From 744f42c5496e656a1f9927740a3b37c0b97a6cba Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:34:12 +0800
Subject: [PATCH] lexcommunityupload0714
---
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls | 1512
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls | 264
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html | 67
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js | 824
force-app/main/default/lwc/lexTopPage/lexTopPage.js | 1518
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css | 15
force-app/main/default/classes/LexConsumableControllerTest.cls | 2089
force-app/main/default/classes/LexProductLimitEditControllerTest.cls | 107
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js | 36
force-app/main/default/classes/LexInventoryViewControllerTest.cls | 2023
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html | 456
force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml | 2
manifest/LEXC02packagelexcommunityupdate.xml | 4
force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml | 2
force-app/main/default/lwc/customOutputGood/customOutputGood.html | 2
force-app/main/default/classes/LexConsumableGoodsInfoTest.cls | 1844
force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml | 2
force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml | 2
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css | 130
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js | 1244
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls | 363
force-app/main/default/classes/LexSearchHospitalControllerTest.cls | 14
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp | 14
force-app/main/default/lwc/paginator/paginator.html | 4
force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml | 2
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc | 6
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml | 2
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js | 7360 +--
.sf/config.json | 2
force-app/main/default/classes/LexOutboundorderImportController.cls | 1920
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml | 2
force-app/main/default/classes/LexConsumableAccountControllerTest.cls | 306
force-app/main/default/classes/LexInventoryControllerTest.cls | 1837
force-app/main/default/classes/LexInventoryListControllerTest.cls | 268
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html | 8
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml | 2
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp | 1616
force-app/main/default/classes/LexSummonsCreatControllerTest.cls | 6097 +-
force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml | 2
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html | 1
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls | 222
force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexConInvoiceListTest.cls | 284
force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml | 6
force-app/main/default/classes/LexArriveGoodsMainController.cls | 2
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/paginator/paginator.js | 15
force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml | 2
force-app/main/default/classes/LexConInvoiceViewController.cls | 3541
force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls | 150
force-app/main/default/aura/WeeklyReport/WeeklyReportController.js | 630
force-app/main/default/lwc/lexInventory/lexInventory.js | 4
force-app/main/default/classes/LookupSearchResultTest.cls | 94
force-app/main/default/classes/LexUtilityTest.cls | 31
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp | 2056
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml | 5
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html | 495
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js | 83
force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp | 20
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css | 12
force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml | 4
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls | 112
force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml | 2
force-app/main/default/classes/LexSearchContractControllerTest.cls | 107
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml | 4
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml | 2
force-app/main/default/classes/Batch_FixAttachmentToFiles.cls | 194
force-app/main/default/aura/WeeklyReport/WeeklyReport.css | 159
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js | 703
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexSummonsCreatController.cls | 6292 +-
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexOverdueStockController.cls | 819
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js | 24
force-app/main/default/classes/LexInventoryListController.cls | 242
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js | 4
force-app/main/default/classes/ResponseBodyLWCTest.cls | 22
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexOverdueStockControllerTest.cls | 401
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js | 4085 +
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js | 396
force-app/main/default/classes/LexArriveGoodsControllerTest.cls | 773
force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/customMydrComp/customMydrComp.js | 24
force-app/main/default/classes/LexConsumableAccountController.cls | 956
force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml | 2
force-app/main/default/classes/ArriveGoodsController.cls | 10046 ++---
force-app/main/default/classes/LexConsumableOrderManageController.cls | 687
force-app/main/default/classes/LexSaleOrderController.cls | 2838
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html | 1
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/lexTopPage/lexTopPage.html | 371
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls | 227
force-app/main/default/classes/LexSaleOrderControllerTest.cls | 3026
force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml | 2
force-app/main/default/classes/DealerInquiryModifyStateController.cls | 1315
force-app/main/default/classes/LexLicenceReminderControllerTest.cls | 323
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml | 4
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls | 6411 +--
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls | 155
force-app/main/default/classes/LexInventoryController.cls | 3230
force-app/main/default/classes/LexUpAccountProLimit.cls | 306
force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml | 2
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls | 163
force-app/main/default/classes/LexConsumableController.cls | 4960 +-
force-app/main/default/lwc/customMydrComp/customMydrComp.html | 12
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js | 5859 +-
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls | 659
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml | 2
force-app/main/default/pages/DealerInquiryModifyState.page | 1356
force-app/main/default/aura/CreateTarget/CreateTarget.css | 14
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls | 992
force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls | 843
force-app/main/default/classes/LexCancelRemoveBoxController.cls | 1365
force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml | 2
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html | 16
force-app/main/default/lwc/lexInventory/lexInventory.html | 2
force-app/main/default/classes/LexRemoveBoxControllerTest.cls | 1270
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp | 23
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml | 2
force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexTopPageControllerTest.cls | 732
force-app/main/default/classes/LexConsumableAccountSOQL.cls | 67
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp | 71
force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html | 2319
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls | 393
force-app/main/default/aura/AgencyAccount/AgencyAccount.css | 13
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html | 809
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js | 4
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml | 2
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js | 56
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js | 1674
force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml | 2
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml | 2
force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml | 2
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger | 1444
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design | 3
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js | 1034
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | 4
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls | 29
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg | 7
force-app/main/default/lwc/lexConsumable/lexConsumable.js | 4
force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml | 2
force-app/main/default/lwc/lexConsumable/lexConsumable.html | 2
force-app/main/default/triggers/ContentDocumentTrigger.trigger | 3
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls | 373
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html | 4
force-app/main/default/triggers/ContentDocumentLink.trigger | 3
force-app/main/default/classes/ArriveGoodsControllerTest.cls | 6484 +-
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js | 9
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml | 2
force-app/main/default/classes/LexConInvoicedetailsController.cls | 869
force-app/main/default/classes/LexUtilityTest.cls-meta.xml | 2
force-app/main/default/aura/CreateTarget/CreateTarget.cmp | 947
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js | 4
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js | 5
163 files changed, 51,340 insertions(+), 67,502 deletions(-)
diff --git a/.sf/config.json b/.sf/config.json
index 090aeab..3debff0 100644
--- a/.sf/config.json
+++ b/.sf/config.json
@@ -1,3 +1,3 @@
{
- "target-org": "OlympusProd"
+ "target-org": "OlympusStageEnv"
}
\ No newline at end of file
diff --git a/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp b/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp
index 486b5df..ad1a5d5 100644
--- a/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp
+++ b/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp
@@ -12,13 +12,16 @@
<ltng:require scripts="{! $Resource.jquery183minjs }" />
<ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" afterScriptsLoaded="{!c.scriptsLoaded}" />
<aura:renderIf isTrue="{!v.login}">
- <div class="slds-spinner_container height100vh">
- <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
- <span class="slds-assistive-text">Loading</span>
- <div class="slds-spinner__dot-a"></div>
- <div class="slds-spinner__dot-b"></div>
- </div>
- </div>
+ <!-- add by Deloitte-Link 2023-6-19 -->
+ <div class="weeklyReportSpinner">
+ <div class="slds-spinner_container">
+ <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
+ <span id="aa" class="slds-assistive-text">Loading</span>
+ <div class="slds-spinner__dot-a"></div>
+ <div class="slds-spinner__dot-b"></div>
+ </div>
+ </div>
+ </div>
</aura:renderIf>
<form class="slds-form--inline">
<div class="slds-form-element">
@@ -77,7 +80,8 @@
<div class="slds-truncate">
<a href="{!'/partner/s/agency-contact/' + item.Id}" style="position: relative;">
- {!item.Name}
+ <span class="encrypt">{!item.Name}</span>
+ <span class="decrypt">{!item.awsdata.name}</span>
</a>
</div>
</th>
diff --git a/force-app/main/default/aura/AgencyAccount/AgencyAccount.css b/force-app/main/default/aura/AgencyAccount/AgencyAccount.css
index c5abf53..b5a3e56 100644
--- a/force-app/main/default/aura/AgencyAccount/AgencyAccount.css
+++ b/force-app/main/default/aura/AgencyAccount/AgencyAccount.css
@@ -18,4 +18,15 @@
.THIS tr:hover .encrypt{
display: none;
-}
\ No newline at end of file
+}
+
+/* add by Deloitte-Link 2023-6-19 start*/
+.THIS .weeklyReportSpinner{
+ top:100px;
+}
+
+.THIS .slds-spinner_container{
+ position: absolute;
+ top:100px;
+}
+/* add by Deloitte-Link 2023-6-19 end*/
\ No newline at end of file
diff --git a/force-app/main/default/aura/CreateTarget/CreateTarget.cmp b/force-app/main/default/aura/CreateTarget/CreateTarget.cmp
index 3bd31c0..a3de553 100644
--- a/force-app/main/default/aura/CreateTarget/CreateTarget.cmp
+++ b/force-app/main/default/aura/CreateTarget/CreateTarget.cmp
@@ -1,642 +1,321 @@
-<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="" />
- <aura:attribute name="test" type="string" default="1" />
- <aura:handler event="force:refreshView" action="{!c.isRefreshed}" />
- <aura:attribute name="hospitalId" type="string" default="" />
- <aura:attribute name="GIAmount" type="string" default="0.00" />
- <aura:attribute name="BFAmount" type="string" default="0.00" />
- <aura:attribute name="ETAmount" type="string" default="0.00" />
- <aura:attribute name="GSAmount" type="string" default="0.00" />
- <aura:attribute name="UROAmount" type="string" default="0.00" />
- <aura:attribute name="GYNAmount" type="string" default="0.00" />
- <aura:attribute name="ENTAmount" type="string" default="0.00" />
- <aura:attribute name="OTHAmount" type="string" default="0.00" />
- <aura:attribute name="OCMTerm" type="string" default="" />
- <aura:attribute name="button_text" type="string" default="鏂板缓" />
- <aura:handler
- name="change"
- value="{!v.record.Agency_Hospital__c}"
- action="{!c.hosChange}"
- />
- <aura:attribute name="hospitalList" type="sobject[]" />
- <aura:attribute
- name="record"
- type="Agency_Opportunity__c"
- default="{'sobjectType':'Agency_Opportunity__c'}"
- />
- <aura:handler
- name="change"
- value="{!v.recordET.Product_Category1__c}"
- action="{!c.productcategoryETChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordET.Product_Category2__c}"
- action="{!c.productcategoryETChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordET.Product_Category3__c}"
- action="{!c.productcategoryETChange3}"
- />
+<aura: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=""/>
+ <aura:attribute name="test" type="string" default="1"/>
+ <aura:handler event="force:refreshView" action="{!c.isRefreshed}" />
+ <aura:attribute name="hospitalId" type="string" default=""/>
+ <aura:attribute name="GIAmount" type="string" default="0.00"/>
+ <aura:attribute name="BFAmount" type="string" default="0.00"/>
+ <aura:attribute name="ETAmount" type="string" default="0.00"/>
+ <aura:attribute name="GSAmount" type="string" default="0.00"/>
+ <aura:attribute name="UROAmount" type="string" default="0.00"/>
+ <aura:attribute name="GYNAmount" type="string" default="0.00"/>
+ <aura:attribute name="ENTAmount" type="string" default="0.00"/>
+ <aura:attribute name="OTHAmount" type="string" default="0.00"/>
+ <aura:attribute name="OCMTerm" type="string" default=""/>
+ <aura:attribute name="button_text" type="string" default="鏂板缓"/>
+ <aura:handler name="change" value="{!v.record.Agency_Hospital__c}" action="{!c.hosChange}"/>
+ <aura:attribute name="hospitalList" type="sobject[]" />
+ <aura:attribute name="record" type="Agency_Opportunity__c" default="{'sobjectType':'Agency_Opportunity__c'}"/>
+ <aura:handler name="change" value="{!v.recordET.Product_Category1__c}" action="{!c.productcategoryETChange1}"/>
+ <aura:handler name="change" value="{!v.recordET.Product_Category2__c}" action="{!c.productcategoryETChange2}"/>
+ <aura:handler name="change" value="{!v.recordET.Product_Category3__c}" action="{!c.productcategoryETChange3}"/>
+
- <aura:handler
- name="change"
- value="{!v.recordBF.Product_Category1__c}"
- action="{!c.productcategoryBFChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordBF.Product_Category2__c}"
- action="{!c.productcategoryBFChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordBF.Product_Category3__c}"
- action="{!c.productcategoryBFChange3}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGS.Product_Category1__c}"
- action="{!c.productcategoryGSChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGS.Product_Category2__c}"
- action="{!c.productcategoryGSChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGS.Product_Category3__c}"
- action="{!c.productcategoryGSChange3}"
- />
- <aura:handler
- name="change"
- value="{!v.recordURO.Product_Category1__c}"
- action="{!c.productcategoryUROChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordURO.Product_Category2__c}"
- action="{!c.productcategoryUROChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordURO.Product_Category3__c}"
- action="{!c.productcategoryUROChange3}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGYN.Product_Category1__c}"
- action="{!c.productcategoryGYNChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGYN.Product_Category2__c}"
- action="{!c.productcategoryGYNChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordGYN.Product_Category3__c}"
- action="{!c.productcategoryGYNChange3}"
- />
- <aura:handler
- name="change"
- value="{!v.recordENT.Product_Category1__c}"
- action="{!c.productcategoryENTChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordENT.Product_Category2__c}"
- action="{!c.productcategoryENTChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordENT.Product_Category3__c}"
- action="{!c.productcategoryENTChange3}"
- />
- <aura:handler
- name="change"
- value="{!v.recordOTH.Product_Category1__c}"
- action="{!c.productcategoryOTHChange1}"
- />
- <aura:handler
- name="change"
- value="{!v.recordOTH.Product_Category2__c}"
- action="{!c.productcategoryOTHChange2}"
- />
- <aura:handler
- name="change"
- value="{!v.recordOTH.Product_Category3__c}"
- action="{!c.productcategoryOTHChange3}"
- />
- <div class="button_area">
- <ui:button label="{!v.button_text}" press="{!c.toggle_report}" />
- </div>
- <div
- aura:id="modal_window"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- aria-labelledby="headerTarget"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <button
- class="slds-button slds-modal__close slds-button--icon-inverse"
- title="Close"
- onclick="{!c.toggle_report}"
- >
- <lightning:icon
- iconName="utility:close"
- size="medium"
- alternative-text="close"
- variant="inverse"
- />
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鐩爣({!v.OCMTerm})
- </h2>
- </div>
- <div class="slds-modal__content slds-grow slds-p-around--medium">
- <div class="slds-box slds-theme--shade">
- <fieldset class="slds-form--compound">
- <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"
- >
- <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>
+ <aura:handler name="change" value="{!v.recordBF.Product_Category1__c}" action="{!c.productcategoryBFChange1}"/>
+ <aura:handler name="change" value="{!v.recordBF.Product_Category2__c}" action="{!c.productcategoryBFChange2}"/>
+ <aura:handler name="change" value="{!v.recordBF.Product_Category3__c}" action="{!c.productcategoryBFChange3}"/>
+ <aura:handler name="change" value="{!v.recordGS.Product_Category1__c}" action="{!c.productcategoryGSChange1}"/>
+ <aura:handler name="change" value="{!v.recordGS.Product_Category2__c}" action="{!c.productcategoryGSChange2}"/>
+ <aura:handler name="change" value="{!v.recordGS.Product_Category3__c}" action="{!c.productcategoryGSChange3}"/>
+ <aura:handler name="change" value="{!v.recordURO.Product_Category1__c}" action="{!c.productcategoryUROChange1}"/>
+ <aura:handler name="change" value="{!v.recordURO.Product_Category2__c}" action="{!c.productcategoryUROChange2}"/>
+ <aura:handler name="change" value="{!v.recordURO.Product_Category3__c}" action="{!c.productcategoryUROChange3}"/>
+ <aura:handler name="change" value="{!v.recordGYN.Product_Category1__c}" action="{!c.productcategoryGYNChange1}"/>
+ <aura:handler name="change" value="{!v.recordGYN.Product_Category2__c}" action="{!c.productcategoryGYNChange2}"/>
+ <aura:handler name="change" value="{!v.recordGYN.Product_Category3__c}" action="{!c.productcategoryGYNChange3}"/>
+ <aura:handler name="change" value="{!v.recordENT.Product_Category1__c}" action="{!c.productcategoryENTChange1}"/>
+ <aura:handler name="change" value="{!v.recordENT.Product_Category2__c}" action="{!c.productcategoryENTChange2}"/>
+ <aura:handler name="change" value="{!v.recordENT.Product_Category3__c}" action="{!c.productcategoryENTChange3}"/>
+ <aura:handler name="change" value="{!v.recordOTH.Product_Category1__c}" action="{!c.productcategoryOTHChange1}"/>
+ <aura:handler name="change" value="{!v.recordOTH.Product_Category2__c}" action="{!c.productcategoryOTHChange2}"/>
+ <aura:handler name="change" value="{!v.recordOTH.Product_Category3__c}" action="{!c.productcategoryOTHChange3}"/>
+ <div class="button_area">
+ <ui:button label="{!v.button_text}" press="{!c.toggle_report}"/>
+ </div>
+ <div aura:id="modal_window" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.toggle_report}">
+ <lightning:icon iconName="utility:close" size="medium" alternative-text="close" variant="inverse"/>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鐩爣({!v.OCMTerm})</h2>
+ </div>
+ <div class="slds-modal__content slds-grow slds-p-around--medium">
+ <div class="slds-box slds-theme--shade ">
+ <fieldset class="slds-form--compound">
+ <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">
+ <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>
<div class="slds-form-element__row">
<div class="slds-form-element slds-size-1-of-2">
<label class="slds-form-element__label" for="input-target">鐩爣鍖婚櫌</label>
<force:inputField value="{!v.record2.TargetHospital__c}" aura:id="input-target"/>
</div>
</div> -->
- <h4 class="slds-section__title">浜у搧鐩爣</h4>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">娑堝寲绉�</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_GI1"
- class="slds-select"
- change="{!c.productcategoryGIChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GI4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_GI2"
- class="slds-select"
- change="{!c.productcategoryGIChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GI4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_GI3"
- class="slds-select"
- change="{!c.productcategoryGIChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GI4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">ET鑰楁潗</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_ET1"
- class="slds-select"
- change="{!c.productcategoryETChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ET4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_ET2"
- class="slds-select"
- change="{!c.productcategoryETChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ET4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_ET3"
- class="slds-select"
- change="{!c.productcategoryETChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ET4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">鍛煎惛绉�</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_BF1"
- class="slds-select"
- change="{!c.productcategoryBFChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_BF4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_BF2"
- class="slds-select"
- change="{!c.productcategoryBFChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_BF4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_BF3"
- class="slds-select"
- change="{!c.productcategoryBFChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_BF4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">鏅绉�</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_GS1"
- class="slds-select"
- change="{!c.productcategoryGSChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GS4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_GS2"
- class="slds-select"
- change="{!c.productcategoryGSChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GS4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_GS3"
- class="slds-select"
- change="{!c.productcategoryGSChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GS4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">娉屽翱绉�</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_URO1"
- class="slds-select"
- change="{!c.productcategoryUROChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_URO4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_URO2"
- class="slds-select"
- change="{!c.productcategoryUROChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_URO4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_URO3"
- class="slds-select"
- change="{!c.productcategoryUROChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_URO4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">濡囩</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_GYN1"
- class="slds-select"
- change="{!c.productcategoryGYNChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GYN4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_GYN2"
- class="slds-select"
- change="{!c.productcategoryGYNChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GYN4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_GYN3"
- class="slds-select"
- change="{!c.productcategoryGYNChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_GYN4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">鑰抽蓟鍠夌</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_ENT1"
- class="slds-select"
- change="{!c.productcategoryENTChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ENT4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_ENT2"
- class="slds-select"
- change="{!c.productcategoryENTChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ENT4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_ENT3"
- class="slds-select"
- change="{!c.productcategoryENTChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_ENT4_3" class="slds-select" />
- </div>
- </div>
- <div class="slds-form-element__row">
- <div class="slds-size--1-of-7 slds-grid--align-center">
- <div style="margin-top: 32px">鍏朵粬</div>
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎1</label
- >
- <ui:inputSelect
- aura:id="select_OTH1"
- class="slds-select"
- change="{!c.productcategoryOTHChange1}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_OTH4_1" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎2</label
- >
- <ui:inputSelect
- aura:id="select_OTH2"
- class="slds-select"
- change="{!c.productcategoryOTHChange2}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_OTH4_2" class="slds-select" />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >浜у搧鍖哄垎3</label
- >
- <ui:inputSelect
- aura:id="select_OTH3"
- class="slds-select"
- change="{!c.productcategoryOTHChange3}"
- />
- </div>
- <div class="slds-form-element slds-size--1-of-7">
- <label class="slds-form-element__label" for="input-hos"
- >閲戦鐩爣(涓嶅惈绋�)</label
- >
- <ui:inputText aura:id="select_OTH4_3" class="slds-select" />
- </div>
- </div>
- </div>
- </fieldset>
- </div>
- </div>
- <div class="slds-modal__footer slds-grid slds-grid--align-spread">
- <div class="slds-order--1" />
- <ui:button
- aura:id="save_button"
- label="淇濆瓨"
- class="slds-button slds-button--brand slds-order--2"
- press="{!c.createTarget}"
- />
- <div class="slds-order--3" />
- </div>
+ <h4 class="slds-section__title">浜у搧鐩爣</h4>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">娑堝寲绉�</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_GI1" class="slds-select" change="{!c.productcategoryGIChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GI4_1" class="slds-select"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_GI2" class="slds-select" change="{!c.productcategoryGIChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GI4_2" class="slds-select"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_GI3" class="slds-select" change="{!c.productcategoryGIChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GI4_3" class="slds-select"/>
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">ET鑰楁潗</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_ET1" class="slds-select" change="{!c.productcategoryETChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ET4_1" class="slds-select"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_ET2" class="slds-select" change="{!c.productcategoryETChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ET4_2" class="slds-select"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_ET3" class="slds-select" change="{!c.productcategoryETChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ET4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">鍛煎惛绉�</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_BF1" class="slds-select" change="{!c.productcategoryBFChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_BF4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_BF2" class="slds-select" change="{!c.productcategoryBFChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_BF4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_BF3" class="slds-select" change="{!c.productcategoryBFChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_BF4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">鏅绉�</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_GS1" class="slds-select" change="{!c.productcategoryGSChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GS4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_GS2" class="slds-select" change="{!c.productcategoryGSChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GS4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_GS3" class="slds-select" change="{!c.productcategoryGSChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GS4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">娉屽翱绉�</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_URO1" class="slds-select" change="{!c.productcategoryUROChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_URO4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_URO2" class="slds-select" change="{!c.productcategoryUROChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_URO4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_URO3" class="slds-select" change="{!c.productcategoryUROChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_URO4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">濡囩</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_GYN1" class="slds-select" change="{!c.productcategoryGYNChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GYN4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_GYN2" class="slds-select" change="{!c.productcategoryGYNChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GYN4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_GYN3" class="slds-select" change="{!c.productcategoryGYNChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_GYN4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">鑰抽蓟鍠夌</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_ENT1" class="slds-select" change="{!c.productcategoryENTChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ENT4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_ENT2" class="slds-select" change="{!c.productcategoryENTChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ENT4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_ENT3" class="slds-select" change="{!c.productcategoryENTChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_ENT4_3" class="slds-select" />
+ </div>
+ </div>
+ <div class="slds-form-element__row">
+ <div class="slds-size--1-of-7 slds-grid--align-center">
+ <div style="margin-top: 32px;">鍏朵粬</div>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎1</label>
+ <ui:inputSelect aura:id="select_OTH1" class="slds-select" change="{!c.productcategoryOTHChange1}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_OTH4_1" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎2</label>
+ <ui:inputSelect aura:id="select_OTH2" class="slds-select" change="{!c.productcategoryOTHChange2}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_OTH4_2" class="slds-select" />
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">浜у搧鍖哄垎3</label>
+ <ui:inputSelect aura:id="select_OTH3" class="slds-select" change="{!c.productcategoryOTHChange3}"/>
+ </div>
+ <div class="slds-form-element slds-size--1-of-7">
+ <label class="slds-form-element__label" for="input-hos">閲戦鐩爣(涓嶅惈绋�)</label>
+ <ui:inputText aura:id="select_OTH4_3" class="slds-select" />
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </div>
+ </div>
+ <div class="slds-modal__footer slds-grid slds-grid--align-spread">
+ <div class="slds-order--1" />
+ <ui:button aura:id="save_button" label="淇濆瓨" class="slds-button slds-button--brand slds-order--2" press="{!c.createTarget}"/>
+ <div class="slds-order--3" />
+ </div>
+ </div>
</div>
- </div>
- <div
- aura:id="modal_bg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
-</aura:component>
+ <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+</aura:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml b/force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml
index 171ac69..e7c0133 100644
--- a/force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml
+++ b/force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>42.0</apiVersion>
<description>A Lightning Component Bundle</description>
diff --git a/force-app/main/default/aura/CreateTarget/CreateTarget.css b/force-app/main/default/aura/CreateTarget/CreateTarget.css
index f79adff..68a877a 100644
--- a/force-app/main/default/aura/CreateTarget/CreateTarget.css
+++ b/force-app/main/default/aura/CreateTarget/CreateTarget.css
@@ -1,12 +1,12 @@
.THIS.button_area {
- text-align: right;
+ text-align: right;
}
.THIS.disp_none {
- display: none;
+ display: none;
}
.THIS select {
- --lwc-lineHeightButton: 36px;
- --lwc-heightInput: 36px;
- min-height: 0px !important;
- height: 36px !important;
-}
+ --lwc-lineHeightButton:36px;
+ --lwc-heightInput:36px;
+ min-height: 0px !important;
+ height: 36px !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
index e021d2c..89aea61 100644
--- a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
+++ b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
@@ -1,693 +1,593 @@
({
- doinit: function (component, event, helper) {
- component.set("v.OCMTerm", this.getOCMTerm());
- if (component.get("v.recordId")) {
- component.set("v.button_text", "缂栬緫");
- var recordId = component.get("v.recordId");
- var action = component.get("c.getHospital");
- action.setParams({ recordId: recordId });
- action.setCallback(this, function (response) {
- var state = response.getState();
- console.log("state1:" + state);
- if (state === "SUCCESS") {
- var ah = response.getReturnValue();
- var select_ah = ah.Id;
- var select_ah_name = ah.Name;
- // component.set('v.record.Agency_Hospital__c', select_ah);
- //add by Deloitte 2023-6-8
- 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");
- var values = [
- {
- type: "Agency_Hospital_Link__c",
- id: select_ah,
- label: select_ah_name,
- icon: {
- url: "/img/icon/t4v35/custom/custom24_120.png",
- backgroundColor: "dc71d1",
- alt: "Agency_Hospital_Link__c"
+ doinit : function(component, event, helper) {
+ component.set("v.OCMTerm", this.getOCMTerm());
+ if (component.get("v.recordId")) {
+ component.set("v.button_text", "缂栬緫");
+ var recordId = component.get("v.recordId");
+ var action = component.get("c.getHospital");
+ action.setParams({recordId: recordId});
+ action.setCallback(this, function(response) {
+ var state = response.getState();
+ console.log("state1:"+state);
+ if(state === "SUCCESS") {
+ var ah = response.getReturnValue();
+ var select_ah = ah.Id;
+ var select_ah_name = ah.Name;
+ // component.set('v.record.Agency_Hospital__c', select_ah);
+ //add by Deloitte 2023-6-8
+ 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");
+ var values = [{
+ type: 'Agency_Hospital_Link__c',
+ id: select_ah,
+ label: select_ah_name,
+ icon : {
+ url:'/img/icon/t4v35/custom/custom24_120.png',
+ backgroundColor:'dc71d1',
+ alt:'Agency_Hospital_Link__c'
+ }
+ }];
+ // component.find('input-hos').get("v.body")[0].set('v.values', values);
+ //add by Deloitte 2023-6-8
+ if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
+ component.find('input-hos').get("v.body")[0].set('v.values', values);
+ }
+ } else {
+ // component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
+ //add by Deloitte 2023-6-8
+ if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
+ component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
+ }
+ }
+
+ } else if (state === "ERROR") {
+ var errors = response.getError();
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ "title": "閿欒",
+ "type":"error",
+ "message": errors[0].message
+ });
+ toastEvent.fire();
+
}
- }
- ];
- // component.find('input-hos').get("v.body")[0].set('v.values', values);
- //add by Deloitte 2023-6-8
- if (
- component.find("input-hos").get("v.body") &&
- component.find("input-hos").get("v.body").length > 0
- ) {
- component
- .find("input-hos")
- .get("v.body")[0]
- .set("v.values", values);
+ });
+ $A.enqueueAction(action);
+ }
+
+ var action = component.get("c.getProductList");
+ action.setCallback(this, function(response) {
+ var state = response.getState();
+ console.log("state2:"+state);
+ if(state === "SUCCESS") {
+ var opts = response.getReturnValue();
+ // alert(JSON.stringify(opts["GI"]));
+ component.find("select_GI1").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
+ component.find("select_GI2").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
+ component.find("select_GI3").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
+
+ component.find("select_GS1").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
+ component.find("select_GS2").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
+ component.find("select_GS3").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
+
+ component.find("select_GYN1").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
+ component.find("select_GYN2").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
+ component.find("select_GYN3").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
+
+ component.find("select_URO1").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
+ component.find("select_URO2").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
+ component.find("select_URO3").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
+
+ component.find("select_ENT1").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
+ component.find("select_ENT2").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
+ component.find("select_ENT3").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
+
+ component.find("select_OTH1").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
+ component.find("select_OTH2").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
+ component.find("select_OTH3").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
+
+ component.find("select_ET1").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
+ component.find("select_ET2").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
+ component.find("select_ET3").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
+
+ component.find("select_BF1").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
+ component.find("select_BF2").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
+ component.find("select_BF3").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
+ } else if (state === "ERROR") {
+ var errors = response.getError();
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ title: "閿欒",
+ type:"error",
+ message: errors[0].message
+ });
+ toastEvent.fire();
+
}
- } else {
- // component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
- //add by Deloitte 2023-6-8
- if (
- component.find("input-hos").get("v.body") &&
- component.find("input-hos").get("v.body").length > 0
- ) {
- component
- .find("input-hos")
- .get("v.body")[0]
- .set("v.selectedLabel", select_ah_name);
- }
- }
- } else if (state === "ERROR") {
- var errors = response.getError();
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "閿欒",
- type: "error",
- message: errors[0].message
- });
- toastEvent.fire();
+ });
+ $A.enqueueAction(action);
+ },
+
+ toggle_report : function(component, event, helper) {
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ $A.util.toggleClass(modal_window, 'disp_none');
+ $A.util.toggleClass(modal_bg, 'disp_none');
+
+ if ($A.util.hasClass(modal_window, 'disp_none') && !component.get("v.recordId")) {
+ $A.get('e.force:refreshView').fire();
}
- });
- $A.enqueueAction(action);
- }
+ },
- var action = component.get("c.getProductList");
- action.setCallback(this, function (response) {
- var state = response.getState();
- console.log("state2:" + state);
- if (state === "SUCCESS") {
- var opts = response.getReturnValue();
- // alert(JSON.stringify(opts["GI"]));
- component
- .find("select_GI1")
- .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
- component
- .find("select_GI2")
- .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
- component
- .find("select_GI3")
- .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
+ productcategoryChange : function(component, event, helper, dept, index) {
+ var cmpId = 'select_'+dept;
+ var myId;
+ var o1Id;
+ var o2Id;
+ if (index == 1) {
+ myId = cmpId + '1';
+ o1Id = cmpId + '2';
+ o2Id = cmpId + '3';
+ } else if (index == 2){
+ myId = cmpId + '2';
+ o1Id = cmpId + '1';
+ o2Id = cmpId + '3';
+ } else {
+ myId = cmpId + '3';
+ o1Id = cmpId + '1';
+ o2Id = cmpId + '2';
+ }
- component
- .find("select_GS1")
- .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
- component
- .find("select_GS2")
- .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
- component
- .find("select_GS3")
- .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
+ var product_category_id = component.find(myId).get('v.value');
+ var pcId1 = component.find(o1Id).get('v.value');
+ var pcId2 = component.find(o2Id).get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ this.warning('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ component.find(myId).set('v.value','');
+ }
+ },
- component
- .find("select_GYN1")
- .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
- component
- .find("select_GYN2")
- .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
- component
- .find("select_GYN3")
- .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
+ selectHos : function(component, event, helper) {
- component
- .find("select_URO1")
- .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
- component
- .find("select_URO2")
- .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
- component
- .find("select_URO3")
- .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
+ var accid = component.get("v.record.Agency_Hospital__c");
+ var action = component.get("c.getDeptAmount");
+ action.setParams({ hospitalId : accid });
+ action.setCallback(this, function(response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var amountMap = response.getReturnValue();
+ var GIProduct_Category1 = '';
+ var GIProduct_Category2 = '';
+ var GIProduct_Category3 = '';
+ var GIAim_Price__c1 = '';
+ var GIAim_Price__c2 = '';
+ var GIAim_Price__c3 = '';
+ if (amountMap.GI.length > 0) {
+ GIProduct_Category1 = amountMap.GI[0].Product_Category__c;
+ if (amountMap.GI.length > 1) {
+ GIProduct_Category2 = amountMap.GI[1].Product_Category__c;
+ }
+ if (amountMap.GI.length > 2) {
+ GIProduct_Category3 = amountMap.GI[2].Product_Category__c;
+ }
+ GIAim_Price__c1 = amountMap.GI[0].Aim_Price__c;
+ GIAim_Price__c2 = amountMap.GI[1].Aim_Price__c;
+ GIAim_Price__c3 = amountMap.GI[2].Aim_Price__c;
+ console.warn(GIAim_Price__c1+"-"+GIAim_Price__c2+"-"+GIAim_Price__c3);
- component
- .find("select_ENT1")
- .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
- component
- .find("select_ENT2")
- .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
- component
- .find("select_ENT3")
- .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
+ }
+ component.find('select_GI1').set('v.value',GIProduct_Category1);
+ component.find('select_GI2').set('v.value',GIProduct_Category2);
+ component.find('select_GI3').set('v.value',GIProduct_Category3);
+ component.find('select_GI4_1').set('v.value',GIAim_Price__c1);
+ component.find('select_GI4_2').set('v.value',GIAim_Price__c2);
+ component.find('select_GI4_3').set('v.value',GIAim_Price__c3);
- component
- .find("select_OTH1")
- .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
- component
- .find("select_OTH2")
- .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
- component
- .find("select_OTH3")
- .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
- component
- .find("select_ET1")
- .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
- component
- .find("select_ET2")
- .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
- component
- .find("select_ET3")
- .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
+ var ETProduct_Category1 = '';
+ var ETProduct_Category2 = '';
+ var ETProduct_Category3 = '';
+ var ETAim_Price__c1 = '';
+ var ETAim_Price__c2 = '';
+ var ETAim_Price__c3 = '';
+ if (amountMap.ET.length > 0) {
+ ETProduct_Category1 = amountMap.ET[0].Product_Category__c;
+ if (amountMap.ET.length > 1) {
+ ETProduct_Category2 = amountMap.ET[1].Product_Category__c;
+ }
+ if (amountMap.ET.length > 2) {
+ ETProduct_Category3 = amountMap.ET[2].Product_Category__c;
+ }
+ ETAim_Price__c1 = amountMap.ET[0].Aim_Price__c;
+ ETAim_Price__c2 = amountMap.ET[1].Aim_Price__c;
+ ETAim_Price__c3 = amountMap.ET[2].Aim_Price__c;
+ }
+ component.find('select_ET1').set('v.value',ETProduct_Category1);
+ component.find('select_ET2').set('v.value',ETProduct_Category2);
+ component.find('select_ET3').set('v.value',ETProduct_Category3);
+ component.find('select_ET4_1').set('v.value',ETAim_Price__c1);
+ component.find('select_ET4_2').set('v.value',ETAim_Price__c2);
+ component.find('select_ET4_3').set('v.value',ETAim_Price__c3);
- component
- .find("select_BF1")
- .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
- component
- .find("select_BF2")
- .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
- component
- .find("select_BF3")
- .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
- } else if (state === "ERROR") {
- var errors = response.getError();
+
+ var BFProduct_Category1 = '';
+ var BFProduct_Category2 = '';
+ var BFProduct_Category3 = '';
+ var BFAim_Price__c1 = '';
+ var BFAim_Price__c2 = '';
+ var BFAim_Price__c3 = '';
+ if (amountMap.BF.length > 0) {
+ BFProduct_Category1 = amountMap.BF[0].Product_Category__c;
+ if (amountMap.BF.length > 1) {
+ BFProduct_Category2 = amountMap.BF[1].Product_Category__c;
+ }
+ if (amountMap.BF.length > 2) {
+ BFProduct_Category3 = amountMap.BF[2].Product_Category__c;
+ }
+ BFAim_Price__c1 = amountMap.BF[0].Aim_Price__c;
+ BFAim_Price__c2 = amountMap.BF[1].Aim_Price__c;
+ BFAim_Price__c3 = amountMap.BF[2].Aim_Price__c;
+ }
+ component.find('select_BF1').set('v.value',BFProduct_Category1);
+ component.find('select_BF2').set('v.value',BFProduct_Category2);
+ component.find('select_BF3').set('v.value',BFProduct_Category3);
+ component.find('select_BF4_1').set('v.value',BFAim_Price__c1);
+ component.find('select_BF4_2').set('v.value',BFAim_Price__c2);
+ component.find('select_BF4_3').set('v.value',BFAim_Price__c3);
+
+
+ var OTHProduct_Category1 = '';
+ var OTHProduct_Category2 = '';
+ var OTHProduct_Category3 = '';
+ var OTHAim_Price__c1 = '';
+ var OTHAim_Price__c2 = '';
+ var OTHAim_Price__c3 = '';
+ if (amountMap.OTH.length > 0) {
+
+ OTHProduct_Category1 = amountMap.OTH[0].Product_Category__c;
+ if (amountMap.OTH.length > 1) {
+ OTHProduct_Category2 = amountMap.OTH[1].Product_Category__c;
+ }
+ if (amountMap.OTH.length > 2) {
+ OTHProduct_Category3 = amountMap.OTH[2].Product_Category__c;
+ }
+ OTHAim_Price__c1 = amountMap.OTH[0].Aim_Price__c;
+ OTHAim_Price__c2 = amountMap.OTH[1].Aim_Price__c;
+ OTHAim_Price__c3 = amountMap.OTH[2].Aim_Price__c;
+ }
+ component.find('select_OTH1').set('v.value',OTHProduct_Category1);
+ component.find('select_OTH2').set('v.value',OTHProduct_Category2);
+ component.find('select_OTH3').set('v.value',OTHProduct_Category3);
+ component.find('select_OTH4_1').set('v.value',OTHAim_Price__c1);
+ component.find('select_OTH4_2').set('v.value',OTHAim_Price__c2);
+ component.find('select_OTH4_3').set('v.value',OTHAim_Price__c3);
+
+ var GSProduct_Category1 = '';
+ var GSProduct_Category2 = '';
+ var GSProduct_Category3 = '';
+ var GSPAim_Price__c1 = '';
+ var GSPAim_Price__c2 = '';
+ var GSPAim_Price__c3 = '';
+ if (amountMap.GS.length > 0) {
+ GSProduct_Category1 = amountMap.GS[0].Product_Category__c;
+ if (amountMap.GS.length > 1) {
+ GSProduct_Category2 = amountMap.GS[1].Product_Category__c;
+ }
+ if (amountMap.GS.length > 2) {
+ GSProduct_Category3 = amountMap.GS[2].Product_Category__c;
+ }
+ GSPAim_Price__c1 = amountMap.GS[0].Aim_Price__c;
+ GSPAim_Price__c2 = amountMap.GS[1].Aim_Price__c;
+ GSPAim_Price__c3= amountMap.GS[2].Aim_Price__c;
+ }
+ component.find('select_GS1').set('v.value',GSProduct_Category1);
+ component.find('select_GS2').set('v.value',GSProduct_Category2);
+ component.find('select_GS3').set('v.value',GSProduct_Category3);
+ component.find('select_GS4_1').set('v.value',GSPAim_Price__c1);
+ component.find('select_GS4_2').set('v.value',GSPAim_Price__c2);
+ component.find('select_GS4_3').set('v.value',GSPAim_Price__c3);
+
+ var UROProduct_Category1 = '';
+ var UROProduct_Category2 = '';
+ var UROProduct_Category3 = '';
+ var UROAim_Price__c1 = '';
+ var UROAim_Price__c2 = '';
+ var UROAim_Price__c3 = '';
+ if (amountMap.URO.length > 0) {
+
+ UROProduct_Category1 = amountMap.URO[0].Product_Category__c;
+ if (amountMap.URO.length > 1) {
+ UROProduct_Category2 = amountMap.URO[1].Product_Category__c;
+ }
+ if (amountMap.URO.length > 2) {
+ UROProduct_Category3 = amountMap.URO[2].Product_Category__c;
+ }
+ UROAim_Price__c1 = amountMap.URO[0].Aim_Price__c;
+ UROAim_Price__c2 = amountMap.URO[1].Aim_Price__c;
+ UROAim_Price__c3 = amountMap.URO[2].Aim_Price__c;
+ }
+ component.find('select_URO1').set('v.value',UROProduct_Category1);
+ component.find('select_URO2').set('v.value',UROProduct_Category2);
+ component.find('select_URO3').set('v.value',UROProduct_Category3);
+ component.find('select_URO4_1').set('v.value',UROAim_Price__c1);
+ component.find('select_URO4_2').set('v.value',UROAim_Price__c2);
+ component.find('select_URO4_3').set('v.value',UROAim_Price__c3);
+
+
+ var GYNProduct_Category1 = '';
+ var GYNProduct_Category2 = '';
+ var GYNProduct_Category3 = '';
+ var GYNAim_Price__c1 = '';
+ var GYNAim_Price__c2 = '';
+ var GYNAim_Price__c3 = '';
+ if (amountMap.GYN.length > 0) {
+
+ GYNProduct_Category1 = amountMap.GYN[0].Product_Category__c;
+ if (amountMap.GYN.length > 1) {
+ GYNProduct_Category2 = amountMap.GYN[1].Product_Category__c;
+ }
+ if (amountMap.GYN.length > 2) {
+ GYNProduct_Category3 = amountMap.GYN[2].Product_Category__c;
+ }
+ GYNAim_Price__c1= amountMap.GYN[0].Aim_Price__c;
+ GYNAim_Price__c2 = amountMap.GYN[1].Aim_Price__c;
+ GYNAim_Price__c3 = amountMap.GYN[2].Aim_Price__c;
+ }
+ component.find('select_GYN1').set('v.value',GYNProduct_Category1);
+ component.find('select_GYN2').set('v.value',GYNProduct_Category2);
+ component.find('select_GYN3').set('v.value',GYNProduct_Category3);
+ component.find('select_GYN4_1').set('v.value',GYNAim_Price__c1);
+ component.find('select_GYN4_2').set('v.value',GYNAim_Price__c2);
+ component.find('select_GYN4_3').set('v.value',GYNAim_Price__c3);
+
+
+ var ENTProduct_Category1 = '';
+ var ENTProduct_Category2 = '';
+ var ENTProduct_Category3 = '';
+ var ENTAim_Price__c1 = '';
+ var ENTAim_Price__c2 = '';
+ var ENTAim_Price__c3 = '';
+ if (amountMap.ENT.length > 0) {
+
+ ENTProduct_Category1 = amountMap.ENT[0].Product_Category__c;
+ if (amountMap.ENT.length > 1) {
+ ENTProduct_Category2 = amountMap.ENT[1].Product_Category__c;
+ }
+ if (amountMap.ENT.length > 2) {
+ ENTProduct_Category3 = amountMap.ENT[2].Product_Category__c;
+ }
+ ENTAim_Price__c1 = amountMap.ENT[0].Aim_Price__c;
+ ENTAim_Price__c2 = amountMap.ENT[1].Aim_Price__c;
+ ENTAim_Price__c3 = amountMap.ENT[2].Aim_Price__c;
+ }
+ component.find('select_ENT1').set('v.value',ENTProduct_Category1);
+ component.find('select_ENT2').set('v.value',ENTProduct_Category2);
+ component.find('select_ENT3').set('v.value',ENTProduct_Category3);
+ component.find('select_ENT4_1').set('v.value',ENTAim_Price__c1);
+ component.find('select_ENT4_2').set('v.value',ENTAim_Price__c2);
+ component.find('select_ENT4_3').set('v.value',ENTAim_Price__c3);
+
+ }
+ });
+ $A.enqueueAction(action);
+ console.log(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v')));
+ },
+
+ getOCMTerm : function() {
+ var today = new Date();
+ var year = today.getFullYear();
+ var month = today.getMonth();
+
+ if (month < 3) year -= 1;
+ var thisYearOCMPeriod = String(year - 1867) + 'P';
+
+ return thisYearOCMPeriod;
+ },
+
+ createTarget : function(component, event, helper) {
+ var action = component.get("c.createSFTarget");
+ // alert(component.get("v.GIAmount"));
+
+
+
+ var p1_1 = component.find('select_GI4_1').get('v.value') ;
+ var p1_2 = component.find('select_GI4_2').get('v.value') ;
+ var p1_3 = component.find('select_GI4_3').get('v.value') ;
+
+ if (p1_1 == undefined || p1_1 == "") {
+ p1_1 = 0;
+ }
+ if (p1_2 == undefined || p1_2 == "") {
+ p1_2 = 0;
+ }
+ if (p1_3 == undefined || p1_3 == "") {
+ p1_3 = 0;
+ }
+ console.warn(p1_1+"-"+p1_2+"-"+p1_3);
+
+ var p2_1 = component.find('select_ET4_1').get('v.value') ;
+ var p2_2 = component.find('select_ET4_2').get('v.value') ;
+ var p2_3 = component.find('select_ET4_3').get('v.value') ;
+ if (p2_1 == undefined || p2_1 == "") {
+ p2_1 = 0;
+ }
+ if (p2_2 == undefined || p2_2 == "") {
+ p2_2 = 0;
+ }
+ if (p2_3 == undefined || p2_3 == "") {
+ p2_3 = 0;
+ }
+
+
+ var p3_1 = component.find('select_BF4_1').get('v.value') ;
+ var p3_2 = component.find('select_BF4_2').get('v.value') ;
+ var p3_3 = component.find('select_BF4_3').get('v.value') ;
+ if (p3_1 == undefined || p3_1 == "") {
+ p3_1 = 0;
+ }
+ if (p3_2 == undefined || p3_2 == "") {
+ p3_2 = 0;
+ }
+ if (p3_3 == undefined || p3_3 == "") {
+ p3_3 = 0;
+ }
+
+
+
+ var p4_1 = component.find('select_OTH4_1').get('v.value') ;
+ var p4_2 = component.find('select_OTH4_2').get('v.value') ;
+ var p4_3 = component.find('select_OTH4_3').get('v.value') ;
+ if (p4_1 == undefined || p4_1 == "") {
+ p4_1 = 0;
+ }
+ if (p4_2 == undefined || p4_2 == "") {
+ p4_2 = 0;
+ }
+ if (p4_3 == undefined || p4_3 == "") {
+ p4_3 = 0;
+ }
+
+
+
+ var p5_1 = component.find('select_GS4_1').get('v.value') ;
+ var p5_2 = component.find('select_GS4_2').get('v.value') ;
+ var p5_3 = component.find('select_GS4_3').get('v.value') ;
+ if (p5_1 == undefined || p5_1 == "") {
+ p5_1 = 0;
+ }
+ if (p5_2 == undefined || p5_2 == "") {
+ p5_2 = 0;
+ }
+ if (p5_3 == undefined || p5_3 == "") {
+ p5_3 = 0;
+ }
+
+
+
+ var p6_1 = component.find('select_URO4_1').get('v.value') ;
+ var p6_2 = component.find('select_URO4_2').get('v.value') ;
+ var p6_3 = component.find('select_URO4_3').get('v.value') ;
+ if (p6_1 == undefined || p6_1 == "") {
+ p6_1 = 0;
+ }
+ if (p6_2 == undefined || p6_2 == "") {
+ p6_2 = 0;
+ }
+ if (p6_3 == undefined || p6_3 == "") {
+ p6_3 = 0;
+ }
+
+ var p7_1 = component.find('select_GYN4_1').get('v.value') ;
+ var p7_2 = component.find('select_GYN4_2').get('v.value') ;
+ var p7_3 = component.find('select_GYN4_3').get('v.value') ;
+ if (p7_1 == undefined || p7_1 == "") {
+ p7_1 = 0;
+ }
+ if (p7_2 == undefined || p7_2 == "") {
+ p7_2 = 0;
+ }
+ if (p7_3 == undefined || p7_3 == "") {
+ p7_3 = 0;
+ }
+
+
+
+ var p8_1 = component.find('select_ENT4_1').get('v.value') ;
+ var p8_2 = component.find('select_ENT4_2').get('v.value') ;
+ var p8_3 = component.find('select_ENT4_3').get('v.value') ;
+ if (p8_1 == undefined || p8_1 == "") {
+ p8_1 = 0;
+ }
+ if (p8_2 == undefined || p8_2 == "") {
+ p8_2 = 0;
+ }
+ if (p8_3 == undefined || p8_3 == "") {
+ p8_3 = 0;
+ }
+
+
+
+
+ action.setParams({
+ "hospitalId" : component.get("v.record.Agency_Hospital__c"),
+ "GIProduct" : [component.find('select_GI1').get('v.value'),component.find('select_GI2').get('v.value'),component.find('select_GI3').get('v.value'),p1_1,p1_2,p1_3],
+ "ETProduct" : [component.find('select_ET1').get('v.value'),component.find('select_ET2').get('v.value'),component.find('select_ET3').get('v.value'),p2_1, p2_2,p2_3 ],
+ "BFProduct" : [component.find('select_BF1').get('v.value'),component.find('select_BF2').get('v.value'),component.find('select_BF3').get('v.value'),p3_1 ,p3_2 ,p3_3 ],
+ "OTHProduct" : [component.find('select_OTH1').get('v.value'),component.find('select_OTH2').get('v.value'),component.find('select_OTH3').get('v.value'),p4_1,p4_2 ,p4_3],
+ "GSProduct" : [component.find('select_GS1').get('v.value'),component.find('select_GS2').get('v.value'),component.find('select_GS3').get('v.value'),p5_1,p5_2,p5_3],
+ "UROProduct" : [component.find('select_URO1').get('v.value'),component.find('select_URO2').get('v.value'),component.find('select_URO3').get('v.value'),p6_1,p6_2 ,p6_2 ],
+ "GYNProduct" : [component.find('select_GYN1').get('v.value'),component.find('select_GYN2').get('v.value'),component.find('select_GYN3').get('v.value'),p7_1,p7_2 ,p7_3 ],
+ "ENTProduct" : [component.find('select_ENT1').get('v.value'),component.find('select_ENT2').get('v.value'),component.find('select_ENT3').get('v.value'),p8_1 ,p8_2 ,p8_3],
+ "OCMTerm" : component.get("v.OCMTerm")
+ });
+ action.setCallback(this, function(response) {
+ console.warn(response);
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ $A.util.toggleClass(modal_window, 'disp_none');
+ $A.util.toggleClass(modal_bg, 'disp_none');
+
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ title: "鎴愬姛",
+ type:"success",
+ message: "淇濆瓨鎴愬姛"
+ });
+ toastEvent.fire();
+
+ $A.get('e.force:refreshView').fire();
+ } else if (state === "INCOMPLETE") {
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ title: "鏈畬鎴�!",
+ type:"error",
+ message: "鏈畬鎴�"
+ });
+ toastEvent.fire();
+ } else if (state === "ERROR") {
+ var errors = response.getError();
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ title: "閿欒",
+ type:"error",
+ message: errors[0].message
+ });
+ toastEvent.fire();
+
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ warning : function(message) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
- title: "閿欒",
- type: "error",
- message: errors[0].message
+ title: "璀﹀憡!",
+ message: message,
+ type:"warning",
+ duration : "10000"
});
toastEvent.fire();
- }
- });
- $A.enqueueAction(action);
- },
-
- toggle_report: function (component, event, helper) {
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- $A.util.toggleClass(modal_window, "disp_none");
- $A.util.toggleClass(modal_bg, "disp_none");
-
- if (
- $A.util.hasClass(modal_window, "disp_none") &&
- !component.get("v.recordId")
- ) {
- $A.get("e.force:refreshView").fire();
- }
- },
-
- productcategoryChange: function (component, event, helper, dept, index) {
- var cmpId = "select_" + dept;
- var myId;
- var o1Id;
- var o2Id;
- if (index == 1) {
- myId = cmpId + "1";
- o1Id = cmpId + "2";
- o2Id = cmpId + "3";
- } else if (index == 2) {
- myId = cmpId + "2";
- o1Id = cmpId + "1";
- o2Id = cmpId + "3";
- } else {
- myId = cmpId + "3";
- o1Id = cmpId + "1";
- o2Id = cmpId + "2";
- }
-
- var product_category_id = component.find(myId).get("v.value");
- var pcId1 = component.find(o1Id).get("v.value");
- var pcId2 = component.find(o2Id).get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- this.warning("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- component.find(myId).set("v.value", "");
- }
- },
-
- selectHos: function (component, event, helper) {
- var accid = component.get("v.record.Agency_Hospital__c");
- var action = component.get("c.getDeptAmount");
- action.setParams({ hospitalId: accid });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var amountMap = response.getReturnValue();
- var GIProduct_Category1 = "";
- var GIProduct_Category2 = "";
- var GIProduct_Category3 = "";
- var GIAim_Price__c1 = "";
- var GIAim_Price__c2 = "";
- var GIAim_Price__c3 = "";
- if (amountMap.GI.length > 0) {
- GIProduct_Category1 = amountMap.GI[0].Product_Category__c;
- if (amountMap.GI.length > 1) {
- GIProduct_Category2 = amountMap.GI[1].Product_Category__c;
- }
- if (amountMap.GI.length > 2) {
- GIProduct_Category3 = amountMap.GI[2].Product_Category__c;
- }
- GIAim_Price__c1 = amountMap.GI[0].Aim_Price__c;
- GIAim_Price__c2 = amountMap.GI[1].Aim_Price__c;
- GIAim_Price__c3 = amountMap.GI[2].Aim_Price__c;
- console.warn(
- GIAim_Price__c1 + "-" + GIAim_Price__c2 + "-" + GIAim_Price__c3
- );
- }
- component.find("select_GI1").set("v.value", GIProduct_Category1);
- component.find("select_GI2").set("v.value", GIProduct_Category2);
- component.find("select_GI3").set("v.value", GIProduct_Category3);
- component.find("select_GI4_1").set("v.value", GIAim_Price__c1);
- component.find("select_GI4_2").set("v.value", GIAim_Price__c2);
- component.find("select_GI4_3").set("v.value", GIAim_Price__c3);
-
- var ETProduct_Category1 = "";
- var ETProduct_Category2 = "";
- var ETProduct_Category3 = "";
- var ETAim_Price__c1 = "";
- var ETAim_Price__c2 = "";
- var ETAim_Price__c3 = "";
- if (amountMap.ET.length > 0) {
- ETProduct_Category1 = amountMap.ET[0].Product_Category__c;
- if (amountMap.ET.length > 1) {
- ETProduct_Category2 = amountMap.ET[1].Product_Category__c;
- }
- if (amountMap.ET.length > 2) {
- ETProduct_Category3 = amountMap.ET[2].Product_Category__c;
- }
- ETAim_Price__c1 = amountMap.ET[0].Aim_Price__c;
- ETAim_Price__c2 = amountMap.ET[1].Aim_Price__c;
- ETAim_Price__c3 = amountMap.ET[2].Aim_Price__c;
- }
- component.find("select_ET1").set("v.value", ETProduct_Category1);
- component.find("select_ET2").set("v.value", ETProduct_Category2);
- component.find("select_ET3").set("v.value", ETProduct_Category3);
- component.find("select_ET4_1").set("v.value", ETAim_Price__c1);
- component.find("select_ET4_2").set("v.value", ETAim_Price__c2);
- component.find("select_ET4_3").set("v.value", ETAim_Price__c3);
-
- var BFProduct_Category1 = "";
- var BFProduct_Category2 = "";
- var BFProduct_Category3 = "";
- var BFAim_Price__c1 = "";
- var BFAim_Price__c2 = "";
- var BFAim_Price__c3 = "";
- if (amountMap.BF.length > 0) {
- BFProduct_Category1 = amountMap.BF[0].Product_Category__c;
- if (amountMap.BF.length > 1) {
- BFProduct_Category2 = amountMap.BF[1].Product_Category__c;
- }
- if (amountMap.BF.length > 2) {
- BFProduct_Category3 = amountMap.BF[2].Product_Category__c;
- }
- BFAim_Price__c1 = amountMap.BF[0].Aim_Price__c;
- BFAim_Price__c2 = amountMap.BF[1].Aim_Price__c;
- BFAim_Price__c3 = amountMap.BF[2].Aim_Price__c;
- }
- component.find("select_BF1").set("v.value", BFProduct_Category1);
- component.find("select_BF2").set("v.value", BFProduct_Category2);
- component.find("select_BF3").set("v.value", BFProduct_Category3);
- component.find("select_BF4_1").set("v.value", BFAim_Price__c1);
- component.find("select_BF4_2").set("v.value", BFAim_Price__c2);
- component.find("select_BF4_3").set("v.value", BFAim_Price__c3);
-
- var OTHProduct_Category1 = "";
- var OTHProduct_Category2 = "";
- var OTHProduct_Category3 = "";
- var OTHAim_Price__c1 = "";
- var OTHAim_Price__c2 = "";
- var OTHAim_Price__c3 = "";
- if (amountMap.OTH.length > 0) {
- OTHProduct_Category1 = amountMap.OTH[0].Product_Category__c;
- if (amountMap.OTH.length > 1) {
- OTHProduct_Category2 = amountMap.OTH[1].Product_Category__c;
- }
- if (amountMap.OTH.length > 2) {
- OTHProduct_Category3 = amountMap.OTH[2].Product_Category__c;
- }
- OTHAim_Price__c1 = amountMap.OTH[0].Aim_Price__c;
- OTHAim_Price__c2 = amountMap.OTH[1].Aim_Price__c;
- OTHAim_Price__c3 = amountMap.OTH[2].Aim_Price__c;
- }
- component.find("select_OTH1").set("v.value", OTHProduct_Category1);
- component.find("select_OTH2").set("v.value", OTHProduct_Category2);
- component.find("select_OTH3").set("v.value", OTHProduct_Category3);
- component.find("select_OTH4_1").set("v.value", OTHAim_Price__c1);
- component.find("select_OTH4_2").set("v.value", OTHAim_Price__c2);
- component.find("select_OTH4_3").set("v.value", OTHAim_Price__c3);
-
- var GSProduct_Category1 = "";
- var GSProduct_Category2 = "";
- var GSProduct_Category3 = "";
- var GSPAim_Price__c1 = "";
- var GSPAim_Price__c2 = "";
- var GSPAim_Price__c3 = "";
- if (amountMap.GS.length > 0) {
- GSProduct_Category1 = amountMap.GS[0].Product_Category__c;
- if (amountMap.GS.length > 1) {
- GSProduct_Category2 = amountMap.GS[1].Product_Category__c;
- }
- if (amountMap.GS.length > 2) {
- GSProduct_Category3 = amountMap.GS[2].Product_Category__c;
- }
- GSPAim_Price__c1 = amountMap.GS[0].Aim_Price__c;
- GSPAim_Price__c2 = amountMap.GS[1].Aim_Price__c;
- GSPAim_Price__c3 = amountMap.GS[2].Aim_Price__c;
- }
- component.find("select_GS1").set("v.value", GSProduct_Category1);
- component.find("select_GS2").set("v.value", GSProduct_Category2);
- component.find("select_GS3").set("v.value", GSProduct_Category3);
- component.find("select_GS4_1").set("v.value", GSPAim_Price__c1);
- component.find("select_GS4_2").set("v.value", GSPAim_Price__c2);
- component.find("select_GS4_3").set("v.value", GSPAim_Price__c3);
-
- var UROProduct_Category1 = "";
- var UROProduct_Category2 = "";
- var UROProduct_Category3 = "";
- var UROAim_Price__c1 = "";
- var UROAim_Price__c2 = "";
- var UROAim_Price__c3 = "";
- if (amountMap.URO.length > 0) {
- UROProduct_Category1 = amountMap.URO[0].Product_Category__c;
- if (amountMap.URO.length > 1) {
- UROProduct_Category2 = amountMap.URO[1].Product_Category__c;
- }
- if (amountMap.URO.length > 2) {
- UROProduct_Category3 = amountMap.URO[2].Product_Category__c;
- }
- UROAim_Price__c1 = amountMap.URO[0].Aim_Price__c;
- UROAim_Price__c2 = amountMap.URO[1].Aim_Price__c;
- UROAim_Price__c3 = amountMap.URO[2].Aim_Price__c;
- }
- component.find("select_URO1").set("v.value", UROProduct_Category1);
- component.find("select_URO2").set("v.value", UROProduct_Category2);
- component.find("select_URO3").set("v.value", UROProduct_Category3);
- component.find("select_URO4_1").set("v.value", UROAim_Price__c1);
- component.find("select_URO4_2").set("v.value", UROAim_Price__c2);
- component.find("select_URO4_3").set("v.value", UROAim_Price__c3);
-
- var GYNProduct_Category1 = "";
- var GYNProduct_Category2 = "";
- var GYNProduct_Category3 = "";
- var GYNAim_Price__c1 = "";
- var GYNAim_Price__c2 = "";
- var GYNAim_Price__c3 = "";
- if (amountMap.GYN.length > 0) {
- GYNProduct_Category1 = amountMap.GYN[0].Product_Category__c;
- if (amountMap.GYN.length > 1) {
- GYNProduct_Category2 = amountMap.GYN[1].Product_Category__c;
- }
- if (amountMap.GYN.length > 2) {
- GYNProduct_Category3 = amountMap.GYN[2].Product_Category__c;
- }
- GYNAim_Price__c1 = amountMap.GYN[0].Aim_Price__c;
- GYNAim_Price__c2 = amountMap.GYN[1].Aim_Price__c;
- GYNAim_Price__c3 = amountMap.GYN[2].Aim_Price__c;
- }
- component.find("select_GYN1").set("v.value", GYNProduct_Category1);
- component.find("select_GYN2").set("v.value", GYNProduct_Category2);
- component.find("select_GYN3").set("v.value", GYNProduct_Category3);
- component.find("select_GYN4_1").set("v.value", GYNAim_Price__c1);
- component.find("select_GYN4_2").set("v.value", GYNAim_Price__c2);
- component.find("select_GYN4_3").set("v.value", GYNAim_Price__c3);
-
- var ENTProduct_Category1 = "";
- var ENTProduct_Category2 = "";
- var ENTProduct_Category3 = "";
- var ENTAim_Price__c1 = "";
- var ENTAim_Price__c2 = "";
- var ENTAim_Price__c3 = "";
- if (amountMap.ENT.length > 0) {
- ENTProduct_Category1 = amountMap.ENT[0].Product_Category__c;
- if (amountMap.ENT.length > 1) {
- ENTProduct_Category2 = amountMap.ENT[1].Product_Category__c;
- }
- if (amountMap.ENT.length > 2) {
- ENTProduct_Category3 = amountMap.ENT[2].Product_Category__c;
- }
- ENTAim_Price__c1 = amountMap.ENT[0].Aim_Price__c;
- ENTAim_Price__c2 = amountMap.ENT[1].Aim_Price__c;
- ENTAim_Price__c3 = amountMap.ENT[2].Aim_Price__c;
- }
- component.find("select_ENT1").set("v.value", ENTProduct_Category1);
- component.find("select_ENT2").set("v.value", ENTProduct_Category2);
- component.find("select_ENT3").set("v.value", ENTProduct_Category3);
- component.find("select_ENT4_1").set("v.value", ENTAim_Price__c1);
- component.find("select_ENT4_2").set("v.value", ENTAim_Price__c2);
- component.find("select_ENT4_3").set("v.value", ENTAim_Price__c3);
- }
- });
- $A.enqueueAction(action);
- console.log(
- JSON.stringify(component.find("input-hos").get("v.body")[0].get("v"))
- );
- },
-
- getOCMTerm: function () {
- var today = new Date();
- var year = today.getFullYear();
- var month = today.getMonth();
-
- if (month < 3) year -= 1;
- var thisYearOCMPeriod = String(year - 1867) + "P";
-
- return thisYearOCMPeriod;
- },
-
- createTarget: function (component, event, helper) {
- var action = component.get("c.createSFTarget");
- // alert(component.get("v.GIAmount"));
-
- var p1_1 = component.find("select_GI4_1").get("v.value");
- var p1_2 = component.find("select_GI4_2").get("v.value");
- var p1_3 = component.find("select_GI4_3").get("v.value");
-
- if (p1_1 == undefined || p1_1 == "") {
- p1_1 = 0;
- }
- if (p1_2 == undefined || p1_2 == "") {
- p1_2 = 0;
- }
- if (p1_3 == undefined || p1_3 == "") {
- p1_3 = 0;
- }
- console.warn(p1_1 + "-" + p1_2 + "-" + p1_3);
-
- var p2_1 = component.find("select_ET4_1").get("v.value");
- var p2_2 = component.find("select_ET4_2").get("v.value");
- var p2_3 = component.find("select_ET4_3").get("v.value");
- if (p2_1 == undefined || p2_1 == "") {
- p2_1 = 0;
- }
- if (p2_2 == undefined || p2_2 == "") {
- p2_2 = 0;
- }
- if (p2_3 == undefined || p2_3 == "") {
- p2_3 = 0;
- }
-
- var p3_1 = component.find("select_BF4_1").get("v.value");
- var p3_2 = component.find("select_BF4_2").get("v.value");
- var p3_3 = component.find("select_BF4_3").get("v.value");
- if (p3_1 == undefined || p3_1 == "") {
- p3_1 = 0;
- }
- if (p3_2 == undefined || p3_2 == "") {
- p3_2 = 0;
- }
- if (p3_3 == undefined || p3_3 == "") {
- p3_3 = 0;
- }
-
- var p4_1 = component.find("select_OTH4_1").get("v.value");
- var p4_2 = component.find("select_OTH4_2").get("v.value");
- var p4_3 = component.find("select_OTH4_3").get("v.value");
- if (p4_1 == undefined || p4_1 == "") {
- p4_1 = 0;
- }
- if (p4_2 == undefined || p4_2 == "") {
- p4_2 = 0;
- }
- if (p4_3 == undefined || p4_3 == "") {
- p4_3 = 0;
- }
-
- var p5_1 = component.find("select_GS4_1").get("v.value");
- var p5_2 = component.find("select_GS4_2").get("v.value");
- var p5_3 = component.find("select_GS4_3").get("v.value");
- if (p5_1 == undefined || p5_1 == "") {
- p5_1 = 0;
- }
- if (p5_2 == undefined || p5_2 == "") {
- p5_2 = 0;
- }
- if (p5_3 == undefined || p5_3 == "") {
- p5_3 = 0;
- }
-
- var p6_1 = component.find("select_URO4_1").get("v.value");
- var p6_2 = component.find("select_URO4_2").get("v.value");
- var p6_3 = component.find("select_URO4_3").get("v.value");
- if (p6_1 == undefined || p6_1 == "") {
- p6_1 = 0;
- }
- if (p6_2 == undefined || p6_2 == "") {
- p6_2 = 0;
- }
- if (p6_3 == undefined || p6_3 == "") {
- p6_3 = 0;
- }
-
- var p7_1 = component.find("select_GYN4_1").get("v.value");
- var p7_2 = component.find("select_GYN4_2").get("v.value");
- var p7_3 = component.find("select_GYN4_3").get("v.value");
- if (p7_1 == undefined || p7_1 == "") {
- p7_1 = 0;
- }
- if (p7_2 == undefined || p7_2 == "") {
- p7_2 = 0;
- }
- if (p7_3 == undefined || p7_3 == "") {
- p7_3 = 0;
- }
-
- var p8_1 = component.find("select_ENT4_1").get("v.value");
- var p8_2 = component.find("select_ENT4_2").get("v.value");
- var p8_3 = component.find("select_ENT4_3").get("v.value");
- if (p8_1 == undefined || p8_1 == "") {
- p8_1 = 0;
- }
- if (p8_2 == undefined || p8_2 == "") {
- p8_2 = 0;
- }
- if (p8_3 == undefined || p8_3 == "") {
- p8_3 = 0;
- }
-
- action.setParams({
- hospitalId: component.get("v.record.Agency_Hospital__c"),
- GIProduct: [
- component.find("select_GI1").get("v.value"),
- component.find("select_GI2").get("v.value"),
- component.find("select_GI3").get("v.value"),
- p1_1,
- p1_2,
- p1_3
- ],
- ETProduct: [
- component.find("select_ET1").get("v.value"),
- component.find("select_ET2").get("v.value"),
- component.find("select_ET3").get("v.value"),
- p2_1,
- p2_2,
- p2_3
- ],
- BFProduct: [
- component.find("select_BF1").get("v.value"),
- component.find("select_BF2").get("v.value"),
- component.find("select_BF3").get("v.value"),
- p3_1,
- p3_2,
- p3_3
- ],
- OTHProduct: [
- component.find("select_OTH1").get("v.value"),
- component.find("select_OTH2").get("v.value"),
- component.find("select_OTH3").get("v.value"),
- p4_1,
- p4_2,
- p4_3
- ],
- GSProduct: [
- component.find("select_GS1").get("v.value"),
- component.find("select_GS2").get("v.value"),
- component.find("select_GS3").get("v.value"),
- p5_1,
- p5_2,
- p5_3
- ],
- UROProduct: [
- component.find("select_URO1").get("v.value"),
- component.find("select_URO2").get("v.value"),
- component.find("select_URO3").get("v.value"),
- p6_1,
- p6_2,
- p6_2
- ],
- GYNProduct: [
- component.find("select_GYN1").get("v.value"),
- component.find("select_GYN2").get("v.value"),
- component.find("select_GYN3").get("v.value"),
- p7_1,
- p7_2,
- p7_3
- ],
- ENTProduct: [
- component.find("select_ENT1").get("v.value"),
- component.find("select_ENT2").get("v.value"),
- component.find("select_ENT3").get("v.value"),
- p8_1,
- p8_2,
- p8_3
- ],
- OCMTerm: component.get("v.OCMTerm")
- });
- action.setCallback(this, function (response) {
- console.warn(response);
- var state = response.getState();
- if (state === "SUCCESS") {
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- $A.util.toggleClass(modal_window, "disp_none");
- $A.util.toggleClass(modal_bg, "disp_none");
-
+ },
+
+ error : function(message) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
- title: "鎴愬姛",
- type: "success",
- message: "淇濆瓨鎴愬姛"
+ title: "閿欒!",
+ message: message,
+ type:"error",
+ duration : "10000"
});
toastEvent.fire();
+ },
- $A.get("e.force:refreshView").fire();
- } else if (state === "INCOMPLETE") {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "鏈畬鎴�!",
- type: "error",
- message: "鏈畬鎴�"
- });
- toastEvent.fire();
- } else if (state === "ERROR") {
- var errors = response.getError();
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "閿欒",
- type: "error",
- message: errors[0].message
- });
- toastEvent.fire();
- }
- });
- $A.enqueueAction(action);
- },
-
- warning: function (message) {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "璀﹀憡!",
- message: message,
- type: "warning",
- duration: "10000"
- });
- toastEvent.fire();
- },
-
- error: function (message) {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "閿欒!",
- message: message,
- type: "error",
- duration: "10000"
- });
- toastEvent.fire();
- }
-});
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp
index d87fcc0..83c0c1a 100644
--- a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp
+++ b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp
@@ -1,3 +1,11 @@
+<!--
+ * @Author: Thhto 997058689@qq.com
+ * @Date: 2022-07-08 10:47:25
+ * @LastEditors: Thhto 997058689@qq.com
+ * @LastEditTime: 2023-02-03 15:25:46
+ * @FilePath: \ceshihuanj\force-app\main\default\aura\DealerPersonnelInformationImport\DealerPersonnelInformationImport.cmp
+ * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
<aura:component controller="DealerPersonnelController"
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes"
access="global">
@@ -35,7 +43,7 @@
</aura:renderIf>
<!-- 鎵归噺娣诲姞鍛ㄦ姤 start-->
<div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv" style="z-index: 10001">
- <ui:inputText aura:id="articleURL" />
+ <!-- <ui:inputText aura:id="articleURL" /> -->
<div class="demo-only" style="height: 8rem;">
<div class="slds-notify_container slds-is-relative">
<div class="slds-notify slds-notify_toast slds-theme_error" role="status">
@@ -44,7 +52,10 @@
class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
<lightning:icon alternativeText="error" iconName="utility:error" size="small"
class="buttonColor slds-m-right_small" />
- <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2>
+ <!-- DB202301262139 SFDC缁忛攢鍟嗕汉鍛樺鍏ュ姛鑳芥敼杩� start -->
+ <!-- <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2> -->
+ <pre class="slds-text-heading_small ">{!v.errorMessage}</pre>
+ <!-- DB202301262139 SFDC缁忛攢鍟嗕汉鍛樺鍏ュ姛鑳芥敼杩� end -->
</div>
</div>
</div>
@@ -52,7 +63,7 @@
</div>
</div>
<div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01">
- <ui:inputText aura:id="articleURL" />
+ <!-- <ui:inputText aura:id="articleURL" /> -->
<div class="demo-only" style="height: 8rem;">
<div class="slds-notify_container slds-is-relative">
<div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
@@ -68,7 +79,7 @@
</div>
</div>
</div>
- <div>
+ <div >
<div class="slds-modal__header ">
<h4 id="headerTarget" class="slds-float--left"></h4>
<h2 id="headerTarget" class="slds-text-heading--medium">瀹㈡埛浜哄憳鎵归噺瀵煎叆</h2>
@@ -83,7 +94,7 @@
<aura:set attribute="else">
<ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent}" />
<div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button label="淇濆瓨" variant="brand" onclick="{!c.processFileContent}" />
+ <lightning:button aura:id="save_con" label="淇濆瓨" variant="brand" onclick="{!c.processFileContent}" disabled="false" />
<lightning:button label="鍙栨秷" variant="brand" onclick="{!c.cancel}" />
</div>
<aura:if isTrue="{!v.showErrorInfo}">
@@ -93,7 +104,7 @@
<div class="slds-p-around--large slds-align--absolute-center">
<div style="height: 300px;overflow-x:scroll">
<lightning:datatable keyField="id" data="{! v.errorData }" columns="{! v.errorColumns }"
- hideCheckboxColumn="true" minColumnWidth="120"/>
+ hideCheckboxColumn="true"/>
</div>
</div>
</aura:if>
diff --git a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
index ddd60f2..cbd114b 100644
--- a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
+++ b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
@@ -77,6 +77,9 @@
};
reader.readAsDataURL(file);
},
+ isNumber: function(str) {
+ return /^\d+$/.test(str);
+ },
saveRecords: function (component, event, helper) {
component.set('v.login', true);
var action = component.get("c.processData");
@@ -101,34 +104,44 @@
res1 += ress[i].substr(7) + '\n';
if (ress[i] != '') {
let errorData = {}
+ if(!this.isNumber(ress[i].substr(7).substring(1, 2))){
+ continue
+ }
let index = errorDataRow.indexOf(ress[i].substr(7).substring(1, 2));
if (index == -1) {
errorData.errorRow = ress[i].substr(7).substring(1, 2);
errorDataRow.push(errorData.errorRow);
- errorData.errorInfo = ress[i].substr(7).substring(6);
+ errorData.errorInfo = ress[i].substr(7).substring(5);
errorDatas.push(errorData);
} else {
- errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(6);
+ errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5);
}
}
}
var fileContentData = component.get("v.fileContentData").split('\n');
let errorColumns = [
- { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 50 },
+ { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
{ label: '閿欒淇℃伅', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true,initialWidth: 300,wrapText: true }
];
for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) {
errorColumns.push({
- label: fileContentData[0].split(',')[i], fieldName: 'field' + i, type: 'text', hideDefaultActions: true,wrapText: true
+ label: fileContentData[0].split(',')[i],
+ fieldName: 'field' + i,
+ type: 'text',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 120
});
}
for(var i = 0; i < errorDatas.length; i++){
let data = fileContentData[errorDatas[i].errorRow];
console.log('data = ' + JSON.stringify(data));
- for(var j = 0; j < data.split(',').length; j++){
- let label = 'field' + j;
- errorDatas[i][label] = data.split(',')[j];
+ if(data){
+ for(var j = 0; j < data.split(',').length; j++){
+ let label = 'field' + j;
+ errorDatas[i][label] = data.split(',')[j];
+ }
}
}
console.log('errorDatas = ' + JSON.stringify(errorDatas))
@@ -142,12 +155,14 @@
component.set('v.errorMessage', res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
this.showErrorToast(component);
component.set('v.login', false);
+ component.find('save_con').set('v.disabled', true);
} else {
// this.success('瀵煎叆鎴愬姛');
component.set('v.successMessage', '瀵煎叆鎴愬姛');
this.showSuccessToast01(component);
component.set("v.showMain", true);
component.set('v.login', false);
+ component.find('save_con').set('v.disabled', false);
}
}
else if (state === "INCOMPLETE") {
@@ -195,7 +210,7 @@
window.setTimeout($A.getCallback(function () {
$A.util.addClass(component.find('errorDiv'), 'slds-hide');
}),
- 4000
+ 7000
);
},
success: function (message) {
@@ -283,8 +298,9 @@
downloadCSV: function (component, csv) {
var link = document.createElement('a');
// 璁剧疆瀛楃闆嗗拰鏂囦欢澶�
- let bom = "\uFEFF";
- link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom+csv);
+ var bom = "\uFEFF";
+ link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
+ //link.href = URL.createObjectURL(csvFile);
link.download = 'data.csv';
document.body.appendChild(link);
link.click();
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc
new file mode 100644
index 0000000..d0d6eb5
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc
@@ -0,0 +1,6 @@
+<aura:documentation>
+ <aura:description>Documentation</aura:description>
+ <aura:example name="ExampleName" ref="exampleComponentName" label="Label">
+ Example Description
+ </aura:example>
+</aura:documentation>
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp
new file mode 100644
index 0000000..754199c
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp
@@ -0,0 +1,71 @@
+<!--
+ @description :
+ @author : ChangeMeIn@UserSettingsUnder.SFDoc
+ @group :
+ @last modified on : 07-08-2022
+ @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc
+-->
+<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,lightning:actionOverride,lightning:isUrlAddressable" access="global"
+ controller="NewAgencyContactController">
+
+ <aura:attribute name = "recordId" type = "Id" default = ""/>
+ <aura:attribute name="title" type="string"/>
+ <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
+ <aura:attribute name="layout" type="LayoutDescriberHelper.LayoutWrapper"/>
+ <aura:attribute name="record_data" type="Map"/>
+ <aura:attribute name="section_names" type="List"/>
+ <aura:attribute name="showSpinner" type="Boolean" default = "False"/>
+ <aura:attribute name="staticResource" type="Map"/>
+ <aura:attribute name="pi_fields_map" type="Map"/>
+ <aura:attribute name="isClone" type="Boolean" default = "False"/>
+ <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
+ <ltng:require scripts="{! $Resource.jquery183minjs }" />
+ <aura:registerEvent name="NewAgencyContactEvent" type="c:NewAgencyContactEvent"/>
+ <aura:attribute name="agencyHospitalId" type="String"/>
+
+ <div class="slds-modal__container">
+ <!-- header -->
+ <header class="slds-modal__header">
+ <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">
+ {!v.title}
+ </h2>
+ </header>
+
+ <div class="slds-modal__content slds-p-around_medium">
+ <aura:if isTrue="{!v.showSpinner}">
+ <lightning:spinner alternativeText="Loading" size="medium" />
+ </aura:if>
+
+
+ <lightning:recordEditForm objectApiName="Agency_Contact__c" onload="{!c.handleLoad}">
+
+ <lightning:accordion activeSectionName="{! v.section_names }" allowMultipleSectionsOpen="true" class="greyyyy" >
+ <aura:iteration items="{!v.layout}" var="section">
+ <aura:if isTrue="{! section.editHeading }">
+ <lightning:accordionSection name="{! section.label }" label="{! section.label }">
+
+ <aura:iteration items="{! section.layoutColumns}" var="col">
+ <aura:iteration items="{! col.layoutItems}" var="field">
+ <aura:if isTrue="{! field.behavior != 'Readonly' }">
+ <lightning:inputField required="{! field.behavior == 'Required' }" aura:id="field" fieldName="{! field.field}" value="{! field.value}" />
+
+ </aura:if>
+ </aura:iteration>
+
+ </aura:iteration>
+
+
+ </lightning:accordionSection>
+ </aura:if>
+ </aura:iteration>
+ </lightning:accordion>
+ </lightning:recordEditForm>
+
+ <div style="text-align:center;margin: 5px;">
+ <lightning:button class="slds-button slds-button_neutral" label="鍙栨秷" onclick="{! c.cancelClick }" />
+ <lightning:button class="slds-button slds-button_brand" variant="brand" label="淇濆瓨" onclick="{! c.saveClick }" />
+
+ </div>
+ </div>
+ </div>
+</aura:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml
new file mode 100644
index 0000000..119345a
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>55.0</apiVersion>
+ <description>A Lightning Component Bundle</description>
+</AuraDefinitionBundle>
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css
new file mode 100644
index 0000000..919a7e5
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css
@@ -0,0 +1,15 @@
+.THIS {
+}
+
+.THIS .greyyyy .slds-button_reset{
+ display: flex;
+ align-items: center;
+ background: var(--lwc-colorBackground,rgb(243, 242, 242));
+ cursor: pointer;
+ width: 100%;
+ height: 2rem;
+ text-align: left;
+ color: currentColor;
+ font-size: inherit;
+ padding: 0 var(--lwc-spacingXSmall,0.5rem);
+}
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design
new file mode 100644
index 0000000..d247163
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design
@@ -0,0 +1,3 @@
+<design:component >
+
+</design:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg
new file mode 100644
index 0000000..e201ae9
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E" />
+ <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF" />
+ </g>
+</svg>
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js
new file mode 100644
index 0000000..72dc139
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js
@@ -0,0 +1,396 @@
+({
+ doInit : function(component, event, helper) {
+ let rid = component.get('v.recordId');
+ let pid = null;
+ if(!rid){
+ pid = window.location.href.replace("https://","").split("/")[4];
+ }
+ let isClone = component.get('v.isClone');
+ if(!rid || isClone){
+ component.set('v.title',$A.get("$Label.c.New")+'.瀹㈡埛浜哄憳');
+ }else{
+ component.set('v.title',$A.get("$Label.c.Edit")+'.瀹㈡埛浜哄憳');
+ }
+
+ let record_type_id = null;
+ let pageref = component.get("v.pageReference")
+ if(!record_type_id && pageref){
+ record_type_id = pageref.state.recordTypeId
+ }
+ component.set("v.showSpinner", true);
+ helper.CallBackAction(component,'Init',{
+ rid : rid,
+ pid : null,
+ //rid : component.get('v.recordId'),
+ record_type_id : record_type_id,
+ },function(data){
+ debugger
+ console.log('data = ' + JSON.stringify(data));
+ if(data.getState() == "SUCCESS"){
+ var rv = data.getReturnValue();
+ console.log(rv);
+ if(rv.IsSuccess){
+ let layout = JSON.parse(rv.Data.layout);
+ let fields = rv.Data.fields;
+ let staticResource = JSON.parse(rv.Data.staticResource);
+ let staticResourceV2 = JSON.parse(rv.Data.staticResourceV2);
+ let section_names = [];
+ section_names = layout.map(s=>s.label);
+ component.set('v.section_names',section_names);
+
+ let m = {};
+ for(let f of staticResource.PIDetails){
+ m[f.SF_Field_API_Name__c] = f;
+ }
+ component.set('v.pi_fields_map',m);
+
+
+
+ var agencyHospitalId = component.get("v.agencyHospitalId");
+ console.log('agencyHospitalId = ' + agencyHospitalId);
+ if(rv.Data && rv.Data.data && rv.Data.data.AWS_Data_Id__c){
+ helper.AwsGet(staticResource.queryUrl, {
+ dataId : rv.Data.data.AWS_Data_Id__c
+ }, function(data){
+ console.log('data = ' + data);
+
+ for(let f of staticResource.PIDetails){
+
+ if(data.object && data.object.hasOwnProperty(f.AWS_Field_API__c)){
+ rv.Data.data[f.SF_Field_API_Name__c] = data.object[f.AWS_Field_API__c];
+ if(data.object.hasOwnProperty(f.AWS_Encrypted_Field_API__c) && data.object[f.AWS_Encrypted_Field_API__c]){
+ rv.Data.data[f.SF_Field_Encrypted_API__c] = data.object[f.AWS_Encrypted_Field_API__c];
+ }
+ }
+ }
+
+ for(let s of layout){
+ for(let c of s.layoutColumns){
+ for(let item of c.layoutItems){
+ if(rv.Data.data.hasOwnProperty(item.field)){
+ item.value = rv.Data.data[item.field];
+ }
+ if(fields.hasOwnProperty(item.field)){
+ item.fi = fields[item.field];
+ }
+ if(item.field == 'Agency_Hospital__c'){
+ item.value = agencyHospitalId;
+ }
+ }
+ }
+ }
+
+ component.set('v.record_data',rv.Data.data);
+ component.set('v.layout',layout);
+ }, staticResource.token);
+ }else{
+
+ for(let s of layout){
+ for(let c of s.layoutColumns){
+ for(let item of c.layoutItems){
+ if(rv.Data && fields.hasOwnProperty(item.field) && fields[item.field].References && fields[item.field].References.map(m=>m.value).indexOf(rv.Data.pidType) > -1){
+ item.value = pid;
+ }
+ if(item.field == 'Agency_Hospital__c'){
+ item.value = agencyHospitalId;
+ }
+ }
+ }
+ }
+ component.set('v.layout',layout);
+ }
+
+
+ component.set('v.fields',fields);
+ component.set('v.staticResource',staticResource);
+ component.set('v.staticResourceV2',staticResourceV2);
+ }else{
+ helper.ShowToast({
+ "message" : rv.Message,
+ "type" : "error"
+ });
+ }
+
+ }else{
+
+ helper.ShowToast({
+ "message" : "Init error",
+ "type" : "error"
+ });
+
+ }
+ });
+ },
+ handleLoad: function(component, event, helper) {
+ console.log('recordEditForm handleSuccess')
+ component.set("v.showSpinner", false);
+ },
+ saveClick : function(component, event, helper){
+
+ let staticResource = component.get('v.staticResource');
+ //let staticResourceV2 = component.get('v.staticResourceV2');
+ let record_id = component.get('v.recordId');
+ let record_type_id = component.get('v.recordTypeId');
+
+ let isClone = component.get('v.isClone');
+ let url = staticResource.newUrl;
+ //let urlV2 = staticResourceV2.newUrl;
+ let payloadPi = {};
+ if (record_id && !isClone) {
+ url = staticResource.updateUrl;
+ //urlV2 = staticResourceV2.updateUrl;
+ payloadPi['dataId'] = component.get('v.record_data').AWS_Data_Id__c;
+ }
+ let layout = component.get('v.layout');
+
+ let pi_fields_map = component.get('v.pi_fields_map');
+
+ let hospitalId = '';
+ for(let s of layout){
+ for(let c of s.layoutColumns){
+ for(let item of c.layoutItems){
+ if(item.field == 'Agency_Hospital__c'){
+ hospitalId = item.value;
+ }
+ if(pi_fields_map.hasOwnProperty(item.field)){
+
+ payloadPi[pi_fields_map[item.field].AWS_Field_API__c] = item.value;
+ }
+
+ if (item.behavior == "Required" && !item.value ) {
+ let fs = component.find("field");
+ for(let fi in fs){
+ let f = fs[fi];
+ if(!f.get('v.value')){
+ f.reset();
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ component.set("v.showSpinner", true);
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+ debugger
+ let hospitalName = '';
+ //璋冪敤鍚庣searchAgencyDataId鏂规硶鏌ヨ鍑哄尰闄笅闈㈡墍鏈夊鎴蜂汉鍛榙ataid
+ helper.CallBackAction(component,'searchAgencyDataId',{
+ hospitalId : hospitalId
+ },function(data){
+ if(data.getState() == "SUCCESS"){
+ var data = data.getReturnValue();
+ if(data.IsSuccess == true){
+ let agencyContactIds = ''
+ if(data.Message == '' && data.Data && data.Data.length > 0){
+ hospitalName = data.Data[0].Agency_Hospital__r.Name;
+ for(var i=0;i<data.Data.length;i++){
+ if(data.Data[i].AWS_Data_Id__c)
+ agencyContactIds += ','+data.Data[i].AWS_Data_Id__c;
+ }
+ agencyContactIds = agencyContactIds.substring(1);
+ payloadPi['agencyContactIds'] = agencyContactIds;
+ }else{
+ payloadPi['agencyContactIds'] = agencyContactIds;
+ }
+ helper.AwsPost(url+'V2', [payloadPi], function(result){
+ //濡傛灉杩斿洖鏄�129琛ㄧず閲嶅浜嗭紝鎶ラ敊
+ if(result.status == '129'){
+ helper.ShowToast({
+ "message" : '璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+hospitalName+'鍖婚櫌锛岃淇敼',
+ "type" : "error"
+ });
+ component.set("v.showSpinner", false);
+ return
+ }
+
+ let obj = result.object[0];
+ let data = {};
+ if(record_id && !isClone){
+ data.Id = record_id;
+ }else{
+ data.AWS_Data_Id__c = obj.dataId;
+ }
+ for(let s of layout){
+ for(let c of s.layoutColumns){
+ for(let item of c.layoutItems){
+ if(item.field && item.behavior != "Readonly"){
+ if(pi_fields_map.hasOwnProperty(item.field)){
+ data[item.field] = obj[pi_fields_map[item.field].AWS_Field_API__c];
+ //data[pi_fields_map[item.field].SF_Field_Encrypted_API__c] = obj[pi_fields_map[item.field].AWS_Encrypted_Field_API__c];
+ }else{
+ data[item.field] = item.value;
+ }
+ }
+
+ }
+ }
+ }
+
+
+ $A.getCallback(function(){
+ helper.CallBackAction(component,'Save',{
+ data : data,
+ transId : result.txId
+ },function(data){
+ component.set("v.showSpinner", false);
+ if(data.getState() == "SUCCESS"){
+ var rv = data.getReturnValue();
+ console.log(rv);
+ var sfId = null;
+ if(rv.IsSuccess){
+ sfId = rv.Data.recordId;
+ }
+
+ helper.AwsPost(staticResource.transactionUrl,{
+ txId: result.txId,
+ sfRecordId:sfId,
+ isSuccess: rv.IsSuccess ? 1 : 0
+ },function(data){
+ if(rv.IsSuccess){
+ helper.ShowToast({
+ "message" : "鎴愬姛",
+ "type" : "success"
+ });
+ helper.closeAgencyContact(component);
+
+ // if (record_id && !isClone){
+
+ // helper.closeAgencyContact(component);
+ // //$A.get('e.force:refreshView').fire();
+ // }else{
+ // var sObjectEvent = $A.get("e.force:navigateToSObject");
+ // sObjectEvent.setParams({
+ // "recordId": sfId
+ // })
+ // sObjectEvent.fire();
+ // }
+ }else{
+ helper.ShowToast({
+ "message" : rv.Message,
+ "type" : "error"
+ });
+ }
+ },staticResource.token);
+
+
+ }else{
+
+ helper.ShowToast({
+ "message" : "Init error",
+ "type" : "error"
+ });
+
+ }
+ });
+ })();
+
+ }, staticResource.token);
+ }else{
+ helper.ShowToast({
+ "message" : data.message,
+ "type" : "error"
+ });
+ component.set("v.showSpinner", false);
+ }
+ }else{
+ helper.ShowToast({
+ "message" : 'searchAgency澶辫触',
+ "type" : "error"
+ });
+ component.set("v.showSpinner", false);
+ }
+ });
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+ // helper.AwsPost(urlV2, [payloadPi], function(result){
+
+ // let obj = result.object[0];
+ // let data = {};
+ // if(record_id && !isClone){
+ // data.Id = record_id;
+ // }else{
+ // data.AWS_Data_Id__c = obj.dataId;
+ // }
+ // for(let s of layout){
+ // for(let c of s.layoutColumns){
+ // for(let item of c.layoutItems){
+ // if(item.field && item.behavior != "Readonly"){
+ // if(pi_fields_map.hasOwnProperty(item.field)){
+ // data[item.field] = obj[pi_fields_map[item.field].AWS_Field_API__c];
+ // data[pi_fields_map[item.field].SF_Field_Encrypted_API__c] = obj[pi_fields_map[item.field].AWS_Encrypted_Field_API__c];
+ // }else{
+ // data[item.field] = item.value;
+ // }
+ // }
+
+ // }
+ // }
+ // }
+
+
+ // $A.getCallback(function(){
+ // helper.CallBackAction(component,'Save',{
+ // data : data,
+ // transId : result.txId
+ // },function(data){
+ // component.set("v.showSpinner", false);
+ // if(data.getState() == "SUCCESS"){
+ // var rv = data.getReturnValue();
+ // console.log(rv);
+ // var sfId = null;
+ // if(rv.IsSuccess){
+ // sfId = rv.Data.recordId;
+ // }
+
+ // helper.AwsPost(staticResource.transactionUrl,{
+ // txId: result.txId,
+ // sfRecordId:sfId,
+ // isSuccess: rv.IsSuccess ? 1 : 0
+ // },function(data){
+ // if(rv.IsSuccess){
+ // helper.ShowToast({
+ // "message" : "鎴愬姛",
+ // "type" : "success"
+ // });
+ // helper.closeAgencyContact(component);
+
+ // // if (record_id && !isClone){
+
+ // // helper.closeAgencyContact(component);
+ // // //$A.get('e.force:refreshView').fire();
+ // // }else{
+ // // var sObjectEvent = $A.get("e.force:navigateToSObject");
+ // // sObjectEvent.setParams({
+ // // "recordId": sfId
+ // // })
+ // // sObjectEvent.fire();
+ // // }
+ // }else{
+ // helper.ShowToast({
+ // "message" : rv.Message,
+ // "type" : "error"
+ // });
+ // }
+ // },staticResource.token);
+
+
+ // }else{
+
+ // helper.ShowToast({
+ // "message" : "Init error",
+ // "type" : "error"
+ // });
+
+ // }
+ // });
+ // })();
+
+ // }, staticResource.token);
+ },
+ cancelClick : function(component, event, helper){
+ helper.closeAgencyContact(component);
+ },
+
+ scriptsLoaded : function(component, event, helper){}
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js
new file mode 100644
index 0000000..043120b
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js
@@ -0,0 +1,56 @@
+({
+ CallBackAction : function(component,action_name,para,callback) {
+ var action = component.get("c." + action_name.trimStart().replace("c.",""));
+ if(para){
+ action.setParams(para);
+ }
+ if(callback){
+ action.setCallback(this,function(data){
+ callback(data);
+ });
+ }
+
+ $A.enqueueAction(action);
+ },
+ ShowToast : function(paras){
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams(paras);
+ toastEvent.fire();
+ },
+ AwsPost : function(postURL, data ,callback,token){
+ let payloadForNewPI = '';
+ if(typeof(data) == 'string'){
+ payloadForNewPI = data;
+ }else{
+ payloadForNewPI = JSON.stringify(data);
+ }
+
+ AWSService.post(postURL,payloadForNewPI,function(result) {
+ //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus);
+ if(callback) callback(result);
+ },token);
+ },
+ AwsGet : function(url, data ,callback,token){
+
+ if(typeof(data) == 'string'){
+ url += data;
+ }else{
+ let i = 0;
+ for(let p in data){
+ url += (i++) ? '&' : '?';
+ url += p + '=' + data[p];
+ }
+ }
+
+ AWSService.get(url,function(result){
+ //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus);
+ if(callback) callback(result);
+ },token);
+ },
+ closeAgencyContact : function(component){
+ var cmpEvent = component.getEvent("NewAgencyContactEvent");
+ cmpEvent.setParams({
+ "showNewAgencyContact":false});
+ cmpEvent.fire();
+ }
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js
new file mode 100644
index 0000000..f1f0c75
--- /dev/null
+++ b/force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js
@@ -0,0 +1,5 @@
+({
+
+// Your renderer method overrides go here
+
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp
index a16937c..4acb227 100644
--- a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp
+++ b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp
@@ -30,6 +30,7 @@
<aura:attribute name="show" type="Boolean" default="false"/>
<aura:attribute name="showNewAgencyContact" type="Boolean" default="false"/>
<aura:handler name="NewAgencyContactEvent" event="c:NewAgencyContactEvent" action="{!c.closeAgencyContact}"/>
+ <aura:attribute name="agencyHospitalId" type="String" default = ""/>
@@ -45,7 +46,7 @@
<aura:if isTrue="{!v.showSpinner}">
<lightning:spinner alternativeText="Loading" size="medium" />
</aura:if>
- <lightning:recordEditForm objectApiName="Agency_Opportunity__c">
+ <lightning:recordEditForm objectApiName="Agency_Opportunity__c" onload="{!c.handleLoad}">
<lightning:accordion activeSectionName="{! v.section_names }" allowMultipleSectionsOpen="true" class="greyyyy" >
<aura:iteration items="{!v.layout}" var="section">
<aura:if isTrue="{! section.editHeading }">
@@ -130,10 +131,19 @@
</div>
</div>
- <aura:if isTrue="{!v.showNewAgencyContact}">
+ <!-- <aura:if isTrue="{!v.showNewAgencyContact}">
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open" aura:id="NewAgencyContact" id="NewAgencyContact">
<c:NewAgencyContact2 />
</section>
+ </aura:if> -->
+
+ <aura:if isTrue="{!v.showNewAgencyContact}">
+ <section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01"
+ class="slds-modal slds-fade-in-open" aura:id="NewAgencyContact"
+ id="NewAgencyContact" aria-describedby="modal-content-id-2" style="z-index: 9999;">
+ <c:NewAgencyContact2 agencyHospitalId="{!v.agencyHospitalId}"/>
+ </section>
+ <div class="slds-backdrop2 slds-backdrop_open2"></div>
</aura:if>
</div>
diff --git a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css
index 7438f38..8cbd05f 100644
--- a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css
+++ b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css
@@ -64,4 +64,16 @@
.THIS .slds-spinner_container{
position: revert;
+}
+
+.THIS .slds-backdrop2 {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.6); /* 閬僵灞傜殑鍗婇�忔槑鑳屾櫙鑹� */
+}
+.THIS .slds-backdrop_open2 {
+ z-index: 9003; /* 閬僵灞傜殑灞傜骇锛岄渶瑕佺‘淇濇瘮妯℃�佹鐨勫眰绾ч珮 */
}
\ No newline at end of file
diff --git a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js
index d496604..406ad66 100644
--- a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js
+++ b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js
@@ -106,7 +106,7 @@
}
// component.set('v.fields',fields);
// component.set('v.staticResource',staticResource);
- component.set("v.showSpinner", false);
+ //component.set("v.showSpinner", false);
}else{
component.set("v.showSpinner", false);
helper.ShowToast({
@@ -125,6 +125,10 @@
}
});
},
+ handleLoad: function(component, event, helper) {
+ console.log('recordEditForm handleSuccess')
+ component.set("v.showSpinner", false);
+ },
saveClick : function(component, event, helper){
let staticResource = component.get('v.staticResource');
@@ -264,6 +268,9 @@
"type" : "warning"
});
return
+ }else if(item.field == 'Agency_Hospital__c' && item.value){
+ component.set('v.agencyHospitalId',item.value)
+ console.log('v.agencyHospitalId item.value = ' + item.value)
}
}
}
diff --git a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
index 18f1564..34e057a 100644
--- a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
+++ b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
@@ -52,13 +52,13 @@
let myTableDiv = document.getElementById("QueryResult");
let table = document.createElement('TABLE');
table.border = '1';
- table.id = 'table';
+ table.id = 'customTable';
table.setAttribute('class','slds-table slds-table_cell-buffer slds-table_bordered');
let tableBody = document.createElement('TBODY');
table.appendChild(tableBody);
let headerTR = document.createElement('TR');
headerTR.setAttribute('class','slds-line-height_reset');
- let colsHeader = ['濮撳悕','鍖婚櫌', '鍖荤敓鍖哄垎(鑱屽姟)','鍒嗙被'];
+ let colsHeader = [' ','濮撳悕','鍖婚櫌', '鍖荤敓鍖哄垎(鑱屽姟)','鍒嗙被'];
tableBody.appendChild(headerTR);
for (let i = 0; i < colsHeader.length; i++) {
let td = document.createElement('TH');
@@ -71,7 +71,27 @@
for (let i = 0; i < contactInfoList.length; i++) {
let tr = document.createElement('TR');
tableBody.appendChild(tr);
- let contactInfoTemp = contactInfoList[i]
+ let contactInfoTemp = contactInfoList[i];
+
+ //鍐嶅姞涓�鍒楅�夋嫨button
+ debugger
+ let td = document.createElement('TD');
+ td.width = '75';
+ td.id = contactsInfo[contactInfoTemp.AWSDataId].Id;
+ console.log('contactInfoTemp = ' + JSON.stringify(contactInfoTemp))
+ // 鍒涘缓鎸夐挳鍏冪礌
+ var button = document.createElement('button');
+ button.classList.add('slds-button','slds-button_neutral');
+ button.id = contactInfoTemp.sfRecordId != null ? contactInfoTemp.sfRecordId : '';
+ // 璁剧疆鎸夐挳鐨勬枃鏈唴瀹�
+ var buttonText = document.createTextNode('閫夋嫨');
+ button.appendChild(buttonText);
+ button.addEventListener("click", function (obj) {
+ that.redirectToParentPage(component, event, helper, obj);
+ });
+ button.value = contactInfoTemp[cols[0]] != null ? contactInfoTemp[cols[0]] : ''
+ td.appendChild(button);
+ tr.appendChild(td);
for (let j = 0; j < cols.length; j++) {
let td = document.createElement('TD');
td.width = '75';
@@ -86,19 +106,20 @@
td.id = contactInfoTemp.sfRecordId;
}
td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:''));
- if (cols[j] == 'Name') {
- td.addEventListener("click", function (obj) {
- that.redirectToParentPage(component, event, helper,obj);
- });
- }
+ // if (cols[j] == 'Name') {
+ // td.addEventListener("click", function (obj) {
+ // that.redirectToParentPage(component, event, helper,obj);
+ // });
+ // }
tr.appendChild(td);
}
}
+ that.resetTable();
myTableDiv.appendChild(table);
component.find('button').set('v.disabled', false);
},
redirectToParentPage : function(component, event, helper,obj){
- let agencyContactName = obj.currentTarget.innerText;
+ let agencyContactName = obj.currentTarget.value;
let id = obj.currentTarget.id;
component.set('v.ac_name',agencyContactName);
let layout = component.get('v.layout');
@@ -114,15 +135,17 @@
component.set("v.isModalOpen", false);
},
resetTable : function(){
- let queryResult = document.getElementById('QueryResult');
- let table = document.getElementsByTagName('table');
- debugger;
- console.log('table:' + table);
- debugger;
- if(table.length > 1){
- for(var i=1;i<table.length;i++){
- queryResult.removeChild(table[i])
- }
+ // let queryResult = document.getElementById('QueryResult');
+ // let table = document.getElementById('customTable');
+ // console.log('table:' + table);
+ // if(table.length > 1){
+ // for(var i=1;i<table.length;i++){
+ // queryResult.removeChild(table[i])
+ // }
+ // }
+ let customTable = document.getElementById('customTable');
+ if(customTable){
+ customTable.parentNode.removeChild(customTable);
}
},
preparePayloadForSearchAgencyContact : function(component, event, helper){
@@ -159,6 +182,7 @@
});
return
}
+ component.set('v.showSpinner',true);
let searchPayload = new Object();
let searchAgencyContactName = component.get('v.searchKeyWord');
searchPayload.dataIds = rv.Data;
@@ -178,6 +202,7 @@
"message" : '娌℃湁鏌ヨ鍒拌瀹㈡埛浜哄憳',
"type" : "warning"
});
+ component.set('v.showSpinner',false);
return
}
for(var i=0;i<data.object.length;i++){
@@ -196,13 +221,30 @@
}
}
//let AWSIdToSFIdMapValue = {};
+ debugger
var searchAgencyContacts = component.get('c.searchAgencyContacts');
searchAgencyContacts.setParams({
"awsAgencyContactIds" : JSON.stringify(awsDataIds),
"agencyHospitalId" : agencyHospitalId,
"accountId" : accountId
});
- searchAgencyContacts.setCallback(this,function(response){
+ // 寤惰繜鎵ц涓�娈典唬鐮�
+ setTimeout(function() {
+ // 闇�瑕佸欢杩熸墽琛岀殑浠g爜
+ // 鍒涘缓涓�涓紶鏍囩偣鍑讳簨浠�
+ var event = new MouseEvent('click', {
+ bubbles: true,
+ cancelable: true,
+ view: window
+ });
+
+ // 瑙﹀彂鍏冪礌鐨勭偣鍑讳簨浠�
+ var element = document.getElementById('NewAgencyContact');
+ for(var i = 0;i<100;i++){
+ element.dispatchEvent(event);
+ }
+ }, 1000); // 寤惰繜 1000 姣锛堝嵆 1 绉掞級
+ searchAgencyContacts.setCallback(that,function(response){
var state = response.getState();
if(state == 'SUCCESS'){
var rv = response.getReturnValue();
@@ -226,10 +268,13 @@
}
}
that.refreshTable(component, event, helper,cols,contactInfoList,contactsInfo);
+ component.set('v.showSpinner',false);
}
}
});
$A.enqueueAction(searchAgencyContacts);
+ }else{
+ component.set('v.showSpinner',false);
}
},token);
}
diff --git a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
index 42b2d98..2f53aa1 100644
--- a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
+++ b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
@@ -1,455 +1,310 @@
-<aura:component
- controller="RetrospectiveWeeklyReportController"
- implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens"
- access="global"
->
- <ltng:require styles="{!$Resource.multilineToastCSS}" />聽
- <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
- <aura:handler
- event="c:strike_evt"
- action="{!c.createAopp}"
- name="strike_evt_addNewRecord"
- />
- <aura:attribute
- name="data"
- type="Agency_Report__c"
- default="{sobjectType:'Agency_Report__c'}"
- />
- <aura:attribute
- name="oppdata"
- type="Agency_Opportunity__c"
- default="{sobjectType:'Agency_Opportunity__c'}"
- />
- <aura:attribute
- name="acondata"
- type="Agency_Contact__c"
- default="{sobjectType:'Ag
- ency_Contact__c'}"
- />
- <aura:attribute name="successMessage" type="String" />
- <aura:attribute name="etEng" type="String" />
- <aura:attribute name="errorMessage" type="String" />
- <aura:attribute name="Close_Forecasted_Date__c_o" type="Date" />
- <aura:attribute name="Amount__c_o" type="String" />
- <aura:attribute name="OCMSale_Price__c_o" type="String" />
- <aura:attribute name="StageName__c_o" type="String" />
- <aura:attribute name="fieldsmap" type="Map" />
- <aura:attribute name="AgencyReportMap" type="Boolean" default="false" />
- <!-- 鏃ユ姤鍒嗙被 -->
+<aura:component controller="RetrospectiveWeeklyReportController"
+ implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens"
+ access="global">
+ <ltng:require styles="{!$Resource.multilineToastCSS}" />聽
+ <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
+ <aura:handler event="c:strike_evt" action="{!c.createAopp}" name="strike_evt_addNewRecord" />
+ <aura:attribute name="data" type="Agency_Report__c" default="{sobjectType:'Agency_Report__c'}" />
+ <aura:attribute name="oppdata" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}" />
+ <aura:attribute name="acondata" type="Agency_Contact__c" default="{sobjectType:'Ag
+ ency_Contact__c'}" />
+ <aura:attribute name="successMessage" type="String" />
+ <aura:attribute name="etEng" type="String" />
+ <aura:attribute name="errorMessage" type="String" />
+ <aura:attribute name="Close_Forecasted_Date__c_o" type="Date" />
+ <aura:attribute name="Amount__c_o" type="String" />
+ <aura:attribute name="OCMSale_Price__c_o" type="String" />
+ <aura:attribute name="StageName__c_o" type="String" />
+ <aura:attribute name="fieldsmap" type="Map" />
+ <aura:attribute name="AgencyReportMap" type="Boolean" default="false" />
+ <!-- 鏃ユ姤鍒嗙被 -->
- <aura:attribute name="alldata" type="List" />
- <aura:attribute name="setdoctorlisthos" type="Boolean" default="false" />
- <aura:attribute name="allselectlist" type="Map" />
- <aura:attribute name="doclist" type="List" />
- <aura:attribute name="docmap" type="Map" />
- <aura:attribute name="login" type="Boolean" default="false" />
- <aura:attribute name="loginEdit" type="Boolean" default="false" />
- <aura:attribute name="modal_import_spinner" type="Boolean" default="false" />
- <aura:attribute name="loadOpp" type="Boolean" default="false" />
- <aura:attribute name="reportPageData" type="Map" />
- <aura:attribute name="selectbody" type="String" />
- <aura:attribute name="report_date_list" type="Map" />
- <aura:attribute name="selected_date" type="String" />
- <aura:attribute name="selected_agency_person" type="String" />
- <aura:attribute name="agency_report_header" type="String" />
- <aura:attribute name="agency_report_header_id" type="String" />
- <aura:attribute name="result" type="String" default="" />
- <!-- //鍖婚櫌 鐐归�夐渶瑕� -->
- <aura:attribute name="hospital" type="string" default="" />
- <aura:attribute name="hospitalId" type="string" default="" />
- <aura:attribute name="hospitals" type="string" default="" />
- <aura:attribute name="hospitalLinkId" type="string" default="" />
- <aura:handler name="change" value="{!v.hospital}" action="{!c.hosChange}" />
- <aura:attribute name="hospitalList" type="Map" />
- <!-- 浣跨敤浜у搧1(浜у搧鍨嬪彿) -->
- <aura:attribute name="UseProduct1" type="string" default="" />
- <aura:attribute name="UseProduct1s" type="string" default="" />
- <aura:handler
- name="change"
- value="{!v.UseProduct1}"
- action="{!c.UseProduct1Change}"
- />
- <aura:attribute name="UseProduct1List" type="Map" />
- <aura:attribute name="UseProduct1Id" type="string" default="" />
- <!-- 浣跨敤浜у搧2 -->
- <aura:attribute name="UseProduct2" type="string" default="" />
- <aura:attribute name="UseProduct2s" type="string" default="" />
- <aura:handler
- name="change"
- value="{!v.UseProduct2}"
- action="{!c.UseProduct2Change}"
- />
- <aura:attribute name="UseProduct2List" type="Map" />
- <aura:attribute name="UseProduct2Id" type="string" default="" />
- <!-- 浣跨敤浜у搧3 -->
- <aura:attribute name="UseProduct3" type="string" default="" />
- <aura:attribute name="UseProduct3s" type="string" default="" />
- <aura:handler
- name="change"
- value="{!v.UseProduct3}"
- action="{!c.UseProduct3Change}"
- />
- <aura:attribute name="UseProduct3List" type="Map" />
- <aura:attribute name="UseProduct3Id" type="string" default="" />
- <!--SWAG-CF58C3 fy start -->
- <aura:attribute name="AWStoken" type="String" />
- <aura:attribute name="AWSsearch" type="String" />
- <aura:attribute name="AWSinsert" type="String" />
- <aura:attribute name="AWStransactionURL" type="String" />
- <aura:attribute name="AWSDoctor2Map" type="String" />
- <aura:attribute name="awsurl" type="Map" />
- <aura:attribute name="contactawsurl" type="Map" />
- <aura:attribute name="allselectlistAgencyPerson" type="Map" />
- <!--SWAG-CF58C3 fy end -->
+ <aura:attribute name="alldata" type="List" />
+ <aura:attribute name="setdoctorlisthos" type="Boolean" default="false" />
+ <aura:attribute name="allselectlist" type="Map" />
+ <aura:attribute name="doclist" type="List" />
+ <aura:attribute name="docmap" type="Map" />
+ <aura:attribute name="login" type="Boolean" default="false" />
+ <aura:attribute name="loginEdit" type="Boolean" default="false" />
+ <aura:attribute name="modal_import_spinner" type="Boolean" default="false" />
+ <aura:attribute name="loadOpp" type="Boolean" default="false" />
+ <aura:attribute name="reportPageData" type="Map" />
+ <aura:attribute name="selectbody" type="String" />
+ <aura:attribute name="report_date_list" type="Map" />
+ <aura:attribute name="selected_date" type="String" />
+ <aura:attribute name="selected_agency_person" type="String" />
+ <aura:attribute name="agency_report_header" type="String" />
+ <aura:attribute name="agency_report_header_id" type="String" />
+ <aura:attribute name="result" type="String" default="" />
+ <!-- //鍖婚櫌 鐐归�夐渶瑕� -->
+ <aura:attribute name="hospital" type="string" default="" />
+ <aura:attribute name="hospitalId" type="string" default="" />
+ <aura:attribute name="hospitals" type="string" default="" />
+ <aura:attribute name="hospitalLinkId" type="string" default="" />
+ <aura:handler name="change" value="{!v.hospital}" action="{!c.hosChange}" />
+ <aura:attribute name="hospitalList" type="Map" />
+ <!-- 浣跨敤浜у搧1(浜у搧鍨嬪彿) -->
+ <aura:attribute name="UseProduct1" type="string" default="" />
+ <aura:attribute name="UseProduct1s" type="string" default="" />
+ <aura:handler name="change" value="{!v.UseProduct1}" action="{!c.UseProduct1Change}" />
+ <aura:attribute name="UseProduct1List" type="Map" />
+ <aura:attribute name="UseProduct1Id" type="string" default="" />
+ <!-- 浣跨敤浜у搧2 -->
+ <aura:attribute name="UseProduct2" type="string" default="" />
+ <aura:attribute name="UseProduct2s" type="string" default="" />
+ <aura:handler name="change" value="{!v.UseProduct2}" action="{!c.UseProduct2Change}" />
+ <aura:attribute name="UseProduct2List" type="Map" />
+ <aura:attribute name="UseProduct2Id" type="string" default="" />
+ <!-- 浣跨敤浜у搧3 -->
+ <aura:attribute name="UseProduct3" type="string" default="" />
+ <aura:attribute name="UseProduct3s" type="string" default="" />
+ <aura:handler name="change" value="{!v.UseProduct3}" action="{!c.UseProduct3Change}" />
+ <aura:attribute name="UseProduct3List" type="Map" />
+ <aura:attribute name="UseProduct3Id" type="string" default="" />
+ <!--SWAG-CF58C3 fy start -->
+ <aura:attribute name="AWStoken" type="String" />
+ <aura:attribute name="AWSsearch" type="String" />
+ <aura:attribute name="AWSinsert" type="String" />
+ <aura:attribute name="AWStransactionURL" type="String" />
+ <aura:attribute name="AWSDoctor2Map" type="String" />
+ <aura:attribute name="awsurl" type="Map" />
+ <aura:attribute name="contactawsurl" type="Map" />
+ <aura:attribute name="allselectlistAgencyPerson" type="Map" />
+ <!--SWAG-CF58C3 fy end -->
- <aura:attribute name="doctor_list" type="Map" />
- <!-- <aura:attribute name="doctor_title" type="String" /> -->
- <aura:attribute name="opportunity_list" type="Map" />
- <aura:attribute name="edit_copy_select_report_id" type="String" />
- <aura:attribute name="create_agency_report_id" type="String" />
- <aura:attribute name="reports" type="List" />
- <aura:attribute name="reports_now" type="List" />
- <aura:attribute name="reports_now_count" type="Integer" />
- <aura:attribute name="mode" type="String" />
- <aura:attribute name="select_report_data" type="Map" />
- <aura:attribute name="select_report_data_radio" type="Map" />
- <aura:attribute name="default_select_doctor_id" type="String" />
- <aura:attribute name="default_select_doctor_id2" type="String" />
- <aura:attribute name="default_select_opportunity_id" type="String" />
- <aura:attribute name="report_count" type="Integer" />
- <aura:attribute name="dialog_type" type="String" />
- <aura:attribute name="truthy" type="Boolean" default="false" />
- <aura:attribute name="list_message" type="String" default="鎼滅储" />
- <aura:attribute name="confirm_status" type="Integer" default="0" />
- <aura:attribute name="modal_confirm_title" type="String" />
- <aura:attribute name="modal_confirm_text" type="String" />
- <!-- <aura:attribute name="new_falg" type="String" /> -->
- <!-- fy -->
- <aura:attribute name="UserProType" type="String" />
- <!-- 绉戝 -->
- <aura:attribute name="opportunity_cfilter" type="String" />
- <aura:attribute
- name="update_select_report_data_id"
- type="String"
- default=""
- />
- <!-- 鎵归噺娣诲姞鏃ユ姤 start-->
- <aura:attribute name="reports_date" type="List" />
- <aura:attribute
- name="TableContent"
- type="String"
- description=" Show the Result class"
- />
- <aura:attribute
- name="TableContent2"
- type="String"
- description=" Show the Result class"
- />
- <aura:attribute
- name="TargetFileName"
- type="String"
- description="Name of the file"
- />
- <aura:attribute name="tableheaders" type="Object[]" />
- <aura:attribute name="fileContentData" type="String" />
- <aura:attribute name="filename" type="String" />
- <aura:attribute name="NumOfRecords" type="Integer" default="1000" />
- <aura:attribute name="showMain" type="Boolean" default="true" />
- <aura:attribute name="IsEventDefault" type="Boolean" default="true" />
- <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <aura:attribute name="errorData" type="Object" />
- <aura:attribute name="errorColumns" type="List" />
- <!-- show Error information -->
- <aura:attribute name="showErrorInfo" type="Boolean" default="false" />
- <!-- end DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <aura:attribute name="PIConfig" type="Map" />
+ <aura:attribute name="doctor_list" type="Map" />
+ <!-- <aura:attribute name="doctor_title" type="String" /> -->
+ <aura:attribute name="opportunity_list" type="Map" />
+ <aura:attribute name="edit_copy_select_report_id" type="String" />
+ <aura:attribute name="create_agency_report_id" type="String" />
+ <aura:attribute name="reports" type="List" />
+ <aura:attribute name="reports_now" type="List" />
+ <aura:attribute name="reports_now_count" type="Integer" />
+ <aura:attribute name="mode" type="String" />
+ <aura:attribute name="select_report_data" type="Map" />
+ <aura:attribute name="select_report_data_radio" type="Map" />
+ <aura:attribute name="default_select_doctor_id" type="String" />
+ <aura:attribute name="default_select_doctor_id2" type="String" />
+ <aura:attribute name="default_select_opportunity_id" type="String" />
+ <aura:attribute name="report_count" type="Integer" />
+ <aura:attribute name="dialog_type" type="String" />
+ <aura:attribute name="truthy" type="Boolean" default="false" />
+ <aura:attribute name="list_message" type="String" default="鎼滅储" />
+ <aura:attribute name="confirm_status" type="Integer" default="0" />
+ <aura:attribute name="modal_confirm_title" type="String" />
+ <aura:attribute name="modal_confirm_text" type="String" />
+ <!-- <aura:attribute name="new_falg" type="String" /> -->
+ <!-- fy -->
+ <aura:attribute name="UserProType" type="String" />
+ <!-- 绉戝 -->
+ <aura:attribute name="opportunity_cfilter" type="String" />
+ <aura:attribute name="update_select_report_data_id" type="String" default="" />
+ <!-- 鎵归噺娣诲姞鏃ユ姤 start-->
+ <aura:attribute name="reports_date" type="List" />
+ <aura:attribute name="TableContent" type="String" description=" Show the Result class" />
+ <aura:attribute name="TableContent2" type="String" description=" Show the Result class" />
+ <aura:attribute name="TargetFileName" type="String" description="Name of the file" />
+ <aura:attribute name="tableheaders" type="Object[]" />
+ <aura:attribute name="fileContentData" type="String" />
+ <aura:attribute name="filename" type="String" />
+ <aura:attribute name="NumOfRecords" type="Integer" default="1000" />
+ <aura:attribute name="showMain" type="Boolean" default="true" />
+ <aura:attribute name="IsEventDefault" type="Boolean" default="true" />
+ <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
+ <aura:attribute name="errorData" type="Object" />
+ <aura:attribute name="errorColumns" type="List" />
+ <!-- show Error information -->
+ <aura:attribute name="showErrorInfo" type="Boolean" default="false" />
+ <!-- end DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
- <ltng:require scripts="{! $Resource.jquery183minjs }" />
+ <aura:attribute name="PIConfig" type="Map" />
- <!-- 鎵归噺娣诲姞鏃ユ姤 end-->
- <!--銉兗銉変腑...-->
- <aura:renderIf isTrue="{!v.login}">
- <aura:renderIf isTrue="{!!v.loginEdit}">
- <!-- <div class="slds-spinner_container">
+ <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
+ <ltng:require scripts="{! $Resource.jquery183minjs }" />
+
+ <!-- 鎵归噺娣诲姞鏃ユ姤 end-->
+ <!--銉兗銉変腑...-->
+ <aura:renderIf isTrue="{!v.login}">
+ <aura:renderIf isTrue="{!!v.loginEdit}">
+ <!-- <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> -->
- <div
- class="slds-spinner_container"
- id="spinner"
- style="position: fixed; top: 123px"
- >
- <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>
- </aura:renderIf>
- </aura:renderIf>
- <div aura:id="report" id="report">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div style="width: 150px"></div>
- <div
- class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12 fontSize"
- >
- 鍛�
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 fontSize"
- >
- <ui:inputSelect
- aura:id="select_date"
- class="slds-select"
- change="{!c.select_date_change}"
- />
- </div>
- <!-- 浠g悊搴楁媴褰撹�� -->
- <div
- class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
- style="display: none"
- >
- {!v.fieldsmap.Person_In_Charge2__c}
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
- style="display: none"
- >
- <ui:inputSelect
- aura:id="select_agency_person"
- class="slds-select agency_person_select"
- change="{!c.select_agency_change}"
- />
- </div>
- <div style="width: 100px"></div>
- <div
- class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
- style="display: contents"
- >
- <ui:button
- aura:id="new_button"
- label="鏂板缓"
- press="{!c.new_report}"
- class="buttonFontSize"
- />
- </div>
- <div
- style="width: 400px"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12"
- >
- <ui:button
- aura:id="copy_button"
- label="澶嶅埗"
- press="{!c.copy_button}"
- disabled="true"
- class="buttonFontSize"
- />
- <ui:button
- aura:id="delete_button"
- label="鍒犻櫎"
- press="{!c.delete_button}"
- disabled="true"
- class="buttonFontSize"
- />
- <ui:button
- aura:id="import"
- label="瀵煎叆"
- press="{!c.import}"
- class="buttonFontSize"
- />
- <ui:button
- aura:id="export"
- label="瀵煎嚭"
- press="{!c.export_condition}"
- class="buttonFontSize"
- />
- <!-- <ui:button aura:id="returnbutton" label="杩斿洖" press="{!c.return_main_page}" /> -->
- </div>
- </div>
- </div>
- <div aura:id="report_list" class="report_list_area">
- <div
- class="slds-table--edit_container slds-is-relative"
- style="padding-left: 50px"
- >
- <table
- class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
- role="grid"
- style="width: 66.75rem"
- >
- <thead>
- <tr class="slds-line-height--reset">
- <th
- class="table_header slds-text-title--caps fontSize"
- style="width: 250px"
- >
- <span class="slds-truncate" title="Name">鏃ユ姤缂栧彿</span>
- </th>
- <th class="table_header slds-text-title--caps fontSize">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Person_In_Charge2__c}</span
- >
- <!-- {!v.fieldsmap.Person_In_Charge2__c} 鎷呭綋-->
- </th>
- <th
- class="table_header slds-text-title--caps fontSize"
- style="width: 250px"
- >
- <span class="slds-truncate" title="Name">鍖婚櫌</span>
- </th>
- <th class="table_header slds-text-title--caps fontSize">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Department_Cateogy__c}</span
- >
- <!-- {!v.fieldsmap.Department_Cateogy__c} 绉戝-->
- </th>
- <th class="table_header slds-text-title--caps fontSize">
- <span class="slds-truncate" title="Name">鎷滆浜�</span>
- <!-- {!v.fieldsmap.doctor2__c} 鎷滆浜� -->
- </th>
- <th class="table_header slds-text-title--caps fontSize">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.DealerPersonnel__c}</span
- >
- <!-- {!v.fieldsmap.visitor_title__c} 鑱屼綅-->
- </th>
- <th class="table_header slds-text-title--caps fontSize">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.WorkMark__c}</span
- >
- <!-- {!v.fieldsmap.visitor_title__c} 鑱屼綅-->
- </th>
- </tr>
- </thead>
- <tbody>
- <aura:iteration items="{!v.reports}" var="item" indexVar="index">
- <tr class="slds-hint-parent">
- <td role="gridcell" class="slds-cell-edit fontSize">
- <ui:inputRadio
- class="report_radio"
- name="report_radio"
- label="{!item.Name}"
- change="{!c.change_report_radio}"
- />
- <lightning:buttonIcon
- class="edit_button"
- iconName="utility:edit"
- size="small"
- alternativeText="edit"
- value="{!index}"
- onclick="{!c.edit_button}"
- />
- </td>
- <td role="gridcell" class="slds-cell-edit fontSize">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Person_In_Charge2__r.Name}"
- >{!item.Person_In_Charge2__r.Name}</span
- >
- </span>
- </td>
- <td scope="row" tabindex="0" class="slds-cell-edit fontSize">
+ <div class="slds-spinner_container" id="spinner" style="position: fixed;top:123px;">
<div
- class="slds-grid slds-grid--align-spread"
- style="word-wrap: break-word"
+ role="status"
+ class="slds-spinner slds-spinner_medium slds-spinner_brand"
>
- {!item.Agency_Hospital__r.Name}
+ <span class="slds-assistive-text">Loading</span>
+ <div class="slds-spinner__dot-a"></div>
+ <div class="slds-spinner__dot-b"></div>
</div>
- </td>
- <td role="gridcell" class="slds-cell-edit fontSize">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy_text__c}"
- >{!item.Department_Cateogy_text__c}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit fontSize">
- <span class="slds-grid slds-grid--align-spread">
- <span class="slds-truncate" title="{!item.doctor2__r.Name}">
- <span class="encrypt">{!item.doctor2__r.Name}</span>
- <span class="decrypt">{!item.doctor2__r.awsdata.name}</span>
- </span>
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit fontSize">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.DealerPersonnel__r.Name}"
- >{!item.DealerPersonnel__r.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit fontSize">
- <span class="slds-grid slds-grid--align-spread">
- <span class="slds-truncate" title="{!item.WorkMark__c}">
- <lightning:input
- type="checkbox"
- checked="{!item.WorkMark__c}"
- disabled="true"
- />
- </span>
- </span>
- </td>
- </tr>
- </aura:iteration>
- </tbody>
- </table>
- </div>
- <aura:renderIf isTrue="{!v.report_count > 0}">
- <aura:set attribute="else">
- <div class="no_data_area">{!v.list_message}</div>
- </aura:set>
- </aura:renderIf>
- </div>
- <!-- 鎵归噺娣诲姞鏃ユ姤 start-->
- <div
- aura:id="modal_import"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- aria-labelledby="headerTarget"
- >
- <aura:renderIf isTrue="{!v.modal_import_spinner}">
- <lightning:spinner alternativeText="Loading" size="medium" />
- </aura:renderIf>
- <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01">
- <!-- <ui:inputText aura:id="articleURL" /> -->
- <div class="demo-only" style="height: 8rem">
- <div class="slds-notify_container slds-is-relative">
- <div
- class="slds-notify slds-notify_toast slds-theme_success"
- role="alert"
- >
- <div class="slds-m-left_xx-large">
- <div
- class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
- >
- <lightning:icon
- alternativeText="Success"
- iconName="utility:success"
- size="small"
- class="buttonColor slds-m-right_small"
- />
- <h2 class="slds-text-heading_small">{!v.successMessage}</h2>
- </div>
</div>
- </div>
+ </aura:renderIf>
+ </aura:renderIf>
+ <div aura:id="report" id="report">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded">
+ <div style="width: 150px;"></div>
+ <div
+ class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12 fontSize">
+ 鍛�
+ </div>
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 fontSize">
+ <ui:inputSelect aura:id="select_date" class="slds-select" change="{!c.select_date_change}" />
+ </div>
+ <!-- 浠g悊搴楁媴褰撹�� -->
+ <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
+ style="display: none;">
+ {!v.fieldsmap.Person_In_Charge2__c}
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
+ style="display: none;">
+ <ui:inputSelect aura:id="select_agency_person" class="slds-select agency_person_select"
+ change="{!c.select_agency_change}" />
+ </div>
+ <div style="width: 100px;">
+ </div>
+ <div class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
+ style="display: contents;">
+ <ui:button aura:id="new_button" label="鏂板缓" press="{!c.new_report}" class="buttonFontSize" />
+ </div>
+ <div style="width: 400px;"
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12">
+ <ui:button aura:id="copy_button" label="澶嶅埗" press="{!c.copy_button}" disabled="true"
+ class="buttonFontSize" />
+ <ui:button aura:id="delete_button" label="鍒犻櫎" press="{!c.delete_button}" disabled="true"
+ class="buttonFontSize" />
+ <ui:button aura:id="import" label="瀵煎叆" press="{!c.import}" class="buttonFontSize" />
+ <ui:button aura:id="export" label="瀵煎嚭" press="{!c.export_condition}" class="buttonFontSize" />
+ <!-- <ui:button aura:id="returnbutton" label="杩斿洖" press="{!c.return_main_page}" /> -->
+ </div>
</div>
- </div>
</div>
- <!-- <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv01" style="z-index: 10001">
+ <div aura:id="report_list" class="report_list_area">
+ <div class="slds-table--edit_container slds-is-relative" style="padding-left: 50px;">
+ <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
+ role="grid" style="width:66.75rem;">
+ <thead>
+ <tr class="slds-line-height--reset">
+ <th class="table_header slds-text-title--caps fontSize" style="width:250px">
+ <span class="slds-truncate" title="Name">鏃ユ姤缂栧彿</span>
+ </th>
+ <th class="table_header slds-text-title--caps fontSize">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span>
+ <!-- {!v.fieldsmap.Person_In_Charge2__c} 鎷呭綋-->
+ </th>
+ <th class="table_header slds-text-title--caps fontSize" style="width:250px">
+ <span class="slds-truncate" title="Name">鍖婚櫌</span>
+ </th>
+ <th class="table_header slds-text-title--caps fontSize">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
+ <!-- {!v.fieldsmap.Department_Cateogy__c} 绉戝-->
+ </th>
+ <th class="table_header slds-text-title--caps fontSize">
+ <span class="slds-truncate" title="Name">鎷滆浜�</span>
+ <!-- {!v.fieldsmap.doctor2__c} 鎷滆浜� -->
+ </th>
+ <th class="table_header slds-text-title--caps fontSize">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.DealerPersonnel__c}</span>
+ <!-- {!v.fieldsmap.visitor_title__c} 鑱屼綅-->
+ </th>
+ <th class="table_header slds-text-title--caps fontSize">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.WorkMark__c}</span>
+ <!-- {!v.fieldsmap.visitor_title__c} 鑱屼綅-->
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <aura:iteration items="{!v.reports}" var="item" indexVar="index">
+ <tr class="slds-hint-parent">
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <ui:inputRadio class="report_radio" name="report_radio" label="{!item.Name}"
+ change="{!c.change_report_radio}" />
+ <lightning:buttonIcon class="edit_button" iconName="utility:edit" size="small"
+ alternativeText="edit" value="{!index}" onclick="{!c.edit_button}" />
+
+ </td>
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.Person_In_Charge2__r.Name}">{!item.Person_In_Charge2__r.Name}</span>
+ </span>
+ </td>
+ <td scope="row" tabindex="0" class="slds-cell-edit fontSize">
+ <div class="slds-grid slds-grid--align-spread" style="word-wrap: break-word;">
+ {!item.Agency_Hospital__r.Name}
+ </div>
+ </td>
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.Department_Cateogy_text__c}">{!item.Department_Cateogy_text__c}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.doctor2__r.Name}">
+ <span class="encrypt">{!item.doctor2__r.Name}</span>
+ <span class="decrypt">{!item.doctor2__r.awsdata.name}</span>
+ </span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.DealerPersonnel__r.Name}">{!item.DealerPersonnel__r.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit fontSize">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.WorkMark__c}">
+ <lightning:input type="checkbox" checked="{!item.WorkMark__c}"
+ disabled="true" />
+ </span>
+ </span>
+ </td>
+ </tr>
+ </aura:iteration>
+ </tbody>
+ </table>
+ </div>
+ <aura:renderIf isTrue="{!v.report_count > 0}">
+ <aura:set attribute="else">
+ <div class="no_data_area">
+ {!v.list_message}
+ </div>
+ </aura:set>
+ </aura:renderIf>
+ </div>
+ <!-- 鎵归噺娣诲姞鏃ユ姤 start-->
+ <div aura:id="modal_import" role="dialog" tabindex="-1"
+ class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
+ <aura:renderIf isTrue="{!v.modal_import_spinner}">
+ <lightning:spinner alternativeText="Loading" size="medium" />
+ </aura:renderIf>
+ <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01">
+ <!-- <ui:inputText aura:id="articleURL" /> -->
+ <div class="demo-only" style="height: 8rem;">
+ <div class="slds-notify_container slds-is-relative">
+ <div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
+ <div class=" slds-m-left_xx-large">
+ <div
+ class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
+ <lightning:icon alternativeText="Success" iconName="utility:success" size="small"
+ class="buttonColor slds-m-right_small" />
+ <h2 class="slds-text-heading_small ">{!v.successMessage}</h2>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv01" style="z-index: 10001">
<div class="demo-only" style="height: 8rem;">
<div class="slds-notify_container slds-is-relative">
<div class="slds-notify slds-notify_toast slds-theme_error" role="status">
@@ -467,857 +322,516 @@
</div>
</div>
</div> -->
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h4 id="headerTarget" class="slds-float--left"></h4>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鏃ユ姤鎵归噺瀵煎叆
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1 buttonFontSize"
- press="{!c.close_import}"
- />
- </div>
- <div
- class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium fontSize"
- >
- <aura:if isTrue="{!v.showMain}">
- <div>
- <lightning:input
- type="file"
- class="file"
- uara:id="file"
- onchange="{!c.CreateRecord}"
- />
- </div>
- <aura:set attribute="else">
- <ui:outputRichText
- class="uiOutputRichText slds-m--around-large fontSize"
- value="{!v.TableContent}"
- />
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="淇濆瓨"
- variant="brand"
- onclick="{!c.processFileContent}"
- class="buttonFontSize"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.cancel}"
- class="buttonFontSize"
- />
+ <div class="slds-modal__container ">
+ <div class="slds-modal__header ">
+ <h4 id="headerTarget" class="slds-float--left"></h4>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鏃ユ姤鎵归噺瀵煎叆</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴"
+ class="close_button slds-button slds-button--neutral slds-order--1 buttonFontSize"
+ press="{!c.close_import}" />
</div>
- <aura:if isTrue="{!v.showErrorInfo}">
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="瀵煎嚭閿欒淇℃伅"
- variant="brand"
- onclick="{!c.exportErrorInfo}"
- />
- </div>
- <div class="slds-p-around--large slds-align--absolute-center">
- <div style="height: 300px; overflow-x: scroll">
- <lightning:datatable
- keyField="id"
- data="{! v.errorData }"
- columns="{! v.errorColumns }"
- hideCheckboxColumn="true"
- />
- </div>
- </div>
- </aura:if>
- </aura:set>
- </aura:if>
- </div>
- </div>
- </div>
- <div
- aura:id="modal_importbg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
- <!-- 鎵归噺娣诲姞鏃ユ姤 end-->
-
- <!-- 鎵归噺瀵煎嚭鏃ユ姤 start-->
- <div
- aura:id="modal_export"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h4 id="headerTarget" class="slds-float--left"></h4>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鏃ユ姤鎵归噺瀵煎嚭
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1"
- press="{!c.close_export}"
- />
- </div>
- <div
- class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
- >
- <aura:if isTrue="{!v.showMain}">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- ></div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- >
- 娲诲姩鏃ュ紑濮嬫棩鏈�
- <lightning:input
- type="Date"
- class="slds-input slds-input_bare"
- aura:id="input-report-date1"
- />
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- >
- 娲诲姩鏃ョ粨鏉熸棩鏈�
- <lightning:input
- type="Date"
- class="slds-input slds-input_bare"
- aura:id="input-report-date2"
- />
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- ></div>
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="纭"
- variant="brand"
- onclick="{!c.select_repores_date}"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.close_export}"
- />
- </div>
- </div>
- <aura:set attribute="else">
- <ui:outputRichText
- class="uiOutputRichText slds-m--around-large"
- value="{!v.TableContent2}"
- />
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="纭"
- variant="brand"
- onclick="{!c.exportDate}"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.close_export}"
- />
- </div>
- </aura:set>
- </aura:if>
- </div>
- </div>
- </div>
- <div
- aura:id="modal_exportbg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
- <!-- 鎵归噺瀵煎嚭鏃ユ姤 end-->
- <div
- aura:id="modal_window"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- aria-labelledby="headerTarget"
- >
- <div class="slds-modal__container">
- <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv">
- <!-- <ui:inputText aura:id="articleURL" /> -->
- <div class="demo-only" style="height: 8rem">
- <div class="slds-notify_container slds-is-relative">
- <div
- class="slds-notify slds-notify_toast slds-theme_success"
- role="alert"
- >
- <div class="slds-m-left_xx-large">
- <div
- class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
- >
- <lightning:icon
- alternativeText="Success"
- iconName="utility:success"
- size="small"
- class="buttonColor slds-m-right_small"
- />
- <h2 class="slds-text-heading_small">{!v.successMessage}</h2>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div
- class="slds-modal slds-fade-in-open slds-hide"
- aura:id="errorDiv"
- style="z-index: 10001"
- >
- <!-- <ui:inputText aura:id="articleURL" /> -->
- <div class="demo-only" style="height: 8rem">
- <div class="slds-notify_container slds-is-relative">
- <div
- class="slds-notify slds-notify_toast slds-theme_error"
- role="status"
- >
- <div class="slds-m-left_xx-large">
- <div
- class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
- >
- <lightning:icon
- alternativeText="error"
- iconName="utility:error"
- size="small"
- class="buttonColor slds-m-right_small"
- />
- <h2 class="slds-text-heading_small">{!v.errorMessage}</h2>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div
- class="slds-modal__content slds-grow slds-p-around--medium"
- style="position: relative"
- >
- <aura:renderIf isTrue="{!v.loginEdit}">
- <lightning:spinner
- alternativeText="Loading"
- size="medium"
- style="width: 100%; height: 100%"
- />
- </aura:renderIf>
- <div class="slds-modal__header">
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鏃ユ姤({!v.selected_date} {!v.selected_agency_person})
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1"
- press="{!c.toggle_report}"
- />
- </div>
- <div class="slds-box slds-theme--shade">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- >
- 娲诲姩鏃�
- <lightning:input
- type="date"
- value="{!v.data.Report_Date__c}"
- aura:id="input-report-date"
- variant="label-hidden"
- />
- </div>
- <!-- 鍖婚櫌 -->
- <div
- aura:id="hospital_list"
- class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- data-select="single"
- >
- <!-- label="鍖婚櫌" -->
- 鍖婚櫌
- <lightning:input
- aura:id="hospital_input_text"
- class="field"
- value="{!v.hospital}"
- updateOn="keyup"
- variant="label-hidden"
- />
- <div class="slds-lookup__menu" id="lookup-66">
- <ul class="slds-lookup__list" role="listbox">
- <aura:iteration var="hospital" items="{!v.hospitalList}">
- <li
- role="presentation"
- onclick="{!c.selectHos}"
- data-accName="{!hospital.Hospital_Name_readonly__c}"
- data-accId="{!hospital.Hospital__c}"
- >
- <span
- class="slds-lookup__item-action slds-media"
- id="lookup-option-498"
- role="option"
- >
- <div class="slds-media__body">
- <div class="slds-lookup__result-text">
- {!hospital.Hospital_Name_readonly__c}
- </div>
+ <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium fontSize">
+ <aura:if isTrue="{!v.showMain}">
+ <div>
+ <lightning:input type="file" class="file" uara:id="file" onchange="{!c.CreateRecord}" />
+ </div>
+ <aura:set attribute="else">
+ <ui:outputRichText class="uiOutputRichText slds-m--around-large fontSize"
+ value="{!v.TableContent}" />
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="淇濆瓨" variant="brand" onclick="{!c.processFileContent}"
+ class="buttonFontSize" />
+ <lightning:button label="鍙栨秷" variant="brand" onclick="{!c.cancel}" class="buttonFontSize" />
</div>
- </span>
- </li>
- </aura:iteration>
- </ul>
- </div>
+ <aura:if isTrue="{!v.showErrorInfo}">
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="瀵煎嚭閿欒淇℃伅" variant="brand" onclick="{!c.exportErrorInfo}" />
+ </div>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <div style="height: 300px;overflow-x:scroll">
+ <lightning:datatable keyField="id" data="{! v.errorData }"
+ columns="{! v.errorColumns }" hideCheckboxColumn="true" />
+ </div>
+ </div>
+ </aura:if>
+ </aura:set>
+
+ </aura:if>
</div>
- <!-- 绉戝鍒嗙被 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- >
- {!v.fieldsmap.Department_Cateogy__c}
- <!-- <ui:inputText aura:id="select_department" class="slds-select"
+ </div>
+ </div>
+ <div aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+ <!-- 鎵归噺娣诲姞鏃ユ姤 end-->
+
+ <!-- 鎵归噺瀵煎嚭鏃ユ姤 start-->
+ <div aura:id="modal_export" role="dialog" tabindex="-1"
+ class="disp_none slds-modal slds-fade-in-open slds-modal--large">
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <h4 id="headerTarget" class="slds-float--left"></h4>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鏃ユ姤鎵归噺瀵煎嚭</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴"
+ class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_export}" />
+ </div>
+ <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium">
+ <aura:if isTrue="{!v.showMain}">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded">
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ </div>
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ 娲诲姩鏃ュ紑濮嬫棩鏈�
+ <lightning:input type="Date" class="slds-input slds-input_bare "
+ aura:id="input-report-date1" />
+ </div>
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ 娲诲姩鏃ョ粨鏉熸棩鏈�
+ <lightning:input type="Date" class="slds-input slds-input_bare "
+ aura:id="input-report-date2" />
+ </div>
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ </div>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="纭" variant="brand" onclick="{!c.select_repores_date}" />
+ <lightning:button label="鍙栨秷" variant="brand" onclick="{!c.close_export}" />
+ </div>
+ </div>
+ <aura:set attribute="else">
+ <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent2}" />
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="纭" variant="brand" onclick="{!c.exportDate}" />
+ <lightning:button label="鍙栨秷" variant="brand" onclick="{!c.close_export}" />
+ </div>
+ </aura:set>
+ </aura:if>
+ </div>
+ </div>
+ </div>
+ <div aura:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+ <!-- 鎵归噺瀵煎嚭鏃ユ姤 end-->
+ <div aura:id="modal_window" role="dialog" tabindex="-1"
+ class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
+ <div class="slds-modal__container">
+ <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv">
+ <!-- <ui:inputText aura:id="articleURL" /> -->
+ <div class="demo-only" style="height: 8rem;">
+ <div class="slds-notify_container slds-is-relative">
+ <div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
+ <div class=" slds-m-left_xx-large">
+ <div
+ class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
+ <lightning:icon alternativeText="Success" iconName="utility:success" size="small"
+ class="buttonColor slds-m-right_small" />
+ <h2 class="slds-text-heading_small ">{!v.successMessage}</h2>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv" style="z-index: 10001">
+ <!-- <ui:inputText aura:id="articleURL" /> -->
+ <div class="demo-only" style="height: 8rem;">
+ <div class="slds-notify_container slds-is-relative">
+ <div class="slds-notify slds-notify_toast slds-theme_error" role="status">
+ <div class=" slds-m-left_xx-large">
+ <div
+ class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
+ <lightning:icon alternativeText="error" iconName="utility:error" size="small"
+ class="buttonColor slds-m-right_small" />
+ <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="slds-modal__content slds-grow slds-p-around--medium" style="position: relative;">
+ <aura:renderIf isTrue="{!v.loginEdit}">
+ <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 100%;" />
+ </aura:renderIf>
+ <div class="slds-modal__header">
+ <h2 id="headerTarget" class="slds-text-heading--medium">
+ 鏃ユ姤({!v.selected_date} {!v.selected_agency_person})</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴"
+ class="close_button slds-button slds-button--neutral slds-order--1"
+ press="{!c.toggle_report}" />
+ </div>
+ <div class="slds-box slds-theme--shade">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded">
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
+ 娲诲姩鏃�
+ <lightning:input type="date" value="{!v.data.Report_Date__c}" aura:id="input-report-date"
+ variant="label-hidden" />
+ </div>
+ <!-- 鍖婚櫌 -->
+ <div aura:id="hospital_list"
+ class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
+ data-select="single">
+ <!-- label="鍖婚櫌" -->
+ 鍖婚櫌
+ <lightning:input aura:id="hospital_input_text" class="field" value="{!v.hospital}"
+ updateOn="keyup" variant="label-hidden" />
+ <div class="slds-lookup__menu" id="lookup-66">
+ <ul class="slds-lookup__list" role="listbox">
+ <aura:iteration var="hospital" items="{!v.hospitalList}">
+ <li role="presentation" onclick="{!c.selectHos}"
+ data-accName="{!hospital.Hospital_Name_readonly__c}"
+ data-accId="{!hospital.Hospital__c}">
+ <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
+ role="option">
+ <div class="slds-media__body">
+ <div class="slds-lookup__result-text">
+ {!hospital.Hospital_Name_readonly__c}</div>
+ </div>
+ </span>
+ </li>
+ </aura:iteration>
+ </ul>
+ </div>
+ </div>
+ <!-- 绉戝鍒嗙被 -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
+ {!v.fieldsmap.Department_Cateogy__c}
+ <!-- <ui:inputText aura:id="select_department" class="slds-select"
change="{!c.select_department}"/> -->
- <lightning:input
- type="text"
- onchange="{!c.select_department}"
- aura:id="select_department"
- variant="label-hidden"
- />
- </div>
- <!-- 缁忛攢鍟嗕汉鍛� change="{!c.select_DealerPersonnel}" -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- style="width: 145px"
- >
- {!v.fieldsmap.DealerPersonnel__c}
- <ui:inputSelect
- aura:id="select_DealerPersonnel"
- class="slds-select"
- />
- </div>
- <!-- 娲诲姩鍖哄垎 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- >
- {!v.fieldsmap.WorkRecord__c}
- <ui:inputSelect
- aura:id="select_purpose_type"
- class="slds-select"
- change="{!c.select_purpose_type}"
- />
- </div>
- <!-- 鎷滆浜� {!v.fieldsmap.doctor2__c}-->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- style="width: 145px"
- >
- 鎷滆浜�
- <ui:inputSelect
- aura:id="select_doctor"
- class="slds-select"
- change="{!c.doctor_change}"
- />
- </div>
- <!-- <p hidden="hidden"> -->
+ <lightning:input type="text" onchange="{!c.select_department}" aura:id="select_department"
+ variant="label-hidden" />
+ </div>
+ <!-- 缁忛攢鍟嗕汉鍛� change="{!c.select_DealerPersonnel}" -->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
+ style="width: 145px;">
+ {!v.fieldsmap.DealerPersonnel__c}
+ <ui:inputSelect aura:id="select_DealerPersonnel" class="slds-select" />
+ </div>
+ <!-- 娲诲姩鍖哄垎 -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
+ {!v.fieldsmap.WorkRecord__c}
+ <ui:inputSelect aura:id="select_purpose_type" class="slds-select"
+ change="{!c.select_purpose_type}" />
+ </div>
+ <!-- 鎷滆浜� {!v.fieldsmap.doctor2__c}-->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
+ style="width: 145px;">
+ 鎷滆浜�
+ <ui:inputSelect aura:id="select_doctor" class="slds-select" change="{!c.doctor_change}" />
+ </div>
+ <!-- <p hidden="hidden"> -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
- >
- <br />
- <ui:button
- label="鏂板缓"
- class="slds-button"
- press="{!c.createCon}"
- disabled="true"
- aura:id="new_con"
- />
- </div>
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
+ <br />
+ <ui:button label="鏂板缓" class="slds-button" press="{!c.createCon}" disabled="true"
+ aura:id="new_con" />
+ </div>
- <!-- </p> -->
- <hr />
- <!-- 浜у搧鍒嗙被(绗笁鍒嗙被) change="{!c.select_ProductClassification}" -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- >
- 浜у搧鍒嗙被(绗笁鍒嗙被)
- <ui:inputSelect
- aura:id="select_ProductClassification"
- class="slds-select"
- change="{!c.selectProductClassification}"
- />
- </div>
- <!-- 浣跨敤浜у搧1(浜у搧鍨嬪彿) UseProduct1__c -->
- <div
- aura:id="UseProduct1_List"
- class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- data-select="single"
- >
- <!-- label="浣跨敤浜у搧1(浜у搧鍨嬪彿)" -->
- 浣跨敤浜у搧1(浜у搧鍨嬪彿)
- <lightning:input
- aura:id="UseProduct1_TEXT"
- class="field"
- value="{!v.UseProduct1}"
- updateOn="keyup"
- variant="label-hidden"
- />
- <div class="slds-lookup__menu" id="lookup-11">
- <ul
- class="slds-lookup__list"
- role="listbox"
- style="max-height: 230px"
- >
- <aura:iteration
- var="UseProduct1"
- items="{!v.UseProduct1List}"
- >
- <li
- role="presentation"
- onclick="{!c.seletUseProduct1Change}"
- data-accid="{!UseProduct1.Id}"
- data-accName="{!UseProduct1.Asset_Model_No__c}"
- >
- <span
- class="slds-lookup__item-action slds-media"
- id="lookup-option-498"
- role="option"
- >
- <div class="slds-media__body">
- <div class="slds-lookup__result-text">
- {!UseProduct1.Asset_Model_No__c}
- </div>
+ <!-- </p> -->
+ <hr />
+ <!-- 浜у搧鍒嗙被(绗笁鍒嗙被) change="{!c.select_ProductClassification}" -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
+ 浜у搧鍒嗙被(绗笁鍒嗙被)
+ <ui:inputSelect aura:id="select_ProductClassification" class="slds-select"
+ change="{!c.selectProductClassification}" />
</div>
- </span>
- </li>
- </aura:iteration>
- </ul>
- </div>
- </div>
- <!-- 浣跨敤浜у搧2 UseProduct2__c -->
- <div
- aura:id="UseProduct2_List"
- class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- data-select="single"
- >
- <!-- label="浣跨敤浜у搧2" -->
- 浣跨敤浜у搧2
- <lightning:input
- aura:id="UseProduct2_TEXT"
- class="field"
- value="{!v.UseProduct2}"
- updateOn="keyup"
- variant="label-hidden"
- />
- <div class="slds-lookup__menu" id="lookup-22">
- <ul
- class="slds-lookup__list"
- role="listbox"
- style="max-height: 230px"
- >
- <aura:iteration
- var="UseProduct2"
- items="{!v.UseProduct2List}"
- >
- <li
- role="presentation"
- onclick="{!c.seletUseProduct2Change}"
- data-accid="{!UseProduct2.Id}"
- data-accName="{!UseProduct2.Asset_Model_No__c}"
- >
- <span
- class="slds-lookup__item-action slds-media"
- id="lookup-option-498"
- role="option"
- >
- <div class="slds-media__body">
- <div class="slds-lookup__result-text">
- {!UseProduct2.Asset_Model_No__c}
- </div>
+ <!-- 浣跨敤浜у搧1(浜у搧鍨嬪彿) UseProduct1__c -->
+ <div aura:id="UseProduct1_List"
+ class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
+ data-select="single">
+ <!-- label="浣跨敤浜у搧1(浜у搧鍨嬪彿)" -->
+ 浣跨敤浜у搧1(浜у搧鍨嬪彿)
+ <lightning:input aura:id="UseProduct1_TEXT" class="field" value="{!v.UseProduct1}"
+ updateOn="keyup" variant="label-hidden" />
+ <div class="slds-lookup__menu" id="lookup-11">
+ <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
+ <aura:iteration var="UseProduct1" items="{!v.UseProduct1List}">
+ <li role="presentation" onclick="{!c.seletUseProduct1Change}"
+ data-accid="{!UseProduct1.Id}"
+ data-accName="{!UseProduct1.Asset_Model_No__c}">
+ <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
+ role="option">
+ <div class="slds-media__body">
+ <div class="slds-lookup__result-text">
+ {!UseProduct1.Asset_Model_No__c}</div>
+ </div>
+ </span>
+ </li>
+ </aura:iteration>
+ </ul>
+ </div>
</div>
- </span>
- </li>
- </aura:iteration>
- </ul>
- </div>
- </div>
- <!-- 浣跨敤浜у搧3 UseProduct3__c -->
- <div
- aura:id="UseProduct3_List"
- class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- data-select="single"
- >
- <!-- label="浣跨敤浜у搧3" -->
- 浣跨敤浜у搧3
- <lightning:input
- aura:id="UseProduct3_TEXT"
- class="field"
- value="{!v.UseProduct3}"
- updateOn="keyup"
- variant="label-hidden"
- />
- <div class="slds-lookup__menu" id="lookup-33">
- <ul
- class="slds-lookup__list"
- role="listbox"
- style="max-height: 230px"
- >
- <aura:iteration
- var="UseProduct3"
- items="{!v.UseProduct3List}"
- >
- <li
- role="presentation"
- onclick="{!c.seletUseProduct3Change}"
- data-accid="{!UseProduct3.Id}"
- data-accName="{!UseProduct3.Asset_Model_No__c}"
- >
- <span
- class="slds-lookup__item-action slds-media"
- id="lookup-option-498"
- role="option"
- >
- <div class="slds-media__body">
- <div class="slds-lookup__result-text">
- {!UseProduct3.Asset_Model_No__c}
- </div>
+ <!-- 浣跨敤浜у搧2 UseProduct2__c -->
+ <div aura:id="UseProduct2_List"
+ class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
+ data-select="single">
+ <!-- label="浣跨敤浜у搧2" -->
+ 浣跨敤浜у搧2
+ <lightning:input aura:id="UseProduct2_TEXT" class="field" value="{!v.UseProduct2}"
+ updateOn="keyup" variant="label-hidden" />
+ <div class="slds-lookup__menu" id="lookup-22">
+ <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
+ <aura:iteration var="UseProduct2" items="{!v.UseProduct2List}">
+ <li role="presentation" onclick="{!c.seletUseProduct2Change}"
+ data-accid="{!UseProduct2.Id}"
+ data-accName="{!UseProduct2.Asset_Model_No__c}">
+ <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
+ role="option">
+ <div class="slds-media__body">
+ <div class="slds-lookup__result-text">
+ {!UseProduct2.Asset_Model_No__c}</div>
+ </div>
+ </span>
+ </li>
+ </aura:iteration>
+ </ul>
+ </div>
</div>
- </span>
- </li>
- </aura:iteration>
- </ul>
- </div>
- </div>
- <!-- 鏁堟灉/杩涘害 EffectProgress__c-->
- <div
- aura:id="product_category_select1"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- >
- {!v.fieldsmap.EffectProgress__c}
- <ui:inputSelect
- aura:id="select_EffectProgress"
- class="slds-select"
- />
- </div>
- <hr />
- <!-- 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺 ConsumptionOfConsumables__c-->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
- >
- {!v.fieldsmap.ConsumptionOfConsumables__c}
- <!-- <ui:inputText aura:id="select_ConsumptionOfConsumables" class="slds-select"
+ <!-- 浣跨敤浜у搧3 UseProduct3__c -->
+ <div aura:id="UseProduct3_List"
+ class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
+ data-select="single">
+ <!-- label="浣跨敤浜у搧3" -->
+ 浣跨敤浜у搧3
+ <lightning:input aura:id="UseProduct3_TEXT" class="field" value="{!v.UseProduct3}"
+ updateOn="keyup" variant="label-hidden" />
+ <div class="slds-lookup__menu" id="lookup-33">
+ <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
+ <aura:iteration var="UseProduct3" items="{!v.UseProduct3List}">
+ <li role="presentation" onclick="{!c.seletUseProduct3Change}"
+ data-accid="{!UseProduct3.Id}"
+ data-accName="{!UseProduct3.Asset_Model_No__c}">
+ <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
+ role="option">
+ <div class="slds-media__body">
+ <div class="slds-lookup__result-text">
+ {!UseProduct3.Asset_Model_No__c}</div>
+ </div>
+ </span>
+ </li>
+ </aura:iteration>
+ </ul>
+ </div>
+ </div>
+ <!-- 鏁堟灉/杩涘害 EffectProgress__c-->
+ <div aura:id="product_category_select1"
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
+ {!v.fieldsmap.EffectProgress__c}
+ <ui:inputSelect aura:id="select_EffectProgress" class="slds-select" />
+ </div>
+ <hr />
+ <!-- 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺 ConsumptionOfConsumables__c-->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
+ {!v.fieldsmap.ConsumptionOfConsumables__c}
+ <!-- <ui:inputText aura:id="select_ConsumptionOfConsumables" class="slds-select"
change="{!c.select_ConsumptionOfConsumables}" /> -->
- <lightning:input
- type="text"
- onchange="{!c.select_ConsumptionOfConsumables}"
- aura:id="select_ConsumptionOfConsumables"
- variant="label-hidden"
- />
- </div>
- <!-- 鏈+鍒嗙被 WarlockClassification__c -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
- >
- {!v.fieldsmap.WarlockClassification__c}
- <ui:inputSelect
- aura:id="select_OtherBrandConsumables"
- class="slds-select"
- />
- </div>
- <!-- 宸查噰鐢ㄥ叾浠栧搧鐗� ProductCcategory__c -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
- >
- {!v.fieldsmap.ProductCcategory__c}
- <ui:inputSelect
- aura:id="select_ProductCcategory"
- class="slds-select"
- change="{!c.selectpurposetype}"
- />
- </div>
- <!-- 鍏朵粬鍝佺墝浜у搧绫诲埆 -->
- <div
- aura:id="result"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
- >
- {!v.fieldsmap.productCategories__c}
- <ui:inputSelect
- aura:id="select_productCategories"
- class="slds-select"
- />
- </div>
- <!-- 浜у搧鐢ㄩ噺 warlocksNumber__c -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
- >
- {!v.fieldsmap.warlocksNumber__c}
- <!-- <ui:inputText aura:id="select_warlocksNumber" class="slds-select"
+ <lightning:input type="text" onchange="{!c.select_ConsumptionOfConsumables}"
+ aura:id="select_ConsumptionOfConsumables" variant="label-hidden" />
+ </div>
+ <!-- 鏈+鍒嗙被 WarlockClassification__c -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
+ {!v.fieldsmap.WarlockClassification__c}
+ <ui:inputSelect aura:id="select_OtherBrandConsumables" class="slds-select" />
+ </div>
+ <!-- 宸查噰鐢ㄥ叾浠栧搧鐗� ProductCcategory__c -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
+ {!v.fieldsmap.ProductCcategory__c}
+ <ui:inputSelect aura:id="select_ProductCcategory" class="slds-select"
+ change="{!c.selectpurposetype}" />
+ </div>
+ <!-- 鍏朵粬鍝佺墝浜у搧绫诲埆 -->
+ <div aura:id="result"
+ class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
+ {!v.fieldsmap.productCategories__c}
+ <ui:inputSelect aura:id="select_productCategories" class="slds-select" />
+ </div>
+ <!-- 浜у搧鐢ㄩ噺 warlocksNumber__c -->
+ <div
+ class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
+ {!v.fieldsmap.warlocksNumber__c}
+ <!-- <ui:inputText aura:id="select_warlocksNumber" class="slds-select"
change="{!c.select_warlocksNumber}" /> -->
- <lightning:input
- type="text"
- onchange="{!c.select_warlocksNumber}"
- aura:id="select_warlocksNumber"
- variant="label-hidden"
- />
+ <lightning:input type="text" onchange="{!c.select_warlocksNumber}"
+ aura:id="select_warlocksNumber" variant="label-hidden" />
+ </div>
+ <!-- 鏀彺闇�姹� WorkMark__c-->
+ <div style="padding-left: 12px;">
+ {!v.fieldsmap.WorkMark__c}
+ <lightning:input type="checkbox" aura:id="select_WorkMark" />
+ </div>
+ <div aura:id="input-opportunity-stage"
+ class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
+ {!v.fieldsmap.StageName__c}
+ <ui:inputSelect aura:id="select_stageName" class="slds-select" />
+ </div>
+ <div aura:id="input-opportunity-amount1"
+ class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
+ {!v.fieldsmap.Amount__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 鍖婚櫌閲囪喘棰勭畻(涓嶅惈绋�,鍏�)-->
+ <lightning:inputField value="{!v.oppdata.Amount__c}" class="" />
+
+ </div>
+ <div aura:id="input-opportunity-amount2"
+ class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
+ {!v.fieldsmap.OCMSale_Price__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 璁㈣揣閲戦(涓嶅惈绋�,鍏�) -->
+ <lightning:inputField value="{!v.oppdata.OCMSale_Price__c}" class="" />
+ </div>
+ <div aura:id="input-opportunity-date"
+ class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
+ {!v.fieldsmap.Close_Forecasted_Date__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 棰勬祴涓嶰CSM绛剧害鏃� -->
+ <lightning:inputField value="{!v.oppdata.Close_Forecasted_Date__c}" class="" />
+ </div>
+ <hr />
+ </div>
+ </div>
+ <div class="save_button_area">
+ <ui:button aura:id="save_button" label="淇濆瓨骞舵柊寤�"
+ class="save_button slds-button slds-button--brand slds-order--3" press="{!c.save_report}" />
+ </div>
+ <aura:renderIf isTrue="{!v.reports_now_count > 0}">
+ <div class="mt40 slds-box slds-theme--shade">
+ <div class="slds-table--edit_container slds-is-relative">
+ <table
+ class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
+ role="grid">
+ <thead>
+ <tr class="slds-line-height--reset">
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name"></span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">鍖婚櫌</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate"
+ title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__c}</span>
+ <!-- 瀹㈡埛浜哄憳 -->
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate"
+ title="Name">{!v.fieldsmap.visitor_title__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.WorkRecord__c}</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <aura:iteration items="{!v.reports_now}" var="item" indexVar="index">
+ <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.Department_Cateogy_text__c}">{!item.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.Agency_Hospital__r.Name}">{!item.Agency_Hospital__r.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.Department_Cateogy_text__c}">{!item.Department_Cateogy_text__c}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.doctor2__r.Name}">{!item.doctor2__r.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.visitor_title__c}">{!item.visitor_title__c}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate"
+ title="{!item.WorkRecord__c}">{!item.WorkRecord__c}</span>
+ </span>
+ </td>
+ </tr>
+ </aura:iteration>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </aura:renderIf>
</div>
- <!-- 鏀彺闇�姹� WorkMark__c-->
- <div style="padding-left: 12px">
- {!v.fieldsmap.WorkMark__c}
- <lightning:input type="checkbox" aura:id="select_WorkMark" />
- </div>
- <div
- aura:id="input-opportunity-stage"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
- >
- {!v.fieldsmap.StageName__c}
- <ui:inputSelect aura:id="select_stageName" class="slds-select" />
- </div>
- <div
- aura:id="input-opportunity-amount1"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
- >
- {!v.fieldsmap.Amount__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 鍖婚櫌閲囪喘棰勭畻(涓嶅惈绋�,鍏�)-->
- <lightning:inputField value="{!v.oppdata.Amount__c}" class="" />
- </div>
- <div
- aura:id="input-opportunity-amount2"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
- >
- {!v.fieldsmap.OCMSale_Price__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 璁㈣揣閲戦(涓嶅惈绋�,鍏�) -->
- <lightning:inputField
- value="{!v.oppdata.OCMSale_Price__c}"
- class=""
- />
- </div>
- <div
- aura:id="input-opportunity-date"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
- >
- {!v.fieldsmap.Close_Forecasted_Date__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> 棰勬祴涓嶰CSM绛剧害鏃� -->
- <lightning:inputField
- value="{!v.oppdata.Close_Forecasted_Date__c}"
- class=""
- />
- </div>
- <hr />
- </div>
</div>
- <div class="save_button_area">
- <ui:button
- aura:id="save_button"
- label="淇濆瓨骞舵柊寤�"
- class="save_button slds-button slds-button--brand slds-order--3"
- press="{!c.save_report}"
- />
- </div>
- <aura:renderIf isTrue="{!v.reports_now_count > 0}">
- <div class="mt40 slds-box slds-theme--shade">
- <div class="slds-table--edit_container slds-is-relative">
- <table
- class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
- role="grid"
- >
- <thead>
- <tr class="slds-line-height--reset">
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"></span>
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name">鍖婚櫌</span>
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Department_Cateogy__c}</span
- >
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.doctor2__c}</span
- >
- <!-- 瀹㈡埛浜哄憳 -->
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.visitor_title__c}</span
- >
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.WorkRecord__c}</span
- >
- </th>
- </tr>
- </thead>
- <tbody>
- <aura:iteration
- items="{!v.reports_now}"
- var="item"
- indexVar="index"
- >
- <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy_text__c}"
- >{!item.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Agency_Hospital__r.Name}"
- >{!item.Agency_Hospital__r.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy_text__c}"
- >{!item.Department_Cateogy_text__c}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.doctor2__r.Name}"
- >{!item.doctor2__r.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.visitor_title__c}"
- >{!item.visitor_title__c}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.WorkRecord__c}"
- >{!item.WorkRecord__c}</span
- >
- </span>
- </td>
- </tr>
- </aura:iteration>
- </tbody>
- </table>
+ </div>
+
+
+
+ <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+
+ <div aura:id="modal_confirm" role="dialog" tabindex="-2" aria-labelledby="header43"
+ class="disp_none slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <h2 id="header43" class="slds-text-heading--medium">{!v.modal_confirm_title}</h2>
</div>
- </div>
- </aura:renderIf>
- </div>
+ <div class="slds-modal__content slds-p-around--medium">
+ <p>{!v.modal_confirm_text}</p>
+ </div>
+ <div class="slds-modal__footer">
+ <ui:button label="鏄�" class="slds-button slds-button--brand" press="{!c.yes_button}" />
+ <ui:button label="鍚�" class="slds-button slds-button--neutral" press="{!c.no_button}" />
+ </div>
+ </div>
</div>
- </div>
+ <div aura:id="modal_confirm_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
- <div
- aura:id="modal_bg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
-
- <div
- aura:id="modal_confirm"
- role="dialog"
- tabindex="-2"
- aria-labelledby="header43"
- class="disp_none slds-modal slds-fade-in-open"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h2 id="header43" class="slds-text-heading--medium">
- {!v.modal_confirm_title}
- </h2>
- </div>
- <div class="slds-modal__content slds-p-around--medium">
- <p>{!v.modal_confirm_text}</p>
- </div>
- <div class="slds-modal__footer">
- <ui:button
- label="鏄�"
- class="slds-button slds-button--brand"
- press="{!c.yes_button}"
- />
- <ui:button
- label="鍚�"
- class="slds-button slds-button--neutral"
- press="{!c.no_button}"
- />
- </div>
+ <div aura:id="modal_newAC" role="dialog" tabindex="-3" aria-labelledby="headertest"
+ class="disp_none slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <h2 id="headertest" class="slds-text-heading--medium">鏂板缓.鎷滆浜�</h2>
+ </div>
+ <div class="slds-modal__content slds-p-around--medium">
+ <lightning:recordEditForm aura:id="recordEditForm" objectApiName="Agency_Contact__c"
+ onsuccess="{!c.handleSuccess}" onload="{!c.showRequiredFields}" onsubmit="{!c.handleSubmit}">
+ <lightning:messages aura:id="OppMessage" />
+ <!-- onload="{!c.showRequiredFields}" -->
+ <aura:renderIf isTrue="{!v.truthy}">
+ <lightning:inputField fieldName="Name" aura:id="newOpportunityField" />
+ <lightning:inputField fieldName="Type__c" aura:id="newOpportunityField" />
+ <lightning:inputField fieldName="Doctor_Division1__c" aura:id="newOpportunityField" />
+ </aura:renderIf>
+ <br />
+ <br />
+ <br />
+ <br />
+ <br />
+ <div class="save_button_area">
+ <lightning:button class="slds-m-top_small" type="button" label="鍙栨秷"
+ onclick="{!c.createCancel}" />
+ <lightning:button class="slds-m-top_small" type="button" label="淇濆瓨"
+ onclick="{!c.handleSubmit}" />
+ </div>
+ </lightning:recordEditForm>
+ </div>
+ </div>
</div>
- </div>
- <div
- aura:id="modal_confirm_bg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
- <div
- aura:id="modal_newAC"
- role="dialog"
- tabindex="-3"
- aria-labelledby="headertest"
- class="disp_none slds-modal slds-fade-in-open"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h2 id="headertest" class="slds-text-heading--medium">鏂板缓.鎷滆浜�</h2>
- </div>
- <div class="slds-modal__content slds-p-around--medium">
- <lightning:recordEditForm
- aura:id="recordEditForm"
- objectApiName="Agency_Contact__c"
- onsuccess="{!c.handleSuccess}"
- onload="{!c.showRequiredFields}"
- onsubmit="{!c.handleSubmit}"
- >
- <lightning:messages aura:id="OppMessage" />
- <!-- onload="{!c.showRequiredFields}" -->
- <aura:renderIf isTrue="{!v.truthy}">
- <lightning:inputField
- fieldName="Name"
- aura:id="newOpportunityField"
- />
- <lightning:inputField
- fieldName="Type__c"
- aura:id="newOpportunityField"
- />
- <lightning:inputField
- fieldName="Doctor_Division1__c"
- aura:id="newOpportunityField"
- />
- </aura:renderIf>
- <br />
- <br />
- <br />
- <br />
- <br />
- <div class="save_button_area">
- <lightning:button
- class="slds-m-top_small"
- type="button"
- label="鍙栨秷"
- onclick="{!c.createCancel}"
- />
- <lightning:button
- class="slds-m-top_small"
- type="button"
- label="淇濆瓨"
- onclick="{!c.handleSubmit}"
- />
- </div>
- </lightning:recordEditForm>
- </div>
- </div>
- </div>
-</aura:component>
+
+</aura:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css
index 7451abc..b528937 100644
--- a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css
+++ b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css
@@ -1,202 +1,202 @@
-@import "c/lexCssUtility";
+@import 'c/lexCssUtility';
.THIS .bcolor {
- color: #333;
+ color: #333;
}
.THIS.height100vh {
- height: 100vh;
+ height: 100vh;
}
.THIS.contents_wrapper {
- padding-top: 50px;
+ padding-top: 50px;
}
.THIS .mt5 {
- margin-top: 5px;
+ margin-top: 5px;
}
.THIS .mt40 {
- margin-top: 40px;
+ margin-top: 40px;
}
.THIS .edit_button {
- float: right;
- margin: -1.5em 0.5em 0 0;
- border: 0;
+ float: right;
+ margin: -1.5em 0.5em 0 0;
+ border: 0;
}
.THIS .no_data_area {
- text-align: center;
- margin: 0.5em 0;
+ text-align: center;
+ margin: .5em 0;
}
.THIS.report_list_area {
- margin: 40px 0 20px 100px;
- height: 60vh;
- overflow-y: scroll;
+ margin: 40px 0 20px 100px;
+ height: 60vh;
+ overflow-y: scroll;
}
.THIS .report_radio {
- float: left;
+ float: left;
}
.THIS .table_header {
- width: 9.4rem;
- height: 2em;
+ width: 9.4rem;
+ height: 2em;
}
.THIS.disp_none {
- display: none;
+ display: none;
}
.THIS .disp_none {
- display: none;
+ display: none;
}
.THIS .tr {
- text-align: right;
+ text-align: right;
}
.THIS .close_button {
- float: right;
- margin-top: -2em;
+ float: right;
+ margin-top: -2em;
}
.THIS .close_icn svg {
- fill: #fefefe;
+ fill: #fefefe;
}
.THIS .slds-progress__marker {
- cursor: default;
+ cursor: default;
}
.THIS .progress_0 {
- width: 0%;
+ width: 0%;
}
.THIS .progress_100 {
- width: 100%;
+ width: 100%;
}
.THIS .new_btn_area {
- text-align: center;
- margin-top: 22px;
+ text-align: center;
+ margin-top: 22px;
}
.THIS .new_btn {
- width: 100%;
+ width: 100%;
}
.THIS .save_button_area {
- margin: 1em 0;
- text-align: right;
+ margin: 1em 0;
+ text-align: right;
}
.THIS .save_button {
- background-color: #ffa500;
- border: 1px solid #ff8c00;
+ background-color: #ffa500;
+ border: 1px solid #ff8c00;
}
.THIS .report_data_header {
- border-bottom: 2px solid #ccc;
+ border-bottom: 2px solid #ccc;
}
.THIS .report_data_area {
- border-bottom: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
}
.THIS.fade {
- transition: 5s opacity linear;
+ transition: 5s opacity linear;
}
.THIS.animation_off {
- opacity: 0;
+ opacity: 0;
}
.THIS.animation_on {
- opacity: 1;
+ opacity: 1;
}
.THIS .fade {
- transition: 5s opacity linear;
+ transition: 5s opacity linear;
}
.THIS .animation_off {
- opacity: 0;
+ opacity: 0;
}
.THIS .animation_on {
- opacity: 1;
+ opacity: 1;
}
.THIS .divbotuser {
- width: fit-content;
+ width: fit-content;
}
.THIS .toastMessage.forceActionsText {
- white-space: pre-line !important;
+ white-space: pre-line !important;
}
.THIS .slds-file-selector__dropzone .slds-file-selector__text {
- display: none;
+ display: none;
}
.THIS .slds-input:focus,
.THIS .slds-input:active {
- border-color: rgb(216, 221, 230);
- box-shadow: none;
+ border-color: rgb(216, 221, 230);
+ box-shadow: none;
}
.THIS .customRequired {
- font-weight: 400;
+ font-weight: 400;
}
.THIS .customRequired:before {
- content: "*";
- margin: 0 0.125rem 0 0.125rem;
- color: rgb(194, 57, 52);
- float: left;
+ content: "*";
+ margin: 0 0.125rem 0 0.125rem;
+ color: rgb(194, 57, 52);
+ float: left;
}
.THIS .none {
- display: none;
+ display: none;
}
.THIS tr .decrypt {
- display: none;
+ display: none;
}
.THIS tr:hover .decrypt {
- display: unset;
+ display: unset;
}
.THIS tr:hover .encrypt {
- display: none;
+ display: none;
}
.THIS tr:hover .encrypt {
- display: none;
+ display: none;
}
.THIS .buttonFontSize {
- font-size: 18px;
- min-width: 80px;
- max-width: 110px;
+ font-size: 18px;
+ min-width: 80px;
+ max-width: 110px;
}
.THIS .fontSize {
- font-size: 18px;
+ font-size: 18px;
}
.THIS thead th {
- font-size: 18px;
+ font-size: 18px;
}
.THIS table {
- table-layout: fixed;
+ table-layout: fixed;
}
.THIS td {
- white-space: normal;
- overflow-wrap: break-word;
-}
+ white-space: normal;
+ overflow-wrap: break-word;
+}
\ No newline at end of file
diff --git a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js
index f5e6a6b..baa5976 100644
--- a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js
+++ b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js
@@ -1,379 +1,352 @@
({
- doInit: function (component, event, helper) {
- helper.doinit(component, event, helper);
- },
+ doInit: function (component, event, helper) {
+ helper.doinit(component, event, helper);
+ },
- createAopp: function (component, event, helper) {
- var addRecordEvent = $A.get("e.force:createRecord");
- addRecordEvent.setParams({
- entityApiName: "Agency_Opportunity__c",
- recordTypeId: "012100000006KW7"
- });
- addRecordEvent.fire();
- },
+ createAopp: function (component, event, helper) {
+ var addRecordEvent = $A.get('e.force:createRecord');
+ addRecordEvent.setParams({
+ entityApiName: 'Agency_Opportunity__c',
+ recordTypeId: '012100000006KW7'
+ });
+ addRecordEvent.fire();
+ },
- new_report: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨骞舵柊寤�");
- helper.new_report(component, event, helper);
- },
+ new_report: function (component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨骞舵柊寤�');
+ helper.new_report(component, event, helper);
+ },
- copy_button: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨骞舵柊寤�");
- helper.copy_button(component, event, helper);
- },
- delete_button: function (component, event, helper) {
- helper.delete_button(component, event, helper);
- },
- change_report_radio: function (component, event, helper) {
- helper.change_report_radio(component, event, helper);
- },
+ copy_button: function (component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨骞舵柊寤�');
+ helper.copy_button(component, event, helper);
+ },
+ delete_button: function (component, event, helper) {
+ helper.delete_button(component, event, helper);
+ },
+ change_report_radio: function (component, event, helper) {
+ helper.change_report_radio(component, event, helper);
+ },
- edit_button: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨");
- helper.edit_button(component, event, helper);
- },
+ edit_button: function (component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨');
+ helper.edit_button(component, event, helper);
+ },
- createCon: function (component, event, helper) {
- helper.createCon(component, event, helper);
- },
+ createCon: function (component, event, helper) {
+ helper.createCon(component, event, helper);
+ },
- showRequiredFields: function (component, event, helper) {
- $A.util.removeClass(component.find("newOpportunityField"), "none");
- $A.util.removeClass(component.find("newOpportunityField"), "none");
- },
+ showRequiredFields: function (component, event, helper) {
+ $A.util.removeClass(component.find("newOpportunityField"), "none");
+ $A.util.removeClass(component.find("newOpportunityField"), "none");
+ },
- handleSuccess: function (component, event, helper) {
- helper.handleSuccess(component, event, helper);
- },
+ handleSuccess: function (component, event, helper) {
+ helper.handleSuccess(component, event, helper);
+ },
- handleSubmit: function (component, event, helper) {
- event.preventDefault(); // stop form submission
- var showValidationError = false;
- var fields = component.find("newOpportunityField");
- var vaildationFailReason = "";
- let agencyReport = Object.create(null);
- fields.forEach(function (field) {
- if (
- field.get("v.fieldName") === "Type__c" &&
- $A.util.isEmpty(field.get("v.value"))
- ) {
- showValidationError = true;
- vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
- } else if (
- field.get("v.fieldName") === "Doctor_Division1__c" &&
- $A.util.isEmpty(field.get("v.value"))
- ) {
- showValidationError = true;
- if (vaildationFailReason != "") {
- vaildationFailReason += "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
- } else {
- vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
- }
- }
- //SWAG-CF58C3 fy start
- if (field.get("v.fieldName") === "Name") {
- agencyReport["name"] = field.get("v.value");
- } else if (field.get("v.fieldName") === "Type__c") {
- agencyReport["type"] = field.get("v.value");
- } else if (field.get("v.fieldName") === "Doctor_Division1__c") {
- agencyReport["doctorDivision1"] = field.get("v.value");
- }
- //SWAG-CF58C3 fy end
- });
- if (!showValidationError) {
- //SWAG-CF58C3 fy start
- var agencyHospitalid = component.get("v.hospitalLinkId");
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
- debugger;
- let hospitalName = "";
- //璋冪敤鍚庣searchAgencyDataId鏂规硶鏌ヨ鍑哄尰闄笅闈㈡墍鏈夊鎴蜂汉鍛榙ataid
- helper.CallBackAction(
- component,
- "searchAgencyDataId",
- {
- hospitalId: agencyHospitalid
- },
- function (data) {
- if (data.getState() == "SUCCESS") {
- var data = data.getReturnValue();
- if (data.IsSuccess == true) {
- let agencyContactIds = "";
- if (data.Message == "" && data.Data && data.Data.length > 0) {
- hospitalName = data.Data[0].Agency_Hospital__r.Name;
- for (var i = 0; i < data.Data.length; i++) {
- if (data.Data[i].AWS_Data_Id__c)
- agencyContactIds += "," + data.Data[i].AWS_Data_Id__c;
+ handleSubmit: function (component, event, helper) {
+ event.preventDefault(); // stop form submission
+ var showValidationError = false;
+ var fields = component.find("newOpportunityField");
+ var vaildationFailReason = '';
+ let agencyReport = Object.create(null);
+ fields.forEach(function (field) {
+ if (field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))) {
+ showValidationError = true;
+ vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
+ } else if (field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))) {
+ showValidationError = true;
+ if (vaildationFailReason != '') {
+ vaildationFailReason += "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
+ } else {
+ vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
}
- agencyContactIds = agencyContactIds.substring(1);
- agencyReport["agencyContactIds"] = agencyContactIds;
- } else {
- agencyReport["agencyContactIds"] = agencyContactIds;
- }
- var arr = new Array();
- arr.push(agencyReport);
- var requestData = JSON.stringify(arr);
- // helper.set_aws_url(component,data,agencyHospitalid);
- var token = component.get("v.AWStoken");
- var newUrl = component.get("v.AWSinsert") + "V2";
-
- component.set("v.login", true);
- helper.insert_agencycontact(
- component,
- token,
- newUrl,
- requestData,
- agencyHospitalid,
- helper,
- hospitalName
- );
- } else {
- helper.ShowToast({
- message: data.message,
- type: "error"
- });
}
- } else {
- helper.ShowToast({
- message: "searchAgency澶辫触",
- type: "error"
- });
- }
+ //SWAG-CF58C3 fy start
+ if (field.get("v.fieldName") === 'Name') {
+ agencyReport['name'] = field.get("v.value");
+ } else if (field.get("v.fieldName") === 'Type__c') {
+ agencyReport['type'] = field.get("v.value");
+ } else if (field.get("v.fieldName") === 'Doctor_Division1__c') {
+ agencyReport['doctorDivision1'] = field.get("v.value");
+ }
+ //SWAG-CF58C3 fy end
+ });
+ if (!showValidationError) {
+ //SWAG-CF58C3 fy start
+ var agencyHospitalid = component.get('v.hospitalLinkId');
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+ debugger
+ let hospitalName = '';
+ //璋冪敤鍚庣searchAgencyDataId鏂规硶鏌ヨ鍑哄尰闄笅闈㈡墍鏈夊鎴蜂汉鍛榙ataid
+ helper.CallBackAction(component, 'searchAgencyDataId', {
+ hospitalId: agencyHospitalid
+ }, function (data) {
+ if (data.getState() == "SUCCESS") {
+ var data = data.getReturnValue();
+ if (data.IsSuccess == true) {
+ let agencyContactIds = ''
+ if (data.Message == '' && data.Data && data.Data.length > 0) {
+ hospitalName = data.Data[0].Agency_Hospital__r.Name;
+ for (var i = 0; i < data.Data.length; i++) {
+ if (data.Data[i].AWS_Data_Id__c)
+ agencyContactIds += ',' + data.Data[i].AWS_Data_Id__c;
+ }
+ agencyContactIds = agencyContactIds.substring(1);
+ agencyReport['agencyContactIds'] = agencyContactIds;
+ } else {
+ agencyReport['agencyContactIds'] = agencyContactIds;
+ }
+ var arr = new Array();
+ arr.push(agencyReport);
+ var requestData = JSON.stringify(arr);
+ // helper.set_aws_url(component,data,agencyHospitalid);
+
+ var token = component.get('v.AWStoken');
+ var newUrl = component.get('v.AWSinsert') + 'V2';
+
+ component.set('v.login', true);
+ helper.insert_agencycontact(component, token, newUrl, requestData, agencyHospitalid, helper, hospitalName);
+ } else {
+ helper.ShowToast({
+ "message": data.message,
+ "type": "error"
+ });
+ }
+ } else {
+ helper.ShowToast({
+ "message": 'searchAgency澶辫触',
+ "type": "error"
+ });
+ }
+ })
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+ // var arr = new Array();
+ // arr.push(agencyReport);
+ // var data = JSON.stringify(arr);
+ // var token = component.get('v.AWStoken');
+ // var newUrl = component.get('v.AWSinsert');
+ // component.set('v.login',true);
+ // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper);
+ //SWAG-CF58C3 fy end
+ // helper.newlyBuild(component, event, helper);
+ } else {
+ component.find('OppMessage').setError(vaildationFailReason);
}
- );
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
- // var arr = new Array();
- // arr.push(agencyReport);
- // var data = JSON.stringify(arr);
- // var token = component.get('v.AWStoken');
- // var newUrl = component.get('v.AWSinsert');
- // component.set('v.login',true);
- // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper);
- //SWAG-CF58C3 fy end
- // helper.newlyBuild(component, event, helper);
- } else {
- component.find("OppMessage").setError(vaildationFailReason);
+ },
+
+ createCancel: function (component, event, helper) {
+ helper.createCancel(component, event, helper);
+ },
+
+ yes_button: function (component, event, helper) {
+ component.set('v.confirm_status', 1);
+ helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
+ },
+
+ no_button: function (component, event, helper) {
+ component.set('v.confirm_status', 2);
+ helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
+ },
+
+ toggle_report: function (component, event, helper) {
+ helper.toggle_report(component, event, helper);
+ },
+
+ save_report: function (component, event, helper) {
+ helper.save_report(component, event, helper);
+ },
+
+ select_date_change: function (component, event, helper) {
+ helper.select_date_change(component, event, helper);
+ },
+
+ select_agency_change: function (component, event, helper) {
+ debugger
+ helper.select_agency_change(component, event, helper);
+ },
+
+ hosChange: function (component, event, helper) {
+ var hospital_name = event.getParam("value");
+ var hospital_nameld = component.get("v.UseProduct1s");
+ if (hospital_name.match(/(\S+\s)+/)) {
+ if (hospital_nameld != hospital_name) {
+ helper.searchHos(component, event, helper);
+ }
+ } else {
+ if (hospital_name == '') {
+ helper.hideSearchs(component, event, helper);
+ } else {
+ helper.hideSearch(component, event, helper);
+ }
+ }
+ },
+ selectHos: function (component, event, helper) {
+ helper.selectHos(component, event, helper);
+ helper.setOpportunity_cfilter(component);
+ },
+ //浣跨敤浜у搧1
+ UseProduct1Change: function (component, event, helper) {
+ var UseProduct1Name = event.getParam("value");
+ var UseProduct1Nameold = component.get("v.UseProduct1s");
+ debugger
+ if (UseProduct1Name.match(/(\S+\s)+/)) {
+ if (UseProduct1Name != UseProduct1Nameold) {
+ helper.searchUseProduct1(component, event, helper);
+ }
+ } else {
+ if (UseProduct1Name == '') {
+ helper.hideSearchUseProduct1s(component, event, helper);
+ } else {
+ helper.hideSearchUseProduct1(component, event, helper);
+ }
+ }
+ },
+ seletUseProduct1Change: function (component, event, helper) {
+ helper.seletUseProduct1Change(component, event, helper);
+ },
+ //浣跨敤浜у搧2
+ UseProduct2Change: function (component, event, helper) {
+ var UseProduct2Name = event.getParam("value");
+ var UseProduct2Nameold = component.get("v.UseProduct2s");
+ if (UseProduct2Name.match(/(\S+\s)+/)) {
+ if (UseProduct2Name != UseProduct2Nameold) {
+ helper.searchUseProduct2(component, event, helper);
+ }
+ } else {
+ if (UseProduct2Name == '') {
+ helper.hideSearchUseProduct2s(component, event, helper);
+ } else {
+ helper.hideSearchUseProduct2(component, event, helper);
+ }
+ }
+ },
+ seletUseProduct2Change: function (component, event, helper) {
+ helper.seletUseProduct2Change(component, event, helper);
+ },
+ productcategoryChange2: function (component, event, helper) {
+ helper.productcategoryChange2(component, event, helper);
+ },
+ //浣跨敤浜у搧3
+ UseProduct3Change: function (component, event, helper) {
+ var UseProduct3Name = event.getParam("value");
+ var UseProduct3Nameold = component.get("v.UseProduct3s");
+ if (UseProduct3Name.match(/(\S+\s)+/)) {
+ if (UseProduct3Name != UseProduct3Nameold) {
+ helper.searchUseProduct3(component, event, helper);
+ }
+ } else {
+ if (UseProduct3Name == '') {
+ helper.hideSearchUseProduct3s(component, event, helper);
+ } else {
+ helper.hideSearchUseProduct3(component, event, helper);
+ }
+ }
+ },
+ seletUseProduct3Change: function (component, event, helper) {
+ helper.seletUseProduct3Change(component, event, helper);
+ },
+
+
+ select_department: function (component, event, helper) {
+ helper.setOpportunity_cfilter(component);
+ },
+ doctor_change: function (component, event, helper) {
+ helper.doctor_change(component, event, helper);
+ },
+ stageNameChange: function (component, event, helper) {
+ helper.stageNameChange(component, event, helper);
+ },
+ onDragOver: function (component, event, helper) {
+ event.preventDefault();
+ },
+
+ onDrop: function (component, event, helper) {
+ event.stopPropagation();
+ event.preventDefault();
+ event.dataTransfer.dropEffect = 'copy';
+ var files = event.dataTransfer.files;
+ helper.readFile(component, helper, files[0]);
+ },
+ CreateRecord: function (component, event, helper) {
+ var files = event.getSource().get("v.files");
+ helper.readFile(component, helper, files[0]);
+ component.set("v.showErrorInfo", false);
+ },
+
+ processFileContent: function (component, event, helper) {
+ helper.saveRecords(component, event, helper);
+ component.set("v.showErrorInfo", false);
+ },
+
+ cancel: function (component, event, helper) {
+ component.set("v.showMain", true);
+ },
+
+ import: function (component, event, helper) {
+ helper.showImport(component);
+ },
+ exportDate: function (component, event, helper) {
+ var stockData = component.get("v.reports_date");
+ console.log('瀵煎嚭鏁版嵁' + stockData);
+ var csv = helper.convertArrayOfObjectsToCSV(component, stockData);
+ if (csv == null) { return; }
+
+ var universalBOM = "\uFEFF";
+ var hiddenElement = document.createElement('a');
+ hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM + csv);
+ hiddenElement.target = '_self'; //
+ hiddenElement.download = 'ExportData.csv'; // CSV file Name* you can change it.[only name not .csv]
+ document.body.appendChild(hiddenElement); // Required for FireFox browser
+ hiddenElement.click(); // using click() js function to download csv file
+
+ },
+ export_condition: function (component, event, helper) {
+ helper.showExport(component);
+ },
+
+ select_repores_date: function (component, event, helper) {
+ helper.select_repores_date(component, event, helper);
+ },
+ export: function (component, event, helper) {
+ console.log('杩涘叆export');
+ var stockData = component.get("v.reports_date");
+ console.log('鏌ュ嚭鐨勬暟鎹�' + stockData);
+ },
+ close_import: function (component, event, helper) {
+ component.set("v.showMain", true);
+ helper.close_import(component);
+ },
+ close_export: function (component, event, helper) {
+ component.set("v.showMain", true);
+ helper.close_export(component);
+ },
+ select_ConsumptionOfConsumables: function (component, event, helper) {
+ helper.select_ConsumptionOfConsumables(component, event, helper);
+ },
+ select_purpose_type: function (component, event, helper) {
+ helper.selectPurposeType(component, event, helper);
+ },
+ select_warlocksNumber: function (component, event, helper) {
+ helper.select_warlocksNumber(component, event, helper);
+ },
+ selectProductClassification: function (component, event, helper) {
+ helper.selectProductClassification(component, event, helper);
+ },
+ selectpurposetype: function (component, event, helper) {
+ helper.selectpurposetype(component, event, helper);
+ },
+ return_main_page: function (component, event, helper) {
+ window.open('/customer/', '_self');
+ },
+ exportErrorInfo: function (component, event, helper) {
+ helper.exportErrorInfoHelper(component);
+ },
+ closeErrorDiv: function (component, event, helper) {
+ var errorDiv01 = component.find('errorDiv01');
+ $A.util.addClass(errorDiv01, 'slds-hide');
}
- },
-
- createCancel: function (component, event, helper) {
- helper.createCancel(component, event, helper);
- },
-
- yes_button: function (component, event, helper) {
- component.set("v.confirm_status", 1);
- helper.close_confirm(
- component,
- component.get("v.modal_confirm_title"),
- component.get("v.modal_confirm_text")
- );
- },
-
- no_button: function (component, event, helper) {
- component.set("v.confirm_status", 2);
- helper.close_confirm(
- component,
- component.get("v.modal_confirm_title"),
- component.get("v.modal_confirm_text")
- );
- },
-
- toggle_report: function (component, event, helper) {
- helper.toggle_report(component, event, helper);
- },
-
- save_report: function (component, event, helper) {
- helper.save_report(component, event, helper);
- },
-
- select_date_change: function (component, event, helper) {
- helper.select_date_change(component, event, helper);
- },
-
- select_agency_change: function (component, event, helper) {
- debugger;
- helper.select_agency_change(component, event, helper);
- },
-
- hosChange: function (component, event, helper) {
- var hospital_name = event.getParam("value");
- var hospital_nameld = component.get("v.UseProduct1s");
- if (hospital_name.match(/(\S+\s)+/)) {
- if (hospital_nameld != hospital_name) {
- helper.searchHos(component, event, helper);
- }
- } else {
- if (hospital_name == "") {
- helper.hideSearchs(component, event, helper);
- } else {
- helper.hideSearch(component, event, helper);
- }
- }
- },
- selectHos: function (component, event, helper) {
- helper.selectHos(component, event, helper);
- helper.setOpportunity_cfilter(component);
- },
- //浣跨敤浜у搧1
- UseProduct1Change: function (component, event, helper) {
- var UseProduct1Name = event.getParam("value");
- var UseProduct1Nameold = component.get("v.UseProduct1s");
- debugger;
- if (UseProduct1Name.match(/(\S+\s)+/)) {
- if (UseProduct1Name != UseProduct1Nameold) {
- helper.searchUseProduct1(component, event, helper);
- }
- } else {
- if (UseProduct1Name == "") {
- helper.hideSearchUseProduct1s(component, event, helper);
- } else {
- helper.hideSearchUseProduct1(component, event, helper);
- }
- }
- },
- seletUseProduct1Change: function (component, event, helper) {
- helper.seletUseProduct1Change(component, event, helper);
- },
- //浣跨敤浜у搧2
- UseProduct2Change: function (component, event, helper) {
- var UseProduct2Name = event.getParam("value");
- var UseProduct2Nameold = component.get("v.UseProduct2s");
- if (UseProduct2Name.match(/(\S+\s)+/)) {
- if (UseProduct2Name != UseProduct2Nameold) {
- helper.searchUseProduct2(component, event, helper);
- }
- } else {
- if (UseProduct2Name == "") {
- helper.hideSearchUseProduct2s(component, event, helper);
- } else {
- helper.hideSearchUseProduct2(component, event, helper);
- }
- }
- },
- seletUseProduct2Change: function (component, event, helper) {
- helper.seletUseProduct2Change(component, event, helper);
- },
- productcategoryChange2: function (component, event, helper) {
- helper.productcategoryChange2(component, event, helper);
- },
- //浣跨敤浜у搧3
- UseProduct3Change: function (component, event, helper) {
- var UseProduct3Name = event.getParam("value");
- var UseProduct3Nameold = component.get("v.UseProduct3s");
- if (UseProduct3Name.match(/(\S+\s)+/)) {
- if (UseProduct3Name != UseProduct3Nameold) {
- helper.searchUseProduct3(component, event, helper);
- }
- } else {
- if (UseProduct3Name == "") {
- helper.hideSearchUseProduct3s(component, event, helper);
- } else {
- helper.hideSearchUseProduct3(component, event, helper);
- }
- }
- },
- seletUseProduct3Change: function (component, event, helper) {
- helper.seletUseProduct3Change(component, event, helper);
- },
-
- select_department: function (component, event, helper) {
- helper.setOpportunity_cfilter(component);
- },
- doctor_change: function (component, event, helper) {
- helper.doctor_change(component, event, helper);
- },
- stageNameChange: function (component, event, helper) {
- helper.stageNameChange(component, event, helper);
- },
- onDragOver: function (component, event, helper) {
- event.preventDefault();
- },
-
- onDrop: function (component, event, helper) {
- event.stopPropagation();
- event.preventDefault();
- event.dataTransfer.dropEffect = "copy";
- var files = event.dataTransfer.files;
- helper.readFile(component, helper, files[0]);
- },
- CreateRecord: function (component, event, helper) {
- var files = event.getSource().get("v.files");
- helper.readFile(component, helper, files[0]);
- component.set("v.showErrorInfo", false);
- },
-
- processFileContent: function (component, event, helper) {
- helper.saveRecords(component, event, helper);
- component.set("v.showErrorInfo", false);
- },
-
- cancel: function (component, event, helper) {
- component.set("v.showMain", true);
- },
-
- import: function (component, event, helper) {
- helper.showImport(component);
- },
- exportDate: function (component, event, helper) {
- var stockData = component.get("v.reports_date");
- console.log("瀵煎嚭鏁版嵁" + stockData);
- var csv = helper.convertArrayOfObjectsToCSV(component, stockData);
- if (csv == null) {
- return;
- }
-
- var universalBOM = "\uFEFF";
- var hiddenElement = document.createElement("a");
- hiddenElement.href =
- "data:text/csv;charset=utf-8," + encodeURI(universalBOM + csv);
- hiddenElement.target = "_self"; //
- hiddenElement.download = "ExportData.csv"; // CSV file Name* you can change it.[only name not .csv]
- document.body.appendChild(hiddenElement); // Required for FireFox browser
- hiddenElement.click(); // using click() js function to download csv file
- },
- export_condition: function (component, event, helper) {
- helper.showExport(component);
- },
-
- select_repores_date: function (component, event, helper) {
- helper.select_repores_date(component, event, helper);
- },
- export: function (component, event, helper) {
- console.log("杩涘叆export");
- var stockData = component.get("v.reports_date");
- console.log("鏌ュ嚭鐨勬暟鎹�" + stockData);
- },
- close_import: function (component, event, helper) {
- component.set("v.showMain", true);
- helper.close_import(component);
- },
- close_export: function (component, event, helper) {
- component.set("v.showMain", true);
- helper.close_export(component);
- },
- select_ConsumptionOfConsumables: function (component, event, helper) {
- helper.select_ConsumptionOfConsumables(component, event, helper);
- },
- select_purpose_type: function (component, event, helper) {
- helper.selectPurposeType(component, event, helper);
- },
- select_warlocksNumber: function (component, event, helper) {
- helper.select_warlocksNumber(component, event, helper);
- },
- selectProductClassification: function (component, event, helper) {
- helper.selectProductClassification(component, event, helper);
- },
- selectpurposetype: function (component, event, helper) {
- helper.selectpurposetype(component, event, helper);
- },
- return_main_page: function (component, event, helper) {
- window.open("/customer/", "_self");
- },
- exportErrorInfo: function (component, event, helper) {
- helper.exportErrorInfoHelper(component);
- },
- closeErrorDiv: function (component, event, helper) {
- var errorDiv01 = component.find("errorDiv01");
- $A.util.addClass(errorDiv01, "slds-hide");
- }
-});
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
index 5cac1fd..ce599da 100644
--- a/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
+++ b/force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
@@ -1,4120 +1,3338 @@
({
- doinit: function (component, event, helper) {
- document.title = "杩芥函鏃ユ姤";
-
- this.report_date_list(component, event, helper, 5);
- component.set("v.login", true);
- 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.login", false);
- } else {
- //component.set('v.errorMessage', 'doinit failed.');
- this.error("doinit failed.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- });
- $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");
- if (select_ProductClassification != "") {
- var action = component.get("c.selectProductCcategory");
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component
- .find("select_ProductCcategory")
- .set("v.options", JSON.parse(JSON.stringify(res)));
- }
- });
- $A.enqueueAction(action);
- } else {
- component.find("select_ProductCcategory").set("v.options", []);
- }
- },
- //鏍规嵁鍛ㄥ拰鎷呭綋鏌ヨ鏁版嵁缁欏垵濮嬮〉闈㈣祴鏁版嵁
- get_reports: function (component, event, helper, date_str, person_str) {
- if (!date_str) {
- return false;
- }
-
- if (person_str) {
- var person_str2 = person_str.split(";");
- if (person_str2.length > 1) {
- person_str = person_str2[0];
- }
- }
- date_str = this.get_date_string(date_str);
- var action = component.get("c.getReports");
- action.setParams({
- date_str: date_str,
- person_str: person_str
- });
- component.set("v.loginEdit", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.reports", res.reports);
- component.set("v.report_count", res.reports.length);
- // 鏇存柊淇濆瓨寰屻伄select_data鐢�
- var report_id = component.get("v.update_select_report_data_id");
- if (report_id != "") {
- for (var i = 0; i < res.reports.length; i++) {
- if (res.reports[i]["Id"] == report_id) {
- component.set("v.select_report_data", res.reports[i]);
- break;
- }
- }
- component.set("v.update_select_report_data_id", "");
- }
- if (res.reports.length > 0) {
- component.set("v.list_message", "");
- var flag2 = res.reports.length;
- //fy 20220414 start
- var report1 = [];
- var report2 = [];
- res.reports.forEach((item) => {
- if (
- (item.WorkRecord__c == "绉戝浼�" &&
- item.doctor3__c != undefined) ||
- ((item.doctor3__c == undefined ||
- item.doctor3__c == "" ||
- item.doctor3__c == "") &&
- (item.doctor2__r == undefined ||
- item.doctor2__r == "" ||
- item.doctor2__r == ""))
- ) {
- report1.push(item);
- } else {
- report2.push(item);
- }
- });
- res.reports = report2;
- //fy 20220414 end
- // PI 鏀归�� By Bright 20220328
- if (true) {
- let doctor_awsids = res.reports.map(function (d) {
- return d.doctor2__r.AWS_Data_Id__c;
- });
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- if (doctor_awsids.length > 0) {
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: doctor_awsids
- },
- function (data) {
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res.reports) {
- if (
- res.reports[ri] &&
- res.reports[ri].doctor2__r &&
- res.reports[ri].doctor2__r.AWS_Data_Id__c &&
- m.hasOwnProperty(
- res.reports[ri].doctor2__r.AWS_Data_Id__c
- )
- ) {
- res.reports[ri].doctor2__r.awsdata =
- m[res.reports[ri].doctor2__r.AWS_Data_Id__c];
- }
- }
- component.set("v.reports", res.reports);
- component.set("v.report_count", res.reports.length);
- }
- //fy 20220414 start
- var reports3 = component.get("v.reports");
- if (reports3.length < flag2) {
- res.reports = [...report1, ...reports3];
- component.set("v.reports", res.reports);
- component.set("v.report_count", res.reports.length);
- }
- //fy 20220414 end
- component.set("v.loginEdit", false);
- },
- staticResourceAgencyContact.token
- );
- } else {
- component.set("v.loginEdit", false);
- }
- }
- } else {
- component.set("v.list_message", "no_data");
- component.set("v.loginEdit", false);
- }
- } else {
- //component.set('v.errorMessage', 'get_reports failed.');
- this.error("get_reports failed.");
- //this.showErrorToast(component);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
- //澶嶅埗鎸夐挳鍙樼伆鑹�
- select_date_change: function (component, event, helper) {
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- component.find("select_agency_person").get("v.value")
- );
- component.set("v.select_report_data_radio", "");
- component.find("copy_button").set("v.disabled", true);
- component.find("delete_button").set("v.disabled", true);
- },
-
- select_agency_change: function (component, event, helper) {
- var select_value = component.find("select_agency_person").get("v.value");
- var new_label = this.get_agency_person_name(component, select_value);
- component.set("v.selected_agency_person", new_label);
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- select_value
- );
- component.set("v.select_report_data_radio", "");
- component.find("copy_button").set("v.disabled", true);
- component.find("delete_button").set("v.disabled", true);
- },
-
- get_agency_person_name: function (component, agency_person_value) {
- var allselectlist = component.get("v.allselectlist.AgencyPerson__c");
- var new_label = "";
- for (var i = 0; i < allselectlist.length; i++) {
- if (agency_person_value == allselectlist[i].value) {
- new_label = allselectlist[i].label;
- break;
- }
- }
- return new_label;
- },
- //澶嶅埗鍜岀紪杈戝洖鏄剧殑浣嶇疆
- toggle_report: function (component) {
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- if ($A.util.hasClass(modal_window, "disp_none")) {
- // OPEN
- $A.util.removeClass(modal_window, "disp_none");
- $A.util.removeClass(modal_bg, "disp_none");
- //澶嶅埗 鍜岀紪杈� 鍥炴樉闂鍦ㄨ繖閲岄潰
- if (
- component.get("v.mode") == "edit" ||
- component.get("v.mode") == "copy"
- ) {
- var select_data = "";
- if (component.get("v.mode") == "edit") {
- select_data = component.get("v.select_report_data");
- } else if (component.get("v.mode") == "copy") {
- select_data = component.get("v.select_report_data_radio");
- }
- var reports = component.get("v.reports");
- var Agency_Hospital_text = "";
- var Agency_Hospital_parent_id = "";
- // 鍖婚櫌鍚�
- if (select_data["Agency_Hospital__c"] != "") {
- for (var i = 0; i < reports.length; i++) {
- if (
- reports[i]["Agency_Hospital__c"] ==
- select_data["Agency_Hospital__c"]
- ) {
- Agency_Hospital_text = reports[i]["Agency_Hospital__r"]["Name"];
- Agency_Hospital_parent_id =
- reports[i]["Agency_Hospital__r"]["Hospital__c"];
- }
- }
- component.set("v.hospital", Agency_Hospital_text);
- component.set("v.hospitalId", Agency_Hospital_parent_id);
- component.set("v.hospitalLinkId", select_data["Agency_Hospital__c"]);
- component.find("new_con").set("v.disabled", false);
- }
- //浣跨敤浜у搧1(浜у搧鍨嬪彿)
- var UseProduct1Text = "";
- var UseProduct1Id = "";
- if (
- select_data["UseProduct1__c"] != "" &&
- select_data["UseProduct1__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct1__c"] == select_data["UseProduct1__c"]) {
- UseProduct1Text =
- reports[i]["UseProduct1__r"]["Asset_Model_No__c"];
- UseProduct1Id = reports[i]["UseProduct1__c"];
- }
- }
- component.set("v.UseProduct1", UseProduct1Text);
- component.set("v.UseProduct1Id", select_data["UseProduct1__c"]);
- }
- //浣跨敤浜у搧2
- var UseProduct2Text = "";
- var UseProduct2Id = "";
- if (
- select_data["UseProduct2__c"] != "" &&
- select_data["UseProduct2__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct2__c"] == select_data["UseProduct2__c"]) {
- UseProduct2Text =
- reports[i]["UseProduct2__r"]["Asset_Model_No__c"];
- UseProduct2Id = reports[i]["UseProduct2__c"];
- }
- }
- component.set("v.UseProduct2", UseProduct2Text);
- component.set("v.UseProduct2Id", select_data["UseProduct2__c"]);
- }
- //浣跨敤浜у搧3
- var UseProduct3Text = "";
- var UseProduct3Id = "";
- if (
- select_data["UseProduct3__c"] != "" &&
- select_data["UseProduct3__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct3__c"] == select_data["UseProduct3__c"]) {
- UseProduct3Text =
- reports[i]["UseProduct3__r"]["Asset_Model_No__c"];
- UseProduct3Id = reports[i]["UseProduct3__c"];
- }
- }
- component.set("v.UseProduct3", UseProduct3Text);
- component.set("v.UseProduct3Id", select_data["UseProduct3__c"]);
- }
- //娲诲姩鏃�
- var reportDate;
- if (select_data["Report_Date__c"] != "") {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["Report_Date__c"] == select_data["Report_Date__c"]) {
- reportDate = reports[i]["Report_Date__c"];
- }
- }
- component.set("v.data.Report_Date__c", reportDate);
- }
- // 绉戝
- // if (select_data['Department_Cateogy__c'] != '') {
- // component.find('select_department').set('v.value',select_data['Department_Cateogy__c']);
- // }
- //fy Department_Cateogy_text__c
- if (select_data["Department_Cateogy_text__c"] != "") {
- component
- .find("select_department")
- .set("v.value", select_data["Department_Cateogy_text__c"]);
- }
- //缁忛攢鍟嗕汉鍛�
- if (select_data["DealerPersonnel__c"] != "") {
- this.set_selected(
- component,
- "select_DealerPersonnel",
- select_data["DealerPersonnel__c"]
- );
- }
- // 娲诲姩鍖哄垎
- if (select_data["WorkRecord__c"] != "") {
- this.set_selected(
- component,
- "select_purpose_type",
- select_data["WorkRecord__c"]
- );
- this.selectPurposeType(component);
- }
- // 鎷滆浜�
- if (select_data["WorkRecord__c"] == "绉戝浼�") {
- component.set(
- "v.default_select_doctor_id2",
- select_data["doctor3__c"]
- );
- var a = component.get("v.default_select_doctor_id2");
- this.set_doctor_list(component);
- } else {
- component.set(
- "v.default_select_doctor_id",
- select_data["doctor2__c"]
- );
- this.set_doctor_list(component);
- }
- //浜у搧鍒嗙被(绗笁鍒嗙被)
- if (select_data["ProductClassification__c"] != null) {
- this.set_selected(
- component,
- "select_ProductClassification",
- select_data["ProductClassification__c"]
- );
- this.selectProductClassification(component);
- }
- // 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺
- if (select_data["ConsumptionOfConsumables__c"] != "") {
- component
- .find("select_ConsumptionOfConsumables")
- .set("v.value", select_data["ConsumptionOfConsumables__c"]);
- }
- // 浜у搧鐢ㄩ噺
- if (select_data["warlocksNumber__c"] != "") {
- component
- .find("select_warlocksNumber")
- .set("v.value", select_data["warlocksNumber__c"]);
- }
- // 鏀彺闇�姹�
- if (select_data["WorkMark__c"] != false) {
- component
- .find("select_WorkMark")
- .set("v.checked", select_data["WorkMark__c"]);
- }
- var report_id = component.get("v.edit_copy_select_report_id");
- if (report_id != "") {
- var select_EffectProgress1 = "";
- var WarlockClassification = "";
- var ProductCcategory = "";
- var productCategories = "";
- var i = 0;
- for (i = 0; i < reports.length; i++) {
- if (report_id == reports[i]["Id"]) {
- select_EffectProgress1 = reports[i]["EffectProgress__c"];
- WarlockClassification = reports[i]["WarlockClassification__c"];
- ProductCcategory = reports[i]["ProductCcategory__c"];
- productCategories = reports[i]["productCategories__c"];
- break;
- }
- }
- //鏁堟灉/杩涘害
- if (select_EffectProgress1 != null && select_EffectProgress1 != "") {
- component
- .find("select_EffectProgress")
- .set("v.value", select_EffectProgress1);
- }
- //鏈+鍒嗙被
- if (WarlockClassification != null && WarlockClassification != "") {
- component
- .find("select_OtherBrandConsumables")
- .set("v.value", WarlockClassification);
- }
- //宸查噰鐢ㄥ叾浠栧搧鐗�
- if (ProductCcategory != null && ProductCcategory != "") {
- component
- .find("select_ProductCcategory")
- .set("v.value", ProductCcategory);
- this.selectpurposetype(component);
- }
- //鍏朵粬鍝佺墝浜у搧绫诲埆
- if (productCategories != null && productCategories != "") {
- component
- .find("select_productCategories")
- .set("v.value", productCategories);
- }
- component.set("v.edit_copy_select_report_id", "");
- }
- }
- } else {
- var select_report_data = component.get("v.select_report_data");
- var Report_Date__c = component.get("v.data.Report_Date__c");
- var Agency_Hospital__c = component.get("v.hospitalLinkId");
- var UseProduct1__c = component.get("v.UseProduct1Id");
- var UseProduct2__c = component.get("v.UseProduct2Id");
- var UseProduct3__c = component.get("v.UseProduct3Id");
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- var ConsumptionOfConsumables__c = component
- .find("select_ConsumptionOfConsumables")
- .get("v.value");
- var DealerPersonnel__c = component
- .find("select_DealerPersonnel")
- .get("v.value");
- var doctor2__c = component.find("select_doctor").get("v.value");
- var WorkRecord__c = component.find("select_purpose_type").get("v.value");
- var EffectProgress__c = component
- .find("select_EffectProgress")
- .get("v.value");
- var WarlockClassification__c = component
- .find("select_OtherBrandConsumables")
- .get("v.value");
- var ProductCcategory__c = component
- .find("select_ProductCcategory")
- .get("v.value");
- var productCategories__c = component
- .find("select_productCategories")
- .get("v.value");
- var warlocksNumber__c = component
- .find("select_warlocksNumber")
- .get("v.value");
- var WorkMark__c = component.find("select_WorkMark").get("v.checked");
- if (component.get("v.mode") == "new") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鏃ユ姤锛�";
- if (
- !Report_Date__c &&
- !Agency_Hospital__c &&
- !UseProduct1__c &&
- !UseProduct2__c &&
- !UseProduct3__c &&
- !Department_Cateogy__c &&
- !ConsumptionOfConsumables__c &&
- !DealerPersonnel__c &&
- !doctor2__c &&
- !EffectProgress__c &&
- !WarlockClassification__c &&
- !ProductCcategory__c &&
- !productCategories__c &&
- !warlocksNumber__c &&
- !WorkMark__c &&
- !WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- this.close_confirm(component, confirm_title, confirm_text);
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "copy") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鏃ユ姤锛�";
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["UseProduct1__c"] == UseProduct1__c &&
- select_report_data["UseProduct2__c"] == UseProduct2__c &&
- select_report_data["UseProduct3__c"] == UseProduct3__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["ConsumptionOfConsumables__c"] ==
- ConsumptionOfConsumables__c &&
- select_report_data["DealerPersonnel__c"] == DealerPersonnel__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["EffectProgress__c"] == EffectProgress__c &&
- select_report_data["WarlockClassification__c"] ==
- WarlockClassification__c &&
- select_report_data["ProductCcategory__c"] == ProductCcategory__c &&
- select_report_data["productCategories__c"] == productCategories__c &&
- select_report_data["warlocksNumber__c"] == warlocksNumber__c &&
- select_report_data["WorkMark__c"] == WorkMark__c &&
- select_report_data["WorkRecord__c"] == WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "edit") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純缂栬緫鏃ユ姤锛�";
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["UseProduct1__c"] == UseProduct1__c &&
- select_report_data["UseProduct2__c"] == UseProduct2__c &&
- select_report_data["UseProduct3__c"] == UseProduct3__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["ConsumptionOfConsumables__c"] ==
- ConsumptionOfConsumables__c &&
- select_report_data["DealerPersonnel__c"] == DealerPersonnel__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["EffectProgress__c"] == EffectProgress__c &&
- select_report_data["WarlockClassification__c"] ==
- WarlockClassification__c &&
- select_report_data["ProductCcategory__c"] == ProductCcategory__c &&
- select_report_data["productCategories__c"] == productCategories__c &&
- select_report_data["warlocksNumber__c"] == warlocksNumber__c &&
- select_report_data["WorkMark__c"] == WorkMark__c &&
- select_report_data["WorkRecord__c"] == WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- }
- }
- },
- toggle_report_edit: function (component) {
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- if ($A.util.hasClass(modal_window, "disp_none")) {
- // OPEN
- $A.util.removeClass(modal_window, "disp_none");
- $A.util.removeClass(modal_bg, "disp_none");
- component.set("v.loginEdit", true);
- //澶嶅埗 鍜岀紪杈� 鍥炴樉闂鍦ㄨ繖閲岄潰
- if (
- component.get("v.mode") == "edit" ||
- component.get("v.mode") == "copy"
- ) {
- var select_data = "";
- if (component.get("v.mode") == "edit") {
- select_data = component.get("v.select_report_data");
- } else if (component.get("v.mode") == "copy") {
- select_data = component.get("v.select_report_data_radio");
- }
- var reports = component.get("v.reports");
- var Agency_Hospital_text = "";
- var Agency_Hospital_parent_id = "";
- // 鍖婚櫌鍚�
- if (select_data["Agency_Hospital__c"] != "") {
- for (var i = 0; i < reports.length; i++) {
- if (
- reports[i]["Agency_Hospital__c"] ==
- select_data["Agency_Hospital__c"]
- ) {
- Agency_Hospital_text = reports[i]["Agency_Hospital__r"]["Name"];
- Agency_Hospital_parent_id =
- reports[i]["Agency_Hospital__r"]["Hospital__c"];
- }
- }
- component.set("v.hospital", Agency_Hospital_text);
- component.set("v.hospitalId", Agency_Hospital_parent_id);
- component.set("v.hospitalLinkId", select_data["Agency_Hospital__c"]);
- component.find("new_con").set("v.disabled", false);
- }
- //浣跨敤浜у搧1(浜у搧鍨嬪彿)
- var UseProduct1Text = "";
- var UseProduct1Id = "";
- if (
- select_data["UseProduct1__c"] != "" &&
- select_data["UseProduct1__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct1__c"] == select_data["UseProduct1__c"]) {
- UseProduct1Text =
- reports[i]["UseProduct1__r"]["Asset_Model_No__c"];
- UseProduct1Id = reports[i]["UseProduct1__c"];
- }
- }
- component.set("v.UseProduct1", UseProduct1Text);
- component.set("v.UseProduct1Id", select_data["UseProduct1__c"]);
- }
- //浣跨敤浜у搧2
- var UseProduct2Text = "";
- var UseProduct2Id = "";
- if (
- select_data["UseProduct2__c"] != "" &&
- select_data["UseProduct2__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct2__c"] == select_data["UseProduct2__c"]) {
- UseProduct2Text =
- reports[i]["UseProduct2__r"]["Asset_Model_No__c"];
- UseProduct2Id = reports[i]["UseProduct2__c"];
- }
- }
- component.set("v.UseProduct2", UseProduct2Text);
- component.set("v.UseProduct2Id", select_data["UseProduct2__c"]);
- }
- //浣跨敤浜у搧3
- var UseProduct3Text = "";
- var UseProduct3Id = "";
- if (
- select_data["UseProduct3__c"] != "" &&
- select_data["UseProduct3__c"] != undefined
- ) {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["UseProduct3__c"] == select_data["UseProduct3__c"]) {
- UseProduct3Text =
- reports[i]["UseProduct3__r"]["Asset_Model_No__c"];
- UseProduct3Id = reports[i]["UseProduct3__c"];
- }
- }
- component.set("v.UseProduct3", UseProduct3Text);
- component.set("v.UseProduct3Id", select_data["UseProduct3__c"]);
- }
- //娲诲姩鏃�
- var reportDate;
- if (select_data["Report_Date__c"] != "") {
- for (var i = 0; i < reports.length; i++) {
- if (reports[i]["Report_Date__c"] == select_data["Report_Date__c"]) {
- reportDate = reports[i]["Report_Date__c"];
- }
- }
- component.set("v.data.Report_Date__c", reportDate);
- }
- // 绉戝
- // if (select_data['Department_Cateogy__c'] != '') {
- // component.find('select_department').set('v.value',select_data['Department_Cateogy__c']);
- // }
- //fy Department_Cateogy_text__c
- if (select_data["Department_Cateogy_text__c"] != "") {
- component
- .find("select_department")
- .set("v.value", select_data["Department_Cateogy_text__c"]);
- }
- //缁忛攢鍟嗕汉鍛�
- if (select_data["DealerPersonnel__c"] != "") {
- this.set_selected(
- component,
- "select_DealerPersonnel",
- select_data["DealerPersonnel__c"]
- );
- }
- // 娲诲姩鍖哄垎
- if (select_data["WorkRecord__c"] != "") {
- this.set_selected(
- component,
- "select_purpose_type",
- select_data["WorkRecord__c"]
- );
- this.selectPurposeType(component);
- }
- // 鎷滆浜�
- if (select_data["WorkRecord__c"] == "绉戝浼�") {
- component.set(
- "v.default_select_doctor_id2",
- select_data["doctor3__c"]
- );
- var a = component.get("v.default_select_doctor_id2");
- this.set_doctor_list_edit(component);
- } else {
- component.set(
- "v.default_select_doctor_id",
- select_data["doctor2__c"]
- );
- this.set_doctor_list_edit(component);
- }
- //浜у搧鍒嗙被(绗笁鍒嗙被)
- if (select_data["ProductClassification__c"] != null) {
- this.set_selected(
- component,
- "select_ProductClassification",
- select_data["ProductClassification__c"]
- );
- this.selectProductClassification(component);
- }
- // 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺
- if (select_data["ConsumptionOfConsumables__c"] != "") {
- component
- .find("select_ConsumptionOfConsumables")
- .set("v.value", select_data["ConsumptionOfConsumables__c"]);
- }
- // 浜у搧鐢ㄩ噺
- if (select_data["warlocksNumber__c"] != "") {
- component
- .find("select_warlocksNumber")
- .set("v.value", select_data["warlocksNumber__c"]);
- }
- // 鏀彺闇�姹�
- if (select_data["WorkMark__c"] != false) {
- component
- .find("select_WorkMark")
- .set("v.checked", select_data["WorkMark__c"]);
- }
- var report_id = component.get("v.edit_copy_select_report_id");
- if (report_id != "") {
- var select_EffectProgress1 = "";
- var WarlockClassification = "";
- var ProductCcategory = "";
- var productCategories = "";
- var i = 0;
- for (i = 0; i < reports.length; i++) {
- if (report_id == reports[i]["Id"]) {
- select_EffectProgress1 = reports[i]["EffectProgress__c"];
- WarlockClassification = reports[i]["WarlockClassification__c"];
- ProductCcategory = reports[i]["ProductCcategory__c"];
- productCategories = reports[i]["productCategories__c"];
- break;
- }
- }
- //鏁堟灉/杩涘害
- if (select_EffectProgress1 != null && select_EffectProgress1 != "") {
- component
- .find("select_EffectProgress")
- .set("v.value", select_EffectProgress1);
- }
- //鏈+鍒嗙被
- if (WarlockClassification != null && WarlockClassification != "") {
- component
- .find("select_OtherBrandConsumables")
- .set("v.value", WarlockClassification);
- }
- //宸查噰鐢ㄥ叾浠栧搧鐗�
- if (ProductCcategory != null && ProductCcategory != "") {
- component
- .find("select_ProductCcategory")
- .set("v.value", ProductCcategory);
- this.selectpurposetype(component);
- }
- //鍏朵粬鍝佺墝浜у搧绫诲埆
- if (productCategories != null && productCategories != "") {
- component
- .find("select_productCategories")
- .set("v.value", productCategories);
- }
- component.set("v.edit_copy_select_report_id", "");
- }
- }
- } else {
- var select_report_data = component.get("v.select_report_data");
- var Report_Date__c = component.get("v.data.Report_Date__c");
- var Agency_Hospital__c = component.get("v.hospitalLinkId");
- var UseProduct1__c = component.get("v.UseProduct1Id");
- var UseProduct2__c = component.get("v.UseProduct2Id");
- var UseProduct3__c = component.get("v.UseProduct3Id");
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- var ConsumptionOfConsumables__c = component
- .find("select_ConsumptionOfConsumables")
- .get("v.value");
- var DealerPersonnel__c = component
- .find("select_DealerPersonnel")
- .get("v.value");
- var doctor2__c = component.find("select_doctor").get("v.value");
- var WorkRecord__c = component.find("select_purpose_type").get("v.value");
- var EffectProgress__c = component
- .find("select_EffectProgress")
- .get("v.value");
- var WarlockClassification__c = component
- .find("select_OtherBrandConsumables")
- .get("v.value");
- var ProductCcategory__c = component
- .find("select_ProductCcategory")
- .get("v.value");
- var productCategories__c = component
- .find("select_productCategories")
- .get("v.value");
- var warlocksNumber__c = component
- .find("select_warlocksNumber")
- .get("v.value");
- var WorkMark__c = component.find("select_WorkMark").get("v.checked");
- if (component.get("v.mode") == "new") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鏃ユ姤锛�";
- if (
- !Report_Date__c &&
- !Agency_Hospital__c &&
- !UseProduct1__c &&
- !UseProduct2__c &&
- !UseProduct3__c &&
- !Department_Cateogy__c &&
- !ConsumptionOfConsumables__c &&
- !DealerPersonnel__c &&
- !doctor2__c &&
- !EffectProgress__c &&
- !WarlockClassification__c &&
- !ProductCcategory__c &&
- !productCategories__c &&
- !warlocksNumber__c &&
- !WorkMark__c &&
- !WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- this.close_confirm(component, confirm_title, confirm_text);
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "copy") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鏃ユ姤锛�";
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["UseProduct1__c"] == UseProduct1__c &&
- select_report_data["UseProduct2__c"] == UseProduct2__c &&
- select_report_data["UseProduct3__c"] == UseProduct3__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["ConsumptionOfConsumables__c"] ==
- ConsumptionOfConsumables__c &&
- select_report_data["DealerPersonnel__c"] == DealerPersonnel__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["EffectProgress__c"] == EffectProgress__c &&
- select_report_data["WarlockClassification__c"] ==
- WarlockClassification__c &&
- select_report_data["ProductCcategory__c"] == ProductCcategory__c &&
- select_report_data["productCategories__c"] == productCategories__c &&
- select_report_data["warlocksNumber__c"] == warlocksNumber__c &&
- select_report_data["WorkMark__c"] == WorkMark__c &&
- select_report_data["WorkRecord__c"] == WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "edit") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純缂栬緫鏃ユ姤锛�";
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["UseProduct1__c"] == UseProduct1__c &&
- select_report_data["UseProduct2__c"] == UseProduct2__c &&
- select_report_data["UseProduct3__c"] == UseProduct3__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["ConsumptionOfConsumables__c"] ==
- ConsumptionOfConsumables__c &&
- select_report_data["DealerPersonnel__c"] == DealerPersonnel__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["EffectProgress__c"] == EffectProgress__c &&
- select_report_data["WarlockClassification__c"] ==
- WarlockClassification__c &&
- select_report_data["ProductCcategory__c"] == ProductCcategory__c &&
- select_report_data["productCategories__c"] == productCategories__c &&
- select_report_data["warlocksNumber__c"] == warlocksNumber__c &&
- select_report_data["WorkMark__c"] == WorkMark__c &&
- select_report_data["WorkRecord__c"] == WorkRecord__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- }
- }
- //component.set('v.loginEdit',false);
- },
- //鍏抽棴椤甸潰鏄� 灏忕殑鎻愮ず妗嗘槸鍚︽斁寮冩柊寤烘棩鎶�
- close_confirm: function (component, title, text) {
- var confirm_status = component.get("v.confirm_status");
- component.set("v.modal_confirm_title", title);
- component.set("v.modal_confirm_text", text);
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- var modal_confirm = component.find("modal_confirm");
- var modal_confirm_bg = component.find("modal_confirm_bg");
-
- if (confirm_status == 0) {
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- $A.util.removeClass(modal_confirm, "disp_none");
- $A.util.removeClass(modal_confirm_bg, "disp_none");
- } else if (confirm_status == 1) {
- // 鏄�
- $A.util.addClass(modal_confirm, "disp_none");
- $A.util.addClass(modal_confirm_bg, "disp_none");
- component.set("v.mode", "");
- this.allclear(component);
- component.set("v.reports_now", "");
- component.set("v.reports_now_count", 0);
- component.set("v.confirm_status", 0);
- } else if (confirm_status == 2) {
- // 鍚�
- $A.util.removeClass(modal_window, "disp_none");
- $A.util.removeClass(modal_bg, "disp_none");
- $A.util.addClass(modal_confirm, "disp_none");
- $A.util.addClass(modal_confirm_bg, "disp_none");
- component.set("v.confirm_status", 0);
- }
- },
- //鏂板缓鎸夐挳
- new_report: function (component, event, helper) {
- component.set("v.mode", "new");
- component.set("v.dialog_type", "鏂板缓");
- // 鍛�
- var select_date = component.find("select_date").get("v.value");
- // 鎷呭綋
- var select_agency = component.find("select_agency_person").get("v.value");
- var cm = 0;
- if (select_agency.indexOf(";") != -1) {
- select_agency = select_agency.split(";")[0];
- }
- component.set("v.selected_date", select_date);
- // 鎷呭綋
- var name = component.get("v.selected_agency_person");
- var ret = this.create_report_header(
- component,
- event,
- helper,
- name,
- select_agency,
- select_date
- );
- component.set("v.default_select_doctor_id2", "");
-
- // SWAG-CF58C3 fy start
- this.set_aws_url(component, "Agency_Contact__c");
- // SWAG-CF58C3 fy end
- },
- // 澶嶅埗鎸夐挳
- copy_button: function (component, event, helper) {
- this.allclear(component);
- component.set("v.mode", "copy");
- component.set("v.dialog_type", "鏂板缓");
- var select_report_data = component.get("v.select_report_data_radio");
- component.set("v.loadOpp", true);
- // 閫�
- var now = new Date();
- var start_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() + 1
- );
- var select_date =
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate();
- this.set_selected(component, "select_date", select_date);
- component.set("v.selected_date", select_date);
- // 鎷呭綋
- var select_agency = select_report_data["Person_In_Charge2__c"];
- var new_label = this.get_agency_person_name(component, select_agency);
- component.set("v.selected_agency_person", new_label);
- this.set_selected(component, "select_agency_person", select_agency);
- var name = component.get("v.selected_agency_person");
- component.set("v.edit_copy_select_report_id", select_report_data["Id"]);
- component.set("v.select_report_data", select_report_data);
-
- var ret = this.create_report_header(
- component,
- event,
- helper,
- name,
- select_agency,
- select_date
- );
- // SWAG-CF58C3 fy start
- this.set_aws_url(component, "Agency_Contact__c");
- // SWAG-CF58C3 fy end
- },
- //鍒犻櫎鎸夐挳
- delete_button: function (component, event, helper) {
- var select_report_data = component.get("v.select_report_data_radio");
- if (confirm("鏄惁鍒犻櫎璇ユ暟鎹紵")) {
- component.set("v.login", true);
- var action = component.get("c.deleteAgencyReport");
- action.setParams({
- agencyReport_id: select_report_data.Id
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var result = response.getReturnValue();
- if (result == "success") {
- this.select_agency_change(component, event, helper);
- }
- component.set("v.login", false);
- } else {
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- }
- },
- //澶嶅埗鎸夐挳鍙敤
- change_report_radio: function (component, event, helper) {
- var reports = component.get("v.reports");
- for (var i = 0; i < reports.length; i++) {
- if (reports[i].Name == event.getSource().get("v.label")) {
- component.set("v.select_report_data_radio", reports[i]);
- component.find("copy_button").set("v.disabled", false);
- component.find("delete_button").set("v.disabled", false);
- break;
- }
- }
- },
- //缂栬緫鎸夐挳
- edit_button: function (component, event, helper) {
- component.set("v.login", true);
- debugger;
- //component.set('v.loginEdit', true);
- this.allclear(component);
- //component.set('v.loadOpp', true);
- var index = event.getSource().get("v.value");
- component.set("v.select_report_data", component.get("v.reports")[index]);
- component.set("v.mode", "edit");
- component.set("v.dialog_type", "缂栬緫");
- var select_date = component.get("v.reports")[index].Submit_date__c;
- var select_agency = component.get("v.reports")[index].Person_In_Charge2__c;
- var text_tmp = select_date.split("-");
- var select_date_text =
- text_tmp[0] + "/" + Number(text_tmp[1]) + "/" + Number(text_tmp[2]);
- component.set("v.selected_date", select_date_text);
- var name = component.get("v.reports")[index].Person_In_Charge2__r.Name;
- this.set_selected(component, "select_agency_person", select_agency);
- var new_label = this.get_agency_person_name(component, select_agency);
- component.set("v.selected_agency_person", new_label);
- component.set(
- "v.edit_copy_select_report_id",
- component.get("v.reports")[index].Id
- );
- var ret = this.create_report_header_edit(
- component,
- event,
- helper,
- name,
- select_agency,
- select_date
- );
- // SWAG-CF58C3 fy start
- this.set_aws_url(component, "Agency_Contact__c");
- //component.set('v.login', false);
- // SWAG-CF58C3 fy end
- },
- //淇濆瓨
- save_report: function (component, event, helper) {
- var UserProType = component.get("v.UserProType");
- component.find("save_button").set("v.disabled", true);
- var etEng = component.get("v.etEng");
- var Report_Date__c = component.get("v.data.Report_Date__c");
- var Person_In_Charge2__c = "";
- var Submit_date__c = "";
- if (component.get("v.mode") == "edit") {
- // 鍛� Submit_date__c
- Submit_date__c = component.get("v.select_report_data").Submit_date__c;
- // 鎷呭綋 Person_In_Charge2__c
- Person_In_Charge2__c = component.get(
- "v.select_report_data"
- ).Person_In_Charge2__c;
- } else {
- // 鍛� Submit_date__c
- Submit_date__c = this.get_date_string(
- component.find("select_date").get("v.value")
- );
- // 鎷呭綋 Person_In_Charge2__c
- Person_In_Charge2__c = component
- .find("select_agency_person")
- .get("v.value");
- }
-
- // Agency_Report_Header__c
- var Agency_Report_Header__c = component.get("v.agency_report_header_id");
- // 鍖婚櫌
- var Agency_Hospital__c = component.get("v.hospitalLinkId");
- // 浜у搧鍒嗙被(绗笁鍒嗙被)
- var ProductClassification__c = component
- .find("select_ProductClassification")
- .get("v.value");
- // 浣跨敤浜у搧1(浜у搧鍨嬪彿) UseProduct1__c
- var UseProduct1__c = component.get("v.UseProduct1Id");
- // 浣跨敤浜у搧2 UseProduct2__c
- var UseProduct2__c = component.get("v.UseProduct2Id");
- // 浣跨敤浜у搧3 UseProduct3__c
- var UseProduct3__c = component.get("v.UseProduct3Id");
- // 绉戝 Department_Cateogy__c
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- // 缁忛攢鍟嗕汉鍛� DealerPersonnel__c
- var DealerPersonnel__c = component
- .find("select_DealerPersonnel")
- .get("v.value");
- // 鎷滆浜� doctor2__c
- var doctor2__c = component.find("select_doctor").get("v.value");
- // 娲诲姩鍖哄垎浼� WorkRecord__c
- var WorkRecord__c = component.find("select_purpose_type").get("v.value");
- // 鏁堟灉/杩涘害 EffectProgress__c
- var EffectProgress__c = component
- .find("select_EffectProgress")
- .get("v.value");
- // alert(EffectProgress__c);
- // 绉戝鍚屾潵鑰楁潗鏈堜娇鐢ㄩ噺 ConsumptionOfConsumables__c
- var ConsumptionOfConsumables__c = component
- .find("select_ConsumptionOfConsumables")
- .get("v.value");
- // 鏈+鍒嗙被 WarlockClassification__c
- var WarlockClassification__c = component
- .find("select_OtherBrandConsumables")
- .get("v.value");
- // 宸查噰鐢ㄥ叾浠栧搧鐗� ProductCcategory__c
- var ProductCcategory__c = component
- .find("select_ProductCcategory")
- .get("v.value");
- // 鍏朵粬鍝佺墝浜у搧绫诲埆 productCategories__c
- var productCategories__c = component
- .find("select_productCategories")
- .get("v.value");
- // 浜у搧鐢ㄩ噺 warlocksNumber__c
- var warlocksNumber__c = component
- .find("select_warlocksNumber")
- .get("v.value");
- // 鏀彺闇�姹� WorkMark__c
- var WorkMark__c = component.find("select_WorkMark").get("v.checked");
- var StageName__c = component.find("select_stageName").get("v.value");
- var Amount__c =
- component.get("v.oppdata.Amount__c") != null
- ? component.get("v.oppdata.Amount__c").toString()
- : "";
- var OCMSale_Price__c =
- component.get("v.oppdata.OCMSale_Price__c") != null
- ? component.get("v.oppdata.OCMSale_Price__c").toString()
- : "";
- var Close_Forecasted_Date__c = component.get(
- "v.oppdata.Close_Forecasted_Date__c"
- );
- var StageName__c_o = component.get("v.StageName__c_o");
- var Amount__c_o = component.get("v.Amount__c_o");
- var OCMSale_Price__c_o = component.get("v.OCMSale_Price__c_o");
- var Close_Forecasted_Date__c_o = component.get(
- "v.Close_Forecasted_Date__c_o"
- );
- if (StageName__c_o == undefined) StageName__c_o = "";
- if (Amount__c_o == undefined) Amount__c_o = "";
- if (OCMSale_Price__c_o == undefined) OCMSale_Price__c_o = "";
- if (Close_Forecasted_Date__c_o == undefined)
- Close_Forecasted_Date__c_o = "";
- if (
- StageName__c == StageName__c_o &&
- OCMSale_Price__c_o == OCMSale_Price__c &&
- Amount__c == Amount__c_o &&
- Close_Forecasted_Date__c == Close_Forecasted_Date__c_o
- ) {
- StageName__c = "";
- Amount__c = "";
- OCMSale_Price__c = "";
- Close_Forecasted_Date__c = "";
- }
- // 銉愩儶銉囥兗銈枫儳銉�
- var error = [];
- //fy start
- // if(WorkRecord__c != 'SIS'&&WorkRecord__c != '绉戝浼�'){
- if (WorkRecord__c == "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦") {
- if (
- warlocksNumber__c == "" ||
- warlocksNumber__c == "" ||
- warlocksNumber__c == undefined
- ) {
- error.push("浜у搧鐢ㄩ噺 涓嶈兘涓虹┖");
- }
- }
- //fy end
- if (WorkRecord__c == "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦" && UserProType == "ENG") {
- if (
- productCategories__c == "" ||
- productCategories__c == "" ||
- productCategories__c == undefined
- ) {
- error.push("鍏朵粬鍝佺墝浜у搧绫诲埆 涓嶅瓨鍦�");
- }
- }
- if (WorkRecord__c == "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦") {
- if (
- ProductCcategory__c == "" ||
- ProductCcategory__c == "" ||
- ProductCcategory__c == undefined
- ) {
- error.push("宸查噰鐢ㄥ叾浠栧搧鐗� 涓嶅瓨鍦�");
- }
- }
- if (WorkRecord__c == "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦") {
- if (
- WarlockClassification__c == "" ||
- WarlockClassification__c == "" ||
- WarlockClassification__c == undefined
- ) {
- error.push("浜у搧1瀵瑰簲OLY浜у搧绾� 涓嶅瓨鍦�");
- }
- }
- if (WorkRecord__c == "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦") {
- if (
- ConsumptionOfConsumables__c == "" ||
- ConsumptionOfConsumables__c == "" ||
- ConsumptionOfConsumables__c == undefined
- ) {
- error.push("浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺 涓嶈兘涓虹┖");
- }
- }
- if (
- WorkRecord__c != "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦" &&
- WorkRecord__c != "甯傚満鎺ㄥ箍绫绘椿鍔�"
- ) {
- if (
- EffectProgress__c == "" ||
- EffectProgress__c == "" ||
- EffectProgress__c == undefined
- ) {
- error.push("鏁堟灉/杩涘害 涓嶅瓨鍦�");
- }
- }
- // if(WorkRecord__c != '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦'&&WorkRecord__c != 'QIS澶勭悊'){
- if (WorkRecord__c != "涓村簥淇℃伅(浣跨敤閲�)鏀堕泦") {
- if (
- UseProduct1__c == "" ||
- UseProduct1__c == "" ||
- UseProduct1__c == undefined
- ) {
- error.push("浣跨敤浜у搧1(浜у搧鍨嬪彿) 涓嶅瓨鍦�");
- }
- }
- if (
- ProductClassification__c == "" ||
- ProductClassification__c == "" ||
- ProductClassification__c == undefined
- ) {
- error.push("浜у搧鍒嗙被(绗笁鍒嗙被) 涓嶅瓨鍦�");
- }
- if (
- WorkRecord__c == "SIS" ||
- WorkRecord__c == "绉戝浼�" ||
- WorkRecord__c == "闄㈠唴鍏ラ櫌鐢宠" ||
- WorkRecord__c == "鏀惰垂椤圭洰鐢宠"
- ) {
- if (doctor2__c == "" || doctor2__c == "" || doctor2__c == undefined) {
- error.push("鎷滆浜� 涓嶅瓨鍦�");
- }
- }
- if (
- WorkRecord__c == "" ||
- WorkRecord__c == "" ||
- WorkRecord__c == undefined
- ) {
- error.push("娲诲姩鍖哄垎 涓嶅瓨鍦�");
- }
- if (
- DealerPersonnel__c == "" ||
- DealerPersonnel__c == "" ||
- DealerPersonnel__c == undefined
- ) {
- error.push("缁忛攢鍟嗕汉鍛� 涓嶅瓨鍦�");
- }
- if (
- Department_Cateogy__c == "" ||
- Department_Cateogy__c == "" ||
- Department_Cateogy__c == undefined
- ) {
- error.push("绉戝 涓嶅瓨鍦�");
- }
- if (
- Agency_Hospital__c == "" ||
- Agency_Hospital__c == "" ||
- Agency_Hospital__c == undefined
- ) {
- error.push("鍖婚櫌 涓嶅瓨鍦�");
- }
-
- if (
- Report_Date__c == "" ||
- Report_Date__c == "" ||
- Report_Date__c == undefined
- ) {
- error.push("娲诲姩鏃� 涓嶅瓨鍦�");
- }
- if (
- Submit_date__c == "" ||
- Submit_date__c == "" ||
- Submit_date__c == undefined
- ) {
- error.push("鍛� 涓嶅瓨鍦�");
- }
- var rDate = new Date(Report_Date__c);
- var sDate = new Date(Submit_date__c);
- sDate.setDate(sDate.getDate() - 1);
- if (rDate < sDate) {
- error.push("娲诲姩鏃ュ繀椤绘槸鏈懆锛�");
- }
- sDate.setDate(sDate.getDate() + 7);
- if (rDate >= sDate) {
- error.push("娲诲姩鏃ュ繀椤绘槸鏈懆锛�");
- }
- if (
- Person_In_Charge2__c == "" ||
- Person_In_Charge2__c == "" ||
- Person_In_Charge2__c == undefined
- ) {
- error.push("鎷呭綋 涓嶅瓨鍦�");
- }
- if (
- Agency_Report_Header__c == "" ||
- Agency_Report_Header__c == "" ||
- Agency_Report_Header__c == undefined
- ) {
- this.error("Report Header Id 涓嶅瓨鍦�");
- }
-
- // if (!UseProduct2__c) { error.push("浣跨敤浜у搧2 涓嶅瓨鍦�"); }
- // if (!UseProduct3__c) { error.push("浣跨敤浜у搧3 涓嶅瓨鍦�"); }
-
- // if (!productCategories__c) { error.push("鍏朵粬鍝佺墝浜у搧绫诲埆 涓嶅瓨鍦�"); }
-
- //let errorMsg = '';
- for (var i = 0; i < error.length; i++) {
- component.set("v.errorMessage", error[i]);
- this.showErrorToast(component);
- //errorMsg += '; ' + error[i]
- //this.error(error[i]);
- }
- // if(errorMsg != '')
- // this.error(errorMsg.substring(1));
- if (error.length > 0) {
- component.find("save_button").set("v.disabled", false);
- return false;
- }
- // 淇濆瓨鍑︾悊
- 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");
- action.setParams({
- Agency_Report_Id: Agency_Report__c,
- Department_Cateogy: Department_Cateogy__c,
- ConsumptionOfConsumables: ConsumptionOfConsumables__c,
- WorkRecord: WorkRecord__c,
- EffectProgress: EffectProgress__c,
- WarlockClassification: WarlockClassification__c,
- ProductCcategory: ProductCcategory__c,
- productCategories: productCategories__c,
- warlocksNumber: warlocksNumber__c,
- WorkMark: WorkMark__c,
- ProductClassification: ProductClassification__c,
- DealerPersonnel: DealerPersonnel__c,
- Agency_Report_Header: Agency_Report_Header__c,
- Agency_Hospital: Agency_Hospital__c,
- UseProduct1: UseProduct1__c,
- UseProduct2: UseProduct2__c,
- UseProduct3: UseProduct3__c,
- Person_In_Charge2: Person_In_Charge2__c,
- doctor: doctor2__c,
- Submit_date: Submit_date__c,
- StageName: StageName__c,
- oppAmount: Amount__c,
- oppOCMPrice: OCMSale_Price__c,
- Close_Forecasted_Date: Close_Forecasted_Date__c,
- Report_Date: Report_Date__c
- });
- 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();
- component.set("v.create_agency_report_id", report_id);
- var select_agency_list =
- component.get("v.allselectlist").AgencyPerson__c;
- for (var i = 0; i < select_agency_list.length; i++) {
- if (
- select_agency_list[i].value ==
- component.get("v.select_report_data").Person_In_Charge2__c
- ) {
- select_agency_list[i].selected = true;
- } else {
- select_agency_list[i].selected = false;
- }
- }
- component
- .find("select_agency_person")
- .set("v.options", select_agency_list);
- 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.loginEdit", false);
- } else {
- //component.set('v.errorMessage', 'save_report failed.');
- this.error("淇濆瓨鏃ユ姤澶辫触");
- //this.showErrorToast(component);
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- } else {
- /* Save (New & Copy) */
- var action = component.get("c.saveAgencyReport");
- action.setParams({
- Department_Cateogy: Department_Cateogy__c,
- ConsumptionOfConsumables: ConsumptionOfConsumables__c,
- WorkMark: WorkMark__c,
- warlocksNumber: warlocksNumber__c,
- DealerPersonnel: DealerPersonnel__c,
- ProductCcategory: ProductCcategory__c,
- productCategories: productCategories__c,
- WarlockClassification: WarlockClassification__c,
- ProductClassification: ProductClassification__c,
- WorkRecord: WorkRecord__c,
- EffectProgress: EffectProgress__c,
- Agency_Report_Header: Agency_Report_Header__c,
- Agency_Hospital: Agency_Hospital__c,
- Person_In_Charge2: Person_In_Charge2__c,
- doctor: doctor2__c,
- Submit_date: Submit_date__c,
- UseProduct1: UseProduct1__c,
- UseProduct2: UseProduct2__c,
- UseProduct3: UseProduct3__c,
- StageName: StageName__c,
- oppAmount: Amount__c,
- oppOCMPrice: OCMSale_Price__c,
- Close_Forecasted_Date: Close_Forecasted_Date__c,
- Report_Date: Report_Date__c
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- component.set("v.successMessage", "淇濆瓨鎴愬姛");
- this.showSuccessToast(component);
- var report_id = response.getReturnValue();
- component.set("v.create_agency_report_id", report_id);
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- component.find("select_agency_person").get("v.value")
- );
- // 銉€兗銉�銉偊銈c兂銉夈偊鍐呫伄涓�瑕х敤
- var action2 = component.get("c.getReportsById");
- action2.setParams({
- report_id: report_id
- });
- action2.setCallback(this, function (response) {
+ doinit: function (component, event, helper) {
+ document.title = "杩芥函鏃ユ姤";
+
+ this.report_date_list(component, event, helper, 5);
+ component.set('v.login', true);
+ var action = component.get('c.getalldata');
+ action.setCallback(this, function (response) {
var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- var reports_now = component.get("v.reports_now");
- var reports_now_count = 0;
- if (reports_now.length > 0 && reports_now != "") {
- reports_now_count = reports_now.length;
- }
- // Save&New鏅傘伄銈︺偅銉炽儔銈﹀唴銉囥兗銈夸竴瑕�
- if (res.length > 0) {
- reports_now[reports_now_count] = res[0];
- reports_now.sort(function (a, b) {
- if (a.Name > b.Name) return -1;
- if (a.Name < b.Name) return 1;
- return 0;
- });
- component.set("v.reports_now", reports_now);
- component.set("v.reports_now_count", reports_now.length);
- var data_list = component.find("modal_data_list_tr");
- }
- } else {
- // component.set('v.errorMessage', 'get_reports_now failed.');
- this.error("get_reports_now failed.");
- //this.showErrorToast(component);
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
+ 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.login', 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.loginEdit", false);
- debugger;
- this.doinitSave(component, event, helper);
- } else {
- var error = response.getError();
- //component.set('v.errorMessage', '淇濆瓨鏃ユ姤澶辫触');
- this.error("淇濆瓨鏃ユ姤澶辫触");
- //this.showErrorToast(component);
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- }
- },
-
- allclear: function (component) {
- var clear = [{ label: "", value: "", selected: true }];
- component.set("v.hospital", "");
- component.set("v.hospitalId", "");
- component.set("v.hospitalLinkId", "");
- component.set("v.UseProduct1", "");
- component.set("v.UseProduct1Id", "");
- component.set("v.UseProduct2", "");
- component.set("v.UseProduct2Id", "");
- component.set("v.UseProduct3", "");
- component.set("v.UseProduct3Id", "");
- component.find("select_ProductClassification").set("v.value", "");
- component.find("select_warlocksNumber").set("v.value", null);
- component.find("select_department").set("v.value", "");
- component.find("select_ConsumptionOfConsumables").set("v.value", null);
- component.find("select_WorkMark").set("v.checked", false);
- component.find("new_con").set("v.disabled", true);
- component.find("select_doctor").set("v.options", clear);
- component
- .find("select_DealerPersonnel")
- .set(
- "v.options",
- this.conv_selected(component.get("v.allselectlist.DealerPersonnel__c"))
- );
- component
- .find("select_purpose_type")
- .set(
- "v.options",
- this.conv_selected(component.get("v.allselectlist.WorkRecord__c"))
- );
- // component.find('select_ProductCcategory').set('v.options', this.conv_selected(component.get('v.allselectlist.ProductCcategory__c')));
- component.find("select_EffectProgress").set("v.value", "");
- component.find("select_OtherBrandConsumables").set("v.value", "");
- component.find("select_ProductCcategory").set("v.value", "");
- component.find("select_productCategories").set("v.value", "");
- // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
- component.set("v.data.Report_Date__c", "");
- component.set("v.oppdata.Close_Forecasted_Date__c", "");
- component.set("v.oppdata.Amount__c", "");
- component.set("v.oppdata.OCMSale_Price__c", "");
- component.set("v.oppdata.StageName__c", "");
- component.set("v.Close_Forecasted_Date__c_o", "");
- component.set("v.Amount__c_o", "");
- component.set("v.OCMSale_Price__c_o", "");
- component.set("v.StageName__c_o", "");
- $A.util.addClass(component.find("input-opportunity-stage"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-amount1"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-amount2"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-date"), "disp_none");
- this.selectPurposeType(component);
- this.selectProductClassification(component);
- this.selectpurposetype(component);
- },
-
- report_date_list: function (component, event, helper, count) {
- var ret_obj = [];
- var now = new Date();
- for (var i = 0; i < count; i++) {
- var start_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() + 1 - i * 7
- );
- var end_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() + (7 - now.getDay()) - i * 7
- );
- var start_day_show = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() - i * 7
- );
- var end_day_show = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() + (6 - now.getDay()) - i * 7
- );
- var date_text =
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate() +
- "~" +
- end_day.getFullYear() +
- "/" +
- (end_day.getMonth() + 1) +
- "/" +
- end_day.getDate();
- if (i == 0) {
- ret_obj.push({
- selected: true,
- value:
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate(),
- label:
- start_day_show.getFullYear() +
- "/" +
- (start_day_show.getMonth() + 1) +
- "/" +
- start_day_show.getDate() +
- "~" +
- end_day_show.getFullYear() +
- "/" +
- (end_day_show.getMonth() + 1) +
- "/" +
- end_day_show.getDate()
- });
- } else {
- ret_obj.push({
- selected: false,
- value:
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate(),
- label:
- start_day_show.getFullYear() +
- "/" +
- (start_day_show.getMonth() + 1) +
- "/" +
- start_day_show.getDate() +
- "~" +
- end_day_show.getFullYear() +
- "/" +
- (end_day_show.getMonth() + 1) +
- "/" +
- end_day_show.getDate()
- });
- }
- }
- component.find("select_date").set("v.options", ret_obj);
- component.set("v.report_date_list", ret_obj);
- },
- create_report_header: function (
- component,
- event,
- helper,
- name,
- s_agency,
- s_date
- ) {
- s_date = this.get_date_string(s_date);
- if (s_date == false) {
- //component.set('v.errorMessage', 'get_date_string failed.');
- this.error("get_date_string failed.");
- //this.showErrorToast(component);
- return false;
- }
- var head_key = this.create_header_input_key(s_agency, s_date);
- component.set("v.agency_report_header", head_key);
- if (head_key == false) {
- //component.set('v.errorMessage', 'create_header_input_key failed.');
- this.error("create_header_input_key failed.");
- //this.showErrorToast(component);
- return false;
- }
- var key2 = s_date.replace(/-/g, "");
- var action = component.get("c.createReportHeader");
- action.setParams({
- name: name,
- s_date: s_date,
- s_agency: s_agency,
- head_key: head_key
- });
- component.set("v.login", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.agency_report_header_id", res);
- component.set("v.login", false);
- this.toggle_report(component, event, helper);
- } else {
- //component.set('v.errorMessage', 'createReportHeader callback failed.');
- this.error("createReportHeader callback failed.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
- create_report_header_edit: function (
- component,
- event,
- helper,
- name,
- s_agency,
- s_date
- ) {
- s_date = this.get_date_string(s_date);
- if (s_date == false) {
- //component.set('v.errorMessage', 'get_date_string failed.');
- this.error("get_date_string failed.");
- //this.showErrorToast(component);
- return false;
- }
- var head_key = this.create_header_input_key(s_agency, s_date);
- component.set("v.agency_report_header", head_key);
- if (head_key == false) {
- //component.set('v.errorMessage', 'create_header_input_key failed.');
- this.error("create_header_input_key failed.");
- //this.showErrorToast(component);
- return false;
- }
- var key2 = s_date.replace(/-/g, "");
- var action = component.get("c.createReportHeader");
-
- action.setParams({
- name: name,
- s_date: s_date,
- s_agency: s_agency,
- head_key: head_key
- });
- component.set("v.login", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.agency_report_header_id", res);
- component.set("v.login", false);
- this.toggle_report_edit(component, event, helper);
- } else {
- //component.set('v.errorMessage', 'createReportHeader callback failed.');
- this.error("createReportHeader callback failed.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
- create_header_input_key: function (agency_id, s_date) {
- if (typeof s_date != "string") {
- s_date = this.get_date_string(s_date);
- if (s_date == false) {
- //component.set('v.errorMessage', 'get_date_string in create_header_input_key.');
- this.error("get_date_string in create_header_input_key.");
- //this.showErrorToast(component);
- return false;
- }
- }
- if (!agency_id || !s_date) {
- return false;
- }
- s_date = s_date.replace(/-/g, "");
- var headkey = agency_id + ":" + s_date;
- return headkey;
- },
-
- /* typeof is not cool
- * @ret : String, Boolean, Date, Error, Array, Function, Null, Undefined, etc
- */
- object_type: function (obj) {
- var obj_type = Object.prototype.toString.call(obj).slice(8, -1);
- return obj_type;
- },
- // create yyyy-mm-dd string
- get_date_string: function (val) {
- if (typeof val == "string") {
- if (val.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) {
- val = val.replace(/[\/]/g, "-");
- var tmp = val.split("-");
- if (tmp[1].length == 1) {
- tmp[1] = "0" + tmp[1];
- }
- if (tmp[2].length == 1) {
- tmp[2] = "0" + tmp[2];
- }
- val = tmp[0] + "-" + tmp[1] + "-" + tmp[2];
- } else if (val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) {
- //ok
- } else {
- return false;
- }
- } else if (this.object_type(val) == "Date") {
- var mm = val.getMonth() + 1;
- if (String(mm).length == 1) {
- mm = "0" + mm;
- }
- var dd = "";
- if (String(val.getDate()).length == 1) {
- dd = "0" + val.getDate();
- } else {
- dd = val.getDate();
- }
- val = val.getFullYear() + "-" + mm + "-" + dd;
- } else {
- return false;
- }
- return val;
- },
- // Controller 鏍规嵁椤甸潰鍖婚櫌鏌ヨ绗﹀悎鐨勫尰闄�
- searchHos: function (component, event, helper) {
- var hospital_name = event.getParam("value");
- var action = component.get("c.getHospitalList");
- action.setParams({
- hospital_name: hospital_name
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var hospital_list = component.find("hospital_list");
- var hosList = response.getReturnValue();
- if (hosList.length > 0) {
- $A.util.addClass(hospital_list, "slds-is-open");
- } else {
- $A.util.removeClass(hospital_list, "slds-is-open");
- }
- component.set("v.hospitalList", response.getReturnValue());
- } else {
- $A.util.removeClass(hospital_list, "slds-is-open");
- }
- });
- $A.enqueueAction(action);
- },
- hideSearch: function (component, event, helper) {
- var hospital_list = component.find("hospital_list");
- $A.util.removeClass(hospital_list, "slds-is-open");
- },
- hideSearchs: function (component, event, helper) {
- var hospital_list = component.find("hospital_list");
- $A.util.removeClass(hospital_list, "slds-is-open");
- component.set("v.hospital", "");
- component.set("v.hospitals", "");
- component.set("v.hospitalLinkId", "");
- component.set("v.data.Agency_Hospital__c", "");
- component.set("v.hospitalId", "");
- },
- selectHos: function (component, event, helper) {
- var hospital_list = component.find("hospital_list");
- $A.util.removeClass(hospital_list, "slds-is-open");
- var accname = event.currentTarget.dataset.accname;
- var accid = event.currentTarget.dataset.accid;
- var hospital_data = component.get("v.hospitalList");
- var select_purpose_type = component
- .find("select_purpose_type")
- .get("v.value");
- for (var i = 0; i < hospital_data.length; i++) {
- if (hospital_data[i].Hospital__c == accid) {
- component.set("v.hospitalLinkId", hospital_data[i].Id);
- component.set("v.data.Agency_Hospital__c", hospital_data[i].Id);
- if (select_purpose_type != "绉戝浼�" && hospital_data[i].Hospital__c) {
- component.find("new_con").set("v.disabled", false);
- } else {
- component.find("new_con").set("v.disabled", true);
- }
- }
- }
- component.set("v.hospitals", accname);
- component.set("v.hospital", accname);
- component.set("v.hospitalId", accid);
-
- component.set("v.setdoctorlisthos", true);
- this.set_doctor_list_edit(component, event, helper);
- },
-
- //妯$硦鏌ヨ浣跨敤浜у搧1(浜у搧鍨嬪彿)
- searchUseProduct1: function (component, event, helper) {
- var UseProduct1Name = event.getParam("value");
- var select_ProductClassification = component
- .find("select_ProductClassification")
- .get("v.value");
- var action = component.get("c.getUseProduct1");
- action.setParams({
- UseProduct1Name: UseProduct1Name,
- select_ProductClassification: select_ProductClassification
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var UseProduct1_List = component.find("UseProduct1_List");
- var UseProduct1ListValue = response.getReturnValue();
- if (UseProduct1ListValue.length > 0) {
- $A.util.addClass(UseProduct1_List, "slds-is-open");
- } else {
- $A.util.removeClass(UseProduct1_List, "slds-is-open");
- }
- component.set("v.UseProduct1List", UseProduct1ListValue);
- } else {
- $A.util.removeClass(UseProduct1_List, "slds-is-open");
- }
- });
- $A.enqueueAction(action);
- },
- hideSearchUseProduct1: function (component, event, helper) {
- var UseProduct1_List = component.find("UseProduct1_List");
- $A.util.removeClass(UseProduct1_List, "slds-is-open");
- },
- hideSearchUseProduct1s: function (component, event, helper) {
- var UseProduct1_List = component.find("UseProduct1_List");
- $A.util.removeClass(UseProduct1_List, "slds-is-open");
- component.set("v.UseProduct1", "");
- component.set("v.UseProduct1s", "");
- component.set("v.UseProduct1Id", "");
- component.set("v.data.UseProduct1__c", "");
- },
- seletUseProduct1Change: function (component, event, helper) {
- var UseProduct1_List = component.find("UseProduct1_List");
- $A.util.removeClass(UseProduct1_List, "slds-is-open");
- var accname = event.currentTarget.dataset.accname;
- var accid = event.currentTarget.dataset.accid;
- var UseProduct1ListDate = component.get("v.UseProduct1List");
- for (var i = 0; i < UseProduct1ListDate.length; i++) {
- if (UseProduct1ListDate[i].Id == accid) {
- component.set("v.UseProduct1Id", UseProduct1ListDate[i].Id);
- component.set("v.data.UseProduct1__c", UseProduct1ListDate[i].Id);
- }
- }
- var UseProduct2_TEXT = component.find("UseProduct2_TEXT").get("v.value");
- var UseProduct3_TEXT = component.find("UseProduct3_TEXT").get("v.value");
- if (UseProduct2_TEXT != accname && UseProduct3_TEXT != accname) {
- component.set("v.UseProduct1s", accname);
- component.set("v.UseProduct1", accname);
- } else {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�");
- //this.showErrorToast(component);
- }
- },
- //妯$硦鏌ヨ浣跨敤浜у搧2
- searchUseProduct2: function (component, event, helper) {
- var UseProduct2Name = event.getParam("value");
- var select_ProductClassification = component
- .find("select_ProductClassification")
- .get("v.value");
- var action = component.get("c.getUseProduct1");
- action.setParams({
- UseProduct1Name: UseProduct2Name,
- select_ProductClassification: select_ProductClassification
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var UseProduct2_List = component.find("UseProduct2_List");
- var UseProduct2List = response.getReturnValue();
- if (UseProduct2List.length > 0) {
- $A.util.addClass(UseProduct2_List, "slds-is-open");
- } else {
- $A.util.removeClass(UseProduct2_List, "slds-is-open");
- }
- component.set("v.UseProduct2List", response.getReturnValue());
- } else {
- $A.util.removeClass(UseProduct2_List, "slds-is-open");
- }
- });
- $A.enqueueAction(action);
- },
- hideSearchUseProduct2: function (component, event, helper) {
- var UseProduct2_List = component.find("UseProduct2_List");
- $A.util.removeClass(UseProduct2_List, "slds-is-open");
- },
- hideSearchUseProduct2s: function (component, event, helper) {
- var UseProduct2_List = component.find("UseProduct2_List");
- $A.util.removeClass(UseProduct2_List, "slds-is-open");
- component.set("v.UseProduct2", "");
- component.set("v.UseProduct2s", "");
- component.set("v.UseProduct2Id", "");
- component.set("v.data.UseProduct2__c", "");
- },
- seletUseProduct2Change: function (component, event, helper) {
- var UseProduct2_List = component.find("UseProduct2_List");
- $A.util.removeClass(UseProduct2_List, "slds-is-open");
- var accname = event.currentTarget.dataset.accname;
- var accid = event.currentTarget.dataset.accid;
- var UseProduct2ListDate = component.get("v.UseProduct2List");
- for (var i = 0; i < UseProduct2ListDate.length; i++) {
- if (UseProduct2ListDate[i].Id == accid) {
- component.set("v.UseProduct2Id", UseProduct2ListDate[i].Id);
- component.set("v.data.UseProduct2__c", UseProduct2ListDate[i].Id);
- }
- }
- var UseProduct1_TEXT = component.find("UseProduct1_TEXT").get("v.value");
- var UseProduct3_TEXT = component.find("UseProduct3_TEXT").get("v.value");
- if (UseProduct1_TEXT != accname && UseProduct3_TEXT != accname) {
- component.set("v.UseProduct2s", accname);
- component.set("v.UseProduct2", accname);
- } else {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�");
- //this.showErrorToast(component);
- }
- },
- //妯$硦鏌ヨ浣跨敤浜у搧3
- searchUseProduct3: function (component, event, helper) {
- var UseProduct3Name = event.getParam("value");
- var select_ProductClassification = component
- .find("select_ProductClassification")
- .get("v.value");
- var action = component.get("c.getUseProduct1");
- action.setParams({
- UseProduct1Name: UseProduct3Name,
- select_ProductClassification: select_ProductClassification
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var UseProduct3_List = component.find("UseProduct3_List");
- var UseProduct3List = response.getReturnValue();
- if (UseProduct3List.length > 0) {
- $A.util.addClass(UseProduct3_List, "slds-is-open");
- } else {
- $A.util.removeClass(UseProduct3_List, "slds-is-open");
- }
- component.set("v.UseProduct3List", response.getReturnValue());
- } else {
- $A.util.removeClass(UseProduct3_List, "slds-is-open");
- }
- });
- $A.enqueueAction(action);
- },
- hideSearchUseProduct3: function (component, event, helper) {
- var UseProduct3_List = component.find("UseProduct3_List");
- $A.util.removeClass(UseProduct3_List, "slds-is-open");
- },
- hideSearchUseProduct3s: function (component, event, helper) {
- var UseProduct3_List = component.find("UseProduct3_List");
- $A.util.removeClass(UseProduct3_List, "slds-is-open");
- component.set("v.UseProduct3", "");
- component.set("v.UseProduct3s", "");
- component.set("v.UseProduct3Id", "");
- component.set("v.data.UseProduct3__c", "");
- },
- seletUseProduct3Change: function (component, event, helper) {
- var UseProduct3_List = component.find("UseProduct3_List");
- $A.util.removeClass(UseProduct3_List, "slds-is-open");
- var accname = event.currentTarget.dataset.accname;
- var accid = event.currentTarget.dataset.accid;
- var UseProduct3ListDate = component.get("v.UseProduct3List");
- for (var i = 0; i < UseProduct3ListDate.length; i++) {
- if (UseProduct3ListDate[i].Id == accid) {
- component.set("v.UseProduct3Id", UseProduct3ListDate[i].Id);
- component.set("v.data.UseProduct3__c", UseProduct3ListDate[i].Id);
- }
- }
- var UseProduct1_TEXT = component.find("UseProduct1_TEXT").get("v.value");
- var UseProduct2_TEXT = component.find("UseProduct2_TEXT").get("v.value");
- if (UseProduct1_TEXT != accname && UseProduct2_TEXT != accname) {
- component.set("v.UseProduct3s", accname);
- component.set("v.UseProduct3", accname);
- } else {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�");
- //this.showErrorToast(component);
- }
- },
- //hospitalLinkId 缁忛攢鍟嗗尰闄㈢殑ID 鎷滆浜哄鍒剁殑鍦版柟
- doctor_change: function (component, event, helper) {
- var doctorurpose = component.find("select_purpose_type").get("v.value");
- var doctor_value = component.find("select_doctor").get("v.value");
- var doctor_list = component.get("v.doctor_list");
- var flg = false;
- if (doctor_list) {
- for (var i = 0; i < doctor_list.length; i++) {
- if (doctor_list[i].value == doctor_value) {
- if (doctorurpose == "绉戝浼�") {
- // component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c);
- } else {
- component.set("v.doctor_title", doctor_list[i].Doctor_Division1__c);
- }
- flg = true;
- break;
- }
- }
- }
- if (flg == false) {
- component.set("v.doctor_title", "");
- }
- },
- //SWAG-CF58C3 fy start 璋冪敤pi
- set_aws_url: function (component, sobject) {
- var action = component.get("c.getAwsurl");
- action.setParams({
- sobj: sobject
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var awsmap = this.conv_selected(response.getReturnValue());
- component.set("v.AWStoken", awsmap.token);
- component.set("v.AWSinsert", awsmap.newUrl);
- component.set("v.AWSsearch", awsmap.searchUrl);
- component.set("v.AWStransactionURL", awsmap.transactionURL);
- } else {
- // component.set('v.errorMessage', 'AWS url/token error.');
- this.error("AWS url/token error.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- insert_agencycontact: function (
- component,
- token,
- newUrl,
- payload,
- agencyHospitalid,
- helper,
- hospitalName
- ) {
- console.log("newUrl = " + newUrl);
- console.log("payload = " + payload);
- console.log("token = " + token);
- fetch(newUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- console.log("result = " + JSON.stringify(result));
- if (result.status == "0") {
- $A.getCallback(function () {
- helper.to_agencycontact(component, result, agencyHospitalid);
- })();
- } else {
- console.log("AWS status error:" + result);
- component.set("v.login", false);
- if (result.status == "129") {
- component
- .find("OppMessage")
- .setError(
- "璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪" + hospitalName + "鍖婚櫌锛岃淇敼"
- );
- } else {
- component.find("OppMessage").setError("AWS insert error.");
- }
- }
- })
- .catch((error) => {
- console.log("AWS insert error:" + error);
- component.set("v.login", false);
- component.find("OppMessage").setError("AWS insert error.");
- });
- },
-
- to_agencycontact: function (component, result, agencyHospitalid) {
- var action = component.get("c.saveAgencyContact");
- action.setParams({
- name: result.object[0].name,
- //"nameEncrypt" : result.object[0].nameEncrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
- type: result.object[0].type,
- //"typeEncrypt" : result.object[0].typeEncrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
- doctorDivision1: result.object[0].doctorDivision1,
- //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
- agencyHospitalid: agencyHospitalid,
- awsid: result.object[0].dataId
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var acMap = this.conv_selected(response.getReturnValue());
- console.log(acMap);
- if (acMap.AgencyContactId != "") {
- //纭浜嬪姟
- var token = component.get("v.AWStoken");
- var confirmUrl = component.get("v.AWStransactionURL");
-
- let data = Object.create(null);
- data["isSuccess"] = 1;
- data["sfRecordId"] = "";
- data["txId"] = result.txId;
-
- this.to_confirm(component, token, confirmUrl, JSON.stringify(data));
- } else if (acMap.errormsg != "") {
- // component.set('v.errorMessage', acMap.errormsg);
- this.error(acMap.errormsg);
- //this.showErrorToast(component);
- component.set("v.login", false);
- } else {
- //component.set('v.errorMessage', 'agency contact insert id error.');
- this.error("agency contact insert id error.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- } else {
- //component.set('v.errorMessage', 'agency contact insert error.');
- this.error("agency contact insert error.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- to_confirm: function (component, token, confirmUrl, payload, event) {
- fetch(confirmUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- if (
- result.status == "0" &&
- result.hasOwnProperty("success") &&
- result.success
- ) {
- // component.set('v.truthy', false);
- // var modal_newAC = component.find('modal_newAC')
- // $A.util.addClass(modal_newAC, 'disp_none');
- // this.success('.瀹㈡埛浜哄憳宸插垱寤恒��');
- // this.set_doctor_list(component);
-
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- component.set("v.successMessage", ".鎷滆浜哄凡鍒涘缓銆�");
- this.showSuccessToast(component);
- component.set("v.login", false);
- this.set_doctor_list_edit(component);
- } else {
- //component.set('v.errorMessage', 'AWS confirm error.');
- this.error("AWS confirm error.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- }
- })
- .catch((error) => {
- // component.set('v.errorMessage', 'AWS confirm error.');
- this.error("AWS confirm error.");
- //this.showErrorToast(component);
- component.set("v.login", false);
- });
- },
- //SWAG-CF58C3 fy end 璋冪敤pi
-
- set_doctor_list: function (component) {
- console.log("set_doctor_list");
- var doctor_value = component.find("select_purpose_type").get("v.value");
- var hospital_id = component.get("v.hospitalLinkId");
- console.log("hospital_id = " + hospital_id);
- if (hospital_id) {
- if (doctor_value == "绉戝浼�") {
- component.set("v.loginEdit", true);
- this.set_doctor_list2(component);
- } else {
- component.set("v.loginEdit", true);
- var action = component.get("c.getDoctorList");
- action.setParams({
- hospital_id: hospital_id
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = this.conv_selected(response.getReturnValue());
- //fy
- var setdoctorlisthos = component.get("v.setdoctorlisthos");
- if (setdoctorlisthos) {
- component.set("v.default_select_doctor_id", "");
- component.set("v.setdoctorlisthos", false);
+ else {
+ //component.set('v.errorMessage', 'doinit failed.');
+ this.error('doinit failed.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
}
- //fy
- var default_doctor = component.get("v.default_select_doctor_id");
- if (default_doctor != "" && res.length > 0) {
- var doctor_title = "";
- let awsids = [];
- for (var i = 0; i < res.length; i++) {
- if (res[i].value == default_doctor) {
- res[i].selected = true;
- doctor_title = res[i].Doctor_Division1__c;
- } else {
- res[i].selected = false;
- }
- if (res[i].AWS_Data_Id__c) {
- awsids.push(res[i].AWS_Data_Id__c);
- }
- }
- component.find("select_doctor").set("v.options", res);
- component.set("v.doctor_title", doctor_title);
- console.log("awsids = " + JSON.stringify(awsids));
- if (awsids.length > 0) {
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- console.log("data = " + JSON.stringify(data));
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].AWS_Data_Id__c)
- ) {
- res[ri].label = m[res[ri].AWS_Data_Id__c].name;
- }
- }
- component.find("select_doctor").set("v.options", res);
- }
-
- component.set("v.loginEdit", false);
- },
- staticResourceAgencyContact.token
- );
- }
- } else {
- let awsids = [];
- for (var i = 0; i < res.length; i++) {
- if (res[i].AWS_Data_Id__c) {
- awsids.push(res[i].AWS_Data_Id__c);
- }
- }
- component.find("select_doctor").set("v.options", res);
- if (awsids.length > 0) {
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].AWS_Data_Id__c)
- ) {
- res[ri].label = m[res[ri].AWS_Data_Id__c].name;
- }
- }
- component.find("select_doctor").set("v.options", res);
- }
-
- component.set("v.loginEdit", false);
- },
- staticResourceAgencyContact.token
- );
- }
- // component.find('select_doctor').set('v.options', res);
- if (res.length > 0) {
- component.set("v.doctor_title", res[0].Doctor_Division1__c);
- }
- }
- // component.set('v.default_select_doctor_id', '');
-
- component.set("v.doctor_list", res);
- component.set("v.loginEdit", false);
- } else {
- // component.set('v.errorMessage', 'set_doctor_list failed.');
- this.error("set_doctor_list failed.");
- //this.showErrorToast(component);
- component.set("v.loginEdit", false);
- }
});
$A.enqueueAction(action);
- }
- } else {
- if (doctor_value == "绉戝浼�") {
- this.set_doctor_list2(component);
- } else {
- component.find("select_doctor").set("v.options", "");
- }
- }
- component.set("v.loginEdit", false);
- }, //fy 20220414
- set_doctor_list_edit: function (component) {
- console.log("set_doctor_list");
- var doctor_value = component.find("select_purpose_type").get("v.value");
- var hospital_id = component.get("v.hospitalLinkId");
- console.log("hospital_id = " + hospital_id);
- if (hospital_id) {
- if (doctor_value == "绉戝浼�") {
- component.set("v.loginEdit", true);
- this.set_doctor_list2(component);
- } else {
- component.set("v.loginEdit", true);
- var action = component.get("c.getDoctorList");
- action.setParams({
- hospital_id: hospital_id
- });
+ },
+ 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 = this.conv_selected(response.getReturnValue());
- //fy
- var setdoctorlisthos = component.get("v.setdoctorlisthos");
- if (setdoctorlisthos) {
- component.set("v.default_select_doctor_id", "");
- component.set("v.setdoctorlisthos", false);
+ 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);
}
- //fy
- var default_doctor = component.get("v.default_select_doctor_id");
- if (default_doctor != "" && res.length > 0) {
- var doctor_title = "";
- let awsids = [];
- for (var i = 0; i < res.length; i++) {
- if (res[i].value == default_doctor) {
- res[i].selected = true;
- doctor_title = res[i].Doctor_Division1__c;
- } else {
- res[i].selected = false;
- }
- if (res[i].AWS_Data_Id__c) {
- awsids.push(res[i].AWS_Data_Id__c);
- }
- }
- component.find("select_doctor").set("v.options", res);
- component.set("v.doctor_title", doctor_title);
- console.log("awsids = " + JSON.stringify(awsids));
- if (awsids.length > 0) {
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- console.log("data = " + JSON.stringify(data));
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].AWS_Data_Id__c)
- ) {
- res[ri].label = m[res[ri].AWS_Data_Id__c].name;
- }
- }
- component.find("select_doctor").set("v.options", res);
- }
-
- component.set("v.loginEdit", false);
- },
- staticResourceAgencyContact.token
- );
- }
- } else {
- let awsids = [];
- for (var i = 0; i < res.length; i++) {
- if (res[i].AWS_Data_Id__c) {
- awsids.push(res[i].AWS_Data_Id__c);
- }
- }
- component.find("select_doctor").set("v.options", res);
- if (awsids.length > 0) {
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].AWS_Data_Id__c)
- ) {
- res[ri].label = m[res[ri].AWS_Data_Id__c].name;
- }
- }
- component.find("select_doctor").set("v.options", res);
- }
-
- component.set("v.loginEdit", false);
- },
- staticResourceAgencyContact.token
- );
- }
- // component.find('select_doctor').set('v.options', res);
- if (res.length > 0) {
- component.set("v.doctor_title", res[0].Doctor_Division1__c);
- }
+ else {
+ //component.set('v.errorMessage', 'doinit failed.');
+ this.error('doinit failed.');
+ //this.showErrorToast(component);
+ component.set('v.loginEdit', false);
}
- // component.set('v.default_select_doctor_id', '');
-
- component.set("v.doctor_list", res);
- component.set("v.loginEdit", false);
- } else {
- // component.set('v.errorMessage', 'set_doctor_list failed.');
- this.error("set_doctor_list failed.");
- //this.showErrorToast(component);
- component.set("v.loginEdit", false);
- }
});
$A.enqueueAction(action);
- }
- } else {
- if (doctor_value == "绉戝浼�") {
- this.set_doctor_list2(component);
- } else {
- component.find("select_doctor").set("v.options", "");
- }
- }
- },
- set_doctor_list2: function (component) {
- var action1 = component.get("c.selectdoctor3c");
- action1.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
-
- for (var i = 0; i < res.length; i++) {
- if (res[i].selected == "true") {
- res[i].selected = true;
- } else {
- res[i].selected = false;
- }
- }
-
- component.find("select_doctor").set("v.options", res);
- var doctor3value = component.get("v.default_select_doctor_id2");
- this.set_selected(component, "select_doctor", doctor3value);
- component.set("v.login", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action1);
- },
- productcategoryChange1: function (component, event, helper) {
- var product_category_id = component.find("select_Product1").get("v.value");
- var pcId1 = component.find("select_Product2").get("v.value");
- var pcId2 = component.find("select_Product3").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- //this.showErrorToast(component);
- component.find("select_Product1").set("v.value", "");
- }
- },
- productcategoryChange2: function (component, event, helper) {
- var product_category_id = component.find("UseProduct2_TEXT").get("v.value");
- var pcId1 = component.find("UseProduct1_TEXT").get("v.value");
- var pcId2 = component.find("UseProduct3_TEXT").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null;
- var p2bool = pcId2 != "" && pcId2 != null;
- var p0bool = product_category_id != "" && product_category_id != null;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- //this.showErrorToast(component);
- component.set("v.UseProduct2_TEXT", "");
- }
- },
- productcategoryChange3: function (component, event, helper) {
- var product_category_id = component.find("select_Product3").get("v.value");
- var pcId1 = component.find("select_Product1").get("v.value");
- var pcId2 = component.find("select_Product2").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
- this.error("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- //this.showErrorToast(component);
- component.find("select_Product3").set("v.value", "");
- }
- },
- conv_selected: function (obj) {
- for (var i = 0; i < obj.length; i++) {
- if (obj[i].selected) {
- if (obj[i].selected == "true") {
- obj[i].selected = true;
- } else {
- obj[i].selected = false;
- }
- }
- }
- return obj;
- },
- set_selected: function (component, aura_id_name, value) {
- var select_tmp = component.find(aura_id_name).get("v.options");
- if (select_tmp) {
- for (var i = 0; i < select_tmp.length; i++) {
- if (select_tmp[i].value == value) {
- select_tmp[i].selected = true;
- } else {
- select_tmp[i].selected = false;
- }
- }
- component.find(aura_id_name).set("v.options", select_tmp);
- return true;
- } else {
- return false;
- }
- },
- //寮瑰嚭 鎴愬姛鎻愮ず
- showSuccessToast: function (component) {
- $A.util.removeClass(component.find("successDiv"), "slds-hide");
- window.setTimeout(
- $A.getCallback(function () {
- $A.util.addClass(component.find("successDiv"), "slds-hide");
- }),
- 3000
- );
- },
- //寮瑰嚭 鎴愬姛鎻愮ず
- showSuccessToast01: function (component) {
- $A.util.removeClass(component.find("successDiv01"), "slds-hide");
- window.setTimeout(
- $A.getCallback(function () {
- $A.util.addClass(component.find("successDiv01"), "slds-hide");
- }),
- 3000
- );
- },
- //寮瑰嚭 閿欒鎻愮ず
- showErrorToast: function (component) {
- $A.util.removeClass(component.find("errorDiv"), "slds-hide");
- window.setTimeout(
- $A.getCallback(function () {
- $A.util.addClass(component.find("errorDiv"), "slds-hide");
- }),
- 3000
- );
- },
- //寮瑰嚭 閿欒鎻愮ず
- showErrorToast01: function (component) {
- $A.util.removeClass(component.find("errorDiv01"), "slds-hide");
- window.setTimeout(
- $A.getCallback(function () {
- $A.util.addClass(component.find("errorDiv01"), "slds-hide");
- }),
- 6000
- );
- },
- error: function (message) {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "閿欒!",
- message: message,
- type: "error",
- duration: "sticky"
- });
- toastEvent.fire();
- },
- createCon: function (component, event, helper) {
- var modal_newAC = component.find("modal_newAC");
- $A.util.removeClass(modal_newAC, "disp_none");
- component.set("v.truthy", true);
- },
- hideCmp: function (component, event, helper) {
- var div1 = component.find("report");
- var div2 = component.find("report_list");
- $A.util.addClass(div1, "disp_none");
- $A.util.addClass(div2, "disp_none");
- },
- handleSuccess: function (component, event, helper) {
- var insertId = event.getParams().response.Id;
- var displayValue = event.getParams().response.fields.Name.value;
- event.setParams({});
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- component.set("v.successMessage", ".鎷滆浜哄凡鍒涘缓銆�");
- this.showSuccessToast(component);
- this.set_doctor_list_edit(component, event, helper);
- },
- createCancel: function (component, event, helper) {
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- component.find("OppMessage").setError("");
- },
- //绉戝璧嬪��
- setOpportunity_cfilter: function (component) {
- var hosId = component.get("v.hospitalId");
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- var opportunity_cfilter = "";
- if (hosId != "" && hosId != null) {
- opportunity_cfilter =
- " Agency_Hospital__r.Hospital__c=" + "'" + hosId + "'";
- }
- if (Department_Cateogy__c != "" && Department_Cateogy__c != null) {
- if (opportunity_cfilter != "" && opportunity_cfilter != null) {
- opportunity_cfilter += " AND ";
- }
- // fy Department_Cateogy_text__c
- opportunity_cfilter +=
- "Department_Cateogy__c=" + "'" + Department_Cateogy__c + "'";
- // opportunity_cfilter += 'Department_Cateogy_text__c=' + '\'' + Department_Cateogy__c + '\'';
- }
- component.set("v.opportunity_cfilter", opportunity_cfilter);
- },
- readFile: function (component, helper, file) {
- if (!file) return;
- if (!file.name.match(/\.(csv||CSV)$/)) {
- return alert("only support csv files");
- } else {
- reader = new FileReader();
- reader.onerror = function errorHandler(evt) {
- switch (evt.target.error.code) {
- case evt.target.error.NOT_FOUND_ERR:
- alert("File Not Found!");
- break;
- case evt.target.error.NOT_READABLE_ERR:
- alert("File is not readable");
- break;
- case evt.target.error.ABORT_ERR:
- break; // noop
- default:
- alert("An error occurred reading this file.");
- }
- };
- reader.onabort = function (e) {
- alert("File read cancelled");
- };
- reader.onloadstart = function (e) {
- var output =
- '<ui type="disc"><li><strong>' +
- file.name +
- "</strong> (" +
- file.type +
- ")- " +
- file.size +
- "bytes, last modified: " +
- file.lastModifiedDate.toLocaleDateString() +
- "</li></ui>";
- component.set("v.filename", file.name);
- component.set("v.TargetFileName", output);
- };
- reader.onload = function (e) {
- var data = e.target.result;
-
- component.set("v.fileContentData", data);
- console.log("file data" + JSON.stringify(data));
- var allTextLines = data.split(/\r\n|\n/);
- console.log("qqqqqqqqqqqqqqqqqqq" + allTextLines);
- var dataRows = allTextLines.length - 1;
- var headers = allTextLines[0].split(",");
- var numOfRows = component.get("v.NumOfRecords");
- if (dataRows > numOfRows + 1 || dataRows == 1 || dataRows == 0) {
- alert("File Rows between 1 to " + numOfRows + " .");
- component.set("v.showMain", true);
- } else {
- var lines = [];
- var filecontentdata;
- var content =
- '<table class="table slds-table slds-table--bordered slds-table--cell-buffer">';
- content += '<thead><tr class="slds-text-title--caps">';
- content += '<th scope="col" style="width:100px">' + "琛屽彿" + "</th>";
- for (i = 0; i < headers.length; i++) {
- if (headers[i] == "浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺") {
- content +=
- '<th scope="col" style="width:250px">' + headers[i] + "</th>";
- } else {
- content +=
- '<th scope="col" style="width:200px">' + headers[i] + "</th>";
- }
- }
- content += "</tr></thead>";
- for (var i = 1; i < allTextLines.length; i++) {
- filecontentdata = allTextLines[i].split(",");
- if (filecontentdata[0] != "") {
- content += "<tr>";
- content += "<td>" + i + "</td>";
- for (var j = 0; j < filecontentdata.length; j++) {
- content += "<td>" + filecontentdata[j] + "</td>";
- }
- content += "</tr>";
- }
- }
- content += "</table>";
- console.log(content);
- component.set("v.TableContent", content);
- component.set("v.showMain", false);
- }
- };
- reader.readAsText(file, "gb2312");
- }
- var reader = new FileReader();
- reader.onloadend = function () {};
- reader.readAsDataURL(file);
- },
- // fy 璋冪敤pi鏀归�犵殑 鑾峰彇url 鍜� token鐨勬柟娉�
- search_contact_url: function (component, sobject, callback) {
- var action = component.get("c.getAwsurl");
- action.setParams({
- sobj: sobject
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var result = response.getReturnValue();
- if (callback) callback(result);
- } else {
- //component.set('v.errorMessage', 'AWS url/token error.');
- this.error("AWS url/token error.");
- //this.showErrorToast01(component);
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
- // fy 璋冪敤pi鏀归�犵殑 鑾峰彇.瀹㈡埛浜哄憳鐨勬柟娉�
- search_core: function (token, searchUrl, payload, callback, component) {
- console.log("searchUrl = " + searchUrl);
- fetch(searchUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- component.set("v.login", false);
- if (callback) callback(result);
- })
- .catch((error) => {
- console.log("AWS search error = " + JSON.stringify(error));
- // component.set('v.errorMessage', 'AWS search error.');
- this.error("AWS search error.");
- //this.showErrorToast01(component);
- component.set("v.login", false);
- });
- },
- saveRecords: function (component, event, helper) {
- //component.set('v.login', true);
- component.set("v.modal_import_spinner", true);
- //fy 瀵煎叆 202200506 start
- var action1 = component.get("c.processDataAWSId");
- action1.setParams({
- fileData: component.get("v.fileContentData")
- });
- action1.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var ress = response.getReturnValue();
- if (ress) {
- var valur = ress.split("error1");
- if (valur.length <= 1) {
- var res = JSON.parse(response.getReturnValue());
-
- var dataArr = new Array();
- var dataMap = new Map();
- res.forEach((item) => {
- if (item.AWS_Data_Id__c) {
- dataArr.push(item.AWS_Data_Id__c);
- //dataMap.set(item.AWS_Data_Id__c,item.Name_Encrypted__c); //zhj 鏂版柟妗堟敼閫� 2022-12-21
- dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c);
- }
+ },
+ //鍏朵粬鍝佺墝浜у搧绫诲埆 涓嬫媺妗嗚祴鍊�
+ selectProductCcategory: function (component) {
+ var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
+ if (select_ProductClassification != '') {
+ var action = component.get('c.selectProductCcategory');
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.find('select_ProductCcategory').set('v.options', JSON.parse(JSON.stringify(res)));
+ }
});
+ $A.enqueueAction(action);
+ } else {
+ component.find('select_ProductCcategory').set('v.options', []);
+ }
+ },
+ //鏍规嵁鍛ㄥ拰鎷呭綋鏌ヨ鏁版嵁缁欏垵濮嬮〉闈㈣祴鏁版嵁
+ get_reports: function (component, event, helper, date_str, person_str) {
+
+ if (!date_str) {
+ return false;
+ }
- let obj = Object.create(null);
- obj["dataIds"] = dataArr;
- var payload = JSON.stringify(obj);
- this.search_contact_url(
- component,
- "Agency_Contact__c",
- (result) => {
- var token = result.token;
- var searchUrl = result.searchUrl;
- console.log("token = " + token);
- console.log("searchUrl = " + searchUrl);
- console.log("payload = " + payload);
- this.search_core(
- token,
- searchUrl,
- payload,
- (result) => {
- console.log("result = " + JSON.stringify(result));
- if (result.status == "0") {
- if (result.object != null && result.object.length != 0) {
- //component.set('v.login', true);
- component.set("v.modal_import_spinner", true);
- this.saveRecordsEditFile(
- component,
- dataMap,
- result.object,
- helper
- );
- } else {
- //component.set('v.errorMessage', 'AWS 鏌ヨ鏁版嵁涓虹┖ ');
- this.error("AWS 鏌ヨ鏁版嵁涓虹┖ ");
+ if (person_str) {
+ var person_str2 = person_str.split(';');
+ if (person_str2.length > 1) {
+ person_str = person_str2[0];
+ }
+ }
+ date_str = this.get_date_string(date_str);
+ var action = component.get('c.getReports');
+ action.setParams({
+ "date_str": date_str,
+ "person_str": person_str,
+ });
+ component.set('v.loginEdit', true);
+ action.setCallback(this, function (response) {
+
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.set('v.reports', res.reports);
+ component.set('v.report_count', res.reports.length);
+ // 鏇存柊淇濆瓨寰屻伄select_data鐢�
+ var report_id = component.get('v.update_select_report_data_id');
+ if (report_id != "") {
+ for (var i = 0; i < res.reports.length; i++) {
+ if (res.reports[i]['Id'] == report_id) {
+ component.set('v.select_report_data', res.reports[i]);
+ break;
+ }
+ }
+ component.set('v.update_select_report_data_id', '');
+ }
+ if (res.reports.length > 0) {
+ component.set('v.list_message', '');
+ var flag2 = res.reports.length;
+ //fy 20220414 start
+ var report1 = [];
+ var report2 = [];
+ res.reports.forEach(item => {
+ if ((item.WorkRecord__c == '绉戝浼�' && item.doctor3__c != undefined) ||
+ ((item.doctor3__c == undefined || item.doctor3__c == '' || item.doctor3__c == "")
+ && (item.doctor2__r == undefined || item.doctor2__r == '' || item.doctor2__r == ""))) {
+ report1.push(item);
+ } else {
+ report2.push(item);
+ }
+ });
+ res.reports = report2;
+ //fy 20220414 end
+ // PI 鏀归�� By Bright 20220328
+ if (true) {
+ let doctor_awsids = res.reports.map(function (d) { return d.doctor2__r.AWS_Data_Id__c; });
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ if (doctor_awsids.length > 0) {
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: doctor_awsids
+ }, function (data) {
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res.reports) {
+ if (res.reports[ri] && res.reports[ri].doctor2__r && res.reports[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res.reports[ri].doctor2__r.AWS_Data_Id__c)) {
+ res.reports[ri].doctor2__r.awsdata = m[res.reports[ri].doctor2__r.AWS_Data_Id__c];
+ }
+ }
+ component.set('v.reports', res.reports);
+ component.set('v.report_count', res.reports.length);
+ }
+ //fy 20220414 start
+ var reports3 = component.get('v.reports');
+ if (reports3.length < flag2) {
+ res.reports = [...report1, ...reports3];
+ component.set('v.reports', res.reports);
+ component.set('v.report_count', res.reports.length);
+ }
+ //fy 20220414 end
+ component.set('v.loginEdit', false);
+ }, staticResourceAgencyContact.token);
+ } else {
+ component.set('v.loginEdit', false);
+ }
+ }
+ } else {
+ component.set('v.list_message', 'no_data');
+ component.set('v.loginEdit', false);
+ }
+
+ }
+ else {
+ //component.set('v.errorMessage', 'get_reports failed.');
+ this.error('get_reports failed.');
+ //this.showErrorToast(component);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ //澶嶅埗鎸夐挳鍙樼伆鑹�
+ select_date_change: function (component, event, helper) {
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
+ component.set('v.select_report_data_radio', '');
+ component.find('copy_button').set('v.disabled', true);
+ component.find('delete_button').set('v.disabled', true);
+ },
+
+ select_agency_change: function (component, event, helper) {
+ var select_value = component.find('select_agency_person').get('v.value');
+ var new_label = this.get_agency_person_name(component, select_value);
+ component.set('v.selected_agency_person', new_label);
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), select_value);
+ component.set('v.select_report_data_radio', '');
+ component.find('copy_button').set('v.disabled', true);
+ component.find('delete_button').set('v.disabled', true);
+ },
+
+ get_agency_person_name: function (component, agency_person_value) {
+ var allselectlist = component.get('v.allselectlist.AgencyPerson__c');
+ var new_label = '';
+ for (var i = 0; i < allselectlist.length; i++) {
+ if (agency_person_value == allselectlist[i].value) {
+ new_label = allselectlist[i].label;
+ break;
+ }
+ }
+ return new_label;
+ },
+ //澶嶅埗鍜岀紪杈戝洖鏄剧殑浣嶇疆
+ toggle_report: function (component) {
+
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ if ($A.util.hasClass(modal_window, 'disp_none')) {
+ // OPEN
+ $A.util.removeClass(modal_window, 'disp_none');
+ $A.util.removeClass(modal_bg, 'disp_none');
+ //澶嶅埗 鍜岀紪杈� 鍥炴樉闂鍦ㄨ繖閲岄潰
+ if (component.get('v.mode') == 'edit' || component.get('v.mode') == 'copy') {
+ var select_data = '';
+ if (component.get('v.mode') == 'edit') {
+ select_data = component.get('v.select_report_data');
+ } else if (component.get('v.mode') == 'copy') {
+ select_data = component.get('v.select_report_data_radio');
+ }
+ var reports = component.get('v.reports');
+ var Agency_Hospital_text = '';
+ var Agency_Hospital_parent_id = '';
+ // 鍖婚櫌鍚�
+ if (select_data['Agency_Hospital__c'] != '') {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['Agency_Hospital__c'] == select_data['Agency_Hospital__c']) {
+ Agency_Hospital_text = reports[i]['Agency_Hospital__r']['Name'];
+ Agency_Hospital_parent_id = reports[i]['Agency_Hospital__r']['Hospital__c'];
+ }
+ }
+ component.set('v.hospital', Agency_Hospital_text);
+ component.set('v.hospitalId', Agency_Hospital_parent_id);
+ component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']);
+ component.find('new_con').set('v.disabled', false);
+ }
+ //浣跨敤浜у搧1(浜у搧鍨嬪彿)
+ var UseProduct1Text = '';
+ var UseProduct1Id = '';
+ if (select_data['UseProduct1__c'] != '' && select_data['UseProduct1__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct1__c'] == select_data['UseProduct1__c']) {
+ UseProduct1Text = reports[i]['UseProduct1__r']['Asset_Model_No__c'];
+ UseProduct1Id = reports[i]['UseProduct1__c'];
+ }
+ }
+ component.set('v.UseProduct1', UseProduct1Text);
+ component.set('v.UseProduct1Id', select_data['UseProduct1__c']);
+ }
+ //浣跨敤浜у搧2
+ var UseProduct2Text = '';
+ var UseProduct2Id = '';
+ if (select_data['UseProduct2__c'] != '' && select_data['UseProduct2__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct2__c'] == select_data['UseProduct2__c']) {
+ UseProduct2Text = reports[i]['UseProduct2__r']['Asset_Model_No__c'];
+ UseProduct2Id = reports[i]['UseProduct2__c'];
+ }
+ }
+ component.set('v.UseProduct2', UseProduct2Text);
+ component.set('v.UseProduct2Id', select_data['UseProduct2__c']);
+ }
+ //浣跨敤浜у搧3
+ var UseProduct3Text = '';
+ var UseProduct3Id = '';
+ if (select_data['UseProduct3__c'] != '' && select_data['UseProduct3__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct3__c'] == select_data['UseProduct3__c']) {
+ UseProduct3Text = reports[i]['UseProduct3__r']['Asset_Model_No__c'];
+ UseProduct3Id = reports[i]['UseProduct3__c'];
+ }
+ }
+ component.set('v.UseProduct3', UseProduct3Text);
+ component.set('v.UseProduct3Id', select_data['UseProduct3__c']);
+ }
+ //娲诲姩鏃�
+ var reportDate;
+ if (select_data['Report_Date__c'] != '') {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['Report_Date__c'] == select_data['Report_Date__c']) {
+ reportDate = reports[i]["Report_Date__c"];
+ }
+ }
+ component.set('v.data.Report_Date__c', reportDate);
+ }
+ // 绉戝
+ // if (select_data['Department_Cateogy__c'] != '') {
+ // component.find('select_department').set('v.value',select_data['Department_Cateogy__c']);
+ // }
+ //fy Department_Cateogy_text__c
+ if (select_data['Department_Cateogy_text__c'] != '') {
+ component.find('select_department').set('v.value', select_data['Department_Cateogy_text__c']);
+ }
+ //缁忛攢鍟嗕汉鍛�
+ if (select_data['DealerPersonnel__c'] != '') {
+ this.set_selected(component, 'select_DealerPersonnel', select_data['DealerPersonnel__c']);
+ }
+ // 娲诲姩鍖哄垎
+ if (select_data['WorkRecord__c'] != '') {
+ this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']);
+ this.selectPurposeType(component);
+ }
+ // 鎷滆浜�
+ if (select_data['WorkRecord__c'] == '绉戝浼�') {
+ component.set('v.default_select_doctor_id2', select_data['doctor3__c']);
+ var a = component.get('v.default_select_doctor_id2');
+ this.set_doctor_list(component);
+ } else {
+ component.set('v.default_select_doctor_id', select_data['doctor2__c']);
+ this.set_doctor_list(component);
+ }
+ //浜у搧鍒嗙被(绗笁鍒嗙被)
+ if (select_data['ProductClassification__c'] != null) {
+ this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']);
+ this.selectProductClassification(component);
+ }
+ // 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺
+ if (select_data['ConsumptionOfConsumables__c'] != '') {
+ component.find('select_ConsumptionOfConsumables').set('v.value', select_data['ConsumptionOfConsumables__c']);
+ }
+ // 浜у搧鐢ㄩ噺
+ if (select_data['warlocksNumber__c'] != '') {
+ component.find('select_warlocksNumber').set('v.value', select_data['warlocksNumber__c']);
+ }
+ // 鏀彺闇�姹�
+ if (select_data['WorkMark__c'] != false) {
+ component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']);
+ }
+ ;
+
+ var report_id = component.get('v.edit_copy_select_report_id');
+ if (report_id != "") {
+ var select_EffectProgress1 = '';
+ var WarlockClassification = '';
+ var ProductCcategory = '';
+ var productCategories = '';
+ var i = 0;
+ for (i = 0; i < reports.length; i++) {
+ if (report_id == reports[i]["Id"]) {
+ select_EffectProgress1 = reports[i]["EffectProgress__c"];
+ WarlockClassification = reports[i]["WarlockClassification__c"];
+ ProductCcategory = reports[i]["ProductCcategory__c"];
+ productCategories = reports[i]["productCategories__c"];
+ break;
+ }
+ }
+ //鏁堟灉/杩涘害
+ if (select_EffectProgress1 != null && select_EffectProgress1 != '') {
+ component.find('select_EffectProgress').set('v.value', select_EffectProgress1);
+ }
+ //鏈+鍒嗙被
+ if (WarlockClassification != null && WarlockClassification != '') {
+ component.find('select_OtherBrandConsumables').set('v.value', WarlockClassification);
+ }
+ //宸查噰鐢ㄥ叾浠栧搧鐗�
+ if (ProductCcategory != null && ProductCcategory != '') {
+ component.find('select_ProductCcategory').set('v.value', ProductCcategory);
+ this.selectpurposetype(component);
+ }
+ //鍏朵粬鍝佺墝浜у搧绫诲埆
+ if (productCategories != null && productCategories != '') {
+ component.find('select_productCategories').set('v.value', productCategories);
+ }
+ component.set('v.edit_copy_select_report_id', "");
+ }
+ }
+ } else {
+ var select_report_data = component.get('v.select_report_data');
+ var Report_Date__c = component.get('v.data.Report_Date__c');
+ var Agency_Hospital__c = component.get('v.hospitalLinkId');
+ var UseProduct1__c = component.get('v.UseProduct1Id');
+ var UseProduct2__c = component.get('v.UseProduct2Id');
+ var UseProduct3__c = component.get('v.UseProduct3Id');
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value');
+ var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value');
+ var doctor2__c = component.find('select_doctor').get('v.value');
+ var WorkRecord__c = component.find('select_purpose_type').get('v.value');
+ var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
+ var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
+ var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
+ var productCategories__c = component.find('select_productCategories').get('v.value');
+ var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value');
+ var WorkMark__c = component.find('select_WorkMark').get('v.checked');
+ if (component.get('v.mode') == 'new') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鏃ユ姤锛�';
+ if (!Report_Date__c &&
+ !Agency_Hospital__c &&
+ !UseProduct1__c &&
+ !UseProduct2__c &&
+ !UseProduct3__c &&
+ !Department_Cateogy__c &&
+ !ConsumptionOfConsumables__c &&
+ !DealerPersonnel__c &&
+ !doctor2__c &&
+ !EffectProgress__c &&
+ !WarlockClassification__c &&
+ !ProductCcategory__c &&
+ !productCategories__c &&
+ !warlocksNumber__c &&
+ !WorkMark__c &&
+ !WorkRecord__c
+ ) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ this.close_confirm(component, confirm_title, confirm_text);
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'copy') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鏃ユ姤锛�';
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['UseProduct1__c'] == UseProduct1__c &&
+ select_report_data['UseProduct2__c'] == UseProduct2__c &&
+ select_report_data['UseProduct3__c'] == UseProduct3__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
+ select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['EffectProgress__c'] == EffectProgress__c &&
+ select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
+ select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
+ select_report_data['productCategories__c'] == productCategories__c &&
+ select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
+ select_report_data['WorkMark__c'] == WorkMark__c &&
+ select_report_data['WorkRecord__c'] == WorkRecord__c) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'edit') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純缂栬緫鏃ユ姤锛�';
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['UseProduct1__c'] == UseProduct1__c &&
+ select_report_data['UseProduct2__c'] == UseProduct2__c &&
+ select_report_data['UseProduct3__c'] == UseProduct3__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
+ select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['EffectProgress__c'] == EffectProgress__c &&
+ select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
+ select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
+ select_report_data['productCategories__c'] == productCategories__c &&
+ select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
+ select_report_data['WorkMark__c'] == WorkMark__c &&
+ select_report_data['WorkRecord__c'] == WorkRecord__c) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ }
+ }
+ },
+ toggle_report_edit: function (component) {
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ if ($A.util.hasClass(modal_window, 'disp_none')) {
+ // OPEN
+ $A.util.removeClass(modal_window, 'disp_none');
+ $A.util.removeClass(modal_bg, 'disp_none');
+ component.set('v.loginEdit',true);
+ //澶嶅埗 鍜岀紪杈� 鍥炴樉闂鍦ㄨ繖閲岄潰
+ if (component.get('v.mode') == 'edit' || component.get('v.mode') == 'copy') {
+ var select_data = '';
+ if (component.get('v.mode') == 'edit') {
+ select_data = component.get('v.select_report_data');
+ } else if (component.get('v.mode') == 'copy') {
+ select_data = component.get('v.select_report_data_radio');
+ }
+ var reports = component.get('v.reports');
+ var Agency_Hospital_text = '';
+ var Agency_Hospital_parent_id = '';
+ // 鍖婚櫌鍚�
+ if (select_data['Agency_Hospital__c'] != '') {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['Agency_Hospital__c'] == select_data['Agency_Hospital__c']) {
+ Agency_Hospital_text = reports[i]['Agency_Hospital__r']['Name'];
+ Agency_Hospital_parent_id = reports[i]['Agency_Hospital__r']['Hospital__c'];
+ }
+ }
+ component.set('v.hospital', Agency_Hospital_text);
+ component.set('v.hospitalId', Agency_Hospital_parent_id);
+ component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']);
+ component.find('new_con').set('v.disabled', false);
+ }
+ //浣跨敤浜у搧1(浜у搧鍨嬪彿)
+ var UseProduct1Text = '';
+ var UseProduct1Id = '';
+ if (select_data['UseProduct1__c'] != '' && select_data['UseProduct1__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct1__c'] == select_data['UseProduct1__c']) {
+ UseProduct1Text = reports[i]['UseProduct1__r']['Asset_Model_No__c'];
+ UseProduct1Id = reports[i]['UseProduct1__c'];
+ }
+ }
+ component.set('v.UseProduct1', UseProduct1Text);
+ component.set('v.UseProduct1Id', select_data['UseProduct1__c']);
+ }
+ //浣跨敤浜у搧2
+ var UseProduct2Text = '';
+ var UseProduct2Id = '';
+ if (select_data['UseProduct2__c'] != '' && select_data['UseProduct2__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct2__c'] == select_data['UseProduct2__c']) {
+ UseProduct2Text = reports[i]['UseProduct2__r']['Asset_Model_No__c'];
+ UseProduct2Id = reports[i]['UseProduct2__c'];
+ }
+ }
+ component.set('v.UseProduct2', UseProduct2Text);
+ component.set('v.UseProduct2Id', select_data['UseProduct2__c']);
+ }
+ //浣跨敤浜у搧3
+ var UseProduct3Text = '';
+ var UseProduct3Id = '';
+ if (select_data['UseProduct3__c'] != '' && select_data['UseProduct3__c'] != undefined) {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['UseProduct3__c'] == select_data['UseProduct3__c']) {
+ UseProduct3Text = reports[i]['UseProduct3__r']['Asset_Model_No__c'];
+ UseProduct3Id = reports[i]['UseProduct3__c'];
+ }
+ }
+ component.set('v.UseProduct3', UseProduct3Text);
+ component.set('v.UseProduct3Id', select_data['UseProduct3__c']);
+ }
+ //娲诲姩鏃�
+ var reportDate;
+ if (select_data['Report_Date__c'] != '') {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['Report_Date__c'] == select_data['Report_Date__c']) {
+ reportDate = reports[i]["Report_Date__c"];
+ }
+ }
+ component.set('v.data.Report_Date__c', reportDate);
+ }
+ // 绉戝
+ // if (select_data['Department_Cateogy__c'] != '') {
+ // component.find('select_department').set('v.value',select_data['Department_Cateogy__c']);
+ // }
+ //fy Department_Cateogy_text__c
+ if (select_data['Department_Cateogy_text__c'] != '') {
+ component.find('select_department').set('v.value', select_data['Department_Cateogy_text__c']);
+ }
+ //缁忛攢鍟嗕汉鍛�
+ if (select_data['DealerPersonnel__c'] != '') {
+ this.set_selected(component, 'select_DealerPersonnel', select_data['DealerPersonnel__c']);
+ }
+ // 娲诲姩鍖哄垎
+ if (select_data['WorkRecord__c'] != '') {
+ this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']);
+ this.selectPurposeType(component);
+ }
+ // 鎷滆浜�
+ if (select_data['WorkRecord__c'] == '绉戝浼�') {
+ component.set('v.default_select_doctor_id2', select_data['doctor3__c']);
+ var a = component.get('v.default_select_doctor_id2');
+ this.set_doctor_list_edit(component);
+ } else {
+ component.set('v.default_select_doctor_id', select_data['doctor2__c']);
+ this.set_doctor_list_edit(component);
+ }
+ //浜у搧鍒嗙被(绗笁鍒嗙被)
+ if (select_data['ProductClassification__c'] != null) {
+ this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']);
+ this.selectProductClassification(component);
+ }
+ // 浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺
+ if (select_data['ConsumptionOfConsumables__c'] != '') {
+ component.find('select_ConsumptionOfConsumables').set('v.value', select_data['ConsumptionOfConsumables__c']);
+ }
+ // 浜у搧鐢ㄩ噺
+ if (select_data['warlocksNumber__c'] != '') {
+ component.find('select_warlocksNumber').set('v.value', select_data['warlocksNumber__c']);
+ }
+ // 鏀彺闇�姹�
+ if (select_data['WorkMark__c'] != false) {
+ component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']);
+ }
+ ;
+
+ var report_id = component.get('v.edit_copy_select_report_id');
+ if (report_id != "") {
+ var select_EffectProgress1 = '';
+ var WarlockClassification = '';
+ var ProductCcategory = '';
+ var productCategories = '';
+ var i = 0;
+ for (i = 0; i < reports.length; i++) {
+ if (report_id == reports[i]["Id"]) {
+ select_EffectProgress1 = reports[i]["EffectProgress__c"];
+ WarlockClassification = reports[i]["WarlockClassification__c"];
+ ProductCcategory = reports[i]["ProductCcategory__c"];
+ productCategories = reports[i]["productCategories__c"];
+ break;
+ }
+ }
+ //鏁堟灉/杩涘害
+ if (select_EffectProgress1 != null && select_EffectProgress1 != '') {
+ component.find('select_EffectProgress').set('v.value', select_EffectProgress1);
+ }
+ //鏈+鍒嗙被
+ if (WarlockClassification != null && WarlockClassification != '') {
+ component.find('select_OtherBrandConsumables').set('v.value', WarlockClassification);
+ }
+ //宸查噰鐢ㄥ叾浠栧搧鐗�
+ if (ProductCcategory != null && ProductCcategory != '') {
+ component.find('select_ProductCcategory').set('v.value', ProductCcategory);
+ this.selectpurposetype(component);
+ }
+ //鍏朵粬鍝佺墝浜у搧绫诲埆
+ if (productCategories != null && productCategories != '') {
+ component.find('select_productCategories').set('v.value', productCategories);
+ }
+ component.set('v.edit_copy_select_report_id', "");
+ }
+
+ }
+ } else {
+ var select_report_data = component.get('v.select_report_data');
+ var Report_Date__c = component.get('v.data.Report_Date__c');
+ var Agency_Hospital__c = component.get('v.hospitalLinkId');
+ var UseProduct1__c = component.get('v.UseProduct1Id');
+ var UseProduct2__c = component.get('v.UseProduct2Id');
+ var UseProduct3__c = component.get('v.UseProduct3Id');
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value');
+ var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value');
+ var doctor2__c = component.find('select_doctor').get('v.value');
+ var WorkRecord__c = component.find('select_purpose_type').get('v.value');
+ var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
+ var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
+ var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
+ var productCategories__c = component.find('select_productCategories').get('v.value');
+ var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value');
+ var WorkMark__c = component.find('select_WorkMark').get('v.checked');
+ if (component.get('v.mode') == 'new') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鏃ユ姤锛�';
+ if (!Report_Date__c &&
+ !Agency_Hospital__c &&
+ !UseProduct1__c &&
+ !UseProduct2__c &&
+ !UseProduct3__c &&
+ !Department_Cateogy__c &&
+ !ConsumptionOfConsumables__c &&
+ !DealerPersonnel__c &&
+ !doctor2__c &&
+ !EffectProgress__c &&
+ !WarlockClassification__c &&
+ !ProductCcategory__c &&
+ !productCategories__c &&
+ !warlocksNumber__c &&
+ !WorkMark__c &&
+ !WorkRecord__c
+ ) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ this.close_confirm(component, confirm_title, confirm_text);
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'copy') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鏃ユ姤锛�';
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['UseProduct1__c'] == UseProduct1__c &&
+ select_report_data['UseProduct2__c'] == UseProduct2__c &&
+ select_report_data['UseProduct3__c'] == UseProduct3__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
+ select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['EffectProgress__c'] == EffectProgress__c &&
+ select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
+ select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
+ select_report_data['productCategories__c'] == productCategories__c &&
+ select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
+ select_report_data['WorkMark__c'] == WorkMark__c &&
+ select_report_data['WorkRecord__c'] == WorkRecord__c) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'edit') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純缂栬緫鏃ユ姤锛�';
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['UseProduct1__c'] == UseProduct1__c &&
+ select_report_data['UseProduct2__c'] == UseProduct2__c &&
+ select_report_data['UseProduct3__c'] == UseProduct3__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
+ select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['EffectProgress__c'] == EffectProgress__c &&
+ select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
+ select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
+ select_report_data['productCategories__c'] == productCategories__c &&
+ select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
+ select_report_data['WorkMark__c'] == WorkMark__c &&
+ select_report_data['WorkRecord__c'] == WorkRecord__c) {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ }
+
+ }
+ //component.set('v.loginEdit',false);
+ },
+ //鍏抽棴椤甸潰鏄� 灏忕殑鎻愮ず妗嗘槸鍚︽斁寮冩柊寤烘棩鎶�
+ close_confirm: function (component, title, text) {
+ var confirm_status = component.get('v.confirm_status');
+ component.set('v.modal_confirm_title', title);
+ component.set('v.modal_confirm_text', text);
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ var modal_confirm = component.find('modal_confirm');
+ var modal_confirm_bg = component.find('modal_confirm_bg');
+
+ if (confirm_status == 0) {
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ $A.util.removeClass(modal_confirm, 'disp_none');
+ $A.util.removeClass(modal_confirm_bg, 'disp_none');
+ } else if (confirm_status == 1) {
+ // 鏄�
+ $A.util.addClass(modal_confirm, 'disp_none');
+ $A.util.addClass(modal_confirm_bg, 'disp_none');
+ component.set('v.mode', '');
+ this.allclear(component);
+ component.set('v.reports_now', "");
+ component.set('v.reports_now_count', 0);
+ component.set('v.confirm_status', 0);
+ } else if (confirm_status == 2) {
+ // 鍚�
+ $A.util.removeClass(modal_window, 'disp_none');
+ $A.util.removeClass(modal_bg, 'disp_none');
+ $A.util.addClass(modal_confirm, 'disp_none');
+ $A.util.addClass(modal_confirm_bg, 'disp_none');
+ component.set('v.confirm_status', 0);
+ }
+ },
+ //鏂板缓鎸夐挳
+ new_report: function (component, event, helper) {
+
+ component.set('v.mode', 'new');
+ component.set('v.dialog_type', '鏂板缓');
+ // 鍛�
+ var select_date = component.find('select_date').get('v.value');
+ // 鎷呭綋
+ var select_agency = component.find('select_agency_person').get('v.value');
+ var cm = 0;
+ if (select_agency.indexOf(";") != -1) {
+ select_agency = select_agency.split(";")[0];
+ }
+ component.set('v.selected_date', select_date);
+ // 鎷呭綋
+ var name = component.get('v.selected_agency_person');
+ var ret = this.create_report_header(component, event, helper, name, select_agency, select_date);
+ component.set('v.default_select_doctor_id2', '');
+
+ // SWAG-CF58C3 fy start
+ this.set_aws_url(component, 'Agency_Contact__c')
+ // SWAG-CF58C3 fy end
+ },
+ // 澶嶅埗鎸夐挳
+ copy_button: function (component, event, helper) {
+
+ this.allclear(component);
+ component.set('v.mode', 'copy');
+ component.set('v.dialog_type', '鏂板缓');
+ var select_report_data = component.get('v.select_report_data_radio');
+ component.set('v.loadOpp', true);
+ // 閫�
+ var now = new Date();
+ var start_day = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() + 1));
+ var select_date = start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate();
+ this.set_selected(component, 'select_date', select_date);
+ component.set('v.selected_date', select_date);
+ // 鎷呭綋
+ var select_agency = select_report_data['Person_In_Charge2__c'];
+ var new_label = this.get_agency_person_name(component, select_agency);
+ component.set('v.selected_agency_person', new_label);
+ this.set_selected(component, 'select_agency_person', select_agency);
+ var name = component.get('v.selected_agency_person');
+ component.set('v.edit_copy_select_report_id', select_report_data['Id']);
+ component.set('v.select_report_data', select_report_data);
+
+ var ret = this.create_report_header(component, event, helper, name, select_agency, select_date);
+ // SWAG-CF58C3 fy start
+ this.set_aws_url(component, 'Agency_Contact__c')
+ // SWAG-CF58C3 fy end
+
+ },
+ //鍒犻櫎鎸夐挳
+ delete_button: function (component, event, helper) {
+
+ var select_report_data = component.get('v.select_report_data_radio');
+ if (confirm('鏄惁鍒犻櫎璇ユ暟鎹紵')) {
+
+ component.set('v.login', true);
+ var action = component.get('c.deleteAgencyReport');
+ action.setParams({
+ "agencyReport_id": select_report_data.Id,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var result = response.getReturnValue();
+ if (result == 'success') {
+ this.select_agency_change(component, event, helper);
+ }
+ component.set('v.login', false);
+ } else {
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+ },
+ //澶嶅埗鎸夐挳鍙敤
+ change_report_radio: function (component, event, helper) {
+
+ var reports = component.get('v.reports');
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i].Name == event.getSource().get('v.label')) {
+ component.set('v.select_report_data_radio', reports[i]);
+ component.find('copy_button').set('v.disabled', false);
+ component.find('delete_button').set('v.disabled', false);
+ break;
+ }
+ }
+ },
+ //缂栬緫鎸夐挳
+ edit_button: function (component, event, helper) {
+ component.set('v.login', true);
+ debugger
+ //component.set('v.loginEdit', true);
+ this.allclear(component);
+ //component.set('v.loadOpp', true);
+ var index = event.getSource().get('v.value');
+ component.set('v.select_report_data', component.get('v.reports')[index]);
+ component.set('v.mode', 'edit');
+ component.set('v.dialog_type', '缂栬緫');
+ var select_date = component.get('v.reports')[index].Submit_date__c;
+ var select_agency = component.get('v.reports')[index].Person_In_Charge2__c;
+ var text_tmp = select_date.split('-');
+ var select_date_text = text_tmp[0] + '/' + Number(text_tmp[1]) + '/' + Number(text_tmp[2]);
+ component.set('v.selected_date', select_date_text);
+ var name = component.get('v.reports')[index].Person_In_Charge2__r.Name;
+ this.set_selected(component, 'select_agency_person', select_agency);
+ var new_label = this.get_agency_person_name(component, select_agency);
+ component.set('v.selected_agency_person', new_label);
+ component.set('v.edit_copy_select_report_id', component.get('v.reports')[index].Id);
+ var ret = this.create_report_header_edit(component, event, helper, name, select_agency, select_date);
+ // SWAG-CF58C3 fy start
+ this.set_aws_url(component, 'Agency_Contact__c')
+ //component.set('v.login', false);
+ // SWAG-CF58C3 fy end
+ },
+ //淇濆瓨
+ save_report: function (component, event, helper) {
+ var UserProType = component.get('v.UserProType');
+ component.find('save_button').set('v.disabled', true);
+ var etEng = component.get('v.etEng');
+ var Report_Date__c = component.get('v.data.Report_Date__c');
+ var Person_In_Charge2__c = "";
+ var Submit_date__c = "";
+ if (component.get('v.mode') == 'edit') {
+ // 鍛� Submit_date__c
+ Submit_date__c = component.get('v.select_report_data').Submit_date__c;
+ // 鎷呭綋 Person_In_Charge2__c
+ Person_In_Charge2__c = component.get('v.select_report_data').Person_In_Charge2__c;
+ } else {
+ // 鍛� Submit_date__c
+ Submit_date__c = this.get_date_string(component.find('select_date').get('v.value'));
+ // 鎷呭綋 Person_In_Charge2__c
+ Person_In_Charge2__c = component.find('select_agency_person').get('v.value');
+ }
+
+ // Agency_Report_Header__c
+ var Agency_Report_Header__c = component.get('v.agency_report_header_id');
+ // 鍖婚櫌
+ var Agency_Hospital__c = component.get('v.hospitalLinkId');
+ // 浜у搧鍒嗙被(绗笁鍒嗙被)
+ var ProductClassification__c = component.find('select_ProductClassification').get('v.value');
+ // 浣跨敤浜у搧1(浜у搧鍨嬪彿) UseProduct1__c
+ var UseProduct1__c = component.get('v.UseProduct1Id');
+ // 浣跨敤浜у搧2 UseProduct2__c
+ var UseProduct2__c = component.get('v.UseProduct2Id');
+ // 浣跨敤浜у搧3 UseProduct3__c
+ var UseProduct3__c = component.get('v.UseProduct3Id');
+ // 绉戝 Department_Cateogy__c
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ // 缁忛攢鍟嗕汉鍛� DealerPersonnel__c
+ var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value');
+ // 鎷滆浜� doctor2__c
+ var doctor2__c = component.find('select_doctor').get('v.value');
+ // 娲诲姩鍖哄垎浼� WorkRecord__c
+ var WorkRecord__c = component.find('select_purpose_type').get('v.value');
+ // 鏁堟灉/杩涘害 EffectProgress__c
+ var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
+ // alert(EffectProgress__c);
+ // 绉戝鍚屾潵鑰楁潗鏈堜娇鐢ㄩ噺 ConsumptionOfConsumables__c
+ var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value');
+ // 鏈+鍒嗙被 WarlockClassification__c
+ var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
+ // 宸查噰鐢ㄥ叾浠栧搧鐗� ProductCcategory__c
+ var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
+ // 鍏朵粬鍝佺墝浜у搧绫诲埆 productCategories__c
+ var productCategories__c = component.find('select_productCategories').get('v.value');
+ // 浜у搧鐢ㄩ噺 warlocksNumber__c
+ var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value');
+ // 鏀彺闇�姹� WorkMark__c
+ var WorkMark__c = component.find('select_WorkMark').get('v.checked');
+ var StageName__c = component.find('select_stageName').get('v.value');
+ var Amount__c = component.get('v.oppdata.Amount__c') != null ? component.get('v.oppdata.Amount__c').toString() : '';
+ var OCMSale_Price__c = component.get('v.oppdata.OCMSale_Price__c') != null ? component.get('v.oppdata.OCMSale_Price__c').toString() : '';
+ var Close_Forecasted_Date__c = component.get('v.oppdata.Close_Forecasted_Date__c');
+ var StageName__c_o = component.get('v.StageName__c_o');
+ var Amount__c_o = component.get('v.Amount__c_o');
+ var OCMSale_Price__c_o = component.get('v.OCMSale_Price__c_o');
+ var Close_Forecasted_Date__c_o = component.get('v.Close_Forecasted_Date__c_o');
+ if (StageName__c_o == undefined) StageName__c_o = '';
+ if (Amount__c_o == undefined) Amount__c_o = '';
+ if (OCMSale_Price__c_o == undefined) OCMSale_Price__c_o = '';
+ if (Close_Forecasted_Date__c_o == undefined) Close_Forecasted_Date__c_o = '';
+ if (StageName__c == StageName__c_o && OCMSale_Price__c_o == OCMSale_Price__c && Amount__c == Amount__c_o && Close_Forecasted_Date__c == Close_Forecasted_Date__c_o) {
+ StageName__c = '';
+ Amount__c = '';
+ OCMSale_Price__c = '';
+ Close_Forecasted_Date__c = '';
+ }
+ // 銉愩儶銉囥兗銈枫儳銉�
+ var error = [];
+ //fy start
+ // if(WorkRecord__c != 'SIS'&&WorkRecord__c != '绉戝浼�'){
+ if (WorkRecord__c == '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦') {
+ if (warlocksNumber__c == '' || warlocksNumber__c == "" || warlocksNumber__c == undefined) { error.push("浜у搧鐢ㄩ噺 涓嶈兘涓虹┖"); }
+ }
+ //fy end
+ if (WorkRecord__c == '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦' && UserProType == 'ENG') {
+ if (productCategories__c == '' || productCategories__c == "" || productCategories__c == undefined) { error.push("鍏朵粬鍝佺墝浜у搧绫诲埆 涓嶅瓨鍦�"); }
+ }
+ if (WorkRecord__c == '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦') {
+ if (ProductCcategory__c == '' || ProductCcategory__c == "" || ProductCcategory__c == undefined) { error.push("宸查噰鐢ㄥ叾浠栧搧鐗� 涓嶅瓨鍦�"); }
+ }
+ if (WorkRecord__c == '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦') {
+ if (WarlockClassification__c == '' || WarlockClassification__c == "" || WarlockClassification__c == undefined) { error.push("浜у搧1瀵瑰簲OLY浜у搧绾� 涓嶅瓨鍦�"); }
+ }
+ if (WorkRecord__c == '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦') {
+ if (ConsumptionOfConsumables__c == '' || ConsumptionOfConsumables__c == "" || ConsumptionOfConsumables__c == undefined) { error.push("浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺 涓嶈兘涓虹┖"); }
+ }
+ if (WorkRecord__c != '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦' && WorkRecord__c != '甯傚満鎺ㄥ箍绫绘椿鍔�') {
+ if (EffectProgress__c == '' || EffectProgress__c == "" || EffectProgress__c == undefined) { error.push("鏁堟灉/杩涘害 涓嶅瓨鍦�"); }
+ }
+ // if(WorkRecord__c != '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦'&&WorkRecord__c != 'QIS澶勭悊'){
+ if (WorkRecord__c != '涓村簥淇℃伅(浣跨敤閲�)鏀堕泦') {
+ if (UseProduct1__c == '' || UseProduct1__c == "" || UseProduct1__c == undefined) { error.push("浣跨敤浜у搧1(浜у搧鍨嬪彿) 涓嶅瓨鍦�"); }
+ }
+ if (ProductClassification__c == '' || ProductClassification__c == "" || ProductClassification__c == undefined) { error.push("浜у搧鍒嗙被(绗笁鍒嗙被) 涓嶅瓨鍦�"); }
+ if (WorkRecord__c == 'SIS' || WorkRecord__c == '绉戝浼�' || WorkRecord__c == '闄㈠唴鍏ラ櫌鐢宠' || WorkRecord__c == '鏀惰垂椤圭洰鐢宠') {
+ if (doctor2__c == '' || doctor2__c == "" || doctor2__c == undefined) { error.push("鎷滆浜� 涓嶅瓨鍦�"); }
+ }
+ if (WorkRecord__c == '' || WorkRecord__c == "" || WorkRecord__c == undefined) { error.push("娲诲姩鍖哄垎 涓嶅瓨鍦�"); }
+ if (DealerPersonnel__c == '' || DealerPersonnel__c == "" || DealerPersonnel__c == undefined) { error.push("缁忛攢鍟嗕汉鍛� 涓嶅瓨鍦�"); }
+ if (Department_Cateogy__c == '' || Department_Cateogy__c == "" || Department_Cateogy__c == undefined) { error.push("绉戝 涓嶅瓨鍦�"); }
+ if (Agency_Hospital__c == '' || Agency_Hospital__c == "" || Agency_Hospital__c == undefined) { error.push("鍖婚櫌 涓嶅瓨鍦�"); }
+
+
+
+
+ if (Report_Date__c == '' || Report_Date__c == "" || Report_Date__c == undefined) { error.push("娲诲姩鏃� 涓嶅瓨鍦�"); }
+ if (Submit_date__c == '' || Submit_date__c == "" || Submit_date__c == undefined) { error.push("鍛� 涓嶅瓨鍦�"); }
+ var rDate = new Date(Report_Date__c);
+ var sDate = new Date(Submit_date__c);
+ sDate.setDate(sDate.getDate() - 1);
+ if (rDate < sDate) { error.push('娲诲姩鏃ュ繀椤绘槸鏈懆锛�'); }
+ sDate.setDate(sDate.getDate() + 7);
+ if (rDate >= sDate) { error.push('娲诲姩鏃ュ繀椤绘槸鏈懆锛�'); }
+ if (Person_In_Charge2__c == '' || Person_In_Charge2__c == "" || Person_In_Charge2__c == undefined) { error.push("鎷呭綋 涓嶅瓨鍦�"); }
+ if (Agency_Report_Header__c == '' || Agency_Report_Header__c == "" || Agency_Report_Header__c == undefined) { this.error("Report Header Id 涓嶅瓨鍦�"); }
+
+
+ // if (!UseProduct2__c) { error.push("浣跨敤浜у搧2 涓嶅瓨鍦�"); }
+ // if (!UseProduct3__c) { error.push("浣跨敤浜у搧3 涓嶅瓨鍦�"); }
+
+
+
+
+
+
+
+
+ // if (!productCategories__c) { error.push("鍏朵粬鍝佺墝浜у搧绫诲埆 涓嶅瓨鍦�"); }
+
+ //let errorMsg = '';
+ for (var i = 0; i < error.length; i++) {
+ component.set('v.errorMessage', error[i]);
+ this.showErrorToast(component);
+ //errorMsg += '; ' + error[i]
+ //this.error(error[i]);
+ }
+ // if(errorMsg != '')
+ // this.error(errorMsg.substring(1));
+ if (error.length > 0) {
+ component.find('save_button').set('v.disabled', false);
+ return false;
+ }
+ // 淇濆瓨鍑︾悊
+ 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');
+ action.setParams({
+ "Agency_Report_Id": Agency_Report__c,
+ "Department_Cateogy": Department_Cateogy__c,
+ "ConsumptionOfConsumables": ConsumptionOfConsumables__c,
+ "WorkRecord": WorkRecord__c,
+ "EffectProgress": EffectProgress__c,
+ "WarlockClassification": WarlockClassification__c,
+ "ProductCcategory": ProductCcategory__c,
+ "productCategories": productCategories__c,
+ "warlocksNumber": warlocksNumber__c,
+ "WorkMark": WorkMark__c,
+ "ProductClassification": ProductClassification__c,
+ "DealerPersonnel": DealerPersonnel__c,
+ "Agency_Report_Header": Agency_Report_Header__c,
+ "Agency_Hospital": Agency_Hospital__c,
+ "UseProduct1": UseProduct1__c,
+ "UseProduct2": UseProduct2__c,
+ "UseProduct3": UseProduct3__c,
+ "Person_In_Charge2": Person_In_Charge2__c,
+ "doctor": doctor2__c,
+ "Submit_date": Submit_date__c,
+ "StageName": StageName__c,
+ "oppAmount": Amount__c,
+ "oppOCMPrice": OCMSale_Price__c,
+ "Close_Forecasted_Date": Close_Forecasted_Date__c,
+ "Report_Date": Report_Date__c
+ });
+ 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();
+ component.set('v.create_agency_report_id', report_id);
+ var select_agency_list = component.get('v.allselectlist').AgencyPerson__c;
+ for (var i = 0; i < select_agency_list.length; i++) {
+ if (select_agency_list[i].value == component.get('v.select_report_data').Person_In_Charge2__c) {
+ select_agency_list[i].selected = true;
+ } else {
+ select_agency_list[i].selected = false;
+ }
+ }
+ component.find('select_agency_person').set('v.options', select_agency_list);
+ 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.loginEdit', false);
+ }
+ else {
+ //component.set('v.errorMessage', 'save_report failed.');
+ this.error('淇濆瓨鏃ユ姤澶辫触');
+ //this.showErrorToast(component);
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ } else {
+ /* Save (New & Copy) */
+ var action = component.get('c.saveAgencyReport');
+ action.setParams({
+ "Department_Cateogy": Department_Cateogy__c,
+ "ConsumptionOfConsumables": ConsumptionOfConsumables__c,
+ "WorkMark": WorkMark__c,
+ "warlocksNumber": warlocksNumber__c,
+ "DealerPersonnel": DealerPersonnel__c,
+ "ProductCcategory": ProductCcategory__c,
+ "productCategories": productCategories__c,
+ "WarlockClassification": WarlockClassification__c,
+ "ProductClassification": ProductClassification__c,
+ "WorkRecord": WorkRecord__c,
+ "EffectProgress": EffectProgress__c,
+ "Agency_Report_Header": Agency_Report_Header__c,
+ "Agency_Hospital": Agency_Hospital__c,
+ "Person_In_Charge2": Person_In_Charge2__c,
+ "doctor": doctor2__c,
+ "Submit_date": Submit_date__c,
+ "UseProduct1": UseProduct1__c,
+ "UseProduct2": UseProduct2__c,
+ "UseProduct3": UseProduct3__c,
+ "StageName": StageName__c,
+ "oppAmount": Amount__c,
+ "oppOCMPrice": OCMSale_Price__c,
+ "Close_Forecasted_Date": Close_Forecasted_Date__c,
+ "Report_Date": Report_Date__c
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ component.set('v.successMessage', '淇濆瓨鎴愬姛');
+ this.showSuccessToast(component);
+ var report_id = response.getReturnValue();
+ component.set('v.create_agency_report_id', report_id);
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
+ // 銉€兗銉�銉偊銈c兂銉夈偊鍐呫伄涓�瑕х敤
+ var action2 = component.get('c.getReportsById');
+ action2.setParams({
+ "report_id": report_id,
+ });
+ action2.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ var reports_now = component.get('v.reports_now');
+ var reports_now_count = 0;
+ if (reports_now.length > 0 && reports_now != "") {
+ reports_now_count = reports_now.length;
+ }
+ // Save&New鏅傘伄銈︺偅銉炽儔銈﹀唴銉囥兗銈夸竴瑕�
+ if (res.length > 0) {
+ reports_now[reports_now_count] = res[0];
+ reports_now.sort(function (a, b) {
+ if (a.Name > b.Name) return -1;
+ if (a.Name < b.Name) return 1;
+ return 0;
+ });
+ component.set('v.reports_now', reports_now);
+ component.set('v.reports_now_count', reports_now.length);
+ var data_list = component.find('modal_data_list_tr');
+ }
+ }
+ else {
+ // component.set('v.errorMessage', 'get_reports_now failed.');
+ this.error('get_reports_now failed.');
+ //this.showErrorToast(component);
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.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.loginEdit', false);
+ debugger
+ this.doinitSave(component, event, helper);
+ }
+ else {
+ var error = response.getError();
+ //component.set('v.errorMessage', '淇濆瓨鏃ユ姤澶辫触');
+ this.error('淇濆瓨鏃ユ姤澶辫触');
+ //this.showErrorToast(component);
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+ },
+
+ allclear: function (component) {
+ var clear = [{ label: '', value: '', selected: true }];
+ component.set('v.hospital', '');
+ component.set('v.hospitalId', '');
+ component.set('v.hospitalLinkId', '');
+ component.set('v.UseProduct1', '');
+ component.set('v.UseProduct1Id', '');
+ component.set('v.UseProduct2', '');
+ component.set('v.UseProduct2Id', '');
+ component.set('v.UseProduct3', '');
+ component.set('v.UseProduct3Id', '');
+ component.find('select_ProductClassification').set('v.value', '');
+ component.find('select_warlocksNumber').set('v.value', null);
+ component.find('select_department').set('v.value', '');
+ component.find('select_ConsumptionOfConsumables').set('v.value', null);
+ component.find('select_WorkMark').set('v.checked', false);
+ component.find('new_con').set('v.disabled', true);
+ component.find('select_doctor').set('v.options', clear);
+ component.find('select_DealerPersonnel').set('v.options', this.conv_selected(component.get('v.allselectlist.DealerPersonnel__c')));
+ component.find('select_purpose_type').set('v.options', this.conv_selected(component.get('v.allselectlist.WorkRecord__c')));
+ // component.find('select_ProductCcategory').set('v.options', this.conv_selected(component.get('v.allselectlist.ProductCcategory__c')));
+ component.find('select_EffectProgress').set('v.value', '');
+ component.find('select_OtherBrandConsumables').set('v.value', '');
+ component.find('select_ProductCcategory').set('v.value', '');
+ component.find('select_productCategories').set('v.value', '');
+ // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
+ component.set('v.data.Report_Date__c', '');
+ component.set('v.oppdata.Close_Forecasted_Date__c', '');
+ component.set('v.oppdata.Amount__c', '');
+ component.set('v.oppdata.OCMSale_Price__c', '');
+ component.set('v.oppdata.StageName__c', '');
+ component.set('v.Close_Forecasted_Date__c_o', '');
+ component.set('v.Amount__c_o', '');
+ component.set('v.OCMSale_Price__c_o', '');
+ component.set('v.StageName__c_o', '');
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ this.selectPurposeType(component);
+ this.selectProductClassification(component);
+ this.selectpurposetype(component);
+ },
+
+ report_date_list: function (component, event, helper, count) {
+ var ret_obj = [];
+ var now = new Date();
+ for (var i = 0; i < count; i++) {
+ var start_day = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() + 1 - (i * 7)));
+ var end_day = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (7 - now.getDay()) - (i * 7));
+ var start_day_show = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() - (i * 7)));
+ var end_day_show = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()) - (i * 7));
+ var date_text = start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate() + '~' + end_day.getFullYear() + '/' + (end_day.getMonth() + 1) + '/' + end_day.getDate();
+ if (i == 0) {
+ ret_obj.push({
+ selected: true,
+ value: start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate(),
+ label: start_day_show.getFullYear() + '/' + (start_day_show.getMonth() + 1) + '/' + start_day_show.getDate() + '~' + end_day_show.getFullYear() + '/' + (end_day_show.getMonth() + 1) + '/' + end_day_show.getDate(),
+ });
+ } else {
+ ret_obj.push({
+ selected: false,
+ value: start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate(),
+ label: start_day_show.getFullYear() + '/' + (start_day_show.getMonth() + 1) + '/' + start_day_show.getDate() + '~' + end_day_show.getFullYear() + '/' + (end_day_show.getMonth() + 1) + '/' + end_day_show.getDate(),
+ });
+ }
+ }
+ component.find('select_date').set('v.options', ret_obj);
+ component.set('v.report_date_list', ret_obj);
+ },
+ create_report_header: function (component, event, helper, name, s_agency, s_date) {
+ s_date = this.get_date_string(s_date);
+ if (s_date == false) {
+ //component.set('v.errorMessage', 'get_date_string failed.');
+ this.error('get_date_string failed.');
+ //this.showErrorToast(component);
+ return false;
+ }
+ var head_key = this.create_header_input_key(s_agency, s_date);
+ component.set('v.agency_report_header', head_key);
+ if (head_key == false) {
+ //component.set('v.errorMessage', 'create_header_input_key failed.');
+ this.error('create_header_input_key failed.');
+ //this.showErrorToast(component);
+ return false;
+ }
+ var key2 = s_date.replace(/-/g, '');
+ var action = component.get('c.createReportHeader');
+ action.setParams({
+ "name": name,
+ "s_date": s_date,
+ "s_agency": s_agency,
+ "head_key": head_key,
+ });
+ component.set('v.login', true);
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.set('v.agency_report_header_id', res);
+ component.set('v.login', false);
+ this.toggle_report(component, event, helper);
+ }
+ else {
+ //component.set('v.errorMessage', 'createReportHeader callback failed.');
+ this.error('createReportHeader callback failed.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ create_report_header_edit: function (component, event, helper, name, s_agency, s_date) {
+
+ s_date = this.get_date_string(s_date);
+ if (s_date == false) {
+ //component.set('v.errorMessage', 'get_date_string failed.');
+ this.error('get_date_string failed.');
+ //this.showErrorToast(component);
+ return false;
+ }
+ var head_key = this.create_header_input_key(s_agency, s_date);
+ component.set('v.agency_report_header', head_key);
+ if (head_key == false) {
+ //component.set('v.errorMessage', 'create_header_input_key failed.');
+ this.error('create_header_input_key failed.');
+ //this.showErrorToast(component);
+ return false;
+ }
+ var key2 = s_date.replace(/-/g, '');
+ var action = component.get('c.createReportHeader');
+
+ action.setParams({
+ "name": name,
+ "s_date": s_date,
+ "s_agency": s_agency,
+ "head_key": head_key,
+ });
+ component.set('v.login',true);
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.set('v.agency_report_header_id', res);
+ component.set('v.login', false);
+ this.toggle_report_edit(component, event, helper);
+ }
+ else {
+ //component.set('v.errorMessage', 'createReportHeader callback failed.');
+ this.error('createReportHeader callback failed.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ create_header_input_key: function (agency_id, s_date) {
+ if (typeof (s_date) != 'string') {
+ s_date = this.get_date_string(s_date);
+ if (s_date == false) {
+ //component.set('v.errorMessage', 'get_date_string in create_header_input_key.');
+ this.error('get_date_string in create_header_input_key.');
+ //this.showErrorToast(component);
+ return false;
+ }
+ }
+ if (!agency_id || !s_date) {
+ return false;
+ }
+ s_date = s_date.replace(/-/g, '');
+ var headkey = agency_id + ":" + s_date;
+ return headkey;
+ },
+
+ /* typeof is not cool
+ * @ret : String, Boolean, Date, Error, Array, Function, Null, Undefined, etc
+ */
+ object_type: function (obj) {
+ var obj_type = Object.prototype.toString.call(obj).slice(8, -1);
+ return obj_type;
+ },
+ // create yyyy-mm-dd string
+ get_date_string: function (val) {
+ if (typeof (val) == 'string') {
+ if (val.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) {
+ val = val.replace(/[\/]/g, '-');
+ var tmp = val.split('-');
+ if (tmp[1].length == 1) {
+ tmp[1] = '0' + tmp[1];
+ }
+ if (tmp[2].length == 1) {
+ tmp[2] = '0' + tmp[2];
+ }
+ val = tmp[0] + '-' + tmp[1] + '-' + tmp[2];
+ } else if (val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) {
+ //ok
+ } else {
+ return false;
+ }
+ } else if (this.object_type(val) == 'Date') {
+ var mm = val.getMonth() + 1;
+ if (String(mm).length == 1) {
+ mm = '0' + mm;
+ }
+ var dd = '';
+ if (String(val.getDate()).length == 1) {
+ dd = '0' + val.getDate();
+ } else {
+ dd = val.getDate();
+ }
+ val = val.getFullYear() + '-' + mm + '-' + dd;
+ } else {
+ return false;
+ }
+ return val;
+ },
+ // Controller 鏍规嵁椤甸潰鍖婚櫌鏌ヨ绗﹀悎鐨勫尰闄�
+ searchHos: function (component, event, helper) {
+ var hospital_name = event.getParam("value");
+ var action = component.get("c.getHospitalList");
+ action.setParams({
+ "hospital_name": hospital_name
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var hospital_list = component.find('hospital_list');
+ var hosList = response.getReturnValue();
+ if (hosList.length > 0) {
+ $A.util.addClass(hospital_list, 'slds-is-open');
+ } else {
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ }
+ component.set("v.hospitalList", response.getReturnValue());
+ } else {
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ hideSearch: function (component, event, helper) {
+ var hospital_list = component.find('hospital_list');
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ },
+ hideSearchs: function (component, event, helper) {
+ var hospital_list = component.find('hospital_list');
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ component.set("v.hospital", '');
+ component.set("v.hospitals", '');
+ component.set('v.hospitalLinkId', '');
+ component.set('v.data.Agency_Hospital__c', '');
+ component.set("v.hospitalId", '');
+ },
+ selectHos: function (component, event, helper) {
+
+ var hospital_list = component.find('hospital_list');
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ var accname = event.currentTarget.dataset.accname;
+ var accid = event.currentTarget.dataset.accid;
+ var hospital_data = component.get('v.hospitalList');
+ var select_purpose_type = component.find('select_purpose_type').get('v.value');
+ for (var i = 0; i < hospital_data.length; i++) {
+ if (hospital_data[i].Hospital__c == accid) {
+ component.set('v.hospitalLinkId', hospital_data[i].Id);
+ component.set('v.data.Agency_Hospital__c', hospital_data[i].Id);
+ if (select_purpose_type != '绉戝浼�' && hospital_data[i].Hospital__c) {
+ component.find('new_con').set('v.disabled', false);
+ } else {
+ component.find('new_con').set('v.disabled', true);
+ }
+ }
+ }
+ component.set("v.hospitals", accname);
+ component.set("v.hospital", accname);
+ component.set("v.hospitalId", accid);
+
+ component.set('v.setdoctorlisthos', true);
+ this.set_doctor_list_edit(component, event, helper);
+ },
+
+
+ //妯$硦鏌ヨ浣跨敤浜у搧1(浜у搧鍨嬪彿)
+ searchUseProduct1: function (component, event, helper) {
+ var UseProduct1Name = event.getParam("value");
+ var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
+ var action = component.get("c.getUseProduct1");
+ action.setParams({
+ "UseProduct1Name": UseProduct1Name,
+ "select_ProductClassification": select_ProductClassification
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var UseProduct1_List = component.find('UseProduct1_List');
+ var UseProduct1ListValue = response.getReturnValue();
+ if (UseProduct1ListValue.length > 0) {
+ $A.util.addClass(UseProduct1_List, 'slds-is-open');
+ } else {
+ $A.util.removeClass(UseProduct1_List, 'slds-is-open');
+ }
+ component.set("v.UseProduct1List", UseProduct1ListValue);
+ } else {
+ $A.util.removeClass(UseProduct1_List, 'slds-is-open');
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ hideSearchUseProduct1: function (component, event, helper) {
+ var UseProduct1_List = component.find('UseProduct1_List');
+ $A.util.removeClass(UseProduct1_List, 'slds-is-open');
+ },
+ hideSearchUseProduct1s: function (component, event, helper) {
+ var UseProduct1_List = component.find('UseProduct1_List');
+ $A.util.removeClass(UseProduct1_List, 'slds-is-open');
+ component.set("v.UseProduct1", '');
+ component.set("v.UseProduct1s", '');
+ component.set('v.UseProduct1Id', '');
+ component.set('v.data.UseProduct1__c', '');
+ },
+ seletUseProduct1Change: function (component, event, helper) {
+
+ var UseProduct1_List = component.find('UseProduct1_List');
+ $A.util.removeClass(UseProduct1_List, 'slds-is-open');
+ var accname = event.currentTarget.dataset.accname;
+ var accid = event.currentTarget.dataset.accid;
+ var UseProduct1ListDate = component.get('v.UseProduct1List');
+ for (var i = 0; i < UseProduct1ListDate.length; i++) {
+ if (UseProduct1ListDate[i].Id == accid) {
+ component.set('v.UseProduct1Id', UseProduct1ListDate[i].Id);
+ component.set('v.data.UseProduct1__c', UseProduct1ListDate[i].Id);
+ }
+ }
+ var UseProduct2_TEXT = component.find('UseProduct2_TEXT').get('v.value');
+ var UseProduct3_TEXT = component.find('UseProduct3_TEXT').get('v.value');
+ if (UseProduct2_TEXT != accname && UseProduct3_TEXT != accname) {
+ component.set("v.UseProduct1s", accname);
+ component.set("v.UseProduct1", accname);
+ } else {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ //this.showErrorToast(component);
+ }
+ },
+ //妯$硦鏌ヨ浣跨敤浜у搧2
+ searchUseProduct2: function (component, event, helper) {
+ var UseProduct2Name = event.getParam("value");
+ var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
+ var action = component.get("c.getUseProduct1");
+ action.setParams({
+ "UseProduct1Name": UseProduct2Name,
+ "select_ProductClassification": select_ProductClassification
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var UseProduct2_List = component.find('UseProduct2_List');
+ var UseProduct2List = response.getReturnValue();
+ if (UseProduct2List.length > 0) {
+ $A.util.addClass(UseProduct2_List, 'slds-is-open');
+ } else {
+ $A.util.removeClass(UseProduct2_List, 'slds-is-open');
+ }
+ component.set("v.UseProduct2List", response.getReturnValue());
+ } else {
+ $A.util.removeClass(UseProduct2_List, 'slds-is-open');
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ hideSearchUseProduct2: function (component, event, helper) {
+ var UseProduct2_List = component.find('UseProduct2_List');
+ $A.util.removeClass(UseProduct2_List, 'slds-is-open');
+ },
+ hideSearchUseProduct2s: function (component, event, helper) {
+ var UseProduct2_List = component.find('UseProduct2_List');
+ $A.util.removeClass(UseProduct2_List, 'slds-is-open');
+ component.set("v.UseProduct2", '');
+ component.set("v.UseProduct2s", '');
+ component.set('v.UseProduct2Id', '');
+ component.set('v.data.UseProduct2__c', '');
+ },
+ seletUseProduct2Change: function (component, event, helper) {
+ var UseProduct2_List = component.find('UseProduct2_List');
+ $A.util.removeClass(UseProduct2_List, 'slds-is-open');
+ var accname = event.currentTarget.dataset.accname;
+ var accid = event.currentTarget.dataset.accid;
+ var UseProduct2ListDate = component.get('v.UseProduct2List');
+ for (var i = 0; i < UseProduct2ListDate.length; i++) {
+ if (UseProduct2ListDate[i].Id == accid) {
+ component.set('v.UseProduct2Id', UseProduct2ListDate[i].Id);
+ component.set('v.data.UseProduct2__c', UseProduct2ListDate[i].Id);
+ }
+ }
+ var UseProduct1_TEXT = component.find('UseProduct1_TEXT').get('v.value');
+ var UseProduct3_TEXT = component.find('UseProduct3_TEXT').get('v.value');
+ if (UseProduct1_TEXT != accname && UseProduct3_TEXT != accname) {
+ component.set("v.UseProduct2s", accname);
+ component.set("v.UseProduct2", accname);
+ } else {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ //this.showErrorToast(component);
+ }
+
+ },
+ //妯$硦鏌ヨ浣跨敤浜у搧3
+ searchUseProduct3: function (component, event, helper) {
+ var UseProduct3Name = event.getParam("value");
+ var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
+ var action = component.get("c.getUseProduct1");
+ action.setParams({
+ "UseProduct1Name": UseProduct3Name,
+ "select_ProductClassification": select_ProductClassification
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var UseProduct3_List = component.find('UseProduct3_List');
+ var UseProduct3List = response.getReturnValue();
+ if (UseProduct3List.length > 0) {
+ $A.util.addClass(UseProduct3_List, 'slds-is-open');
+ } else {
+ $A.util.removeClass(UseProduct3_List, 'slds-is-open');
+ }
+ component.set("v.UseProduct3List", response.getReturnValue());
+ } else {
+ $A.util.removeClass(UseProduct3_List, 'slds-is-open');
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ hideSearchUseProduct3: function (component, event, helper) {
+ var UseProduct3_List = component.find('UseProduct3_List');
+ $A.util.removeClass(UseProduct3_List, 'slds-is-open');
+ },
+ hideSearchUseProduct3s: function (component, event, helper) {
+ var UseProduct3_List = component.find('UseProduct3_List');
+ $A.util.removeClass(UseProduct3_List, 'slds-is-open');
+ component.set("v.UseProduct3", '');
+ component.set("v.UseProduct3s", '');
+ component.set('v.UseProduct3Id', '');
+ component.set('v.data.UseProduct3__c', '');
+ },
+ seletUseProduct3Change: function (component, event, helper) {
+ var UseProduct3_List = component.find('UseProduct3_List');
+ $A.util.removeClass(UseProduct3_List, 'slds-is-open');
+ var accname = event.currentTarget.dataset.accname;
+ var accid = event.currentTarget.dataset.accid;
+ var UseProduct3ListDate = component.get('v.UseProduct3List');
+ for (var i = 0; i < UseProduct3ListDate.length; i++) {
+ if (UseProduct3ListDate[i].Id == accid) {
+ component.set('v.UseProduct3Id', UseProduct3ListDate[i].Id);
+ component.set('v.data.UseProduct3__c', UseProduct3ListDate[i].Id);
+ }
+ }
+ var UseProduct1_TEXT = component.find('UseProduct1_TEXT').get('v.value');
+ var UseProduct2_TEXT = component.find('UseProduct2_TEXT').get('v.value');
+ if (UseProduct1_TEXT != accname && UseProduct2_TEXT != accname) {
+ component.set("v.UseProduct3s", accname);
+ component.set("v.UseProduct3", accname);
+ } else {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝�');
+ //this.showErrorToast(component);
+ }
+
+ },
+ //hospitalLinkId 缁忛攢鍟嗗尰闄㈢殑ID 鎷滆浜哄鍒剁殑鍦版柟
+ doctor_change: function (component, event, helper) {
+
+ var doctorurpose = component.find('select_purpose_type').get('v.value');
+ var doctor_value = component.find('select_doctor').get('v.value');
+ var doctor_list = component.get('v.doctor_list');
+ var flg = false;
+ if (doctor_list) {
+ for (var i = 0; i < doctor_list.length; i++) {
+ if (doctor_list[i].value == doctor_value) {
+ if (doctorurpose == '绉戝浼�') {
+ // component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c);
+ } else {
+ component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c);
+ }
+ flg = true;
+ break;
+ }
+ }
+ }
+ if (flg == false) {
+ component.set('v.doctor_title', '');
+ }
+ },
+ //SWAG-CF58C3 fy start 璋冪敤pi
+ set_aws_url: function (component, sobject) {
+ var action = component.get('c.getAwsurl');
+ action.setParams({
+ "sobj": sobject,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var awsmap = this.conv_selected(response.getReturnValue());
+ component.set('v.AWStoken', awsmap.token);
+ component.set('v.AWSinsert', awsmap.newUrl);
+ component.set('v.AWSsearch', awsmap.searchUrl);
+ component.set('v.AWStransactionURL', awsmap.transactionURL);
+ }
+ else {
+ // component.set('v.errorMessage', 'AWS url/token error.');
+ this.error('AWS url/token error.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ insert_agencycontact: function (component, token, newUrl, payload, agencyHospitalid, helper, hospitalName) {
+
+ console.log('newUrl = ' + newUrl);
+ console.log('payload = ' + payload);
+ console.log('token = ' + token);
+ fetch(newUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ console.log('result = ' + JSON.stringify(result));
+ if (result.status == '0') {
+ $A.getCallback(function () {
+ helper.to_agencycontact(component, result, agencyHospitalid);
+ })();
+ } else {
+ console.log('AWS status error:' + result)
+ component.set('v.login', false);
+ if (result.status == '129') {
+ component.find('OppMessage').setError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪' + hospitalName + '鍖婚櫌锛岃淇敼');
+ } else {
+ component.find('OppMessage').setError('AWS insert error.');
+ }
+ }
+ }).catch(error => {
+ console.log('AWS insert error:' + error)
+ component.set('v.login', false);
+ component.find('OppMessage').setError('AWS insert error.');
+ });
+
+ },
+
+ to_agencycontact: function (component, result, agencyHospitalid) {
+ var action = component.get('c.saveAgencyContact');
+ action.setParams({
+ "name": result.object[0].name,
+ //"nameEncrypt" : result.object[0].nameEncrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
+ "type": result.object[0].type,
+ //"typeEncrypt" : result.object[0].typeEncrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
+ "doctorDivision1": result.object[0].doctorDivision1,
+ //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt, //zhj 鏂版柟妗堟敼閫� 2023-12-21
+ "agencyHospitalid": agencyHospitalid,
+ "awsid": result.object[0].dataId,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var acMap = this.conv_selected(response.getReturnValue());
+ console.log(acMap);
+ if (acMap.AgencyContactId != '') {
+ //纭浜嬪姟
+ var token = component.get('v.AWStoken');
+ var confirmUrl = component.get('v.AWStransactionURL');
+
+ let data = Object.create(null);
+ data['isSuccess'] = 1;
+ data['sfRecordId'] = '';
+ data['txId'] = result.txId;
+
+ this.to_confirm(component, token, confirmUrl, JSON.stringify(data));
+ } else if (acMap.errormsg != '') {
+ // component.set('v.errorMessage', acMap.errormsg);
+ this.error(acMap.errormsg);
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ } else {
+ //component.set('v.errorMessage', 'agency contact insert id error.');
+ this.error('agency contact insert id error.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ }
+ else {
+ //component.set('v.errorMessage', 'agency contact insert error.');
+ this.error('agency contact insert error.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ to_confirm: function (component, token, confirmUrl, payload, event) {
+ fetch(confirmUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ if (result.status == '0' && result.hasOwnProperty('success') && result.success) {
+ // component.set('v.truthy', false);
+ // var modal_newAC = component.find('modal_newAC')
+ // $A.util.addClass(modal_newAC, 'disp_none');
+ // this.success('.瀹㈡埛浜哄憳宸插垱寤恒��');
+ // this.set_doctor_list(component);
+
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ component.set('v.successMessage', '.鎷滆浜哄凡鍒涘缓銆�');
+ this.showSuccessToast(component);
+ component.set('v.login', false);
+ this.set_doctor_list_edit(component);
+ } else {
+ //component.set('v.errorMessage', 'AWS confirm error.');
+ this.error('AWS confirm error.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ }).catch(error => {
+ // component.set('v.errorMessage', 'AWS confirm error.');
+ this.error('AWS confirm error.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ });
+ },
+ //SWAG-CF58C3 fy end 璋冪敤pi
+
+ set_doctor_list: function (component) {
+ console.log('set_doctor_list')
+ var doctor_value = component.find('select_purpose_type').get('v.value');
+ var hospital_id = component.get('v.hospitalLinkId');
+ console.log('hospital_id = ' + hospital_id);
+ if (hospital_id) {
+ if (doctor_value == '绉戝浼�') {
+ component.set('v.loginEdit', true);
+ this.set_doctor_list2(component);
+ } else {
+ component.set('v.loginEdit', true);
+ var action = component.get('c.getDoctorList');
+ action.setParams({
+ "hospital_id": hospital_id,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ ;
+ var res = this.conv_selected(response.getReturnValue());
+ //fy
+ var setdoctorlisthos = component.get('v.setdoctorlisthos');
+ if (setdoctorlisthos) {
+ component.set('v.default_select_doctor_id', '');
+ component.set('v.setdoctorlisthos', false);
+ }
+ //fy
+ var default_doctor = component.get('v.default_select_doctor_id');
+ if (default_doctor != '' && res.length > 0) {
+ var doctor_title = '';
+ let awsids = [];
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].value == default_doctor) {
+ res[i].selected = true;
+ doctor_title = res[i].Doctor_Division1__c;
+ } else {
+ res[i].selected = false;
+ }
+ if (res[i].AWS_Data_Id__c) {
+ awsids.push(res[i].AWS_Data_Id__c);
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ component.set('v.doctor_title', doctor_title);
+ console.log('awsids = ' + JSON.stringify(awsids))
+ if (awsids.length > 0) {
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: awsids
+ }, function (data) {
+ console.log('data = ' + JSON.stringify(data))
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res) {
+ if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
+ res[ri].label = m[res[ri].AWS_Data_Id__c].name;
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ }
+
+ component.set('v.loginEdit', false);
+ }, staticResourceAgencyContact.token);
+ }
+ } else {
+ let awsids = [];
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].AWS_Data_Id__c) {
+ awsids.push(res[i].AWS_Data_Id__c);
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ if (awsids.length > 0) {
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: awsids
+ }, function (data) {
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res) {
+ if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
+ res[ri].label = m[res[ri].AWS_Data_Id__c].name;
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ }
+
+ component.set('v.loginEdit', false);
+ }, staticResourceAgencyContact.token);
+ }
+ // component.find('select_doctor').set('v.options', res);
+ if (res.length > 0) {
+ component.set('v.doctor_title', res[0].Doctor_Division1__c);
+ }
+ }
+ // component.set('v.default_select_doctor_id', '');
+
+ component.set('v.doctor_list', res);
+ component.set('v.loginEdit', false);
+ }
+ else {
+ // component.set('v.errorMessage', 'set_doctor_list failed.');
+ this.error('set_doctor_list failed.');
+ //this.showErrorToast(component);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+
+ } else {
+ if (doctor_value == '绉戝浼�') {
+ this.set_doctor_list2(component);
+ } else {
+ component.find('select_doctor').set('v.options', '');
+ }
+ }
+ component.set('v.loginEdit', false);
+ },//fy 20220414
+ set_doctor_list_edit: function (component) {
+ console.log('set_doctor_list')
+ var doctor_value = component.find('select_purpose_type').get('v.value');
+ var hospital_id = component.get('v.hospitalLinkId');
+ console.log('hospital_id = ' + hospital_id);
+ if (hospital_id) {
+ if (doctor_value == '绉戝浼�') {
+ component.set('v.loginEdit', true);
+ this.set_doctor_list2(component);
+ } else {
+ component.set('v.loginEdit', true);
+ var action = component.get('c.getDoctorList');
+ action.setParams({
+ "hospital_id": hospital_id,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = this.conv_selected(response.getReturnValue());
+ //fy
+ var setdoctorlisthos = component.get('v.setdoctorlisthos');
+ if (setdoctorlisthos) {
+ component.set('v.default_select_doctor_id', '');
+ component.set('v.setdoctorlisthos', false);
+ }
+ //fy
+ var default_doctor = component.get('v.default_select_doctor_id');
+ if (default_doctor != '' && res.length > 0) {
+ var doctor_title = '';
+ let awsids = [];
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].value == default_doctor) {
+ res[i].selected = true;
+ doctor_title = res[i].Doctor_Division1__c;
+ } else {
+ res[i].selected = false;
+ }
+ if (res[i].AWS_Data_Id__c) {
+ awsids.push(res[i].AWS_Data_Id__c);
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ component.set('v.doctor_title', doctor_title);
+ console.log('awsids = ' + JSON.stringify(awsids))
+ if (awsids.length > 0) {
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: awsids
+ }, function (data) {
+ console.log('data = ' + JSON.stringify(data))
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res) {
+ if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
+ res[ri].label = m[res[ri].AWS_Data_Id__c].name;
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ }
+
+ component.set('v.loginEdit', false);
+ }, staticResourceAgencyContact.token);
+ }
+ } else {
+ let awsids = [];
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].AWS_Data_Id__c) {
+ awsids.push(res[i].AWS_Data_Id__c);
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ if (awsids.length > 0) {
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: awsids
+ }, function (data) {
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res) {
+ if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
+ res[ri].label = m[res[ri].AWS_Data_Id__c].name;
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ }
+
+ component.set('v.loginEdit', false);
+ }, staticResourceAgencyContact.token);
+ }
+ // component.find('select_doctor').set('v.options', res);
+ if (res.length > 0) {
+ component.set('v.doctor_title', res[0].Doctor_Division1__c);
+ }
+ }
+ // component.set('v.default_select_doctor_id', '');
+
+ component.set('v.doctor_list', res);
+ component.set('v.loginEdit', false);
+ }
+ else {
+ // component.set('v.errorMessage', 'set_doctor_list failed.');
+ this.error('set_doctor_list failed.');
+ //this.showErrorToast(component);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+
+ } else {
+ if (doctor_value == '绉戝浼�') {
+ this.set_doctor_list2(component);
+ } else {
+ component.find('select_doctor').set('v.options', '');
+ }
+ }
+ },
+ set_doctor_list2: function (component) {
+ var action1 = component.get('c.selectdoctor3c');
+ action1.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].selected == 'true') {
+ res[i].selected = true;
+ } else {
+ res[i].selected = false;
+ }
+ }
+
+ component.find('select_doctor').set('v.options', res);
+ var doctor3value = component.get('v.default_select_doctor_id2');
+ this.set_selected(component, 'select_doctor', doctor3value);
+ component.set('v.login', false);
+ component.set('v.loginEdit', false);
+ }
+ });
+ $A.enqueueAction(action1);
+ },
+ productcategoryChange1: function (component, event, helper) {
+ var product_category_id = component.find('select_Product1').get('v.value');
+ var pcId1 = component.find('select_Product2').get('v.value');
+ var pcId2 = component.find('select_Product3').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ //this.showErrorToast(component);
+ component.find('select_Product1').set('v.value', '');
+ }
+ },
+ productcategoryChange2: function (component, event, helper) {
+ var product_category_id = component.find('UseProduct2_TEXT').get('v.value');
+ var pcId1 = component.find('UseProduct1_TEXT').get('v.value');
+ var pcId2 = component.find('UseProduct3_TEXT').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null;
+ var p2bool = pcId2 != '' && pcId2 != null;
+ var p0bool = product_category_id != '' && product_category_id != null;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ //this.showErrorToast(component);
+ component.set('v.UseProduct2_TEXT', '');
+ }
+ },
+ productcategoryChange3: function (component, event, helper) {
+ var product_category_id = component.find('select_Product3').get('v.value');
+ var pcId1 = component.find('select_Product1').get('v.value');
+ var pcId2 = component.find('select_Product2').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ //component.set('v.errorMessage', '涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ this.error('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ //this.showErrorToast(component);
+ component.find('select_Product3').set('v.value', '');
+ }
+ },
+ conv_selected: function (obj) {
+ for (var i = 0; i < obj.length; i++) {
+ if (obj[i].selected) {
+ if (obj[i].selected == 'true') {
+ obj[i].selected = true;
+ } else {
+ obj[i].selected = false;
+ }
+ }
+ }
+ return obj;
+ },
+ set_selected: function (component, aura_id_name, value) {
+ ;
+ var select_tmp = component.find(aura_id_name).get('v.options');
+ if (select_tmp) {
+ for (var i = 0; i < select_tmp.length; i++) {
+ if (select_tmp[i].value == value) {
+ select_tmp[i].selected = true;
+ } else {
+ select_tmp[i].selected = false;
+ }
+ }
+ component.find(aura_id_name).set('v.options', select_tmp);
+ return true;
+ } else {
+ return false;
+ }
+ },
+ //寮瑰嚭 鎴愬姛鎻愮ず
+ showSuccessToast: function (component) {
+
+ $A.util.removeClass(component.find('successDiv'), 'slds-hide');
+ window.setTimeout($A.getCallback(function () {
+ $A.util.addClass(component.find('successDiv'), 'slds-hide');
+ }),
+ 3000
+ );
+ },
+ //寮瑰嚭 鎴愬姛鎻愮ず
+ showSuccessToast01: function (component) {
+
+ $A.util.removeClass(component.find('successDiv01'), 'slds-hide');
+ window.setTimeout($A.getCallback(function () {
+ $A.util.addClass(component.find('successDiv01'), 'slds-hide');
+ }),
+ 3000
+ );
+ },
+ //寮瑰嚭 閿欒鎻愮ず
+ showErrorToast: function (component) {
+
+ $A.util.removeClass(component.find('errorDiv'), 'slds-hide');
+ window.setTimeout($A.getCallback(function () {
+ $A.util.addClass(component.find('errorDiv'), 'slds-hide');
+ }),
+ 3000
+ );
+ },
+ //寮瑰嚭 閿欒鎻愮ず
+ showErrorToast01: function (component) {
+
+ $A.util.removeClass(component.find('errorDiv01'), 'slds-hide');
+ window.setTimeout($A.getCallback(function () {
+ $A.util.addClass(component.find('errorDiv01'), 'slds-hide');
+ }),
+ 6000
+ );
+ },
+ error: function (message) {
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ "title": "閿欒!",
+ "message": message,
+ "type": "error",
+ "duration": "sticky"
+ });
+ toastEvent.fire();
+ },
+ createCon: function (component, event, helper) {
+ var modal_newAC = component.find('modal_newAC');
+ $A.util.removeClass(modal_newAC, 'disp_none');
+ component.set('v.truthy', true);
+ },
+ hideCmp: function (component, event, helper) {
+ var div1 = component.find('report')
+ var div2 = component.find('report_list')
+ $A.util.addClass(div1, 'disp_none');
+ $A.util.addClass(div2, 'disp_none');
+ },
+ handleSuccess: function (component, event, helper) {
+ var insertId = event.getParams().response.Id;
+ var displayValue = event.getParams().response.fields.Name.value;
+ event.setParams({});
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ component.set('v.successMessage', '.鎷滆浜哄凡鍒涘缓銆�');
+ this.showSuccessToast(component);
+ this.set_doctor_list_edit(component, event, helper);
+ },
+ createCancel: function (component, event, helper) {
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ component.find('OppMessage').setError('');
+ },
+ //绉戝璧嬪��
+ setOpportunity_cfilter: function (component) {
+ var hosId = component.get('v.hospitalId');
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ var opportunity_cfilter = '';
+ if (hosId != '' && hosId != null) {
+ opportunity_cfilter = ' Agency_Hospital__r.Hospital__c=' + '\'' + hosId + '\'';
+ }
+ if (Department_Cateogy__c != '' && Department_Cateogy__c != null) {
+ if (opportunity_cfilter != '' && opportunity_cfilter != null) {
+ opportunity_cfilter += ' AND ';
+ }
+ // fy Department_Cateogy_text__c
+ opportunity_cfilter += 'Department_Cateogy__c=' + '\'' + Department_Cateogy__c + '\'';
+ // opportunity_cfilter += 'Department_Cateogy_text__c=' + '\'' + Department_Cateogy__c + '\'';
+ }
+ component.set('v.opportunity_cfilter', opportunity_cfilter);
+ },
+ readFile: function (component, helper, file) {
+ if (!file) return;
+ if (!file.name.match(/\.(csv||CSV)$/)) {
+ return alert('only support csv files');
+ } else {
+ reader = new FileReader();
+ reader.onerror = function errorHandler(evt) {
+ switch (evt.target.error.code) {
+ case evt.target.error.NOT_FOUND_ERR:
+ alert('File Not Found!');
+ break;
+ case evt.target.error.NOT_READABLE_ERR:
+ alert('File is not readable');
+ break;
+ case evt.target.error.ABORT_ERR:
+ break; // noop
+ default:
+ alert('An error occurred reading this file.');
+ };
+ }
+ reader.onabort = function (e) {
+ alert('File read cancelled');
+ };
+ reader.onloadstart = function (e) {
+ var output = '<ui type=\"disc\"><li><strong>' + file.name + '</strong> (' + file.type + ')- ' + file.size + 'bytes, last modified: ' + file.lastModifiedDate.toLocaleDateString() + '</li></ui>';
+ component.set("v.filename", file.name);
+ component.set("v.TargetFileName", output);
+ };
+ reader.onload = function (e) {
+ ;
+ var data = e.target.result;
+
+ component.set("v.fileContentData", data);
+ console.log("file data" + JSON.stringify(data));
+ var allTextLines = data.split(/\r\n|\n/);
+ console.log("qqqqqqqqqqqqqqqqqqq" + allTextLines);
+ var dataRows = allTextLines.length - 1;
+ var headers = allTextLines[0].split(',');
+ var numOfRows = component.get("v.NumOfRecords");
+ if (dataRows > numOfRows + 1 || dataRows == 1 || dataRows == 0) {
+ alert("File Rows between 1 to " + numOfRows + " .");
+ component.set("v.showMain", true);
+ }
+ else {
+ var lines = [];
+ var filecontentdata;
+ var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
+ content += "<thead><tr class=\"slds-text-title--caps\">";
+ content += '<th scope=\"col"\ style=\"width:100px">' + '琛屽彿' + '</th>';
+ for (i = 0; i < headers.length; i++) {
+ if (headers[i] == '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺') {
+ content += '<th scope=\"col"\ style=\"width:250px"\>' + headers[i] + '</th>';
+ } else {
+ content += '<th scope=\"col"\ style=\"width:200px"\>' + headers[i] + '</th>';
+ }
+ }
+ content += "</tr></thead>";
+ for (var i = 1; i < allTextLines.length; i++) {
+ filecontentdata = allTextLines[i].split(',');
+ if (filecontentdata[0] != '') {
+ content += "<tr>";
+ content += "<td>" + i + "</td>";
+ for (var j = 0; j < filecontentdata.length; j++) {
+ content += '<td>' + filecontentdata[j] + '</td>';
+ }
+ content += "</tr>";
+ }
+ }
+ content += "</table>";
+ console.log(content);
+ component.set("v.TableContent", content);
+ component.set("v.showMain", false);
+ }
+ }
+ reader.readAsText(file, 'gb2312');
+
+ }
+ var reader = new FileReader();
+ reader.onloadend = function () {
+ };
+ reader.readAsDataURL(file);
+ },
+ // fy 璋冪敤pi鏀归�犵殑 鑾峰彇url 鍜� token鐨勬柟娉�
+ search_contact_url: function (component, sobject, callback) {
+ var action = component.get("c.getAwsurl");
+ action.setParams({
+ sobj: sobject
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var result = response.getReturnValue();
+ if (callback) callback(result);
+ }
+ else {
+ //component.set('v.errorMessage', 'AWS url/token error.');
+ this.error('AWS url/token error.');
+ //this.showErrorToast01(component);
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ // fy 璋冪敤pi鏀归�犵殑 鑾峰彇.瀹㈡埛浜哄憳鐨勬柟娉�
+ search_core: function (token, searchUrl, payload, callback, component) {
+ console.log('searchUrl = ' + searchUrl);
+ fetch(searchUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ component.set('v.login', false);
+ if (callback) callback(result);
+ }).catch(error => {
+ console.log('AWS search error = ' + JSON.stringify(error));
+ // component.set('v.errorMessage', 'AWS search error.');
+ this.error('AWS search error.');
+ //this.showErrorToast01(component);
+ component.set('v.login', false);
+ });
+ },
+ saveRecords: function (component, event, helper) {
+ //component.set('v.login', true);
+ component.set('v.modal_import_spinner', true);
+ //fy 瀵煎叆 202200506 start
+ var action1 = component.get("c.processDataAWSId");
+ action1.setParams({
+ fileData: component.get("v.fileContentData"),
+ });
+ action1.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+
+ var ress = response.getReturnValue();
+ if (ress) {
+ var valur = ress.split('error1');
+ if (valur.length <= 1) {
+ var res = JSON.parse(response.getReturnValue());
+
+ var dataArr = new Array();
+ var dataMap = new Map();
+ res.forEach(item => {
+ if (item.AWS_Data_Id__c) {
+ dataArr.push(item.AWS_Data_Id__c);
+ //dataMap.set(item.AWS_Data_Id__c,item.Name_Encrypted__c); //zhj 鏂版柟妗堟敼閫� 2022-12-21
+ dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c);
+ }
+ });
+
+ let obj = Object.create(null);
+ obj['dataIds'] = dataArr;
+ var payload = JSON.stringify(obj);
+ this.search_contact_url(component, 'Agency_Contact__c', (result) => {
+ var token = result.token;
+ var searchUrl = result.searchUrl;
+ console.log('token = ' + token);
+ console.log('searchUrl = ' + searchUrl);
+ console.log('payload = ' + payload);
+ this.search_core(token, searchUrl, payload, (result) => {
+ console.log('result = ' + JSON.stringify(result));
+ if (result.status == '0') {
+ if (result.object != null && result.object.length != 0) {
+ //component.set('v.login', true);
+ component.set('v.modal_import_spinner', true);
+ this.saveRecordsEditFile(component, dataMap, result.object, helper);
+ } else {
+ //component.set('v.errorMessage', 'AWS 鏌ヨ鏁版嵁涓虹┖ ');
+ this.error('AWS 鏌ヨ鏁版嵁涓虹┖ ');
+ //this.showErrorToast01(component);
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ }
+ } else {
+ //component.set('v.errorMessage', 'AWS search status : ' + result.status);
+ this.error('AWS search status : ' + result.status);
+ //this.showErrorToast01(component);
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ }
+ }, component);
+ });
+ } else {
+ //component.set('v.errorMessage', valur[1] + '\n' + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ this.error(valur[1] + '\n' + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
//this.showErrorToast01(component);
//component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- }
- } else {
- //component.set('v.errorMessage', 'AWS search status : ' + result.status);
- this.error("AWS search status : " + result.status);
- //this.showErrorToast01(component);
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
+ component.set('v.modal_import_spinner', false);
}
- },
- component
- );
- }
- );
- } else {
- //component.set('v.errorMessage', valur[1] + '\n' + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- this.error(valur[1] + "\n" + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- //this.showErrorToast01(component);
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- }
- }
- }
- });
- $A.enqueueAction(action1);
- // var action = component.get("c.processData");
- // var fieldsList = ['Name', 'Phone', 'AccountNumber']; //Please write your code dynamic fields
- // var filedata =component.get("v.fileContentData");
- // action.setParams({
- // fileData: filedata,
- // sobjectName: 'Account', //Any object
- // fields: fieldsList
- // });
- // action.setCallback(this, function (response) {
- // var state = response.getState();
- // if (state === "SUCCESS") {
- // var res = response.getReturnValue();
- // var res1 = '';
- // if (res != 'success') {
- // var ress = res.split('=');
- // console.log(ress);
- // for (var i = 0; i < ress.length; i++) {
- // res1 += ress[i].substr(7) + '\n';
- // }
- // console.log("==" + res1);
- // component.set('v.errorMessage', res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- // this.showErrorToast01(component);
- // component.set('v.login', false);
- // } else {
- // component.set('v.successMessage', '瀵煎叆鎴愬姛');
- // this.showSuccessToast01(component);
- // component.set("v.showMain", true);
- // component.set('v.login', false);
- // this.doinit(component, event, helper);
- // }
- // }
- // else if (state === "INCOMPLETE") {
- // component.set('v.login', false);
- // }
- // else if (state === "ERROR") {
- // var errors = response.getError();
- // if (errors) {
- // if (errors[0] && errors[0].message) {
- // console.log("Error message: " +
- // errors[0].message);
- // component.set('v.login', false);
- // }
- // } else {
- // console.log("Unknown error");
- // component.set('v.login', false);
- // }
- // }
- // });
- // $A.enqueueAction(action);
- },
- saveRecordsEditFile: function (component, dataMap, searchData, helper) {
- var searchDataMap = new Map();
- for (var i = 0; i < searchData.length; i++) {
- if (searchData[i].name != null) {
- var sd = searchData[i];
- searchDataMap.set(sd.name.replace(" ", ""), sd.dataId);
- }
- }
- console.log("searchDataMap=" + searchDataMap);
- var error = "";
- var fileData = component.get("v.fileContentData");
- fileData = this.ToCDB(fileData); //鍏ㄨ杞崐瑙�
- var files = fileData.split("\n");
-
- var fileStr = files[0];
- fileStr += "\n";
-
- for (var i = 1; i < files.length - 1; i++) {
- if (files[i]) {
- var filelist = files[i].split(",");
- var fileName = filelist[5];
- var WorkRecord = filelist[4];
- if (
- WorkRecord == "SIS" ||
- WorkRecord == "闄㈠唴鍏ラ櫌鐢宠" ||
- WorkRecord == "鏀惰垂椤圭洰鐢宠" ||
- WorkRecord == "绉戝浼�"
- ) {
- if (fileName) {
- if (WorkRecord != "绉戝浼�") {
- if (searchDataMap.get(fileName.replace(" ", ""))) {
- var nameDataId = searchDataMap.get(fileName.replace(" ", ""));
- if (dataMap.get(nameDataId)) {
- filelist[5] = dataMap.get(nameDataId); //zhj 鏂版柟妗堟敼閫� filelist[5]涓嶅啀瀛樼殑nameEncrpt 2022-12-21
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�";
}
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�";
- }
- } else {
- if (filelist[5] != "鍖荤敓" && filelist[5] != "鍖荤敓+鎶ゅ+") {
- //&&filelist[5]!='鍖荤敓锛嬫姢澹�'
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉涓嶅瓨鍦�";
- }
}
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉涓嶈兘涓虹┖";
- }
- } else {
- if (fileName) {
- if (WorkRecord != "绉戝浼�") {
- if (searchDataMap.get(fileName.replace(" ", ""))) {
- var nameDataId = searchDataMap.get(fileName.replace(" ", ""));
- if (dataMap.get(nameDataId)) {
- filelist[5] = dataMap.get(nameDataId);
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�";
- }
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�";
- }
- } else {
- if (filelist[5] != "鍖荤敓" && filelist[5] != "鍖荤敓+鎶ゅ+") {
- //&&filelist[5]!='鍖荤敓锛嬫姢澹�'
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉涓嶅瓨鍦�";
- }
- }
- }
- }
- fileStr += filelist.toString();
- fileStr += "\n";
- }
- }
-
- if (error != "") {
- console.log("zhj error = " + error);
- let errorArray = error.split("error1");
- let errorDatas = [];
- let errorDataRow = [];
-
- var fileContentData = component.get("v.fileContentData").split("\n");
- console.log("fileContentData = " + JSON.stringify(fileContentData));
- console.log("errorArray = " + JSON.stringify(errorArray));
- for (var i in errorArray) {
- // if (errorArray[i] != '') {
- // let errorData = {}
- // errorData.errorRow = errorArray[i].trim().substring(1, 2);
- // errorData.errorInfo = errorArray[i].trim().substring(5);
- // errorDatas.push(errorData);
- // }
- if (errorArray[i] != "") {
- let errorData = {};
- let index = errorDataRow.indexOf(
- errorArray[i].trim().substring(1, 2)
- );
- if (index == -1) {
- errorData.errorRow = errorArray[i].trim().substring(1, 2);
- errorDataRow.push(errorData.errorRow);
- errorData.errorInfo = errorArray[i].trim().substring(5);
- if (errorData.errorInfo == "鎷滆浜篈WS涓嶅瓨鍦�") {
- errorData.errorInfo =
- "鎷滆浜� " +
- fileContentData[errorData.errorRow].split(",")[5] +
- "涓嶅瓨鍦�";
- }
- errorDatas.push(errorData);
- } else {
- if (errorArray[i].trim().substring(5) == "鎷滆浜篈WS涓嶅瓨鍦�") {
- errorData[index].errorInfo =
- "; " +
- "鎷滆浜� " +
- fileContentData[errorDatas[index].errorRow].split(",")[5] +
- "涓嶅瓨鍦�";
- } else {
- errorDatas[index].errorInfo +=
- "; " + errorArray[i].trim().substring(5);
- }
- }
- }
- }
-
- var fileContentData = component.get("v.fileContentData").split("\n");
- console.log("fileContentData = " + JSON.stringify(fileContentData));
- let errorColumns = [
- {
- label: "閿欒琛�",
- fieldName: "errorRow",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "閿欒淇℃伅",
- fieldName: "errorInfo",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 300,
- wrapText: true
- }
- ];
- for (var i = 0; i < fileContentData[0].split(",").length - 1; i++) {
- let initialWidth = 180;
- if (
- fileContentData[0].split(",")[i] == "浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺" ||
- fileContentData[0].split(",")[i] == "浣跨敤浜у搧1(浜у搧鍨嬪彿)"
- ) {
- initialWidth = 250;
- }
- errorColumns.push({
- label: fileContentData[0].split(",")[i],
- fieldName: "field" + i,
- type: "text",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: initialWidth
});
- }
+ $A.enqueueAction(action1);
+ // var action = component.get("c.processData");
+ // var fieldsList = ['Name', 'Phone', 'AccountNumber']; //Please write your code dynamic fields
+ // var filedata =component.get("v.fileContentData");
+ // action.setParams({
+ // fileData: filedata,
+ // sobjectName: 'Account', //Any object
+ // fields: fieldsList
+ // });
+ // action.setCallback(this, function (response) {
+ // var state = response.getState();
+ // if (state === "SUCCESS") {
+ // var res = response.getReturnValue();
+ // var res1 = '';
+ // if (res != 'success') {
+ // var ress = res.split('=');
+ // console.log(ress);
+ // for (var i = 0; i < ress.length; i++) {
+ // res1 += ress[i].substr(7) + '\n';
+ // }
+ // console.log("==" + res1);
+ // component.set('v.errorMessage', res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ // this.showErrorToast01(component);
+ // component.set('v.login', false);
+ // } else {
+ // component.set('v.successMessage', '瀵煎叆鎴愬姛');
+ // this.showSuccessToast01(component);
+ // component.set("v.showMain", true);
+ // component.set('v.login', false);
+ // this.doinit(component, event, helper);
+ // }
+ // }
+ // else if (state === "INCOMPLETE") {
+ // component.set('v.login', false);
+ // }
+ // else if (state === "ERROR") {
+ // var errors = response.getError();
+ // if (errors) {
+ // if (errors[0] && errors[0].message) {
+ // console.log("Error message: " +
+ // errors[0].message);
+ // component.set('v.login', false);
+ // }
+ // } else {
+ // console.log("Unknown error");
+ // component.set('v.login', false);
+ // }
+ // }
+ // });
+ // $A.enqueueAction(action);
- for (var i = 0; i < errorDatas.length; i++) {
- let data = fileContentData[errorDatas[i].errorRow];
- console.log("data = " + JSON.stringify(data));
- if (data) {
- for (var j = 0; j < data.split(",").length; j++) {
- let label = "field" + j;
- errorDatas[i][label] = data.split(",")[j];
- }
+ },
+ saveRecordsEditFile: function (component, dataMap, searchData, helper) {
+ var searchDataMap = new Map();
+ for (var i = 0; i < searchData.length; i++) {
+ if (searchData[i].name != null) {
+ var sd = searchData[i];
+ searchDataMap.set(sd.name.replace(' ', ''), sd.dataId);
+ }
}
- }
- console.log("errorDatas =" + JSON.stringify(errorDatas));
- component.set("v.errorColumns", errorColumns);
- component.set("v.errorData", errorDatas);
- component.set("v.showErrorInfo", true);
+ console.log('searchDataMap=' + searchDataMap);
+ var error = '';
+ var fileData = component.get("v.fileContentData");
+ fileData = this.ToCDB(fileData);//鍏ㄨ杞崐瑙�
+ var files = fileData.split('\n');
- console.log("error = " + error);
- //component.set('v.errorMessage', error);
- this.error(error);
- //this.showErrorToast01(component);
- console.log("error=" + error);
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- return;
- }
+ var fileStr = files[0];
+ fileStr += '\n';
- console.log("fileStr=" + fileStr);
- $A.getCallback(function () {
- helper.ImportMethod(component, fileStr, helper);
- })();
- },
- ImportMethod: function (component, fileStr, helper) {
- var action = component.get("c.processData");
- var fieldsList = ["Name", "Phone", "AccountNumber"]; //Please write your code dynamic fields
- // var filedata =component.get("v.fileContentData");
- action.setParams({
- fileData: fileStr,
- sobjectName: "Account", //Any object
- fields: fieldsList
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var res = response.getReturnValue();
- var res1 = "";
- if (res != "success") {
- var ress = res.split("=");
- console.log(ress);
- let errorDatas = [];
- let errorDataRow = [];
- var fileContentData = component.get("v.fileContentData").split("\n");
- console.log(
- "fileContentData[1].split(,)[5] = " +
- fileContentData[1].split(",")[5]
- );
-
- for (var i = 0; i < ress.length; i++) {
- res1 += ress[i].substr(7) + "\n";
- if (ress[i] != "") {
- let errorData = {};
- let index = errorDataRow.indexOf(
- ress[i].substr(7).substring(1, 2)
- );
- if (index == -1) {
- errorData.errorRow = ress[i].substr(7).substring(1, 2);
- errorDataRow.push(errorData.errorRow);
- errorData.errorInfo = ress[i].substr(7).substring(5);
- if (errorData.errorInfo == "鎷滆浜轰笉瀛樺湪") {
- console.log("errorData.errorRow = " + errorData.errorRow);
- errorData.errorInfo =
- "鎷滆浜� " +
- fileContentData[errorData.errorRow].split(",")[5] +
- "涓嶅瓨鍦�";
- }
- errorDatas.push(errorData);
- } else {
- if (ress[i].substr(7).substring(5) == "鎷滆浜轰笉瀛樺湪") {
- errorDatas[index].errorInfo +=
- "; " +
- "鎷滆浜� " +
- fileContentData[errorDatas[index].errorRow].split(",")[5] +
- "涓嶅瓨鍦�";
+ for (var i = 1; i < files.length - 1; i++) {
+ if (files[i]) {
+ var filelist = files[i].split(',');
+ var fileName = filelist[5];
+ var WorkRecord = filelist[4];
+ if (WorkRecord == 'SIS' || WorkRecord == '闄㈠唴鍏ラ櫌鐢宠' || WorkRecord == '鏀惰垂椤圭洰鐢宠' || WorkRecord == '绉戝浼�') {
+ if (fileName) {
+ if (WorkRecord != '绉戝浼�') {
+ if (searchDataMap.get(fileName.replace(' ', ''))) {
+ var nameDataId = searchDataMap.get(fileName.replace(' ', ''));
+ if (dataMap.get(nameDataId)) {
+ filelist[5] = dataMap.get(nameDataId); //zhj 鏂版柟妗堟敼閫� filelist[5]涓嶅啀瀛樼殑nameEncrpt 2022-12-21
+ } else {
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�';
+ }
+ } else {
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�';
+ }
+ } else {
+ if (filelist[5] != '鍖荤敓' && filelist[5] != '鍖荤敓+鎶ゅ+') {//&&filelist[5]!='鍖荤敓锛嬫姢澹�'
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉涓嶅瓨鍦�';
+ }
+ }
+ } else {
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉涓嶈兘涓虹┖';
+ }
} else {
- errorDatas[index].errorInfo +=
- "; " + ress[i].substr(7).substring(5);
+ if (fileName) {
+ if (WorkRecord != '绉戝浼�') {
+ if (searchDataMap.get(fileName.replace(' ', ''))) {
+ var nameDataId = searchDataMap.get(fileName.replace(' ', ''));
+ if (dataMap.get(nameDataId)) {
+ filelist[5] = dataMap.get(nameDataId);
+ } else {
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�';
+ }
+ } else {
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�';
+ }
+ } else {
+ if (filelist[5] != '鍖荤敓' && filelist[5] != '鍖荤敓+鎶ゅ+') {//&&filelist[5]!='鍖荤敓锛嬫姢澹�'
+ error += 'error1 绗�' + i + '琛屾暟鎹嫓璁夸汉涓嶅瓨鍦�';
+ }
+ }
+ }
}
- }
+ fileStr += filelist.toString();
+ fileStr += '\n';
}
- }
- var fileContentData = component.get("v.fileContentData").split("\n");
- let errorColumns = [
- {
- label: "閿欒琛�",
- fieldName: "errorRow",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "閿欒淇℃伅",
- fieldName: "errorInfo",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 300,
- wrapText: true
- }
- ];
- for (var i = 0; i < fileContentData[0].split(",").length - 1; i++) {
- let initialWidth = 180;
- if (
- fileContentData[0].split(",")[i] == "浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺" ||
- fileContentData[0].split(",")[i] == "浣跨敤浜у搧1(浜у搧鍨嬪彿)"
- ) {
- initialWidth = 250;
- }
- errorColumns.push({
- label: fileContentData[0].split(",")[i],
- fieldName: "field" + i,
- type: "text",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: initialWidth
- });
- }
-
- for (var i = 0; i < errorDatas.length; i++) {
- let data = fileContentData[errorDatas[i].errorRow];
- console.log("data = " + JSON.stringify(data));
- for (var j = 0; j < data.split(",").length; j++) {
- let label = "field" + j;
- errorDatas[i][label] = data.split(",")[j];
- }
- }
- component.set("v.errorColumns", errorColumns);
- component.set("v.errorData", errorDatas);
- component.set("v.showErrorInfo", true);
-
- console.log("==" + res1);
- //component.set('v.errorMessage', res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- this.error(res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- //this.showErrorToast01(component);
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- } else {
- component.set("v.successMessage", "瀵煎叆鎴愬姛");
- this.showSuccessToast01(component);
- component.set("v.showMain", true);
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- this.doinit(component, event, helper);
}
- } else if (state === "INCOMPLETE") {
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- } else if (state === "ERROR") {
- var errors = response.getError();
- if (errors) {
- if (errors[0] && errors[0].message) {
- console.log("Error message: " + errors[0].message);
+
+ if (error != '') {
+ console.log('zhj error = ' + error);
+ let errorArray = error.split('error1');
+ let errorDatas = [];
+ let errorDataRow = [];
+
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ console.log('fileContentData = ' + JSON.stringify(fileContentData))
+ console.log('errorArray = ' + JSON.stringify(errorArray))
+ for (var i in errorArray) {
+ // if (errorArray[i] != '') {
+ // let errorData = {}
+ // errorData.errorRow = errorArray[i].trim().substring(1, 2);
+ // errorData.errorInfo = errorArray[i].trim().substring(5);
+ // errorDatas.push(errorData);
+ // }
+ if (errorArray[i] != '') {
+ let errorData = {}
+ let index = errorDataRow.indexOf(errorArray[i].trim().substring(1, 2));
+ if (index == -1) {
+ errorData.errorRow = errorArray[i].trim().substring(1, 2);
+ errorDataRow.push(errorData.errorRow);
+ errorData.errorInfo = errorArray[i].trim().substring(5);
+ if(errorData.errorInfo == '鎷滆浜篈WS涓嶅瓨鍦�'){
+ errorData.errorInfo ='鎷滆浜� ' + fileContentData[errorData.errorRow].split(',')[5] + '涓嶅瓨鍦�';
+ }
+ errorDatas.push(errorData);
+ } else {
+ if(errorArray[i].trim().substring(5) == '鎷滆浜篈WS涓嶅瓨鍦�'){
+ errorData[index].errorInfo = '; ' + '鎷滆浜� ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '涓嶅瓨鍦�';
+ }else{
+ errorDatas[index].errorInfo += '; ' + errorArray[i].trim().substring(5);
+ }
+ }
+ }
+ }
+
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ console.log('fileContentData = ' + JSON.stringify(fileContentData))
+ let errorColumns = [
+ { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
+ { label: '閿欒淇℃伅', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true }
+ ];
+ for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) {
+ let initialWidth = 180;
+ if (fileContentData[0].split(',')[i] == '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺' || fileContentData[0].split(',')[i] == '浣跨敤浜у搧1(浜у搧鍨嬪彿)') {
+ initialWidth = 250;
+ }
+ errorColumns.push({
+ label: fileContentData[0].split(',')[i],
+ fieldName: 'field' + i,
+ type: 'text',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: initialWidth
+ });
+ }
+
+ for (var i = 0; i < errorDatas.length; i++) {
+ let data = fileContentData[errorDatas[i].errorRow];
+ console.log('data = ' + JSON.stringify(data));
+ if (data) {
+ for (var j = 0; j < data.split(',').length; j++) {
+ let label = 'field' + j;
+ errorDatas[i][label] = data.split(',')[j];
+ }
+ }
+ }
+ console.log('errorDatas =' + JSON.stringify(errorDatas))
+ component.set('v.errorColumns', errorColumns);
+ component.set('v.errorData', errorDatas);
+ component.set("v.showErrorInfo", true);
+
+ console.log('error = ' + error);
+ //component.set('v.errorMessage', error);
+ this.error(error);
+ //this.showErrorToast01(component);
+ console.log('error=' + error);
//component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
- }
- } else {
- console.log("Unknown error");
- //component.set('v.login', false);
- component.set("v.modal_import_spinner", false);
+ component.set('v.modal_import_spinner', false);
+ return;
}
- }
- });
- $A.enqueueAction(action);
- }, //鍏ㄨ杞崐瑙�
- ToCDB: function (str) {
- var tmp = "";
- for (var i = 0; i < str.length; i++) {
- if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
- tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
- } else {
- tmp += String.fromCharCode(str.charCodeAt(i));
- }
- }
- return tmp;
- },
- //瀵煎嚭鐨凜SV鏂囦欢
- convertArrayOfObjectsToCSV: function (component, objectRecords) {
- var csvStringResult, counter, keys, columnDivider, lineDivider, thkeys;
- if (objectRecords == null || !objectRecords.length) {
- return null;
- }
- columnDivider = ",";
- lineDivider = "\n";
- keys = [
- "Report_Date__c",
- "Agency_Hospital__c",
- "Department_Cateogy_text__c",
- "DealerPersonnel__c",
- "WorkRecord__c",
- "doctor2__c",
- "ProductClassification__c",
- "UseProduct1__c",
- "UseProduct2__c",
- "UseProduct3__c",
- "EffectProgress__c",
- "ConsumptionOfConsumables__c",
- "WarlockClassification__c",
- "ProductCcategory__c",
- "productCategories__c",
- "warlocksNumber__c",
- "WorkMark__c"
- ];
- thkeys = [
- "娲诲姩鏃�",
- "鍖婚櫌",
- "绉戝",
- "缁忛攢鍟嗕汉鍛�",
- "娲诲姩鍖哄垎",
- "鎷滆浜�",
- "浜у搧鍒嗙被(绗笁鍒嗙被)",
- "浣跨敤浜у搧1(浜у搧鍨嬪彿)",
- "浣跨敤浜у搧2",
- "浣跨敤浜у搧3",
- "鏁堟灉/杩涘害",
- "浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺",
- "浜у搧1瀵瑰簲鏈紡鍒嗙被",
- "宸查噰鐢ㄥ叾浠栧搧鐗�",
- "鍏朵粬鍝佺墝浜у搧绫诲埆",
- "浜у搧鐢ㄩ噺",
- "鏀彺闇�姹�"
- ];
- csvStringResult = "";
- csvStringResult += thkeys.join(columnDivider);
- csvStringResult += lineDivider;
- console.log("杩涘叆瀵煎嚭helper");
- for (var i = 0; i < objectRecords.length; i++) {
- counter = 0;
- for (var sTempkey in keys) {
- var skey = keys[sTempkey];
- if (counter > 0) {
- csvStringResult += columnDivider;
- }
- if (typeof objectRecords[i][skey] === "undefined") {
- csvStringResult += "" + "" + "";
- continue;
- }
- if (skey == "Person_In_Charge2__c") {
- csvStringResult += objectRecords[i].Person_In_Charge2__r.Name;
- } else if (skey == "Agency_Hospital__c") {
- csvStringResult += objectRecords[i].Agency_Hospital__r.Name;
- } else if (skey == "DealerPersonnel__c") {
- csvStringResult += objectRecords[i].DealerPersonnel__r.Name;
- } else if (skey == "doctor2__c") {
- csvStringResult += objectRecords[i].doctor2__r.Name;
- } else if (skey == "UseProduct1__c") {
- csvStringResult += objectRecords[i].UseProduct1__r.Asset_Model_No__c;
- } else if (skey == "UseProduct2__c") {
- csvStringResult += objectRecords[i].UseProduct2__r.Asset_Model_No__c;
- } else if (skey == "UseProduct3__c") {
- csvStringResult += objectRecords[i].UseProduct3__r.Asset_Model_No__c;
- } else {
- csvStringResult += objectRecords[i][skey];
- }
- counter++;
- }
- console.log("瀵煎嚭寰幆缁撴潫");
- csvStringResult += lineDivider;
- }
- return csvStringResult;
- },
- // 瀵煎嚭椤甸潰鏄剧ず鐨勬ā鏉�
- showExportDate: function (component, objectRecords) {
- console.log("杩涘叆showexceportdate" + objectRecords);
- var keys = [
- "Report_Date__c",
- "Agency_Hospital__c",
- "Department_Cateogy_text__c",
- "DealerPersonnel__c",
- "WorkRecord__c",
- "doctor2__c",
- "ProductClassification__c",
- "UseProduct1__c",
- "UseProduct2__c",
- "UseProduct3__c",
- "EffectProgress__c",
- "ConsumptionOfConsumables__c",
- "WarlockClassification__c",
- "ProductCcategory__c",
- "productCategories__c",
- "warlocksNumber__c",
- "WorkMark__c"
- ];
- var headers = [
- "娲诲姩鏃�",
- "鍖婚櫌",
- "绉戝",
- "缁忛攢鍟嗕汉鍛�",
- "娲诲姩鍖哄垎",
- "鎷滆浜�",
- "浜у搧鍒嗙被(绗笁鍒嗙被)",
- "浣跨敤浜у搧1(浜у搧鍨嬪彿)",
- "浣跨敤浜у搧2",
- "浣跨敤浜у搧3",
- "鏁堟灉/杩涘害",
- "浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺",
- "浜у搧1瀵瑰簲鏈紡鍒嗙被",
- "宸查噰鐢ㄥ叾浠栧搧鐗�",
- "鍏朵粬鍝佺墝浜у搧绫诲埆",
- "浜у搧鐢ㄩ噺",
- "鏀彺闇�姹�"
- ];
- var content =
- '<table class="table slds-table slds-table--bordered slds-table--cell-buffer">';
- content += '<thead><tr class="slds-text-title--caps">';
- for (i = 0; i < headers.length; i++) {
- content += '<th scope="col">' + headers[i] + "</th>";
- }
- content += "</tr></thead>";
- for (var i = 0; i < objectRecords.length; i++) {
- console.log("for" + content);
- content += "<tr>";
- for (var sTempkey in keys) {
- console.log("for1" + sTempkey);
- var skey = keys[sTempkey];
- if (typeof objectRecords[i][skey] === "undefined") {
- content += "<td>" + "" + "</td>";
- continue;
- }
- console.log("for2" + objectRecords[i].Person_In_Charge2__r.Name);
- if (skey == "Person_In_Charge2__c") {
- content +=
- "<td>" + objectRecords[i].Person_In_Charge2__r.Name + "</td>";
- } else if (skey == "Agency_Hospital__c") {
- content +=
- "<td>" + objectRecords[i].Agency_Hospital__r.Name + "</td>";
- } else if (skey == "DealerPersonnel__c") {
- content +=
- "<td>" + objectRecords[i].DealerPersonnel__r.Name + "</td>";
- } else if (skey == "doctor2__c") {
- content += "<td>" + objectRecords[i].doctor2__r.Name + "</td>";
- } else if (skey == "UseProduct1__c") {
- content +=
- "<td>" +
- objectRecords[i].UseProduct1__r.Asset_Model_No__c +
- "</td>";
- } else if (skey == "UseProduct2__c") {
- content +=
- "<td>" +
- objectRecords[i].UseProduct2__r.Asset_Model_No__c +
- "</td>";
- } else if (skey == "UseProduct3__c") {
- content +=
- "<td>" +
- objectRecords[i].UseProduct3__r.Asset_Model_No__c +
- "</td>";
- } else {
- content += "<td>" + objectRecords[i][skey] + "</td>";
- }
- }
- content += "</tr>";
- }
- content += "</table>";
- console.log("helper寰幆缁撴潫" + content);
- component.set("v.TableContent2", content);
- component.set("v.showMain", false);
- },
- select_repores_date: function (component, event, helper) {
- component.set("v.login", true);
- var reportsdate1 = component.find("input-report-date1").get("v.value");
- var reportsdate2 = component.find("input-report-date2").get("v.value");
- console.log(
- "杈撳叆鐨勫紑濮嬫棩鏈�" + reportsdate1 + "杈撳叆鐨勭粨鏉熸棩鏈�" + reportsdate2
- );
- var action = component.get("c.getReportsByDate");
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�1");
- action.setParams({
- date1: reportsdate1,
- date2: reportsdate2
- });
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�2");
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var res = response.getReturnValue();
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�3" + res);
- component.set("v.login", false);
+ console.log('fileStr=' + fileStr);
+ $A.getCallback(function () {
+
+ helper.ImportMethod(component, fileStr, helper);
+ })();
- // PI 鏀归�� By Bright 20220328
- if (true) {
- let awsids = [];
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].doctor2__r &&
- res[ri].doctor2__r.AWS_Data_Id__c
- ) {
- awsids.push(res[ri].doctor2__r.AWS_Data_Id__c);
- }
- }
- if (awsids.length > 0) {
- let PIConfig = component.get("v.PIConfig");
- let staticResourceAgencyContact = JSON.parse(
- PIConfig.staticResourceAgencyContact
- );
- AWSService.search(
- staticResourceAgencyContact.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
+ }, ImportMethod: function (component, fileStr, helper) {
+ var action = component.get("c.processData");
+ var fieldsList = ['Name', 'Phone', 'AccountNumber']; //Please write your code dynamic fields
+ // var filedata =component.get("v.fileContentData");
+ action.setParams({
+ fileData: fileStr,
+ sobjectName: 'Account', //Any object
+ fields: fieldsList
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var res = response.getReturnValue();
+ var res1 = '';
+ if (res != 'success') {
+ var ress = res.split('=');
+ console.log(ress);
+ let errorDatas = [];
+ let errorDataRow = [];
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ console.log('fileContentData[1].split(,)[5] = ' + fileContentData[1].split(',')[5])
+
+ for (var i = 0; i < ress.length; i++) {
+ res1 += ress[i].substr(7) + '\n';
+ if (ress[i] != '') {
+ let errorData = {}
+ let index = errorDataRow.indexOf(ress[i].substr(7).substring(1, 2));
+ if (index == -1) {
+ errorData.errorRow = ress[i].substr(7).substring(1, 2);
+ errorDataRow.push(errorData.errorRow);
+ errorData.errorInfo = ress[i].substr(7).substring(5);
+ if(errorData.errorInfo == '鎷滆浜轰笉瀛樺湪'){
+ console.log('errorData.errorRow = ' + errorData.errorRow)
+ errorData.errorInfo ='鎷滆浜� ' + fileContentData[errorData.errorRow].split(',')[5] + '涓嶅瓨鍦�';
+ }
+ errorDatas.push(errorData);
+ } else {
+
+ if(ress[i].substr(7).substring(5) == '鎷滆浜轰笉瀛樺湪'){
+ errorDatas[index].errorInfo += '; ' + '鎷滆浜� ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '涓嶅瓨鍦�';
+ }else{
+ errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5);
+ }
+ }
+ }
}
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].doctor2__r &&
- res[ri].doctor2__r.AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)
- ) {
- res[ri].doctor2__r.Name =
- m[res[ri].doctor2__r.AWS_Data_Id__c].name;
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ let errorColumns = [
+ { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
+ { label: '閿欒淇℃伅', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true }
+ ];
+ for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) {
+ let initialWidth = 180;
+ if (fileContentData[0].split(',')[i] == '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺' || fileContentData[0].split(',')[i] == '浣跨敤浜у搧1(浜у搧鍨嬪彿)') {
+ initialWidth = 250;
+ }
+ errorColumns.push({
+ label: fileContentData[0].split(',')[i],
+ fieldName: 'field' + i,
+ type: 'text',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: initialWidth
+ });
}
- }
+
+ for (var i = 0; i < errorDatas.length; i++) {
+ let data = fileContentData[errorDatas[i].errorRow];
+ console.log('data = ' + JSON.stringify(data));
+ for (var j = 0; j < data.split(',').length; j++) {
+ let label = 'field' + j;
+ errorDatas[i][label] = data.split(',')[j];
+ }
+ }
+ component.set('v.errorColumns', errorColumns);
+ component.set('v.errorData', errorDatas);
+ component.set("v.showErrorInfo", true);
+
+ console.log("==" + res1);
+ //component.set('v.errorMessage', res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ this.error(res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ //this.showErrorToast01(component);
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ } else {
+ component.set('v.successMessage', '瀵煎叆鎴愬姛');
+ this.showSuccessToast01(component);
+ component.set("v.showMain", true);
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ this.doinit(component, event, helper);
}
- helper.showExportDate(component, res);
-
- component.set("v.login", false);
- },
- staticResourceAgencyContact.token
- );
- } else {
- helper.showExportDate(component, res);
- }
- }
-
- component.set("v.reports_date", res);
- } else {
- alert("瀵煎嚭澶辫触,璇锋鏌ユ椿鍔ㄦ棩");
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- showImport: function (component) {
- var modalimport = component.find("modal_import");
- var modalimportbg = component.find("modal_importbg");
- $A.util.removeClass(modalimport, "disp_none");
- $A.util.removeClass(modalimportbg, "disp_none");
- },
-
- showExport: function (component) {
- var modalimport = component.find("modal_export");
- var modalimportbg = component.find("modal_exportbg");
- $A.util.removeClass(modalimport, "disp_none");
- $A.util.removeClass(modalimportbg, "disp_none");
- },
-
- close_import: function (component) {
- var modalimport = component.find("modal_import");
- var modalimportbg = component.find("modal_importbg");
- $A.util.addClass(modalimport, "disp_none");
- $A.util.addClass(modalimportbg, "disp_none");
- },
-
- close_export: function (component) {
- var modalimport = component.find("modal_export");
- var modalimportbg = component.find("modal_exportbg");
- $A.util.addClass(modalimport, "disp_none");
- $A.util.addClass(modalimportbg, "disp_none");
- },
- //椤甸潰涓殑鏂板缓鑱屼綅鎸夐挳
- newlyBuild: function (component, event, helper) {
- var hospital_id = component.get("v.hospitalLinkId");
- event.preventDefault(); // stop form submission
- var fields = component.find("newOpportunityField");
- var nameer = "";
- var type = "";
- var doctorDivision1 = "";
- fields.forEach(function (field) {
- if (field.get("v.fieldName") === "Name") {
- nameer = field.get("v.value");
- }
- if (field.get("v.fieldName") === "Type__c") {
- type = field.get("v.value");
- }
- if (field.get("v.fieldName") === "Doctor_Division1__c") {
- doctorDivision1 = field.get("v.value");
- }
- });
- if (hospital_id) {
- component.set("v.login", true);
- var action = component.get("c.newlyBuild");
- action.setParams({
- hospital_id: hospital_id,
- nameer: nameer,
- type: type,
- doctorDivision1: doctorDivision1
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = this.conv_selected(response.getReturnValue());
- var default_doctor = component.get("v.default_select_doctor_id");
- if (default_doctor != "" && res.length > 0) {
- var doctor_title = "";
- for (var i = 0; i < res.length; i++) {
- if (res[i].value == default_doctor) {
- res[i].selected = true;
- doctor_title = res[i].Doctor_Division1__c;
- } else {
- res[i].selected = false;
- }
}
- component.find("select_doctor").set("v.options", res);
- component.set("v.doctor_title", doctor_title);
- } else {
- component.find("select_doctor").set("v.options", res);
- if (res.length > 0) {
- component.set("v.doctor_title", res[0].Doctor_Division1__c);
+ else if (state === "INCOMPLETE") {
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
}
- }
- component.set("v.default_select_doctor_id", "");
- component.set("v.doctor_list", res);
- component.set("v.login", false);
+ else if (state === "ERROR") {
+ var errors = response.getError();
+ if (errors) {
+ if (errors[0] && errors[0].message) {
+ console.log("Error message: " +
+ errors[0].message);
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ }
+ } else {
+ console.log("Unknown error");
+ //component.set('v.login', false);
+ component.set('v.modal_import_spinner', false);
+ }
+ }
+ });
+ $A.enqueueAction(action);
+ },//鍏ㄨ杞崐瑙�
+ ToCDB: function (str) {
+ var tmp = "";
+ for (var i = 0; i < str.length; i++) {
+ if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
+ tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
+ }
+ else {
+ tmp += String.fromCharCode(str.charCodeAt(i));
+ }
+ }
+ return tmp
+ },
+ //瀵煎嚭鐨凜SV鏂囦欢
+ convertArrayOfObjectsToCSV: function (component, objectRecords) {
+ var csvStringResult, counter, keys, columnDivider, lineDivider, thkeys;
+ if (objectRecords == null || !objectRecords.length) {
+ return null;
+ }
+ columnDivider = ',';
+ lineDivider = '\n';
+ keys = ['Report_Date__c', 'Agency_Hospital__c', 'Department_Cateogy_text__c', 'DealerPersonnel__c', 'WorkRecord__c', 'doctor2__c', 'ProductClassification__c', 'UseProduct1__c', 'UseProduct2__c', 'UseProduct3__c', 'EffectProgress__c', 'ConsumptionOfConsumables__c', 'WarlockClassification__c', 'ProductCcategory__c', 'productCategories__c', 'warlocksNumber__c', 'WorkMark__c'];
+ thkeys = ['娲诲姩鏃�', '鍖婚櫌', '绉戝', '缁忛攢鍟嗕汉鍛�', '娲诲姩鍖哄垎', '鎷滆浜�', '浜у搧鍒嗙被(绗笁鍒嗙被)', '浣跨敤浜у搧1(浜у搧鍨嬪彿)', '浣跨敤浜у搧2', '浣跨敤浜у搧3', '鏁堟灉/杩涘害', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺', '浜у搧1瀵瑰簲鏈紡鍒嗙被', '宸查噰鐢ㄥ叾浠栧搧鐗�', '鍏朵粬鍝佺墝浜у搧绫诲埆', '浜у搧鐢ㄩ噺', '鏀彺闇�姹�']
+ csvStringResult = '';
+ csvStringResult += thkeys.join(columnDivider);
+ csvStringResult += lineDivider;
+ console.log("杩涘叆瀵煎嚭helper");
+ for (var i = 0; i < objectRecords.length; i++) {
+ counter = 0;
+ for (var sTempkey in keys) {
+ var skey = keys[sTempkey];
+ if (counter > 0) {
+ csvStringResult += columnDivider;
+ }
+ if (typeof objectRecords[i][skey] === "undefined") {
+ csvStringResult += '' + '' + '';
+ continue;
+ }
+ if (skey == 'Person_In_Charge2__c') {
+ csvStringResult += objectRecords[i].Person_In_Charge2__r.Name;
+ } else if (skey == 'Agency_Hospital__c') {
+ csvStringResult += objectRecords[i].Agency_Hospital__r.Name;
+ } else if (skey == 'DealerPersonnel__c') {
+ csvStringResult += objectRecords[i].DealerPersonnel__r.Name;
+ } else if (skey == 'doctor2__c') {
+ csvStringResult += objectRecords[i].doctor2__r.Name;
+ } else if (skey == 'UseProduct1__c') {
+ csvStringResult += objectRecords[i].UseProduct1__r.Asset_Model_No__c;
+ } else if (skey == 'UseProduct2__c') {
+ csvStringResult += objectRecords[i].UseProduct2__r.Asset_Model_No__c;
+ } else if (skey == 'UseProduct3__c') {
+ csvStringResult += objectRecords[i].UseProduct3__r.Asset_Model_No__c;
+ } else {
+ csvStringResult += objectRecords[i][skey];
+ }
+ counter++;
+ }
+ console.log("瀵煎嚭寰幆缁撴潫");
+ csvStringResult += lineDivider;
+ }
+ return csvStringResult;
+ },
+ // 瀵煎嚭椤甸潰鏄剧ず鐨勬ā鏉�
+ showExportDate: function (component, objectRecords) {
+ console.log('杩涘叆showexceportdate' + objectRecords);
+ var keys = ['Report_Date__c', 'Agency_Hospital__c', 'Department_Cateogy_text__c', 'DealerPersonnel__c', 'WorkRecord__c', 'doctor2__c', 'ProductClassification__c', 'UseProduct1__c', 'UseProduct2__c', 'UseProduct3__c', 'EffectProgress__c', 'ConsumptionOfConsumables__c', 'WarlockClassification__c', 'ProductCcategory__c', 'productCategories__c', 'warlocksNumber__c', 'WorkMark__c'];
+ var headers = ['娲诲姩鏃�', '鍖婚櫌', '绉戝', '缁忛攢鍟嗕汉鍛�', '娲诲姩鍖哄垎', '鎷滆浜�', '浜у搧鍒嗙被(绗笁鍒嗙被)', '浣跨敤浜у搧1(浜у搧鍨嬪彿)', '浣跨敤浜у搧2', '浣跨敤浜у搧3', '鏁堟灉/杩涘害', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺', '浜у搧1瀵瑰簲鏈紡鍒嗙被', '宸查噰鐢ㄥ叾浠栧搧鐗�', '鍏朵粬鍝佺墝浜у搧绫诲埆', '浜у搧鐢ㄩ噺', '鏀彺闇�姹�']
+ var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
+ content += "<thead><tr class=\"slds-text-title--caps\">";
+ for (i = 0; i < headers.length; i++) {
+ //content += '<th scope=\"col"\ style=\"width:200px">' + headers[i] + '</th>';
+ if (headers[i] == '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺') {
+ content += '<th scope=\"col"\ style=\"width:250px"\>' + headers[i] + '</th>';
+ } else {
+ content += '<th scope=\"col"\ style=\"width:200px"\>' + headers[i] + '</th>';
+ }
+ }
+ content += "</tr></thead>";
+ for (var i = 0; i < objectRecords.length; i++) {
+ console.log('for' + content);
+ content += '<tr>';
+ for (var sTempkey in keys) {
+ console.log('for1' + sTempkey);
+ var skey = keys[sTempkey];
+ if (typeof objectRecords[i][skey] === "undefined") {
+ content += '<td>' + '' + '</td>';
+ continue;
+ }
+ console.log('for2' + objectRecords[i].Person_In_Charge2__r.Name);
+ if (skey == 'Person_In_Charge2__c') {
+ content += '<td>' + objectRecords[i].Person_In_Charge2__r.Name + '</td>';
+ } else if (skey == 'Agency_Hospital__c') {
+ content += '<td>' + objectRecords[i].Agency_Hospital__r.Name + '</td>';
+ } else if (skey == 'DealerPersonnel__c') {
+ content += '<td>' + objectRecords[i].DealerPersonnel__r.Name + '</td>';
+ } else if (skey == 'doctor2__c') {
+ content += '<td>' + objectRecords[i].doctor2__r.Name + '</td>';
+ } else if (skey == 'UseProduct1__c') {
+ content += '<td>' + objectRecords[i].UseProduct1__r.Asset_Model_No__c + '</td>';
+ } else if (skey == 'UseProduct2__c') {
+ content += '<td>' + objectRecords[i].UseProduct2__r.Asset_Model_No__c + '</td>';
+ } else if (skey == 'UseProduct3__c') {
+ content += '<td>' + objectRecords[i].UseProduct3__r.Asset_Model_No__c + '</td>';
+ } else {
+ content += '<td>' + objectRecords[i][skey] + '</td>';
+ }
+ }
+ content += '</tr>'
+ }
+ content += '</table>';
+ console.log("helper寰幆缁撴潫" + content);
+ component.set("v.TableContent2", content);
+ component.set("v.showMain", false);
+ },
+
+ select_repores_date: function (component, event, helper) {
+ component.set('v.login', true);
+ var reportsdate1 = component.find('input-report-date1').get('v.value');
+ var reportsdate2 = component.find('input-report-date2').get('v.value');
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�' + reportsdate1 + '杈撳叆鐨勭粨鏉熸棩鏈�' + reportsdate2);
+ var action = component.get("c.getReportsByDate");
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�1');
+ action.setParams({
+ date1: reportsdate1,
+ date2: reportsdate2
+ });
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�2');
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var res = response.getReturnValue();
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�3' + res);
+ component.set('v.login', false);
+
+ // PI 鏀归�� By Bright 20220328
+ if (true) {
+ let awsids = [];
+ for (let ri in res) {
+ if (res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c) {
+ awsids.push(res[ri].doctor2__r.AWS_Data_Id__c);
+ }
+ }
+ if (awsids.length > 0) {
+ let PIConfig = component.get('v.PIConfig');
+ let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
+ AWSService.search(staticResourceAgencyContact.searchUrl, {
+ dataIds: awsids
+ }, function (data) {
+ if (data && data.object && data.object.length) {
+ let m = {};
+ for (let di in data.object) {
+ if (data.object[di] && data.object[di].dataId) {
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for (let ri in res) {
+ if (res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)) {
+ res[ri].doctor2__r.Name = m[res[ri].doctor2__r.AWS_Data_Id__c].name;
+ }
+ }
+ }
+ helper.showExportDate(component, res);
+
+ component.set('v.login', false);
+ }, staticResourceAgencyContact.token);
+ } else {
+ helper.showExportDate(component, res);
+ }
+ }
+
+
+ component.set('v.reports_date', res);
+ } else {
+ alert('瀵煎嚭澶辫触,璇锋鏌ユ椿鍔ㄦ棩');
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+
+ },
+
+ showImport: function (component) {
+ var modalimport = component.find('modal_import');
+ var modalimportbg = component.find('modal_importbg');
+ $A.util.removeClass(modalimport, 'disp_none');
+ $A.util.removeClass(modalimportbg, 'disp_none');
+ },
+
+ showExport: function (component) {
+ var modalimport = component.find('modal_export');
+ var modalimportbg = component.find('modal_exportbg');
+ $A.util.removeClass(modalimport, 'disp_none');
+ $A.util.removeClass(modalimportbg, 'disp_none');
+ },
+
+ close_import: function (component) {
+ var modalimport = component.find('modal_import');
+ var modalimportbg = component.find('modal_importbg');
+ $A.util.addClass(modalimport, 'disp_none');
+ $A.util.addClass(modalimportbg, 'disp_none');
+ },
+
+ close_export: function (component) {
+ var modalimport = component.find('modal_export');
+ var modalimportbg = component.find('modal_exportbg');
+ $A.util.addClass(modalimport, 'disp_none');
+ $A.util.addClass(modalimportbg, 'disp_none');
+ },
+ //椤甸潰涓殑鏂板缓鑱屼綅鎸夐挳
+ newlyBuild: function (component, event, helper) {
+ var hospital_id = component.get('v.hospitalLinkId');
+ event.preventDefault(); // stop form submission
+ var fields = component.find("newOpportunityField");
+ var nameer = '';
+ var type = '';
+ var doctorDivision1 = '';
+ fields.forEach(function (field) {
+ if (field.get("v.fieldName") === 'Name') {
+ nameer = field.get("v.value");
+ }
+ if (field.get("v.fieldName") === 'Type__c') {
+ type = field.get("v.value");
+ }
+ if (field.get("v.fieldName") === 'Doctor_Division1__c') {
+ doctorDivision1 = field.get("v.value");
+ }
+ });
+ if (hospital_id) {
+ component.set('v.login', true);
+ var action = component.get('c.newlyBuild');
+ action.setParams({
+ "hospital_id": hospital_id,
+ "nameer": nameer,
+ "type": type,
+ "doctorDivision1": doctorDivision1,
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = this.conv_selected(response.getReturnValue());
+ var default_doctor = component.get('v.default_select_doctor_id');
+ if (default_doctor != '' && res.length > 0) {
+ var doctor_title = '';
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].value == default_doctor) {
+ res[i].selected = true;
+ doctor_title = res[i].Doctor_Division1__c;
+ } else {
+ res[i].selected = false;
+ }
+ }
+ component.find('select_doctor').set('v.options', res);
+ component.set('v.doctor_title', doctor_title);
+ } else {
+ component.find('select_doctor').set('v.options', res);
+ if (res.length > 0) {
+ component.set('v.doctor_title', res[0].Doctor_Division1__c);
+ }
+ }
+ component.set('v.default_select_doctor_id', '');
+ component.set('v.doctor_list', res);
+ component.set('v.login', false);
+ }
+ else {
+ //component.set('v.errorMessage', 'newlyBuild failed.');
+ this.error('newlyBuild failed.');
+ //this.showErrorToast(component);
+ component.set('v.login', false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+ },
+ //绉戝鍚岀被鑰楁潗楠岃瘉蹇呴』杈撳叆鏁板瓧
+ select_ConsumptionOfConsumables: function (component, event, helper) {
+ var sc = event.getSource().get('v.value');
+ if (sc != null) {
+ if (sc.length <= 14) {
+ if (sc.replace(/\D/gi, "")) {
+ component.set("v.select_ConsumptionOfConsumables", sc);
+ } else {
+ //component.set('v.errorMessage', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
+ this.error('浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
+ //this.showErrorToast(component);
+ }
+ } else {
+ //component.set('v.errorMessage', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
+ this.error('浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
+ //this.showErrorToast(component);
+ }
+ }
+ },
+ //浜у搧鐢ㄩ噺楠岃瘉蹇呴』杈撳叆鏁板瓧
+ select_warlocksNumber: function (component, event, helper) {
+ var sc = event.getSource().get('v.value');
+ if (sc != null) {
+ if (sc.length <= 14) {
+ if (sc.replace(/\D/gi, "")) {
+ component.set("v.select_warlocksNumber", sc);
+ } else {
+ //component.set('v.errorMessage', '浜у搧鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
+ this.error('浜у搧鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
+ //this.showErrorToast(component);
+ }
+ } else {
+ //component.set('v.errorMessage', '浜у搧鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
+ this.error('浜у搧鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
+ //this.showErrorToast(component);
+ }
+ }
+ },
+ //宸ヤ綔浼氳褰�
+ selectPurposeType: function (component, event, helper) {
+
+ var doctor_value = component.find('select_purpose_type').get('v.value');
+ // alert(doctor_value);
+ if (doctor_value != '绉戝浼�') {
+ component.find('new_con').set('v.disabled', false);
} else {
- //component.set('v.errorMessage', 'newlyBuild failed.');
- this.error("newlyBuild failed.");
- //this.showErrorToast(component);
- component.set("v.login", false);
+ component.find('new_con').set('v.disabled', true);
}
- });
- $A.enqueueAction(action);
- }
- },
- //绉戝鍚岀被鑰楁潗楠岃瘉蹇呴』杈撳叆鏁板瓧
- select_ConsumptionOfConsumables: function (component, event, helper) {
- var sc = event.getSource().get("v.value");
- if (sc != null) {
- if (sc.length <= 14) {
- if (sc.replace(/\D/gi, "")) {
- component.set("v.select_ConsumptionOfConsumables", sc);
+ if (doctor_value != '') {
+ this.set_doctor_list_edit(component);
+ var action = component.get('c.selectPurposeTypes');
+ action.setParams({
+ 'doctor_value': doctor_value
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.find('select_EffectProgress').set("v.options", JSON.parse(JSON.stringify(res)));
+ }
+ });
+ $A.enqueueAction(action);
} else {
- //component.set('v.errorMessage', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
- this.error("浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!");
- //this.showErrorToast(component);
+ component.find('select_EffectProgress').set('v.options', []);
}
- } else {
- //component.set('v.errorMessage', '浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
- this.error("浜у搧1鍚岀被鑰楁潗绉戝鏈堜娇鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!");
- //this.showErrorToast(component);
- }
- }
- },
- //浜у搧鐢ㄩ噺楠岃瘉蹇呴』杈撳叆鏁板瓧
- select_warlocksNumber: function (component, event, helper) {
- var sc = event.getSource().get("v.value");
- if (sc != null) {
- if (sc.length <= 14) {
- if (sc.replace(/\D/gi, "")) {
- component.set("v.select_warlocksNumber", sc);
+ },
+
+ selectProductClassification: function (component, event, helper) {
+
+ var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
+ if (select_ProductClassification != '') {
+ var action = component.get('c.selectProductClassificationc');
+ action.setParams({
+ "select_ProductClassification": select_ProductClassification
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.find('select_OtherBrandConsumables').set("v.options", JSON.parse(JSON.stringify(res)));
+ }
+ });
+ $A.enqueueAction(action);
} else {
- //component.set('v.errorMessage', '浜у搧鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!');
- this.error("浜у搧鐢ㄩ噺蹇呴』杈撳叆鏁板瓧!");
- //this.showErrorToast(component);
+ component.find('select_OtherBrandConsumables').set('v.options', []);
}
- } else {
- //component.set('v.errorMessage', '浜у搧鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!');
- this.error("浜у搧鐢ㄩ噺鏈�澶氳緭鍏�14浣嶆暟瀛�!");
- //this.showErrorToast(component);
- }
- }
- },
- //宸ヤ綔浼氳褰�
- selectPurposeType: function (component, event, helper) {
- var doctor_value = component.find("select_purpose_type").get("v.value");
- // alert(doctor_value);
- if (doctor_value != "绉戝浼�") {
- component.find("new_con").set("v.disabled", false);
- } else {
- component.find("new_con").set("v.disabled", true);
- }
- if (doctor_value != "") {
- this.set_doctor_list_edit(component);
- var action = component.get("c.selectPurposeTypes");
- action.setParams({
- doctor_value: doctor_value
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component
- .find("select_EffectProgress")
- .set("v.options", JSON.parse(JSON.stringify(res)));
+ this.selectProductCcategory(component);
+ },
+ select_ProductCcategory: function (component, event, helper) {
+ var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value');
+
+ if (select_ProductCcategory != '') {
+ var result = component.find('result');
+ var UserProType = component.get('v.UserProType');
+ //fy
+ $A.util.removeClass(result, 'disp_none');
+ if (UserProType == 'ENG') {
+ $A.util.removeClass(result, 'disp_none');
+ } else {
+ $A.util.addClass(result, 'disp_none');
+ }
+ var action = component.get('c.selectProductCcategory01');
+ action.setParams({
+ "select_ProductCcategory": select_ProductCcategory
+ });
+ action.setCallback(this, function (response) {
+ var state = response.getState();
+ if (state == 'SUCCESS') {
+ var res = response.getReturnValue();
+ component.find('select_productCategories').set("v.options", JSON.parse(JSON.stringify(res)));
+ }
+ });
+ $A.enqueueAction(action);
+ } else {
+ component.find('select_productCategories').set('v.options', []);
+ var result = component.find('result');
+ $A.util.addClass(result, 'disp_none');
}
- });
- $A.enqueueAction(action);
- } else {
- component.find("select_EffectProgress").set("v.options", []);
- }
- },
-
- selectProductClassification: function (component, event, helper) {
- var select_ProductClassification = component
- .find("select_ProductClassification")
- .get("v.value");
- if (select_ProductClassification != "") {
- var action = component.get("c.selectProductClassificationc");
- action.setParams({
- select_ProductClassification: select_ProductClassification
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component
- .find("select_OtherBrandConsumables")
- .set("v.options", JSON.parse(JSON.stringify(res)));
+ },
+ selectpurposetype: function (component, event, helper) {
+ var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value');
+ if (select_ProductCcategory == null && select_ProductCcategory == undefined && select_ProductCcategory == '') {
+ var result = component.find('result');
+ // $A.util.removeClass(result, 'disp_none');
+ if (UserProType == 'ENG') {
+ $A.util.removeClass(result, 'disp_none');
+ } else {
+ $A.util.addClass(result, 'disp_none');
+ }
+ } else {
+
+ component.find('select_productCategories').set('v.value', '');
+ var result = component.find('result');
+ $A.util.addClass(result, 'disp_none');
+ this.select_ProductCcategory(component);
}
- });
- $A.enqueueAction(action);
- } else {
- component.find("select_OtherBrandConsumables").set("v.options", []);
- }
- this.selectProductCcategory(component);
- },
- select_ProductCcategory: function (component, event, helper) {
- var select_ProductCcategory = component
- .find("select_ProductCcategory")
- .get("v.value");
-
- if (select_ProductCcategory != "") {
- var result = component.find("result");
- var UserProType = component.get("v.UserProType");
- //fy
- $A.util.removeClass(result, "disp_none");
- if (UserProType == "ENG") {
- $A.util.removeClass(result, "disp_none");
- } else {
- $A.util.addClass(result, "disp_none");
- }
- var action = component.get("c.selectProductCcategory01");
- action.setParams({
- select_ProductCcategory: select_ProductCcategory
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component
- .find("select_productCategories")
- .set("v.options", JSON.parse(JSON.stringify(res)));
+ },
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+ CallBackAction: function (component, action_name, para, callback) {
+ var action = component.get("c." + action_name.trimStart().replace("c.", ""));
+ if (para) {
+ action.setParams(para);
}
- });
- $A.enqueueAction(action);
- } else {
- component.find("select_productCategories").set("v.options", []);
- var result = component.find("result");
- $A.util.addClass(result, "disp_none");
- }
- },
- selectpurposetype: function (component, event, helper) {
- var select_ProductCcategory = component
- .find("select_ProductCcategory")
- .get("v.value");
- if (
- select_ProductCcategory == null &&
- select_ProductCcategory == undefined &&
- select_ProductCcategory == ""
- ) {
- var result = component.find("result");
- // $A.util.removeClass(result, 'disp_none');
- if (UserProType == "ENG") {
- $A.util.removeClass(result, "disp_none");
- } else {
- $A.util.addClass(result, "disp_none");
- }
- } else {
- component.find("select_productCategories").set("v.value", "");
- var result = component.find("result");
- $A.util.addClass(result, "disp_none");
- this.select_ProductCcategory(component);
- }
- },
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
- CallBackAction: function (component, action_name, para, callback) {
- var action = component.get(
- "c." + action_name.trimStart().replace("c.", "")
- );
- if (para) {
- action.setParams(para);
- }
- if (callback) {
- action.setCallback(this, function (data) {
- callback(data);
- });
- }
-
- $A.enqueueAction(action);
- },
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
-
- //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 start
- exportErrorInfoHelper: function (component) {
- var errorData = component.get("v.errorData");
- var errorColumns = component.get("v.errorColumns");
-
- var datas = [];
- let errorColumnsArray = [];
- for (var i in errorColumns) {
- errorColumnsArray.push(errorColumns[i].label);
- }
- datas.push(errorColumnsArray);
- //datas.push(errorColumns);
-
- for (var i in errorData) {
- let data = [];
- data.push(errorData[i].errorRow);
- data.push(errorData[i].errorInfo);
- for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) {
- data.push(errorData[i]["field" + j]);
- }
- datas.push(data);
- }
-
- console.log("datas = " + JSON.stringify(datas));
- var csv = this.convertToCSV(component, datas);
- console.log("csv = " + JSON.stringify(csv));
- this.downloadCSV(component, csv);
- },
-
- convertToCSV: function (component, data) {
- console.log("enter convertToCSV");
- console.log("data = " + data);
- var csv = "";
- for (var i = 0; i < data.length; i++) {
- var row = data[i];
- console.log("row = " + JSON.stringify(row));
- for (var j = 0; j < row.length; j++) {
- var val = "";
- val = row[j] === null ? "" : row[j].toString();
- console.log("val = " + val);
- if (
- val.indexOf(",") !== -1 ||
- val.indexOf('"') !== -1 ||
- val.indexOf("\n") !== -1
- ) {
- //val = '"' + val.replace(/"/g,'""') + '"';
+ if (callback) {
+ action.setCallback(this, function (data) {
+ callback(data);
+ });
}
- if (j > 0) {
- csv += ",";
+
+ $A.enqueueAction(action);
+ },
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+
+ //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 start
+ exportErrorInfoHelper: function (component) {
+ var errorData = component.get('v.errorData');
+ var errorColumns = component.get('v.errorColumns');
+
+ var datas = [];
+ let errorColumnsArray = [];
+ for (var i in errorColumns) {
+ errorColumnsArray.push(errorColumns[i].label);
}
- csv += val;
- }
- csv += "\n";
- }
- return csv;
- },
+ datas.push(errorColumnsArray);
+ //datas.push(errorColumns);
- downloadCSV: function (component, csv) {
- var link = document.createElement("a");
- var bom = "\uFEFF";
- link.href = "data:text/csv;charset=utf-8," + encodeURIComponent(bom + csv);
- link.download = "data.csv";
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- },
- error: function (message) {
- // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap');
- var toastEvent = $A.get("e.force:showToast");
+ for (var i in errorData) {
+ let data = [];
+ data.push(errorData[i].errorRow)
+ data.push(errorData[i].errorInfo)
+ for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) {
+ data.push(errorData[i]['field' + j])
+ }
+ datas.push(data);
+ }
- toastEvent.setParams({
- title: "閿欒!",
- message: message,
- type: "error"
- //"duration" : "sticky"
- });
- toastEvent.fire();
- }
- //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 end
-});
+ console.log('datas = ' + JSON.stringify(datas));
+ var csv = this.convertToCSV(component, datas);
+ console.log('csv = ' + JSON.stringify(csv))
+ this.downloadCSV(component, csv);
+ },
+
+ convertToCSV: function (component, data) {
+ console.log('enter convertToCSV')
+ console.log('data = ' + data);
+ var csv = '';
+ for (var i = 0; i < data.length; i++) {
+ var row = data[i];
+ console.log('row = ' + JSON.stringify(row));
+ for (var j = 0; j < row.length; j++) {
+ var val = '';
+ val = row[j] === null ? '' : row[j].toString();
+ console.log('val = ' + val);
+ if (val.indexOf(',') !== -1 || val.indexOf('"') !== -1 || val.indexOf('\n') !== -1) {
+ //val = '"' + val.replace(/"/g,'""') + '"';
+ }
+ if (j > 0) {
+ csv += ',';
+ }
+ csv += val;
+ }
+ csv += '\n';
+ }
+ return csv;
+ },
+
+ downloadCSV: function (component, csv) {
+ var link = document.createElement('a');
+ var bom = "\uFEFF";
+ link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
+ link.download = 'data.csv';
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ },
+ error: function (message) {
+ // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap');
+ var toastEvent = $A.get("e.force:showToast");
+
+ toastEvent.setParams({
+ "title": "閿欒!",
+ "message": message,
+ "type": "error",
+ //"duration" : "sticky"
+ });
+ toastEvent.fire();
+ },
+ //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 end
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp b/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
index 831f94a..8b827ee 100644
--- a/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
+++ b/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
@@ -1,533 +1,321 @@
-<aura:component
- controller="WeeklyReportCmp"
- implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes"
- access="global"
->
- <ltng:require styles="{!$Resource.multilineToastCSS}" />聽
- <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
- <aura:handler
- event="c:strike_evt"
- action="{!c.createAopp}"
- name="strike_evt_addNewRecord"
- />
- <aura:attribute
- name="data"
- type="Agency_Report__c"
- default="{sobjectType:'Agency_Report__c'}"
- />
- <aura:attribute
- name="oppdata"
- type="Agency_Opportunity__c"
- default="{sobjectType:'Agency_Opportunity__c'}"
- />
- <aura:attribute
- name="acondata"
- type="Agency_Contact__c"
- default="{sobjectType:'Agency_Contact__c'}"
- />
- <!-- <aura:attribute name="oppdata_old" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}"/> -->
- <aura:attribute name="Close_Forecasted_Date__c_o" type="Date" />
- <aura:attribute name="Amount__c_o" type="String" />
- <aura:attribute name="OCMSale_Price__c_o" type="String" />
- <aura:attribute name="StageName__c_o" type="String" />
- <aura:attribute name="fieldsmap" type="Map" />
- <aura:attribute name="alldata" type="List" />
- <aura:attribute name="allselectlist" type="Map" />
- <aura:attribute name="doclist" type="List" />
- <aura:attribute name="docmap" type="Map" />
- <aura:attribute name="login" type="Boolean" default="false" />
- <aura:attribute name="loginEdit" type="Boolean" default="false" />
- <aura:attribute name="loadOpp" type="Boolean" default="false" />
- <aura:attribute name="reportPageData" type="Map" />
- <aura:attribute name="selectbody" type="String" />
- <aura:attribute name="report_date_list" type="Map" />
- <aura:attribute name="selected_date" type="String" />
- <aura:attribute name="selected_agency_person" type="String" />
- <aura:attribute name="agency_report_header" type="String" />
- <aura:attribute name="agency_report_header_id" type="String" />
- <aura:attribute name="result" type="String" default="" />
- <aura:attribute name="hospital" type="string" default="" />
- <aura:attribute name="hospitalId" type="string" default="" />
- <aura:attribute name="hospitalLinkId" type="string" default="" />
- <aura:handler name="change" value="{!v.hospital}" action="{!c.hosChange}" />
- <aura:attribute name="hospitalList" type="Map" />
- <aura:attribute name="doctor_list" type="Map" />
- <aura:attribute name="doctor_title" type="String" />
- <aura:attribute name="opportunity_list" type="Map" />
- <aura:handler
- name="change"
- value="{!v.data.Opportunity__c}"
- action="{!c.opportunityChange}"
- />
- <aura:attribute name="edit_copy_select_report_id" type="String" />
- <aura:attribute name="create_agency_report_id" type="String" />
- <aura:attribute name="reports" type="List" />
- <aura:attribute name="reports_now" type="List" />
- <aura:attribute name="reports_now_count" type="Integer" />
- <aura:attribute name="mode" type="String" />
- <aura:attribute name="select_report_data" type="Map" />
- <aura:attribute name="select_report_data_radio" type="Map" />
- <aura:attribute name="default_select_doctor_id" type="String" />
- <aura:attribute name="default_select_opportunity_id" type="String" />
- <aura:attribute name="report_count" type="Integer" />
- <aura:attribute name="dialog_type" type="String" />
- <aura:attribute name="truthy" type="Boolean" default="false" />
- <aura:attribute name="list_message" type="String" default="鎼滅储" />
- <aura:attribute name="confirm_status" type="Integer" default="0" />
- <aura:attribute name="modal_confirm_title" type="String" />
- <aura:attribute name="modal_confirm_text" type="String" />
- <aura:attribute name="opportunity_cfilter" type="String" />
- <!-- <aura:handler name="change" value="{!v.data.Product_Category1__c}" action="{!c.productcategoryChange1}"/>
+<aura:component controller="WeeklyReportCmp" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes" access="global" >
+ <ltng:require styles="{!$Resource.multilineToastCSS}" />聽
+ <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
+ <aura:handler event="c:strike_evt" action="{!c.createAopp}" name="strike_evt_addNewRecord"/>
+ <aura:attribute name="data" type="Agency_Report__c" default="{sobjectType:'Agency_Report__c'}"/>
+ <aura:attribute name="oppdata" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}"/>
+ <aura:attribute name="acondata" type="Agency_Contact__c" default="{sobjectType:'Agency_Contact__c'}"/>
+ <!-- <aura:attribute name="oppdata_old" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}"/> -->
+ <aura:attribute name="Close_Forecasted_Date__c_o" type="Date"/>
+ <aura:attribute name="Amount__c_o" type="String"/>
+ <aura:attribute name="OCMSale_Price__c_o" type="String"/>
+ <aura:attribute name="StageName__c_o" type="String"/>
+ <aura:attribute name="fieldsmap" type="Map"/>
+ <aura:attribute name="alldata" type="List"/>
+ <aura:attribute name="allselectlist" type="Map"/>
+ <aura:attribute name="doclist" type="List"/>
+ <aura:attribute name="docmap" type="Map"/>
+ <aura:attribute name="login" type="Boolean" default="false"/>
+ <aura:attribute name="loginEdit" type="Boolean" default="false" />
+ <aura:attribute name="loadOpp" type="Boolean" default="false"/>
+ <aura:attribute name="reportPageData" type="Map"/>
+ <aura:attribute name="selectbody" type="String"/>
+ <aura:attribute name="report_date_list" type="Map"/>
+ <aura:attribute name="selected_date" type="String"/>
+ <aura:attribute name="selected_agency_person" type="String"/>
+ <aura:attribute name="agency_report_header" type="String"/>
+ <aura:attribute name="agency_report_header_id" type="String"/>
+ <aura:attribute name="result" type="String" default=""/>
+ <aura:attribute name="hospital" type="string" default=""/>
+ <aura:attribute name="hospitalId" type="string" default=""/>
+ <aura:attribute name="hospitalLinkId" type="string" default=""/>
+ <aura:handler name="change" value="{!v.hospital}" action="{!c.hosChange}"/>
+ <aura:attribute name="hospitalList" type="Map" />
+ <aura:attribute name="doctor_list" type="Map"/>
+ <aura:attribute name="doctor_title" type="String"/>
+ <aura:attribute name="opportunity_list" type="Map"/>
+ <aura:handler name="change" value="{!v.data.Opportunity__c}" action="{!c.opportunityChange}"/>
+ <aura:attribute name="edit_copy_select_report_id" type="String"/>
+ <aura:attribute name="create_agency_report_id" type="String"/>
+ <aura:attribute name="reports" type="List"/>
+ <aura:attribute name="reports_now" type="List"/>
+ <aura:attribute name="reports_now_count" type="Integer"/>
+ <aura:attribute name="mode" type="String"/>
+ <aura:attribute name="select_report_data" type="Map"/>
+ <aura:attribute name="select_report_data_radio" type="Map"/>
+ <aura:attribute name="default_select_doctor_id" type="String"/>
+ <aura:attribute name="default_select_opportunity_id" type="String"/>
+ <aura:attribute name="report_count" type="Integer"/>
+ <aura:attribute name="dialog_type" type="String"/>
+ <aura:attribute name="truthy" type="Boolean" default="false"/>
+ <aura:attribute name="list_message" type="String" default="鎼滅储" />
+ <aura:attribute name="confirm_status" type="Integer" default="0" />
+ <aura:attribute name="modal_confirm_title" type="String" />
+ <aura:attribute name="modal_confirm_text" type="String" />
+ <aura:attribute name="opportunity_cfilter" type="String" />
+ <!-- <aura:handler name="change" value="{!v.data.Product_Category1__c}" action="{!c.productcategoryChange1}"/>
<aura:handler name="change" value="{!v.data.Product_Category2__c}" action="{!c.productcategoryChange2}"/>
<aura:handler name="change" value="{!v.data.Product_Category3__c}" action="{!c.productcategoryChange3}"/> -->
- <!-- <aura:handler name="change" value="{!v.oppdata.StageName__c}" action="{!c.stageNameChange}"/> -->
- <aura:attribute
- name="update_select_report_data_id"
- type="String"
- default=""
- />
+ <!-- <aura:handler name="change" value="{!v.oppdata.StageName__c}" action="{!c.stageNameChange}"/> -->
+ <aura:attribute name="update_select_report_data_id" type="String" default=""/>
- <!-- 鎵归噺娣诲姞鍛ㄦ姤 start-->
- <aura:attribute name="reports_date" type="List" />
- <!-- <aura:attribute name="reports_date1" type="Date" />
+ <!-- 鎵归噺娣诲姞鍛ㄦ姤 start-->
+ <aura:attribute name="reports_date" type="List" />
+ <!-- <aura:attribute name="reports_date1" type="Date" />
<aura:attribute name="reports_date2" type="Date" /> -->
- <aura:attribute
- name="TableContent"
- type="String"
- description=" Show the Result class"
- />
- <aura:attribute
- name="TableContent2"
- type="String"
- description=" Show the Result class"
- />
- <aura:attribute
- name="TargetFileName"
- type="String"
- description="Name of the file"
- />
- <aura:attribute name="tableheaders" type="Object[]" />
- <aura:attribute name="fileContentData" type="String" />
- <aura:attribute name="filename" type="String" />
- <!-- It will display 100 records . Change for your requirement-->
- <aura:attribute name="NumOfRecords" type="Integer" default="1000" />
- <aura:attribute name="showMain" type="Boolean" default="true" />
- <!-- PIPL update Yin Mingjie 21/02/2022 start -->
- <aura:attribute name="AWStoken" type="String" />
- <aura:attribute name="AWSsearch" type="String" />
- <aura:attribute name="AWSinsert" type="String" />
- <aura:attribute name="AWStransactionURL" type="String" />
- <aura:attribute name="AWSDoctor2Map" type="String" />
- <aura:attribute name="awsurl" type="Map" />
- <aura:attribute name="contactawsurl" type="Map" />
- <aura:attribute name="allselectlistAgencyPerson" type="Map" />
- <!-- PIPL update Yin Mingjie 21/02/2022 end -->
+ <aura:attribute name="TableContent" type="String" description=" Show the Result class"/>
+ <aura:attribute name="TableContent2" type="String" description=" Show the Result class"/>
+ <aura:attribute name="TargetFileName" type="String" description="Name of the file"/>
+ <aura:attribute name="tableheaders" type="Object[]" />
+ <aura:attribute name="fileContentData" type="String"/>
+ <aura:attribute name="filename" type="String"/>
+ <!-- It will display 100 records . Change for your requirement-->
+ <aura:attribute name="NumOfRecords" type="Integer" default="1000"/>
+ <aura:attribute name="showMain" type="Boolean" default="true"/>
+ <!-- PIPL update Yin Mingjie 21/02/2022 start -->
+ <aura:attribute name="AWStoken" type="String"/>
+ <aura:attribute name="AWSsearch" type="String"/>
+ <aura:attribute name="AWSinsert" type="String"/>
+ <aura:attribute name="AWStransactionURL" type="String"/>
+ <aura:attribute name="AWSDoctor2Map" type="String"/>
+ <aura:attribute name="awsurl" type="Map"/>
+ <aura:attribute name="contactawsurl" type="Map"/>
+ <aura:attribute name="allselectlistAgencyPerson" type="Map"/>
+ <!-- PIPL update Yin Mingjie 21/02/2022 end -->
- <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <aura:attribute name="errorData" type="Object" />
- <aura:attribute name="errorColumns" type="List" />
- <!-- show Error information -->
- <aura:attribute name="showErrorInfo" type="Boolean" default="false" />
- <!-- end DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
+ <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
+ <aura:attribute name="errorData" type="Object" />
+ <aura:attribute name="errorColumns" type="List" />
+ <!-- show Error information -->
+ <aura:attribute name="showErrorInfo" type="Boolean" default="false" />
+ <!-- end DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <!-- 鎵归噺娣诲姞鍛ㄦ姤 end-->
- <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
- <ltng:require scripts="{! $Resource.jquery183minjs }" />
-
- <!--銉兗銉変腑...-->
- <aura:renderIf isTrue="{!v.login}">
- <aura:renderIf isTrue="{!!v.loginEdit}">
- <!-- add by Deloitte-Link 2023-6-19 -->
- <div class="weeklyReportSpinner">
- <div class="slds-spinner_container">
- <div
- class="slds-spinner--brand slds-spinner slds-spinner--medium"
- role="alert"
- >
- <span id="aa" class="slds-assistive-text">Loading</span>
- <div class="slds-spinner__dot-a"></div>
- <div class="slds-spinner__dot-b"></div>
- </div>
- </div>
- </div>
+ <!-- 鎵归噺娣诲姞鍛ㄦ姤 end-->
+ <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
+ <ltng:require scripts="{! $Resource.jquery183minjs }" />
+
+ <!--銉兗銉変腑...-->
+ <aura:renderIf isTrue="{!v.login}">
+ <aura:renderIf isTrue="{!!v.loginEdit}">
+ <!-- add by Deloitte-Link 2023-6-19 -->
+ <div class="weeklyReportSpinner">
+ <div class="slds-spinner_container">
+ <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
+ <span id="aa" class="slds-assistive-text">Loading</span>
+ <div class="slds-spinner__dot-a"></div>
+ <div class="slds-spinner__dot-b"></div>
+ </div>
+ </div>
+ </div>
+ </aura:renderIf>
</aura:renderIf>
- </aura:renderIf>
-
- <div aura:id="report" id="report" class="contents_wrapper">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div
- class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
- >
- 鍛�
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
- >
- <ui:inputSelect
- aura:id="select_date"
- class="slds-select"
- change="{!c.select_date_change}"
- />
- </div>
-
- <!-- 浠g悊搴楁媴褰撹�� -->
- <div
- class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
- >
- {!v.fieldsmap.Person_In_Charge2__c}
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
- >
- <ui:inputSelect
- aura:id="select_agency_person"
- class="slds-select agency_person_select"
- change="{!c.select_agency_change}"
- />
- </div>
- <div
- class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
- >
- <ui:button
- aura:id="new_button"
- label="鏂板缓"
- press="{!c.new_report}"
- disabled="true"
- />
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
- >
- <ui:button
- aura:id="copy_button"
- label="澶嶅埗"
- press="{!c.copy_button}"
- disabled="true"
- />
- <!-- <ui:button aura:id="import" label="瀵煎叆" press="{!c.import}" /> -->
- <ui:button aura:id="import" label="瀵煎叆" press="{!c.import}" />
-
- <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}" style="position:absolute;filter:alpha(opacity=0);" size="1" hidden="true" /> -->
- <!-- <ui:button aura:id="import" label="瀵煎嚭" press="{!c.export}"/> -->
- <ui:button
- aura:id="export"
- label="瀵煎嚭"
- press="{!c.export_condition}"
- />
- </div>
+
+ <div aura:id="report" id="report" class="contents_wrapper">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded">
+ <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
+ 鍛�
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
+ <ui:inputSelect aura:id="select_date" class="slds-select" change="{!c.select_date_change}"/>
+ </div>
+
+ <!-- 浠g悊搴楁媴褰撹�� -->
+ <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
+ {!v.fieldsmap.Person_In_Charge2__c}
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
+ <ui:inputSelect aura:id="select_agency_person" class="slds-select agency_person_select" change="{!c.select_agency_change}"/>
+ </div>
+ <div class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
+ <ui:button aura:id="new_button" label="鏂板缓" press="{!c.new_report}" disabled="true"/>
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
+ <ui:button aura:id="copy_button" label="澶嶅埗" press="{!c.copy_button}" disabled="true"/>
+ <!-- <ui:button aura:id="import" label="瀵煎叆" press="{!c.import}" /> -->
+ <ui:button aura:id="import" label="瀵煎叆" press="{!c.import}" />
+
+ <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}" style="position:absolute;filter:alpha(opacity=0);" size="1" hidden="true" /> -->
+ <!-- <ui:button aura:id="import" label="瀵煎嚭" press="{!c.export}"/> -->
+ <ui:button aura:id="export" label="瀵煎嚭" press="{!c.export_condition}"/>
+ </div>
+
+ </div>
</div>
- </div>
-
- <div aura:id="report_list" class="report_list_area">
- <div class="slds-table--edit_container slds-is-relative">
- <table
- class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
- role="grid"
- style="width: 66.75rem"
- >
- <thead>
- <tr class="slds-line-height--reset">
- <th
- class="table_header slds-text-title--caps"
- style="width: 250px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name">鍛ㄦ姤缂栧彿</span>
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 100px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Person_In_Charge2__c}</span
- >
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 250px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name">鍖婚櫌</span>
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 100px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Department_Cateogy__c}</span
- >
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 100px; font-size: 13px"
- >
- <!-- PIPL update Yin Mingjie 21/02/2022 start
+
+ <div aura:id="report_list" class="report_list_area" >
+ <div class="slds-table--edit_container slds-is-relative">
+ <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus" role="grid" style="width:66.75rem;">
+ <thead>
+ <tr class="slds-line-height--reset">
+ <th class="table_header slds-text-title--caps" style="width: 250px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">鍛ㄦ姤缂栧彿</span>
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 250px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">鍖婚櫌</span>
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
+ <!-- PIPL update Yin Mingjie 21/02/2022 start
<span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__r}</span>
PIPL update Yin Mingjie 21/02/2022 end-->
- <span
- class="slds-truncate"
- title="Name"
- style="width: 100px; font-size: 13px"
- >{!v.fieldsmap.Agency_Contact__c}</span
- >
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 100px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.visitor_title__c}</span
- >
- </th>
- <th
- class="table_header slds-text-title--caps"
- style="width: 100px; font-size: 13px"
- >
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Purpose_Type__c}</span
- >
- </th>
- </tr>
- </thead>
- <tbody>
- <aura:iteration items="{!v.reports}" var="item" indexVar="index">
- <tr class="slds-hint-parent">
- <td role="gridcell" class="slds-cell-edit">
- <ui:inputRadio
- class="report_radio"
- name="report_radio"
- label="{!item.Name}"
- change="{!c.change_report_radio}"
- />
- <lightning:buttonIcon
- class="edit_button"
- iconName="utility:edit"
- size="small"
- alternativeText="edit"
- value="{!index}"
- onclick="{!c.edit_button}"
- />
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Person_In_Charge2__r.Name}"
- >
- {!item.Person_In_Charge2__r.Name}
- <!-- <span class="decrypt">{!item.Person_In_Charge2__r.awsdata.lastName}</span> -->
- </span>
- </span>
- </td>
- <th scope="row" tabindex="0" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- {!item.Agency_Hospital__r.Name}
- </span>
- </th>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy__c}"
- >{!item.Department_Cateogy__c}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span class="slds-truncate" title="{!item.doctor2__r.Name}">
- <span class="encrypt">{!item.doctor2__r.Name}</span>
- <span class="decrypt">{!item.doctor2__r.awsdata.name}</span>
- </span>
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span class="slds-truncate" title="{!item.visitor_title__c}">
- <span class="encrypt">{!item.visitor_title__c}</span>
- <span class="decrypt"
- >{!item.doctor2__r.awsdata.doctorDivision1}</span
- >
- </span>
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span class="slds-truncate" title="{!item.Purpose_Type__c}"
- >{!item.Purpose_Type__c}</span
- >
- </span>
- </td>
- </tr>
- </aura:iteration>
- </tbody>
- </table>
- </div>
- <aura:renderIf isTrue="{!v.report_count > 0}">
- <aura:set attribute="else">
- <div class="no_data_area">{!v.list_message}</div>
- </aura:set>
- </aura:renderIf>
- </div>
-
- <!-- <ui:button aura:id="test_button" label="test" class="fade animation_on" press="{!c.test}"/>-->
- <!-- 鎵归噺娣诲姞鍛ㄦ姤 start-->
- <div
- aura:id="modal_import"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- aria-labelledby="headerTarget"
- >
- <div class="slds-modal__container">
- <aura:renderIf isTrue="{!v.loginEdit}">
- <lightning:spinner
- alternativeText="Loading"
- size="medium"
- style="width: 100%; height: 80%; top: 50px"
- />
- </aura:renderIf>
- <div class="slds-modal__header">
- <h4 id="headerTarget" class="slds-float--left"></h4>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鍛ㄦ姤鎵归噺瀵煎叆
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1"
- press="{!c.close_import}"
- />
- </div>
- <div
- class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
- >
- <aura:if isTrue="{!v.showMain}">
- <div>
- <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}" value="瀵煎叆" /> -->
- <lightning:input
- type="file"
- class="file"
- uara:id="file"
- onchange="{!c.CreateRecord}"
- />
- <!-- <ui:button label="Create Accounts" press="{!c.CreateRecord}"/> -->
- </div>
- <aura:set attribute="else">
- <!-- <ui:outputRichText class="uiOutputRichText slds-m-around-large" value="{!v.TargetFileName}"/> -->
- <ui:outputRichText
- class="uiOutputRichText slds-m--around-large"
- value="{!v.TableContent}"
- />
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="淇濆瓨"
- variant="brand"
- onclick="{!c.processFileContent}"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.cancel}"
- />
- </div>
- <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- <aura:if isTrue="{!v.showErrorInfo}">
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="瀵煎嚭閿欒淇℃伅"
- variant="brand"
- onclick="{!c.exportErrorInfo}"
- />
- </div>
- <div class="slds-p-around--large slds-align--absolute-center">
- <div style="height: 300px; overflow-x: scroll">
- <lightning:datatable
- keyField="id"
- data="{! v.errorData }"
- columns="{! v.errorColumns }"
- hideCheckboxColumn="true"
- />
+ <span class="slds-truncate" title="Name" style="width: 100px;font-size: 13px;">{!v.fieldsmap.Agency_Contact__c}</span>
+
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Purpose_Type__c}</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <aura:iteration items="{!v.reports}" var="item" indexVar="index">
+ <tr class="slds-hint-parent">
+ <td role="gridcell" class="slds-cell-edit">
+ <ui:inputRadio class="report_radio" name="report_radio" label="{!item.Name}" change="{!c.change_report_radio}"/>
+ <lightning:buttonIcon class="edit_button" iconName="utility:edit" size="small" alternativeText="edit" value="{!index}" onclick="{!c.edit_button}"/>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Person_In_Charge2__r.Name}">
+ {!item.Person_In_Charge2__r.Name}
+ <!-- <span class="decrypt">{!item.Person_In_Charge2__r.awsdata.lastName}</span> -->
+ </span>
+ </span>
+ </td>
+ <th scope="row" tabindex="0" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ {!item.Agency_Hospital__r.Name}
+ </span>
+ </th>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Department_Cateogy__c}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.doctor2__r.Name}">
+ <span class="encrypt">{!item.doctor2__r.Name}</span>
+ <span class="decrypt">{!item.doctor2__r.awsdata.name}</span>
+ </span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.visitor_title__c}">
+ <span class="encrypt">{!item.visitor_title__c}</span>
+ <span class="decrypt">{!item.doctor2__r.awsdata.doctorDivision1}</span>
+ </span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Purpose_Type__c}">{!item.Purpose_Type__c}</span>
+ </span>
+ </td>
+ </tr>
+ </aura:iteration>
+ </tbody>
+ </table>
+ </div>
+ <aura:renderIf isTrue="{!v.report_count > 0}">
+ <aura:set attribute="else">
+ <div class="no_data_area">
+ {!v.list_message}
</div>
- </div>
- </aura:if>
- <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
- </aura:set>
- </aura:if>
- </div>
+ </aura:set>
+ </aura:renderIf>
</div>
- </div>
- <div
- aura:id="modal_importbg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
- <!-- 鎵归噺娣诲姞鍛ㄦ姤 end-->
- <!-- 鎵归噺瀵煎嚭鍛ㄦ姤 start-->
- <div
- aura:id="modal_export"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h4 id="headerTarget" class="slds-float--left"></h4>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鍛ㄦ姤鎵归噺瀵煎嚭
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1"
- press="{!c.close_export}"
- />
- </div>
- <div
- class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
- >
- <aura:if isTrue="{!v.showMain}">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- ></div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- >
- 娲诲姩鏃ュ紑濮嬫棩鏈�
+ <!-- <ui:button aura:id="test_button" label="test" class="fade animation_on" press="{!c.test}"/>-->
+ <!-- 鎵归噺娣诲姞鍛ㄦ姤 start-->
+ <div aura:id="modal_import" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
+ <div class="slds-modal__container ">
+ <aura:renderIf isTrue="{!v.loginEdit}">
+ <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
+ </aura:renderIf>
+ <div class="slds-modal__header ">
+ <h4 id="headerTarget" class="slds-float--left"></h4>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鍛ㄦ姤鎵归噺瀵煎叆</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_import}"/>
+ </div>
+ <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium " >
+ <aura:if isTrue="{!v.showMain}">
+ <div>
+ <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}" value="瀵煎叆" /> -->
+ <lightning:input type="file" class="file" uara:id="file" onchange="{!c.CreateRecord}" />
+ <!-- <ui:button label="Create Accounts" press="{!c.CreateRecord}"/> -->
+ </div>
+ <aura:set attribute="else">
+ <!-- <ui:outputRichText class="uiOutputRichText slds-m-around-large" value="{!v.TargetFileName}"/> -->
+ <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent}"/>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="淇濆瓨" variant="brand" onclick="{!c.processFileContent}"
+ />
+ <lightning:button label="鍙栨秷" variant="brand"
+ onclick="{!c.cancel}" />
+ </div>
+ <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
+ <aura:if isTrue="{!v.showErrorInfo}">
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="瀵煎嚭閿欒淇℃伅" variant="brand" onclick="{!c.exportErrorInfo}" />
+ </div>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <div style="height: 300px;overflow-x:scroll">
+ <lightning:datatable keyField="id" data="{! v.errorData }"
+ columns="{! v.errorColumns }" hideCheckboxColumn="true" />
+ </div>
+ </div>
+ </aura:if>
+ <!-- start DTT-zhj 澧炲姞閿欒淇℃伅table 2023-05-16-->
+ </aura:set>
+ </aura:if>
+ </div>
+ </div>
+ </div>
+ <div aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+ <!-- 鎵归噺娣诲姞鍛ㄦ姤 end-->
- <lightning:input
- type="Date"
- class="slds-input slds-input_bare"
- aura:id="input-report-date1"
- />
+ <!-- 鎵归噺瀵煎嚭鍛ㄦ姤 start-->
+ <div aura:id="modal_export" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" >
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <h4 id="headerTarget" class="slds-float--left"></h4>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鍛ㄦ姤鎵归噺瀵煎嚭</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_export}"/>
</div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- >
- 娲诲姩鏃ョ粨鏉熸棩鏈�
- <lightning:input
- type="Date"
- class="slds-input slds-input_bare"
- aura:id="input-report-date2"
- />
- </div>
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
- ></div>
+ <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium">
+ <aura:if isTrue="{!v.showMain}">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded" >
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ 娲诲姩鏃ュ紑濮嬫棩鏈�
+
+ <lightning:input type="Date" class="slds-input slds-input_bare " aura:id="input-report-date1" />
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ 娲诲姩鏃ョ粨鏉熸棩鏈�
+ <lightning:input type="Date" class="slds-input slds-input_bare " aura:id="input-report-date2" />
+ </div>
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
+ </div>
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="纭"
- variant="brand"
- onclick="{!c.select_repores_date}"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.close_export}"
- />
- </div>
- </div>
- <!-- <div>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="纭" variant="brand" onclick="{!c.select_repores_date}"
+ />
+ <lightning:button label="鍙栨秷" variant="brand"
+ onclick="{!c.close_export}" />
+ </div>
+ </div>
+ <!-- <div>
璇疯緭鍏ヨ瀵煎嚭鏃ユ姤鐨勬姤娲诲姩鏃ョ殑寮�濮嬪拰缁撴潫鏃ユ湡
<force:inputField aura:id="input-report-date1"/>鍒�
<force:inputField aura:id="input-report-date2"/>
@@ -536,530 +324,296 @@
<lightning:button label="鍙栨秷" variant="brand"
onclick="{!c.close_export}" />
</div> -->
- <aura:set attribute="else">
- <ui:outputRichText
- class="uiOutputRichText slds-m--around-large"
- value="{!v.TableContent2}"
- />
- <div class="slds-p-around--large slds-align--absolute-center">
- <lightning:button
- label="纭"
- variant="brand"
- onclick="{!c.exportDate}"
- />
- <lightning:button
- label="鍙栨秷"
- variant="brand"
- onclick="{!c.close_export}"
- />
- </div>
- </aura:set>
- </aura:if>
- </div>
- </div>
- </div>
- <div
- aura:id="modal_exportbg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
- <!-- 鎵归噺瀵煎嚭鍛ㄦ姤 end-->
-
- <div
- aura:id="modal_window"
- role="dialog"
- tabindex="-1"
- class="disp_none slds-modal slds-fade-in-open slds-modal--large"
- aria-labelledby="headerTarget"
- >
- <div class="slds-modal__container">
- <aura:renderIf isTrue="{!v.loginEdit}">
- <lightning:spinner
- alternativeText="Loading"
- size="medium"
- style="width: 100%; height: 80%; top: 50px"
- />
- </aura:renderIf>
- <div class="slds-modal__header">
- <h4 id="headerTarget" class="slds-float--left"></h4>
- <h2 id="headerTarget" class="slds-text-heading--medium">
- 鍛ㄦ姤({!v.selected_date} {!v.selected_agency_person})
- </h2>
- <ui:button
- aura:id="close_button"
- label="鍏抽棴"
- class="close_button slds-button slds-button--neutral slds-order--1"
- press="{!c.toggle_report}"
- />
- </div>
- <div class="slds-modal__content slds-grow slds-p-around--medium">
- <div class="slds-box slds-theme--shade">
- <div class="slds-grid slds-wrap slds-grid--pull-padded">
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
- >
- 娲诲姩鏃�
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <!-- <force:inputField value="{!v.data.Report_Date__c}" aura:id="input-report-date"/> -->
- <lightning:input
- type="date"
- value="{!v.data.Report_Date__c}"
- aura:id="input-report-date"
- variant="label-hidden"
- />
- </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"/> -->
- 鍖婚櫌
- <lightning:input
- aura:id="hospital_input_text"
- class="field"
- value="{!v.hospital}"
- variant="label-hidden"
- updateOn="keyup"
- />
- <div class="slds-lookup__menu" id="lookup-66">
- <ul class="slds-lookup__list" role="listbox">
- <aura:iteration var="hospital" items="{!v.hospitalList}">
- <li
- role="presentation"
- onclick="{!c.selectHos}"
- data-accName="{!hospital.Hospital_Name_readonly__c}"
- data-accId="{!hospital.Hospital__c}"
- >
- <span
- class="slds-lookup__item-action slds-media"
- id="lookup-option-498"
- role="option"
- >
- <div class="slds-media__body">
- <div class="slds-lookup__result-text">
- {!hospital.Hospital_Name_readonly__c}
- </div>
+ <aura:set attribute="else">
+ <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent2}"/>
+ <div class="slds-p-around--large slds-align--absolute-center">
+ <lightning:button label="纭" variant="brand" onclick="{!c.exportDate}"
+ />
+ <lightning:button label="鍙栨秷" variant="brand"
+ onclick="{!c.close_export}" />
</div>
- </span>
- </li>
- </aura:iteration>
- </ul>
- </div>
+
+ </aura:set>
+ </aura:if>
</div>
-
- <!-- 绉戝鍒嗙被 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
- >
- {!v.fieldsmap.Department_Cateogy__c}
- <ui:inputSelect
- aura:id="select_department"
- class="slds-select"
- change="{!c.select_department}"
- />
- </div>
-
- <!-- 鍏堢敓 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
- >
- {!v.fieldsmap.doctor2__c}
- <ui:inputSelect
- aura:id="select_doctor"
- class="slds-select"
- change="{!c.doctor_change}"
- />
- </div>
-
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12 marginTop"
- >
- <br />
- <ui:button
- label="鏂板缓"
- class="slds-button"
- press="{!c.createCon}"
- disabled="true"
- aura:id="new_con"
- />
- </div>
-
- <!-- 鑱屼綅 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
- >
- {!v.fieldsmap.visitor_title__c}
- <div>{!v.doctor_title}</div>
- </div>
- <!-- 娲诲姩鍖哄垎 -->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
- >
- {!v.fieldsmap.Purpose_Type__c}
- <ui:inputSelect
- aura:id="select_purpose_type"
- class="slds-select"
- change="{!c.select_purpose_type}"
- />
- </div>
- <!-- 璇环 -->
- <div
- aura:id="input-opportunity-opp"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12 marginTop"
- >
- {!v.fieldsmap.Opportunity__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <!-- <force:inputField value="{!v.data.Opportunity__c}" aura:id="input-opportunity"/> -->
- <c:strike_lookup
- label=""
- object="Agency_Opportunity__c"
- searchField="Name"
- placeholder="鎼滅储缁忛攢鍟嗚浠�..."
- iconName="standard:opportunity"
- subtitleField="Department_Cateogy__c,Agency_Opportunity_No__c,Change_To_Opportunity__r.Name"
- order="StageName__c"
- limit="5"
- loadingMessage="Loading..."
- errorMessage="Invalid input"
- allowNewRecords="true"
- overrideNewEvent="true"
- showRecentRecords="true"
- value="{!v.data.Opportunity__c}"
- filter="{!v.opportunity_cfilter}"
- subTitleFormat="{0}+{1}+{2}"
- />
- </div>
- <div
- aura:id="input-opportunity-blank"
- class="lds-p-horizontal--small slds-size--1-of-1 slds-medium-size--8-of-12 slds-large-size--8-of-12 marginTop"
- ></div>
- <div
- aura:id="input-opportunity-stage"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
- >
- {!v.fieldsmap.StageName__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <ui:inputSelect aura:id="select_stageName" class="slds-select" />
- <!-- <force:inputField value="{!v.oppdata.StageName__c}" aura:id="input-oppstage" /> -->
- </div>
- <div
- aura:id="input-opportunity-amount1"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
- >
- {!v.fieldsmap.Amount__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <force:inputField value="{!v.oppdata.Amount__c}" class="" />
- </div>
- <div
- aura:id="input-opportunity-amount2"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
- >
- {!v.fieldsmap.OCMSale_Price__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <force:inputField
- value="{!v.oppdata.OCMSale_Price__c}"
- class=""
- />
- </div>
- <div
- aura:id="input-opportunity-date"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
- >
- {!v.fieldsmap.Close_Forecasted_Date__c}
- <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
- <force:inputField
- value="{!v.oppdata.Close_Forecasted_Date__c}"
- class=""
- />
- </div>
- <!-- 瑁藉搧鍒嗛 -->
- <div
- aura:id="product_category_select1"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
- >
- {!v.fieldsmap.Product_Category1__c}
- <!-- <force:inputField value="{!v.data.Product_Category1__c}" aura:id="input-product-category1"/> -->
- <ui:inputSelect
- aura:id="select_Product1"
- class="slds-select"
- change="{!c.productcategoryChange1}"
- />
- </div>
- <div
- aura:id="product_category_select2"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
- >
- {!v.fieldsmap.Product_Category2__c}
- <!-- <force:inputField value="{!v.data.Product_Category2__c}" aura:id="input-product-category2"/> -->
- <ui:inputSelect
- aura:id="select_Product2"
- class="slds-select"
- change="{!c.productcategoryChange2}"
- />
- </div>
- <div
- aura:id="product_category_select3"
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
- >
- {!v.fieldsmap.Product_Category3__c}
- <!-- <force:inputField value="{!v.data.Product_Category3__c}" aura:id="input-product-category3"/> -->
- <ui:inputSelect
- aura:id="select_Product3"
- class="slds-select"
- change="{!c.productcategoryChange3}"
- />
- </div>
- <!--SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start-->
- <!-- 鏀彺闇�姹� change="{!c.SupportNeeds__c}"-->
- <div
- class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
- >
- {!v.fieldsmap.SupportNeeds__c}
- <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" />
- </div>
- <!--SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end-->
- <div
- aura:id="result"
- class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
- >
- {!v.fieldsmap.Result__c}
- <ui:inputSelect aura:id="select_result" class="slds-select" />
- <!-- <ui:inputText label="缁撴灉" class="bcolor" value="{!v.result}"/> -->
- </div>
- </div>
</div>
- <div class="save_button_area">
- <ui:button
- aura:id="save_button"
- label="淇濆瓨骞舵柊寤�"
- class="save_button slds-button slds-button--brand slds-order--3"
- press="{!c.save_report}"
- />
- </div>
+ </div>
+ <div aura:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+ <!-- 鎵归噺瀵煎嚭鍛ㄦ姤 end-->
- <aura:renderIf isTrue="{!v.reports_now_count > 0}">
- <div class="mt40 slds-box slds-theme--shade">
- <div class="slds-table--edit_container slds-is-relative">
- <table
- class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
- role="grid"
- >
- <thead>
- <tr class="slds-line-height--reset">
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"></span>
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name">鍖婚櫌</span>
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Department_Cateogy__c}</span
- >
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.doctor2__c}</span
- >
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.visitor_title__c}</span
- >
- </th>
- <th class="table_header slds-text-title--caps">
- <span class="slds-truncate" title="Name"
- >{!v.fieldsmap.Purpose_Type__c}</span
- >
- </th>
- </tr>
- </thead>
- <tbody>
- <aura:iteration
- items="{!v.reports_now}"
- var="item"
- indexVar="index"
- >
- <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy__c}"
- >{!item.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Agency_Hospital__r.Name}"
- >{!item.Agency_Hospital__r.Name}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Department_Cateogy__c}"
- >{!item.Department_Cateogy__c}</span
- >
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.doctor2__r.Name}"
- >
- <span class="encrypt">{!item.doctor2__r.Name}</span>
- <span class="decrypt"
- >{!item.doctor2NameOrigin}</span
- >
- </span>
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.visitor_title__c}"
- >
- <span class="encrypt"
- >{!item.visitor_title__c}</span
- >
- <span class="decrypt"
- >{!item.visitorTitleOrigin}</span
- >
- </span>
- </span>
- </td>
- <td role="gridcell" class="slds-cell-edit">
- <span class="slds-grid slds-grid--align-spread">
- <span
- class="slds-truncate"
- title="{!item.Purpose_Type__c}"
- >{!item.Purpose_Type__c}</span
- >
- </span>
- </td>
- </tr>
- </aura:iteration>
- </tbody>
- </table>
+ <div aura:id="modal_window" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
+ <div class="slds-modal__container" >
+ <aura:renderIf isTrue="{!v.loginEdit}">
+ <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
+ </aura:renderIf>
+ <div class="slds-modal__header">
+ <h4 id="headerTarget" class="slds-float--left"></h4>
+ <h2 id="headerTarget" class="slds-text-heading--medium">鍛ㄦ姤({!v.selected_date} {!v.selected_agency_person})</h2>
+ <ui:button aura:id="close_button" label="鍏抽棴" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.toggle_report}"/>
</div>
- </div>
- </aura:renderIf>
- </div>
+ <div class="slds-modal__content slds-grow slds-p-around--medium">
+ <div class="slds-box slds-theme--shade">
+ <div class="slds-grid slds-wrap slds-grid--pull-padded" >
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop" >
+ 娲诲姩鏃�
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <!-- <force:inputField value="{!v.data.Report_Date__c}" aura:id="input-report-date"/> -->
+ <lightning:input type="date" value="{!v.data.Report_Date__c}" aura:id="input-report-date"
+ variant="label-hidden" />
+ </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"/> -->
+ 鍖婚櫌
+ <lightning:input aura:id="hospital_input_text" class="field" value="{!v.hospital}" variant="label-hidden" updateOn="keyup"/>
+ <div class="slds-lookup__menu" id="lookup-66">
+ <ul class="slds-lookup__list" role="listbox">
+ <aura:iteration var="hospital" items="{!v.hospitalList}">
+ <li role="presentation" onclick="{!c.selectHos}" data-accName="{!hospital.Hospital_Name_readonly__c}" data-accId="{!hospital.Hospital__c}">
+ <span class="slds-lookup__item-action slds-media" id="lookup-option-498" role="option">
+ <div class="slds-media__body">
+ <div class="slds-lookup__result-text">{!hospital.Hospital_Name_readonly__c}</div>
+ </div>
+ </span>
+ </li>
+ </aura:iteration>
+ </ul>
+ </div>
+ </div>
+
+ <!-- 绉戝鍒嗙被 -->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
+ {!v.fieldsmap.Department_Cateogy__c}
+ <ui:inputSelect aura:id="select_department" class="slds-select" change="{!c.select_department}"/>
+ </div>
+
+ <!-- 鍏堢敓 -->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
+ {!v.fieldsmap.doctor2__c}
+ <ui:inputSelect aura:id="select_doctor" class="slds-select" change="{!c.doctor_change}"/>
+ </div>
+
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12 marginTop">
+ <br/>
+ <ui:button label="鏂板缓" class="slds-button" press="{!c.createCon}" disabled="true" aura:id="new_con"/>
+ </div>
+
+ <!-- 鑱屼綅 -->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
+ {!v.fieldsmap.visitor_title__c}
+ <div>{!v.doctor_title}</div>
+ </div>
+ <!-- 娲诲姩鍖哄垎 -->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop">
+ {!v.fieldsmap.Purpose_Type__c}
+ <ui:inputSelect aura:id="select_purpose_type" class="slds-select" change="{!c.select_purpose_type}"/>
+ </div>
+ <!-- 璇环 -->
+ <div aura:id="input-opportunity-opp" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12 marginTop">
+ {!v.fieldsmap.Opportunity__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <!-- <force:inputField value="{!v.data.Opportunity__c}" aura:id="input-opportunity"/> -->
+ <c:strike_lookup label=""
+ object="Agency_Opportunity__c"
+ searchField="Name"
+ placeholder="鎼滅储缁忛攢鍟嗚浠�..."
+ iconName="standard:opportunity"
+ subtitleField="Department_Cateogy__c,Agency_Opportunity_No__c,Change_To_Opportunity__r.Name"
+ order="StageName__c"
+ limit="5"
+ loadingMessage="Loading..."
+ errorMessage="Invalid input"
+ allowNewRecords = "true"
+ overrideNewEvent = "true"
+ showRecentRecords ="true"
+ value="{!v.data.Opportunity__c}"
+ filter="{!v.opportunity_cfilter}"
+ subTitleFormat="{0}+{1}+{2}"/>
+ </div>
+ <div aura:id="input-opportunity-blank" class="lds-p-horizontal--small slds-size--1-of-1 slds-medium-size--8-of-12 slds-large-size--8-of-12 marginTop">
+ </div>
+ <div aura:id="input-opportunity-stage" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
+ {!v.fieldsmap.StageName__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <ui:inputSelect aura:id="select_stageName" class="slds-select"/>
+ <!-- <force:inputField value="{!v.oppdata.StageName__c}" aura:id="input-oppstage" /> -->
+ </div>
+ <div aura:id="input-opportunity-amount1" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
+ {!v.fieldsmap.Amount__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <force:inputField value="{!v.oppdata.Amount__c}" class=""/>
+ </div>
+ <div aura:id="input-opportunity-amount2" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
+ {!v.fieldsmap.OCMSale_Price__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <force:inputField value="{!v.oppdata.OCMSale_Price__c}" class=""/>
+ </div>
+ <div aura:id="input-opportunity-date" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
+ {!v.fieldsmap.Close_Forecasted_Date__c}
+ <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
+ <force:inputField value="{!v.oppdata.Close_Forecasted_Date__c}" class=""/>
+ </div>
+ <!-- 瑁藉搧鍒嗛 -->
+ <div aura:id="product_category_select1" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
+ {!v.fieldsmap.Product_Category1__c}
+ <!-- <force:inputField value="{!v.data.Product_Category1__c}" aura:id="input-product-category1"/> -->
+ <ui:inputSelect aura:id="select_Product1" class="slds-select" change="{!c.productcategoryChange1}"/>
+ </div>
+ <div aura:id="product_category_select2" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
+ {!v.fieldsmap.Product_Category2__c}
+ <!-- <force:inputField value="{!v.data.Product_Category2__c}" aura:id="input-product-category2"/> -->
+ <ui:inputSelect aura:id="select_Product2" class="slds-select" change="{!c.productcategoryChange2}"/>
+ </div>
+ <div aura:id="product_category_select3" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
+ {!v.fieldsmap.Product_Category3__c}
+ <!-- <force:inputField value="{!v.data.Product_Category3__c}" aura:id="input-product-category3"/> -->
+ <ui:inputSelect aura:id="select_Product3" class="slds-select" change="{!c.productcategoryChange3}"/>
+ </div>
+ <!--SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start-->
+ <!-- 鏀彺闇�姹� change="{!c.SupportNeeds__c}"-->
+ <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop">
+ {!v.fieldsmap.SupportNeeds__c}
+ <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" />
+ </div>
+ <!--SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end-->
+ <div aura:id="result" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
+ {!v.fieldsmap.Result__c}
+ <ui:inputSelect aura:id="select_result" class="slds-select"/>
+ <!-- <ui:inputText label="缁撴灉" class="bcolor" value="{!v.result}"/> -->
+ </div>
+ </div>
+ </div>
+ <div class="save_button_area">
+ <ui:button aura:id="save_button" label="淇濆瓨骞舵柊寤�" class="save_button slds-button slds-button--brand slds-order--3" press="{!c.save_report}"/>
+ </div>
+
+ <aura:renderIf isTrue="{!v.reports_now_count > 0}">
+ <div class="mt40 slds-box slds-theme--shade">
+ <div class="slds-table--edit_container slds-is-relative">
+ <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus" role="grid">
+ <thead>
+ <tr class="slds-line-height--reset">
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name"></span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">鍖婚櫌</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span>
+ </th>
+ <th class="table_header slds-text-title--caps">
+ <span class="slds-truncate" title="Name">{!v.fieldsmap.Purpose_Type__c}</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <aura:iteration items="{!v.reports_now}" var="item" indexVar="index">
+ <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Agency_Hospital__r.Name}">{!item.Agency_Hospital__r.Name}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Department_Cateogy__c}</span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.doctor2__r.Name}">
+ <span class="encrypt">{!item.doctor2__r.Name}</span>
+ <span class="decrypt">{!item.doctor2NameOrigin}</span>
+ </span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.visitor_title__c}">
+ <span class="encrypt">{!item.visitor_title__c}</span>
+ <span class="decrypt">{!item.visitorTitleOrigin}</span>
+ </span>
+ </span>
+ </td>
+ <td role="gridcell" class="slds-cell-edit">
+ <span class="slds-grid slds-grid--align-spread">
+ <span class="slds-truncate" title="{!item.Purpose_Type__c}">{!item.Purpose_Type__c}</span>
+ </span>
+ </td>
+ </tr>
+ </aura:iteration>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </aura:renderIf>
+ </div>
+ </div>
</div>
- </div>
- <div
- aura:id="modal_bg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
-
- <div
- aura:id="modal_confirm"
- role="dialog"
- tabindex="-2"
- aria-labelledby="header43"
- class="disp_none slds-modal slds-fade-in-open"
- >
- <div class="slds-modal__container">
- <div class="slds-modal__header">
- <h2 id="header43" class="slds-text-heading--medium">
- {!v.modal_confirm_title}
- </h2>
- </div>
- <div class="slds-modal__content slds-p-around--medium">
- <p>{!v.modal_confirm_text}</p>
- </div>
- <div class="slds-modal__footer">
- <ui:button
- label="鏄�"
- class="slds-button slds-button--brand"
- press="{!c.yes_button}"
- />
- <ui:button
- label="鍚�"
- class="slds-button slds-button--neutral"
- press="{!c.no_button}"
- />
- </div>
+ <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
+
+ <div aura:id="modal_confirm" role="dialog" tabindex="-2" aria-labelledby="header43" class="disp_none slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <div class="slds-modal__header">
+ <h2 id="header43" class="slds-text-heading--medium">{!v.modal_confirm_title}</h2>
+ </div>
+ <div class="slds-modal__content slds-p-around--medium">
+ <p>{!v.modal_confirm_text}</p>
+ </div>
+ <div class="slds-modal__footer">
+ <ui:button label="鏄�" class="slds-button slds-button--brand" press="{!c.yes_button}"/>
+ <ui:button label="鍚�" class="slds-button slds-button--neutral" press="{!c.no_button}" />
+ </div>
+ </div>
</div>
- </div>
- <div
- aura:id="modal_confirm_bg"
- class="disp_none slds-backdrop slds-backdrop--open"
- ></div>
+ <div aura:id="modal_confirm_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
- <div
- aura:id="modal_newAC"
- role="dialog"
- tabindex="-3"
- aria-labelledby="headertest"
- class="disp_none slds-modal slds-fade-in-open"
- >
- <div class="slds-modal__container">
- <aura:renderIf isTrue="{!v.loginEdit}">
- <lightning:spinner
- alternativeText="Loading"
- size="medium"
- style="width: 100%; height: 80%; top: 50px"
- />
- </aura:renderIf>
- <div class="slds-modal__header">
- <h2 id="headertest" class="slds-text-heading--medium">鏂板缓.瀹㈡埛浜哄憳</h2>
- </div>
- <div class="slds-modal__content slds-p-around--medium">
- <lightning:recordEditForm
- aura:id="recordEditForm"
- objectApiName="Agency_Contact__c"
- onsuccess="{!c.handleSuccess}"
- onload="{!c.showRequiredFields}"
- onsubmit="{!c.handleSubmit}"
- >
- <lightning:messages aura:id="OppMessage" />
- <!-- onload="{!c.showRequiredFields}" -->
- <aura:renderIf isTrue="{!v.truthy}">
- <lightning:inputField
- fieldName="Name"
- aura:id="newOpportunityField"
- />
- <lightning:inputField
- fieldName="Type__c"
- aura:id="newOpportunityField"
- />
- <lightning:inputField
- fieldName="Doctor_Division1__c"
- aura:id="newOpportunityField"
- />
- <!-- <lightning:inputField class="customRequired none" aura:id="Input_type__c" fieldName="Type__c"/>
+ <div aura:id="modal_newAC" role="dialog" tabindex="-3" aria-labelledby="headertest" class="disp_none slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <aura:renderIf isTrue="{!v.loginEdit}">
+ <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
+ </aura:renderIf>
+ <div class="slds-modal__header">
+ <h2 id="headertest" class="slds-text-heading--medium">鏂板缓.瀹㈡埛浜哄憳</h2>
+ </div>
+ <div class="slds-modal__content slds-p-around--medium">
+ <lightning:recordEditForm aura:id="recordEditForm" objectApiName="Agency_Contact__c" onsuccess="{!c.handleSuccess}" onload="{!c.showRequiredFields}" onsubmit="{!c.handleSubmit}">
+ <lightning:messages aura:id="OppMessage" />
+ <!-- onload="{!c.showRequiredFields}" -->
+ <aura:renderIf isTrue="{!v.truthy}">
+ <lightning:inputField fieldName="Name" aura:id="newOpportunityField" />
+ <lightning:inputField fieldName="Type__c" aura:id="newOpportunityField" />
+ <lightning:inputField fieldName="Doctor_Division1__c" aura:id="newOpportunityField" />
+ <!-- <lightning:inputField class="customRequired none" aura:id="Input_type__c" fieldName="Type__c"/>
<lightning:inputField class="customRequired none" aura:id="Input_Doctor_Division1__c" fieldName="Doctor_Division1__c"/> -->
- </aura:renderIf>
- <br />
- <br />
- <br />
- <br />
- <br />
- <div class="save_button_area">
- <lightning:button
- class="slds-m-top_small"
- type="button"
- label="鍙栨秷"
- onclick="{!c.createCancel}"
- />
- <lightning:button
- class="slds-m-top_small"
- type="submit"
- label="淇濆瓨"
- />
- </div>
- </lightning:recordEditForm>
- </div>
+ </aura:renderIf>
+ <br/>
+ <br/>
+ <br/>
+ <br/>
+ <br/>
+ <div class="save_button_area">
+ <lightning:button class="slds-m-top_small" type="button" label="鍙栨秷" onclick="{!c.createCancel}"/>
+ <lightning:button class="slds-m-top_small" type="submit" label="淇濆瓨" />
+ </div>
+
+
+ </lightning:recordEditForm>
+ </div>
+ </div>
</div>
- </div>
-</aura:component>
+
+
+</aura:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReport.css b/force-app/main/default/aura/WeeklyReport/WeeklyReport.css
index 8b2291b..19e31fe 100644
--- a/force-app/main/default/aura/WeeklyReport/WeeklyReport.css
+++ b/force-app/main/default/aura/WeeklyReport/WeeklyReport.css
@@ -1,170 +1,169 @@
.THIS .bcolor {
- color: #333;
+ color: #333;
}
.THIS.height100vh {
- height: 100vh;
+ height: 100vh;
}
/* .THIS.contents_wrapper {
padding-top: 50px;
width: 105%;
} */
.THIS .mt5 {
- margin-top: 5px;
+ margin-top: 5px;
}
.THIS .mt40 {
- margin-top: 40px;
+ margin-top: 40px;
}
.THIS .edit_button {
- float: right;
- margin: -1.5em 0.5em 0 0;
- border: 0;
+ float: right;
+ margin: -1.5em 0.5em 0 0;
+ border: 0;
}
.THIS .no_data_area {
- text-align: center;
- margin: 0.5em 0;
+ text-align: center;
+ margin: .5em 0;
}
.THIS.report_list_area {
- margin: 40px 0 20px 0px;
- height: 60vh;
- overflow-y: scroll;
+ margin: 40px 0 20px 0px;
+ height: 60vh;
+ overflow-y: scroll;
}
.THIS .report_radio {
- float: left;
+ float: left;
}
.THIS .table_header {
- width: 9.4rem;
- height: 2em;
+ width: 9.4rem;
+ height: 2em;
}
.THIS.disp_none {
- display: none;
+ display: none;
}
.THIS .disp_none {
- display: none;
+ display: none;
}
.THIS .tr {
- text-align: right;
+ text-align: right;
}
.THIS .close_button {
- float: right;
- margin-top: -2em;
+ float: right;
+ margin-top: -2em;
}
.THIS .close_icn svg {
- fill: #fefefe;
+ fill: #fefefe;
}
.THIS .slds-progress__marker {
- cursor: default;
+ cursor: default;
}
.THIS .progress_0 {
- width: 0%;
+ width: 0%;
}
.THIS .progress_100 {
- width: 100%;
+ width: 100%;
}
.THIS .new_btn_area {
- text-align: center;
- margin-top: 22px;
+ text-align: center;
+ margin-top: 22px;
}
.THIS .new_btn {
- width: 100%;
+ width: 100%;
}
.THIS .save_button_area {
- margin: 1em 0;
- text-align: right;
+ margin: 1em 0;
+ text-align: right;
}
.THIS .save_button {
- background-color: #ffa500;
- border: 1px solid #ff8c00;
+ background-color: #ffa500;
+ border: 1px solid #ff8c00;
}
.THIS .report_data_header {
- border-bottom: 2px solid #ccc;
+ border-bottom: 2px solid #ccc;
}
.THIS .report_data_area {
- border-bottom: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
}
.THIS.fade {
- transition: 5s opacity linear;
+ transition: 5s opacity linear;
}
.THIS.animation_off {
- opacity: 0;
+ opacity: 0;
}
.THIS.animation_on {
- opacity: 1;
+ opacity: 1;
}
.THIS .fade {
- transition: 5s opacity linear;
+ transition: 5s opacity linear;
}
.THIS .animation_off {
- opacity: 0;
+ opacity: 0;
}
.THIS .animation_on {
- opacity: 1;
+ opacity: 1;
}
-.THIS .divbotuser {
- width: fit-content;
+.THIS .divbotuser{
+ width:fit-content;
}
-.THIS .toastMessage.forceActionsText {
- white-space: pre-line !important;
+.THIS .toastMessage.forceActionsText{
+ white-space : pre-line !important;
}
-.THIS .slds-file-selector__dropzone .slds-file-selector__text {
- display: none;
+.THIS .slds-file-selector__dropzone .slds-file-selector__text{
+ display: none;
}
-.THIS .slds-input:focus,
-.THIS .slds-input:active {
- border-color: rgb(216, 221, 230);
- box-shadow: none;
+.THIS .slds-input:focus, .THIS .slds-input:active {
+ border-color: rgb(216, 221, 230);
+ box-shadow: none;
}
-.THIS .customRequired {
- font-weight: 400;
-}
-.THIS .customRequired:before {
- content: "*";
- margin: 0 0.125rem 0 0.125rem;
- color: rgb(194, 57, 52);
- float: left;
-}
-.THIS .none {
- display: none;
+.THIS .customRequired{
+ font-weight: 400;
+}
+.THIS .customRequired:before{
+ content: "*";
+ margin: 0 0.125rem 0 0.125rem;
+ color: rgb(194, 57, 52);
+ float: left;
+}
+.THIS .none{
+ display:none;
}
-.THIS tr .decrypt {
- display: none;
+.THIS tr .decrypt{
+ display: none;
}
-.THIS tr:hover .decrypt {
- display: unset;
+.THIS tr:hover .decrypt{
+ display: unset;
}
-.THIS tr:hover .encrypt {
- display: none;
+.THIS tr:hover .encrypt{
+ display: none;
}
/* add by Deloitte-Link 2023-6-19 start*/
-.THIS .weeklyReportSpinner {
- top: 100px;
+.THIS .weeklyReportSpinner{
+ top:100px;
}
-.THIS .weeklyReportSpinnerEdit {
- top: 50px;
+.THIS .weeklyReportSpinnerEdit{
+ top:50px;
}
-.THIS .slds-spinner_container {
- position: absolute;
- top: 100px;
+.THIS .slds-spinner_container{
+ position: absolute;
+ top:100px;
}
-.THIS .slds-spinner_containerEdit {
- position: absolute;
- top: 50px;
+.THIS .slds-spinner_containerEdit{
+ position: absolute;
+ top:50px;
}
-.THIS .marginTop {
- margin-top: 10px;
+.THIS .marginTop{
+ margin-top: 10px;
}
.THIS .custom-input .uiInput {
- height: 2rem;
+ height: 2rem;
}
-/* add by Deloitte-Link 2023-6-19 end*/
+/* add by Deloitte-Link 2023-6-19 end*/
\ No newline at end of file
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportController.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportController.js
index 02ef7bc..435e472 100644
--- a/force-app/main/default/aura/WeeklyReport/WeeklyReportController.js
+++ b/force-app/main/default/aura/WeeklyReport/WeeklyReportController.js
@@ -1,354 +1,326 @@
({
- doInit: function (component, event, helper) {
- console.log("zhj 鏂版柟妗坵eeklyReport");
- if (window.location.href.endsWith("weekly-report")) {
- helper.doinit(component, event, helper);
- } else {
- helper.hideCmp(component, event, helper);
- }
- component.set("v.showErrorInfo", false);
- },
+ doInit : function(component, event, helper) {
+ console.log('zhj 鏂版柟妗坵eeklyReport');
+ if (window.location.href.endsWith("weekly-report")) {
+ helper.doinit(component, event, helper);
+ } else {
+ helper.hideCmp(component, event, helper);
+ }
+ component.set("v.showErrorInfo", false);
+ },
- createAopp: function (component, event, helper) {
- var addRecordEvent = $A.get("e.force:createRecord");
- addRecordEvent.setParams({
- entityApiName: "Agency_Opportunity__c",
- recordTypeId: "012100000006KW7"
- });
- addRecordEvent.fire();
- component.set("v.showErrorInfo", false);
- },
+ createAopp : function(component, event, helper) {
+ var addRecordEvent = $A.get('e.force:createRecord');
+ addRecordEvent.setParams({
+ entityApiName: 'Agency_Opportunity__c',
+ recordTypeId: '012100000006KW7'
+ });
+ addRecordEvent.fire();
+ component.set("v.showErrorInfo", false);
+ },
+
+ new_report : function(component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨骞舵柊寤�');
+ component.set('v.data.Report_Date__c', '');
+ helper.new_report(component, event, helper);
+ },
+
+ copy_button : function(component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨骞舵柊寤�');
+ helper.copy_button(component, event, helper);
+ },
+
+ change_report_radio : function(component, event, helper) {
+ helper.change_report_radio(component, event, helper);
+ },
+
+ edit_button : function(component, event, helper) {
+ component.find('save_button').set('v.label', '淇濆瓨');
+ helper.edit_button(component, event, helper);
+ },
+
+ createCon : function(component, event, helper) {
+ helper.createCon(component, event, helper);
+ },
- new_report: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨骞舵柊寤�");
- component.set("v.data.Report_Date__c", "");
- helper.new_report(component, event, helper);
- },
-
- copy_button: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨骞舵柊寤�");
- helper.copy_button(component, event, helper);
- },
-
- change_report_radio: function (component, event, helper) {
- helper.change_report_radio(component, event, helper);
- },
-
- edit_button: function (component, event, helper) {
- component.find("save_button").set("v.label", "淇濆瓨");
- helper.edit_button(component, event, helper);
- },
-
- createCon: function (component, event, helper) {
- helper.createCon(component, event, helper);
- },
-
- showRequiredFields: function (component, event, helper) {
- $A.util.removeClass(component.find("newOpportunityField"), "none");
- $A.util.removeClass(component.find("newOpportunityField"), "none");
- },
-
- handleSuccess: function (component, event, helper) {
- helper.handleSuccess(component, event, helper);
- },
-
- handleSubmit: function (component, event, helper) {
- /*
+ showRequiredFields: function(component, event, helper){
+ $A.util.removeClass(component.find("newOpportunityField"), "none");
+ $A.util.removeClass(component.find("newOpportunityField"), "none");
+ },
+
+ handleSuccess : function(component, event, helper) {
+ helper.handleSuccess(component, event, helper);
+ },
+
+ handleSubmit : function(component, event, helper) {
+ /*
var params = event.getParams();
params.fields["Agency_Hospital__c"] = component.get('v.hospitalLinkId');
console.log(params);
event.setParams(params);
*/
- event.preventDefault(); // stop form submission
- // vivek 娣诲姞楠岃瘉 start
- // helper.handleFormSubmit(component);
- var showValidationError = false;
- var fields = component.find("newOpportunityField");
- var vaildationFailReason = "";
- // var vaildationFailReason2 = '';
- // var currentDate = new Date().toJSON().slice(0,10);
+ event.preventDefault(); // stop form submission
+ // vivek 娣诲姞楠岃瘉 start
+ // helper.handleFormSubmit(component);
+ var showValidationError = false;
+ var fields = component.find("newOpportunityField");
+ var vaildationFailReason = '';
+ // var vaildationFailReason2 = '';
+ // var currentDate = new Date().toJSON().slice(0,10);
+
+ // PIPL update Yin Mingjie 21/02/2022 start
+ let agencyReport = Object.create(null);
+ // PIPL update Yin Mingjie 21/02/2022 end
- // PIPL update Yin Mingjie 21/02/2022 start
- let agencyReport = Object.create(null);
- // PIPL update Yin Mingjie 21/02/2022 end
-
- fields.forEach(function (field) {
- if (
- field.get("v.fieldName") === "Type__c" &&
- $A.util.isEmpty(field.get("v.value"))
- ) {
- showValidationError = true;
- vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
- } else if (
- field.get("v.fieldName") === "Doctor_Division1__c" &&
- $A.util.isEmpty(field.get("v.value"))
- ) {
- showValidationError = true;
- if (vaildationFailReason != "") {
- vaildationFailReason += "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
- } else {
- vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
- }
- }
- // PIPL update Yin Mingjie 21/02/2022 start
- if (field.get("v.fieldName") === "Name") {
- agencyReport["name"] = field.get("v.value");
- } else if (field.get("v.fieldName") === "Type__c") {
- agencyReport["type"] = field.get("v.value");
- } else if (field.get("v.fieldName") === "Doctor_Division1__c") {
- agencyReport["doctorDivision1"] = field.get("v.value");
- }
- // PIPL update Yin Mingjie 21/02/2022 end
- });
-
- if (!showValidationError) {
- // PIPL update Yin Mingjie 21/02/2022 start
- /*
+ fields.forEach(function (field) {
+ if(field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))){
+ showValidationError = true;
+ vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
+ }else if(field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))){
+ showValidationError = true;
+ if(vaildationFailReason != ''){
+ vaildationFailReason += "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
+ }else{
+ vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
+ }
+
+ }
+ // PIPL update Yin Mingjie 21/02/2022 start
+ if(field.get("v.fieldName") === 'Name'){
+ agencyReport['name'] = field.get("v.value");
+ }else if(field.get("v.fieldName") === 'Type__c'){
+ agencyReport['type'] = field.get("v.value");
+ }else if(field.get("v.fieldName") === 'Doctor_Division1__c'){
+ agencyReport['doctorDivision1'] = field.get("v.value");
+ }
+ // PIPL update Yin Mingjie 21/02/2022 end
+ });
+
+ if (!showValidationError) {
+ // PIPL update Yin Mingjie 21/02/2022 start
+ /*
var eventFields = event.getParam("fields");
eventFields["Agency_Hospital__c"] = component.get('v.hospitalLinkId');
component.find('recordEditForm').submit(eventFields);
*/
- var agencyHospitalid = component.get("v.hospitalLinkId");
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
- debugger;
- let hospitalName = "";
- //璋冪敤鍚庣searchAgencyDataId鏂规硶鏌ヨ鍑哄尰闄笅闈㈡墍鏈夊鎴蜂汉鍛榙ataid
- helper.CallBackAction(
- component,
- "searchAgencyDataId",
- {
- hospitalId: agencyHospitalid
- },
- function (data) {
- if (data.getState() == "SUCCESS") {
- var data = data.getReturnValue();
- if (data.IsSuccess == true) {
- let agencyContactIds = "";
- if (data.Message == "" && data.Data && data.Data.length > 0) {
- hospitalName = data.Data[0].Agency_Hospital__r.Name;
- for (var i = 0; i < data.Data.length; i++) {
- if (data.Data[i].AWS_Data_Id__c)
- agencyContactIds += "," + data.Data[i].AWS_Data_Id__c;
+ var agencyHospitalid = component.get('v.hospitalLinkId');
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+ debugger
+ let hospitalName = '';
+ //璋冪敤鍚庣searchAgencyDataId鏂规硶鏌ヨ鍑哄尰闄笅闈㈡墍鏈夊鎴蜂汉鍛榙ataid
+ helper.CallBackAction(component,'searchAgencyDataId',{
+ hospitalId : agencyHospitalid
+ },function(data){
+ if(data.getState() == "SUCCESS"){
+ var data = data.getReturnValue();
+ if(data.IsSuccess == true){
+ let agencyContactIds = ''
+ if(data.Message == '' && data.Data && data.Data.length > 0){
+ hospitalName = data.Data[0].Agency_Hospital__r.Name;
+ for(var i=0;i<data.Data.length;i++){
+ if(data.Data[i].AWS_Data_Id__c)
+ agencyContactIds += ','+data.Data[i].AWS_Data_Id__c;
+ }
+ agencyContactIds = agencyContactIds.substring(1);
+ agencyReport['agencyContactIds'] = agencyContactIds;
+ }else{
+ agencyReport['agencyContactIds'] = agencyContactIds;
+ }
+ var arr = new Array();
+ arr.push(agencyReport);
+ var requestData = JSON.stringify(arr);
+ // helper.set_aws_url(component,data,agencyHospitalid);
+
+ var token = component.get('v.AWStoken');
+ var newUrl = component.get('v.AWSinsert') + 'V2';
+
+ component.set('v.loginEdit',true);
+ helper.insert_agencycontact(component,token,newUrl,requestData,agencyHospitalid,helper,hospitalName);
+ }else{
+ helper.ShowToast({
+ "message" : data.message,
+ "type" : "error"
+ });
+ }
+ }else{
+ helper.ShowToast({
+ "message" : 'searchAgency澶辫触',
+ "type" : "error"
+ });
}
- agencyContactIds = agencyContactIds.substring(1);
- agencyReport["agencyContactIds"] = agencyContactIds;
- } else {
- agencyReport["agencyContactIds"] = agencyContactIds;
- }
- var arr = new Array();
- arr.push(agencyReport);
- var requestData = JSON.stringify(arr);
- // helper.set_aws_url(component,data,agencyHospitalid);
+ })
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+ // var arr = new Array();
+ // arr.push(agencyReport);
+ // var data = JSON.stringify(arr);
+ // // helper.set_aws_url(component,data,agencyHospitalid);
- var token = component.get("v.AWStoken");
- var newUrl = component.get("v.AWSinsert") + "V2";
+ // var token = component.get('v.AWStoken');
+ // var newUrl = component.get('v.AWSinsert');
+
+ // component.set('v.login',true);
+ // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper);
- component.set("v.loginEdit", true);
- helper.insert_agencycontact(
- component,
- token,
- newUrl,
- requestData,
- agencyHospitalid,
- helper,
- hospitalName
- );
- } else {
- helper.ShowToast({
- message: data.message,
- type: "error"
- });
- }
- } else {
- helper.ShowToast({
- message: "searchAgency澶辫触",
- type: "error"
- });
- }
+ // PIPL update Yin Mingjie 21/02/2022 end
+ }else{
+ component.find('OppMessage').setError(vaildationFailReason);
}
- );
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
- // var arr = new Array();
- // arr.push(agencyReport);
- // var data = JSON.stringify(arr);
- // // helper.set_aws_url(component,data,agencyHospitalid);
+ // var eventFields = event.getParam("fields");
+ // eventFields["Agency_Hospital__c"] = component.get('v.hospitalLinkId');
+ // component.find('recordEditForm').submit(eventFields);
+ // vivek 娣诲姞楠岃瘉 end
+ },
+
+ createCancel : function(component, event, helper) {
+ helper.createCancel(component, event, helper);
+ },
+
+ yes_button : function(component, event, helper) {
+ component.set('v.confirm_status', 1);
+ helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
+ },
- // var token = component.get('v.AWStoken');
- // var newUrl = component.get('v.AWSinsert');
+ no_button : function(component, event, helper) {
+ component.set('v.confirm_status', 2);
+ helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
+ },
+
+ toggle_report : function(component, event, helper) {
+ helper.toggle_report(component);
+ },
- // component.set('v.login',true);
- // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper);
+ save_report : function(component, event, helper) {
+ helper.save_report(component, event, helper);
+ },
+
+ select_date_change : function(component, event, helper) {
+ helper.select_date_change(component, event, helper);
+ },
+
+ select_agency_change : function(component, event, helper) {
+ helper.select_agency_change(component, event, helper);
+ },
+
+ hosChange : function(component, event, helper) {
+ var hospital_name = event.getParam("value");
+ if (hospital_name.match(/(\S+\s)+/)) {
+ helper.searchHos(component, event, helper);
+ } else {
+ helper.hideSearch(component, event, helper);
+ }
+ },
+
+ selectHos : function(component, event, helper) {
+ helper.selectHos(component, event, helper);
+ helper.setOpportunity_cfilter(component);
+ },
+ select_department : function(component, event, helper) {
+ helper.select_department(component, event, helper);
+ helper.setOpportunity_cfilter(component);
+ },
+ select_purpose_type : function(component, event, helper) {
+ helper.select_purpose_type(component, event, helper);
+ },
+
+ doctor_change : function(component, event, helper) {
+ helper.doctor_change(component, event, helper);
+ },
+
+ opportunityChange : function(component, event, helper) {
+ helper.opportunityChange(component, event, helper);
+ },
+
+ productcategoryChange1 : function(component, event, helper) {
+ helper.productcategoryChange1(component, event, helper);
+ },
+ productcategoryChange2 : function(component, event, helper) {
+ helper.productcategoryChange2(component, event, helper);
+ },
+ productcategoryChange3 : function(component, event, helper) {
+ helper.productcategoryChange3(component, event, helper);
+ },
+ stageNameChange : function(component, event, helper) {
+ helper.stageNameChange(component, event, helper);
+ },
+ onDragOver : function(component, event, helper) {
+ event.preventDefault();
+ },
+
+ onDrop : function(component, event, helper) {
+ event.stopPropagation();
+ event.preventDefault();
+ event.dataTransfer.dropEffect='copy';
+ var files=event.dataTransfer.files;
+ helper.readFile(component,helper,files[0]);
+ },
+ CreateRecord : function(component, event, helper){
+ var files = event.getSource().get("v.files");
+ // var fileInput = component.find("file").getElement();
+ // var file = fileInput.files[0];
+ helper.readFile(component,helper,files[0]);
+ component.set("v.showErrorInfo", false);
+ },
- // PIPL update Yin Mingjie 21/02/2022 end
- } else {
- component.find("OppMessage").setError(vaildationFailReason);
- }
- // var eventFields = event.getParam("fields");
- // eventFields["Agency_Hospital__c"] = component.get('v.hospitalLinkId');
- // component.find('recordEditForm').submit(eventFields);
- // vivek 娣诲姞楠岃瘉 end
- },
+ processFileContent : function(component,event,helper){
+ helper.saveRecords(component,event,helper);
+ component.set("v.showErrorInfo", false);
+ },
+
+ cancel : function(component,event,helper){
+ component.set("v.showMain",true);
+ },
- createCancel: function (component, event, helper) {
- helper.createCancel(component, event, helper);
- },
+ import : function(component,event,helper){
+ // component.find('file').click();
+ // console.log('lll'+component.find('file'));
+ helper.showImport(component);
+ },
+ exportDate : function(component,event,helper){
+ var stockData = component.get("v.reports_date");
+ console.log('瀵煎嚭鏁版嵁'+stockData);
+ var csv = helper.convertArrayOfObjectsToCSV(component,stockData);
+ if (csv == null){return;}
- yes_button: function (component, event, helper) {
- component.set("v.confirm_status", 1);
- helper.close_confirm(
- component,
- component.get("v.modal_confirm_title"),
- component.get("v.modal_confirm_text")
- );
- },
+ // ####--code for create a temp. <a> html tag [link tag] for download the CSV file--####
+ var universalBOM = "\uFEFF";
+ var hiddenElement = document.createElement('a');
+ hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM+csv);
+ hiddenElement.target = '_self'; //
+ hiddenElement.download = 'ExportData.csv'; // CSV file Name* you can change it.[only name not .csv]
+ document.body.appendChild(hiddenElement); // Required for FireFox browser
+ hiddenElement.click(); // using click() js function to download csv file
+ // helper.showExport(component);
+
+ },
- no_button: function (component, event, helper) {
- component.set("v.confirm_status", 2);
- helper.close_confirm(
- component,
- component.get("v.modal_confirm_title"),
- component.get("v.modal_confirm_text")
- );
- },
+ export_condition : function(component,event,helper){
+ helper.showExport(component);
+ },
- toggle_report: function (component, event, helper) {
- helper.toggle_report(component);
- },
-
- save_report: function (component, event, helper) {
- helper.save_report(component, event, helper);
- },
-
- select_date_change: function (component, event, helper) {
- helper.select_date_change(component, event, helper);
- },
-
- select_agency_change: function (component, event, helper) {
- helper.select_agency_change(component, event, helper);
- },
-
- hosChange: function (component, event, helper) {
- var hospital_name = event.getParam("value");
- if (hospital_name.match(/(\S+\s)+/)) {
- helper.searchHos(component, event, helper);
- } else {
- helper.hideSearch(component, event, helper);
- }
- },
-
- selectHos: function (component, event, helper) {
- helper.selectHos(component, event, helper);
- helper.setOpportunity_cfilter(component);
- },
- select_department: function (component, event, helper) {
- helper.select_department(component, event, helper);
- helper.setOpportunity_cfilter(component);
- },
- select_purpose_type: function (component, event, helper) {
- helper.select_purpose_type(component, event, helper);
- },
-
- doctor_change: function (component, event, helper) {
- helper.doctor_change(component, event, helper);
- },
-
- opportunityChange: function (component, event, helper) {
- helper.opportunityChange(component, event, helper);
- },
-
- productcategoryChange1: function (component, event, helper) {
- helper.productcategoryChange1(component, event, helper);
- },
- productcategoryChange2: function (component, event, helper) {
- helper.productcategoryChange2(component, event, helper);
- },
- productcategoryChange3: function (component, event, helper) {
- helper.productcategoryChange3(component, event, helper);
- },
- stageNameChange: function (component, event, helper) {
- helper.stageNameChange(component, event, helper);
- },
- onDragOver: function (component, event, helper) {
- event.preventDefault();
- },
-
- onDrop: function (component, event, helper) {
- event.stopPropagation();
- event.preventDefault();
- event.dataTransfer.dropEffect = "copy";
- var files = event.dataTransfer.files;
- helper.readFile(component, helper, files[0]);
- },
- CreateRecord: function (component, event, helper) {
- var files = event.getSource().get("v.files");
- // var fileInput = component.find("file").getElement();
- // var file = fileInput.files[0];
- helper.readFile(component, helper, files[0]);
- component.set("v.showErrorInfo", false);
- },
-
- processFileContent: function (component, event, helper) {
- helper.saveRecords(component, event, helper);
- component.set("v.showErrorInfo", false);
- },
-
- cancel: function (component, event, helper) {
- component.set("v.showMain", true);
- },
-
- import: function (component, event, helper) {
- // component.find('file').click();
- // console.log('lll'+component.find('file'));
- helper.showImport(component);
- },
- exportDate: function (component, event, helper) {
- var stockData = component.get("v.reports_date");
- console.log("瀵煎嚭鏁版嵁" + stockData);
- var csv = helper.convertArrayOfObjectsToCSV(component, stockData);
- if (csv == null) {
- return;
- }
-
- // ####--code for create a temp. <a> html tag [link tag] for download the CSV file--####
- var universalBOM = "\uFEFF";
- var hiddenElement = document.createElement("a");
- hiddenElement.href =
- "data:text/csv;charset=utf-8," + encodeURI(universalBOM + csv);
- hiddenElement.target = "_self"; //
- hiddenElement.download = "ExportData.csv"; // CSV file Name* you can change it.[only name not .csv]
- document.body.appendChild(hiddenElement); // Required for FireFox browser
- hiddenElement.click(); // using click() js function to download csv file
- // helper.showExport(component);
- },
-
- export_condition: function (component, event, helper) {
- helper.showExport(component);
- },
-
- select_repores_date: function (component, event, helper) {
- helper.select_repores_date(component, event, helper);
- // var stockData = component.get("v.reports_date");
- // console.log('鏌ュ嚭鐨勬暟鎹�'+stockData);
- // helper.showExportDate(component,stockData);
- // this.export(component,event,helper);
- },
- export: function (component, event, helper) {
- console.log("杩涘叆export");
- var stockData = component.get("v.reports_date");
- console.log("鏌ュ嚭鐨勬暟鎹�" + stockData);
- // helper.showExportDate(component,stockData);
- // helper.showExport(component);
- },
- close_import: function (component, event, helper) {
- component.set("v.showMain", true);
- helper.close_import(component);
- },
- close_export: function (component, event, helper) {
- component.set("v.showMain", true);
- helper.close_export(component);
- },
- exportErrorInfo: function (component, event, helper) {
- helper.exportErrorInfoHelper(component);
- }
-});
+ select_repores_date : function(component,event,helper){
+ helper.select_repores_date(component,event,helper);
+ // var stockData = component.get("v.reports_date");
+ // console.log('鏌ュ嚭鐨勬暟鎹�'+stockData);
+ // helper.showExportDate(component,stockData);
+ // this.export(component,event,helper);
+ },
+ export : function(component,event,helper){
+ console.log('杩涘叆export');
+ var stockData = component.get("v.reports_date");
+ console.log('鏌ュ嚭鐨勬暟鎹�'+stockData);
+ // helper.showExportDate(component,stockData);
+ // helper.showExport(component);
+ },
+ close_import : function(component,event,helper){
+ component.set("v.showMain",true);
+ helper.close_import(component);
+ },
+ close_export : function(component,event,helper){
+ component.set("v.showMain",true);
+ helper.close_export(component);
+ },
+ exportErrorInfo: function(component,event,helper){
+ helper.exportErrorInfoHelper(component);
+ },
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
index b31c0f9..5dbdbe7 100644
--- a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
+++ b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
@@ -1,1839 +1,1502 @@
({
- doinit: function (component, event, helper) {
- this.report_date_list(component, event, helper, 5);
- component.set("v.login", true);
- 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);
- // PIPL update Yin Mingjie 21/02/2022 start
- component
- .find("select_agency_person")
- .set(
- "v.options",
- this.conv_selected(res.allselectlist.AgencyPerson__c)
- );
- // this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c);
- // PIPL update Yin Mingjie 21/02/2022 end
- component
- .find("select_department")
- .set(
- "v.options",
- this.conv_selected(res.allselectlist.Department_Cateogy__c)
- );
- component
- .find("select_purpose_type")
- .set(
- "v.options",
- this.conv_selected(res.allselectlist.Purpose_Type__c)
- );
- component
- .find("select_result")
- .set("v.options", this.conv_selected(res.allselectlist.Result__c));
- component
- .find("select_stageName")
- .set("v.options", this.conv_selected(res.allselectlist.StageName__c));
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- component
- .find("SupportNeeds__c")
- .set(
- "v.options",
- this.conv_selected(res.allselectlist.SupportNeeds__c)
- );
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- component.set(
- "v.selected_agency_person",
- res.allselectlist.AgencyPerson__c[0].label
- );
- component.set("v.dialog_type", "鏂板缓");
- component.set("v.awsurl", res.awsurl); // 20220222 PI鏀归�� by Bright
- component.set("v.contactawsurl", res.contactawsurl); // 20220222 PI鏀归�� by Bright
-
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- component.find("select_agency_person").get("v.value")
- );
-
- component.set("v.login", false);
- } else {
- this.error("doinit failed.");
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- // PIPL update Yin Mingjie 21/02/2022 start
- search_contact: function (component, event, helper, resobj) {
- let contactData = Object.create(null);
- var dataArr = new Array();
- for (let i = 0; i < resobj.length; i++) {
- if (resobj[i].awsid != null && resobj[i].awsid != "") {
- contactData[resobj[i].awsid] = resobj[i];
- dataArr.push(resobj[i].awsid);
- }
- }
- let obj = Object.create(null);
- obj["dataIds"] = dataArr;
- var payload = JSON.stringify(obj);
- this.search_contact_url(component, "Contact", (result) => {
- var token = result.token;
- var searchUrl = result.searchUrl;
- this.search_core(
- token,
- searchUrl,
- payload,
- (result) => {
- if (result.status == "0") {
- if (result.object != null) {
- this.to_contact_list(result, contactData, component);
- } else {
- component.set("v.loginEdit", false);
- }
- } else {
- this.error("AWS search status1 : " + result.status);
- component.set("v.loginEdit", false);
- }
- },
- component
- );
- });
- },
-
- to_contact_list: function (result, retMap, component) {
- var resls = result.object;
- var res = [];
- var space = {};
- space["label"] = "";
- space["selected"] = true;
- space["value"] = "";
- res.push(space);
-
- for (var i = 0; i < resls.length; i++) {
- var t = {};
- t["label"] = resls[i].lastName;
- t["selected"] = false;
- t["Doctor_Division1__c"] = resls[i].doctorDivision1;
- t["value"] = retMap[resls[i].dataId].value;
- res.push(t);
- }
- component.find("select_agency_person").set("v.options", res);
- component.set("v.allselectlistAgencyPerson", res);
- component.set("v.loginEdit", false);
- },
-
- search_contact_url: function (component, sobject, callback) {
- var action = component.get("c.getAwsurl");
- action.setParams({
- sobj: sobject
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var result = response.getReturnValue();
- if (callback) callback(result);
- } else {
- this.error("AWS url/token error.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
- // PIPL update Yin Mingjie 21/02/2022 end
-
- select_department: function (component, event, helper) {
- var dc = component.find("select_department").get("v.value");
- dc = dc ? "%" + dc + "%" : "";
- var purpose_type = component.find("select_purpose_type").get("v.value");
- if (purpose_type) {
- if (purpose_type.substr(-3) == "OPD") {
- purpose_type = "OPD";
- } else if (purpose_type.substr(-3) == "SIS") {
- purpose_type = "SIS";
- } else {
- purpose_type = "";
- }
- }
- if (dc != "" || purpose_type != "") {
- var action = component.get("c.getProductList");
- action.setParams({
- dc: dc,
- opdsis: purpose_type
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component
- .find("select_Product1")
- .set("v.options", JSON.parse(JSON.stringify(res)));
- component
- .find("select_Product2")
- .set("v.options", JSON.parse(JSON.stringify(res)));
- component
- .find("select_Product3")
- .set("v.options", JSON.parse(JSON.stringify(res)));
- } else {
- this.error("getProductList failed.");
- }
- });
- $A.enqueueAction(action);
- } else {
- component.find("select_Product1").set("v.options", []);
- component.find("select_Product2").set("v.options", []);
- component.find("select_Product3").set("v.options", []);
- }
- },
-
- get_reports: function (component, event, helper, date_str, person_str) {
- if (!date_str) {
- return false;
- }
-
- date_str = this.get_date_string(date_str);
-
- var action = component.get("c.getReports");
- action.setParams({
- date_str: date_str,
- person_str: person_str
- });
-
- component.set("v.login", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.reports", res.reports);
-
- // 20220222 PI鏀归�� by Bright--start
- let dataIds = [];
- let dataIds1 = [];
- let mm = {};
- let b = false;
- let b1 = false;
- for (const rep of res.reports) {
- if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) {
- dataIds.push(rep.doctor2__r.AWS_Data_Id__c);
- }
-
- if (
- rep.Person_In_Charge2__r &&
- rep.Person_In_Charge2__r.AWS_Data_Id__c
- ) {
- dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c);
- }
- }
- let Foo = null;
- Foo = function () {
- if (b && b1) {
- for (const rep of res.reports) {
- if (
- rep.doctor2__r &&
- rep.doctor2__r.AWS_Data_Id__c &&
- mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)
- ) {
- rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c];
- }
- if (
- rep.Person_In_Charge2__r &&
- rep.Person_In_Charge2__r.AWS_Data_Id__c &&
- mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c)
- ) {
- rep.Person_In_Charge2__r.awsdata =
- mm[rep.Person_In_Charge2__r.AWS_Data_Id__c];
- }
- }
-
- $A.getCallback(() => component.set("v.reports", res.reports))();
- } else {
- console.log("b=" + b + ",b1=" + b1 + ",continue");
- setTimeout(Foo, 100);
- }
- };
-
- if (dataIds.length > 0) {
- let awsurl = component.get("v.awsurl");
- helper.search_core(
- awsurl.token,
- awsurl.searchUrl,
- JSON.stringify({
- dataIds: dataIds
- }),
- (result) => {
- if (result.status == "0") {
- for (const m of result.object) {
- mm[m.dataId] = m;
- }
- b = true;
- Foo();
- } else {
- //this.error('AWS search status2 : ' + result.status);
- this.success("璇烽噸鏂板埛鏂伴〉闈㈣繘琛岃В瀵�");
- }
- },
- component
- );
- } else {
- b = true;
- }
-
- if (dataIds1.length > 0) {
- let contactawsurl = component.get("v.contactawsurl");
- helper.search_core(
- contactawsurl.token,
- contactawsurl.searchUrl,
- JSON.stringify({
- dataIds: dataIds1
- }),
- (result) => {
- if (result.status == "0") {
- for (const m of result.object) {
- mm[m.dataId] = m;
- }
- b1 = true;
- Foo();
- } else {
- this.error("AWS search status3 : " + result.status);
- }
- },
- component
- );
- } else {
- b1 = true;
- }
- // 20220222 PI鏀归�� by Bright--end
-
- component.set("v.report_count", res.reports.length);
-
- // 鏇存柊淇濆瓨寰屻伄select_data鐢�
- var report_id = component.get("v.update_select_report_data_id");
-
- if (report_id != "") {
- for (i = 0; i < res.reports.length; i++) {
- if (res.reports[i]["Id"] == report_id) {
- component.set("v.select_report_data", res.reports[i]);
- break;
- }
- }
- component.set("v.update_select_report_data_id", "");
- }
-
- if (res.reports.length > 0) {
- component.set("v.list_message", "");
- } else {
- component.set("v.list_message", "no_data");
- }
- component.set("v.login", false);
- } else {
- this.error("get_reports failed.");
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
- get_reports_edit: function (component, event, helper, date_str, person_str) {
- if (!date_str) {
- return false;
- }
-
- date_str = this.get_date_string(date_str);
-
- var action = component.get("c.getReports");
- action.setParams({
- date_str: date_str,
- person_str: person_str
- });
-
- component.set("v.loginEdit", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.reports", res.reports);
-
- // 20220222 PI鏀归�� by Bright--start
- let dataIds = [];
- let dataIds1 = [];
- let mm = {};
- let b = false;
- let b1 = false;
- for (const rep of res.reports) {
- if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) {
- dataIds.push(rep.doctor2__r.AWS_Data_Id__c);
- }
-
- if (
- rep.Person_In_Charge2__r &&
- rep.Person_In_Charge2__r.AWS_Data_Id__c
- ) {
- dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c);
- }
- }
- let Foo = null;
- Foo = function () {
- if (b && b1) {
- for (const rep of res.reports) {
- if (
- rep.doctor2__r &&
- rep.doctor2__r.AWS_Data_Id__c &&
- mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)
- ) {
- rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c];
- }
- if (
- rep.Person_In_Charge2__r &&
- rep.Person_In_Charge2__r.AWS_Data_Id__c &&
- mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c)
- ) {
- rep.Person_In_Charge2__r.awsdata =
- mm[rep.Person_In_Charge2__r.AWS_Data_Id__c];
- }
- }
-
- $A.getCallback(() => component.set("v.reports", res.reports))();
- } else {
- console.log("b=" + b + ",b1=" + b1 + ",continue");
- setTimeout(Foo, 100);
- }
- };
-
- if (dataIds.length > 0) {
- let awsurl = component.get("v.awsurl");
- helper.search_core(
- awsurl.token,
- awsurl.searchUrl,
- JSON.stringify({
- dataIds: dataIds
- }),
- (result) => {
- if (result.status == "0") {
- for (const m of result.object) {
- mm[m.dataId] = m;
- }
- b = true;
- Foo();
- } else {
- //this.error('AWS search status2 : ' + result.status);
- this.success("璇烽噸鏂板埛鏂伴〉闈㈣繘琛岃В瀵�");
- }
- },
- component
- );
- } else {
- b = true;
- }
-
- if (dataIds1.length > 0) {
- let contactawsurl = component.get("v.contactawsurl");
- helper.search_core(
- contactawsurl.token,
- contactawsurl.searchUrl,
- JSON.stringify({
- dataIds: dataIds1
- }),
- (result) => {
- if (result.status == "0") {
- for (const m of result.object) {
- mm[m.dataId] = m;
- }
- b1 = true;
- Foo();
- } else {
- this.error("AWS search status3 : " + result.status);
- }
- },
- component
- );
- } else {
- b1 = true;
- }
- // 20220222 PI鏀归�� by Bright--end
-
- component.set("v.report_count", res.reports.length);
-
- // 鏇存柊淇濆瓨寰屻伄select_data鐢�
- var report_id = component.get("v.update_select_report_data_id");
-
- if (report_id != "") {
- for (i = 0; i < res.reports.length; i++) {
- if (res.reports[i]["Id"] == report_id) {
- component.set("v.select_report_data", res.reports[i]);
- break;
- }
- }
- component.set("v.update_select_report_data_id", "");
- }
-
- if (res.reports.length > 0) {
- component.set("v.list_message", "");
- } else {
- component.set("v.list_message", "no_data");
- }
- component.set("v.loginEdit", false);
- } else {
- this.error("get_reports failed.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- select_date_change: function (component, event, helper) {
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- component.find("select_agency_person").get("v.value")
- );
- this.new_button_disabled(component, event, helper);
-
- component.set("v.select_report_data_radio", "");
- component.find("copy_button").set("v.disabled", true);
- },
-
- select_agency_change: function (component, event, helper) {
- var select_value = component.find("select_agency_person").get("v.value");
- var new_label = this.get_agency_person_name(component, select_value);
- component.set("v.selected_agency_person", new_label);
-
- this.get_reports(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- select_value
- );
- this.new_button_disabled(component, event, helper);
-
- component.set("v.select_report_data_radio", "");
- component.find("copy_button").set("v.disabled", true);
- },
-
- get_agency_person_name: function (component, agency_person_value) {
- // PIPL update Yin Mingjie 21/02/2022 start
- var allselectlist = component.get("v.allselectlist.AgencyPerson__c");
- // var allselectlist = component.get('v.allselectlistAgencyPerson');
- // PIPL update Yin Mingjie 21/02/2022 end
- var new_label = "";
- for (var i = 0; i < allselectlist.length; i++) {
- if (agency_person_value == allselectlist[i].value) {
- new_label = allselectlist[i].label;
- break;
- }
- }
- return new_label;
- },
-
- new_button_disabled: function (component, event, helper) {
- var select_date = component.find("select_date").get("v.value");
- var select_agency = component.find("select_agency_person").get("v.value");
- if (select_date && select_agency) {
- component.find("new_button").set("v.disabled", false);
- } else {
- component.find("new_button").set("v.disabled", true);
- }
- },
-
- toggle_report: function (component) {
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- if ($A.util.hasClass(modal_window, "disp_none")) {
- // OPEN
- $A.util.removeClass(modal_window, "disp_none");
- $A.util.removeClass(modal_bg, "disp_none");
- component.set("v.loginEdit", true);
- if (
- component.get("v.mode") == "edit" ||
- component.get("v.mode") == "copy"
- ) {
- var select_data = "";
- if (component.get("v.mode") == "edit") {
- select_data = component.get("v.select_report_data");
- } else if (component.get("v.mode") == "copy") {
- select_data = component.get("v.select_report_data_radio");
- }
-
- var reports = component.get("v.reports");
- var Agency_Hospital_text = "";
- var Agency_Hospital_parent_id = "";
- debugger;
- // 鍖婚櫌鍚�
- if (select_data["Agency_Hospital__c"] != "") {
- for (var i = 0; i < reports.length; i++) {
- if (
- reports[i]["Agency_Hospital__c"] ==
- select_data["Agency_Hospital__c"]
- ) {
- Agency_Hospital_text = reports[i]["Agency_Hospital__r"]["Name"];
- Agency_Hospital_parent_id =
- reports[i]["Agency_Hospital__r"]["Hospital__c"];
- }
- }
- component.set("v.hospital", Agency_Hospital_text);
- component.set("v.hospitalId", Agency_Hospital_parent_id);
- component.set("v.hospitalLinkId", select_data["Agency_Hospital__c"]);
- component.find("new_con").set("v.disabled", false);
- }
-
- // 绉戝
- if (select_data["Department_Cateogy__c"] != "") {
- this.set_selected(
- component,
- "select_department",
- select_data["Department_Cateogy__c"]
- );
- }
- // 鎷滆浜�
- component.set("v.default_select_doctor_id", select_data["doctor2__c"]);
- this.set_doctor_list(component);
-
- // 娲诲姩鍖哄垎
- if (select_data["Purpose_Type__c"] != "") {
- this.set_selected(
- component,
- "select_purpose_type",
- select_data["Purpose_Type__c"]
- );
- this.select_purpose_type(component);
- }
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- // 鏀彺闇�姹�
- if (select_data["SupportNeeds__c"] != "") {
- this.set_selected(
- component,
- "SupportNeeds__c",
- select_data["SupportNeeds__c"]
- );
- }
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- // 绲愭灉
- if (
- select_data["Result__c"] != "" &&
- typeof select_data["Result__c"] !== "undefined"
- ) {
- component
- .find("select_result")
- .set("v.value", select_data["Result__c"]);
- }
-
- // 璇环
- var report_id = component.get("v.edit_copy_select_report_id");
- if (report_id != "") {
- var select_opp = "";
- var select_product_category1 = "";
- var select_product_category2 = "";
- var select_product_category3 = "";
- var reportDate;
- var i = 0;
- for (i = 0; i < reports.length; i++) {
- if (report_id == reports[i]["Id"]) {
- select_opp = reports[i]["Opportunity__c"];
- select_product_category1 = reports[i]["Product_Category1__c"];
- select_product_category2 = reports[i]["Product_Category2__c"];
- select_product_category3 = reports[i]["Product_Category3__c"];
- reportDate = reports[i]["Report_Date__c"];
- break;
- }
- }
-
- // 璇环
- if (select_opp != null && select_opp != "") {
- var select_opp_name = component.get("v.reports")[i].OppName__c;
- component.set("v.data.Opportunity__c", select_opp);
- if ($A.get("$Browser.formFactor") == "DESKTOP") {
- var values = [
- {
- type: "Agency_Opportunity__c",
- id: select_opp,
- label: select_opp_name,
- icon: {
- url: "/img/icon/t4v35/custom/custom12_120.png",
- backgroundColor: "dc71d1",
- alt: "Agency_Opportunity__c"
- }
- }
- ];
- component.set("v.data.Opportunity__c", select_opp);
- // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
- } else {
- component
- .find("input-opportunity")
- .get("v.body")[0]
- .set("v.selectedLabel", select_opp_name);
- }
- }
-
- // 浜у搧鍖哄垎
- if (
- select_product_category1 != null &&
- select_product_category1 != ""
- ) {
- component
- .find("select_Product1")
- .set("v.value", select_product_category1);
- }
- if (
- select_product_category2 != null &&
- select_product_category2 != ""
- ) {
- component
- .find("select_Product2")
- .set("v.value", select_product_category2);
- }
- if (
- select_product_category3 != null &&
- select_product_category3 != ""
- ) {
- component
- .find("select_Product3")
- .set("v.value", select_product_category3);
- }
-
- if (reportDate != null) {
- console.log("reportDate = " + reportDate);
- component.set("v.data.Report_Date__c", reportDate);
- }
-
- component.set("v.edit_copy_select_report_id", "");
- }
- }
- setTimeout(function () {
- component.set("v.loginEdit", false);
- }, 1000);
- } else {
- // CLOSE
-
- var select_report_data = component.get("v.select_report_data");
- var Report_Date__c = component.get("v.data.Report_Date__c");
- var Agency_Hospital__c = component.get("v.hospitalLinkId");
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- var doctor2__c = component.find("select_doctor").get("v.value");
- var Purpose_Type__c = component
- .find("select_purpose_type")
- .get("v.value");
- var SupportNeeds__c = component.find("SupportNeeds__c").get("v.value");
- var Opportunity__c = component.get("v.data.Opportunity__c");
- var Product_Category1__c = component
- .find("select_Product1")
- .get("v.value");
- var Product_Category2__c = component
- .find("select_Product2")
- .get("v.value");
- var Product_Category3__c = component
- .find("select_Product3")
- .get("v.value");
- var Result__c = component.find("select_result").get("v.value");
-
- if (select_report_data !== null) {
- if (typeof select_report_data["Opportunity__c"] === "undefined") {
- select_report_data["Opportunity__c"] = "";
- }
- if (typeof select_report_data["Product_Category1__c"] === "undefined") {
- select_report_data["Product_Category1__c"] = "";
- }
- if (typeof select_report_data["Product_Category2__c"] === "undefined") {
- select_report_data["Product_Category2__c"] = "";
- }
- if (typeof select_report_data["Product_Category3__c"] === "undefined") {
- select_report_data["Product_Category3__c"] = "";
- }
- if (typeof select_report_data["Result__c"] === "undefined") {
- select_report_data["Result__c"] = "";
- }
- }
-
- if (component.get("v.mode") == "new") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鍛ㄦ姤锛�";
-
- if (
- !Report_Date__c &&
- !Agency_Hospital__c &&
- !Department_Cateogy__c &&
- !doctor2__c &&
- !Purpose_Type__c &&
- !SupportNeeds__c && //WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
- !Opportunity__c &&
- !Product_Category1__c &&
- !Product_Category2__c &&
- !Product_Category3__c &&
- !Result__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "copy") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純鏂板缓鍛ㄦ姤锛�";
-
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["Purpose_Type__c"] == Purpose_Type__c &&
- select_report_data["SupportNeeds__c"] == SupportNeeds__c && //WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
- select_report_data["Opportunity__c"] == Opportunity__c &&
- select_report_data["Product_Category1__c"] == Product_Category1__c &&
- select_report_data["Product_Category2__c"] == Product_Category2__c &&
- select_report_data["Product_Category3__c"] == Product_Category3__c &&
- select_report_data["Result__c"] == Result__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- } else if (component.get("v.mode") == "edit") {
- var confirm_title = "璀﹀憡!";
- var confirm_text = "鏀惧純缂栬緫鍛ㄦ姤锛�";
-
- if (
- select_report_data["Report_Date__c"] == Report_Date__c &&
- select_report_data["Agency_Hospital__c"] == Agency_Hospital__c &&
- select_report_data["Department_Cateogy__c"] ==
- Department_Cateogy__c &&
- select_report_data["doctor2__c"] == doctor2__c &&
- select_report_data["Purpose_Type__c"] == Purpose_Type__c &&
- select_report_data["SupportNeeds__c"] == SupportNeeds__c && //WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
- select_report_data["Opportunity__c"] == Opportunity__c &&
- select_report_data["Product_Category1__c"] == Product_Category1__c &&
- select_report_data["Product_Category2__c"] == Product_Category2__c &&
- select_report_data["Product_Category3__c"] == Product_Category3__c &&
- select_report_data["Result__c"] == Result__c
- ) {
- this.allclear(component);
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- } else {
- this.close_confirm(component, confirm_title, confirm_text);
- }
- }
- }
- },
-
- close_confirm: function (component, title, text) {
- var confirm_status = component.get("v.confirm_status");
- component.set("v.modal_confirm_title", title);
- component.set("v.modal_confirm_text", text);
- var modal_window = component.find("modal_window");
- var modal_bg = component.find("modal_bg");
- var modal_confirm = component.find("modal_confirm");
- var modal_confirm_bg = component.find("modal_confirm_bg");
-
- if (confirm_status == 0) {
- $A.util.addClass(modal_window, "disp_none");
- $A.util.addClass(modal_bg, "disp_none");
- $A.util.removeClass(modal_confirm, "disp_none");
- $A.util.removeClass(modal_confirm_bg, "disp_none");
- } else if (confirm_status == 1) {
- // 鏄�
- $A.util.addClass(modal_confirm, "disp_none");
- $A.util.addClass(modal_confirm_bg, "disp_none");
- component.set("v.mode", "");
- this.allclear(component);
- component.set("v.reports_now", "");
- component.set("v.reports_now_count", 0);
- component.set("v.confirm_status", 0);
- } else if (confirm_status == 2) {
- // 鍚�
- $A.util.removeClass(modal_window, "disp_none");
- $A.util.removeClass(modal_bg, "disp_none");
- $A.util.addClass(modal_confirm, "disp_none");
- $A.util.addClass(modal_confirm_bg, "disp_none");
- component.set("v.confirm_status", 0);
- }
- },
-
- new_report: function (component, event, helper) {
- component.set("v.mode", "new");
- component.set("v.dialog_type", "鏂板缓");
- var select_date = component.find("select_date").get("v.value");
- var select_agency = component.find("select_agency_person").get("v.value");
- component.set("v.selected_date", select_date);
- var name = component.get("v.selected_agency_person");
- var ret = this.create_report_header(
- component,
- name,
- select_agency,
- select_date
- );
- // PIPL update Yin Mingjie 21/02/2022 start
- this.set_aws_url(component, "Agency_Contact__c");
- // PIPL update Yin Mingjie 21/02/2022 end
- },
-
- copy_button: function (component, event, helper) {
- this.allclear(component);
- component.set("v.mode", "copy");
- component.set("v.dialog_type", "鏂板缓");
- var select_report_data = component.get("v.select_report_data_radio");
- component.set("v.loadOpp", true);
- // 閫�
- var now = new Date();
- var start_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() + 1
- );
- var select_date =
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate();
- this.set_selected(component, "select_date", select_date);
- component.set("v.selected_date", select_date);
-
- // 鎷呭綋
- var select_agency = select_report_data["Person_In_Charge2__c"];
- var new_label = this.get_agency_person_name(component, select_agency);
- component.set("v.selected_agency_person", new_label);
- this.set_selected(component, "select_agency_person", select_agency);
-
- this.new_button_disabled(component, event, helper);
-
- var name = component.get("v.selected_agency_person");
-
- component.set("v.edit_copy_select_report_id", select_report_data["Id"]);
- component.set("v.select_report_data", select_report_data);
-
- var ret = this.create_report_header(
- component,
- name,
- select_agency,
- select_date
- );
- },
-
- change_report_radio: function (component, event, helper) {
- var reports = component.get("v.reports");
- for (var i = 0; i < reports.length; i++) {
- if (reports[i].Name == event.getSource().get("v.label")) {
- component.set("v.select_report_data_radio", reports[i]);
- component.find("copy_button").set("v.disabled", false);
- break;
- }
- }
- },
-
- edit_button: function (component, event, helper) {
- component.set("v.login", true);
- this.allclear(component);
- component.set("v.loadOpp", true);
- var index = event.getSource().get("v.value");
- component.set("v.select_report_data", component.get("v.reports")[index]);
- component.set("v.mode", "edit");
- component.set("v.dialog_type", "缂栬緫");
-
- var select_date = component.get("v.reports")[index].Submit_date__c;
- var select_agency = component.get("v.reports")[index].Person_In_Charge2__c;
- var text_tmp = select_date.split("-");
- var select_date_text =
- text_tmp[0] + "/" + Number(text_tmp[1]) + "/" + Number(text_tmp[2]);
- component.set("v.selected_date", select_date_text);
- var name = component.get("v.reports")[index].Person_In_Charge2__r.Name;
-
- this.set_selected(component, "select_agency_person", select_agency);
- this.new_button_disabled(component, event, helper);
-
- var new_label = this.get_agency_person_name(component, select_agency);
- component.set("v.selected_agency_person", new_label);
-
- component.set(
- "v.edit_copy_select_report_id",
- component.get("v.reports")[index].Id
- );
-
- var ret = this.create_report_header(
- component,
- name,
- select_agency,
- select_date
- );
- },
-
- save_report: function (component, event, helper) {
- // 20220222 PI鏀归�� by Bright--start
- let doctor2Name = "";
- let visitortitle = "";
- for (let op of component.find("select_doctor").get("v.options")) {
- if (op.selected) {
- doctor2Name = op.label;
- visitortitle = op.Doctor_Division1__c;
- }
- }
- // 20220222 PI鏀归�� by Bright--end
-
- component.find("save_button").set("v.disabled", true);
-
- var Report_Date__c = component.get("v.data.Report_Date__c");
- // alert('Report_Date__c'+Report_Date__c);
- var Person_In_Charge2__c = "";
- var Submit_date__c = "";
- if (component.get("v.mode") == "edit") {
- // 鍛� Submit_date__c
- Submit_date__c = component.get("v.select_report_data").Submit_date__c;
- // alert('Submit_date__c'+Submit_date__c);
-
- // 鎷呭綋 Person_In_Charge2__c
- Person_In_Charge2__c = component.get(
- "v.select_report_data"
- ).Person_In_Charge2__c;
- } else {
- // 鍛� Submit_date__c
- Submit_date__c = this.get_date_string(
- component.find("select_date").get("v.value")
- );
- // alert('Submit_date__c'+Submit_date__c);
-
- // 鎷呭綋 Person_In_Charge2__c
- Person_In_Charge2__c = component
- .find("select_agency_person")
- .get("v.value");
- }
- // Agency_Report_Header__c
- var Agency_Report_Header__c = component.get("v.agency_report_header_id");
-
- // 鍖婚櫌 Agency_Hospital__c (Agency_Hospital_Link__c)
- var Agency_Hospital__c = component.get("v.hospitalLinkId");
-
- // 绉戝 Department_Cateogy__c
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
-
- // 鎷滆浜� doctor2__c
- var doctor2__c = component.find("select_doctor").get("v.value");
-
- // 娲诲姩鍖哄垎 Purpose_Type__c
- var Purpose_Type__c = component.find("select_purpose_type").get("v.value");
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- // 鏀彺闇�姹� SupportNeeds__c
- var SupportNeeds__c = component.find("SupportNeeds__c").get("v.value");
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- // 璇环 Opportunity__c
- var Opportunity__c = component.get("v.data.Opportunity__c");
-
- var StageName__c = component.find("select_stageName").get("v.value");
- var Amount__c =
- component.get("v.oppdata.Amount__c") != null
- ? component.get("v.oppdata.Amount__c").toString()
- : "";
- var OCMSale_Price__c =
- component.get("v.oppdata.OCMSale_Price__c") != null
- ? component.get("v.oppdata.OCMSale_Price__c").toString()
- : "";
- var Close_Forecasted_Date__c = component.get(
- "v.oppdata.Close_Forecasted_Date__c"
- );
-
- var StageName__c_o = component.get("v.StageName__c_o");
- var Amount__c_o = component.get("v.Amount__c_o");
- var OCMSale_Price__c_o = component.get("v.OCMSale_Price__c_o");
- var Close_Forecasted_Date__c_o = component.get(
- "v.Close_Forecasted_Date__c_o"
- );
- if (StageName__c_o == undefined) StageName__c_o = "";
- if (Amount__c_o == undefined) Amount__c_o = "";
- if (OCMSale_Price__c_o == undefined) OCMSale_Price__c_o = "";
- if (Close_Forecasted_Date__c_o == undefined)
- Close_Forecasted_Date__c_o = "";
- if (
- StageName__c == StageName__c_o &&
- OCMSale_Price__c_o == OCMSale_Price__c &&
- Amount__c == Amount__c_o &&
- Close_Forecasted_Date__c == Close_Forecasted_Date__c_o
- ) {
- StageName__c = "";
- Amount__c = "";
- OCMSale_Price__c = "";
- Close_Forecasted_Date__c = "";
- }
-
- // 浜у搧鍖哄垎 Product_Category__c (ProductTypes__c)
- var Product_Category1__c = component.find("select_Product1").get("v.value");
- var Product_Category2__c = component.find("select_Product2").get("v.value");
- var Product_Category3__c = component.find("select_Product3").get("v.value");
-
- // 绲愭灉 Result__c
- var Result__c = component.find("select_result").get("v.value");
-
- // 銉愩儶銉囥兗銈枫儳銉�
- var error = [];
- if (!Report_Date__c) {
- error.push("娲诲姩鏃� 涓嶅瓨鍦�");
- }
- if (!Submit_date__c) {
- error.push("鍛� 涓嶅瓨鍦�");
- }
- var rDate = new Date(Report_Date__c);
- var sDate = new Date(Submit_date__c);
- sDate.setDate(sDate.getDate() - 1);
- if (rDate < sDate) {
- error.push("娲诲姩鏃ュ繀椤绘槸鏈懆锛�");
- }
- sDate.setDate(sDate.getDate() + 7);
- if (rDate >= sDate) {
- error.push("娲诲姩鏃ュ繀椤绘槸鏈懆锛�");
- }
-
- if (!Person_In_Charge2__c) {
- error.push("鎷呭綋 涓嶅瓨鍦�");
- }
- if (!Agency_Report_Header__c) {
- this.error("Report Header Id 涓嶅瓨鍦�");
- }
- if (!Agency_Hospital__c) {
- error.push("鍖婚櫌 涓嶅瓨鍦�");
- }
- if (!Department_Cateogy__c) {
- error.push("绉戝 涓嶅瓨鍦�");
- }
- if (!doctor2__c) {
- error.push("鎷滆浜� 涓嶅瓨鍦�");
- }
- if (!Purpose_Type__c) {
- error.push("娲诲姩鍖哄垎 涓嶅瓨鍦�");
- }
- // if (!SupportNeeds__c) { error.push("鏀彺闇�姹� 涓嶅瓨鍦�"); }
- if (!Opportunity__c) {
- Opportunity__c = "";
- }
- if (!Product_Category1__c) {
- error.push("浜у搧鍖哄垎1 涓嶅瓨鍦�");
- }
- if (
- Purpose_Type__c &&
- (Purpose_Type__c.substr(-3) == "SIS" ||
- Purpose_Type__c.substr(-3) == "OPD")
- ) {
- if (!Result__c) {
- error.push("缁撴灉 涓嶅瓨鍦�");
- }
- }
- for (var i = 0; i < error.length; i++) {
- this.warning(error[i]);
- }
- if (error.length > 0) {
- component.find("save_button").set("v.disabled", false);
- return false;
- }
-
- // 淇濆瓨鍑︾悊
- 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");
- debugger;
- // alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c);
- action.setParams({
- Agency_Report_Id: Agency_Report__c,
- Department_Cateogy: Department_Cateogy__c,
- Purpose_Type: Purpose_Type__c,
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- SupportNeedsc: SupportNeeds__c,
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- Agency_Report_Header: Agency_Report_Header__c,
- Agency_Hospital: Agency_Hospital__c,
- Person_In_Charge2: Person_In_Charge2__c,
- doctor: doctor2__c,
- Submit_date: Submit_date__c,
- Product_Category1: Product_Category1__c,
- Product_Category2: Product_Category2__c,
- Product_Category3: Product_Category3__c,
- Result: Result__c,
- Opportunity: Opportunity__c,
- StageName: StageName__c,
- oppAmount: Amount__c,
- oppOCMPrice: OCMSale_Price__c,
- Close_Forecasted_Date: Close_Forecasted_Date__c,
- Report_Date: Report_Date__c
- });
-
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- this.success("缂栬緫淇濆瓨鎴愬姛");
- var report_id = response.getReturnValue();
- component.set("v.create_agency_report_id", report_id);
-
- var select_agency_list =
- component.get("v.allselectlist").AgencyPerson__c;
- for (var i = 0; i < select_agency_list.length; i++) {
- if (
- select_agency_list[i].value ==
- component.get("v.select_report_data").Person_In_Charge2__c
- ) {
- select_agency_list[i].selected = true;
- } else {
- select_agency_list[i].selected = false;
- }
- }
- component
- .find("select_agency_person")
- .set("v.options", select_agency_list);
-
- component.set("v.update_select_report_data_id", report_id);
- this.get_reports_edit(
- 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.loginEdit", false);
- } else {
- // var error = response.getError();
- // alert(JSON.stringify(error));
- // alert(JSON.stringify(error[0].fieldErrors));
- // alert(JSON.stringify(error[0].fieldErrors.next()));
- // alert(JSON.stringify(error[0].fieldErrors.next()[0]));
- // if (this.error(response.getError()[0].message))
- // else () {
- // error[0].fieldErrors[0]
- // }
- this.error("save_report failed.");
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- } else {
- /* Save (New & Copy) */
-
- var action = component.get("c.saveAgencyReport");
- debugger;
- // alert(SupportNeeds__c);
- action.setParams({
- Department_Cateogy: Department_Cateogy__c,
- Purpose_Type: Purpose_Type__c,
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- SupportNeedsc: SupportNeeds__c,
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- Agency_Report_Header: Agency_Report_Header__c,
- Agency_Hospital: Agency_Hospital__c,
- Person_In_Charge2: Person_In_Charge2__c,
- doctor: doctor2__c,
- Submit_date: Submit_date__c,
- Product_Category1: Product_Category1__c,
- Product_Category2: Product_Category2__c,
- Product_Category3: Product_Category3__c,
- Result: Result__c,
- Opportunity: Opportunity__c,
- StageName: StageName__c,
- oppAmount: Amount__c,
- oppOCMPrice: OCMSale_Price__c,
- Close_Forecasted_Date: Close_Forecasted_Date__c,
- Report_Date: Report_Date__c
- });
-
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- this.success("淇濆瓨鎴愬姛");
- var report_id = response.getReturnValue();
- component.set("v.create_agency_report_id", report_id);
-
- this.get_reports_edit(
- component,
- event,
- helper,
- component.find("select_date").get("v.value"),
- component.find("select_agency_person").get("v.value")
- );
-
- // 銉€兗銉�銉偊銈c兂銉夈偊鍐呫伄涓�瑕х敤
- var action2 = component.get("c.getReportsById");
- action2.setParams({
- report_id: report_id
- });
- action2.setCallback(this, function (response) {
+ doinit : function(component, event, helper) {
+ this.report_date_list(component, event, helper, 5);
+ component.set('v.login',true);
+ var action = component.get('c.getalldata');
+ action.setCallback(this,function(response){
var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- var reports_now = component.get("v.reports_now");
- var reports_now_count = 0;
- if (reports_now.length > 0 && reports_now != "") {
- reports_now_count = reports_now.length;
- }
-
- // Save&New鏅傘伄銈︺偅銉炽儔銈﹀唴銉囥兗銈夸竴瑕�
- if (res.length > 0) {
- // 20220222 PI鏀归�� by Bright--start
- res[0].doctor2NameOrigin = doctor2Name;
- res[0].visitorTitleOrigin = visitortitle;
- // 20220222 PI鏀归�� by Bright--end
- reports_now[reports_now_count] = res[0];
-
- reports_now.sort(function (a, b) {
- if (a.Name > b.Name) return -1;
- if (a.Name < b.Name) return 1;
- return 0;
- });
-
- component.set("v.reports_now", reports_now);
- component.set("v.reports_now_count", reports_now.length);
- var data_list = component.find("modal_data_list_tr");
- }
- } else {
- this.error("get_reports_now failed.");
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
+ 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);
+ // PIPL update Yin Mingjie 21/02/2022 start
+ component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c));
+ // this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c);
+ // PIPL update Yin Mingjie 21/02/2022 end
+ component.find('select_department').set('v.options', this.conv_selected(res.allselectlist.Department_Cateogy__c));
+ component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.Purpose_Type__c));
+ component.find('select_result').set('v.options', this.conv_selected(res.allselectlist.Result__c));
+ component.find('select_stageName').set('v.options', this.conv_selected(res.allselectlist.StageName__c));
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ component.find('SupportNeeds__c').set('v.options', this.conv_selected(res.allselectlist.SupportNeeds__c));
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ component.set('v.selected_agency_person', res.allselectlist.AgencyPerson__c[0].label);
+ component.set('v.dialog_type', '鏂板缓');
+ component.set('v.awsurl', res.awsurl);// 20220222 PI鏀归�� by Bright
+ component.set('v.contactawsurl', res.contactawsurl);// 20220222 PI鏀归�� by Bright
+
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
+
+ component.set('v.login',false);
}
- });
- $A.enqueueAction(action2);
-
- this.allclear(component);
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
- } else {
- var error = response.getError();
- // alert(JSON.stringify(error));
- this.error("saveAgencyReport failed.");
- component.find("save_button").set("v.disabled", false);
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- }
- },
-
- allclear: function (component) {
- var clear = [{ label: "", value: "", selected: true }];
- component.set("v.hospital", "");
- component.set("v.hospitalId", "");
- component.set("v.hospitalLinkId", "");
- component.find("new_con").set("v.disabled", true);
- component.find("select_doctor").set("v.options", clear);
- component.set("v.doctor_title", "");
- component
- .find("select_department")
- .set(
- "v.options",
- this.conv_selected(
- component.get("v.allselectlist.Department_Cateogy__c")
- )
- );
- component
- .find("select_purpose_type")
- .set(
- "v.options",
- this.conv_selected(component.get("v.allselectlist.Purpose_Type__c"))
- );
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- component
- .find("SupportNeeds__c")
- .set(
- "v.options",
- this.conv_selected(component.get("v.allselectlist.SupportNeeds__c"))
- );
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
- // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
- component.set("v.data.Opportunity__c", "");
- component.find("select_Product1").set("v.value", "");
- component.find("select_Product2").set("v.value", "");
- component.find("select_Product3").set("v.value", "");
- console.log("reportDate = 绌�");
- component.set("v.data.Report_Date__c", "");
- component.set("v.oppdata.Close_Forecasted_Date__c", "");
- component.set("v.oppdata.Amount__c", "");
- component.set("v.oppdata.OCMSale_Price__c", "");
- component.set("v.oppdata.StageName__c", "");
- // component.set('v.oppdata', '');
- component.set("v.Close_Forecasted_Date__c_o", "");
- component.set("v.Amount__c_o", "");
- component.set("v.OCMSale_Price__c_o", "");
- component.set("v.StageName__c_o", "");
- $A.util.addClass(component.find("input-opportunity-stage"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-amount1"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-amount2"), "disp_none");
- $A.util.addClass(component.find("input-opportunity-date"), "disp_none");
- $A.util.removeClass(component.find("input-opportunity-blank"), "disp_none");
- // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
- // var values = [];
- // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
- // } else {
- // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
- // }
- // component.find('input-opportunity').set("v.body",[]);
- // if (component.find('input-product-category1'))
- // component.find('input-product-category1').get("v.body")[0].set('v.values', values);
- // if (component.find('input-product-category2'))
- // component.find('input-product-category2').get("v.body")[0].set('v.values', values);
- // if (component.find('input-product-category3'))
- // component.find('input-product-category3').get("v.body")[0].set('v.values', values);
- component.find("select_result").set("v.value", "");
- this.select_purpose_type(component);
- },
-
- report_date_list: function (component, event, helper, count) {
- var ret_obj = [];
- var now = new Date();
- for (var i = 0; i < count; i++) {
- var start_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() + 1 - i * 7
- );
- var end_day = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() + (7 - now.getDay()) - i * 7
- );
-
- var start_day_show = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - now.getDay() - i * 7
- );
- var end_day_show = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() + (6 - now.getDay()) - i * 7
- );
- var date_text =
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate() +
- "~" +
- end_day.getFullYear() +
- "/" +
- (end_day.getMonth() + 1) +
- "/" +
- end_day.getDate();
- if (i == 0) {
- ret_obj.push({
- selected: true,
- value:
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate(),
- label:
- start_day_show.getFullYear() +
- "/" +
- (start_day_show.getMonth() + 1) +
- "/" +
- start_day_show.getDate() +
- "~" +
- end_day_show.getFullYear() +
- "/" +
- (end_day_show.getMonth() + 1) +
- "/" +
- end_day_show.getDate()
+ else{
+ this.error('doinit failed.');
+ component.set('v.login',false);
+ }
});
- } else {
- ret_obj.push({
- selected: false,
- value:
- start_day.getFullYear() +
- "/" +
- (start_day.getMonth() + 1) +
- "/" +
- start_day.getDate(),
- label:
- start_day_show.getFullYear() +
- "/" +
- (start_day_show.getMonth() + 1) +
- "/" +
- start_day_show.getDate() +
- "~" +
- end_day_show.getFullYear() +
- "/" +
- (end_day_show.getMonth() + 1) +
- "/" +
- end_day_show.getDate()
+ $A.enqueueAction(action);
+ },
+
+ // PIPL update Yin Mingjie 21/02/2022 start
+ search_contact : function(component, event, helper, resobj) {
+ let contactData = Object.create(null);
+ var dataArr = new Array();
+ for (let i = 0; i < resobj.length; i++) {
+ if (resobj[i].awsid != null && resobj[i].awsid != ''){
+ contactData[resobj[i].awsid] = resobj[i];
+ dataArr.push(resobj[i].awsid);
+ }
+ }
+ let obj= Object.create(null);
+ obj['dataIds'] = dataArr;
+ var payload = JSON.stringify(obj);
+ this.search_contact_url(component, 'Contact', (result)=>{
+ var token = result.token;
+ var searchUrl = result.searchUrl;
+ this.search_core(token,searchUrl,payload,(result)=>{
+ if(result.status == '0'){
+ if(result.object != null){
+ this.to_contact_list(result,contactData,component);
+ }else{
+ component.set('v.loginEdit',false);
+ }
+ }else{
+ this.error('AWS search status1 : ' + result.status);
+ component.set('v.loginEdit',false);
+ }
+ },component);
+
});
- }
- }
+ },
- component.find("select_date").set("v.options", ret_obj);
- component.set("v.report_date_list", ret_obj);
- },
+ to_contact_list : function(result,retMap,component) {
+ var resls = result.object;
+ var res = [];
+ var space = {};
+ space['label'] = '';
+ space['selected'] = true;
+ space['value'] = '';
+ res.push(space);
- create_report_header: function (component, name, s_agency, s_date) {
- s_date = this.get_date_string(s_date);
- if (s_date == false) {
- this.error("get_date_string failed.");
- return false;
- }
-
- var head_key = this.create_header_input_key(s_agency, s_date);
- component.set("v.agency_report_header", head_key);
- if (head_key == false) {
- this.error("create_header_input_key failed.");
- return false;
- }
-
- var key2 = s_date.replace(/-/g, "");
- var action = component.get("c.createReportHeader");
-
- action.setParams({
- name: name,
- s_date: s_date,
- s_agency: s_agency,
- head_key: head_key
- });
-
- component.set("v.login", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- component.set("v.agency_report_header_id", res);
- component.set("v.login", false);
- this.toggle_report(component);
- } else {
- this.error("createReportHeader callback failed.");
- component.set("v.login", false);
- }
- });
- $A.enqueueAction(action);
- },
-
- create_header_input_key: function (agency_id, s_date) {
- if (typeof s_date != "string") {
- s_date = this.get_date_string(s_date);
- if (s_date == false) {
- this.error("get_date_string in create_header_input_key.");
- return false;
- }
- }
- if (!agency_id || !s_date) {
- return false;
- }
-
- s_date = s_date.replace(/-/g, "");
- var headkey = agency_id + ":" + s_date;
-
- return headkey;
- },
-
- /* typeof is not cool
- * @ret : String, Boolean, Date, Error, Array, Function, Null, Undefined, etc
- */
- object_type: function (obj) {
- var obj_type = Object.prototype.toString.call(obj).slice(8, -1);
- return obj_type;
- },
-
- // create yyyy-mm-dd string
- get_date_string: function (val) {
- if (typeof val == "string") {
- if (val.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) {
- val = val.replace(/[\/]/g, "-");
- var tmp = val.split("-");
- if (tmp[1].length == 1) {
- tmp[1] = "0" + tmp[1];
+ for (var i = 0; i < resls.length; i++) {
+ var t = {};
+ t['label'] = resls[i].lastName;
+ t['selected'] = false;
+ t['Doctor_Division1__c'] = resls[i].doctorDivision1;
+ t['value'] = retMap[resls[i].dataId].value;
+ res.push(t);
}
- if (tmp[2].length == 1) {
- tmp[2] = "0" + tmp[2];
+ component.find('select_agency_person').set('v.options',res);
+ component.set('v.allselectlistAgencyPerson',res);
+ component.set('v.loginEdit',false);
+ },
+
+ search_contact_url : function(component, sobject, callback) {
+ var action = component.get('c.getAwsurl');
+ action.setParams({
+ "sobj" : sobject,
+ });
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var result = response.getReturnValue();
+ if(callback)callback(result);
+ }
+ else{
+ this.error('AWS url/token error.');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ // PIPL update Yin Mingjie 21/02/2022 end
+
+ select_department : function(component, event, helper) {
+ var dc = component.find("select_department").get("v.value");
+ dc = dc ? '%'+dc+'%' : '';
+ var purpose_type = component.find("select_purpose_type").get("v.value");
+ if (purpose_type) {
+ if (purpose_type.substr(-3) == 'OPD') {
+ purpose_type = 'OPD';
+ } else if (purpose_type.substr(-3) == 'SIS') {
+ purpose_type = 'SIS';
+ } else {
+ purpose_type = '';
+ }
}
- val = tmp[0] + "-" + tmp[1] + "-" + tmp[2];
- } else if (val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) {
- //ok
- } else {
- return false;
- }
- } else if (this.object_type(val) == "Date") {
- var mm = val.getMonth() + 1;
- if (String(mm).length == 1) {
- mm = "0" + mm;
- }
+ if (dc != '' || purpose_type != '') {
- var dd = "";
- if (String(val.getDate()).length == 1) {
- dd = "0" + val.getDate();
- } else {
- dd = val.getDate();
- }
+ var action = component.get('c.getProductList');
+ action.setParams({
+ "dc" : dc,
+ "opdsis" : purpose_type,
+ });
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
- val = val.getFullYear() + "-" + mm + "-" + dd;
- } else {
- return false;
- }
-
- return val;
- },
-
- searchHos: function (component, event, helper) {
- var hospital_name = event.getParam("value");
- var action = component.get("c.getHospitalList");
- debugger;
- action.setParams({ hospital_name: hospital_name });
-
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var hospital_list = component.find("hospital_list");
- var hosList = response.getReturnValue();
- if (hosList.length > 0) {
- $A.util.addClass(hospital_list, "slds-is-open");
+ var res = response.getReturnValue();
+ component.find('select_Product1').set("v.options", JSON.parse(JSON.stringify(res)));
+ component.find('select_Product2').set("v.options", JSON.parse(JSON.stringify(res)));
+ component.find('select_Product3').set("v.options", JSON.parse(JSON.stringify(res)));
+ }
+ else{
+ this.error('getProductList failed.');
+ }
+ });
+ $A.enqueueAction(action);
} else {
- $A.util.removeClass(hospital_list, "slds-is-open");
+ component.find('select_Product1').set('v.options', []);
+ component.find('select_Product2').set('v.options', []);
+ component.find('select_Product3').set('v.options', []);
}
- component.set("v.hospitalList", response.getReturnValue());
- } else {
- $A.util.removeClass(hospital_list, "slds-is-open");
- }
- });
- $A.enqueueAction(action);
- },
+ },
- hideSearch: function (component, event, helper) {
- var hospital_list = component.find("hospital_list");
- $A.util.removeClass(hospital_list, "slds-is-open");
- },
+ get_reports : function(component, event, helper, date_str, person_str) {
+ if (!date_str) {
+ return false;
+ }
+
+ date_str = this.get_date_string(date_str);
+
+ var action = component.get('c.getReports');
+ action.setParams({
+ "date_str" : date_str,
+ "person_str" : person_str,
+ });
- selectHos: function (component, event, helper) {
- debugger;
- var hospital_list = component.find("hospital_list");
- $A.util.removeClass(hospital_list, "slds-is-open");
- var accname = event.currentTarget.dataset.accname;
- var accid = event.currentTarget.dataset.accid;
- var hospital_data = component.get("v.hospitalList");
- for (var i = 0; i < hospital_data.length; i++) {
- if (hospital_data[i].Hospital__c == accid) {
- component.set("v.hospitalLinkId", hospital_data[i].Id);
- component.set("v.data.Agency_Hospital__c", hospital_data[i].Id);
- component.find("new_con").set("v.disabled", false);
- }
- }
- component.set("v.hospital", accname);
- component.set("v.hospitalId", accid);
- this.set_doctor_list(component);
- this.opportunityChange(component, event, helper);
- },
+ component.set('v.login',true);
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var res = response.getReturnValue();
+ component.set('v.reports', res.reports);
+
+ // 20220222 PI鏀归�� by Bright--start
+ let dataIds = [];
+ let dataIds1 = [];
+ let mm = {};
+ let b = false;
+ let b1 = false;
+ for (const rep of res.reports) {
+ if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) {
+ dataIds.push(rep.doctor2__r.AWS_Data_Id__c);
+ }
- select_purpose_type: function (component) {
- var purpose_type = component.find("select_purpose_type").get("v.value");
- if (
- (purpose_type != null &&
- purpose_type != undefined &&
- purpose_type.substr(-3) == "OPD") ||
- purpose_type.substr(-3) == "SIS"
- ) {
- var result = component.find("result");
- $A.util.removeClass(result, "disp_none");
- } else {
- component.find("select_result").set("v.value", "");
- var result = component.find("result");
- $A.util.addClass(result, "disp_none");
- }
- this.select_department(component, null, null);
- },
+ if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c) {
+ dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c);
+ }
+ }
+ let Foo = null;
+ Foo = function(){
+ if(b && b1){
+ for (const rep of res.reports) {
+ if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)) {
+ rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c];
+ }
+ if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c)) {
+ rep.Person_In_Charge2__r.awsdata = mm[rep.Person_In_Charge2__r.AWS_Data_Id__c];
+ }
+ }
- doctor_change: function (component, event, helper) {
- var doctor_value = component.find("select_doctor").get("v.value");
- var doctor_list = component.get("v.doctor_list");
- var flg = false;
- for (var i = 0; i < doctor_list.length; i++) {
- if (doctor_list[i].value == doctor_value) {
- component.set("v.doctor_title", doctor_list[i].Doctor_Division1__c);
- flg = true;
- break;
- }
- }
- if (flg == false) {
- component.set("v.doctor_title", "");
- }
- },
- // PIPL update Yin Mingjie 21/02/2022 start
- set_aws_url: function (component, sobject) {
- var action = component.get("c.getAwsurl");
- action.setParams({
- sobj: sobject
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var awsmap = this.conv_selected(response.getReturnValue());
- component.set("v.AWStoken", awsmap.token);
- component.set("v.AWSinsert", awsmap.newUrl);
- component.set("v.AWSsearch", awsmap.searchUrl);
- component.set("v.AWStransactionURL", awsmap.transactionURL);
- } else {
- this.error("AWS url/token error.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
+ $A.getCallback(()=>component.set('v.reports', res.reports))();
+ }else{
+ console.log('b='+b + ',b1='+b1+',continue');
+ setTimeout(Foo,100);
+ }
+ }
+
+ if(dataIds.length > 0){
+ let awsurl = component.get('v.awsurl');
+ helper.search_core(awsurl.token,awsurl.searchUrl,JSON.stringify({
+ "dataIds":dataIds
+ }),(result)=>{
+ if(result.status == '0'){
+
+ for (const m of result.object) {
+ mm[m.dataId] = m;
+ }
+ b = true;
+ Foo();
+ }else{
+ //this.error('AWS search status2 : ' + result.status);
+ this.success('璇烽噸鏂板埛鏂伴〉闈㈣繘琛岃В瀵�');
+ }
+ },component);
+ }else{
+ b = true;
+ }
- insert_agencycontact: function (
- component,
- token,
- newUrl,
- payload,
- agencyHospitalid,
- helper,
- hospitalName
- ) {
- // AWSService.insert(newUrl,payload,function(result){
- // if(result.status == '0'){
- // $A.getCallback(function(){
- // helper.to_agencycontact(component,result,agencyHospitalid);
- // })();
+
+
+ if(dataIds1.length > 0){
+ let contactawsurl = component.get('v.contactawsurl');
+ helper.search_core(contactawsurl.token,contactawsurl.searchUrl,JSON.stringify({
+ "dataIds":dataIds1
+ }),(result)=>{
+ if(result.status == '0'){
+
+ for (const m of result.object) {
+ mm[m.dataId] = m;
+ }
+ b1 = true;
+ Foo();
+ }else{
+ this.error('AWS search status3 : ' + result.status);
+ }
+ },component);
+ }else{
+ b1 = true;
+ }
+ // 20220222 PI鏀归�� by Bright--end
- // }else{
- // console.log('AWS status error:' + result)
- // component.set('v.login',false);
- // component.find('OppMessage').setError('AWS insert error.');
- // }
- // },token);
+ component.set('v.report_count', res.reports.length);
- fetch(newUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- if (result.status == "0") {
- $A.getCallback(function () {
- helper.to_agencycontact(component, result, agencyHospitalid);
- })();
+ // 鏇存柊淇濆瓨寰屻伄select_data鐢�
+ var report_id = component.get('v.update_select_report_data_id');
+
+ if (report_id != "") {
+ for (i = 0; i < res.reports.length; i++) {
+ if (res.reports[i]['Id'] == report_id) {
+ component.set('v.select_report_data', res.reports[i]);
+ break;
+ }
+ }
+ component.set('v.update_select_report_data_id', '');
+ }
+
+ if (res.reports.length > 0) {
+ component.set('v.list_message', '');
+ } else {
+ component.set('v.list_message', 'no_data');
+ }
+ component.set('v.login',false);
+ }
+ else{
+ this.error('get_reports failed.');
+ component.set('v.login',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+ get_reports_edit : function(component, event, helper, date_str, person_str) {
+ if (!date_str) {
+ return false;
+ }
+
+ date_str = this.get_date_string(date_str);
+
+ var action = component.get('c.getReports');
+ action.setParams({
+ "date_str" : date_str,
+ "person_str" : person_str,
+ });
+
+ component.set('v.loginEdit',true);
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var res = response.getReturnValue();
+ component.set('v.reports', res.reports);
+
+ // 20220222 PI鏀归�� by Bright--start
+ let dataIds = [];
+ let dataIds1 = [];
+ let mm = {};
+ let b = false;
+ let b1 = false;
+ for (const rep of res.reports) {
+ if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) {
+ dataIds.push(rep.doctor2__r.AWS_Data_Id__c);
+ }
+
+ if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c) {
+ dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c);
+ }
+ }
+ let Foo = null;
+ Foo = function(){
+ if(b && b1){
+ for (const rep of res.reports) {
+ if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)) {
+ rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c];
+ }
+ if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c)) {
+ rep.Person_In_Charge2__r.awsdata = mm[rep.Person_In_Charge2__r.AWS_Data_Id__c];
+ }
+ }
+
+ $A.getCallback(()=>component.set('v.reports', res.reports))();
+ }else{
+ console.log('b='+b + ',b1='+b1+',continue');
+ setTimeout(Foo,100);
+ }
+ }
+
+ if(dataIds.length > 0){
+ let awsurl = component.get('v.awsurl');
+ helper.search_core(awsurl.token,awsurl.searchUrl,JSON.stringify({
+ "dataIds":dataIds
+ }),(result)=>{
+ if(result.status == '0'){
+
+ for (const m of result.object) {
+ mm[m.dataId] = m;
+ }
+ b = true;
+ Foo();
+ }else{
+ //this.error('AWS search status2 : ' + result.status);
+ this.success('璇烽噸鏂板埛鏂伴〉闈㈣繘琛岃В瀵�');
+ }
+ },component);
+ }else{
+ b = true;
+ }
+
+
+
+ if(dataIds1.length > 0){
+ let contactawsurl = component.get('v.contactawsurl');
+ helper.search_core(contactawsurl.token,contactawsurl.searchUrl,JSON.stringify({
+ "dataIds":dataIds1
+ }),(result)=>{
+ if(result.status == '0'){
+
+ for (const m of result.object) {
+ mm[m.dataId] = m;
+ }
+ b1 = true;
+ Foo();
+ }else{
+ this.error('AWS search status3 : ' + result.status);
+ }
+ },component);
+ }else{
+ b1 = true;
+ }
+ // 20220222 PI鏀归�� by Bright--end
+
+ component.set('v.report_count', res.reports.length);
+
+ // 鏇存柊淇濆瓨寰屻伄select_data鐢�
+ var report_id = component.get('v.update_select_report_data_id');
+
+ if (report_id != "") {
+ for (i = 0; i < res.reports.length; i++) {
+ if (res.reports[i]['Id'] == report_id) {
+ component.set('v.select_report_data', res.reports[i]);
+ break;
+ }
+ }
+ component.set('v.update_select_report_data_id', '');
+ }
+
+ if (res.reports.length > 0) {
+ component.set('v.list_message', '');
+ } else {
+ component.set('v.list_message', 'no_data');
+ }
+ component.set('v.loginEdit',false);
+ }
+ else{
+ this.error('get_reports failed.');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ select_date_change : function(component, event, helper) {
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
+ this.new_button_disabled(component, event, helper);
+
+ component.set('v.select_report_data_radio', '');
+ component.find('copy_button').set('v.disabled', true);
+ },
+
+ select_agency_change : function(component, event, helper) {
+ var select_value = component.find('select_agency_person').get('v.value');
+ var new_label = this.get_agency_person_name(component, select_value);
+ component.set('v.selected_agency_person', new_label);
+
+ this.get_reports(component, event, helper, component.find('select_date').get('v.value'), select_value);
+ this.new_button_disabled(component, event, helper);
+
+ component.set('v.select_report_data_radio', '');
+ component.find('copy_button').set('v.disabled', true);
+ },
+
+ get_agency_person_name : function(component, agency_person_value) {
+ // PIPL update Yin Mingjie 21/02/2022 start
+ var allselectlist = component.get('v.allselectlist.AgencyPerson__c');
+ // var allselectlist = component.get('v.allselectlistAgencyPerson');
+ // PIPL update Yin Mingjie 21/02/2022 end
+ var new_label = '';
+ for (var i = 0; i < allselectlist.length; i++) {
+ if (agency_person_value == allselectlist[i].value) {
+ new_label = allselectlist[i].label;
+ break;
+ }
+ }
+ return new_label;
+ },
+
+ new_button_disabled : function(component, event, helper) {
+ var select_date = component.find('select_date').get('v.value');
+ var select_agency = component.find('select_agency_person').get('v.value');
+ if (select_date && select_agency) {
+ component.find('new_button').set('v.disabled', false);
} else {
- console.log("AWS status error:" + result);
- component.set("v.loginEdit", false);
- if (result.status == "129") {
- component
- .find("OppMessage")
- .setError(
- "璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪" + hospitalName + "鍖婚櫌锛岃淇敼"
- );
- } else {
- component.find("OppMessage").setError("AWS insert error.");
- }
+ component.find('new_button').set('v.disabled', true);
}
- })
- .catch((error) => {
- console.log("AWS insert error:" + error);
- component.set("v.loginEdit", false);
- component.find("OppMessage").setError("AWS insert error.");
- });
- },
+ },
+
+ toggle_report : function(component) {
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ if ($A.util.hasClass(modal_window, 'disp_none')) {
+ // OPEN
+ $A.util.removeClass(modal_window, 'disp_none');
+ $A.util.removeClass(modal_bg, 'disp_none');
+ component.set('v.loginEdit',true);
+ if (component.get('v.mode') == 'edit' || component.get('v.mode') == 'copy') {
+ var select_data = '';
+ if (component.get('v.mode') == 'edit') {
+ select_data = component.get('v.select_report_data');
+ } else if (component.get('v.mode') == 'copy') {
+ select_data = component.get('v.select_report_data_radio');
+ }
+
+ var reports = component.get('v.reports');
+ var Agency_Hospital_text = '';
+ var Agency_Hospital_parent_id = '';
+ debugger
+ // 鍖婚櫌鍚�
+ if (select_data['Agency_Hospital__c'] != '') {
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i]['Agency_Hospital__c'] == select_data['Agency_Hospital__c']) {
+ Agency_Hospital_text = reports[i]['Agency_Hospital__r']['Name'];
+ Agency_Hospital_parent_id = reports[i]['Agency_Hospital__r']['Hospital__c'];
+ }
+ }
+ component.set('v.hospital', Agency_Hospital_text);
+ component.set('v.hospitalId', Agency_Hospital_parent_id);
+ component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']);
+ component.find('new_con').set('v.disabled', false);
+ }
+
+ // 绉戝
+ if (select_data['Department_Cateogy__c'] != '') {
+ this.set_selected(component, 'select_department', select_data['Department_Cateogy__c']);
+ }
+ // 鎷滆浜�
+ component.set('v.default_select_doctor_id', select_data['doctor2__c']);
+ this.set_doctor_list(component);
+
+ // 娲诲姩鍖哄垎
+ if (select_data['Purpose_Type__c'] != '') {
+ this.set_selected(component, 'select_purpose_type', select_data['Purpose_Type__c']);
+ this.select_purpose_type(component);
+ }
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ // 鏀彺闇�姹�
+ if (select_data['SupportNeeds__c'] != '') {
+ this.set_selected(component, 'SupportNeeds__c', select_data['SupportNeeds__c']);
+ }
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ // 绲愭灉
+ if (select_data['Result__c'] != '' && typeof select_data['Result__c'] !== "undefined") {
+ component.find('select_result').set('v.value', select_data['Result__c']);
+ }
+
+ // 璇环
+ var report_id = component.get('v.edit_copy_select_report_id');
+ if (report_id != "") {
+ var select_opp = '';
+ var select_product_category1 = '';
+ var select_product_category2 = '';
+ var select_product_category3 = '';
+ var reportDate;
+ var i = 0;
+ for (i = 0; i < reports.length; i++) {
+ if (report_id == reports[i]["Id"]) {
+ select_opp = reports[i]["Opportunity__c"];
+ select_product_category1 = reports[i]["Product_Category1__c"];
+ select_product_category2 = reports[i]["Product_Category2__c"];
+ select_product_category3 = reports[i]["Product_Category3__c"];
+ reportDate = reports[i]["Report_Date__c"];
+ break;
+ }
+ }
+
+ // 璇环
+ if (select_opp != null && select_opp != '') {
+ var select_opp_name = component.get('v.reports')[i].OppName__c;
+ component.set('v.data.Opportunity__c', select_opp);
+ if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+ var values = [{
+ type: 'Agency_Opportunity__c',
+ id: select_opp,
+ label: select_opp_name,
+ icon : {
+ url:'/img/icon/t4v35/custom/custom12_120.png',
+ backgroundColor:'dc71d1',
+ alt:'Agency_Opportunity__c'
+ }
+ }];
+ component.set('v.data.Opportunity__c', select_opp);
+ // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
+ } else {
+ component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', select_opp_name);
+ }
+ }
+
+ // 浜у搧鍖哄垎
+ if (select_product_category1 != null && select_product_category1 != '') {
+ component.find('select_Product1').set('v.value', select_product_category1);
+ }
+ if (select_product_category2 != null && select_product_category2 != '') {
+ component.find('select_Product2').set('v.value', select_product_category2);
+ }
+ if (select_product_category3 != null && select_product_category3 != '') {
+ component.find('select_Product3').set('v.value', select_product_category3);
+ }
- to_agencycontact: function (component, result, agencyHospitalid) {
- var action = component.get("c.saveAgencyContact");
- action.setParams({
- name: result.object[0].name,
- //"nameEncrypt" : result.object[0].nameEncrypt,
- type: result.object[0].type,
- //"typeEncrypt" : result.object[0].typeEncrypt,
- doctorDivision1: result.object[0].doctorDivision1,
- //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt,
- agencyHospitalid: agencyHospitalid,
- awsid: result.object[0].dataId
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var acMap = this.conv_selected(response.getReturnValue());
- console.log(acMap);
- if (acMap.AgencyContactId != "") {
- //纭浜嬪姟
- var token = component.get("v.AWStoken");
- var confirmUrl = component.get("v.AWStransactionURL");
-
- let data = Object.create(null);
- data["isSuccess"] = 1;
- data["sfRecordId"] = "";
- data["txId"] = result.txId;
-
- this.to_confirm(component, token, confirmUrl, JSON.stringify(data));
- } else if (acMap.errormsg != "") {
- this.error(acMap.errormsg);
- component.set("v.loginEdit", false);
+ if (reportDate != null) {
+ console.log('reportDate = ' + reportDate);
+ component.set('v.data.Report_Date__c', reportDate);
+ }
+
+ component.set('v.edit_copy_select_report_id', "");
+ }
+ }
+ setTimeout(function() {
+ component.set('v.loginEdit',false);
+ }, 1000);
} else {
- this.error("agency contact insert id error.");
- component.set("v.loginEdit", false);
- }
- } else {
- this.error("agency contact insert error.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
+ // CLOSE
- to_confirm: function (component, token, confirmUrl, payload) {
- fetch(confirmUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- if (
- result.status == "0" &&
- result.hasOwnProperty("success") &&
- result.success
- ) {
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- this.success(".瀹㈡埛浜哄憳宸插垱寤恒��");
- this.set_doctor_list(component);
+ var select_report_data = component.get('v.select_report_data');
+ var Report_Date__c = component.get('v.data.Report_Date__c');
+ var Agency_Hospital__c = component.get('v.hospitalLinkId');
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ var doctor2__c = component.find('select_doctor').get('v.value');
+ var Purpose_Type__c = component.find('select_purpose_type').get('v.value');
+ var SupportNeeds__c = component.find('SupportNeeds__c').get('v.value');
+ var Opportunity__c = component.get('v.data.Opportunity__c');
+ var Product_Category1__c = component.find('select_Product1').get('v.value');
+ var Product_Category2__c = component.find('select_Product2').get('v.value');
+ var Product_Category3__c = component.find('select_Product3').get('v.value');
+ var Result__c = component.find('select_result').get('v.value');
+
+ if (select_report_data !== null) {
+ if (typeof select_report_data['Opportunity__c'] === "undefined") {
+ select_report_data['Opportunity__c'] = "";
+ }
+ if (typeof select_report_data['Product_Category1__c'] === "undefined") {
+ select_report_data['Product_Category1__c'] = "";
+ }
+ if (typeof select_report_data['Product_Category2__c'] === "undefined") {
+ select_report_data['Product_Category2__c'] = "";
+ }
+ if (typeof select_report_data['Product_Category3__c'] === "undefined") {
+ select_report_data['Product_Category3__c'] = "";
+ }
+ if (typeof select_report_data['Result__c'] === "undefined") {
+ select_report_data['Result__c'] = "";
+ }
+ }
+
+ if (component.get('v.mode') == 'new') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鍛ㄦ姤锛�';
+
+ if (!Report_Date__c &&
+ !Agency_Hospital__c &&
+ !Department_Cateogy__c &&
+ !doctor2__c &&
+ !Purpose_Type__c &&
+ !SupportNeeds__c&&//WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
+ !Opportunity__c &&
+ !Product_Category1__c &&
+ !Product_Category2__c &&
+ !Product_Category3__c &&
+ !Result__c)
+ {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'copy') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純鏂板缓鍛ㄦ姤锛�';
+
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['Purpose_Type__c'] == Purpose_Type__c &&
+ select_report_data['SupportNeeds__c'] == SupportNeeds__c &&//WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
+ select_report_data['Opportunity__c'] == Opportunity__c &&
+ select_report_data['Product_Category1__c'] == Product_Category1__c &&
+ select_report_data['Product_Category2__c'] == Product_Category2__c &&
+ select_report_data['Product_Category3__c'] == Product_Category3__c &&
+ select_report_data['Result__c'] == Result__c)
+ {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ } else if (component.get('v.mode') == 'edit') {
+ var confirm_title = '璀﹀憡!'
+ var confirm_text = '鏀惧純缂栬緫鍛ㄦ姤锛�';
+
+ if (select_report_data['Report_Date__c'] == Report_Date__c &&
+ select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
+ select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
+ select_report_data['doctor2__c'] == doctor2__c &&
+ select_report_data['Purpose_Type__c'] == Purpose_Type__c &&
+ select_report_data['SupportNeeds__c'] == SupportNeeds__c &&//WAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔�
+ select_report_data['Opportunity__c'] == Opportunity__c &&
+ select_report_data['Product_Category1__c'] == Product_Category1__c &&
+ select_report_data['Product_Category2__c'] == Product_Category2__c &&
+ select_report_data['Product_Category3__c'] == Product_Category3__c &&
+ select_report_data['Result__c'] == Result__c)
+ {
+ this.allclear(component);
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ } else {
+ this.close_confirm(component, confirm_title, confirm_text);
+ }
+ }
+
+ }
+ },
+
+ close_confirm : function(component, title, text) {
+ var confirm_status = component.get('v.confirm_status');
+ component.set('v.modal_confirm_title', title);
+ component.set('v.modal_confirm_text', text);
+ var modal_window = component.find('modal_window');
+ var modal_bg = component.find('modal_bg');
+ var modal_confirm = component.find('modal_confirm');
+ var modal_confirm_bg = component.find('modal_confirm_bg');
+
+ if (confirm_status == 0) {
+ $A.util.addClass(modal_window, 'disp_none');
+ $A.util.addClass(modal_bg, 'disp_none');
+ $A.util.removeClass(modal_confirm, 'disp_none');
+ $A.util.removeClass(modal_confirm_bg, 'disp_none');
+ } else if (confirm_status == 1) {
+ // 鏄�
+ $A.util.addClass(modal_confirm, 'disp_none');
+ $A.util.addClass(modal_confirm_bg, 'disp_none');
+ component.set('v.mode', '');
+ this.allclear(component);
+ component.set('v.reports_now', "");
+ component.set('v.reports_now_count', 0);
+ component.set('v.confirm_status', 0);
+ } else if (confirm_status == 2) {
+ // 鍚�
+ $A.util.removeClass(modal_window, 'disp_none');
+ $A.util.removeClass(modal_bg, 'disp_none');
+ $A.util.addClass(modal_confirm, 'disp_none');
+ $A.util.addClass(modal_confirm_bg, 'disp_none');
+ component.set('v.confirm_status', 0);
+ }
+ },
+
+ new_report : function(component, event, helper) {
+ component.set('v.mode', 'new');
+ component.set('v.dialog_type', '鏂板缓');
+ var select_date = component.find('select_date').get('v.value');
+ var select_agency = component.find('select_agency_person').get('v.value');
+ component.set('v.selected_date', select_date);
+ var name = component.get('v.selected_agency_person');
+ var ret = this.create_report_header(component, name, select_agency, select_date);
+ // PIPL update Yin Mingjie 21/02/2022 start
+ this.set_aws_url(component,'Agency_Contact__c')
+ // PIPL update Yin Mingjie 21/02/2022 end
+ },
+
+ copy_button : function(component, event, helper) {
+ this.allclear(component);
+ component.set('v.mode', 'copy');
+ component.set('v.dialog_type', '鏂板缓');
+ var select_report_data = component.get('v.select_report_data_radio');
+ component.set('v.loadOpp', true);
+ // 閫�
+ var now = new Date();
+ var start_day = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() + 1));
+ var select_date = start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate();
+ this.set_selected(component, 'select_date', select_date);
+ component.set('v.selected_date', select_date);
+
+ // 鎷呭綋
+ var select_agency = select_report_data['Person_In_Charge2__c'];
+ var new_label = this.get_agency_person_name(component, select_agency);
+ component.set('v.selected_agency_person', new_label);
+ this.set_selected(component, 'select_agency_person', select_agency);
+
+ this.new_button_disabled(component, event, helper);
+
+ var name = component.get('v.selected_agency_person');
+
+ component.set('v.edit_copy_select_report_id', select_report_data['Id']);
+ component.set('v.select_report_data', select_report_data);
+
+ var ret = this.create_report_header(component, name, select_agency, select_date);
+ },
+
+ change_report_radio : function(component, event, helper) {
+ var reports = component.get('v.reports');
+ for (var i = 0; i < reports.length; i++) {
+ if (reports[i].Name == event.getSource().get('v.label')) {
+ component.set('v.select_report_data_radio', reports[i]);
+ component.find('copy_button').set('v.disabled', false);
+ break;
+ }
+ }
+ },
+
+ edit_button : function(component, event, helper) {
+ component.set('v.login', true);
+ this.allclear(component);
+ component.set('v.loadOpp', true);
+ var index = event.getSource().get('v.value');
+ component.set('v.select_report_data', component.get('v.reports')[index]);
+ component.set('v.mode', 'edit');
+ component.set('v.dialog_type', '缂栬緫');
+
+ var select_date = component.get('v.reports')[index].Submit_date__c;
+ var select_agency = component.get('v.reports')[index].Person_In_Charge2__c;
+ var text_tmp = select_date.split('-');
+ var select_date_text = text_tmp[0] + '/' + Number(text_tmp[1]) + '/' + Number(text_tmp[2]);
+ component.set('v.selected_date', select_date_text);
+ var name = component.get('v.reports')[index].Person_In_Charge2__r.Name;
+
+ this.set_selected(component, 'select_agency_person', select_agency);
+ this.new_button_disabled(component, event, helper);
+
+ var new_label = this.get_agency_person_name(component, select_agency);
+ component.set('v.selected_agency_person', new_label);
+
+ component.set('v.edit_copy_select_report_id', component.get('v.reports')[index].Id);
+
+ var ret = this.create_report_header(component, name, select_agency, select_date);
+ },
+
+ save_report : function(component, event, helper) {
+
+ // 20220222 PI鏀归�� by Bright--start
+ let doctor2Name = '';
+ let visitortitle = '';
+ for(let op of component.find('select_doctor').get('v.options')){
+ if (op.selected) {
+ doctor2Name = op.label;
+ visitortitle = op.Doctor_Division1__c;
+ }
+ }
+ // 20220222 PI鏀归�� by Bright--end
+
+
+ component.find('save_button').set('v.disabled', true);
+
+ var Report_Date__c = component.get('v.data.Report_Date__c');
+ // alert('Report_Date__c'+Report_Date__c);
+ var Person_In_Charge2__c = "";
+ var Submit_date__c = "";
+ if (component.get('v.mode') == 'edit') {
+ // 鍛� Submit_date__c
+ Submit_date__c = component.get('v.select_report_data').Submit_date__c;
+ // alert('Submit_date__c'+Submit_date__c);
+
+
+ // 鎷呭綋 Person_In_Charge2__c
+ Person_In_Charge2__c = component.get('v.select_report_data').Person_In_Charge2__c;
} else {
- this.error("AWS confirm error.");
- component.set("v.loginEdit", false);
- }
- })
- .catch((error) => {
- this.error("AWS confirm error.");
- component.set("v.loginEdit", false);
- });
- },
- // PIPL update Yin Mingjie 21/02/2022 end
+ // 鍛� Submit_date__c
+ Submit_date__c = this.get_date_string(component.find('select_date').get('v.value'));
+ // alert('Submit_date__c'+Submit_date__c);
- set_doctor_list: function (component) {
- var hospital_id = component.get("v.hospitalLinkId");
- if (hospital_id) {
- component.set("v.loginEdit", true);
- var action = component.get("c.getDoctorList");
- action.setParams({
- hospital_id: hospital_id
- });
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var retMap = this.conv_selected(response.getReturnValue());
- // PIPL update Yin Mingjie 21/02/2022 start
- this.AWS_search(retMap, component);
- /*
+ // 鎷呭綋 Person_In_Charge2__c
+ Person_In_Charge2__c = component.find('select_agency_person').get('v.value');
+ }
+ // Agency_Report_Header__c
+ var Agency_Report_Header__c = component.get('v.agency_report_header_id');
+
+ // 鍖婚櫌 Agency_Hospital__c (Agency_Hospital_Link__c)
+ var Agency_Hospital__c = component.get('v.hospitalLinkId');
+
+ // 绉戝 Department_Cateogy__c
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+
+ // 鎷滆浜� doctor2__c
+ var doctor2__c = component.find('select_doctor').get('v.value');
+
+ // 娲诲姩鍖哄垎 Purpose_Type__c
+ var Purpose_Type__c = component.find('select_purpose_type').get('v.value');
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ // 鏀彺闇�姹� SupportNeeds__c
+ var SupportNeeds__c = component.find('SupportNeeds__c').get('v.value');
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ // 璇环 Opportunity__c
+ var Opportunity__c = component.get('v.data.Opportunity__c');
+
+ var StageName__c = component.find('select_stageName').get('v.value');
+ var Amount__c = component.get('v.oppdata.Amount__c') != null ? component.get('v.oppdata.Amount__c').toString() : '';
+ var OCMSale_Price__c = component.get('v.oppdata.OCMSale_Price__c') != null ? component.get('v.oppdata.OCMSale_Price__c').toString() : '';
+ var Close_Forecasted_Date__c = component.get('v.oppdata.Close_Forecasted_Date__c');
+
+ var StageName__c_o = component.get('v.StageName__c_o');
+ var Amount__c_o = component.get('v.Amount__c_o');
+ var OCMSale_Price__c_o = component.get('v.OCMSale_Price__c_o');
+ var Close_Forecasted_Date__c_o = component.get('v.Close_Forecasted_Date__c_o');
+ if (StageName__c_o == undefined) StageName__c_o = '';
+ if (Amount__c_o == undefined) Amount__c_o = '';
+ if (OCMSale_Price__c_o == undefined) OCMSale_Price__c_o = '';
+ if (Close_Forecasted_Date__c_o == undefined) Close_Forecasted_Date__c_o = '';
+ if (StageName__c == StageName__c_o && OCMSale_Price__c_o == OCMSale_Price__c && Amount__c == Amount__c_o && Close_Forecasted_Date__c == Close_Forecasted_Date__c_o) {
+ StageName__c = '';
+ Amount__c = '';
+ OCMSale_Price__c = '';
+ Close_Forecasted_Date__c = '';
+ }
+
+ // 浜у搧鍖哄垎 Product_Category__c (ProductTypes__c)
+ var Product_Category1__c = component.find('select_Product1').get('v.value');
+ var Product_Category2__c = component.find('select_Product2').get('v.value');
+ var Product_Category3__c = component.find('select_Product3').get('v.value');
+
+ // 绲愭灉 Result__c
+ var Result__c = component.find('select_result').get('v.value');
+
+ // 銉愩儶銉囥兗銈枫儳銉�
+ var error = [];
+ if (!Report_Date__c) { error.push("娲诲姩鏃� 涓嶅瓨鍦�"); }
+ if (!Submit_date__c) { error.push("鍛� 涓嶅瓨鍦�"); }
+ var rDate = new Date(Report_Date__c);
+ var sDate = new Date(Submit_date__c);
+ sDate.setDate(sDate.getDate() - 1);
+ if (rDate < sDate) {error.push('娲诲姩鏃ュ繀椤绘槸鏈懆锛�'); }
+ sDate.setDate(sDate.getDate() + 7);
+ if (rDate >= sDate) {error.push('娲诲姩鏃ュ繀椤绘槸鏈懆锛�'); }
+
+ if (!Person_In_Charge2__c) { error.push("鎷呭綋 涓嶅瓨鍦�"); }
+ if (!Agency_Report_Header__c) { this.error("Report Header Id 涓嶅瓨鍦�"); }
+ if (!Agency_Hospital__c) { error.push("鍖婚櫌 涓嶅瓨鍦�"); }
+ if (!Department_Cateogy__c) { error.push("绉戝 涓嶅瓨鍦�"); }
+ if (!doctor2__c) { error.push("鎷滆浜� 涓嶅瓨鍦�"); }
+ if (!Purpose_Type__c) { error.push("娲诲姩鍖哄垎 涓嶅瓨鍦�"); }
+ // if (!SupportNeeds__c) { error.push("鏀彺闇�姹� 涓嶅瓨鍦�"); }
+ if (!Opportunity__c) { Opportunity__c = ""; }
+ if (!Product_Category1__c) { error.push("浜у搧鍖哄垎1 涓嶅瓨鍦�"); }
+ if (Purpose_Type__c && (Purpose_Type__c.substr(-3) == 'SIS' || Purpose_Type__c.substr(-3) == 'OPD')) {
+ if (!Result__c) { error.push("缁撴灉 涓嶅瓨鍦�"); }
+ }
+ for (var i = 0; i < error.length; i++) {
+ this.warning(error[i]);
+ }
+ if (error.length > 0) {
+ component.find('save_button').set('v.disabled', false);
+ return false;
+ }
+
+
+ // 淇濆瓨鍑︾悊
+ 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');
+ debugger
+ // alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c);
+ action.setParams({
+ "Agency_Report_Id" : Agency_Report__c,
+ "Department_Cateogy" : Department_Cateogy__c,
+ "Purpose_Type" : Purpose_Type__c,
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ "SupportNeedsc" : SupportNeeds__c,
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ "Agency_Report_Header" : Agency_Report_Header__c,
+ "Agency_Hospital" : Agency_Hospital__c,
+ "Person_In_Charge2" : Person_In_Charge2__c,
+ "doctor" : doctor2__c,
+ "Submit_date" : Submit_date__c,
+ "Product_Category1" : Product_Category1__c,
+ "Product_Category2" : Product_Category2__c,
+ "Product_Category3" : Product_Category3__c,
+ "Result" : Result__c,
+ "Opportunity" : Opportunity__c,
+ "StageName" : StageName__c,
+ "oppAmount" : Amount__c,
+ "oppOCMPrice" : OCMSale_Price__c,
+ "Close_Forecasted_Date" : Close_Forecasted_Date__c,
+ "Report_Date" : Report_Date__c,
+ });
+
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ this.success('缂栬緫淇濆瓨鎴愬姛');
+ var report_id = response.getReturnValue();
+ component.set('v.create_agency_report_id', report_id);
+
+ var select_agency_list = component.get('v.allselectlist').AgencyPerson__c;
+ for (var i = 0; i < select_agency_list.length; i++) {
+ if (select_agency_list[i].value == component.get('v.select_report_data').Person_In_Charge2__c) {
+ select_agency_list[i].selected = true;
+ } else {
+ select_agency_list[i].selected = false;
+ }
+ }
+ component.find('select_agency_person').set('v.options', select_agency_list);
+
+ component.set('v.update_select_report_data_id', report_id);
+ this.get_reports_edit(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.loginEdit',false);
+ }
+ else{
+ // var error = response.getError();
+ // alert(JSON.stringify(error));
+ // alert(JSON.stringify(error[0].fieldErrors));
+ // alert(JSON.stringify(error[0].fieldErrors.next()));
+ // alert(JSON.stringify(error[0].fieldErrors.next()[0]));
+ // if (this.error(response.getError()[0].message))
+ // else () {
+ // error[0].fieldErrors[0]
+ // }
+ this.error('save_report failed.');
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ } else {
+ /* Save (New & Copy) */
+
+ var action = component.get('c.saveAgencyReport');
+ debugger;
+ // alert(SupportNeeds__c);
+ action.setParams({
+ "Department_Cateogy" : Department_Cateogy__c,
+ "Purpose_Type" : Purpose_Type__c,
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ "SupportNeedsc" : SupportNeeds__c,
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ "Agency_Report_Header" : Agency_Report_Header__c,
+ "Agency_Hospital" : Agency_Hospital__c,
+ "Person_In_Charge2" : Person_In_Charge2__c,
+ "doctor" : doctor2__c,
+ "Submit_date" : Submit_date__c,
+ "Product_Category1" : Product_Category1__c,
+ "Product_Category2" : Product_Category2__c,
+ "Product_Category3" : Product_Category3__c,
+ "Result" : Result__c,
+ "Opportunity" : Opportunity__c,
+ "StageName" : StageName__c,
+ "oppAmount" : Amount__c,
+ "oppOCMPrice" : OCMSale_Price__c,
+ "Close_Forecasted_Date" : Close_Forecasted_Date__c,
+ "Report_Date" : Report_Date__c,
+ });
+
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ this.success('淇濆瓨鎴愬姛');
+ var report_id = response.getReturnValue();
+ component.set('v.create_agency_report_id', report_id);
+
+ this.get_reports_edit(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
+
+ // 銉€兗銉�銉偊銈c兂銉夈偊鍐呫伄涓�瑕х敤
+ var action2 = component.get('c.getReportsById');
+ action2.setParams({
+ "report_id" : report_id,
+ });
+ action2.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var res = response.getReturnValue();
+ var reports_now = component.get('v.reports_now');
+ var reports_now_count = 0;
+ if (reports_now.length > 0 && reports_now != "") {
+ reports_now_count = reports_now.length;
+ }
+
+ // Save&New鏅傘伄銈︺偅銉炽儔銈﹀唴銉囥兗銈夸竴瑕�
+ if (res.length > 0) {
+ // 20220222 PI鏀归�� by Bright--start
+ res[0].doctor2NameOrigin = doctor2Name;
+ res[0].visitorTitleOrigin = visitortitle;
+ // 20220222 PI鏀归�� by Bright--end
+ reports_now[reports_now_count] = res[0];
+
+ reports_now.sort(function(a,b) {
+ if(a.Name>b.Name) return -1;
+ if(a.Name < b.Name) return 1;
+ return 0;
+ });
+
+ component.set('v.reports_now', reports_now);
+ component.set('v.reports_now_count', reports_now.length);
+ var data_list = component.find('modal_data_list_tr');
+ }
+ }
+ else{
+ this.error('get_reports_now failed.');
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action2);
+
+ this.allclear(component);
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit',false);
+ }
+ else{
+ var error = response.getError();
+ // alert(JSON.stringify(error));
+ this.error('saveAgencyReport failed.');
+ component.find('save_button').set('v.disabled', false);
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+ },
+
+ allclear : function(component) {
+ var clear = [{label:'', value:'', selected:true}];
+ component.set('v.hospital', '');
+ component.set('v.hospitalId', '');
+ component.set('v.hospitalLinkId', '');
+ component.find('new_con').set('v.disabled', true);
+ component.find('select_doctor').set('v.options', clear);
+ component.set('v.doctor_title', '');
+ component.find('select_department').set('v.options', this.conv_selected(component.get('v.allselectlist.Department_Cateogy__c')));
+ component.find('select_purpose_type').set('v.options', this.conv_selected(component.get('v.allselectlist.Purpose_Type__c')));
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ component.find('SupportNeeds__c').set('v.options', this.conv_selected(component.get('v.allselectlist.SupportNeeds__c')));
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
+ // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
+ component.set('v.data.Opportunity__c', '');
+ component.find('select_Product1').set('v.value','');
+ component.find('select_Product2').set('v.value','');
+ component.find('select_Product3').set('v.value','');
+ console.log('reportDate = 绌�');
+ component.set('v.data.Report_Date__c', '');
+ component.set('v.oppdata.Close_Forecasted_Date__c', '');
+ component.set('v.oppdata.Amount__c', '');
+ component.set('v.oppdata.OCMSale_Price__c', '');
+ component.set('v.oppdata.StageName__c', '');
+ // component.set('v.oppdata', '');
+ component.set('v.Close_Forecasted_Date__c_o', '');
+ component.set('v.Amount__c_o', '');
+ component.set('v.OCMSale_Price__c_o', '');
+ component.set('v.StageName__c_o', '');
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+ // var values = [];
+ // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
+ // } else {
+ // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
+ // }
+ // component.find('input-opportunity').set("v.body",[]);
+ // if (component.find('input-product-category1'))
+ // component.find('input-product-category1').get("v.body")[0].set('v.values', values);
+ // if (component.find('input-product-category2'))
+ // component.find('input-product-category2').get("v.body")[0].set('v.values', values);
+ // if (component.find('input-product-category3'))
+ // component.find('input-product-category3').get("v.body")[0].set('v.values', values);
+ component.find('select_result').set('v.value', '');
+ this.select_purpose_type(component);
+ },
+
+ report_date_list : function(component, event, helper, count) {
+ var ret_obj = [];
+ var now = new Date();
+ for (var i = 0; i < count; i++) {
+
+ var start_day = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() + 1 - (i * 7)));
+ var end_day = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (7 - now.getDay()) - (i * 7));
+
+ var start_day_show = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() - (i * 7)));
+ var end_day_show = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()) - (i * 7));
+ var date_text = start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate() + '~' + end_day.getFullYear() + '/' + (end_day.getMonth() + 1) + '/' + end_day.getDate();
+ if (i == 0) {
+ ret_obj.push({
+ selected : true,
+ value : start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate(),
+ label : start_day_show.getFullYear() + '/' + (start_day_show.getMonth() + 1) + '/' + start_day_show.getDate() + '~' + end_day_show.getFullYear() + '/' + (end_day_show.getMonth() + 1) + '/' + end_day_show.getDate(),
+ });
+ } else {
+ ret_obj.push({
+ selected : false,
+ value : start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate(),
+ label : start_day_show.getFullYear() + '/' + (start_day_show.getMonth() + 1) + '/' + start_day_show.getDate() + '~' + end_day_show.getFullYear() + '/' + (end_day_show.getMonth() + 1) + '/' + end_day_show.getDate(),
+ });
+ }
+ }
+
+ component.find('select_date').set('v.options', ret_obj);
+ component.set('v.report_date_list', ret_obj);
+ },
+
+ create_report_header : function(component, name, s_agency, s_date) {
+ s_date = this.get_date_string(s_date);
+ if (s_date == false) {
+ this.error('get_date_string failed.');
+ return false;
+ }
+
+ var head_key = this.create_header_input_key(s_agency, s_date);
+ component.set('v.agency_report_header', head_key);
+ if (head_key == false) {
+ this.error('create_header_input_key failed.');
+ return false;
+ }
+
+ var key2 = s_date.replace(/-/g, '');
+ var action = component.get('c.createReportHeader');
+
+ action.setParams({
+ "name" : name,
+ "s_date" : s_date,
+ "s_agency" : s_agency,
+ "head_key" : head_key,
+ });
+
+ component.set('v.login',true);
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var res = response.getReturnValue();
+ component.set('v.agency_report_header_id', res);
+ component.set('v.login',false);
+ this.toggle_report(component);
+ }
+ else{
+ this.error('createReportHeader callback failed.');
+ component.set('v.login',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ create_header_input_key : function(agency_id, s_date) {
+ if (typeof(s_date) != 'string') {
+ s_date = this.get_date_string(s_date);
+ if (s_date == false) {
+ this.error('get_date_string in create_header_input_key.')
+ return false;
+ }
+ }
+ if (!agency_id || !s_date) {
+ return false;
+ }
+
+ s_date = s_date.replace(/-/g, '');
+ var headkey = agency_id + ":" + s_date;
+
+ return headkey;
+ },
+
+ /* typeof is not cool
+ * @ret : String, Boolean, Date, Error, Array, Function, Null, Undefined, etc
+ */
+ object_type : function(obj) {
+ var obj_type = Object.prototype.toString.call(obj).slice(8, -1);
+ return obj_type;
+ },
+
+ // create yyyy-mm-dd string
+ get_date_string : function(val) {
+ if (typeof(val) == 'string') {
+ if (val.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) {
+ val = val.replace(/[\/]/g, '-');
+ var tmp = val.split('-');
+ if (tmp[1].length == 1) {
+ tmp[1] = '0' + tmp[1];
+ }
+ if (tmp[2].length == 1) {
+ tmp[2] = '0' + tmp[2];
+ }
+ val = tmp[0] + '-' + tmp[1] + '-' + tmp[2];
+ } else if (val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) {
+ //ok
+ } else {
+ return false;
+ }
+ } else if (this.object_type(val) == 'Date') {
+ var mm = val.getMonth() + 1;
+ if (String(mm).length == 1) {
+ mm = '0' + mm;
+ }
+
+ var dd = '';
+ if (String(val.getDate()).length == 1) {
+ dd = '0' + val.getDate();
+ } else {
+ dd = val.getDate();
+ }
+
+ val = val.getFullYear() + '-' + mm + '-' + dd;
+ } else {
+ return false;
+ }
+
+ return val;
+ },
+
+ searchHos : function(component, event, helper) {
+ var hospital_name = event.getParam("value");
+ var action = component.get("c.getHospitalList");
+ debugger;
+ action.setParams({"hospital_name": hospital_name});
+
+ action.setCallback(this, function(response) {
+ var state = response.getState();
+ if(state === "SUCCESS") {
+ var hospital_list = component.find('hospital_list');
+ var hosList = response.getReturnValue();
+ if (hosList.length > 0) {
+ $A.util.addClass(hospital_list, 'slds-is-open');
+ } else {
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ }
+ component.set("v.hospitalList", response.getReturnValue());
+ } else {
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ hideSearch : function(component, event, helper) {
+ var hospital_list = component.find('hospital_list');
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ },
+
+ selectHos : function(component, event, helper) {
+ debugger
+ var hospital_list = component.find('hospital_list');
+ $A.util.removeClass(hospital_list, 'slds-is-open');
+ var accname = event.currentTarget.dataset.accname;
+ var accid = event.currentTarget.dataset.accid;
+ var hospital_data = component.get('v.hospitalList');
+ for (var i = 0; i < hospital_data.length; i++) {
+ if (hospital_data[i].Hospital__c == accid) {
+ component.set('v.hospitalLinkId', hospital_data[i].Id);
+ component.set('v.data.Agency_Hospital__c', hospital_data[i].Id);
+ component.find('new_con').set('v.disabled', false);
+ }
+ }
+ component.set("v.hospital", accname);
+ component.set("v.hospitalId", accid);
+ this.set_doctor_list(component);
+ this.opportunityChange(component, event, helper);
+ },
+
+ select_purpose_type : function(component) {
+ var purpose_type = component.find('select_purpose_type').get('v.value');
+ if (purpose_type != null && purpose_type != undefined && purpose_type.substr(-3) == 'OPD' || purpose_type.substr(-3) == 'SIS') {
+ var result = component.find('result');
+ $A.util.removeClass(result, 'disp_none');
+ } else {
+ component.find('select_result').set('v.value', '');
+ var result = component.find('result');
+ $A.util.addClass(result, 'disp_none');
+ }
+ this.select_department(component, null, null);
+ },
+
+ doctor_change : function(component, event, helper) {
+ var doctor_value = component.find('select_doctor').get('v.value');
+ var doctor_list = component.get('v.doctor_list');
+ var flg = false;
+ for (var i = 0; i < doctor_list.length; i++) {
+ if (doctor_list[i].value == doctor_value) {
+ component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c);
+ flg = true;
+ break;
+ }
+ }
+ if (flg == false) {
+ component.set('v.doctor_title', '');
+ }
+ },
+ // PIPL update Yin Mingjie 21/02/2022 start
+ set_aws_url : function(component,sobject) {
+ var action = component.get('c.getAwsurl');
+ action.setParams({
+ "sobj" : sobject,
+ });
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var awsmap = this.conv_selected(response.getReturnValue());
+ component.set('v.AWStoken',awsmap.token);
+ component.set('v.AWSinsert',awsmap.newUrl);
+ component.set('v.AWSsearch',awsmap.searchUrl);
+ component.set('v.AWStransactionURL',awsmap.transactionURL);
+ }
+ else{
+ this.error('AWS url/token error.');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ insert_agencycontact : function(component,token,newUrl,payload,agencyHospitalid,helper,hospitalName) {
+
+ // AWSService.insert(newUrl,payload,function(result){
+ // if(result.status == '0'){
+ // $A.getCallback(function(){
+ // helper.to_agencycontact(component,result,agencyHospitalid);
+ // })();
+
+ // }else{
+ // console.log('AWS status error:' + result)
+ // component.set('v.login',false);
+ // component.find('OppMessage').setError('AWS insert error.');
+ // }
+ // },token);
+
+ fetch(newUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ if(result.status == '0'){
+ $A.getCallback(function(){
+ helper.to_agencycontact(component,result,agencyHospitalid);
+ })();
+ }else{
+ console.log('AWS status error:' + result)
+ component.set('v.loginEdit',false);
+ if(result.status == '129'){
+ component.find('OppMessage').setError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+hospitalName+'鍖婚櫌锛岃淇敼');
+ }else{
+ component.find('OppMessage').setError('AWS insert error.');
+ }
+ }
+ }).catch(error => {
+ console.log('AWS insert error:' + error)
+ component.set('v.loginEdit',false);
+ component.find('OppMessage').setError('AWS insert error.');
+ });
+
+ },
+
+ to_agencycontact : function(component,result,agencyHospitalid) {
+ var action = component.get('c.saveAgencyContact');
+ action.setParams({
+ "name" : result.object[0].name,
+ //"nameEncrypt" : result.object[0].nameEncrypt,
+ "type" : result.object[0].type,
+ //"typeEncrypt" : result.object[0].typeEncrypt,
+ "doctorDivision1" : result.object[0].doctorDivision1,
+ //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt,
+ "agencyHospitalid" : agencyHospitalid,
+ "awsid" : result.object[0].dataId,
+ });
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var acMap = this.conv_selected(response.getReturnValue());
+ console.log(acMap);
+ if(acMap.AgencyContactId != ''){
+ //纭浜嬪姟
+ var token = component.get('v.AWStoken');
+ var confirmUrl = component.get('v.AWStransactionURL');
+
+ let data = Object.create(null);
+ data['isSuccess'] = 1;
+ data['sfRecordId'] = '';
+ data['txId'] = result.txId;
+
+ this.to_confirm(component,token,confirmUrl,JSON.stringify(data));
+ }else if(acMap.errormsg != ''){
+ this.error(acMap.errormsg);
+ component.set('v.loginEdit',false);
+ }else {
+ this.error('agency contact insert id error.');
+ component.set('v.loginEdit',false);
+ }
+ }
+ else{
+ this.error('agency contact insert error.');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ },
+
+ to_confirm : function(component,token,confirmUrl,payload) {
+ fetch(confirmUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ if(result.status == '0' && result.hasOwnProperty('success') && result.success){
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ this.success('.瀹㈡埛浜哄憳宸插垱寤恒��');
+ this.set_doctor_list(component);
+ }else {
+ this.error('AWS confirm error.');
+ component.set('v.loginEdit',false);
+ }
+ }).catch(error => {
+ this.error('AWS confirm error.');
+ component.set('v.loginEdit',false);
+ });
+ },
+ // PIPL update Yin Mingjie 21/02/2022 end
+
+ set_doctor_list : function(component) {
+ var hospital_id = component.get('v.hospitalLinkId');
+ if (hospital_id) {
+ component.set('v.loginEdit',true);
+ var action = component.get('c.getDoctorList');
+ action.setParams({
+ "hospital_id" : hospital_id,
+ });
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var retMap = this.conv_selected(response.getReturnValue());
+ // PIPL update Yin Mingjie 21/02/2022 start
+ this.AWS_search(retMap,component);
+ /*
var default_doctor = component.get('v.default_select_doctor_id');
if (default_doctor != '' && res.length > 0) {
var doctor_title = '';
@@ -1859,1441 +1522,1193 @@
component.set('v.doctor_list', res);
component.set('v.login',false);
*/
- // PIPL update Yin Mingjie 21/02/2022 end
- } else {
- this.error("set_doctor_list failed.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- }
- },
-
- // PIPL update Yin Mingjie 21/02/2022 start
- AWS_search: function (retMap, component) {
- var token = retMap.sre.token;
- var searchUrl = retMap.sre.searchUrl;
-
- var dataArr = new Array();
- for (const key in retMap) {
- if (key == "sre") {
- continue;
- }
- dataArr.push(key);
- }
- if (dataArr.length == 0) {
- component.set("v.loginEdit", false);
- this.warning("娌℃湁鎵惧埌绗﹀悎鏉′欢鐨勫鎴蜂汉鍛�");
- return;
- }
- let obj = Object.create(null);
- obj["dataIds"] = dataArr;
- var data = JSON.stringify(obj);
- this.search_agency_contact(token, searchUrl, data, retMap, component);
- },
-
- search_agency_contact: function (
- token,
- searchUrl,
- payload,
- retMap,
- component
- ) {
- this.search_core(
- token,
- searchUrl,
- payload,
- (result) => {
- if (result.status == "0") {
- this.to_doctor_list(result, retMap, component);
- } else {
- this.error("AWS search status4 : " + result.status);
- component.set("v.loginEdit", false);
- }
- },
- component
- );
- // fetch(searchUrl, {
- // method: 'POST',
- // body: payload,
- // headers: {
- // 'Content-Type': 'application/json',
- // 'pi-token': token
- // }
- // }).then((data) => {
- // return data.json();
- // }).then((result) => {
-
- // }).catch(error => {
- // this.error('AWS search error.');
- // component.set('v.login',false);
- // });
- },
- search_core: function (token, searchUrl, payload, callback, component) {
- console.log("token = " + token);
- console.log("searchUrl = " + searchUrl);
- console.log("payload = " + payload);
- fetch(searchUrl, {
- method: "POST",
- body: payload,
- headers: {
- "Content-Type": "application/json",
- "pi-token": token
- }
- })
- .then((data) => {
- return data.json();
- })
- .then((result) => {
- component.set("v.loginEdit", false);
- if (callback) callback(result);
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.error("AWS search error.");
- component.set("v.loginEdit", false);
- });
- },
-
- to_doctor_list: function (result, retMap, component) {
- var resls = result.object;
- var res = [];
- var space = {};
- space["label"] = "";
- space["selected"] = true;
- space["value"] = "";
- res.push(space);
-
- for (var i = 0; i < resls.length; i++) {
- var t = {};
- t["label"] = resls[i].name;
- t["selected"] = false;
- t["Doctor_Division1__c"] = resls[i].doctorDivision1;
- t["value"] = retMap[resls[i].dataId].value;
- res.push(t);
- }
-
- var default_doctor = component.get("v.default_select_doctor_id");
- if (default_doctor != "" && res.length > 0) {
- var doctor_title = "";
- for (var i = 0; i < res.length; i++) {
- if (res[i].value == default_doctor) {
- res[i].selected = true;
- doctor_title = res[i].Doctor_Division1__c;
- } else {
- res[i].selected = false;
- }
- }
-
- component.find("select_doctor").set("v.options", res);
- component.set("v.doctor_title", doctor_title);
- } else {
- component.find("select_doctor").set("v.options", res);
- if (res.length > 0) {
- component.set("v.doctor_title", res[0].Doctor_Division1__c);
- }
- }
-
- component.set("v.default_select_doctor_id", "");
- component.set("v.doctor_list", res);
- component.set("v.loginEdit", false);
- },
- // PIPL update Yin Mingjie 21/02/2022 end
-
- // stageNameChange : function(component, event, helper) {
- // var options = component.find('input-oppstage').get("v.body")[0].get('v.options');
- // var remove;
- // for (var i = 0; i < options.length; i++) {
- // if (options[i].label == '鐩爣') {
- // remove = i;
- // break;
- // }
- // }
- // options.splice(remove,1);
- // },
-
- opportunityChange: function (component, event, helper) {
- debugger;
- var opp_id = component.get("v.data.Opportunity__c");
- if (opp_id == "") {
- $A.util.addClass(component.find("input-opportunity-stage"), "disp_none");
- $A.util.addClass(
- component.find("input-opportunity-amount1"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount2"),
- "disp_none"
- );
- $A.util.addClass(component.find("input-opportunity-date"), "disp_none");
- $A.util.removeClass(
- component.find("input-opportunity-blank"),
- "disp_none"
- );
- } else if (opp_id == "MALFORMED_ID") {
- component.set("v.data.Opportunity__c", "");
- $A.util.addClass(component.find("input-opportunity-stage"), "disp_none");
- $A.util.addClass(
- component.find("input-opportunity-amount1"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount2"),
- "disp_none"
- );
- $A.util.addClass(component.find("input-opportunity-date"), "disp_none");
- $A.util.removeClass(
- component.find("input-opportunity-blank"),
- "disp_none"
- );
- } else if (opp_id != "") {
- var hospital_link_id = component.get("v.hospitalLinkId");
- if (hospital_link_id == "") {
- this.warning("鍖婚櫌涓嶅瓨鍦�");
- // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
- component.set("v.data.Opportunity__c", "");
- $A.util.addClass(
- component.find("input-opportunity-stage"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount1"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount2"),
- "disp_none"
- );
- $A.util.addClass(component.find("input-opportunity-date"), "disp_none");
- $A.util.removeClass(
- component.find("input-opportunity-blank"),
- "disp_none"
- );
- // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
- // var values = [];
- // // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
- // } else {
- // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
- // }
- return false;
- }
- var action = component.get("c.selectOpportunityByIdAndHospitalLinkId");
- action.setParams({
- opportunity_id: opp_id,
- agency_hospital_link_id: component.get("v.hospitalLinkId")
- });
-
- component.set("v.loginEdit", true);
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state == "SUCCESS") {
- var res = response.getReturnValue();
- if (res.length <= 0) {
- if (component.get("v.data.Opportunity__c")) {
- this.warning("鍖婚櫌鏈尮閰嶅埌");
- }
- // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
- component.set("v.data.Opportunity__c", "");
- $A.util.addClass(
- component.find("input-opportunity-stage"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount1"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-amount2"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-date"),
- "disp_none"
- );
- $A.util.removeClass(
- component.find("input-opportunity-blank"),
- "disp_none"
- );
- // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
- // var values = [];
- // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
- // } else {
- // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
- // }
- component.set("v.loginEdit", false);
- return false;
- }
- //SWAG-CKH5M8 銆愬鎵樸�戝懆鎶ュ叧鑱旇浠凤紝鍙�夋嫨璇环鑼冨洿璋冩暣 fy start
- // else if (res[0]['StageName2__c'] != '3.璇环' && !component.get('v.loadOpp')){
- // this.warning('璇烽�夋嫨璇环涓殑椤圭洰');
- // // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
- // component.set('v.data.Opportunity__c', '');
- // $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
- // $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
- // $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
- // $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
- // $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
- // // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
- // // var values = [];
- // // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
- // // } else {
- // // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
- // // }
- // component.set('v.login',false);
- // return false;
- // }
- //SWAG-CKH5M8 銆愬鎵樸�戝懆鎶ュ叧鑱旇浠凤紝鍙�夋嫨璇环鑼冨洿璋冩暣 fy end
- else {
- component.set("v.loadOpp", false);
- component.set("v.oppdata", res[0]);
- this.set_selected(
- component,
- "select_stageName",
- res[0].StageName__c
- );
- component.set(
- "v.Close_Forecasted_Date__c_o",
- res[0].Close_Forecasted_Date__c
- );
- component.set("v.Amount__c_o", res[0].Amount__c);
- component.set("v.OCMSale_Price__c_o", res[0].OCMSale_Price__c);
- component.set("v.StageName__c_o", res[0].StageName__c);
-
- $A.util.removeClass(
- component.find("input-opportunity-stage"),
- "disp_none"
- );
- $A.util.removeClass(
- component.find("input-opportunity-amount1"),
- "disp_none"
- );
- $A.util.removeClass(
- component.find("input-opportunity-amount2"),
- "disp_none"
- );
- $A.util.removeClass(
- component.find("input-opportunity-date"),
- "disp_none"
- );
- $A.util.addClass(
- component.find("input-opportunity-blank"),
- "disp_none"
- );
- }
-
- component.set("v.loginEdit", false);
- } else {
- this.error("selectOpportunityByIdAndHospitalLinkId failed.");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- }
- },
-
- productcategoryChange1: function (component, event, helper) {
- var product_category_id = component.find("select_Product1").get("v.value");
- var pcId1 = component.find("select_Product2").get("v.value");
- var pcId2 = component.find("select_Product3").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- this.warning("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- component.find("select_Product1").set("v.value", "");
- }
- },
- productcategoryChange2: function (component, event, helper) {
- var product_category_id = component.find("select_Product2").get("v.value");
- var pcId1 = component.find("select_Product1").get("v.value");
- var pcId2 = component.find("select_Product3").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- this.warning("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- component.find("select_Product2").set("v.value", "");
- }
- },
- productcategoryChange3: function (component, event, helper) {
- var product_category_id = component.find("select_Product3").get("v.value");
- var pcId1 = component.find("select_Product1").get("v.value");
- var pcId2 = component.find("select_Product2").get("v.value");
- var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
- var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
- var p0bool =
- product_category_id != "" &&
- product_category_id != null &&
- product_category_id != undefined;
- if (
- (p1bool && p0bool && product_category_id == pcId1) ||
- (p2bool && p0bool && product_category_id == pcId2)
- ) {
- this.warning("涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�");
- component.find("select_Product3").set("v.value", "");
- }
- },
-
- conv_selected: function (obj) {
- for (var i = 0; i < obj.length; i++) {
- if (obj[i].selected) {
- if (obj[i].selected == "true") {
- obj[i].selected = true;
- } else {
- obj[i].selected = false;
- }
- }
- }
-
- return obj;
- },
-
- set_selected: function (component, aura_id_name, value) {
- var select_tmp = component.find(aura_id_name).get("v.options");
- if (select_tmp) {
- for (var i = 0; i < select_tmp.length; i++) {
- if (select_tmp[i].value == value) {
- select_tmp[i].selected = true;
- } else {
- select_tmp[i].selected = false;
- }
- }
- component.find(aura_id_name).set("v.options", select_tmp);
- return true;
- } else {
- return false;
- }
- },
-
- success: function (message) {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "鎴愬姛!",
- message: message,
- type: "success",
- duration: "5000"
- });
- toastEvent.fire();
- },
-
- warning: function (message) {
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- title: "璀﹀憡!",
- message: message,
- type: "warning",
- duration: "10000"
- });
- toastEvent.fire();
- },
-
- error: function (message) {
- // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap');
- var toastEvent = $A.get("e.force:showToast");
-
- toastEvent.setParams({
- title: "閿欒!",
- message: message,
- type: "error",
- duration: "sticky"
- });
- toastEvent.fire();
- },
-
- createCon: function (component, event, helper) {
- var modal_newAC = component.find("modal_newAC");
- $A.util.removeClass(modal_newAC, "disp_none");
- component.set("v.truthy", true);
- // var modal_newAC = component.find('modal_newAC')
- // $A.util.removeClass(modal_newAC, 'disp_none');
- },
-
- // vivek start 娣诲姞楠岃瘉
- // handleFormSubmit : function(component) {
- // var showValidationError = false;
- // var fields = component.find("newOpportunityField");
- // var vaildationFailReason = '';
- // var currentDate = new Date().toJSON().slice(0,10);
-
- // fields.forEach(function (field) {
- // if(field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))){
- // showValidationError = true;
- // vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
- // }else if(field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))){
- // showValidationError = true;
- // vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
- // }
- // });
-
- // if (showValidationError) {
- // component.find('OppMessage').setError(vaildationFailReason);
- // }
- // },
- // vivek end 娣诲姞楠岃瘉
-
- hideCmp: function (component, event, helper) {
- var div1 = component.find("report");
- var div2 = component.find("report_list");
- $A.util.addClass(div1, "disp_none");
- $A.util.addClass(div2, "disp_none");
- },
-
- handleSuccess: function (component, event, helper) {
- var insertId = event.getParams().response.Id;
- var displayValue = event.getParams().response.fields.Name.value;
- event.setParams({});
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- this.success(".瀹㈡埛浜哄憳宸插垱寤恒��");
- this.set_doctor_list(component);
- },
-
- createCancel: function (component, event, helper) {
- component.set("v.truthy", false);
- var modal_newAC = component.find("modal_newAC");
- $A.util.addClass(modal_newAC, "disp_none");
- },
- setOpportunity_cfilter: function (component) {
- debugger;
- var hosId = component.get("v.hospitalId");
- var Department_Cateogy__c = component
- .find("select_department")
- .get("v.value");
- var opportunity_cfilter = "";
- if (hosId != "" && hosId != null) {
- opportunity_cfilter =
- " Agency_Hospital__r.Hospital__c=" + "'" + hosId + "'";
- }
- if (Department_Cateogy__c != "" && Department_Cateogy__c != null) {
- if (opportunity_cfilter != "" && opportunity_cfilter != null) {
- opportunity_cfilter += " AND ";
- }
- opportunity_cfilter +=
- "Department_Cateogy__c=" + "'" + Department_Cateogy__c + "'";
- }
- component.set("v.opportunity_cfilter", opportunity_cfilter);
- component.set("v.data.Opportunity__c", null);
- },
- readFile: function (component, helper, file) {
- if (!file) return;
- // console.log('file'+file.name);
- if (!file.name.match(/\.(csv||CSV)$/)) {
- return alert("only support csv files");
- } else {
- reader = new FileReader();
- reader.onerror = function errorHandler(evt) {
- switch (evt.target.error.code) {
- case evt.target.error.NOT_FOUND_ERR:
- alert("File Not Found!");
- break;
- case evt.target.error.NOT_READABLE_ERR:
- alert("File is not readable");
- break;
- case evt.target.error.ABORT_ERR:
- break; // noop
- default:
- alert("An error occurred reading this file.");
- }
- };
- //reader.onprogress = updateProgress;
- reader.onabort = function (e) {
- alert("File read cancelled");
- };
- reader.onloadstart = function (e) {
- var output =
- '<ui type="disc"><li><strong>' +
- file.name +
- "</strong> (" +
- file.type +
- ")- " +
- file.size +
- "bytes, last modified: " +
- file.lastModifiedDate.toLocaleDateString() +
- "</li></ui>";
- component.set("v.filename", file.name);
- component.set("v.TargetFileName", output);
- };
- reader.onload = function (e) {
- var data = e.target.result;
- component.set("v.fileContentData", data);
- console.log("file data" + JSON.stringify(data));
- // console.log("file data"+encodeURI(JSON.stringify(data),"utf-8"));
- var allTextLines = data.split(/\r\n|\n/);
- var dataRows = allTextLines.length - 1;
- var headers = allTextLines[0].split(",");
-
- // console.log("Rows length::"+dataRows);
-
- var numOfRows = component.get("v.NumOfRecords");
- if (dataRows > numOfRows + 1 || dataRows == 1 || dataRows == 0) {
- alert("File Rows between 1 to " + numOfRows + " .");
- component.set("v.showMain", true);
- } else {
- var lines = [];
- var filecontentdata;
- var content =
- '<table class="table slds-table slds-table--bordered slds-table--cell-buffer">';
- content += '<thead><tr class="slds-text-title--caps">';
- content += '<th scope="col">' + "琛屽彿" + "</th>";
- for (i = 0; i < headers.length; i++) {
- content += '<th scope="col">' + headers[i] + "</th>";
- }
- content += "</tr></thead>";
- for (var i = 1; i < allTextLines.length; i++) {
- filecontentdata = allTextLines[i].split(",");
- if (filecontentdata[0] != "") {
- content += "<tr>";
- content += "<td>" + i + "</td>";
- for (var j = 0; j < filecontentdata.length; j++) {
- content += "<td>" + filecontentdata[j] + "</td>";
- }
- content += "</tr>";
- }
- }
- content += "</table>";
- console.log(content);
- component.set("v.TableContent", content);
- component.set("v.showMain", false);
- }
- };
- reader.readAsText(file, "gb2312");
- }
- var reader = new FileReader();
- reader.onloadend = function () {};
- reader.readAsDataURL(file);
- },
-
- saveRecords: function (component, event, helper) {
- debugger;
- component.set("v.loginEdit", true);
- //fy 瀵煎叆 20220424 start
- var action1 = component.get("c.processDataAWSId");
- action1.setParams({
- fileData: component.get("v.fileContentData")
- });
- debugger;
- action1.setCallback(this, function (response) {
- console.log("response = " + JSON.stringify(response));
- var state = response.getState();
- if (state === "SUCCESS") {
- var ress = response.getReturnValue();
- console.log("ress = " + JSON.stringify(ress));
- if (ress) {
- var valur = ress.split("error1");
- if (valur.length <= 1) {
- var res = JSON.parse(response.getReturnValue());
- console.log("res = " + JSON.stringify(res));
- var dataArr = new Array();
- var dataMap = new Map();
- res.forEach((item) => {
- if (item.AWS_Data_Id__c) {
- dataArr.push(item.AWS_Data_Id__c);
- //dataMap.set(item.AWS_Data_Id__c,item.Name_Encrypted__c);
- dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c); //zhj 鏂版柟妗堟敼閫� 2022-12-21
- }
- });
- let obj = Object.create(null);
- obj["dataIds"] = dataArr;
- var payload = JSON.stringify(obj);
- console.log("payload zhj = " + JSON.stringify(payload));
-
- this.search_contact_url(
- component,
- "Agency_Contact__c",
- (result) => {
- var token = result.token;
- var searchUrl = result.searchUrl;
- this.search_core(
- token,
- searchUrl,
- payload,
- (result) => {
- if (result.status == "0") {
- if (result.object != null && result.object.length != 0) {
- // var resultjson = JSON.stringify(result.object);
- // if(resultjson){
- // debugger
- // console.warn('001');
- // component.set('v.login',true);
- // this.ImportMethod(component,resultjson);
- // }
- component.set("v.loginEdit", true);
- this.saveRecordsEditFile(
- component,
- dataMap,
- result.object,
- helper
- );
- } else {
- this.error("AWS 鏌ヨ鏁版嵁涓虹┖ ");
- component.set("v.loginEdit", false);
- }
- } else {
- this.error("AWS search status6 : " + result.status);
- component.set("v.loginEdit", false);
- }
- },
- component
- );
- // var resultjson =null;
- // this.ImportMethod(component,resultjson);
- }
- );
- // var resultjson =null;
- // this.ImportMethod(component,resultjson);
- } else {
- this.error(valur[1] + "\n" + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- }
- }
- }
- });
- $A.enqueueAction(action1);
- //fy 瀵煎叆 20220424 end
- // var action = component.get("c.processData");
- // var selectDate = component.find('select_date').get('v.value');
- // var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic
- // var sss=component.get("v.fileContentData");
- // action.setParams({
- // fileData : component.get("v.fileContentData"),
- // //selectDateselectDate :component.find('select_date').get('v.value'),
- // sobjectName:'Account', //Any object
- // fields:fieldsList
- // });
- // action.setCallback(this, function(response) {
- // var state = response.getState();
- // if (state === "SUCCESS") {
-
- // var res = response.getReturnValue();
- // var res1 = '';
- // console.log("[[[[[["+res);
- // if(res != 'success'){
- // debugger
- // var ress = res.split('=');
- // console.log(ress);
- // for (var i=0; i<ress.length; i++) {
- // res1 += ress[i].substr(7)+'\n';
- // }
- // // $('.forceToastManager').css('white-space', 'pre-wrap');
- // console.log("=="+res1);
- // this.error(res1+"璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- // component.set('v.login',false);
- // }else{
- // component.set("v.showMain",true);
- // this.success("瀵煎叆鎴愬姛");
- // // alert('saved successfully');
- // component.set('v.login',false);
- // }
-
- // }
- // else if (state === "INCOMPLETE") {
- // // do something
- // component.set('v.login',false);
- // }
- // else if (state === "ERROR") {
- // var errors = response.getError();
- // if (errors) {
- // if (errors[0] && errors[0].message) {
- // console.log("Error message: " +
- // errors[0].message);
- // component.set('v.login',false);
- // }
- // } else {
- // console.log("Unknown error");
- // component.set('v.login',false);
- // }
- // }
- // });
- // $A.enqueueAction(action);
- },
- isNumber: function (str) {
- return /^\d+$/.test(str);
- },
- ImportMethod: function (component, fileStr) {
- debugger;
- var actionss = component.get("c.processData");
- var selectDate = component.find("select_date").get("v.value");
- var fieldsList = ["Name", "Phone", "AccountNumber"]; //Please write your code dynamic
- var sss = component.get("v.fileContentData");
- actionss.setParams({
- // fileData : component.get("v.fileContentData"),
- fileData: fileStr,
- // selectDateselectDate :component.find('select_date').get('v.value'),
- sobjectName: "Account", //Any object
- fields: fieldsList
- // Agency_ContactListjson:resultjson
- });
- actionss.setCallback(this, function (response) {
- console.log("002");
- var state = response.getState();
- if (state === "SUCCESS") {
- var res = response.getReturnValue();
- var res1 = "";
- console.log("[[[[[[" + res);
- if (res != "success") {
- var ress = res.split("=");
- console.log(ress);
- let errorDatas = [];
- let errorDataRow = [];
- debugger;
- var fileContentData = component.get("v.fileContentData").split("\n");
- for (var i = 0; i < ress.length; i++) {
- res1 += ress[i].substr(7) + "\n";
- if (ress[i] != "") {
- let errorData = {};
- if (!this.isNumber(ress[i].substr(7).substring(1, 2))) {
- continue;
- }
- let index = errorDataRow.indexOf(
- ress[i].substr(7).substring(1, 2)
- );
- if (index == -1) {
- errorData.errorRow = ress[i].substr(7).substring(1, 2);
- errorDataRow.push(errorData.errorRow);
- errorData.errorInfo = ress[i]
- .substr(7)
- .substring(5)
- .replace("=", "");
- if (errorData.errorInfo == "鎷滆浜轰笉瀛樺湪") {
- console.log("errorData.errorRow = " + errorData.errorRow);
- errorData.errorInfo =
- "鎷滆浜� " +
- fileContentData[errorData.errorRow].split(",")[4] +
- "涓嶅瓨鍦�";
+ // PIPL update Yin Mingjie 21/02/2022 end
}
- errorDatas.push(errorData);
- } else {
- if (ress[i].substr(7).substring(5) == "鎷滆浜轰笉瀛樺湪") {
- errorDatas[index].errorInfo +=
- "; " +
- "鎷滆浜� " +
- fileContentData[errorDatas[index].errorRow].split(",")[4] +
- "涓嶅瓨鍦�";
- } else {
- errorDatas[index].errorInfo +=
- "; " + ress[i].substr(7).substring(5);
+ else{
+ this.error('set_doctor_list failed.');
+ component.set('v.loginEdit',false);
}
- }
- }
- }
- let errorColumns = [
- {
- label: "閿欒琛�",
- fieldName: "errorRow",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "閿欒淇℃伅",
- fieldName: "errorInfo",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 300,
- wrapText: true
- }
- ];
- for (var i = 0; i < fileContentData[0].split(",").length; i++) {
- errorColumns.push({
- label: fileContentData[0].split(",")[i],
- fieldName: "field" + i,
- type: "text",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 120
});
- }
+ $A.enqueueAction(action);
+ }
+ },
- for (var i = 0; i < errorDatas.length; i++) {
- let data = fileContentData[errorDatas[i].errorRow];
- console.log("data = " + JSON.stringify(data));
- if (data) {
- for (var j = 0; j < data.split(",").length; j++) {
- let label = "field" + j;
- errorDatas[i][label] = data.split(",")[j];
- }
+ // PIPL update Yin Mingjie 21/02/2022 start
+ AWS_search : function(retMap,component) {
+ var token = retMap.sre.token;
+ var searchUrl = retMap.sre.searchUrl;
+
+ var dataArr = new Array();
+ for (const key in retMap) {
+ if (key == 'sre') {continue;}
+ dataArr.push(key);
+ }
+ if(dataArr.length == 0){
+ component.set('v.loginEdit',false);
+ this.warning('娌℃湁鎵惧埌绗﹀悎鏉′欢鐨勫鎴蜂汉鍛�');
+ return;
+ }
+ let obj= Object.create(null);
+ obj['dataIds'] = dataArr;
+ var data = JSON.stringify(obj);
+ this.search_agency_contact(token,searchUrl,data,retMap,component);
+ },
+
+ search_agency_contact : function(token,searchUrl,payload,retMap,component) {
+ this.search_core(token,searchUrl,payload,(result)=>{
+ if(result.status == '0'){
+ this.to_doctor_list(result,retMap,component);
+ }else{
+ this.error('AWS search status4 : ' + result.status);
+ component.set('v.loginEdit',false);
}
- }
- component.set("v.errorColumns", errorColumns);
- component.set("v.errorData", errorDatas);
- component.set("v.showErrorInfo", true);
- console.log("==" + res1);
- this.error(res1 + "璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
- component.set("v.loginEdit", false);
- } else {
- component.set("v.showMain", true);
- this.success("瀵煎叆鎴愬姛");
- // alert('saved successfully');
- component.set("v.loginEdit", false);
- }
- } else if (state === "INCOMPLETE") {
- // do something
- component.set("v.loginEdit", false);
- } else if (state === "ERROR") {
- var errors = response.getError();
- if (errors) {
- if (errors[0] && errors[0].message) {
- console.log("Error message: " + errors[0].message);
- component.set("v.loginEdit", false);
- }
- } else {
- console.log("Unknown error");
- component.set("v.loginEdit", false);
- }
- }
- });
- $A.enqueueAction(actionss);
- },
- saveRecordsEditFile: function (component, dataMap, searchData, helper) {
- var searchDataMap = new Map();
- for (var i = 0; i < searchData.length; i++) {
- var sd = searchData[i];
- if (sd.name) searchDataMap.set(sd.name.replace(" ", ""), sd.dataId);
- }
- console.log("searchDataMap=" + searchDataMap);
- var error = "";
- var fileData = component.get("v.fileContentData");
- var files = fileData.split("\n");
-
- var fileStr = files[0];
- fileStr += "\n";
-
- for (var i = 1; i < files.length - 1; i++) {
- var filelist = files[i].split(",");
- var fileName = filelist[4];
-
- if (searchDataMap.get(fileName.replace(" ", ""))) {
- var nameDataId = searchDataMap.get(fileName.replace(" ", ""));
- if (dataMap.get(nameDataId)) {
- filelist[4] = dataMap.get(nameDataId); //zhj 鏂版柟妗堟敼閫� filelist[4]涓嶅啀瀛樼殑nameEncrpt 2022-12-21
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�";
- error += "=";
- }
- } else {
- error += "error1 绗�" + i + "琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�";
- error += "=";
- }
- fileStr += filelist.toString();
- fileStr += "\n";
- }
-
- if (error != "") {
- console.log("zhj error = " + error);
- let errorArray = error.split("error1");
- let errorDatas = [];
- let errorDataRow = [];
- debugger;
- var fileContentData = component.get("v.fileContentData").split("\n");
- console.log("errorArray = " + JSON.stringify(errorArray));
- for (var i in errorArray) {
- if (errorArray[i] != "") {
- let errorData = {};
- if (!this.isNumber(errorArray[i].trim().substring(1, 2))) {
- continue;
- }
- let index = errorDataRow.indexOf(
- errorArray[i].trim().substring(1, 2)
- );
- if (index == -1) {
- errorData.errorRow = errorArray[i].trim().substring(1, 2);
- errorDataRow.push(errorData.errorRow);
- errorData.errorInfo = errorArray[i]
- .trim()
- .substring(5, errorArray[i].trim().length)
- .replace("=", "");
- if (errorData.errorInfo == "鎷滆浜篈WS涓嶅瓨鍦�") {
- errorData.errorInfo =
- "鎷滆浜� " +
- fileContentData[errorData.errorRow].split(",")[4] +
- "涓嶅瓨鍦�";
+ },component);
+ // fetch(searchUrl, {
+ // method: 'POST',
+ // body: payload,
+ // headers: {
+ // 'Content-Type': 'application/json',
+ // 'pi-token': token
+ // }
+ // }).then((data) => {
+ // return data.json();
+ // }).then((result) => {
+
+ // }).catch(error => {
+ // this.error('AWS search error.');
+ // component.set('v.login',false);
+ // });
+ },
+ search_core : function(token,searchUrl,payload,callback,component) {
+ console.log('token = ' + token);
+ console.log('searchUrl = ' + searchUrl);
+ console.log('payload = ' + payload);
+ fetch(searchUrl, {
+ method: 'POST',
+ body: payload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
}
- errorDatas.push(errorData);
- } else {
- if (errorArray[i].trim().substring(5) == "鎷滆浜篈WS涓嶅瓨鍦�") {
- errorData[index].errorInfo =
- "; " +
- "鎷滆浜� " +
- fileContentData[errorDatas[index].errorRow].split(",")[4] +
- "涓嶅瓨鍦�";
- } else {
- errorDatas[index].errorInfo +=
- "; " +
- errorArray[i].trim().substring(5, errorArray[i].trim().length);
- }
- }
- }
- }
- var fileContentData = component.get("v.fileContentData").split("\n");
- let errorColumns = [
- {
- label: "閿欒琛�",
- fieldName: "errorRow",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "閿欒淇℃伅",
- fieldName: "errorInfo",
- type: "text",
- hideDefaultActions: true,
- initialWidth: 300,
- wrapText: true
- }
- ];
- for (var i = 0; i < fileContentData[0].split(",").length; i++) {
- errorColumns.push({
- label: fileContentData[0].split(",")[i],
- fieldName: "field" + i,
- type: "text",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 120
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ component.set('v.loginEdit',false);
+ if(callback)callback(result);
+ }).catch(error => {
+ console.log('error = ' + JSON.stringify(error));
+ this.error('AWS search error.');
+ component.set('v.loginEdit',false);
});
- }
+ },
- for (var i = 0; i < errorDatas.length; i++) {
- let data = fileContentData[errorDatas[i].errorRow];
- console.log("data = " + JSON.stringify(data));
- for (var j = 0; j < data.split(",").length; j++) {
- let label = "field" + j;
- errorDatas[i][label] = data.split(",")[j];
+ to_doctor_list : function(result,retMap,component) {
+ var resls = result.object;
+ var res = [];
+ var space = {};
+ space['label'] = '';
+ space['selected'] = true;
+ space['value'] = '';
+ res.push(space);
+
+ for (var i = 0; i < resls.length; i++) {
+ var t = {};
+ t['label'] = resls[i].name;
+ t['selected'] = false;
+ t['Doctor_Division1__c'] = resls[i].doctorDivision1;
+ t['value'] = retMap[resls[i].dataId].value;
+ res.push(t);
}
- }
- console.log("errorDatas =" + JSON.stringify(errorDatas));
- component.set("v.errorColumns", errorColumns);
- component.set("v.errorData", errorDatas);
- component.set("v.showErrorInfo", true);
- console.log("error = " + error);
- component.set("v.errorMessage", error);
-
- this.error(error);
- console.log("error=" + error);
- component.set("v.loginEdit", false);
- return;
- }
-
- console.log("fileStr=" + fileStr);
- $A.getCallback(function () {
- debugger;
- helper.ImportMethod(component, fileStr);
- })();
- },
- convertArrayOfObjectsToCSV: function (component, objectRecords) {
- var csvStringResult, counter, keys, columnDivider, lineDivider, thkeys;
- if (objectRecords == null || !objectRecords.length) {
- return null;
- }
- columnDivider = ",";
- lineDivider = "\n";
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�'
- keys = [
- "Submit_date__c",
- "Person_In_Charge2__c",
- "Report_Date__c",
- "Agency_Hospital__c",
- "Department_Cateogy__c",
- "doctor2__c",
- "visitor_title__c",
- "Product_Category1__c",
- "Product_Category2__c",
- "Product_Category3__c",
- "Purpose_Type__c",
- "Result__c",
- "SupportNeeds__c"
- ];
- thkeys = [
- "鍛�",
- "鎷呭綋",
- "娲诲姩鏃�",
- "鍖婚櫌",
- "绉戝",
- "鎷滆浜�",
- "鑱屼綅",
- "浜у搧鍖哄垎1",
- "浜у搧鍖哄垎2",
- "浜у搧鍖哄垎3",
- "娲诲姩鍖哄垎",
- "缁撴灉",
- "鏀彺闇�姹�"
- ];
- csvStringResult = "";
- csvStringResult += thkeys.join(columnDivider);
- csvStringResult += lineDivider;
- console.log("杩涘叆瀵煎嚭helper");
- for (var i = 0; i < objectRecords.length; i++) {
- counter = 0;
- for (var sTempkey in keys) {
- var skey = keys[sTempkey];
- if (counter > 0) {
- csvStringResult += columnDivider;
- }
- if (typeof objectRecords[i][skey] === "undefined") {
- csvStringResult += '"' + "" + '"';
- continue;
- }
- if (skey == "Person_In_Charge2__c") {
- csvStringResult +=
- '"' + objectRecords[i].Person_In_Charge2__r.Name + '"';
- } else if (skey == "Agency_Hospital__c") {
- csvStringResult +=
- '"' + objectRecords[i].Agency_Hospital__r.Name + '"';
- } else if (skey == "doctor2__c") {
- csvStringResult += '"' + objectRecords[i].doctor2__r.Name + '"';
- } else if (skey == "Product_Category1__c") {
- csvStringResult +=
- '"' + objectRecords[i].Product_Category1__r.Name + '"';
- } else if (skey == "Product_Category2__c") {
- csvStringResult +=
- '"' + objectRecords[i].Product_Category2__r.Name + '"';
- } else if (skey == "Product_Category3__c") {
- csvStringResult +=
- '"' + objectRecords[i].Product_Category3__r.Name + '"';
- } else if (skey == "SupportNeeds__c") {
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- csvStringResult += '"' + objectRecords[i].SupportNeeds__c + '"';
- } else {
- csvStringResult += '"' + objectRecords[i][skey] + '"';
- }
- counter++;
- } // inner for loop close
- console.log("瀵煎嚭寰幆缁撴潫");
- csvStringResult += lineDivider;
- } // outer main for loop close
-
- // return the CSV formate String
- return csvStringResult;
- },
- showExportDate: function (component, objectRecords) {
- console.log("杩涘叆showexceportdate" + objectRecords); //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�'
- var keys = [
- "Submit_date__c",
- "Person_In_Charge2__c",
- "Report_Date__c",
- "Agency_Hospital__c",
- "Department_Cateogy__c",
- "doctor2__c",
- "visitor_title__c",
- "Product_Category1__c",
- "Product_Category2__c",
- "Product_Category3__c",
- "Purpose_Type__c",
- "Result__c",
- "SupportNeeds__c"
- ];
- var headers = [
- "鍛�",
- "鎷呭綋",
- "娲诲姩鏃�",
- "鍖婚櫌",
- "绉戝",
- "鎷滆浜�",
- "鑱屼綅",
- "浜у搧鍖哄垎1",
- "浜у搧鍖哄垎2",
- "浜у搧鍖哄垎3",
- "娲诲姩鍖哄垎",
- "缁撴灉",
- "鏀彺闇�姹�"
- ];
- var content =
- '<table class="table slds-table slds-table--bordered slds-table--cell-buffer">';
- content += '<thead><tr class="slds-text-title--caps">';
- for (i = 0; i < headers.length; i++) {
- content += '<th scope="col">' + headers[i] + "</th>";
- }
- content += "</tr></thead>";
- for (var i = 0; i < objectRecords.length; i++) {
- console.log("for" + content);
- content += "<tr>";
- // content += '<td>'+(i+1)+'</td>';
- for (var sTempkey in keys) {
- console.log("for1" + sTempkey);
- var skey = keys[sTempkey];
- if (typeof objectRecords[i][skey] === "undefined") {
- content += "<td>" + "" + "</td>";
- continue;
- }
- console.log("for2" + objectRecords[i].Person_In_Charge2__r.Name);
- if (skey == "Person_In_Charge2__c") {
- content +=
- "<td>" + objectRecords[i].Person_In_Charge2__r.Name + "</td>";
- } else if (skey == "Agency_Hospital__c") {
- content +=
- "<td>" + objectRecords[i].Agency_Hospital__r.Name + "</td>";
- } else if (skey == "doctor2__c") {
- content += "<td>" + objectRecords[i].doctor2__r.Name + "</td>";
- } else if (skey == "Product_Category1__c") {
- content +=
- "<td>" + objectRecords[i].Product_Category1__r.Name + "</td>";
- } else if (skey == "Product_Category2__c") {
- content +=
- "<td>" + objectRecords[i].Product_Category2__r.Name + "</td>";
- } else if (skey == "Product_Category3__c") {
- content +=
- "<td>" + objectRecords[i].Product_Category3__r.Name + "</td>";
- } else if (skey == "SupportNeeds__c") {
- //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
- content += "<td>" + objectRecords[i].SupportNeeds__c + "</td>";
- } else {
- content += "<td>" + objectRecords[i][skey] + "</td>";
- }
- } // inner for loop close
- content += "</tr>";
- } // outer main for loop close
- content += "</table>";
- console.log("helper寰幆缁撴潫" + content);
- component.set("v.TableContent2", content);
- component.set("v.showMain", false);
- },
-
- select_repores_date: function (component, event, helper) {
- component.set("v.loginEdit", true);
- var reportsdate1 = component.find("input-report-date1").get("v.value");
- var reportsdate2 = component.find("input-report-date2").get("v.value");
- console.log(
- "杈撳叆鐨勫紑濮嬫棩鏈�" + reportsdate1 + "杈撳叆鐨勭粨鏉熸棩鏈�" + reportsdate2
- );
- var action = component.get("c.getReportsByDate");
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�1");
- action.setParams({
- date1: reportsdate1,
- date2: reportsdate2
- });
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�2");
- action.setCallback(this, function (response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var res = response.getReturnValue();
- console.log("杈撳叆鐨勫紑濮嬫棩鏈�3" + res);
- component.set("v.loginEdit", false);
-
- // PI 鏀归�� By Bright 20220328
- if (true) {
- let awsids = [];
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].doctor2__r &&
- res[ri].doctor2__r.AWS_Data_Id__c
- ) {
- awsids.push(res[ri].doctor2__r.AWS_Data_Id__c);
- }
- }
- if (awsids.length > 0) {
- let awsurl = component.get("v.awsurl");
-
- AWSService.search(
- awsurl.searchUrl,
- {
- dataIds: awsids
- },
- function (data) {
- if (data && data.object && data.object.length) {
- let m = {};
- for (let di in data.object) {
- if (data.object[di] && data.object[di].dataId) {
- m[data.object[di].dataId] = data.object[di];
- }
- }
-
- for (let ri in res) {
- if (
- res[ri] &&
- res[ri].doctor2__r &&
- res[ri].doctor2__r.AWS_Data_Id__c &&
- m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)
- ) {
- res[ri].doctor2__r.Name =
- m[res[ri].doctor2__r.AWS_Data_Id__c].name;
- res[ri].visitor_title__c =
- m[res[ri].doctor2__r.AWS_Data_Id__c].doctorDivision1;
- }
- }
+ var default_doctor = component.get('v.default_select_doctor_id');
+ if (default_doctor != '' && res.length > 0) {
+ var doctor_title = '';
+ for (var i = 0; i < res.length; i++) {
+ if (res[i].value == default_doctor) {
+ res[i].selected = true;
+ doctor_title = res[i].Doctor_Division1__c;
+ } else {
+ res[i].selected = false;
}
- helper.showExportDate(component, res);
+ }
- component.set("v.loginEdit", false);
- },
- awsurl.token
- );
- } else {
- helper.showExportDate(component, res);
- }
+ component.find('select_doctor').set('v.options', res);
+ component.set('v.doctor_title', doctor_title);
+ } else {
+ component.find('select_doctor').set('v.options', res);
+ if (res.length > 0) {
+ component.set('v.doctor_title', res[0].Doctor_Division1__c);
+ }
+ }
+
+ component.set('v.default_select_doctor_id', '');
+ component.set('v.doctor_list', res);
+ component.set('v.loginEdit',false);
+ },
+ // PIPL update Yin Mingjie 21/02/2022 end
+
+ // stageNameChange : function(component, event, helper) {
+ // var options = component.find('input-oppstage').get("v.body")[0].get('v.options');
+ // var remove;
+ // for (var i = 0; i < options.length; i++) {
+ // if (options[i].label == '鐩爣') {
+ // remove = i;
+ // break;
+ // }
+ // }
+ // options.splice(remove,1);
+ // },
+
+ opportunityChange : function(component, event, helper) {
+ debugger
+ var opp_id = component.get('v.data.Opportunity__c');
+ if (opp_id == '') {
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ } else if (opp_id == 'MALFORMED_ID') {
+ component.set('v.data.Opportunity__c', '');
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ } else if (opp_id != "") {
+ var hospital_link_id = component.get('v.hospitalLinkId');
+ if (hospital_link_id == '') {
+ this.warning('鍖婚櫌涓嶅瓨鍦�');
+ // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
+ component.set('v.data.Opportunity__c', '');
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+ // var values = [];
+ // // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
+ // } else {
+ // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
+ // }
+ return false;
+ }
+ var action = component.get('c.selectOpportunityByIdAndHospitalLinkId');
+ action.setParams({
+ "opportunity_id" : opp_id,
+ "agency_hospital_link_id" : component.get('v.hospitalLinkId'),
+ });
+
+ component.set('v.loginEdit',true);
+ action.setCallback(this,function(response){
+ var state = response.getState();
+ if(state == 'SUCCESS'){
+ var res = response.getReturnValue();
+ if (res.length <= 0) {
+ if (component.get('v.data.Opportunity__c')) {
+ this.warning('鍖婚櫌鏈尮閰嶅埌');
+ }
+ // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
+ component.set('v.data.Opportunity__c', '');
+ $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+ // var values = [];
+ // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
+ // } else {
+ // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
+ // }
+ component.set('v.loginEdit',false);
+ return false;
+ }
+ //SWAG-CKH5M8 銆愬鎵樸�戝懆鎶ュ叧鑱旇浠凤紝鍙�夋嫨璇环鑼冨洿璋冩暣 fy start
+ // else if (res[0]['StageName2__c'] != '3.璇环' && !component.get('v.loadOpp')){
+ // this.warning('璇烽�夋嫨璇环涓殑椤圭洰');
+ // // ToDo闇�瑕佹祴璇曟墜鏈轰笂鑳借繍琛屼笉
+ // component.set('v.data.Opportunity__c', '');
+ // $A.util.addClass(component.find('input-opportunity-stage'), 'disp_none');
+ // $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none');
+ // $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none');
+ // $A.util.addClass(component.find('input-opportunity-date'), 'disp_none');
+ // $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none');
+ // // if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+ // // var values = [];
+ // // component.find('input-opportunity').get("v.body")[0].set('v.values', values);
+ // // } else {
+ // // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', '');
+ // // }
+ // component.set('v.login',false);
+ // return false;
+ // }
+ //SWAG-CKH5M8 銆愬鎵樸�戝懆鎶ュ叧鑱旇浠凤紝鍙�夋嫨璇环鑼冨洿璋冩暣 fy end
+ else {
+ component.set('v.loadOpp', false);
+ component.set('v.oppdata',res[0]);
+ this.set_selected(component, 'select_stageName', res[0].StageName__c);
+ component.set('v.Close_Forecasted_Date__c_o', res[0].Close_Forecasted_Date__c);
+ component.set('v.Amount__c_o', res[0].Amount__c);
+ component.set('v.OCMSale_Price__c_o', res[0].OCMSale_Price__c);
+ component.set('v.StageName__c_o', res[0].StageName__c);
+
+ $A.util.removeClass(component.find('input-opportunity-stage'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-amount1'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-amount2'), 'disp_none');
+ $A.util.removeClass(component.find('input-opportunity-date'), 'disp_none');
+ $A.util.addClass(component.find('input-opportunity-blank'), 'disp_none');
+ }
+
+ component.set('v.loginEdit',false);
+ }
+ else{
+ this.error('selectOpportunityByIdAndHospitalLinkId failed.');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+ }
+ },
+
+ productcategoryChange1 : function(component, event, helper) {
+ var product_category_id = component.find('select_Product1').get('v.value');
+ var pcId1 = component.find('select_Product2').get('v.value');
+ var pcId2 = component.find('select_Product3').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ this.warning('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ component.find('select_Product1').set('v.value','');
+ }
+ },
+ productcategoryChange2 : function(component, event, helper) {
+ var product_category_id = component.find('select_Product2').get('v.value');
+ var pcId1 = component.find('select_Product1').get('v.value');
+ var pcId2 = component.find('select_Product3').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ this.warning('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ component.find('select_Product2').set('v.value','');
+ }
+ },
+ productcategoryChange3 : function(component, event, helper) {
+ var product_category_id = component.find('select_Product3').get('v.value');
+ var pcId1 = component.find('select_Product1').get('v.value');
+ var pcId2 = component.find('select_Product2').get('v.value');
+ var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
+ var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
+ var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
+ if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
+ this.warning('涓嶈兘閫夋嫨鍚屾牱鐨勪骇鍝佸尯鍒�');
+ component.find('select_Product3').set('v.value','');
+ }
+ },
+
+ conv_selected : function(obj) {
+ for (var i = 0; i < obj.length; i++) {
+ if (obj[i].selected) {
+ if (obj[i].selected == 'true') {
+ obj[i].selected = true;
+ } else {
+ obj[i].selected = false;
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ set_selected : function (component, aura_id_name, value) {
+ var select_tmp = component.find(aura_id_name).get('v.options');
+ if (select_tmp) {
+ for (var i = 0; i < select_tmp.length; i++) {
+ if (select_tmp[i].value == value) {
+ select_tmp[i].selected = true;
+ } else {
+ select_tmp[i].selected = false;
+ }
+ }
+ component.find(aura_id_name).set('v.options', select_tmp);
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ success : function(message) {
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ "title" : "鎴愬姛!",
+ "message" : message,
+ "type" : "success",
+ "duration" : "5000"
+ });
+ toastEvent.fire();
+ },
+
+ warning : function(message) {
+ var toastEvent = $A.get("e.force:showToast");
+ toastEvent.setParams({
+ "title": "璀﹀憡!",
+ "message": message,
+ "type":"warning",
+ "duration" : "10000"
+ });
+ toastEvent.fire();
+ },
+
+ error : function(message) {
+ // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap');
+ var toastEvent = $A.get("e.force:showToast");
+
+ toastEvent.setParams({
+ "title": "閿欒!",
+ "message": message,
+ "type":"error",
+ "duration" : "sticky"
+ });
+ toastEvent.fire();
+ },
+
+ createCon : function(component, event, helper) {
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.removeClass(modal_newAC, 'disp_none');
+ component.set('v.truthy', true);
+ // var modal_newAC = component.find('modal_newAC')
+ // $A.util.removeClass(modal_newAC, 'disp_none');
+ },
+
+ // vivek start 娣诲姞楠岃瘉
+ // handleFormSubmit : function(component) {
+ // var showValidationError = false;
+ // var fields = component.find("newOpportunityField");
+ // var vaildationFailReason = '';
+ // var currentDate = new Date().toJSON().slice(0,10);
+
+ // fields.forEach(function (field) {
+ // if(field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))){
+ // showValidationError = true;
+ // vaildationFailReason = "鍒嗙被涓嶈兘涓虹┖锛�";
+ // }else if(field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))){
+ // showValidationError = true;
+ // vaildationFailReason = "鍖荤敓鍖哄垎(鑱屽姟)涓嶈兘涓虹┖锛�";
+ // }
+ // });
+
+ // if (showValidationError) {
+ // component.find('OppMessage').setError(vaildationFailReason);
+ // }
+ // },
+ // vivek end 娣诲姞楠岃瘉
+
+ hideCmp : function(component, event, helper) {
+ var div1 = component.find('report')
+ var div2 = component.find('report_list')
+ $A.util.addClass(div1, 'disp_none');
+ $A.util.addClass(div2, 'disp_none');
+ },
+
+ handleSuccess : function(component, event, helper) {
+ var insertId = event.getParams().response.Id;
+ var displayValue = event.getParams().response.fields.Name.value;
+ event.setParams({});
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ this.success('.瀹㈡埛浜哄憳宸插垱寤恒��');
+ this.set_doctor_list(component);
+ },
+
+ createCancel : function(component, event, helper) {
+ component.set('v.truthy', false);
+ var modal_newAC = component.find('modal_newAC')
+ $A.util.addClass(modal_newAC, 'disp_none');
+ },
+ setOpportunity_cfilter : function(component) {
+ debugger
+ var hosId = component.get('v.hospitalId');
+ var Department_Cateogy__c = component.find('select_department').get('v.value');
+ var opportunity_cfilter = '';
+ if (hosId != '' && hosId != null) {
+ opportunity_cfilter = ' Agency_Hospital__r.Hospital__c=' + '\'' + hosId + '\'';
+ }
+ if (Department_Cateogy__c != '' && Department_Cateogy__c != null) {
+ if (opportunity_cfilter != '' && opportunity_cfilter != null) {
+ opportunity_cfilter += ' AND ';
+ }
+ opportunity_cfilter += 'Department_Cateogy__c=' + '\'' + Department_Cateogy__c + '\'';
+ }
+ component.set('v.opportunity_cfilter', opportunity_cfilter);
+ component.set('v.data.Opportunity__c', null);
+ },
+ readFile: function(component, helper, file) {
+ if (!file) return;
+ // console.log('file'+file.name);
+ if(!file.name.match(/\.(csv||CSV)$/)){
+ return alert('only support csv files');
+ }else{
+
+ reader = new FileReader();
+ reader.onerror =function errorHandler(evt) {
+ switch(evt.target.error.code) {
+ case evt.target.error.NOT_FOUND_ERR:
+ alert('File Not Found!');
+ break;
+ case evt.target.error.NOT_READABLE_ERR:
+ alert('File is not readable');
+ break;
+ case evt.target.error.ABORT_ERR:
+ break; // noop
+ default:
+ alert('An error occurred reading this file.');
+ };
+ }
+ //reader.onprogress = updateProgress;
+ reader.onabort = function(e) {
+ alert('File read cancelled');
+ };
+ reader.onloadstart = function(e) {
+
+ var output = '<ui type=\"disc\"><li><strong>'+file.name +'</strong> ('+file.type+')- '+file.size+'bytes, last modified: '+file.lastModifiedDate.toLocaleDateString()+'</li></ui>';
+ component.set("v.filename",file.name);
+ component.set("v.TargetFileName",output);
+
+ };
+ reader.onload = function(e) {
+ var data=e.target.result;
+ component.set("v.fileContentData",data);
+ console.log("file data"+JSON.stringify(data));
+ // console.log("file data"+encodeURI(JSON.stringify(data),"utf-8"));
+ var allTextLines = data.split(/\r\n|\n/);
+ var dataRows=allTextLines.length-1;
+ var headers = allTextLines[0].split(',');
+
+ // console.log("Rows length::"+dataRows);
+
+
+ var numOfRows=component.get("v.NumOfRecords");
+ if(dataRows > numOfRows+1 || dataRows == 1 || dataRows== 0){
+
+ alert("File Rows between 1 to "+numOfRows+" .");
+ component.set("v.showMain",true);
+
+ }
+ else{
+ var lines = [];
+ var filecontentdata;
+ var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
+ content += "<thead><tr class=\"slds-text-title--caps\">";
+ content += '<th scope=\"col"\>'+'琛屽彿'+'</th>';
+ for(i=0;i<headers.length; i++){
+ content += '<th scope=\"col"\>'+headers[i]+'</th>';
+ }
+ content += "</tr></thead>";
+ for (var i=1; i<allTextLines.length; i++) {
+ filecontentdata = allTextLines[i].split(',');
+ if(filecontentdata[0]!=''){
+ content +="<tr>";
+ content +="<td>"+i+"</td>";
+ for(var j=0;j<filecontentdata.length;j++){
+ content +='<td>'+filecontentdata[j]+'</td>';
+ }
+ content +="</tr>";
+ }
+ }
+ content += "</table>";
+ console.log(content);
+ component.set("v.TableContent",content);
+ component.set("v.showMain",false);
+ }
+ }
+ reader.readAsText(file,'gb2312');
+
+ }
+ var reader = new FileReader();
+ reader.onloadend = function() {
+
+ };
+ reader.readAsDataURL(file);
+ },
+
+ saveRecords : function(component,event,helper){
+ debugger
+ component.set('v.loginEdit',true);
+ //fy 瀵煎叆 20220424 start
+ var action1 = component.get("c.processDataAWSId");
+ action1.setParams({
+ fileData : component.get("v.fileContentData"),
+ });
+ debugger
+ action1.setCallback(this, function(response) {
+ console.log('response = ' + JSON.stringify(response));
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var ress = response.getReturnValue();
+ console.log('ress = ' + JSON.stringify(ress));
+ if(ress){
+ var valur =ress.split('error1');
+ if(valur.length<=1){
+ var res = JSON.parse(response.getReturnValue());
+ console.log('res = ' + JSON.stringify(res));
+ var dataArr = new Array();
+ var dataMap = new Map();
+ res.forEach(item => {
+ if(item.AWS_Data_Id__c){
+ dataArr.push(item.AWS_Data_Id__c);
+ //dataMap.set(item.AWS_Data_Id__c,item.Name_Encrypted__c);
+ dataMap.set(item.AWS_Data_Id__c,item.AWS_Data_Id__c); //zhj 鏂版柟妗堟敼閫� 2022-12-21
+ }
+ });
+ let obj= Object.create(null);
+ obj['dataIds'] = dataArr;
+ var payload = JSON.stringify(obj);
+ console.log('payload zhj = ' + JSON.stringify(payload));
+
+ this.search_contact_url(component, 'Agency_Contact__c', (result)=>{
+ var token = result.token;
+ var searchUrl = result.searchUrl;
+ this.search_core(token,searchUrl,payload,(result)=>{
+ if(result.status == '0'){
+ if(result.object != null&&result.object.length != 0){
+ // var resultjson = JSON.stringify(result.object);
+ // if(resultjson){
+ // debugger
+ // console.warn('001');
+ // component.set('v.login',true);
+ // this.ImportMethod(component,resultjson);
+ // }
+ component.set('v.loginEdit',true);
+ this.saveRecordsEditFile(component,dataMap,result.object,helper);
+ }else{
+ this.error('AWS 鏌ヨ鏁版嵁涓虹┖ ' );
+ component.set('v.loginEdit',false);
+ }
+ }else{
+ this.error('AWS search status6 : ' + result.status);
+ component.set('v.loginEdit',false);
+ }
+ },component);
+ // var resultjson =null;
+ // this.ImportMethod(component,resultjson);
+
+ });
+ // var resultjson =null;
+ // this.ImportMethod(component,resultjson);
+ }else{
+ this.error(valur[1]+'\n'+"璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ }
+ }
+ }
+ });
+ $A.enqueueAction(action1);
+ //fy 瀵煎叆 20220424 end
+ // var action = component.get("c.processData");
+ // var selectDate = component.find('select_date').get('v.value');
+ // var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic
+ // var sss=component.get("v.fileContentData");
+ // action.setParams({
+ // fileData : component.get("v.fileContentData"),
+ // //selectDateselectDate :component.find('select_date').get('v.value'),
+ // sobjectName:'Account', //Any object
+ // fields:fieldsList
+ // });
+ // action.setCallback(this, function(response) {
+ // var state = response.getState();
+ // if (state === "SUCCESS") {
+
+ // var res = response.getReturnValue();
+ // var res1 = '';
+ // console.log("[[[[[["+res);
+ // if(res != 'success'){
+ // debugger
+ // var ress = res.split('=');
+ // console.log(ress);
+ // for (var i=0; i<ress.length; i++) {
+ // res1 += ress[i].substr(7)+'\n';
+ // }
+ // // $('.forceToastManager').css('white-space', 'pre-wrap');
+ // console.log("=="+res1);
+ // this.error(res1+"璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ // component.set('v.login',false);
+ // }else{
+ // component.set("v.showMain",true);
+ // this.success("瀵煎叆鎴愬姛");
+ // // alert('saved successfully');
+ // component.set('v.login',false);
+ // }
+
+ // }
+ // else if (state === "INCOMPLETE") {
+ // // do something
+ // component.set('v.login',false);
+ // }
+ // else if (state === "ERROR") {
+ // var errors = response.getError();
+ // if (errors) {
+ // if (errors[0] && errors[0].message) {
+ // console.log("Error message: " +
+ // errors[0].message);
+ // component.set('v.login',false);
+ // }
+ // } else {
+ // console.log("Unknown error");
+ // component.set('v.login',false);
+ // }
+ // }
+ // });
+ // $A.enqueueAction(action);
+
+ },isNumber: function(str) {
+ return /^\d+$/.test(str);
+ },ImportMethod : function(component,fileStr){
+ debugger
+ var actionss = component.get("c.processData");
+ var selectDate = component.find('select_date').get('v.value');
+ var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic
+ var sss=component.get("v.fileContentData");
+ actionss.setParams({
+ // fileData : component.get("v.fileContentData"),
+ fileData : fileStr,
+ // selectDateselectDate :component.find('select_date').get('v.value'),
+ sobjectName:'Account', //Any object
+ fields:fieldsList
+ // Agency_ContactListjson:resultjson
+ });
+ actionss.setCallback(this, function(response) {
+ console.log('002');
+ var state = response.getState();
+ if (state === "SUCCESS") {
+ var res = response.getReturnValue();
+ var res1 = '';
+ console.log("[[[[[["+res);
+ if(res != 'success'){
+ var ress = res.split('=');
+ console.log(ress);
+ let errorDatas = [];
+ let errorDataRow = [];
+ debugger
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ for (var i=0; i<ress.length; i++) {
+ res1 += ress[i].substr(7)+'\n';
+ if (ress[i] != '') {
+ let errorData = {}
+ if(!this.isNumber(ress[i].substr(7).substring(1, 2))){
+ continue
+ }
+ let index = errorDataRow.indexOf(ress[i].substr(7).substring(1, 2));
+ if (index == -1) {
+ errorData.errorRow = ress[i].substr(7).substring(1, 2);
+ errorDataRow.push(errorData.errorRow);
+ errorData.errorInfo = ress[i].substr(7).substring(5).replace('=','');
+ if(errorData.errorInfo == '鎷滆浜轰笉瀛樺湪'){
+ console.log('errorData.errorRow = ' + errorData.errorRow)
+ errorData.errorInfo ='鎷滆浜� ' + fileContentData[errorData.errorRow].split(',')[4] + '涓嶅瓨鍦�';
+ }
+ errorDatas.push(errorData);
+ } else {
+ if(ress[i].substr(7).substring(5) == '鎷滆浜轰笉瀛樺湪'){
+ errorDatas[index].errorInfo += '; ' + '鎷滆浜� ' + fileContentData[errorDatas[index].errorRow].split(',')[4] + '涓嶅瓨鍦�';
+ }else{
+ errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5);
+ }
+ }
+ }
+ }
+ let errorColumns = [
+ { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
+ { label: '閿欒淇℃伅', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true }
+ ];
+ for (var i = 0; i < fileContentData[0].split(',').length; i++) {
+ errorColumns.push({
+ label: fileContentData[0].split(',')[i],
+ fieldName: 'field' + i,
+ type: 'text',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 120
+ });
+ }
+
+ for (var i = 0; i < errorDatas.length; i++) {
+ let data = fileContentData[errorDatas[i].errorRow];
+ console.log('data = ' + JSON.stringify(data));
+ if(data){
+ for (var j = 0; j < data.split(',').length; j++) {
+ let label = 'field' + j;
+ errorDatas[i][label] = data.split(',')[j];
+ }
+ }
+ }
+ component.set('v.errorColumns', errorColumns);
+ component.set('v.errorData', errorDatas);
+ component.set("v.showErrorInfo", true);
+ console.log("=="+res1);
+ this.error(res1+"璇蜂慨鏀瑰悗閲嶆柊涓婁紶");
+ component.set('v.loginEdit',false);
+ }else{
+ component.set("v.showMain",true);
+ this.success("瀵煎叆鎴愬姛");
+ // alert('saved successfully');
+ component.set('v.loginEdit',false);
+ }
+
+ }
+ else if (state === "INCOMPLETE") {
+ // do something
+ component.set('v.loginEdit',false);
+ }
+ else if (state === "ERROR") {
+ var errors = response.getError();
+ if (errors) {
+ if (errors[0] && errors[0].message) {
+ console.log("Error message: " +
+ errors[0].message);
+ component.set('v.loginEdit',false);
+ }
+ } else {
+ console.log("Unknown error");
+ component.set('v.loginEdit',false);
+ }
+ }
+ });
+ $A.enqueueAction(actionss);
+ },saveRecordsEditFile : function(component,dataMap,searchData,helper){
+ var searchDataMap = new Map();
+ for (var i = 0; i < searchData.length; i++) {
+ var sd = searchData[i];
+ if(sd.name)
+ searchDataMap.set(sd.name.replace(' ',''),sd.dataId);
+ }
+ console.log('searchDataMap='+searchDataMap);
+ var error = '';
+ var fileData = component.get("v.fileContentData");
+ var files = fileData.split('\n');
+
+ var fileStr = files[0];
+ fileStr += '\n';
+
+ for (var i = 1; i < files.length-1; i++) {
+ var filelist = files[i].split(',');
+ var fileName = filelist[4];
+
+ if (searchDataMap.get(fileName.replace(' ',''))) {
+ var nameDataId = searchDataMap.get(fileName.replace(' ',''));
+ if (dataMap.get(nameDataId)) {
+ filelist[4] = dataMap.get(nameDataId); //zhj 鏂版柟妗堟敼閫� filelist[4]涓嶅啀瀛樼殑nameEncrpt 2022-12-21
+ }else {
+ error += 'error1 绗�'+i+'琛屾暟鎹嫓璁夸汉SF涓嶅瓨鍦�';
+ error += '=';
+ }
+ }else {
+ error += 'error1 绗�'+i+'琛屾暟鎹嫓璁夸汉AWS涓嶅瓨鍦�';
+ error += '=';
+ }
+ fileStr += filelist.toString();
+ fileStr += '\n';
}
- component.set("v.reports_date", res);
- } else {
- alert("瀵煎嚭澶辫触,璇锋鏌ユ椿鍔ㄦ棩");
- component.set("v.loginEdit", false);
- }
- });
- $A.enqueueAction(action);
- },
+ if (error != '') {
+ console.log('zhj error = ' + error);
+ let errorArray = error.split('error1');
+ let errorDatas = [];
+ let errorDataRow = [];
+ debugger
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ console.log('errorArray = ' + JSON.stringify(errorArray))
+ for (var i in errorArray) {
+ if (errorArray[i] != '') {
+ let errorData = {}
+ if(!this.isNumber(errorArray[i].trim().substring(1, 2))){
+ continue
+ }
+ let index = errorDataRow.indexOf(errorArray[i].trim().substring(1, 2));
+ if (index == -1) {
+ errorData.errorRow = errorArray[i].trim().substring(1, 2);
+ errorDataRow.push(errorData.errorRow);
+ errorData.errorInfo = errorArray[i].trim().substring(5,errorArray[i].trim().length).replace('=','');
+ if(errorData.errorInfo == '鎷滆浜篈WS涓嶅瓨鍦�'){
+ errorData.errorInfo ='鎷滆浜� ' + fileContentData[errorData.errorRow].split(',')[4] + '涓嶅瓨鍦�';
+ }
+ errorDatas.push(errorData);
+ } else {
+ if(errorArray[i].trim().substring(5) == '鎷滆浜篈WS涓嶅瓨鍦�'){
+ errorData[index].errorInfo = '; ' + '鎷滆浜� ' + fileContentData[errorDatas[index].errorRow].split(',')[4] + '涓嶅瓨鍦�';
+ }else{
+ errorDatas[index].errorInfo += '; ' + errorArray[i].trim().substring(5,errorArray[i].trim().length);
+ }
+ }
+ }
+ }
+ var fileContentData = component.get("v.fileContentData").split('\n');
+ let errorColumns = [
+ { label: '閿欒琛�', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
+ { label: '閿欒淇℃伅', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true }
+ ];
+ for (var i = 0; i < fileContentData[0].split(',').length; i++) {
+ errorColumns.push({
+ label: fileContentData[0].split(',')[i],
+ fieldName: 'field' + i,
+ type: 'text',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 120
+ });
+ }
- showImport: function (component) {
- // console.log('杩涘叆');
- // component.find('file').click();
- var modalimport = component.find("modal_import");
- var modalimportbg = component.find("modal_importbg");
- $A.util.removeClass(modalimport, "disp_none");
- $A.util.removeClass(modalimportbg, "disp_none");
- },
+ for (var i = 0; i < errorDatas.length; i++) {
+ let data = fileContentData[errorDatas[i].errorRow];
+ console.log('data = ' + JSON.stringify(data));
+ for (var j = 0; j < data.split(',').length; j++) {
+ let label = 'field' + j;
+ errorDatas[i][label] = data.split(',')[j];
+ }
+ }
+ console.log('errorDatas =' + JSON.stringify(errorDatas))
+ component.set('v.errorColumns', errorColumns);
+ component.set('v.errorData', errorDatas);
+ component.set("v.showErrorInfo", true);
- showExport: function (component) {
- var modalimport = component.find("modal_export");
- var modalimportbg = component.find("modal_exportbg");
- $A.util.removeClass(modalimport, "disp_none");
- $A.util.removeClass(modalimportbg, "disp_none");
- },
- close_import: function (component) {
- var modalimport = component.find("modal_import");
- var modalimportbg = component.find("modal_importbg");
- $A.util.addClass(modalimport, "disp_none");
- $A.util.addClass(modalimportbg, "disp_none");
- },
- close_export: function (component) {
- var modalimport = component.find("modal_export");
- var modalimportbg = component.find("modal_exportbg");
- $A.util.addClass(modalimport, "disp_none");
- $A.util.addClass(modalimportbg, "disp_none");
- },
+ console.log('error = ' + error);
+ component.set('v.errorMessage', error);
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
- CallBackAction: function (component, action_name, para, callback) {
- var action = component.get(
- "c." + action_name.trimStart().replace("c.", "")
- );
- if (para) {
- action.setParams(para);
- }
- if (callback) {
- action.setCallback(this, function (data) {
- callback(data);
- });
- }
+ this.error(error);
+ console.log('error='+error);
+ component.set('v.loginEdit',false);
+ return;
+ }
- $A.enqueueAction(action);
- },
- //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+ console.log('fileStr='+fileStr);
+ $A.getCallback(function(){
+ debugger
+ helper.ImportMethod(component,fileStr);
+ })();
- //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 start
- exportErrorInfoHelper: function (component) {
- var errorData = component.get("v.errorData");
- var errorColumns = component.get("v.errorColumns");
-
- var datas = [];
- let errorColumnsArray = [];
- for (var i in errorColumns) {
- errorColumnsArray.push(errorColumns[i].label);
- }
- datas.push(errorColumnsArray);
- //datas.push(errorColumns);
-
- for (var i in errorData) {
- let data = [];
- data.push(errorData[i].errorRow);
- data.push(errorData[i].errorInfo);
- for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) {
- data.push(errorData[i]["field" + j]);
- }
- datas.push(data);
- }
-
- console.log("datas = " + JSON.stringify(datas));
- var csv = this.convertToCSV(component, datas);
- console.log("csv = " + JSON.stringify(csv));
- this.downloadCSV(component, csv);
- },
-
- convertToCSV: function (component, data) {
- console.log("enter convertToCSV");
- console.log("data = " + data);
- var csv = "";
- for (var i = 0; i < data.length; i++) {
- var row = data[i];
- console.log("row = " + JSON.stringify(row));
- for (var j = 0; j < row.length; j++) {
- var val = "";
- val = row[j] === null ? "" : row[j].toString();
- console.log("val = " + val);
- if (
- val.indexOf(",") !== -1 ||
- val.indexOf('"') !== -1 ||
- val.indexOf("\n") !== -1
- ) {
- //val = '"' + val.replace(/"/g,'""') + '"';
+ },
+ convertArrayOfObjectsToCSV : function(component,objectRecords){
+ var csvStringResult, counter, keys, columnDivider, lineDivider,thkeys;
+ if (objectRecords == null || !objectRecords.length) {
+ return null;
+ }
+ columnDivider = ',';
+ lineDivider = '\n';
+ //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�'
+ keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c'];
+ thkeys = ['鍛�','鎷呭綋','娲诲姩鏃�','鍖婚櫌','绉戝','鎷滆浜�','鑱屼綅','浜у搧鍖哄垎1','浜у搧鍖哄垎2','浜у搧鍖哄垎3','娲诲姩鍖哄垎','缁撴灉','鏀彺闇�姹�']
+ csvStringResult = '';
+ csvStringResult += thkeys.join(columnDivider);
+ csvStringResult += lineDivider;
+ console.log("杩涘叆瀵煎嚭helper");
+ for(var i=0; i < objectRecords.length; i++){
+ counter = 0;
+ for(var sTempkey in keys) {
+ var skey = keys[sTempkey];
+ if(counter > 0){
+ csvStringResult += columnDivider;
+ }
+ if(typeof objectRecords[i][skey] === "undefined"){
+ csvStringResult += '"'+''+'"';
+ continue;
+ }
+ if(skey == 'Person_In_Charge2__c'){
+ csvStringResult += '"'+ objectRecords[i].Person_In_Charge2__r.Name+'"';
+ }else if(skey == 'Agency_Hospital__c'){
+ csvStringResult += '"'+ objectRecords[i].Agency_Hospital__r.Name+'"';
+ }else if(skey == 'doctor2__c'){
+ csvStringResult += '"'+ objectRecords[i].doctor2__r.Name+'"';
+ }else if(skey == 'Product_Category1__c'){
+ csvStringResult += '"'+ objectRecords[i].Product_Category1__r.Name+'"';
+ }else if(skey == 'Product_Category2__c'){
+ csvStringResult += '"'+ objectRecords[i].Product_Category2__r.Name+'"';
+ }else if(skey == 'Product_Category3__c'){
+ csvStringResult += '"'+ objectRecords[i].Product_Category3__r.Name+'"';
+ }
+ else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ csvStringResult += '"'+ objectRecords[i].SupportNeeds__c+'"';
+ }
+ else{
+ csvStringResult += '"'+ objectRecords[i][skey]+'"';
+ }
+ counter++;
+
+ } // inner for loop close
+ console.log("瀵煎嚭寰幆缁撴潫");
+ csvStringResult += lineDivider;
+ }// outer main for loop close
+
+ // return the CSV formate String
+ return csvStringResult;
+ },
+ showExportDate : function(component,objectRecords){
+ console.log('杩涘叆showexceportdate'+objectRecords);//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�'
+ var keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c'];
+ var headers = ['鍛�','鎷呭綋','娲诲姩鏃�','鍖婚櫌','绉戝','鎷滆浜�','鑱屼綅','浜у搧鍖哄垎1','浜у搧鍖哄垎2','浜у搧鍖哄垎3','娲诲姩鍖哄垎','缁撴灉','鏀彺闇�姹�']
+ var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
+ content += "<thead><tr class=\"slds-text-title--caps\">";
+ for(i=0;i<headers.length; i++){
+ content += '<th scope=\"col"\>'+headers[i]+'</th>';
}
- if (j > 0) {
- csv += ",";
+ content += "</tr></thead>";
+ for(var i=0; i < objectRecords.length; i++){
+ console.log('for'+content);
+ content += '<tr>';
+ // content += '<td>'+(i+1)+'</td>';
+ for(var sTempkey in keys) {
+ console.log('for1'+sTempkey);
+ var skey = keys[sTempkey];
+ if(typeof objectRecords[i][skey] === "undefined"){
+ content += '<td>'+''+'</td>';
+ continue;
+ }
+ console.log('for2'+objectRecords[i].Person_In_Charge2__r.Name);
+ if(skey == 'Person_In_Charge2__c'){
+ content += '<td>'+ objectRecords[i].Person_In_Charge2__r.Name+'</td>';
+ }else if(skey == 'Agency_Hospital__c'){
+ content += '<td>'+ objectRecords[i].Agency_Hospital__r.Name+'</td>';
+ }else if(skey == 'doctor2__c'){
+ content += '<td>'+ objectRecords[i].doctor2__r.Name+'</td>';
+ }else if(skey == 'Product_Category1__c'){
+ content += '<td>'+ objectRecords[i].Product_Category1__r.Name+'</td>';
+ }else if(skey == 'Product_Category2__c'){
+ content += '<td>'+ objectRecords[i].Product_Category2__r.Name+'</td>';
+ }else if(skey == 'Product_Category3__c'){
+ content += '<td>'+ objectRecords[i].Product_Category3__r.Name+'</td>';
+ }
+ else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+ content += '<td>'+ objectRecords[i].SupportNeeds__c+'</td>';
+ }
+ else{
+ content += '<td>'+ objectRecords[i][skey]+'</td>';
+ }
+ } // inner for loop close
+ content += '</tr>'
+ }// outer main for loop close
+ content += '</table>';
+ console.log("helper寰幆缁撴潫"+content);
+ component.set("v.TableContent2",content);
+ component.set("v.showMain",false);
+ },
+
+ select_repores_date : function(component,event,helper){
+ component.set('v.loginEdit',true);
+ var reportsdate1 = component.find('input-report-date1').get('v.value');
+ var reportsdate2 = component.find('input-report-date2').get('v.value');
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�'+reportsdate1+'杈撳叆鐨勭粨鏉熸棩鏈�'+reportsdate2);
+ var action = component.get("c.getReportsByDate");
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�1');
+ action.setParams({
+ date1 : reportsdate1,
+ date2: reportsdate2
+ });
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�2');
+ action.setCallback(this, function(response) {
+ var state = response.getState();
+ if (state === "SUCCESS") {
+
+ var res = response.getReturnValue();
+ console.log('杈撳叆鐨勫紑濮嬫棩鏈�3'+res);
+ component.set('v.loginEdit',false);
+
+ // PI 鏀归�� By Bright 20220328
+ if(true){
+ let awsids = [];
+ for (let ri in res) {
+ if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c){
+ awsids.push(res[ri].doctor2__r.AWS_Data_Id__c);
+ }
+ }
+ if(awsids.length > 0){
+ let awsurl = component.get('v.awsurl');
+
+ AWSService.search(awsurl.searchUrl,{
+ dataIds:awsids
+ }, function(data){
+ if(data && data.object && data.object.length){
+ let m = {};
+ for(let di in data.object){
+ if(data.object[di] && data.object[di].dataId){
+ m[data.object[di].dataId] = data.object[di];
+ }
+ }
+
+ for(let ri in res){
+ if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)){
+ res[ri].doctor2__r.Name = m[res[ri].doctor2__r.AWS_Data_Id__c].name;
+ res[ri].visitor_title__c = m[res[ri].doctor2__r.AWS_Data_Id__c].doctorDivision1;
+
+ }
+ }
+ }
+ helper.showExportDate(component, res);
+
+ component.set('v.loginEdit', false);
+ }, awsurl.token);
+ }else{
+ helper.showExportDate(component, res);
+ }
+ }
+
+
+ component.set('v.reports_date', res);
+
+ }else{
+ alert('瀵煎嚭澶辫触,璇锋鏌ユ椿鍔ㄦ棩');
+ component.set('v.loginEdit',false);
+ }
+ });
+ $A.enqueueAction(action);
+
+ },
+
+ showImport : function(component){
+ // console.log('杩涘叆');
+ // component.find('file').click();
+ var modalimport = component.find('modal_import');
+ var modalimportbg = component.find('modal_importbg');
+ $A.util.removeClass(modalimport, 'disp_none');
+ $A.util.removeClass(modalimportbg,'disp_none');
+ },
+
+ showExport : function(component) {
+ var modalimport = component.find('modal_export');
+ var modalimportbg = component.find('modal_exportbg');
+ $A.util.removeClass(modalimport, 'disp_none');
+ $A.util.removeClass(modalimportbg,'disp_none');
+ },
+
+ close_import : function(component){
+ var modalimport = component.find('modal_import');
+ var modalimportbg = component.find('modal_importbg');
+ $A.util.addClass(modalimport, 'disp_none');
+ $A.util.addClass(modalimportbg,'disp_none');
+ },
+
+ close_export : function(component){
+ var modalimport = component.find('modal_export');
+ var modalimportbg = component.find('modal_exportbg');
+ $A.util.addClass(modalimport, 'disp_none');
+ $A.util.addClass(modalimportbg,'disp_none');
+ },
+
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+ CallBackAction : function(component,action_name,para,callback) {
+ var action = component.get("c." + action_name.trimStart().replace("c.",""));
+ if(para){
+ action.setParams(para);
}
- csv += val;
- }
- csv += "\n";
- }
- return csv;
- },
+ if(callback){
+ action.setCallback(this,function(data){
+ callback(data);
+ });
+ }
+
+ $A.enqueueAction(action);
+ },
+ //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
- downloadCSV: function (component, csv) {
- var link = document.createElement("a");
- // 璁剧疆瀛楃闆嗗拰鏂囦欢澶�
- var bom = "\uFEFF";
- link.href = "data:text/csv;charset=utf-8," + encodeURIComponent(bom + csv);
- link.download = "data.csv";
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- }
- //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 end
+ //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 start
+ exportErrorInfoHelper: function (component) {
+ var errorData = component.get('v.errorData');
+ var errorColumns = component.get('v.errorColumns');
- // searchAgencyContact : function(res) {
- // var agencyContacts = [];
- // for (let idx = 0; idx < res.length; idx++) {
- // agencyContacts.push(res[idx].awsid);
- // }
- // var action = component.get('c.getAWStoken');
- // action.setCallback(this,function(response){
- // var state = response.getState();
- // console.log('state : ' + state);
- // if(state === 'SUCCESS') {
- // console.log('get name : ' + action.getName());
- // }
- // else if(state === 'INCOMPLETE') {
- // console.log('incomplete state');
- // } else if(state === 'ERROR') {
- // if (errors) {
- // if (errors[0] && errors[0].message) {
- // console.log("Error message: " +
- // errors[0].message);
- // }
- // } else {
- // console.log("Unknown error");
- // }
- // }
- // });
- // $A.enqueueAction(action);
- // // var requestSearchPayload = new Map();
- // // requestSearchPayload.set("dataIds",agencyContacts);
- // var data = '{"dataIds": ["944233643042144256", "943645353649897473"]}';
- // var token = 'eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNjQ0NzY4MTIwNjc2LCJhcHBpZCI6IjZMeml6Y1JmN2g4eUx4MjgiLCJleHAiOjE2NDk5NTIxMjB9.6vORDP8BRaf_beCt4SEXrl3DEuYZ3owotkUqh27r8YhfmKDDWrv_NpVVpjTPeFjvzlQqaJMcFobZeAmPxpmq2A';
- // var searchUrl = 'https://52.83.101.205/api/agencycontact/search';
- // var data = this.search(searchUrl,data,token);
- // return data;searchUrl,requestSearchPayload,token
- // },
-});
+ var datas = [];
+ let errorColumnsArray = [];
+ for(var i in errorColumns){
+ errorColumnsArray.push(errorColumns[i].label);
+ }
+ datas.push(errorColumnsArray);
+ //datas.push(errorColumns);
+
+ for (var i in errorData) {
+ let data = [];
+ data.push(errorData[i].errorRow)
+ data.push(errorData[i].errorInfo)
+ for(var j = 0 ; j < Object.keys(errorData[i]).length - 2 ; j++){
+ data.push(errorData[i]['field' + j])
+ }
+ datas.push(data);
+ }
+
+ console.log('datas = ' + JSON.stringify(datas));
+ var csv = this.convertToCSV(component, datas);
+ console.log('csv = ' + JSON.stringify(csv))
+ this.downloadCSV(component, csv);
+ },
+
+ convertToCSV: function (component, data) {
+ console.log('enter convertToCSV')
+ console.log('data = ' + data);
+ var csv = '';
+ for (var i = 0; i < data.length; i++) {
+ var row = data[i];
+ console.log('row = ' + JSON.stringify(row));
+ for (var j = 0; j < row.length; j++) {
+ var val = '';
+ val = row[j] === null ? '' : row[j].toString();
+ console.log('val = ' + val);
+ if (val.indexOf(',') !== -1 || val.indexOf('"') !== -1 || val.indexOf('\n') !== -1) {
+ //val = '"' + val.replace(/"/g,'""') + '"';
+ }
+ if (j > 0) {
+ csv += ',';
+ }
+ csv += val;
+ }
+ csv += '\n';
+ }
+ return csv;
+ },
+
+ downloadCSV: function (component, csv) {
+ var link = document.createElement('a');
+ // 璁剧疆瀛楃闆嗗拰鏂囦欢澶�
+ var bom = "\uFEFF";
+ link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
+ link.download = 'data.csv';
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ },
+ //zhj 瀵煎嚭閿欒淇℃伅 2023-05-16 end
+
+ // searchAgencyContact : function(res) {
+ // var agencyContacts = [];
+ // for (let idx = 0; idx < res.length; idx++) {
+ // agencyContacts.push(res[idx].awsid);
+ // }
+ // var action = component.get('c.getAWStoken');
+ // action.setCallback(this,function(response){
+ // var state = response.getState();
+ // console.log('state : ' + state);
+ // if(state === 'SUCCESS') {
+ // console.log('get name : ' + action.getName());
+ // }
+ // else if(state === 'INCOMPLETE') {
+ // console.log('incomplete state');
+ // } else if(state === 'ERROR') {
+ // if (errors) {
+ // if (errors[0] && errors[0].message) {
+ // console.log("Error message: " +
+ // errors[0].message);
+ // }
+ // } else {
+ // console.log("Unknown error");
+ // }
+ // }
+ // });
+ // $A.enqueueAction(action);
+ // // var requestSearchPayload = new Map();
+ // // requestSearchPayload.set("dataIds",agencyContacts);
+ // var data = '{"dataIds": ["944233643042144256", "943645353649897473"]}';
+ // var token = 'eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNjQ0NzY4MTIwNjc2LCJhcHBpZCI6IjZMeml6Y1JmN2g4eUx4MjgiLCJleHAiOjE2NDk5NTIxMjB9.6vORDP8BRaf_beCt4SEXrl3DEuYZ3owotkUqh27r8YhfmKDDWrv_NpVVpjTPeFjvzlQqaJMcFobZeAmPxpmq2A';
+ // var searchUrl = 'https://52.83.101.205/api/agencycontact/search';
+ // var data = this.search(searchUrl,data,token);
+ // return data;searchUrl,requestSearchPayload,token
+ // },
+})
\ No newline at end of file
diff --git a/force-app/main/default/classes/ArriveGoodsController.cls b/force-app/main/default/classes/ArriveGoodsController.cls
index 8e2988f..190bd57 100644
--- a/force-app/main/default/classes/ArriveGoodsController.cls
+++ b/force-app/main/default/classes/ArriveGoodsController.cls
@@ -1,437 +1,379 @@
public without sharing class ArriveGoodsController {
- public String barcode { get; set; }
- public Consumable_order__c coc { get; set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
- public List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
- public List<ConsumableorderdetailsInfo> detailsSummary { get; set; }
- public List<ConsumableorderdetailsInfo> consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
- //鏇存柊鏄庣粏鍙栨秷鏃堕棿
- public List<Consumable_order_details2__c> consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- Map<String, Consumable_order_details2__c> orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- public List<Consumable_order_details2__c> consumableorderdetails2Insert = new List<Consumable_order_details2__c>();
- public List<Consumable_order_details2__c> consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
- public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror {
- get;
- set;
- }
- public transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy {
- get;
- set;
- }
- public List<ConsumableorderdetailsInfo> ShowGoodsofReturnList { get; set; }
- public List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList {
- get;
- set;
- }
- //add by rentx 20210602 CHAN-C3K4ZQ
- public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview {
- get;
- set;
- }
- //add by rentx 20210602 CHAN-C3K4ZQ
+ public String barcode { get; set; }
+ public Consumable_order__c coc { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
+ public List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
+ public List<ConsumableorderdetailsInfo> detailsSummary { get; set; }
+ public List<ConsumableorderdetailsInfo> consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+ //鏇存柊鏄庣粏鍙栨秷鏃堕棿
+ public List<Consumable_order_details2__c> consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ Map<String,Consumable_order_details2__c> orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ public List<Consumable_order_details2__c> consumableorderdetails2Insert= new List<Consumable_order_details2__c>();
+ public List<Consumable_order_details2__c> consumableorderdetails2Nobox= new List<Consumable_order_details2__c>();
+ public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
+ public transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+ public List<ConsumableorderdetailsInfo> ShowGoodsofReturnList{get;set;}
+ public List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList{get;set;}
+ //add by rentx 20210602 CHAN-C3K4ZQ
+ public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
+ //add by rentx 20210602 CHAN-C3K4ZQ
- public List<String> GrList = new List<String>();
- //瓒呭嚭瀹氳揣鏁伴噺鐨勪骇鍝�
- public List<String> cancellationProList = new List<String>();
- //閿欒淇℃伅
- public String alertMessage { get; set; }
- public integer getinventorysize() {
- return consumableInventory.size();
- }
- public integer geterrorsize() {
- return ConsumableorderdetailsRecordserror.size();
- }
- Set<String> noboxBarcodeList = new Set<String>();
- public transient Map<String, String> ExistIdMap = new Map<String, String>();
- public transient Map<String, String> ErrorIdMap = new Map<String, String>();
- public transient Map<String, String> AllMap = new Map<String, String>();
- Map<String, String> otherAgencyMap = new Map<String, String>();
- public transient Map<String, String> barMcodeMap = new Map<String, String>();
- Map<String, Integer> BarcodeCntMap = new Map<String, Integer>();
- //qi
- public transient List<String> BarCodeListP = new List<String>();
+ public List<String> GrList = new List<String>();
+ //瓒呭嚭瀹氳揣鏁伴噺鐨勪骇鍝�
+ public List<String> cancellationProList = new List<String>();
+ //閿欒淇℃伅
+ public String alertMessage {set;get;}
+ public integer getinventorysize(){
+ return consumableInventory.size();
+ }
+ public integer geterrorsize(){
+ return ConsumableorderdetailsRecordserror.size();
+ }
+ Set<String> noboxBarcodeList = new Set<String>();
+ public transient Map<String, String> ExistIdMap = new Map<String, String>();
+ public transient Map<String, String> ErrorIdMap = new Map<String, String>();
+ public transient Map<String, String> AllMap = new Map<String, String>();
+ Map<String, String> otherAgencyMap = new Map<String, String>();
+ public transient Map<String, String> barMcodeMap = new Map<String, String>();
+ Map<String, Integer> BarcodeCntMap = new Map<String, Integer>();
+ //qi
+ public transient List<String> BarCodeListP = new List<String>();
- // public transient Map<String, String> OrderAllMap = new Map<String, String>();
- Map<String, Decimal> orderProductCunMap = new Map<String, Decimal>();
- Map<String, Decimal> orderProductArrivedCunMap = new Map<String, Decimal>();
- Map<String, Decimal> orderWantArriveCunMap = new Map<String, Decimal>();
- //瓒呭嚭鍨嬪彿鍜屾暟閲�
- Map<String, Decimal> overOrderCunMap = new Map<String, Decimal>();
- //瓒呭嚭BARCODE鍜屽瀷鍙�
- Map<String, List<String>> overOrderBARcodeCunMap = new Map<String, List<String>>();
- list<String> overOrderBARcodeTTTTTT = new List<String>();
+ // public transient Map<String, String> OrderAllMap = new Map<String, String>();
+ Map<String, Decimal> orderProductCunMap = new Map<String, Decimal>();
+ Map<String, Decimal> orderProductArrivedCunMap = new Map<String, Decimal>();
+ Map<String, Decimal> orderWantArriveCunMap = new Map<String, Decimal>();
+ //瓒呭嚭鍨嬪彿鍜屾暟閲�
+ Map<String, Decimal> overOrderCunMap = new Map<String, Decimal>();
+ //瓒呭嚭BARCODE鍜屽瀷鍙�
+ Map<String, List<String>> overOrderBARcodeCunMap = new Map<String, List<String>>();
+ list<String> overOrderBARcodeTTTTTT = new list<String>();
- //涓嶇鍚堢殑barcode鍜屽瀷鍙�
- Map<String, List<String>> notEqualBARcodeCunMap = new Map<String, List<String>>();
- list<String> overOrderBARcodeSSSSSS = new List<String>();
- list<String> productList = new List<String>();
- list<String> notInlist = new List<String>();
- //涓嶉�夋嫨璁㈠崟鏃朵繚瀛樿鍗旾D銆佷骇鍝佸瀷鍙风敤
- //List<String> orderId = new List<String>();
- //List<String> prodName = new List<String>();
- //搴撳瓨鐧诲綍浣跨敤
- list<String> notInStorelist = new List<String>();
- list<String> exitBarCodeList = new List<String>();
+ //涓嶇鍚堢殑barcode鍜屽瀷鍙�
+ Map<String, List<String>> notEqualBARcodeCunMap = new Map<String, List<String>>();
+ list<String> overOrderBARcodeSSSSSS = new list<String>();
+ list<String> productList = new list<String>();
+ list<String> notInlist = new list<String>();
+ //涓嶉�夋嫨璁㈠崟鏃朵繚瀛樿鍗旾D銆佷骇鍝佸瀷鍙风敤
+ //List<String> orderId = new List<String>();
+ //List<String> prodName = new List<String>();
+ //搴撳瓨鐧诲綍浣跨敤
+ list<String> notInStorelist = new list<String>();
+ list<String> exitBarCodeList = new list<String>();
- // Map<String, Consumable_order_details2__c> reallMap = new Map<String, Consumable_order_details2__c>();
- Map<String, String> HosErrorMap = new Map<String, String>();
- List<String> HosErrorList = new List<String>();
- public String baseUrl { get; private set; }
- public String ESetId { get; set; }
- public String arriveId = '';
- private String accountid = null;
- private String accountName = null;
- //public String[] proidList =new String[]{};
- public Decimal orderCountAll = 0;
- public Decimal orderCountNotarrive = 0;
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- public id return_Order_id = null;
- public id inventory_Order_id = null;
- public boolean ReturnFLGbln { get; set; }
- public boolean saveFLGbln { get; set; }
- public String ArrType { get; set; }
- // 鐧诲綍鑰呭伐浣滃湴
- private String userWorkLocation;
- //鐢ㄦ埛浜у搧鍖哄垎
- public String userPro_Typestr = null;
- public String userPro_Type = null;
- public String product_Type = null;
- public Boolean EngFlag = false;
- public Boolean ETFlag = false;
-
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- public Boolean isLwc = false;
- public String returnError;
- public List<String> warningList;
- public List<String> errorList;
- public String urlType;
-
- public ArriveGoodsController() {
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- ESetId = ApexPages.currentPage().getParameters().get('esetId');
- ArrType = ApexPages.currentPage().getParameters().get('ArrType');
- ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
- consumableInventory = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
- consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
- consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
- orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
- detailsSummary = new List<ConsumableorderdetailsInfo>();
- saveFLGbln = false;
- //overOrderBARcodeTTTTTT.add('');
- //add by rentx 20210602 CHAN-C3K4ZQ start
- consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
- //add by rentx 20210602 CHAN-C3K4ZQ end
- // OrderAllMap = new Map<String, String>();
- }
-
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- public ArriveGoodsController(String eSetId, String arrType) {
- this.ESetId = eSetId;
- this.ArrType = arrType;
- ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
- consumableInventory = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
- consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
- consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
- orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
- detailsSummary = new List<ConsumableorderdetailsInfo>();
- saveFLGbln = false;
- consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
- noboxBarcodeList = new Set<String>();
+ // Map<String, Consumable_order_details2__c> reallMap = new Map<String, Consumable_order_details2__c>();
+ Map<String,String> HosErrorMap = new Map<String,String>();
+ List<String> HosErrorList = new List<String>();
+ public String baseUrl {get;private set;}
+ public String ESetId { get; set; }
+ public String arriveId = '';
+ private String accountid = null;
+ private String accountName = null;
+ //public String[] proidList =new String[]{};
+ public Decimal orderCountAll = 0;
+ public Decimal orderCountNotarrive = 0;
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- warningList = new List<String>();
- errorList = new List<String>();
- returnError = null;
- urlType = null;
- }
+ public id return_Order_id = null;
+ public id inventory_Order_id = null;
+ public boolean ReturnFLGbln {get;set;}
+ public boolean saveFLGbln {get;set;}
+ public String ArrType{get;set;}
+ // 鐧诲綍鑰呭伐浣滃湴
+ private String userWorkLocation;
- //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�1000 * 1000
- public void makeRecordsView(List<ConsumableorderdetailsInfo> recordsdummy) {
- consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ //鐢ㄦ埛浜у搧鍖哄垎
+ public String userPro_Typestr = null;
+ public String userPro_Type = null;
+ public String product_Type = null;
+ public Boolean EngFlag = false;
+ public Boolean ETFlag = false;
- if (recordsdummy.size() > 1000) {
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsInfo c = null;
- ConsumableorderdetailsRecordsbreak.clear();
- ConsumableorderdetailsRecordsbreakover.clear();
- consumableorderdetailsRecordsview.clear();
- //閫夋嫨浜у搧view
- ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
- if (recordsdummy.size() > 1000) {
- for (Integer i = 0; i < recordsdummy.size(); i++) {
- if (i < 1000) {
- c = recordsdummy.get(i);
- ConsumableorderdetailsRecordsbreak.add(c);
- } else {
- c = recordsdummy.get(i);
- ConsumableorderdetailsRecordsbreakover.add(c);
- }
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ public Boolean isLwc = false;
+ public String returnError;
+ public List<String> warningList;
+ public List<String> errorList;
+ public String urlType;
+
+ public ArriveGoodsController(){
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ESetId = ApexPages.currentPage().getParameters().get('esetId');
+ ArrType = ApexPages.currentPage().getParameters().get('ArrType');
+ ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
+ consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+ orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+ detailsSummary = new List<ConsumableorderdetailsInfo>();
+ saveFLGbln = FALSE;
+ //overOrderBARcodeTTTTTT.add('');
+ //add by rentx 20210602 CHAN-C3K4ZQ start
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ //add by rentx 20210602 CHAN-C3K4ZQ end
+ // OrderAllMap = new Map<String, String>();
+ }
+
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ public ArriveGoodsController(String eSetId, String arrType){
+ this.ESetId = eSetId;
+ this.ArrType = arrType;
+ ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
+ consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+ orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+ detailsSummary = new List<ConsumableorderdetailsInfo>();
+ saveFLGbln = FALSE;
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ noboxBarcodeList = new Set<String>();
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ warningList = new List<String>();
+ errorList = new List<String>();
+ returnError = null;
+ urlType = null;
+ }
+
+ //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�1000 * 1000
+ public void makeRecordsView(List<ConsumableorderdetailsInfo> recordsdummy){
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+
+ if(recordsdummy.size() > 1000){
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsInfo c = null;
+ ConsumableorderdetailsRecordsbreak.clear();
+ ConsumableorderdetailsRecordsbreakover.clear();
+ consumableorderdetailsRecordsview.clear();
+ //閫夋嫨浜у搧view
+ ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ if(recordsdummy.size() > 1000){
+ for(Integer i = 0; i < recordsdummy.size(); i++){
+ if(i < 1000){
+ c = recordsdummy.get(i);
+ ConsumableorderdetailsRecordsbreak.add(c);
+ }else{
+ c = recordsdummy.get(i);
+ ConsumableorderdetailsRecordsbreakover.add(c);
+ }
+ }
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
+ }else{
+ consumableorderdetailsRecordsview.add(recordsdummy);
+ }
+
+ // Integer count = recordsdummy.size() / 1000;
+ // Integer last = recordsdummy.size() - (1000*count);
+
+ // for(Integer i = 0; i < count ; i++){
+ // List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
+ // for(Integer j=0; j < 1000; j++){
+ // tempList.add(recordsdummy.get(i * count + j ));
+ // // itemList.add(resList.get(i*count+j));
+ // }
+ // consumableorderdetailsRecordsview.add(tempList);
+ // }
+ // if (last > 0) {
+ // List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
+ // for(Integer j=0; j < last; j++){
+ // tempList.add(recordsdummy.get(count * 1000 + j ));
+ // // itemList.add(resList.get(i*count+j));
+ // }
+ // consumableorderdetailsRecordsview.add(tempList);
+ // }
+ }else{
+ consumableorderdetailsRecordsview.add(recordsdummy);
}
- consumableorderdetailsRecordsview.add(
- ConsumableorderdetailsRecordsbreak
- );
- consumableorderdetailsRecordsview.add(
- ConsumableorderdetailsRecordsbreakover
- );
- } else {
- consumableorderdetailsRecordsview.add(recordsdummy);
- }
-
- // Integer count = recordsdummy.size() / 1000;
- // Integer last = recordsdummy.size() - (1000*count);
-
- // for(Integer i = 0; i < count ; i++){
- // List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
- // for(Integer j=0; j < 1000; j++){
- // tempList.add(recordsdummy.get(i * count + j ));
- // // itemList.add(resList.get(i*count+j));
- // }
- // consumableorderdetailsRecordsview.add(tempList);
- // }
- // if (last > 0) {
- // List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
- // for(Integer j=0; j < last; j++){
- // tempList.add(recordsdummy.get(count * 1000 + j ));
- // // itemList.add(resList.get(i*count+j));
- // }
- // consumableorderdetailsRecordsview.add(tempList);
- // }
- } else {
- consumableorderdetailsRecordsview.add(recordsdummy);
}
- }
- //add by rentx 20210602 CHAN-C3K4ZQ end
- public void init() {
- // String userId = '00510000007cthP';
- String userId = UserInfo.getUserId();
- List<user> Useracc = new List<user>();
- Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc[0].accountid;
- //--------AddStart-----XHL--------------20181008-------------
- userPro_Type = Useracc[0].UserPro_Type__c;
- if (String.isBlank(userPro_Type)) {
- userPro_Type = 'ET';
- }
-
- if (userPro_Type == 'ENG') {
- product_Type = 'ET';
- EngFlag = true;
- } else {
- product_Type = 'ENG';
- ETFlag = true;
- }
- userPro_Typestr = '%' + userPro_Type + '%';
- //--------AddEnd-----XHL--------------20181008-------------
- userWorkLocation = Useracc[0].Work_Location__c;
- system.debug('userWorkLocation' + userWorkLocation);
- List<account> accountInfo = [
- SELECT Name
- FROM account
- WHERE id = :accountid
- ];
- accountName = accountInfo[0].Name;
- system.debug('accountName' + accountName);
- coc = new Consumable_order__c();
- if (ArrType == 'ReG') {
- ReturnFLGbln = true;
- } else {
- ReturnFLGbln = false;
- }
- if (ESetId != '' && ESetId != null) {
- List<Consumable_order__c> qs = new List<Consumable_order__c>();
- List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
- List<Consumable_Orderdetails__c> reSet = new List<Consumable_Orderdetails__c>();
- qs = [
- SELECT
- Id,
- Name,
- Order_status__c,
- Dealer_Info__c,
- Deliver_date__c,
- ReturnGs_Upload_Date__c,
- Order_Reason__c,
- Order_date__c,
- Contract_application_decision__c,
- Order_type__c,
- Total_num__c,
- OrderNumber_arrived__c,
- Delivery_detail_count__c,
- OrderNumber_notarrive__c,
- orderPattern__c
- FROM Consumable_order__c
- WHERE
- Id = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- AND Dealer_Info__c = :accountid
- ];
- if (qs.size() > 0) {
- coc = qs[0];
- orderCountAll = coc.Total_num__c;
- orderCountNotarrive = coc.OrderNumber_notarrive__c;
- }
- //浜у搧瀹氳揣鏁伴噺
- reSet = [
- SELECT Asset_Model_No__c, Consumable_order__c, Consumable_count__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- ];
- for (Integer i = 0; i < reSet.size(); i++) {
- productList.add(reSet[i].Asset_Model_No__c);
- orderProductCunMap.put(
- reSet[i].Asset_Model_No__c,
- reSet[i].Consumable_count__c
- );
- orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c, 0);
- orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c, 0);
- overOrderCunMap.put(reSet[i].Asset_Model_No__c, 0);
- overOrderBARcodeCunMap.put(
- reSet[i].Asset_Model_No__c,
- overOrderBARcodeTTTTTT
- );
- //overOrderCunMap.put(reSet[i].Asset_Model_No__c,0);
- }
- //
- reSet1 = [
- 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,
- Box_Piece__c,
- Rrturn_count__c,
- ProductPacking_list_manual__c,
- Report_Product_Approbation__c,
- Report_Product_Expiration__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c1*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Consumable_order_minor__c = :ESetId
- AND Dealer_Arrive__c = TRUE
- AND Box_Piece__c != '涓�'
- ];
- for (Integer i = 0; i < reSet1.size(); i++) {
- // OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
- //init鐨勬椂鍊欎笉灞曠ず宸茬粡鍏ュ簱鐨勬槑缁� by rentx 20210617 CHAN-C3K4ZQ
- // ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
- //update by rentx 20210617 end CHAN-C3K4ZQ
- if (
- orderProductArrivedCunMap.containsKey(reSet1[i].Asset_Model_No__c)
- ) {
- orderProductArrivedCunMap.put(
- reSet1[i].Asset_Model_No__c,
- orderProductArrivedCunMap.get(reSet1[i].Asset_Model_No__c) + 1
- );
+ //add by rentx 20210602 CHAN-C3K4ZQ end
+ public void init() {
+ // String userId = '00510000007cthP';
+ String userId = UserInfo.getUserId();
+ List<user> Useracc = New List<user>();
+ Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
+ accountid = Useracc[0].accountid;
+ //--------AddStart-----XHL--------------20181008-------------
+ userPro_Type = Useracc[0].UserPro_Type__c;
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
}
- }
- //add by rentx 20210602 start CHAN-C3K4ZQ
- // makeRecordsView(ConsumableorderdetailsRecordsdummy);
- //add by rentx 20210602 end CHAN-C3K4ZQ
- }
- }
- //========20160311======ADD_Start================================
- // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
- //========20160311======ADD_Start================================
- public List<String> ParseBarCode(String Code) {
- String[] Cache = new List<String>{};
- Cache = Code.split('\n');
- Set<String> Buff = new Set<String>();
- for (String A : Cache) {
- Buff.add(A.toUpperCase());
- }
- List<String> outPut = new List<String>();
- for (String B : Buff) {
- B = B.trim();
- if (B.length() > 8) {
- String tracingCode = B.substring(B.length() - 5, B.length());
- barMcodeMap.put(B, tracingCode);
- }
- outPut.add(B);
- }
- system.debug('barMcodeMap绛変簬' + barMcodeMap);
- return outPut;
- }
- //========20160311======ADD_End==================================
- //鑾峰彇鏄庣粏
- public void SearchPro() {
- //浠庝笅杈圭Щ涓婃潵 by Link 2023-5-23
- if (barcode == null || barcode.trim() == '') {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = '璇疯緭鍏arCode鍙�';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(ApexPages.severity.INFO, '璇疯緭鍏arCode鍙枫��')
- );
- }
- return;
+ if(userPro_Type == 'ENG'){
+ product_Type = 'ET';
+ EngFlag = true;
+ }else{
+ product_Type = 'ENG';
+ ETFlag = true;
+ }
+ userPro_Typestr = '%' + userPro_Type + '%';
+ //--------AddEnd-----XHL--------------20181008-------------
+ userWorkLocation = Useracc[0].Work_Location__c;
+ system.debug('userWorkLocation'+ userWorkLocation);
+ List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
+ accountName = accountInfo[0].Name;
+ system.debug('accountName'+ accountName);
+ coc = new Consumable_order__c();
+ if(ArrType=='ReG'){
+ ReturnFLGbln = true;
+ }else{
+ ReturnFLGbln = false;
+ }
+ if(ESetId != '' && ESetId !=null){
+ List<Consumable_order__c> qs = New List<Consumable_order__c>();
+ List<Consumable_order_details2__c> reSet1 = New List<Consumable_order_details2__c>();
+ List<Consumable_Orderdetails__c> reSet = New List<Consumable_Orderdetails__c>();
+ qs = [SELECT Id,Name,Order_status__c,Dealer_Info__c,Deliver_date__c,ReturnGs_Upload_Date__c,
+ Order_Reason__c,Order_date__c,
+ Contract_application_decision__c,Order_type__c,Total_num__c,
+ OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,orderPattern__c
+ FROM Consumable_order__c
+ WHERE Id =:ESetId AND Order_Owner_WorkLocal__c =: userWorkLocation
+ AND Dealer_Info__c = :accountid];
+ if (qs.size()>0){
+ coc = qs[0];
+ orderCountAll = coc.Total_num__c;
+ orderCountNotarrive = coc.OrderNumber_notarrive__c;
+ }
+ //浜у搧瀹氳揣鏁伴噺
+ reSet = [SELECT Asset_Model_No__c,
+ Consumable_order__c,
+ Consumable_count__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c =: userWorkLocation];
+ for (Integer i = 0; i < reSet.size(); i++) {
+ productList.add(reSet[i].Asset_Model_No__c);
+ orderProductCunMap.put(reSet[i].Asset_Model_No__c,reSet[i].Consumable_count__c);
+ orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c,0);
+ orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c,0);
+ overOrderCunMap.put(reSet[i].Asset_Model_No__c,0);
+ overOrderBARcodeCunMap.put(reSet[i].Asset_Model_No__c,overOrderBARcodeTTTTTT);
+ //overOrderCunMap.put(reSet[i].Asset_Model_No__c,0);
+ }
+ //
+ reSet1 = [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,
+ Box_Piece__c,
+ Rrturn_count__c,
+ ProductPacking_list_manual__c,
+ Report_Product_Approbation__c,
+ Report_Product_Expiration__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c1*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Arrive_Owner_Work_Location__c = : userWorkLocation
+ AND Consumable_order_minor__c = :ESetId
+ AND Dealer_Arrive__c = true
+ AND Box_Piece__c != '涓�' ];
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ // OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ //init鐨勬椂鍊欎笉灞曠ず宸茬粡鍏ュ簱鐨勬槑缁� by rentx 20210617 CHAN-C3K4ZQ
+ // ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
+ //update by rentx 20210617 end CHAN-C3K4ZQ
+ if(orderProductArrivedCunMap.containsKey(reSet1[i].Asset_Model_No__c)){
+ orderProductArrivedCunMap.put(reSet1[i].Asset_Model_No__c,orderProductArrivedCunMap.get(reSet1[i].Asset_Model_No__c)+1);
+ }
+ }
+ //add by rentx 20210602 start CHAN-C3K4ZQ
+ // makeRecordsView(ConsumableorderdetailsRecordsdummy);
+ //add by rentx 20210602 end CHAN-C3K4ZQ
+ }
}
- notInlist = new List<String>();
- otherAgencyMap = new Map<String, String>();
- barMcodeMap = new Map<String, String>();
- consumableInventory = new List<ConsumableorderdetailsInfo>();
- consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
- consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
- orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
- //update by Link 20230428
- if (isLwc) {
- noboxBarcodeList = new Set<String>();
+ //========20160311======ADD_Start================================
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ //========20160311======ADD_Start================================
+ public List<String> ParseBarCode(String Code){
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ Set <String> Buff = new Set<String>();
+ for(String A : Cache){
+ Buff.add(A.toUpperCase());
+ }
+ List<String> outPut = new List<String>();
+ for(String B :Buff){
+ B = B.trim();
+ if(B.length() > 8){
+ String tracingCode = B.substring(B.length() - 5,B.length());
+ barMcodeMap.put(B,tracingCode);
+ }
+ outPut.add(B);
+ }system.debug('barMcodeMap绛変簬'+barMcodeMap);
+ return outPut;
}
- //add by rentx 2021-01-27 start
- HosErrorList = new List<String>();
- HosErrorMap = new Map<String, String>();
- //add by rentx 2021-01-27 end
- noboxBarcodeList.clear();
- //鍐嶆绱㈤」鐩竻绌�
- ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- ErrorIdMap = new Map<String, String>();
- ErrorIdMap.clear();
- AllMap = new Map<String, String>();
- AllMap.clear();
- ExistIdMap = new Map<String, String>();
- ExistIdMap.clear();
- consumableorderdetails2Insert = new List<Consumable_order_details2__c>();
- ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
- /*if(EsetId != null && EsetId != ''){
+
+ //========20160311======ADD_End==================================
+ //鑾峰彇鏄庣粏
+ public void SearchPro() {
+ //浠庝笅杈圭Щ涓婃潵 by Link 2023-5-23
+ if(barcode == null || barcode.trim() ==''){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = '璇疯緭鍏arCode鍙�';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+ }
+ return;
+ }
+ notInlist = new list<String>();
+ otherAgencyMap = new Map<String, String>();
+ barMcodeMap = new Map<String, String>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+ orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+ //update by Link 20230428
+ if(isLwc){
+ noboxBarcodeList = new Set<String>();
+ }
+ //add by rentx 2021-01-27 start
+ HosErrorList = new List<String>();
+ HosErrorMap = new Map<String,String>();
+ //add by rentx 2021-01-27 end
+
+ noboxBarcodeList.clear();
+ //鍐嶆绱㈤」鐩竻绌�
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ErrorIdMap = new Map<String, String>();
+ ErrorIdMap.clear();
+ AllMap = new Map<String, String>();
+ AllMap.clear();
+ ExistIdMap = new Map<String, String>();
+ ExistIdMap.clear();
+ consumableorderdetails2Insert = new List<Consumable_order_details2__c>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ /*if(EsetId != null && EsetId != ''){
List<Consumable_order_details2__c> reSet1 = [SELECT Id,
Name,
Intra_Trade_List_RMB__c,
@@ -478,4129 +420,2478 @@
//}
}
}*/
- ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- BarCodeListP = new List<String>();
- BarCodeListP = ParseBarCode(barcode);
- Consumable_order_details2__c p = new Consumable_order_details2__c();
- List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
- //绉诲埌鏈�涓婅竟 by Link 2023-5-23
- // if(barcode == null || barcode.trim() ==''){
- // //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- // if(isLwc){
- // returnError = '璇疯緭鍏arCode鍙�';
- // }else {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
- // }
- // return;
- // }
- //瀵规瘮鍏ㄩ儴搴撳瓨涓槸鍚﹀瓨鍦ㄧ鐞嗙紪鐮佷竴鏍凤紝barcode鍙蜂笉涓�鏍风殑浜у搧
- reSet1 = [
- SELECT Id, Name, TracingCode__c, Bar_Code__c, Report_Product_Expiration__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 TracingCode__c IN :barMcodeMap.values()
- AND Bar_Code__c NOT IN :barMcodeMap.keySet()
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- for (String str : barMcodeMap.keySet()) {
- if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- str +
- ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- str +
- ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'
- )
- );
+ ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ BarCodeListP = new List<String>();
+ BarCodeListP = ParseBarCode(barcode);
+ Consumable_order_details2__c p = new Consumable_order_details2__c();
+ List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+ //绉诲埌鏈�涓婅竟 by Link 2023-5-23
+ // if(barcode == null || barcode.trim() ==''){
+ // //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ // if(isLwc){
+ // returnError = '璇疯緭鍏arCode鍙�';
+ // }else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+ // }
+ // return;
+ // }
+ //瀵规瘮鍏ㄩ儴搴撳瓨涓槸鍚﹀瓨鍦ㄧ鐞嗙紪鐮佷竴鏍凤紝barcode鍙蜂笉涓�鏍风殑浜у搧
+ reSet1 = [SELECT Id, Name,TracingCode__c,Bar_Code__c,Report_Product_Expiration__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 TracingCode__c in :barMcodeMap.values()
+ AND Bar_Code__c not in :barMcodeMap.keySet()
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ for(String str : barMcodeMap.keySet()){
+ if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add(str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'));
+ }
+ ErrorIdMap.put(str,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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ TracingCode__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ //AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND (TracingCode__c = null
+ OR TracingCode__c = '')
+ ORDER BY Name ];
+
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍏ュ簱';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '绠$悊缂栫爜涓虹┖鐨勪骇鍝� ' + ErrorIdMap));
+ //鏁翠綋鍒拌揣
+ System.debug('EsetId===>'+EsetId);
+ System.debug('ArrType===>'+ArrType);
+ if(EsetId == null || EsetId == ''){
+ if(ArrType!='ReG'){
+ //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+ reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ Product_Type__c
+ ,ContractNo_text__c/*,ContractNo__c1*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ FROM Consumable_order_details2__c
+ WHERE Bar_Code__c in :BarCodeListP
+ AND ( not Product_Type__c like :userPro_Typestr)
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != null
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR Consumable_order_minor__c = null)
+ ORDER BY Name ];
+
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ System.debug('reSet1===>'+reSet1);
+ //add by Wang Xueqin
+ //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+ reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ Product_Type__c
+ ,ContractNo_text__c
+ ,Consumable_order_minor__r.ContractNo__c
+ FROM Consumable_order_details2__c
+ WHERE Bar_Code__c in :BarCodeListP
+ AND ( not Product_Type__c like :userPro_Typestr)
+ ];
+
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
}
- ErrorIdMap.put(str, 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,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- TracingCode__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- //AND Arrive_Owner_Work_Location__c =: userWorkLocation
- AND (TracingCode__c = NULL
- OR TracingCode__c = '')
- ORDER BY Name
- ];
-
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍏ュ簱';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '绠$悊缂栫爜涓虹┖鐨勪骇鍝� ' + ErrorIdMap));
- //鏁翠綋鍒拌揣
- System.debug('EsetId===>' + EsetId);
- System.debug('ArrType===>' + ArrType);
- if (EsetId == null || EsetId == '') {
- if (ArrType != 'ReG') {
- //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
- reSet1 = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- Product_Type__c,
- ContractNo_text__c /*,ContractNo__c1*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :BarCodeListP
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- AND Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR Consumable_order_minor__c = NULL)
- ORDER BY Name
- ];
-
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '浜у搧绫诲瀷[' +
- reSet1[i].Product_Type__c +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- System.debug('reSet1===>' + reSet1);
- //add by Wang Xueqin
- //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
- reSet1 = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- Product_Type__c,
- ContractNo_text__c,
- Consumable_order_minor__r.ContractNo__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :BarCodeListP
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- ];
-
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '浜у搧绫诲瀷[' +
- reSet1[i].Product_Type__c +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- System.debug('reSet1===>1' + reSet1);
+ System.debug('reSet1===>1'+reSet1);
//end
- //閿�鍞骇鍝�
- 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,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- OwnerId,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Saled__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND (Arrive_Owner_Work_Location__c = :userWorkLocation
- OR OwnerId = :System.Label.User_OlympusSystem)
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '';
- if (reSet1[i].OwnerId == System.Label.User_OlympusSystem) {
- str = '璇ュ晢鍝佹槸鐩撮攢浜у搧璇峰厛杩斿搧';
- } else {
- str = '璇ュ晢鍝佸凡缁忛攢鍞�';
- }
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //鍑哄簱浜у搧
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Shipment__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //宸插埌璐т骇鍝�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Lose_Flag__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓埌璐�';
- if (reSet1[i].Lose_Flag__c == true) {
- str = '璇ュ晢鍝佸凡缁忎涪澶�';
- }
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //宸叉媶鐩掍骇鍝�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Bar_Code__c IN :BarCodeListP
- AND (Dealer_Info_text__c != :accountName
- OR (Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation))
- AND Box_Piece__c = '涓�'
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '宸叉媶鐩掔殑浜у搧涓嶈兘鍏ュ簱';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
-
- // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Arrive_Owner_Work_Location__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Box_Piece__c,
- Deliver_date__c,
- Bar_Code__c,
- TracingCode__c,
- Dealer_Info_text__c,
- OwnerId,
- Lose_Flag__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- SerialLotNo__c,
- Dealer_Arrive__c,
- Consumable_Arrived_order__r.Dealer_Info__c,
- Consumable_Arrived_order__r.Dealer_Info__r.Name,
- Intra_Trade_List_RMB__c,
- Dealer_Shipment__c,
- Dealer_Saled__c,
- Consumable_Product__r.Asset_Model_No__c,
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- SummonsForDirction_det__c,
- Transfer_Time__c,
- Frist_Transfer_Agency__c,
- Agency_Transfer__c,
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
-
- //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
- ContractNo_text__c /*,ContractNo__c */,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- //add by rentx 2020-10-13 end
- //add by rentx 2021-03-22 start
- hospitalSpecialOffer__c,
- exchangeOutPattern__c,
- Report_Product_Expiration__c
- //add by rentx 2021-03-22 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 Cancellation_Flag__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- //AND (Dealer_Shipment__c = FALSE
- // OR (Dealer_Shipment__c = TRUE
- // AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣'))
- AND (Dealer_Info_text__c != :accountName
- OR (Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation))
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- ORDER BY Bar_Code__c, Transfer_Time__c DESC
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- if (otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)) {
- continue;
- } else {
- //鍏朵粬缁忛攢鍟嗗嚭搴撲骇鍝佸彲浠ュ叆搴�
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(reSet1[i].Bar_Code__c);
- barcodedetList.add(
- String.valueOf(reSet1[i].Sterilization_limit__c)
- );
- barcodedetList.add(reSet1[i].SerialLotNo__c);
- barcodedetList.add(reSet1[i].TracingCode__c);
- if (reSet1[i].Lose_Flag__c == false) {
- //&& reSet1[i].Dealer_Info_text__c == accountName
- consumableorderdetails2Cancle.add(reSet1[i]);
+ //閿�鍞骇鍝�
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,OwnerId,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Saled__c = true
+ AND Dealer_Returned__c = false
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND (Arrive_Owner_Work_Location__c =: userWorkLocation
+ OR OwnerId = :System.Label.User_OlympusSystem)
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '';
+ if (reSet1[i].OwnerId == System.Label.User_OlympusSystem) {
+ str = '璇ュ晢鍝佹槸鐩撮攢浜у搧璇峰厛杩斿搧';
+ }else{
+ str = '璇ュ晢鍝佸凡缁忛攢鍞�';
+ }
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+
+ }
+ }
}
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- if (
- reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' &&
- !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
+ //鍑哄簱浜у搧
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Shipment__c = true
+ AND Dealer_Returned__c = false
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- consumableInventory.add(
- new ConsumableorderdetailsInfo(reSet1[i], barcodedetList)
- );
- Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
-
- codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- codsIns.Intra_Trade_List_RMB__c = reSet1[i]
- .Intra_Trade_List_RMB__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
- codsIns.Direct_Arrive_Product__c = true;
- codsIns.Sterilization_limit__c = reSet1[i]
- .Sterilization_limit__c;
- codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
- codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
- codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
- codsIns.TracingCode__c = reSet1[i].TracingCode__c;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c == null
- ? 1
- : reSet1[i].Transfer_Time__c;
- codsIns.Frist_Transfer_Agency__c = reSet1[i]
- .Frist_Transfer_Agency__c == null
- ? reSet1[i].Dealer_Info_text__c
- : reSet1[i].Frist_Transfer_Agency__c;
- codsIns.Agency_Transfer__c = true;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
- codsIns.Frist_Storage_Agency__c = reSet1[i]
- .Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
-
- //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,璁板綍SAP鍚堝悓鍙�
- // update tcm start
- if (
- String.isBlank(
- reSet1[i].Consumable_order_minor__r.ContractNo__c
- )
- ) {
- codsIns.ContractNo_text__c = reSet1[i].ContractNo_text__c;
- } else {
- codsIns.ContractNo_text__c = reSet1[i]
- .Consumable_order_minor__r.ContractNo__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,Lose_Flag__c,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Returned__c = false
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忓埌璐�';
+ if (reSet1[i].Lose_Flag__c == TRUE) {
+ str = '璇ュ晢鍝佸凡缁忎涪澶�';
+ }
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- // update tcm end
- //add by rentx 2020-10-13 end
- //add by rentx 2021-03-22 start
- // if (reSet1[i].Lose_Flag__c == true){
- if (
- reSet1[i].hospitalSpecialOffer__c == true &&
- reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'
- ) {
- codsIns.exchangeOutPattern__c = true;
+ //宸叉媶鐩掍骇鍝�
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Bar_Code__c in :BarCodeListP
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c !=: userWorkLocation))
+ AND Box_Piece__c = '涓�'
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '宸叉媶鐩掔殑浜у搧涓嶈兘鍏ュ簱';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- //add by rentx 2021-03-22 end
- consumableorderdetails2Insert.add(codsIns);
- otherAgencyMap.put(
- reSet1[i].Bar_Code__c,
- reSet1[i].Bar_Code__c
- );
- //String str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
- //ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- //ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
- }
+ // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,Asset_Model_No__c, Arrive_Owner_Work_Location__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,Box_Piece__c,
+ Deliver_date__c,Bar_Code__c,TracingCode__c, Dealer_Info_text__c, OwnerId, Lose_Flag__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,SerialLotNo__c, Dealer_Arrive__c,
+ Consumable_Arrived_order__r.Dealer_Info__c, Consumable_Arrived_order__r.Dealer_Info__r.Name,
+ Intra_Trade_List_RMB__c, Dealer_Shipment__c, Dealer_Saled__c,Consumable_Product__r.Asset_Model_No__c
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ ,SummonsForDirction_det__c,Transfer_Time__c,Frist_Transfer_Agency__c,Agency_Transfer__c
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
+ ,Agencyinfo_fromSAP__c,Frist_Storage_Agency__c
+ // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
+
+ //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+ ,ContractNo_text__c/*,ContractNo__c */
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-13 end
+ //add by rentx 2021-03-22 start
+ ,hospitalSpecialOffer__c
+ ,exchangeOutPattern__c
+ ,Report_Product_Expiration__c
+ //add by rentx 2021-03-22 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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c in :BarCodeListP
+ //AND (Dealer_Shipment__c = FALSE
+ // OR (Dealer_Shipment__c = TRUE
+ // AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣'))
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ )
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ order by Bar_Code__c, Transfer_Time__c desc
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ if(otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)){
+ continue;
+ }else{
+ //鍏朵粬缁忛攢鍟嗗嚭搴撲骇鍝佸彲浠ュ叆搴�
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(reSet1[i].Bar_Code__c);
+ barcodedetList.add(String.valueOf(reSet1[i].Sterilization_limit__c));
+ barcodedetList.add(reSet1[i].SerialLotNo__c);
+ barcodedetList.add(reSet1[i].TracingCode__c);
+ if (reSet1[i].Lose_Flag__c == false
+ //&& reSet1[i].Dealer_Info_text__c == accountName
+ ) {
+ consumableorderdetails2Cancle.add(reSet1[i]);
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ if (reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' && !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)) {
+ orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i],barcodedetList));
+ Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
+
+ codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ codsIns.Intra_Trade_List_RMB__c = reSet1[i].Intra_Trade_List_RMB__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
+ codsIns.Direct_Arrive_Product__c = true;
+ codsIns.Sterilization_limit__c = reSet1[i].Sterilization_limit__c;
+ codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
+ codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
+ codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
+ codsIns.TracingCode__c = reSet1[i].TracingCode__c;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c == null? 1 : reSet1[i].Transfer_Time__c;
+ codsIns.Frist_Transfer_Agency__c = reSet1[i].Frist_Transfer_Agency__c == null ? reSet1[i].Dealer_Info_text__c : reSet1[i].Frist_Transfer_Agency__c;
+ codsIns.Agency_Transfer__c = true;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
+ codsIns.Frist_Storage_Agency__c = reSet1[i].Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+
+ //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,璁板綍SAP鍚堝悓鍙�
+ // update tcm start
+ if (String.isBlank(reSet1[i].Consumable_order_minor__r.ContractNo__c)) {
+ codsIns.ContractNo_text__c= reSet1[i].ContractNo_text__c;
+ }else {
+ codsIns.ContractNo_text__c= reSet1[i].Consumable_order_minor__r.ContractNo__c;
+ }
+ // update tcm end
+ //add by rentx 2020-10-13 end
+
+ //add by rentx 2021-03-22 start
+ // if (reSet1[i].Lose_Flag__c == true){
+ if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+ codsIns.exchangeOutPattern__c = true;
+ }
+ //add by rentx 2021-03-22 end
+
+ consumableorderdetails2Insert.add(codsIns);
+ otherAgencyMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ //String str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
+ //ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ //ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+
+ //鍙戦敊搴� 鏈埌璐�
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,TracingCode__c,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,SerialLotNo__c,Dealer_Arrive__c,
+ Dealer_Shipment__c, Dealer_Saled__c,Consumable_Product__r.Asset_Model_No__c
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ ,SummonsForDirction_det__c,Transfer_Time__c,Frist_Transfer_Agency__c,Agency_Transfer__c,
+ Dealer_Info_text__c,Intra_Trade_List_RMB__c
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
+ ,Agencyinfo_fromSAP__c,Frist_Storage_Agency__c
+ // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
+ //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-13 end 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+ ,hospitalSpecialOffer__c
+ ,exchangeOutPattern__c
+ ,Lose_Flag__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c= FALSE
+ AND Dealer_Saled__c = FALSE
+ //AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c in :BarCodeListP
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != null
+ AND (Consumable_order_minor__r.Order_Owner_WorkLocal__c != :userWorkLocation
+ OR (Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Cancellation_Flag__c = TRUE)))
+ OR (Consumable_order_minor__c = null AND Cancellation_Flag__c = TRUE)))
+ )
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ order by Bar_Code__c, Transfer_Time__c desc
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ if(otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)){
+ continue;
+ }else{
+ //鍙栨秷鏄庣粏
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(reSet1[i].Bar_Code__c);
+ barcodedetList.add(String.valueOf(reSet1[i].Sterilization_limit__c));
+ barcodedetList.add(reSet1[i].SerialLotNo__c);
+ barcodedetList.add(reSet1[i].TracingCode__c);
+ // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
+ //if (reSet1[i].Consumable_order_minor__c == null) {
+ consumableorderdetails2Cancle.add(reSet1[i]);
+ //}
+ // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ if (reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' && !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)) {
+
+ orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i],barcodedetList));
+ Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
+
+ codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ codsIns.Intra_Trade_List_RMB__c = reSet1[i].Intra_Trade_List_RMB__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
+ codsIns.Direct_Arrive_Product__c = true;
+ codsIns.Sterilization_limit__c = reSet1[i].Sterilization_limit__c;
+ codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
+ codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
+ codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
+ codsIns.TracingCode__c = reSet1[i].TracingCode__c;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ // 娌℃湁鍏ュ簱鏃讹紝娌℃湁鍊熻皟淇℃伅
+ codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c;
+ codsIns.Frist_Transfer_Agency__c = reSet1[i].Frist_Transfer_Agency__c;
+ codsIns.Agency_Transfer__c = reSet1[i].Agency_Transfer__c;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
+ codsIns.Frist_Storage_Agency__c = reSet1[i].Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+
+ //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+ // update tcm start
+ if (String.isBlank(reSet1[i].Consumable_order_minor__r.ContractNo__c)) {
+ codsIns.ContractNo_text__c= reSet1[i].ContractNo_text__c;
+ }else {
+ codsIns.ContractNo_text__c= reSet1[i].Consumable_order_minor__r.ContractNo__c;
+ }
+ // update tcm end
+ //add by rentx 2020-10-13 end 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+
+ //add by rentx 2021-03-22 start
+ // if (reSet1[i].Lose_Flag__c == true){
+ if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+ codsIns.exchangeOutPattern__c = true;
+ }
+ //add by rentx 2021-03-22 end
+
+ consumableorderdetails2Insert.add(codsIns);
+ otherAgencyMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+ }else{
+ //杩斿搧妫�鏌�
+ //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+ reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ Product_Type__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE Bar_Code__c in :BarCodeListP
+ AND ( not Product_Type__c like :userPro_Typestr)
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != null
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR Consumable_order_minor__c = null)
+ ORDER BY Name ];
+
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
+ 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,Box_Piece__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-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ ,Report_Product_Expiration__c
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c= FALSE
+ AND Dealer_Saled__c = FALSE
+ // gzw fix 鍙栨秷浜у搧鍒ゆ柇涓烘湭鍏ュ簱 20230323
+ AND Cancellation_Flag__c = false
+ AND Dealer_Returned__c = false
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];//娌″埌璐�
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸皻鏈叆搴�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,ToDueDateDays__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,Lose_Flag__c,Box_Piece__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-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ , Report_Product_Expiration__c
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c= FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Returned__c = false
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ //AND Lose_Flag__c = FALSE
+ // AND Lose_Flag__c = FALSE
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // Gzw 20201215淇锛屾媶鐩掍骇鍝佷笉鍒ゆ柇
+ AND Box_Piece__c = '鐩�'
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ ORDER BY Name ];//娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // String str = '璇ュ晢鍝佸湪搴�';
+ // if (reSet1[i].Lose_Flag__c) {
+ // str = '璇ュ晢鍝佷涪澶�';
+ // }
+ String str = '';
+ if(reSet1[i].Lose_Flag__c == false){
+ str = '璇ュ晢鍝佸湪搴�';//娌″嚭搴� 锛屾病閿�鍞紝娌′涪澶卞氨鏄湪搴撱��
+ }
+ if(reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c >= 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add('浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍'));//濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆�
+ }
+ }
+ if (reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c < 0) {
+ str = '杩囨湡宸查攢瀛樹骇鍝侊紝涓嶅厑璁歌繑鍝�';
+ }
+ if(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);
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ }
+ }
+ }
}
- }
- }
- //鍙戦敊搴� 鏈埌璐�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- TracingCode__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- SerialLotNo__c,
- Dealer_Arrive__c,
- Dealer_Shipment__c,
- Dealer_Saled__c,
- Consumable_Product__r.Asset_Model_No__c,
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- SummonsForDirction_det__c,
- Transfer_Time__c,
- Frist_Transfer_Agency__c,
- Agency_Transfer__c,
- Dealer_Info_text__c,
- Intra_Trade_List_RMB__c,
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
- //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- //add by rentx 2020-10-13 end 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
- hospitalSpecialOffer__c,
- exchangeOutPattern__c,
- Lose_Flag__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = FALSE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- //AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND (Dealer_Info_text__c != :accountName
- OR (Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND (Consumable_order_minor__r.Order_Owner_WorkLocal__c != :userWorkLocation
- OR (Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
- AND Cancellation_Flag__c = TRUE)))
- OR (Consumable_order_minor__c = NULL
- AND Cancellation_Flag__c = TRUE))))
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- ORDER BY Bar_Code__c, Transfer_Time__c DESC
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- if (otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)) {
- continue;
- } else {
- //鍙栨秷鏄庣粏
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(reSet1[i].Bar_Code__c);
- barcodedetList.add(
- String.valueOf(reSet1[i].Sterilization_limit__c)
- );
- barcodedetList.add(reSet1[i].SerialLotNo__c);
- barcodedetList.add(reSet1[i].TracingCode__c);
- // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
- //if (reSet1[i].Consumable_order_minor__c == null) {
- consumableorderdetails2Cancle.add(reSet1[i]);
- //}
- // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- if (
- reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' &&
- !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
+
+
+
+ //鍒拌揣姝g‘淇℃伅
+ 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,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Box_Piece__c,
+ Rrturn_count__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,
+ Consumable_Product__r.Pro2_Dealer_ENG__c,
+ Consumable_Product__r.Pro2_Dealer_Object__c,
+ TracingCode__c,
+ Agencyinfo_fromSAP__c,
+ Frist_Storage_Agency__c,
+ Dealer_Info_text__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Cancellation_Date__c = null
+ AND Dealer_Arrive__c = false
+ AND Product_Type__c like :userPro_Typestr
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != null
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR Consumable_order_minor__c = null)
+ ORDER BY Name ];
+
+ if(reSet.size()>0){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ErrorIdMap+++ '+ ErrorIdMap.keyset()));
+ Map<String,String> errorMap = new Map<String,String>();
+ for (Integer i = 0; i < reSet.size(); i++) {
+
+ if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (reSet[i].TracingCode__c.length() == 5) {
+ String tr = reSet[i].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ if(otherAgencyMap.containsKey(reSet[i].Bar_Code__c)){
+ for (Integer j=0; j<consumableInventory.size(); j++) {
+ ConsumableorderdetailsInfo codInfo = consumableInventory.get(j);
+ if (codInfo.barCodeNo == reSet[i].Bar_Code__c) {
+ consumableInventory.remove(j);
+ break;
+ }
+ }
+ for (Integer m=0; m<consumableorderdetails2Insert.size(); m++) {
+ Consumable_order_details2__c cod2 = consumableorderdetails2Insert.get(m);
+ if (cod2.Bar_Code__c == reSet[i].Bar_Code__c) {
+ consumableorderdetails2Insert.remove(m);
+ break;
+ }
+ }
+ }
+ //orderId.add(reSet[i].Consumable_order_minor__c);
+ //prodName.add(reSet[i].Consumable_Product__r.Name);
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ }
}
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- consumableInventory.add(
- new ConsumableorderdetailsInfo(reSet1[i], barcodedetList)
- );
- Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
-
- codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- codsIns.Intra_Trade_List_RMB__c = reSet1[i]
- .Intra_Trade_List_RMB__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
- codsIns.Direct_Arrive_Product__c = true;
- codsIns.Sterilization_limit__c = reSet1[i]
- .Sterilization_limit__c;
- codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
- codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
- codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
- codsIns.TracingCode__c = reSet1[i].TracingCode__c;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- // 娌℃湁鍏ュ簱鏃讹紝娌℃湁鍊熻皟淇℃伅
- codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c;
- codsIns.Frist_Transfer_Agency__c = reSet1[i]
- .Frist_Transfer_Agency__c;
- codsIns.Agency_Transfer__c = reSet1[i].Agency_Transfer__c;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
- codsIns.Frist_Storage_Agency__c = reSet1[i]
- .Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
-
- //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
- // update tcm start
- if (
- String.isBlank(
- reSet1[i].Consumable_order_minor__r.ContractNo__c
- )
- ) {
- codsIns.ContractNo_text__c = reSet1[i].ContractNo_text__c;
- } else {
- codsIns.ContractNo_text__c = reSet1[i]
- .Consumable_order_minor__r.ContractNo__c;
- }
- // update tcm end
- //add by rentx 2020-10-13 end 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
-
- //add by rentx 2021-03-22 start
- // if (reSet1[i].Lose_Flag__c == true){
- if (
- reSet1[i].hospitalSpecialOffer__c == true &&
- reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'
- ) {
- codsIns.exchangeOutPattern__c = true;
- }
- //add by rentx 2021-03-22 end
-
- consumableorderdetails2Insert.add(codsIns);
- otherAgencyMap.put(
- reSet1[i].Bar_Code__c,
- reSet1[i].Bar_Code__c
- );
- }
}
- }
- }
- } else {
- //杩斿搧妫�鏌�
- //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
- reSet1 = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- Product_Type__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :BarCodeListP
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- AND Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR Consumable_order_minor__c = NULL)
- ORDER BY Name
- ];
+ //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
+ 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,
+ Consumable_Product__r.Asset_Model_No__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,
+ Box_Piece__c,
+ Rrturn_count__c,
+ TracingCode__c
+ ,Agencyinfo_fromSAP__c
+ ,Frist_Storage_Agency__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c */
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Info_text__c = :accountName
+ //update by rentx 2021-01-04 start CHAN-BWX3XW
+ // AND Consumable_order_minor__c != null
+ // AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ AND ((Consumable_order_minor__c != null AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) OR Consumable_order_minor__c = null)
+ //update by rentx 2021-01-04 end CHAN-BWX3XW
+ AND Dealer_Arrive__c = false
+ AND Cancellation_Date__c = null
+ AND TracingCode__c in :barMcodeMap.values()
+ AND Bar_Code__c not in :barMcodeMap.keySet()
+ ORDER BY Name ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '浜у搧绫诲瀷[' +
- reSet1[i].Product_Type__c +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇';
- 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,
- Box_Piece__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-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- Report_Product_Expiration__c
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = FALSE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- // gzw fix 鍙栨秷浜у搧鍒ゆ柇涓烘湭鍏ュ簱 20230323
- AND Cancellation_Flag__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ]; //娌″埌璐�
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸皻鏈叆搴�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- ToDueDateDays__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Lose_Flag__c,
- Box_Piece__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-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- Report_Product_Expiration__c
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Returned__c = FALSE
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- //AND Lose_Flag__c = FALSE
- // AND Lose_Flag__c = FALSE
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // Gzw 20201215淇锛屾媶鐩掍骇鍝佷笉鍒ゆ柇
- AND Box_Piece__c = '鐩�'
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- ORDER BY Name
- ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // String str = '璇ュ晢鍝佸湪搴�';
- // if (reSet1[i].Lose_Flag__c) {
- // str = '璇ュ晢鍝佷涪澶�';
- // }
- String str = '';
- if (reSet1[i].Lose_Flag__c == false) {
- str = '璇ュ晢鍝佸湪搴�'; //娌″嚭搴� 锛屾病閿�鍞紝娌′涪澶卞氨鏄湪搴撱��
- }
- if (
- reSet1[i].Lose_Flag__c == true &&
- reSet1[i].ToDueDateDays__c >= 0
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add(
- '浜у搧' +
- reSet1[i].Consumable_Product__r.Name +
- '瀛樺湪涓㈠け璁板綍'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.WARNING,
- '浜у搧' +
- reSet1[i].Consumable_Product__r.Name +
- '瀛樺湪涓㈠け璁板綍'
- )
- ); //濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆�
+ if(reSet.size()>0){
+ for (Integer i = 0; i < reSet.size(); i++) {
+ if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
+ if(n.find()){// gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (reSet[i].TracingCode__c.length() == 5) {
+ String tr = reSet[i].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ for(String str : barMcodeMap.keySet()){
+ // BarCode涓嶄竴鑷存椂鐨勮鍛婁俊鎭�
+ if(reSet[i].Bar_Code__c != str && reSet[i].TracingCode__c == barMcodeMap.get(str)){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add('鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�');
+ }else {
+ // 20220815 ljh SWAG-CH65B7 start
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佷笌瀹為檯鍙戣揣BarCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�'));
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�'));
+ // 20220815 ljh SWAG-CH65B7 end
+ }
+ }
+ if(barMcodeMap.get(str) == reSet[i].TracingCode__c){
+ reSet[i].Bar_Code__c = str;
+ //=====================================
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鍏ュ簱BarCode('+ str +')鍜屽簱瀛樻潯鐮佷笉涓�鑷淬��'));
+ ExistIdMap.put(str,str);
+ }
+ }
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i]));
+ }
}
- }
- if (
- reSet1[i].Lose_Flag__c == true &&
- reSet1[i].ToDueDateDays__c < 0
- ) {
- str = '杩囨湡宸查攢瀛樹骇鍝侊紝涓嶅厑璁歌繑鍝�';
- }
- if (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);
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
}
- }
- }
- }
- //鍒拌揣姝g‘淇℃伅
- 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,
- Consumable_Product__r.Asset_Model_No__c,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Box_Piece__c,
- Rrturn_count__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,
- Consumable_Product__r.Pro2_Dealer_ENG__c,
- Consumable_Product__r.Pro2_Dealer_Object__c,
- TracingCode__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- Dealer_Info_text__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Cancellation_Date__c = NULL
- AND Dealer_Arrive__c = FALSE
- AND Product_Type__c LIKE :userPro_Typestr
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR Consumable_order_minor__c = NULL)
- ORDER BY Name
- ];
- if (reSet.size() > 0) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ErrorIdMap+++ '+ ErrorIdMap.keyset()));
- Map<String, String> errorMap = new Map<String, String>();
- for (Integer i = 0; i < reSet.size(); i++) {
- if (
- ExistIdMap.containsKey(reSet[i].Bar_Code__c) ||
- ErrorIdMap.containsKey(reSet[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- Matcher n = Pattern.compile('[0-9]')
- .matcher(reSet[i].TracingCode__c);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (reSet[i].TracingCode__c.length() == 5) {
- String tr = reSet[i].TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet[i], str)
- );
- ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- continue;
+ // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘 杩藉姞 barcode涓嶄竴鑷村垽鏂�
+ reSet1 = [SELECT Id,Name,TracingCode__c,Bar_Code__c,Sale_orderName__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND (Dealer_Shipment__c = true
+ OR Dealer_Saled__c = true)
+ AND TracingCode__c in :barMcodeMap.values()
+ AND Bar_Code__c not in :barMcodeMap.keySet()
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ for(String str : barMcodeMap.keySet()){
+ if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'));
+ }
+ ErrorIdMap.put(str,str);
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
}
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
- // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
}
- if (otherAgencyMap.containsKey(reSet[i].Bar_Code__c)) {
- for (Integer j = 0; j < consumableInventory.size(); j++) {
- ConsumableorderdetailsInfo codInfo = consumableInventory.get(j);
- if (codInfo.barCodeNo == reSet[i].Bar_Code__c) {
- consumableInventory.remove(j);
- break;
+ integer RGcnt = GoodsReturnCheck();
+ AllMap.putAll(ErrorIdMap);
+ AllMap.putAll(ExistIdMap);
+ if(RGcnt>0){
+ for(String str:GrList){
+ AllMap.put(str,str);
}
- }
- for (
- Integer m = 0; m < consumableorderdetails2Insert.size(); m++
- ) {
- Consumable_order_details2__c cod2 = consumableorderdetails2Insert.get(
- m
- );
- if (cod2.Bar_Code__c == reSet[i].Bar_Code__c) {
- consumableorderdetails2Insert.remove(m);
- break;
- }
- }
}
- //orderId.add(reSet[i].Consumable_order_minor__c);
- //prodName.add(reSet[i].Consumable_Product__r.Name);
- ConsumableorderdetailsRecordsdummy.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ConsumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- }
- }
- }
- //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
- 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,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- TracingCode__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c */,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Dealer_Info_text__c = :accountName
- //update by rentx 2021-01-04 start CHAN-BWX3XW
- // AND Consumable_order_minor__c != null
- // AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR Consumable_order_minor__c = NULL)
- //update by rentx 2021-01-04 end CHAN-BWX3XW
- AND Dealer_Arrive__c = FALSE
- AND Cancellation_Date__c = NULL
- AND TracingCode__c IN :barMcodeMap.values()
- AND Bar_Code__c NOT IN :barMcodeMap.keySet()
- ORDER BY Name
- ];
+ //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
+ //return;
+ for(Integer i = 0; i < BarCodeListP.size(); i++){
+ if(AllMap.containsKey(BarCodeListP[i])){
+ continue;
+ }else if(otherAgencyMap.containsKey(BarCodeListP[i])){
+ continue;
+ }
+ //add by rentx 2021-01-27 start
+ else if (coc!= null && coc.orderPattern__c == 'hospitalorder') {
+ HosErrorList.add(BarCodeListP[i]);
+ continue;
+ }
+ //add by rentx 2021-01-27 end
+ else{
+ notInlist.add(BarCodeListP[i]);
+ otherAgencyMap.put(BarCodeListP[i],BarCodeListP[i]);
+ }
+ }
+ // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘
+ if(notInlist.size()>0){
+ if(ArrType!='ReG'){
+ inventoryEntryNoESetId(notInlist);
+ if(notInStorelist.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = 'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦�';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��'));
+ }
+ return;
+ }
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = 'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�'));
+ }
+ return;
+ }
+ }
- if (reSet.size() > 0) {
- for (Integer i = 0; i < reSet.size(); i++) {
- if (
- ExistIdMap.containsKey(reSet[i].Bar_Code__c) ||
- ErrorIdMap.containsKey(reSet[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- Matcher n = Pattern.compile('[0-9]')
- .matcher(reSet[i].TracingCode__c);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (reSet[i].TracingCode__c.length() == 5) {
- String tr = reSet[i].TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet[i], str)
- );
- ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- continue;
- }
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
- // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
- }
- ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- for (String str : barMcodeMap.keySet()) {
- // BarCode涓嶄竴鑷存椂鐨勮鍛婁俊鎭�
- if (
- reSet[i].Bar_Code__c != str &&
- reSet[i].TracingCode__c == barMcodeMap.get(str)
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add(
- '鏉″舰鐮佷负(' + str + ')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�'
- );
- } else {
- // 20220815 ljh SWAG-CH65B7 start
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佷笌瀹為檯鍙戣揣BarCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�'));
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.WARNING,
- '鏉″舰鐮佷负(' + str + ')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�'
- )
- );
- // 20220815 ljh SWAG-CH65B7 end
- }
- }
- if (barMcodeMap.get(str) == reSet[i].TracingCode__c) {
- reSet[i].Bar_Code__c = str;
- //=====================================
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鍏ュ簱BarCode('+ str +')鍜屽簱瀛樻潯鐮佷笉涓�鑷淬��'));
- ExistIdMap.put(str, str);
- }
- }
- ConsumableorderdetailsRecordsdummy.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ConsumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- }
- }
- }
-
- // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘 杩藉姞 barcode涓嶄竴鑷村垽鏂�
- reSet1 = [
- SELECT
- Id,
- Name,
- TracingCode__c,
- Bar_Code__c,
- Sale_orderName__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND (Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE)
- AND TracingCode__c IN :barMcodeMap.values()
- AND Bar_Code__c NOT IN :barMcodeMap.keySet()
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- for (String str : barMcodeMap.keySet()) {
- if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- 'barcode' +
- str +
- '涓庡嚭搴撳崟' +
- reSet1[i].Sale_orderName__c +
- ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'barcode' +
- str +
- '涓庡嚭搴撳崟' +
- reSet1[i].Sale_orderName__c +
- ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'
- )
- );
- }
- ErrorIdMap.put(str, str);
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- }
- }
- integer RGcnt = GoodsReturnCheck();
- AllMap.putAll(ErrorIdMap);
- AllMap.putAll(ExistIdMap);
- if (RGcnt > 0) {
- for (String str : GrList) {
- AllMap.put(str, str);
- }
- }
- //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
- //return;
- for (Integer i = 0; i < BarCodeListP.size(); i++) {
- if (AllMap.containsKey(BarCodeListP[i])) {
- continue;
- } else if (otherAgencyMap.containsKey(BarCodeListP[i])) {
- continue;
- }
//add by rentx 2021-01-27 start
- else if (coc != null && coc.orderPattern__c == 'hospitalorder') {
- HosErrorList.add(BarCodeListP[i]);
- continue;
+ if (HosErrorList.size() > 0) {
+ for (String str : HosErrorList) {
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙�:' + str + HosErrorMap.get(str)+'');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str + HosErrorMap.get(str)+''));
+ }
+ }
}
//add by rentx 2021-01-27 end
- else {
- notInlist.add(BarCodeListP[i]);
- otherAgencyMap.put(BarCodeListP[i], BarCodeListP[i]);
- }
- }
- // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘
- if (notInlist.size() > 0) {
- if (ArrType != 'ReG') {
- inventoryEntryNoESetId(notInlist);
- if (notInStorelist.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦�';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦ㄣ��'
- )
- );
- }
- return;
- }
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError =
- 'BarCode鍙�' +
- notInlist +
- '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙�' +
- notInlist +
- '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�'
- )
- );
- }
- return;
- }
- }
- //add by rentx 2021-01-27 start
- if (HosErrorList.size() > 0) {
- for (String str : HosErrorList) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('BarCode鍙�:' + str + HosErrorMap.get(str) + '');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙�:' + str + HosErrorMap.get(str) + ''
- )
- );
- }
- }
- }
- //add by rentx 2021-01-27 end
- } else {
- //宸插彇娑堜骇鍝�
- 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,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__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 Cancellation_Date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ]; //娌″埌璐�
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸彇娑�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //宸茬粡閿�鍞�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Saled__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :BarCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //宸茬粡鍑哄簱浜у搧
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Shipment__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Bar_Code__c IN :BarCodeListP
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //宸茬粡鍒拌揣浜у搧
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Lose_Flag__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓埌璐�';
- if (reSet1[i].Lose_Flag__c == true) {
- str = '璇ュ晢鍝佸凡缁忎涪澶�';
- }
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //涓嶅睘浜庢湰璁㈠崟
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Box_Piece__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Report_Product_Expiration__c
- FROM Consumable_order_details2__c
- WHERE
- Consumable_order_minor__c != :ESetId
- AND Bar_Code__c IN :BarCodeListP
- //AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ユ秷鑰楀搧涓嶅睘浜庢湰璁㈠崟';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
- reSet1 = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- Product_Type__c,
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Dealer_Info_text__c = :accountName
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- AND Consumable_order_minor__c = :ESetId
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
- AND Dealer_Arrive__c = FALSE
- AND Cancellation_Date__c = NULL
- AND Bar_Code__c IN :BarCodeListP
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '浜у搧绫诲瀷[' +
- reSet1[i].Product_Type__c +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
-
- //鍒拌揣姝g‘淇℃伅
- 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,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- TracingCode__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- Dealer_Info_text__c,
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Dealer_Info_text__c = :accountName
- AND Product_Type__c LIKE :userPro_Typestr
- AND Consumable_order_minor__c = :ESetId
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
- AND Dealer_Arrive__c = FALSE
- AND Cancellation_Date__c = NULL
- AND Bar_Code__c IN :BarCodeListP
- ORDER BY Name
- ];
- if (reSet.size() > 0) {
- Map<String, String> errorMap = new Map<String, String>();
- for (Integer i = 0; i < reSet.size(); i++) {
- if (
- ExistIdMap.containsKey(reSet[i].Bar_Code__c) ||
- ErrorIdMap.containsKey(reSet[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- Matcher n = Pattern.compile('[0-9]')
- .matcher(reSet[i].TracingCode__c);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (reSet[i].TracingCode__c.length() == 5) {
- String tr = reSet[i].TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet[i], str)
- );
- ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- continue;
+ }else{
+ //宸插彇娑堜骇鍝�
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__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 Cancellation_Date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];//娌″埌璐�
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸彇娑�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
- // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
- }
- ConsumableorderdetailsRecordsdummy.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ConsumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- }
- }
- }
-
- //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
- 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,
- Consumable_Product__r.Asset_Model_No__c,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Box_Piece__c,
- Rrturn_count__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,
- TracingCode__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Cancellation_Date__c = NULL
- AND Dealer_Arrive__c = FALSE
- AND TracingCode__c IN :barMcodeMap.values()
- AND Bar_Code__c NOT IN :barMcodeMap.keySet()
- AND Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR Consumable_order_minor__c = NULL)
- ORDER BY Name
- ];
- if (reSet.size() > 0) {
- for (Integer i = 0; i < reSet.size(); i++) {
- if (
- ExistIdMap.containsKey(reSet[i].Bar_Code__c) ||
- ErrorIdMap.containsKey(reSet[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- Matcher n = Pattern.compile('[0-9]')
- .matcher(reSet[i].TracingCode__c);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (reSet[i].TracingCode__c.length() == 5) {
- String tr = reSet[i].TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet[i], str)
- );
- ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
- continue;
+ //宸茬粡閿�鍞�
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Saled__c = true
+ AND Dealer_Returned__c =false
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c in :BarCodeListP
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
- // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ //宸茬粡鍑哄簱浜у搧
+ 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,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Shipment__c = true
+ AND Dealer_Returned__c =false
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Bar_Code__c in :BarCodeListP
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ //宸茬粡鍒拌揣浜у搧
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,Lose_Flag__c,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Returned__c =false
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忓埌璐�';
+ if (reSet1[i].Lose_Flag__c == TRUE) {
+ str = '璇ュ晢鍝佸凡缁忎涪澶�';
+ }
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ //涓嶅睘浜庢湰璁㈠崟
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,Box_Piece__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
+ FROM Consumable_order_details2__c
+ WHERE Consumable_order_minor__c != :ESetId
+ AND Bar_Code__c in :BarCodeListP
+ //AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ユ秷鑰楀搧涓嶅睘浜庢湰璁㈠崟';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+ reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ Product_Type__c
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Info_text__c = :accountName
+ AND ( not Product_Type__c like :userPro_Typestr)
+ AND Consumable_order_minor__c = :ESetId
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Dealer_Arrive__c = false
+ AND Cancellation_Date__c = null
+ AND Bar_Code__c in :BarCodeListP
+ ORDER BY Name ];
+ if(reSet1.size()>0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ //鍒拌揣姝g‘淇℃伅
+ 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,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ TracingCode__c,
+ Agencyinfo_fromSAP__c,
+ Frist_Storage_Agency__c,
+ Dealer_Info_text__c
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Info_text__c = :accountName
+ AND Product_Type__c like :userPro_Typestr
+ AND Consumable_order_minor__c = :ESetId
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Dealer_Arrive__c = false
+ AND Cancellation_Date__c = null
+ AND Bar_Code__c in :BarCodeListP
+ ORDER BY Name ];
+ if(reSet.size()>0){
+ Map<String,String> errorMap = new Map<String,String>();
+ for (Integer i = 0; i < reSet.size(); i++) {
+ if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (reSet[i].TracingCode__c.length() == 5) {
+ String tr = reSet[i].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ConsumableorderdetailsRecords.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);
- for (String str : barMcodeMap.keySet()) {
- if (barMcodeMap.get(str) == reSet[i].TracingCode__c) {
- reSet[i].Bar_Code__c = str;
- ExistIdMap.put(str, str);
- }
+
+ //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
+ 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,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Box_Piece__c,
+ Rrturn_count__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,
+ TracingCode__c
+ ,Agencyinfo_fromSAP__c
+ ,Frist_Storage_Agency__c
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ FROM Consumable_order_details2__c
+ WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Cancellation_Date__c = null
+ AND Dealer_Arrive__c = false
+ AND TracingCode__c in :barMcodeMap.values()
+ AND Bar_Code__c not in :barMcodeMap.keySet()
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != null
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR Consumable_order_minor__c = null)
+ ORDER BY Name ];
+ if(reSet.size()>0){
+ for (Integer i = 0; i < reSet.size(); i++) {
+ if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (reSet[i].TracingCode__c.length() == 5) {
+ String tr = reSet[i].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
+ // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ for(String str : barMcodeMap.keySet()){
+ if(barMcodeMap.get(str) == reSet[i].TracingCode__c){
+ reSet[i].Bar_Code__c = str;
+ ExistIdMap.put(str,str);
+ }
+ }
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i]));
+ }
+ }
}
- ConsumableorderdetailsRecordsdummy.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ConsumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- }
+ AllMap.putAll(ErrorIdMap);
+ AllMap.putAll(ExistIdMap);
+ //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
+ for(Integer i = 0; i < BarCodeListP.size(); i++){
+ if(AllMap.containsKey(BarCodeListP[i])){
+ continue;
+ }else if(otherAgencyMap.containsKey(BarCodeListP[i])){
+ continue;
+ }
+ //add by rentx 2021-01-27 start
+ else if (coc!= null && coc.orderPattern__c == 'hospitalorder') {
+ HosErrorList.add(BarCodeListP[i]);
+ continue;
+
+ }
+ //add by rentx 2021-01-27 end
+ else{
+ notInlist.add(BarCodeListP[i]);
+ otherAgencyMap.put(BarCodeListP[i],BarCodeListP[i]);
+ }
+ }
+ if(notInlist.size()>0){
+ inventoryEntry(notInlist);
+ if(notInStorelist.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = 'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦�';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��'));
+ }
+ return;
+ }
+ }
}
- }
- AllMap.putAll(ErrorIdMap);
- AllMap.putAll(ExistIdMap);
- //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
- for (Integer i = 0; i < BarCodeListP.size(); i++) {
- if (AllMap.containsKey(BarCodeListP[i])) {
- continue;
- } else if (otherAgencyMap.containsKey(BarCodeListP[i])) {
- continue;
- }
- //add by rentx 2021-01-27 start
- else if (coc != null && coc.orderPattern__c == 'hospitalorder') {
- HosErrorList.add(BarCodeListP[i]);
- continue;
+
+ //add by rentx 2021-01-27 start 褰撹鍗曚负鍖婚櫌鐗逛环绫诲瀷鐨勮鍗曟椂,濡傛灉鎵句笉鍒癰arcode,涓嶈В鏋�,骞朵笖榛樿璇arcode瀵瑰簲鐨勬槑缁�2涓洪潪鍖婚櫌鐗逛环浜у搧,鐩存帴鎶ラ敊
+ if (HosErrorList.size() > 0) {
+ for (String str : HosErrorList) {
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧'));
+ }
+
+ }
}
//add by rentx 2021-01-27 end
- else {
- notInlist.add(BarCodeListP[i]);
- otherAgencyMap.put(BarCodeListP[i], BarCodeListP[i]);
- }
- }
- if (notInlist.size() > 0) {
- inventoryEntry(notInlist);
- if (notInStorelist.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦�';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦ㄣ��'
- )
- );
- }
- return;
- }
- }
+
+ makeArrivedSummary();
+
+
+ //add by rentx 20210602 start CHAN-C3K4ZQ
+ makeRecordsView(ConsumableorderdetailsRecordsdummy);
+ //add by rentx 20210602 end CHAN-C3K4ZQ
}
- //add by rentx 2021-01-27 start 褰撹鍗曚负鍖婚櫌鐗逛环绫诲瀷鐨勮鍗曟椂,濡傛灉鎵句笉鍒癰arcode,涓嶈В鏋�,骞朵笖榛樿璇arcode瀵瑰簲鐨勬槑缁�2涓洪潪鍖婚櫌鐗逛环浜у搧,鐩存帴鎶ラ敊
- if (HosErrorList.size() > 0) {
- for (String str : HosErrorList) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('BarCode鍙�:' + str + '鏄潪鍖婚櫌鐗逛环浜у搧');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙�:' + str + '鏄潪鍖婚櫌鐗逛环浜у搧'
- )
- );
- }
- }
- }
- //add by rentx 2021-01-27 end
- makeArrivedSummary();
-
- //add by rentx 20210602 start CHAN-C3K4ZQ
- makeRecordsView(ConsumableorderdetailsRecordsdummy);
- //add by rentx 20210602 end CHAN-C3K4ZQ
- }
-
- public void inventoryEntryNoESetId(List<String> barCodeList) {
- //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
- List<String> alljanCodeList = new List<String>();
- List<String> allotCodeList = new List<String>();
- List<String> barCode01List = new List<String>();
- List<String> barCode241List = new List<String>();
- Map<String, Map<String, String>> barJancodeMap = new Map<String, Map<String, String>>();
- Map<String, Map<String, String>> barOtcodeMap = new Map<String, Map<String, String>>();
- Map<String, List<String>> barcodeinfoMap = new Map<String, List<String>>();
- Map<String, String> barcoderightMap = new Map<String, String>();
- notInStorelist.clear();
- for (Integer i = 0; i < barCodeList.size(); i++) {
- Date expirationDate = null;
- String serialNoorLotNo = '';
- String tracingCode = '';
- String productDateStr = '';
- Date productionDate = null;
- String expirationDateStr = '';
- if (barCodeList[i].length() >= 3) {
- if (barCodeList[i].substring(0, 2) == '01') {
- String janCodeMark = '';
- //鐢熶骇鏃ユ湡
- List<String> janCode = new List<String>();
- if (barCodeList[i].length() < 16) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- )
- );
- }
- continue;
- } else {
- //if(barCodeList[i].substring(0,2) !='01'){
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode锛屼笉绗﹀悎瑕佹眰锛�'));
- // return;
- //}
- janCodeMark = barCodeList[i].substring(2, 16);
- try {
- Decimal test = Decimal.valueOf(janCodeMark);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'
- )
- );
- }
- continue;
- }
- }
- if (barCodeList[i].length() >= 22) {
- if (
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) != '250'
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].substring(16, 18) == '11') {
- try {
- productDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-01';
- productionDate = Date.valueOf(productDateStr);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 32) {
- if (barCodeList[i].substring(24, 26) == '17') {
- try {
- if (barCodeList[i].substring(30, 32) == '00') {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(26, 28) +
- '-' +
- barCodeList[i].substring(28, 30) +
- '-' +
- '01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(26, 28) +
- '-' +
- barCodeList[i].substring(28, 30) +
- '-' +
- barCodeList[i].substring(30, 32);
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 42) {
- if (
- barCodeList[i].substring(32, 34) == '10' ||
- barCodeList[i].substring(32, 34) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(34, barCodeList[i].length() - 8);
- }
- }
- } else if (
- barCodeList[i].substring(24, 26) == '10' ||
- barCodeList[i].substring(24, 26) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(26, barCodeList[i].length() - 8);
- }
- }
- } else if (barCodeList[i].substring(16, 18) == '17') {
- try {
- if (barCodeList[i].substring(22, 24) == '00') {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-01';
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-' +
- barCodeList[i].substring(22, 24);
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 34) {
- if (
- barCodeList[i].substring(24, 26) == '10' ||
- barCodeList[i].substring(24, 26) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(26, barCodeList[i].length() - 8);
- }
- }
- } else if (barCodeList[i].length() >= 26) {
- if (
- barCodeList[i].substring(16, 18) == '10' ||
- barCodeList[i].substring(16, 18) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(18, barCodeList[i].length() - 8);
- }
- }
- }
- if (
- barCodeList[i].length() >= 24 &&
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) == '250'
- ) {
- if (
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) == '250'
- ) {
- tracingCode = barCodeList[i]
- .substring(
- barCodeList[i].length() - 5,
- barCodeList[i].length()
- );
- Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (tracingCode.length() == 5) {
- String tr = tracingCode;
- 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()
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- )
- );
- }
- continue;
- }
- }
- }
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'
- )
- );
- }
- continue;
- }
- }
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(barCodeList[i]);
- barcodedetList.add(String.valueOf(expirationDate));
- barcodedetList.add(serialNoorLotNo);
- barcodedetList.add(tracingCode);
- Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
- Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
- Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
- Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
- Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
- Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
- Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
- Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
- Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
- Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
- Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
- Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
- Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
-
- Integer count12 =
- jan2 +
- jan3 * 3 +
- jan4 +
- jan5 * 3 +
- jan6 +
- jan7 * 3 +
- jan8 +
- jan9 * 3 +
- jan10 +
- jan11 * 3 +
- jan12 +
- jan13 * 3;
- Integer count13 =
- jan1 * 3 +
- jan2 +
- jan3 * 3 +
- jan4 +
- jan5 * 3 +
- jan6 +
- jan7 * 3 +
- jan8 +
- jan9 * 3 +
- jan10 +
- jan11 * 3 +
- jan12 +
- jan13 * 3;
- String frost12 = (String.valueOf(count12))
- .substring((String.valueOf(count12)).length() - 1);
- String frost13 = (String.valueOf(count13))
- .substring((String.valueOf(count13)).length() - 1);
- //鍑忓幓12浣嶄釜浣�
- frost12 = (String.valueOf(10 - Integer.valueOf(frost12)))
- .substring(
- (String.valueOf(10 - Integer.valueOf(frost12))).length() - 1
- );
- frost13 = (String.valueOf(10 - Integer.valueOf(frost13)))
- .substring(
- (String.valueOf(10 - Integer.valueOf(frost13))).length() - 1
- );
- janCode.add(janCodeMark.substring(1, 13) + frost12);
- janCode.add(janCodeMark.substring(0, 13) + frost12);
- janCode.add(janCodeMark.substring(1, 13) + frost13);
- janCode.add(janCodeMark.substring(0, 13) + frost13);
- alljanCodeList.addAll(janCode);
- Map<String, String> janCodeMap = new Map<String, String>();
- janCodeMap.put(
- janCodeMark.substring(1, 13) + frost12,
- barCodeList[i]
- );
- janCodeMap.put(
- janCodeMark.substring(0, 13) + frost12,
- barCodeList[i]
- );
- janCodeMap.put(
- janCodeMark.substring(1, 13) + frost13,
- barCodeList[i]
- );
- janCodeMap.put(
- janCodeMark.substring(0, 13) + frost13,
- barCodeList[i]
- );
- barJancodeMap.put(barCodeList[i], janCodeMap);
- barcodeinfoMap.put(barCodeList[i], barcodedetList);
- barCode01List.add(barCodeList[i]);
- } else if (barCodeList[i].substring(0, 3) == '241') {
- if (
- barCodeList[i].length() > 8 &&
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) != '250'
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- )
- );
- }
- continue;
- }
- List<String> otCodeList = new List<String>();
- Map<String, String> otCodeMap = new Map<String, String>();
- if (barCodeList[i].length() < 7) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- )
- );
- }
- continue;
- } else if (barCodeList[i].length() == 11) {
- String otCode4 = barCodeList[i].substring(3, 7);
- String otCode5 = barCodeList[i].substring(3, 8);
- String otCode6 = barCodeList[i].substring(3, 9);
- String otCode7 = barCodeList[i].substring(3, 10);
- String otCode8 = barCodeList[i].substring(3, 11);
- otCodeList.add(otCode4);
- otCodeList.add(otCode5);
- otCodeList.add(otCode6);
- otCodeList.add(otCode7);
- otCodeList.add(otCode8);
- otCodeMap.put(otCode4, barCodeList[i]);
- otCodeMap.put(otCode5, barCodeList[i]);
- otCodeMap.put(otCode6, barCodeList[i]);
- otCodeMap.put(otCode7, barCodeList[i]);
- otCodeMap.put(otCode8, barCodeList[i]);
- } else if (barCodeList[i].length() >= 12) {
- String otCode4 = barCodeList[i].substring(3, 7);
- String otCode5 = barCodeList[i].substring(3, 8);
- String otCode6 = barCodeList[i].substring(3, 9);
- String otCode7 = barCodeList[i].substring(3, 10);
- String otCode8 = barCodeList[i].substring(3, 11);
- String otCode9 = barCodeList[i].substring(3, 12);
- otCodeList.add(otCode4);
- otCodeList.add(otCode5);
- otCodeList.add(otCode6);
- otCodeList.add(otCode7);
- otCodeList.add(otCode8);
- otCodeList.add(otCode9);
- otCodeMap.put(otCode4, barCodeList[i]);
- otCodeMap.put(otCode5, barCodeList[i]);
- otCodeMap.put(otCode6, barCodeList[i]);
- otCodeMap.put(otCode7, barCodeList[i]);
- otCodeMap.put(otCode8, barCodeList[i]);
- otCodeMap.put(otCode9, barCodeList[i]);
- }
- allotCodeList.addAll(otCodeList);
- barOtcodeMap.put(barCodeList[i], otCodeMap);
- barCode241List.add(barCodeList[i]);
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'
- )
- );
- }
- continue;
- }
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'
- )
- );
- }
- continue;
- }
- }
- //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
- //-----------XHL--------------UpdateSTART----------------20181010------
- if (alljanCodeList.size() > 0) {
- List<Product2__c> product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Product2_Jancode__c,
- Pro2_Dealer_ENG__c,
- Pro2_Dealer_Object__c
- FROM Product2__c
- WHERE Product2_Jancode__c IN :alljanCodeList
- ORDER BY SFDA_Expiration_Date__c DESC
- ];
- if (product2InStore.size() > 0) {
- // CHAN-AVSAST
- Map<String, String> rightBar = new Map<String, String>();
- Map<String, String> errorMap = new Map<String, String>();
- for (String bar : barJancodeMap.keySet()) {
- Integer cou = 0;
- for (Product2__c produ : product2InStore) {
- if (
- barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) &&
- !rightBar.containsKey(bar)
- ) {
- cou++;
- if (EngFlag == true && produ.Pro2_Dealer_ENG__c == true) {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- consumableInventoryUse.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- rightBar.put(bar, bar);
- } else if (
- ETFlag == true &&
- produ.Pro2_Dealer_Object__c == true
- ) {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- consumableInventoryUse.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- rightBar.put(bar, bar);
- } else {
- errorMap.put(bar, bar);
- }
- }
- }
- if (cou <= 0) {
- notInStorelist.add(bar);
- }
- }
- if (errorMap.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴风被鍨媅' +
- userPro_Type +
- ']涓嶇'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴风被鍨媅' +
- userPro_Type +
- ']涓嶇'
- )
- );
- }
- }
- }
- }
-
- //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
- if (allotCodeList.size() > 0) {
- Map<String, String> errorMap = new Map<String, String>();
- Map<String, String> exitBarCodeMap = new Map<String, String>();
- List<Product2__c> product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Product2_Jancode__c,
- Pro2_Dealer_ENG__c,
- Pro2_Dealer_Object__c
- FROM Product2__c
- WHERE
- OT_CODE__c IN :allotCodeList
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- ];
- if (product2InStore.size() > 0) {
- for (Product2__c produ : product2InStore) {
- for (String bar : barOtcodeMap.keySet()) {
- if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
- exitBarCodeMap.put(bar, bar);
- errorMap.put(bar, bar);
- }
- }
- }
- }
- if (errorMap.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴穂' +
- userPro_Type +
- ']绫诲瀷涓嶇'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴穂' +
- userPro_Type +
- ']绫诲瀷涓嶇'
- )
- );
- }
- }
- product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Product2_Jancode__c,
- Pro2_Dealer_ENG__c,
- Pro2_Dealer_Object__c
- FROM Product2__c
- WHERE
- OT_CODE__c IN :allotCodeList
- AND Product_Type__c LIKE :userPro_Typestr
- ];
-
- if (product2InStore.size() > 0) {
- for (Product2__c produ : product2InStore) {
- for (String bar : barOtcodeMap.keySet()) {
- Date expirationDate = null;
+ public void inventoryEntryNoESetId (List<String> barCodeList){
+ //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
+ List<String> alljanCodeList = new List<String>();
+ List<String> allotCodeList = new List<String>();
+ List<String> barCode01List = new List<String>();
+ List<String> barCode241List = new List<String>();
+ Map<String,Map<String,String>> barJancodeMap = new Map<String,Map<String,String>>();
+ Map<String,Map<String,String>> barOtcodeMap = new Map<String,Map<String,String>>();
+ Map<String,List<String>> barcodeinfoMap = new Map<String,List<String>>();
+ Map<String,String> barcoderightMap = new Map<String,String>();
+ notInStorelist.clear();
+ for(Integer i = 0; i < barCodeList.size(); i++){
+ Date expirationDate = null ;
String serialNoorLotNo = '';
String tracingCode = '';
String productDateStr = '';
- Date productionDate = null;
+ Date productionDate = null ;
String expirationDateStr = '';
- if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
- Integer oTcodeLength = produ.OT_CODE__c.length();
- if (bar.length() >= oTcodeLength + 11) {
- if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '11') {
- try {
- productDateStr =
- '20' +
- bar.substring(oTcodeLength + 5, oTcodeLength + 7) +
- '-' +
- bar.substring(oTcodeLength + 7, oTcodeLength + 9) +
- '-01';
- productionDate = Date.valueOf(productDateStr);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (bar.length() >= oTcodeLength + 3 + 16) {
- if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '17'
- ) {
- try {
- if (
- bar.substring(
- oTcodeLength + 3 + 14,
- oTcodeLength + 3 + 16
- ) == '00'
- ) {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 10,
- oTcodeLength + 3 + 12
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 12,
- oTcodeLength + 3 + 14
- ) +
- '-' +
- '01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 10,
- oTcodeLength + 3 + 12
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 12,
- oTcodeLength + 3 + 14
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 14,
- oTcodeLength + 3 + 16
- );
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
+ if(barCodeList[i].length() >= 3){
+ if(barCodeList[i].substring(0,2) =='01'){
+ String janCodeMark = '';
+ //鐢熶骇鏃ユ湡
+ List<String> janCode = new List<String>();
+ if(barCodeList[i].length() < 16){
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
}
continue;
- }
- if (bar.length() >= oTcodeLength + 3 + 25) {
- if (
- bar.substring(
- oTcodeLength + 3 + 16,
- oTcodeLength + 3 + 18
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 16,
- oTcodeLength + 3 + 18
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 18,
- bar.length() - 8
- );
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
+ }else {
+ //if(barCodeList[i].substring(0,2) !='01'){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode锛屼笉绗﹀悎瑕佹眰锛�'));
+ // return;
+ //}
+ janCodeMark = barCodeList[i].substring(2,16);
+ try{
+ Decimal test = Decimal.valueOf(janCodeMark);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'));
+ }
+ continue;
}
- }
- } else if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 10,
- bar.length() - 8
- );
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
}
- }
- } else if (
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '17'
- ) {
- try {
- if (
- bar.substring(
- oTcodeLength + 3 + 6,
- oTcodeLength + 3 + 8
- ) == '00'
- ) {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 2,
- oTcodeLength + 3 + 4
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 4,
- oTcodeLength + 3 + 6
- ) +
- '-01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 2,
- oTcodeLength + 3 + 4
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 4,
- oTcodeLength + 3 + 6
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 6,
- oTcodeLength + 3 + 8
- );
- expirationDate = Date.valueOf(expirationDateStr);
+ if(barCodeList[i].length() >= 22){
+ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+ }
+ continue;
+ }
+ if( barCodeList[i].substring(16,18) =='11'){
+ try{
+ productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ;
+ productionDate = Date.valueOf(productDateStr);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >=32){
+ if( barCodeList[i].substring(24,26) =='17'){
+ try{
+ if(barCodeList[i].substring(30,32)=='00'){
+ expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' + '01' ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' +barCodeList[i].substring(30,32) ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >= 42){
+ if(barCodeList[i].substring(32,34) =='10' || barCodeList[i].substring(32,34) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(34,barCodeList[i].length() - 8) ;
+ }
+ }
+ }else if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+ }
+ }
+ }else if(barCodeList[i].substring(16,18) =='17'){
+ try{
+ if(barCodeList[i].substring(22,24)=='00'){
+ expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01';
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-' +barCodeList[i].substring(22,24);
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >= 34){
+ if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+ }
+ }
+
+ }else if(barCodeList[i].length() >= 26){
+ if(barCodeList[i].substring(16,18) =='10' || barCodeList[i].substring(16,18) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(18,barCodeList[i].length() - 8) ;
+ }
+ }
}
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
+ if(barCodeList[i].length() >= 24 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
+ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
+ tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length());
+ Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (tracingCode.length() == 5) {
+ String tr = tracingCode;
+ 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()) {
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'));
+ }
+ continue;
+ }
+ }
+ }
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'));
+ }
+ continue;
+ }
}
- continue;
- }
- if (bar.length() >= oTcodeLength + 20) {
- if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 10,
- bar.length() - 8
- );
- }
- }
- } else if (bar.length() >= oTcodeLength + 12) {
- if (
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '10' ||
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 2,
- bar.length() - 8
- );
- }
- }
- }
- if (
- bar.length() >= oTcodeLength + 3 + 8 &&
- bar.substring(bar.length() - 8, bar.length() - 5) == '250'
- ) {
- if (
- bar.substring(bar.length() - 8, bar.length() - 5) == '250'
- ) {
- tracingCode = bar.substring(bar.length() - 5, bar.length());
- Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (tracingCode.length() == 5) {
- String tr = tracingCode;
- 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(barCodeList[i]);
+ barcodedetList.add(String.valueOf(expirationDate));
+ barcodedetList.add(serialNoorLotNo);
+ barcodedetList.add(tracingCode);
+ Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
+ Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
+ Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
+ Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
+ Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
+ Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
+ Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
+ Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
+ Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
+ Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
+ Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
+ Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
+ Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
+
+ Integer count12 = jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
+ Integer count13 = jan1*3 + jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
+ String frost12 = (String.valueOf(count12)).substring((String.valueOf(count12)).length()-1);
+ String frost13 = (String.valueOf(count13)).substring((String.valueOf(count13)).length()-1);
+ //鍑忓幓12浣嶄釜浣�
+ frost12 = (String.valueOf(10 - Integer.valueOf(frost12))).substring((String.valueOf(10 - Integer.valueOf(frost12))).length()-1);
+ frost13 = (String.valueOf(10 - Integer.valueOf(frost13))).substring((String.valueOf(10 - Integer.valueOf(frost13))).length()-1);
+ janCode.add(janCodeMark.substring(1, 13) + frost12);
+ janCode.add(janCodeMark.substring(0, 13) + frost12);
+ janCode.add(janCodeMark.substring(1, 13) + frost13);
+ janCode.add(janCodeMark.substring(0, 13) + frost13);
+ alljanCodeList.addAll(janCode);
+ Map<String,String> janCodeMap = new Map<String,String>();
+ janCodeMap.put(janCodeMark.substring(1, 13) + frost12,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(0, 13) + frost12,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(1, 13) + frost13,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(0, 13) + frost13,barCodeList[i]);
+ barJancodeMap.put(barCodeList[i], janCodeMap);
+ barcodeinfoMap.put(barCodeList[i], barcodedetList);
+ barCode01List.add(barCodeList[i]);
+ }else if(barCodeList[i].substring(0,3) =='241'){
+ if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- )
- );
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
}
continue;
- }
}
- // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
- }
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'
- )
- );
- }
- continue;
+ List<String> otCodeList = new List<String>();
+ Map<String,String> otCodeMap = new Map<String,String>();
+ if(barCodeList[i].length() < 7){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+ }
+ continue;
+ }else if(barCodeList[i].length() == 11){
+ String otCode4 = barCodeList[i].substring(3,7);
+ String otCode5 = barCodeList[i].substring(3,8);
+ String otCode6 = barCodeList[i].substring(3,9);
+ String otCode7 = barCodeList[i].substring(3,10);
+ String otCode8 = barCodeList[i].substring(3,11);
+ otCodeList.add(otCode4);
+ otCodeList.add(otCode5);
+ otCodeList.add(otCode6);
+ otCodeList.add(otCode7);
+ otCodeList.add(otCode8);
+ otCodeMap.put(otCode4,barCodeList[i]);
+ otCodeMap.put(otCode5,barCodeList[i]);
+ otCodeMap.put(otCode6,barCodeList[i]);
+ otCodeMap.put(otCode7,barCodeList[i]);
+ otCodeMap.put(otCode8,barCodeList[i]);
+ }else if(barCodeList[i].length() >= 12){
+ String otCode4 = barCodeList[i].substring(3,7);
+ String otCode5 = barCodeList[i].substring(3,8);
+ String otCode6 = barCodeList[i].substring(3,9);
+ String otCode7 = barCodeList[i].substring(3,10);
+ String otCode8 = barCodeList[i].substring(3,11);
+ String otCode9 = barCodeList[i].substring(3,12);
+ otCodeList.add(otCode4);
+ otCodeList.add(otCode5);
+ otCodeList.add(otCode6);
+ otCodeList.add(otCode7);
+ otCodeList.add(otCode8);
+ otCodeList.add(otCode9);
+ otCodeMap.put(otCode4,barCodeList[i]);
+ otCodeMap.put(otCode5,barCodeList[i]);
+ otCodeMap.put(otCode6,barCodeList[i]);
+ otCodeMap.put(otCode7,barCodeList[i]);
+ otCodeMap.put(otCode8,barCodeList[i]);
+ otCodeMap.put(otCode9,barCodeList[i]);
+ }
+ allotCodeList.addAll(otCodeList);
+ barOtcodeMap.put(barCodeList[i], otCodeMap);
+ barCode241List.add(barCodeList[i]);
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'));
+ }
+ continue;
}
- }
- exitBarCodeMap.put(bar, bar);
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(bar);
- barcodedetList.add(String.valueOf(expirationDate));
- barcodedetList.add(serialNoorLotNo);
- barcodedetList.add(tracingCode);
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodedetList)
- );
- consumableInventoryUse.add(
- new ConsumableorderdetailsInfo(produ, barcodedetList)
- );
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'));
+ }
+ continue;
}
- }
}
- }
- for (String bartxt : barCode241List) {
- if (!exitBarCodeMap.containsKey(bartxt)) {
- if (!errorMap.containsKey(bartxt)) {
- notInStorelist.add(bartxt);
- }
+ //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
+ //-----------XHL--------------UpdateSTART----------------20181010------
+ if(alljanCodeList.size() > 0){
+ List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
+ Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+ FROM Product2__c
+ WHERE Product2_Jancode__c in :alljanCodeList
+ order by SFDA_Expiration_Date__c desc ] ;
+ if(product2InStore.size() > 0){
+ // CHAN-AVSAST
+ Map<String,String> rightBar = new Map<String,String>();
+ Map<String,String> errorMap = new Map<String,String>();
+ for(String bar: barJancodeMap.keySet() ){
+ Integer cou = 0;
+ for(Product2__c produ: product2InStore){
+ if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
+ cou ++;
+ if(EngFlag == TRUE && produ.Pro2_Dealer_ENG__c == TRUE){
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ rightBar.put(bar, bar);
+ }else if(ETFlag == TRUE && produ.Pro2_Dealer_Object__c == TRUE){
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ rightBar.put(bar, bar);
+ }else{
+ errorMap.put(bar, bar);
+ }
+ }
+
+ }
+ if(cou <= 0 ){
+ notInStorelist.add(bar);
+ }
+ }
+ if(errorMap.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇'));
+ }
+ }
+ }
}
- }
- }
- }
+
+ //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
+ if(allotCodeList.size() > 0){
+ Map<String,String> errorMap = new Map<String,String>();
+ Map<String,String> exitBarCodeMap = new Map<String,String>();
+ List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
+ Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+ FROM Product2__c
+ WHERE OT_CODE__c in :allotCodeList
+ AND (not Product_Type__c like :userPro_Typestr)] ;
+ if(product2InStore.size() > 0){
+
+ for(Product2__c produ: product2InStore){
+ for(String bar: barOtcodeMap.keySet() ){
+ if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
+ exitBarCodeMap.put(bar,bar);
+ errorMap.put(bar, bar);
+ }
+ }
+ }
+ }
+ if(errorMap.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'));
+ }
+ }
+ product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
+ Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+ FROM Product2__c
+ WHERE OT_CODE__c in :allotCodeList
+ AND Product_Type__c like :userPro_Typestr] ;
+
+ if(product2InStore.size() > 0){
+
+ for(Product2__c produ: product2InStore){
+ for(String bar: barOtcodeMap.keySet() ){
+ Date expirationDate = null ;
+ String serialNoorLotNo = '';
+ String tracingCode = '';
+ String productDateStr = '';
+ Date productionDate = null ;
+ String expirationDateStr = '';
+ if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
+ Integer oTcodeLength = produ.OT_CODE__c.length();
+ if(bar.length() >= oTcodeLength + 11){
+ if( bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='11'){
+ try{
+ productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ;
+ productionDate = Date.valueOf(productDateStr);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >=oTcodeLength + 3 + 16){
+ if( bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='17'){
+ try{
+ if(bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16)=='00'){
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' + '01' ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' +bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16) ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >= oTcodeLength + 3 + 25){
+ if(bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='10' || bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18,bar.length() - 8) ;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
+ }
+ }
+ }else if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
+ }
+ }
+ }else if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='17'){
+ try{
+ if(bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8)=='00'){
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-01';
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-' +bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8);
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >=oTcodeLength + 20){
+ if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+ }
+ }
- public void inventoryEntry(List<String> barCodeList) {
- //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
- List<String> alljanCodeList = new List<String>();
- List<String> allotCodeList = new List<String>();
- List<String> barCode01List = new List<String>();
- List<String> barCode241List = new List<String>();
- Map<String, Map<String, String>> barJancodeMap = new Map<String, Map<String, String>>();
- Map<String, Map<String, String>> barOtcodeMap = new Map<String, Map<String, String>>();
- Map<String, List<String>> barcodeinfoMap = new Map<String, List<String>>();
- notInStorelist.clear();
- notEqualBARcodeCunMap.clear();
- Map<String, String> orderdetailMap = new Map<String, String>();
- List<Consumable_Orderdetails__c> orderdetail = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_Product__c,
- Asset_Model_No__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__r.Dealer_Info__c = :accountid
- AND Consumable_order__c != NULL
- AND Consumable_order__c = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- ORDER BY Name
- ];
- for (Integer i = 0; i < orderdetail.size(); i++) {
- orderdetailMap.put(
- orderdetail[i].Consumable_Product__c,
- orderdetail[i].Consumable_Product__c
- );
+ }else if(bar.length() >= oTcodeLength + 12){
+ if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='10' || bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2,bar.length() - 8) ;
+ }
+ }
+ }
+ if(bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8,bar.length()-5)=='250'){
+ if(bar.substring(bar.length() - 8,bar.length()-5)=='250'){
+ tracingCode = bar.substring(bar.length() - 5,bar.length());
+ Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (tracingCode.length() == 5) {
+ String tr = tracingCode;
+ 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'));
+ }
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'));
+ }
+ continue;
+ }
+ }
+ exitBarCodeMap.put(bar,bar);
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(bar);
+ barcodedetList.add(String.valueOf(expirationDate));
+ barcodedetList.add(serialNoorLotNo);
+ barcodedetList.add(tracingCode);
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
+ consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
+
+ }
+ }
+
+ }
+ }
+ for(String bartxt :barCode241List){
+ if(!exitBarCodeMap.containsKey(bartxt)){
+ if(!errorMap.containsKey(bartxt)){
+ notInStorelist.add(bartxt);
+ }
+ }
+ }
+ }
+
}
- for (Integer i = 0; i < barCodeList.size(); i++) {
- Date expirationDate = null;
- String serialNoorLotNo = '';
- String tracingCode = '';
- String productDateStr = '';
- Date productionDate = null;
- String expirationDateStr = '';
- if (barCodeList[i].substring(0, 2) == '01') {
- String janCodeMark = '';
- //鐢熶骇鏃ユ湡
- List<String> janCode = new List<String>();
- if (barCodeList[i].length() < 16) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- )
- );
- }
- continue;
- } else {
- janCodeMark = barCodeList[i].substring(2, 16);
- try {
- Decimal test = Decimal.valueOf(janCodeMark);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'
- )
- );
- }
- continue;
- }
+ public void inventoryEntry (List<String> barCodeList){
+ //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
+ List<String> alljanCodeList = new List<String>();
+ List<String> allotCodeList = new List<String>();
+ List<String> barCode01List = new List<String>();
+ List<String> barCode241List = new List<String>();
+ Map<String,Map<String,String>> barJancodeMap = new Map<String,Map<String,String>>();
+ Map<String,Map<String,String>> barOtcodeMap = new Map<String,Map<String,String>>();
+ Map<String,List<String>> barcodeinfoMap = new Map<String,List<String>>();
+ notInStorelist.clear();
+ notEqualBARcodeCunMap.clear();
+ Map<String,String> orderdetailMap = new Map<String,String>();
+ List<Consumable_Orderdetails__c> orderdetail = [SELECT Id, Name, Consumable_order__c,
+ Consumable_Product__c,Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__r.Dealer_Info__c = :accountid
+ AND Consumable_order__c != null
+ AND Consumable_order__c = :ESetId
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name ];
+ for(Integer i = 0; i < orderdetail.size(); i++){
+ orderdetailMap.put(orderdetail[i].Consumable_Product__c, orderdetail[i].Consumable_Product__c);
}
- if (barCodeList[i].length() >= 22) {
- if (
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) != '250'
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].substring(16, 18) == '11') {
- try {
- productDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-01';
- productionDate = Date.valueOf(productDateStr);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 32) {
- if (barCodeList[i].substring(24, 26) == '17') {
- try {
- if (barCodeList[i].substring(30, 32) == '00') {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(26, 28) +
- '-' +
- barCodeList[i].substring(28, 30) +
- '-' +
- '01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(26, 28) +
- '-' +
- barCodeList[i].substring(28, 30) +
- '-' +
- barCodeList[i].substring(30, 32);
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 42) {
- if (
- barCodeList[i].substring(32, 34) == '10' ||
- barCodeList[i].substring(32, 34) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(34, barCodeList[i].length() - 8);
- }
- }
- } else if (
- barCodeList[i].substring(24, 26) == '10' ||
- barCodeList[i].substring(24, 26) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(26, barCodeList[i].length() - 8);
- }
- }
- } else if (barCodeList[i].substring(16, 18) == '17') {
- try {
- if (barCodeList[i].substring(22, 24) == '00') {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-01';
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- barCodeList[i].substring(18, 20) +
- '-' +
- barCodeList[i].substring(20, 22) +
- '-' +
- barCodeList[i].substring(22, 24);
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (barCodeList[i].length() >= 34) {
- if (
- barCodeList[i].substring(24, 26) == '10' ||
- barCodeList[i].substring(24, 26) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(26, barCodeList[i].length() - 8);
- }
- }
- } else if (barCodeList[i].length() >= 26) {
- if (
- barCodeList[i].substring(16, 18) == '10' ||
- barCodeList[i].substring(16, 18) == '21'
- ) {
- serialNoorLotNo = barCodeList[i]
- .substring(18, barCodeList[i].length() - 8);
- }
- }
- }
- if (
- barCodeList[i].length() >= 24 &&
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) == '250'
- ) {
- if (
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) == '250'
- ) {
- tracingCode = barCodeList[i]
- .substring(barCodeList[i].length() - 5, barCodeList[i].length());
- Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (tracingCode.length() == 5) {
- String tr = tracingCode;
- 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- )
- );
- }
- continue;
- }
- }
- // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
- }
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'
- )
- );
- }
- continue;
- }
- }
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(barCodeList[i]);
- barcodedetList.add(String.valueOf(expirationDate));
- barcodedetList.add(serialNoorLotNo);
- barcodedetList.add(tracingCode);
- Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
- Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
- Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
- Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
- Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
- Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
- Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
- Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
- Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
- Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
- Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
- Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
- Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
- Integer count12 =
- jan2 +
- jan3 * 3 +
- jan4 +
- jan5 * 3 +
- jan6 +
- jan7 * 3 +
- jan8 +
- jan9 * 3 +
- jan10 +
- jan11 * 3 +
- jan12 +
- jan13 * 3;
- Integer count13 =
- jan1 * 3 +
- jan2 +
- jan3 * 3 +
- jan4 +
- jan5 * 3 +
- jan6 +
- jan7 * 3 +
- jan8 +
- jan9 * 3 +
- jan10 +
- jan11 * 3 +
- jan12 +
- jan13 * 3;
- String frost12 = (String.valueOf(count12))
- .substring((String.valueOf(count12)).length() - 1);
- String frost13 = (String.valueOf(count13))
- .substring((String.valueOf(count13)).length() - 1);
- //鍑忓幓12浣嶄釜浣�4
- frost12 = (String.valueOf(10 - Integer.valueOf(frost12)))
- .substring(
- (String.valueOf(10 - Integer.valueOf(frost12))).length() - 1
- );
- frost13 = (String.valueOf(10 - Integer.valueOf(frost13)))
- .substring(
- (String.valueOf(10 - Integer.valueOf(frost13))).length() - 1
- );
-
- janCode.add(janCodeMark.substring(1, 13) + frost12);
- janCode.add(janCodeMark.substring(0, 13) + frost12);
- janCode.add(janCodeMark.substring(1, 13) + frost13);
- janCode.add(janCodeMark.substring(0, 13) + frost13);
- alljanCodeList.addAll(janCode);
- Map<String, String> janCodeMap = new Map<String, String>();
- janCodeMap.put(janCodeMark.substring(1, 13) + frost12, barCodeList[i]);
- janCodeMap.put(janCodeMark.substring(0, 13) + frost12, barCodeList[i]);
- janCodeMap.put(janCodeMark.substring(1, 13) + frost13, barCodeList[i]);
- janCodeMap.put(janCodeMark.substring(0, 13) + frost13, barCodeList[i]);
- barJancodeMap.put(barCodeList[i], janCodeMap);
- barcodeinfoMap.put(barCodeList[i], barcodedetList);
- barCode01List.add(barCodeList[i]);
- } else if (barCodeList[i].substring(0, 3) == '241') {
- if (
- barCodeList[i].length() > 8 &&
- barCodeList[i]
- .substring(
- barCodeList[i].length() - 8,
- barCodeList[i].length() - 5
- ) != '250'
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'
- )
- );
- }
- continue;
- }
- List<String> otCodeList = new List<String>();
- Map<String, String> otCodeMap = new Map<String, String>();
- if (barCodeList[i].length() < 7) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
- )
- );
- }
- continue;
- } else if (barCodeList[i].length() == 11) {
- String otCode4 = barCodeList[i].substring(3, 7);
- String otCode5 = barCodeList[i].substring(3, 8);
- String otCode6 = barCodeList[i].substring(3, 9);
- String otCode7 = barCodeList[i].substring(3, 10);
- String otCode8 = barCodeList[i].substring(3, 11);
- otCodeList.add(otCode4);
- otCodeList.add(otCode5);
- otCodeList.add(otCode6);
- otCodeList.add(otCode7);
- otCodeList.add(otCode8);
- otCodeMap.put(otCode4, barCodeList[i]);
- otCodeMap.put(otCode5, barCodeList[i]);
- otCodeMap.put(otCode6, barCodeList[i]);
- otCodeMap.put(otCode7, barCodeList[i]);
- otCodeMap.put(otCode8, barCodeList[i]);
- } else if (barCodeList[i].length() >= 12) {
- String otCode4 = barCodeList[i].substring(3, 7);
- String otCode5 = barCodeList[i].substring(3, 8);
- String otCode6 = barCodeList[i].substring(3, 9);
- String otCode7 = barCodeList[i].substring(3, 10);
- String otCode8 = barCodeList[i].substring(3, 11);
- String otCode9 = barCodeList[i].substring(3, 12);
- otCodeList.add(otCode4);
- otCodeList.add(otCode5);
- otCodeList.add(otCode6);
- otCodeList.add(otCode7);
- otCodeList.add(otCode8);
- otCodeList.add(otCode9);
- otCodeMap.put(otCode4, barCodeList[i]);
- otCodeMap.put(otCode5, barCodeList[i]);
- otCodeMap.put(otCode6, barCodeList[i]);
- otCodeMap.put(otCode7, barCodeList[i]);
- otCodeMap.put(otCode8, barCodeList[i]);
- otCodeMap.put(otCode9, barCodeList[i]);
- }
- allotCodeList.addAll(otCodeList);
- barOtcodeMap.put(barCodeList[i], otCodeMap);
- barCode241List.add(barCodeList[i]);
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- barCodeList[i] +
- ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�'
- )
- );
- }
- continue;
- }
- }
- //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
- Map<String, String> rightBar = new Map<String, String>();
- if (alljanCodeList.size() > 0) {
- Map<String, String> exitBarCodeMap = new Map<String, String>();
- List<Product2__c> product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Product2_Jancode__c,
- Pro2_Dealer_ENG__c,
- Pro2_Dealer_Object__c,
- Product_Type__c
- FROM Product2__c
- WHERE
- Product2_Jancode__c IN :alljanCodeList
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- ORDER BY SFDA_Expiration_Date__c DESC
- ];
- if (product2InStore.size() > 0) {
- Map<String, String> errorMap = new Map<String, String>();
- for (Product2__c produ : product2InStore) {
- for (String bar : barJancodeMap.keySet()) {
- if (
- barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) &&
- !rightBar.containsKey(bar)
- ) {
- exitBarCodeMap.put(bar, bar);
- errorMap.put(bar, bar);
- }
- }
- }
- if (errorMap.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇'
- )
- );
- }
- }
- }
- product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Product2_Jancode__c,
- Pro2_Dealer_ENG__c,
- Pro2_Dealer_Object__c,
- Product_Type__c
- FROM Product2__c
- WHERE
- Product2_Jancode__c IN :alljanCodeList
- AND Product_Type__c LIKE :userPro_Typestr
- ORDER BY SFDA_Expiration_Date__c DESC
- ];
- if (product2InStore.size() > 0) {
- Map<String, String> errorMap = new Map<String, String>();
- for (Product2__c produ : product2InStore) {
- for (String bar : barJancodeMap.keySet()) {
- if (
- barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) &&
- !rightBar.containsKey(bar)
- ) {
- exitBarCodeMap.put(bar, bar);
- if (orderdetailMap.containsKey(produ.Id)) {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- rightBar.put(bar, bar);
- } else {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar))
- );
- rightBar.put(bar, bar);
- list<String> overOrderBARcodeCunList = new List<String>();
- if (notEqualBARcodeCunMap.containsKey(produ.Id)) {
- overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id)
- .clone();
- overOrderBARcodeCunList.add(bar);
- notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
- } else {
- overOrderBARcodeCunList.add(bar);
- notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
- }
- }
- }
- }
- }
- }
- for (String bartxt : barCode01List) {
- if (!exitBarCodeMap.containsKey(bartxt)) {
- notInStorelist.add(bartxt);
- }
- }
- }
-
- //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
- if (allotCodeList.size() > 0) {
- Map<String, String> exitBarCodeMap = new Map<String, String>();
- Map<String, String> errorMap = new Map<String, String>();
- List<Product2__c> product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Pro2_Dealer_Object__c,
- Pro2_Dealer_ENG__c
- FROM Product2__c
- WHERE
- OT_CODE__c IN :allotCodeList
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- ];
- if (product2InStore.size() > 0) {
- for (Product2__c produ : product2InStore) {
- for (String bar : barOtcodeMap.keySet()) {
- if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
- exitBarCodeMap.put(bar, bar);
- errorMap.put(bar, bar);
- }
- }
- }
- }
- if (errorMap.size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴穂' +
- userPro_Type +
- ']绫诲瀷涓嶇'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- 'BarCode鍙穂' +
- errorMap.values() +
- ']浜у搧绫诲瀷[' +
- product_Type +
- ']涓庣敤鎴穂' +
- userPro_Type +
- ']绫诲瀷涓嶇'
- )
- );
- }
- }
- product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c,
- Pro2_Dealer_Object__c,
- Pro2_Dealer_ENG__c
- FROM Product2__c
- WHERE
- OT_CODE__c IN :allotCodeList
- AND Product_Type__c LIKE :userPro_Typestr
- ];
-
- if (product2InStore.size() > 0) {
- for (Product2__c produ : product2InStore) {
- for (String bar : barOtcodeMap.keySet()) {
- Date expirationDate = null;
+ for(Integer i = 0; i < barCodeList.size(); i++){
+ Date expirationDate = null ;
String serialNoorLotNo = '';
String tracingCode = '';
String productDateStr = '';
- Date productionDate = null;
+ Date productionDate = null ;
String expirationDateStr = '';
- Integer oTcodeLength = produ.OT_CODE__c.length();
- if (bar.length() >= oTcodeLength + 11) {
- if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '11') {
- try {
- productDateStr =
- '20' +
- bar.substring(oTcodeLength + 5, oTcodeLength + 7) +
- '-' +
- bar.substring(oTcodeLength + 7, oTcodeLength + 9) +
- '-01';
- productionDate = Date.valueOf(productDateStr);
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勭敓浜ф棩鏈�' +
- productDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (bar.length() >= oTcodeLength + 3 + 16) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode17' + bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10)));
- if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '17'
- ) {
- try {
- if (
- bar.substring(
- oTcodeLength + 3 + 14,
- oTcodeLength + 3 + 16
- ) == '00'
- ) {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 10,
- oTcodeLength + 3 + 12
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 12,
- oTcodeLength + 3 + 14
- ) +
- '-' +
- '01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 10,
- oTcodeLength + 3 + 12
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 12,
- oTcodeLength + 3 + 14
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 14,
- oTcodeLength + 3 + 16
- );
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
+ if(barCodeList[i].substring(0,2) =='01'){
+ String janCodeMark = '';
+ //鐢熶骇鏃ユ湡
+ List<String> janCode = new List<String>();
+ if(barCodeList[i].length() < 16){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
}
- if (bar.length() >= oTcodeLength + 3 + 25) {
- if (
- bar.substring(
- oTcodeLength + 3 + 16,
- oTcodeLength + 3 + 18
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 16,
- oTcodeLength + 3 + 18
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 18,
- bar.length() - 8
- );
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
- }
+ continue;
+ }else {
+ janCodeMark = barCodeList[i].substring(2,16);
+ try{
+ Decimal test = Decimal.valueOf(janCodeMark);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'));
+ }
+ continue;
}
- } else if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 10,
- bar.length() - 8
- );
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
- }
}
- } else if (
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '17'
- ) {
- try {
- if (
- bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8) ==
- '00'
- ) {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 2,
- oTcodeLength + 3 + 4
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 4,
- oTcodeLength + 3 + 6
- ) +
- '-01';
- expirationDate = Date.valueOf(expirationDateStr);
- expirationDate = expirationDate.addMonths(1)
- .toStartofMonth()
- .addDays(-1);
- } else {
- expirationDateStr =
- '20' +
- bar.substring(
- oTcodeLength + 3 + 2,
- oTcodeLength + 3 + 4
- ) +
- '-' +
- bar.substring(
- oTcodeLength + 3 + 4,
- oTcodeLength + 3 + 6
- ) +
- '-' +
- bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8);
- expirationDate = Date.valueOf(expirationDateStr);
- }
- } catch (Exception e) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')鐨勬粎鑿屾湁鍔规湡闄�' +
- expirationDateStr +
- '閿欒锛�'
- )
- );
- }
- continue;
- }
- if (bar.length() >= oTcodeLength + 20) {
- if (
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '10' ||
- bar.substring(
- oTcodeLength + 3 + 8,
- oTcodeLength + 3 + 10
- ) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 10,
- bar.length() - 8
- );
- }
- }
- } else if (bar.length() >= oTcodeLength + 12) {
- if (
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '10' ||
- bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '21'
- ) {
- serialNoorLotNo = bar.substring(
- oTcodeLength + 3 + 2,
- bar.length() - 8
- );
- }
- }
- }
- if (
- bar.length() >= oTcodeLength + 3 + 8 &&
- bar.substring(bar.length() - 8, bar.length() - 5) == '250'
- ) {
- if (bar.substring(bar.length() - 8, bar.length() - 5) == '250') {
- tracingCode = bar.substring(bar.length() - 5, bar.length());
- Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (tracingCode.length() == 5) {
- String tr = tracingCode;
- 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add(
- '浜у搧BarCode(' +
- bar +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' +
- bar +
- ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'
- )
- );
- }
- continue;
+ if(barCodeList[i].length() >= 22){
+ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+ }
+ continue;
}
- }
- // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ if( barCodeList[i].substring(16,18) =='11'){
+ try{
+ productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ;
+ productionDate = Date.valueOf(productDateStr);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >=32){
+ if( barCodeList[i].substring(24,26) =='17'){
+ try{
+ if(barCodeList[i].substring(30,32)=='00'){
+ expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' + '01' ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' +barCodeList[i].substring(30,32) ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >= 42){
+ if(barCodeList[i].substring(32,34) =='10' || barCodeList[i].substring(32,34) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(34,barCodeList[i].length() - 8) ;
+ }
+ }
+ }else if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+ }
+ }
+ }else if(barCodeList[i].substring(16,18) =='17'){
+ try{
+ if(barCodeList[i].substring(22,24)=='00'){
+ expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01';
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-' +barCodeList[i].substring(22,24);
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(barCodeList[i].length() >= 34){
+ if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+ }
+ }
+
+ }else if(barCodeList[i].length() >= 26){
+ if(barCodeList[i].substring(16,18) =='10' || barCodeList[i].substring(16,18) =='21'){
+ serialNoorLotNo = barCodeList[i].substring(18,barCodeList[i].length() - 8) ;
+ }
+ }
}
- } else {
+ if(barCodeList[i].length() >= 24 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
+ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
+ tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length());
+ Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (tracingCode.length() == 5) {
+ String tr = tracingCode;
+ 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'));
+ }
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'));
+ }
+ continue;
+ }
+ }
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(barCodeList[i]);
+ barcodedetList.add(String.valueOf(expirationDate));
+ barcodedetList.add(serialNoorLotNo);
+ barcodedetList.add(tracingCode);
+ Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
+ Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
+ Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
+ Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
+ Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
+ Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
+ Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
+ Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
+ Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
+ Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
+ Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
+ Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
+ Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
+ Integer count12 = jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
+
+ Integer count13 = jan1*3 + jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
+ String frost12 = (String.valueOf(count12)).substring((String.valueOf(count12)).length()-1);
+ String frost13 = (String.valueOf(count13)).substring((String.valueOf(count13)).length()-1);
+ //鍑忓幓12浣嶄釜浣�4
+ frost12 = (String.valueOf(10 - Integer.valueOf(frost12))).substring((String.valueOf(10 - Integer.valueOf(frost12))).length()-1);
+ frost13 = (String.valueOf(10 - Integer.valueOf(frost13))).substring((String.valueOf(10 - Integer.valueOf(frost13))).length()-1);
+
+ janCode.add(janCodeMark.substring(1, 13) + frost12);
+ janCode.add(janCodeMark.substring(0, 13) + frost12);
+ janCode.add(janCodeMark.substring(1, 13) + frost13);
+ janCode.add(janCodeMark.substring(0, 13) + frost13);
+ alljanCodeList.addAll(janCode);
+ Map<String,String> janCodeMap = new Map<String,String>();
+ janCodeMap.put(janCodeMark.substring(1, 13) + frost12,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(0, 13) + frost12,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(1, 13) + frost13,barCodeList[i]);
+ janCodeMap.put(janCodeMark.substring(0, 13) + frost13,barCodeList[i]);
+ barJancodeMap.put(barCodeList[i], janCodeMap);
+ barcodeinfoMap.put(barCodeList[i], barcodedetList);
+ barCode01List.add(barCodeList[i]);
+ }else if(barCodeList[i].substring(0,3) =='241'){
+ if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+ }
+ continue;
+ }
+ List<String> otCodeList = new List<String>();
+ Map<String,String> otCodeMap = new Map<String,String>();
+ if(barCodeList[i].length() < 7){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+ }
+ continue;
+ }else if(barCodeList[i].length() == 11){
+ String otCode4 = barCodeList[i].substring(3,7);
+ String otCode5 = barCodeList[i].substring(3,8);
+ String otCode6 = barCodeList[i].substring(3,9);
+ String otCode7 = barCodeList[i].substring(3,10);
+ String otCode8 = barCodeList[i].substring(3,11);
+ otCodeList.add(otCode4);
+ otCodeList.add(otCode5);
+ otCodeList.add(otCode6);
+ otCodeList.add(otCode7);
+ otCodeList.add(otCode8);
+ otCodeMap.put(otCode4,barCodeList[i]);
+ otCodeMap.put(otCode5,barCodeList[i]);
+ otCodeMap.put(otCode6,barCodeList[i]);
+ otCodeMap.put(otCode7,barCodeList[i]);
+ otCodeMap.put(otCode8,barCodeList[i]);
+ }else if(barCodeList[i].length() >= 12){
+ String otCode4 = barCodeList[i].substring(3,7);
+ String otCode5 = barCodeList[i].substring(3,8);
+ String otCode6 = barCodeList[i].substring(3,9);
+ String otCode7 = barCodeList[i].substring(3,10);
+ String otCode8 = barCodeList[i].substring(3,11);
+ String otCode9 = barCodeList[i].substring(3,12);
+ otCodeList.add(otCode4);
+ otCodeList.add(otCode5);
+ otCodeList.add(otCode6);
+ otCodeList.add(otCode7);
+ otCodeList.add(otCode8);
+ otCodeList.add(otCode9);
+ otCodeMap.put(otCode4,barCodeList[i]);
+ otCodeMap.put(otCode5,barCodeList[i]);
+ otCodeMap.put(otCode6,barCodeList[i]);
+ otCodeMap.put(otCode7,barCodeList[i]);
+ otCodeMap.put(otCode8,barCodeList[i]);
+ otCodeMap.put(otCode9,barCodeList[i]);
+ }
+ allotCodeList.addAll(otCodeList);
+ barOtcodeMap.put(barCodeList[i], otCodeMap);
+ barCode241List.add(barCodeList[i]);
+ }else{
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- errorList.add('浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'
- )
- );
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�'));
}
continue;
- }
}
- List<String> barcodedetList = new List<String>();
- barcodedetList.add(bar);
- barcodedetList.add(String.valueOf(expirationDate));
- barcodedetList.add(serialNoorLotNo);
- barcodedetList.add(tracingCode);
- if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
- exitBarCodeMap.put(bar, bar);
+ }
+ //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
+ Map<String,String> rightBar = new Map<String,String>();
+ if(alljanCodeList.size() > 0){
+ Map<String,String> exitBarCodeMap = new Map<String,String>();
+ List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
+ Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c,
+ Product_Type__c
+ FROM Product2__c
+ WHERE Product2_Jancode__c in :alljanCodeList
+ AND (not Product_Type__c like :userPro_Typestr)
+ order by SFDA_Expiration_Date__c desc ] ;
+ if(product2InStore.size() > 0){
+ Map<String,String> errorMap = new Map<String,String>();
+ for(Product2__c produ: product2InStore){
+ for(String bar: barJancodeMap.keySet() ){
+ if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
+ exitBarCodeMap.put(bar,bar);
+ errorMap.put(bar, bar);
+ }
- if (orderdetailMap.containsKey(produ.Id)) {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodedetList)
- );
- } else {
- consumableInventory.add(
- new ConsumableorderdetailsInfo(produ, barcodedetList)
- );
- list<String> overOrderBARcodeCunList = new List<String>();
- if (notEqualBARcodeCunMap.containsKey(produ.Id)) {
- overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id)
- .clone();
- overOrderBARcodeCunList.add(bar);
- notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
- } else {
- overOrderBARcodeCunList.add(bar);
- notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
+ }
}
- }
+ if(errorMap.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇'));
+ }
+ }
+ }
+ product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
+ Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c,
+ Product_Type__c
+ FROM Product2__c
+ WHERE Product2_Jancode__c in :alljanCodeList
+ AND Product_Type__c like :userPro_Typestr
+ order by SFDA_Expiration_Date__c desc ] ;
+ if(product2InStore.size() > 0){
+ Map<String,String> errorMap = new Map<String,String>();
+ for(Product2__c produ: product2InStore){
+ for(String bar: barJancodeMap.keySet() ){
+ if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
+ exitBarCodeMap.put(bar,bar);
+ if(orderdetailMap.containsKey(produ.Id)){
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ rightBar.put(bar, bar);
+ }else{
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+ rightBar.put(bar, bar);
+ list<String> overOrderBARcodeCunList = new list<String>();
+ if(notEqualBARcodeCunMap.containsKey(produ.Id)){
+ overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id).clone();
+ overOrderBARcodeCunList.add(bar);
+ notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+ }else{
+ overOrderBARcodeCunList.add(bar);
+ notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+ }
+ }
+
+ }
+ }
+ }
}
- }
- }
- }
-
- for (String bartxt : barCode241List) {
- if (!exitBarCodeMap.containsKey(bartxt)) {
- if (!errorMap.containsKey(bartxt)) {
- notInStorelist.add(bartxt);
- }
- }
- }
- }
- //鍒ゆ柇浜у搧鏄惁涓�鑷�
- if (notEqualBARcodeCunMap.size() > 0) {
- for (String widget : notEqualBARcodeCunMap.keySet()) {
- if (notEqualBARcodeCunMap.get(widget).size() > 0) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add('浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��');
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.INFO,
- '浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��'
- )
- );
- }
- for (
- String barcodeListTTT : (List<String>) notEqualBARcodeCunMap.get(
- widget
- )
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add(barcodeListTTT);
- } else {
- ApexPages.addmessage(
- new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)
- );
+ for(String bartxt :barCode01List){
+ if(!exitBarCodeMap.containsKey(bartxt)){
+ notInStorelist.add(bartxt);
+ }
}
- }
+
}
- }
- }
- }
- public String ConfimResult() {
- list<String> overOrderproList = new List<String>();
- list<String> overOrderBARcodeCunList = new List<String>();
- list<String> overOrderBARcodeCunListTest = new List<String>();
- //overOrderBARcodeCunMap.clear();
- for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
- if (
- orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) +
- orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) >
- orderProductCunMap.get(ass.esd.Asset_Model_No__c) - 1
- ) {
- // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
- overOrderBARcodeCunList = new List<String>();
- overOrderBARcodeCunList = overOrderBARcodeCunMap.get(
- ass.esd.Asset_Model_No__c
- )
- .clone();
- overOrderBARcodeCunList.add(ass.esd.Bar_Code__c);
- overOrderBARcodeCunMap.put(
- ass.esd.Asset_Model_No__c,
- overOrderBARcodeCunList
- );
- overOrderCunMap.put(
- ass.esd.Asset_Model_No__c,
- overOrderCunMap.get(ass.esd.Asset_Model_No__c) + 1
- );
- cancellationProList.add(ass.esd.Asset_Model_No__c);
- } else if (
- orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) +
- orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) ==
- orderProductCunMap.get(ass.esd.Asset_Model_No__c) - 1
- ) {
- consumableorderdetailsRecordsUse.add(ass);
- cancellationProList.add(ass.esd.Asset_Model_No__c);
- } else {
- consumableorderdetailsRecordsUse.add(ass);
- }
- orderWantArriveCunMap.put(
- ass.esd.Asset_Model_No__c,
- orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + 1
- );
- }
- for (ConsumableorderdetailsInfo ass : consumableInventory) {
- if (!orderWantArriveCunMap.containsKey(ass.Prod.Asset_Model_No__c)) {
- consumableInventoryUse.add(ass);
- continue;
- }
- if (
- orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) +
- orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) >
- orderProductCunMap.get(ass.Prod.Asset_Model_No__c) - 1
- ) {
- //鍙栧緱鍘熸湁list
- overOrderBARcodeCunList = new List<String>();
- overOrderBARcodeCunList = overOrderBARcodeCunMap.get(
- ass.Prod.Asset_Model_No__c
- )
- .clone();
- //鏇存柊list
- overOrderBARcodeCunList.add(ass.barCodeNo);
- //鏇存柊map
- overOrderBARcodeCunMap.put(
- ass.Prod.Asset_Model_No__c,
- overOrderBARcodeCunList
- );
- overOrderCunMap.put(
- ass.Prod.Asset_Model_No__c,
- overOrderCunMap.get(ass.Prod.Asset_Model_No__c) + 1
- );
- cancellationProList.add(ass.Prod.Asset_Model_No__c);
- } else if (
- orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) +
- orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) ==
- orderProductCunMap.get(ass.Prod.Asset_Model_No__c) - 1
- ) {
- consumableInventoryUse.add(ass);
- cancellationProList.add(ass.Prod.Asset_Model_No__c);
- } else {
- consumableInventoryUse.add(ass);
- }
- orderWantArriveCunMap.put(
- ass.Prod.Asset_Model_No__c,
- orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + 1
- );
- }
- for (Integer i = 0; i < productList.size(); i++) {
- if (overOrderBARcodeCunMap.get(productList[i]).size() > 0) {
- // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
- overOrderproList.add(productList[i]);
- }
- }
- if (overOrderproList.size() > 0) {
- return '浜у搧' +
- overOrderproList +
- '鏈鍒拌揣鏁伴噺鍜屽凡鍒拌揣鏁伴噺宸茬粡瓒呰繃璁㈣揣鏁伴噺!';
- } else {
- return '';
- }
- }
+ //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
+ if(allotCodeList.size() > 0){
+ Map<String,String> exitBarCodeMap = new Map<String,String>();
+ Map<String,String> errorMap = new Map<String,String>();
+ List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,
+ Pro2_Dealer_Object__c,Pro2_Dealer_ENG__c
+ FROM Product2__c
+ WHERE OT_CODE__c in :allotCodeList
+ AND (not Product_Type__c like :userPro_Typestr)] ;
+ if(product2InStore.size() > 0){
+ for(Product2__c produ: product2InStore){
+ for(String bar: barOtcodeMap.keySet() ){
+ if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
+ exitBarCodeMap.put(bar,bar);
+ errorMap.put(bar, bar);
+ }
+ }
+ }
+ }
+ if(errorMap.size() > 0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'));
+ }
+ }
+ product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,
+ Pro2_Dealer_Object__c,Pro2_Dealer_ENG__c
+ FROM Product2__c
+ WHERE OT_CODE__c in :allotCodeList
+ AND Product_Type__c like :userPro_Typestr] ;
+
+ if(product2InStore.size() > 0){
+ for(Product2__c produ: product2InStore){
+ for(String bar: barOtcodeMap.keySet() ){
+ Date expirationDate = null ;
+ String serialNoorLotNo = '';
+ String tracingCode = '';
+ String productDateStr = '';
+ Date productionDate = null ;
+ String expirationDateStr = '';
+ Integer oTcodeLength = produ.OT_CODE__c.length();
- public void confimResultWithoutOrder() {
- /*list<String> overOrderproList = new list<String>();
+ if(bar.length() >= oTcodeLength + 11){
+ if( bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='11'){
+ try{
+ productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ;
+ productionDate = Date.valueOf(productDateStr);
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >=oTcodeLength + 3 + 16){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode17' + bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10)));
+ if( bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='17'){
+ try{
+ if(bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16)=='00'){
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' + '01' ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' +bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16) ;
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >= oTcodeLength + 3 + 25){
+ if(bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='10' || bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18,bar.length() - 8) ;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
+ }
+ }
+ }else if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'serialNoorLotNo' + serialNoorLotNo));
+ }
+ }
+ }else if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='17'){
+ try{
+ if(bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8)=='00'){
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-01';
+ expirationDate = Date.valueOf(expirationDateStr);
+ expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+ }else{
+ expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-' +bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8);
+ expirationDate = Date.valueOf(expirationDateStr);
+ }
+ }catch(Exception e){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+ }
+ continue;
+ }
+ if(bar.length() >=oTcodeLength + 20){
+ if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+ }
+ }
+
+ }else if(bar.length() >= oTcodeLength + 12){
+ if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='10' || bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='21'){
+ serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2,bar.length() - 8) ;
+ }
+ }
+ }
+ if(bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8,bar.length()-5)=='250'){
+ if(bar.substring(bar.length() - 8,bar.length()-5)=='250'){
+ tracingCode = bar.substring(bar.length() - 5,bar.length());
+ Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (tracingCode.length() == 5) {
+ String tr = tracingCode;
+ 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 = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'));
+ }
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ errorList.add('浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'));
+ }
+ continue;
+ }
+ }
+ List<String> barcodedetList = new List<String>();
+ barcodedetList.add(bar);
+ barcodedetList.add(String.valueOf(expirationDate));
+ barcodedetList.add(serialNoorLotNo);
+ barcodedetList.add(tracingCode);
+ if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
+ exitBarCodeMap.put(bar,bar);
+
+ if(orderdetailMap.containsKey(produ.Id)){
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
+ }else{
+ consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
+ list<String> overOrderBARcodeCunList = new list<String>();
+ if(notEqualBARcodeCunMap.containsKey(produ.Id)){
+ overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id).clone();
+ overOrderBARcodeCunList.add(bar);
+ notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+ }else{
+ overOrderBARcodeCunList.add(bar);
+ notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ for(String bartxt :barCode241List){
+ if(!exitBarCodeMap.containsKey(bartxt)){
+ if(!errorMap.containsKey(bartxt)){
+ notInStorelist.add(bartxt);
+ }
+ }
+ }
+ }
+ //鍒ゆ柇浜у搧鏄惁涓�鑷�
+ if(notEqualBARcodeCunMap.size() > 0){
+ for(String widget : notEqualBARcodeCunMap.keySet()) {
+ if(notEqualBARcodeCunMap.get(widget).size() >0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add('浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��'));
+ }
+ for(String barcodeListTTT : (List<String>)notEqualBARcodeCunMap.get(widget)) {
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add(barcodeListTTT);
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public String ConfimResult() {
+ list<String> overOrderproList = new list<String>();
+ list<String> overOrderBARcodeCunList = new list<String>();
+ list<String> overOrderBARcodeCunListTest = new list<String>();
+ //overOrderBARcodeCunMap.clear();
+ for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
+ if(orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) > orderProductCunMap.get(ass.esd.Asset_Model_No__c)-1){
+ // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
+ overOrderBARcodeCunList = new list<String>();
+ overOrderBARcodeCunList = overOrderBARcodeCunMap.get(ass.esd.Asset_Model_No__c).clone();
+ overOrderBARcodeCunList.add(ass.esd.Bar_Code__c);
+ overOrderBARcodeCunMap.put(ass.esd.Asset_Model_No__c,overOrderBARcodeCunList);
+ overOrderCunMap.put(ass.esd.Asset_Model_No__c,overOrderCunMap.get(ass.esd.Asset_Model_No__c)+1);
+ cancellationProList.add(ass.esd.Asset_Model_No__c);
+ }else if(orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) == orderProductCunMap.get(ass.esd.Asset_Model_No__c)-1){
+ consumableorderdetailsRecordsUse.add(ass);
+ cancellationProList.add(ass.esd.Asset_Model_No__c);
+ }else{
+ consumableorderdetailsRecordsUse.add(ass);
+ }
+ orderWantArriveCunMap.put(ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c)+1);
+ }
+ for(ConsumableorderdetailsInfo ass : consumableInventory){
+ if (!orderWantArriveCunMap.containsKey(ass.Prod.Asset_Model_No__c)) {
+ consumableInventoryUse.add(ass);
+ continue;
+ }
+ if(orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) > orderProductCunMap.get(ass.Prod.Asset_Model_No__c)-1){
+
+ //鍙栧緱鍘熸湁list
+ overOrderBARcodeCunList = new list<String>();
+ overOrderBARcodeCunList = overOrderBARcodeCunMap.get(ass.Prod.Asset_Model_No__c).clone();
+ //鏇存柊list
+ overOrderBARcodeCunList.add(ass.barCodeNo);
+ //鏇存柊map
+ overOrderBARcodeCunMap.put(ass.Prod.Asset_Model_No__c,overOrderBARcodeCunList);
+ overOrderCunMap.put(ass.Prod.Asset_Model_No__c,overOrderCunMap.get(ass.Prod.Asset_Model_No__c)+1);
+ cancellationProList.add(ass.Prod.Asset_Model_No__c);
+ }else if(orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) == orderProductCunMap.get(ass.Prod.Asset_Model_No__c)-1){
+
+ consumableInventoryUse.add(ass);
+ cancellationProList.add(ass.Prod.Asset_Model_No__c);
+ }else{
+ consumableInventoryUse.add(ass);
+ }
+ orderWantArriveCunMap.put(ass.Prod.Asset_Model_No__c,orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c)+1);
+ }
+ for (Integer i = 0; i < productList.size(); i++) {
+ if(overOrderBARcodeCunMap.get(productList[i]).size() > 0){
+ // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
+ overOrderproList.add(productList[i]);
+ }
+ }
+ if(overOrderproList.size() > 0){
+ return '浜у搧' + overOrderproList + '鏈鍒拌揣鏁伴噺鍜屽凡鍒拌揣鏁伴噺宸茬粡瓒呰繃璁㈣揣鏁伴噺!';
+ }else{
+ return '';
+ }
+
+ }
+
+ public void confimResultWithoutOrder() {
+ /*list<String> overOrderproList = new list<String>();
list<String> overOrderBARcodeCunList = new list<String>();
orderProductCunMap.clear();
orderProductArrivedCunMap.clear();
@@ -4636,9 +2927,9 @@
}
}*/
- //瑕佸埌璐т骇鍝佹暟閲�
- for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
- /*if(orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) > orderProductCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)-1){
+ //瑕佸埌璐т骇鍝佹暟閲�
+ for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
+ /*if(orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) > orderProductCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)-1){
// 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
overOrderproList.add('浜у搧' + ass.esd.Asset_Model_No__c + '鍦ㄨ鍗�' + ass.esd.Consumable_order_minor__r.Name + '涓秴杩囪璐ф暟閲�!\n');
overOrderBARcodeCunList = new list<String>();
@@ -4649,1602 +2940,1363 @@
consumableorderdetailsRecordsUse.add(ass);
orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
}else{*/
- consumableorderdetailsRecordsUse.add(ass);
- }
- /*orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
+ consumableorderdetailsRecordsUse.add(ass);
+ }
+ /*orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
}
return overOrderproList;*/
- }
+ }
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // 铏氭嫙鐩樼偣鍗曟秷鑰楀搧鏄庣粏1鍒涘缓宸″洖
- public void addInventoryDetails1(List<Consumable_order_details2__c> addList) {
- Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
- Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>>();
- List<Id> orderIdList = new List<Id>();
- // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
- for (Consumable_order_details2__c cod : addList) {
- List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c>();
- Map<Id, Integer> pNumMap = new Map<Id, Integer>();
- Integer num = 1;
- if (
- accountGroupMap.containsKey(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- )
- ) {
- accGroupList = accountGroupMap.get(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- );
- pNumMap = productMap.get(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- );
- if (pNumMap.containsKey(cod.Consumable_Product__c)) {
- num = pNumMap.get(cod.Consumable_Product__c) + 1;
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // 铏氭嫙鐩樼偣鍗曟秷鑰楀搧鏄庣粏1鍒涘缓宸″洖
+ public void addInventoryDetails1(List<Consumable_order_details2__c> addList){
+ Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
+ Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>> ();
+ List<Id> orderIdList = new List<Id> ();
+ // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
+ for (Consumable_order_details2__c cod : addList) {
+ List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c> ();
+ Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+ Integer num = 1;
+ if (accountGroupMap.containsKey(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c)) {
+ accGroupList = accountGroupMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
+ pNumMap = productMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
+ if (pNumMap.containsKey(cod.Consumable_Product__c)) {
+ num = pNumMap.get(cod.Consumable_Product__c) + 1;
+ }
+ }
+ orderIdList.add(cod.Consumable_Inventory_order__c);
+ pNumMap.put(cod.Consumable_Product__c, num);
+ accGroupList.add(cod);
+ productMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, pNumMap);
+ accountGroupMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, accGroupList);
+ System.debug('======accGroupList'+accGroupList);
}
- }
- orderIdList.add(cod.Consumable_Inventory_order__c);
- pNumMap.put(cod.Consumable_Product__c, num);
- accGroupList.add(cod);
- productMap.put(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c,
- pNumMap
- );
- accountGroupMap.put(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c,
- accGroupList
- );
- System.debug('======accGroupList' + accGroupList);
- }
+
+ System.debug('======accountGroupMap'+accountGroupMap);
+ List<Consumable_order__c> orderList = [select Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c from Consumable_order__c where id in : orderIdList];
- System.debug('======accountGroupMap' + accountGroupMap);
- List<Consumable_order__c> orderList = [
- SELECT Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c
- FROM Consumable_order__c
- WHERE id IN :orderIdList
- ];
+ // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
+ // List<Consumable_order__c> orderList = new List<Consumable_order__c> ();
+ Map<String, List<Consumable_orderdetails__c>> insDetail1Map = new Map<String, List<Consumable_orderdetails__c>>();
+ for (String acc : accountGroupMap.keySet()) {
+ Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
+ List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(acc);
+ Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+ pNumMap = productMap.get(acc);
+ List<Consumable_orderdetails__c> insDetail1 = New List<Consumable_orderdetails__c>();
+ for (Id id : pNumMap.keySet()) {
+ Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
+
+ //InsAfterDel.Consumable_order__c = p.id;
+ ins.Product_Refind__c = pNumMap.get(id);
+ ins.inventory_sum__c = pNumMap.get(id);
+ ins.Consumable_Product__c = id;
+ for (Consumable_order_details2__c pri : prodPriceList) {
+ if (pri.Consumable_Product__c == id) {
+ ins.Intra_Trade_List_RMB__c =pri.Intra_Trade_List_RMB__c;
+ break;
+ }
+ }
+ ins.Box_Piece__c = '鐩�';
+ ins.Out_unit__c = '鐩�';
+ //ins.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ //ins.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ //ins.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ ins.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ ins.Used_date__c = Date.today();
+ ins.OwnerId = arriveAccount.OwnerId;
- // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
- // List<Consumable_order__c> orderList = new List<Consumable_order__c> ();
- Map<String, List<Consumable_orderdetails__c>> insDetail1Map = new Map<String, List<Consumable_orderdetails__c>>();
- for (String acc : accountGroupMap.keySet()) {
- Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
- List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(
- acc
- );
- Map<Id, Integer> pNumMap = new Map<Id, Integer>();
- pNumMap = productMap.get(acc);
- List<Consumable_orderdetails__c> insDetail1 = new List<Consumable_orderdetails__c>();
- for (Id id : pNumMap.keySet()) {
- Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
-
- //InsAfterDel.Consumable_order__c = p.id;
- ins.Product_Refind__c = pNumMap.get(id);
- ins.inventory_sum__c = pNumMap.get(id);
- ins.Consumable_Product__c = id;
- for (Consumable_order_details2__c pri : prodPriceList) {
- if (pri.Consumable_Product__c == id) {
- ins.Intra_Trade_List_RMB__c = pri.Intra_Trade_List_RMB__c;
- break;
- }
+ insDetail1.add(ins);
+ }
+ System.debug('======insDetail1'+insDetail1);
+ insDetail1Map.put(acc, insDetail1);
+ System.debug('======insDetail1Map'+insDetail1Map);
}
- ins.Box_Piece__c = '鐩�';
- ins.Out_unit__c = '鐩�';
- //ins.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
- //ins.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
- //ins.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
- ins.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
- ins.Used_date__c = Date.today();
- ins.OwnerId = arriveAccount.OwnerId;
-
- insDetail1.add(ins);
- }
- System.debug('======insDetail1' + insDetail1);
- insDetail1Map.put(acc, insDetail1);
- System.debug('======insDetail1Map' + insDetail1Map);
+ List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c> ();
+ for (Consumable_order__c setId : orderList) {
+ // 鏄庣粏1
+ List<Consumable_orderdetails__c> d1list = insDetail1Map.get(setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c);
+ Integer i = 1;
+ for (Consumable_orderdetails__c dtl1 : d1list) {
+ String str = ('000' + i).right(4);
+ dtl1.Consumable_order__c = setId.Id;
+ dtl1.Name = setId.Name + '-'+ str;
+ insDetail1List.add(dtl1);
+ }
+ }
+ System.debug('======insDetail1List'+insDetail1List);
+ insert insDetail1List;
}
- List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c>();
- for (Consumable_order__c setId : orderList) {
- // 鏄庣粏1
- List<Consumable_orderdetails__c> d1list = insDetail1Map.get(
- setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c
- );
- Integer i = 1;
- for (Consumable_orderdetails__c dtl1 : d1list) {
- String str = ('000' + i).right(4);
- dtl1.Consumable_order__c = setId.Id;
- dtl1.Name = setId.Name + '-' + str;
- insDetail1List.add(dtl1);
- }
- }
- System.debug('======insDetail1List' + insDetail1List);
- insert insDetail1List;
- }
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- // 缁忛攢鍟嗙殑涓嶅悓宸ヤ綔鍦拌皟璐ц嚜鍔ㄧ敓鎴愬嚭搴撳崟
- public void addSaleOrderAuto(List<Consumable_order_details2__c> addList) {
- Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
- Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>>();
- // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
- for (Consumable_order_details2__c cod : addList) {
- List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c>();
- Map<Id, Integer> pNumMap = new Map<Id, Integer>();
- Integer num = 1;
- if (
- accountGroupMap.containsKey(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- )
- ) {
- accGroupList = accountGroupMap.get(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- );
- pNumMap = productMap.get(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c
- );
- if (pNumMap.containsKey(cod.Consumable_Product__c)) {
- num = pNumMap.get(cod.Consumable_Product__c) + 1;
+
+ // 缁忛攢鍟嗙殑涓嶅悓宸ヤ綔鍦拌皟璐ц嚜鍔ㄧ敓鎴愬嚭搴撳崟
+ public void addSaleOrderAuto (List<Consumable_order_details2__c> addList) {
+ Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
+ Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>> ();
+ // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
+ for (Consumable_order_details2__c cod : addList) {
+ List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c> ();
+ Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+ Integer num = 1;
+ if (accountGroupMap.containsKey(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c)) {
+ accGroupList = accountGroupMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
+ pNumMap = productMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
+ if (pNumMap.containsKey(cod.Consumable_Product__c)) {
+ num = pNumMap.get(cod.Consumable_Product__c) + 1;
+ }
+ }
+ pNumMap.put(cod.Consumable_Product__c, num);
+ accGroupList.add(cod);
+ productMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, pNumMap);
+ accountGroupMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, accGroupList);
}
- }
- pNumMap.put(cod.Consumable_Product__c, num);
- accGroupList.add(cod);
- productMap.put(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c,
- pNumMap
- );
- accountGroupMap.put(
- cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c,
- accGroupList
- );
- }
- // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- Map<String, List<Consumable_orderdetails__c>> insDetail1Map = new Map<String, List<Consumable_orderdetails__c>>();
- for (String acc : accountGroupMap.keySet()) {
- Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
- Consumable_order__c autoOrder = new Consumable_order__c();
- autoOrder.Name = '*';
- autoOrder.Dealer_Info__c = arriveAccount.Consumable_Arrived_order__r.Dealer_Info__c;
- autoOrder.OwnerId = arriveAccount.OwnerId;
- autoOrder.Order_type__c = '浼犵エ';
- autoOrder.SummonsStatus_c__c = '宸插畬鎴�';
- autoOrder.Order_ForDealerText__c = accountName;
- autoOrder.SummonsForDirction__c = '浜掔浉璋冭揣';
- autoOrder.RecordTypeid = System.Label.RT_ConOrder_Shipment;
- autoOrder.Outbound_Date__c = Date.today();
- autoOrder.Order_date__c = Date.today();
- autoOrder.AutoShipment__c = true;
- orderList.add(autoOrder);
+ // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
+ List<Consumable_order__c> orderList = new List<Consumable_order__c> ();
+ Map<String, List<Consumable_orderdetails__c>> insDetail1Map = new Map<String, List<Consumable_orderdetails__c>>();
+ for (String acc : accountGroupMap.keySet()) {
+ Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
+ Consumable_order__c autoOrder = new Consumable_order__c();
+ autoOrder.Name = '*';
+ autoOrder.Dealer_Info__c = arriveAccount.Consumable_Arrived_order__r.Dealer_Info__c;
+ autoOrder.OwnerId = arriveAccount.OwnerId;
+ autoOrder.Order_type__c = '浼犵エ';
+ autoOrder.SummonsStatus_c__c = '宸插畬鎴�';
+ autoOrder.Order_ForDealerText__c = accountName;
+ autoOrder.SummonsForDirction__c = '浜掔浉璋冭揣';
+ autoOrder.RecordTypeid = System.Label.RT_ConOrder_Shipment;
+ autoOrder.Outbound_Date__c = Date.today();
+ autoOrder.Order_date__c = Date.today();
+ autoOrder.AutoShipment__c = TRUE;
+ orderList.add(autoOrder);
- List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(
- acc
- );
- Map<Id, Integer> pNumMap = new Map<Id, Integer>();
- pNumMap = productMap.get(acc);
- List<Consumable_orderdetails__c> insDetail1 = new List<Consumable_orderdetails__c>();
- for (Id id : pNumMap.keySet()) {
- Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
+ List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(acc);
+ Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+ pNumMap = productMap.get(acc);
+ List<Consumable_orderdetails__c> insDetail1 = New List<Consumable_orderdetails__c>();
+ for (Id id : pNumMap.keySet()) {
+ Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
+
+ //InsAfterDel.Consumable_order__c = p.id;
+ ins.Shipment_Count__c = pNumMap.get(id);
+ ins.Consumable_Product__c = id;
+ for (Consumable_order_details2__c pri : prodPriceList) {
+ if (pri.Consumable_Product__c == id) {
+ ins.Intra_Trade_List_RMB__c =pri.Intra_Trade_List_RMB__c;
+ break;
+ }
+ }
+ ins.Box_Piece__c = '鐩�';
+ ins.Out_unit__c = '鐩�';
+ //ins.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ //ins.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ //ins.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ ins.RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment;
+ ins.Used_date__c = Date.today();
+ ins.OwnerId = arriveAccount.OwnerId;
- //InsAfterDel.Consumable_order__c = p.id;
- ins.Shipment_Count__c = pNumMap.get(id);
- ins.Consumable_Product__c = id;
- for (Consumable_order_details2__c pri : prodPriceList) {
- if (pri.Consumable_Product__c == id) {
- ins.Intra_Trade_List_RMB__c = pri.Intra_Trade_List_RMB__c;
- break;
- }
+ insDetail1.add(ins);
+ }
+ insDetail1Map.put(acc, insDetail1);
}
- ins.Box_Piece__c = '鐩�';
- ins.Out_unit__c = '鐩�';
- //ins.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
- //ins.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
- //ins.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
- ins.RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment;
- ins.Used_date__c = Date.today();
- ins.OwnerId = arriveAccount.OwnerId;
+ insert orderList;
- insDetail1.add(ins);
- }
- insDetail1Map.put(acc, insDetail1);
- }
- insert orderList;
+ List<Id> orderIdList = new List<Id> ();
+ for (Consumable_order__c co : orderList) {
+ orderIdList.add(co.Id);
+ }
- List<Id> orderIdList = new List<Id>();
- for (Consumable_order__c co : orderList) {
- orderIdList.add(co.Id);
+ orderList = new List<Consumable_order__c> ();
+ orderList = [select Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c from Consumable_order__c where id in : orderIdList];
+
+ // 璁剧疆鏄庣粏1 鍜� 鏄庣粏2 鐨� 璁㈠崟ID
+ List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c> ();
+ List<Consumable_order_details2__c> updDetail2List = new List<Consumable_order_details2__c> ();
+ for (Consumable_order__c setId : orderList) {
+ // 鏄庣粏1
+ List<Consumable_orderdetails__c> d1list = insDetail1Map.get(setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c);
+ Integer i = 1;
+ for (Consumable_orderdetails__c dtl1 : d1list) {
+ String str = ('000' + i).right(4);
+ // if(str.length() == 1){
+ // str = '0' + str;
+ // }
+ dtl1.Consumable_order__c = setId.Id;
+ dtl1.Name = setId.Name + '-'+ str;
+ insDetail1List.add(dtl1);
+ }
+
+ // 鏄庣粏2
+ List<Consumable_order_details2__c> d2list = accountGroupMap.get(setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c);
+ for (Consumable_order_details2__c dtl2 : d2list) {
+ dtl2.Send_Date__c = Date.today();
+ dtl2.Consumable_Sale_order__c = null;
+ dtl2.Consumable_Return_order__c = null;
+ dtl2.Consumable_ZS_order__c = setId.Id;
+ //dtl2.Delivery_List_RMB__c = null;
+ dtl2.Return_date__c = null;
+ dtl2.Return_reason__c = null;
+ dtl2.Consumable_Shipment_order__c = setId.Id;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ dtl2.Transfer_Time__c = 1;
+ dtl2.Agency_Transfer__c = true;
+ dtl2.Frist_Transfer_Agency__c = dtl2.Dealer_Info_text__c;
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+ updDetail2List.add(dtl2);
+ }
+ }
+
+ insert insDetail1List;
+ update updDetail2List;
}
- orderList = new List<Consumable_order__c>();
- orderList = [
- SELECT Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c
- FROM Consumable_order__c
- WHERE id IN :orderIdList
- ];
+ //鍒拌揣纭
+ public PageReference ArriveGoodsConfim() {
+ //add by rentx 20210618 start CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
+ StaticParameter.ConsumableOrderTrigger = true;
+ //add by rentx 20210618 end CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
+ cancellationProList = new List<String>();
+ List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
+ String resultcheck = '';
+ List<String> resultcheckWithoutOrder = new List<String>();
+ Savepoint sp = Database.setSavepoint();
- // 璁剧疆鏄庣粏1 鍜� 鏄庣粏2 鐨� 璁㈠崟ID
- List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c>();
- List<Consumable_order_details2__c> updDetail2List = new List<Consumable_order_details2__c>();
- for (Consumable_order__c setId : orderList) {
- // 鏄庣粏1
- List<Consumable_orderdetails__c> d1list = insDetail1Map.get(
- setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c
- );
- Integer i = 1;
- for (Consumable_orderdetails__c dtl1 : d1list) {
- String str = ('000' + i).right(4);
- // if(str.length() == 1){
- // str = '0' + str;
- // }
- dtl1.Consumable_order__c = setId.Id;
- dtl1.Name = setId.Name + '-' + str;
- insDetail1List.add(dtl1);
- }
-
- // 鏄庣粏2
- List<Consumable_order_details2__c> d2list = accountGroupMap.get(
- setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c
- );
- for (Consumable_order_details2__c dtl2 : d2list) {
- dtl2.Send_Date__c = Date.today();
- dtl2.Consumable_Sale_order__c = null;
- dtl2.Consumable_Return_order__c = null;
- dtl2.Consumable_ZS_order__c = setId.Id;
- //dtl2.Delivery_List_RMB__c = null;
- dtl2.Return_date__c = null;
- dtl2.Return_reason__c = null;
- dtl2.Consumable_Shipment_order__c = setId.Id;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- dtl2.Transfer_Time__c = 1;
- dtl2.Agency_Transfer__c = true;
- dtl2.Frist_Transfer_Agency__c = dtl2.Dealer_Info_text__c;
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
- updDetail2List.add(dtl2);
- }
- }
-
- insert insDetail1List;
- update updDetail2List;
- }
-
- //鍒拌揣纭
- public PageReference ArriveGoodsConfim() {
- //add by rentx 20210618 start CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
- StaticParameter.ConsumableOrderTrigger = true;
- //add by rentx 20210618 end CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
- cancellationProList = new List<String>();
- List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
- String resultcheck = '';
- List<String> resultcheckWithoutOrder = new List<String>();
- Savepoint sp = Database.setSavepoint();
-
- if (
- ConsumableorderdetailsRecords.size() < 1 &&
- consumableInventory.size() < 1
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = '涓嶅瓨鍦ㄥ埌璐ф槑缁�';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(ApexPages.severity.ERROR, '涓嶅瓨鍦ㄥ埌璐ф槑缁�')
- );
- }
- return null;
- }
- if (EsetId != null && EsetId != '') {
- resultcheck = ConfimResult();
- if (resultcheck.length() > 0) {
- for (String widget : overOrderBARcodeCunMap.keySet()) {
- if (overOrderBARcodeCunMap.get(widget).size() > 0) {
+ if(ConsumableorderdetailsRecords.size()<1 && consumableInventory.size()<1){
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add(
- '浜у搧' +
- widget +
- '鏈鍒拌揣鏁伴噺瓒呰繃' +
- overOrderBARcodeCunMap.get(widget).size() +
- '涓璐х殑鏁伴噺銆�'
- );
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.INFO,
- '浜у搧' +
- widget +
- '鏈鍒拌揣鏁伴噺瓒呰繃' +
- overOrderBARcodeCunMap.get(widget).size() +
- '涓璐х殑鏁伴噺銆�'
- )
- );
- }
- for (
- String barcodeListTTT : (List<String>) overOrderBARcodeCunMap.get(
- widget
- )
- ) {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- warningList.add(barcodeListTTT);
- } else {
- ApexPages.addmessage(
- new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)
- );
- }
- }
- }
- }
- }
- } else {
- confimResultWithoutOrder();
- }
- try {
- Consumable_order__c orderMain = new Consumable_order__c();
- List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>();
- //鍒拌揣姝g‘淇℃伅
- orderMain.Name = '*';
- orderMain.Order_status__c = '鎵瑰噯';
- orderMain.Dealer_Info__c = accountid;
- orderMain.Deliver_date__c = Date.today();
- orderMain.Order_date__c = Date.today();
- orderMain.Order_type__c = '鍒拌揣';
- orderMain.Order_ProType__c = userPro_Type;
- if (EsetId != null && EsetId != '') {
- orderMain.Arrive_Order__c = coc.Id;
- }
- orderMain.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- insert orderMain;
-
- List<Consumable_order__c> consumable_order = [
- SELECT Name
- FROM Consumable_order__c
- WHERE id = :orderMain.id
- ];
- arriveId = orderMain.id;
- Decimal arriveAmount = 0;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------'));
- Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
- insDetails.Id = ass.esd.Id;
- insDetails.Consumable_Arrived_order__c = orderMain.id;
- insDetails.Arrive_date__c = Date.today();
- insDetails.Bar_Code__c = ass.esd.Bar_Code__c;
- insDetails.OwnerId = UserInfo.getUserId();
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
- insDetails.Transfer_Time__c = ass.esd.Transfer_Time__c == null
- ? 1
- : ass.esd.Transfer_Time__c;
- insDetails.Agency_Transfer__c = true;
- insDetails.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c ==
- null
- ? ass.esd.Dealer_Info_text__c
- : ass.esd.Frist_Transfer_Agency__c;
- }
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- insDetails.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
- insDetails.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c ==
- null
- ? ass.esd.Dealer_Info_text__c
- : ass.esd.Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
- arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
- orderdetails.add(insDetails);
- }
- Integer i = 1;
- for (ConsumableorderdetailsInfo ass : consumableInventoryUse) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------'));
- Consumable_order_details2__c insAfterDel = new Consumable_order_details2__c();
- String str = ('000' + i).right(4);
- // if(str.length() == 1){
- // str = '0' + str;
- // }
- insAfterDel.Name = consumable_order[0].Name + '-' + str;
- insAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- // if(EsetId != null && EsetId != ''){
- // insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- // }else{
- // insAfterDel.Intra_Trade_List_RMB__c = 0;
- // }
- insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- insAfterDel.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
- if (EsetId != null && EsetId != '') {
- insAfterDel.Consumable_order_minor__c = ESetId;
- }
- insAfterDel.Deliver_date__c = Date.today();
- insAfterDel.Direct_Arrive_Product__c = true;
- //TODO寰呯‘璁�
- insAfterDel.Sterilization_limit__c = ass.sterilizationlimitDate;
- insAfterDel.Consumable_Product__c = ass.Prod.id;
- insAfterDel.Bar_Code__c = ass.barCodeNo;
- insAfterDel.Used_account__c = accountid;
- //TODO寰呯‘璁�
- insAfterDel.SerialLotNo__c = ass.serialNoorLotNo;
- insAfterDel.TracingCode__c = ass.tracingCodeNo;
-
- //insAfterDel.Dealer_Arrive__c = true;
- insAfterDel.Consumable_Arrived_order__c = orderMain.id;
- insAfterDel.Arrive_date__c = Date.today();
- insAfterDel.OwnerId = UserInfo.getUserId();
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
- insAfterDel.Transfer_Time__c = ass.esd.Transfer_Time__c == null
- ? 1
- : ass.esd.Transfer_Time__c;
- insAfterDel.Agency_Transfer__c = true;
- insAfterDel.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c ==
- null
- ? accountName
- : ass.esd.Frist_Transfer_Agency__c;
- }
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- insAfterDel.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
- insAfterDel.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c ==
- null
- ? accountName
- : ass.esd.Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
- arriveAmount += insAfterDel.Intra_Trade_List_RMB__c;
- //add by rentx 2020-10-14 strat
- //insAfterDel.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
- // tcm start
- if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
- insAfterDel.ContractNo_text__c = ass.esd.ContractNo_text__c;
- } else {
- insAfterDel.ContractNo_text__c = ass.esd.Consumable_order_minor__r.ContractNo__c;
- }
- // tcm end
- //add by rentx 2020-10-14 end
- i++;
-
- ins.add(insAfterDel);
- }
- orderMain.Arrive_total_amount__c = arriveAmount;
- update orderMain;
- List<Consumable_order_details2__c> updateconsumableorderdetails2 = new List<Consumable_order_details2__c>();
- //鏇存柊鏄庣粏鍙栨秷鏃堕棿 => 鏈埌璐у彇娑堬紝鍒拌揣鑷姩鐢熸垚鍑哄簱娴佺▼
- List<Consumable_order_details2__c> addSaleOrderList = new List<Consumable_order_details2__c>();
- for (Consumable_order_details2__c Cod : consumableorderdetails2Cancle) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------3------'));
- if (Cod.Dealer_Arrive__c) {
- if (Cod.Dealer_Shipment__c == false && Cod.Dealer_Saled__c == false) {
- addSaleOrderList.add(Cod);
- }
- } else {
- Cod.Cancellation_Date__c = Date.today();
- Cod.Cancellation_Flag__c = true;
- updateconsumableorderdetails2.add(Cod);
- }
- }
-
- if (addSaleOrderList.size() > 0) {
- addSaleOrderAuto(addSaleOrderList);
- }
-
- if (updateconsumableorderdetails2.size() > 0) {
- update updateconsumableorderdetails2;
- }
-
- List<Consumable_order_details2__c> insertconsumableorderdetails2 = new List<Consumable_order_details2__c>();
- for (Consumable_order_details2__c Cod2 : consumableorderdetails2Insert) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------'));
- String str = ('000' + i).right(4);
- // if(str.length() == 1){
- // str = '0' + str;
- // }
- Cod2.Name = consumable_order[0].Name + '-' + str;
- Cod2.Consumable_order_minor__c = null;
- Cod2.Deliver_date__c = Date.today();
- Cod2.Used_account__c = accountid;
- Cod2.Consumable_Arrived_order__c = orderMain.id;
- Cod2.Arrive_date__c = Date.today();
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
- if (orderdetails2trMap.containsKey(Cod2.Bar_Code__c)) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4++++++' + Cod2.Frist_Storage_Agency__c));
- Cod2.Transfer_Time__c = Cod2.Transfer_Time__c == null
- ? 1
- : Cod2.Transfer_Time__c;
- Cod2.Agency_Transfer__c = true;
- Cod2.Frist_Transfer_Agency__c = Cod2.Frist_Transfer_Agency__c == null
- ? accountName
- : Cod2.Frist_Transfer_Agency__c;
- }
- // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- Cod2.Agencyinfo_fromSAP__c = Cod2.Agencyinfo_fromSAP__c;
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------' + Cod2.Frist_Storage_Agency__c));
- Cod2.Frist_Storage_Agency__c = Cod2.Frist_Storage_Agency__c == null
- ? accountName
- : Cod2.Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
- insertconsumableorderdetails2.add(Cod2);
- i++;
- }
-
- //return null;
-
- if (insertconsumableorderdetails2.size() > 0) {
- insert insertconsumableorderdetails2;
- }
-
- if (ins.size() > 0) {
- insert ins;
- }
- if (orderdetails.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(orderdetails);
- }
- //瓒呭嚭鍒拌揣鏁伴噺浜у搧鍙栨秷鏃ユ湡鏇存柊
- List<Consumable_order_details2__c> needcanceldet = new List<Consumable_order_details2__c>();
- if (cancellationProList.size() > 0) {
- needcanceldet = [
- SELECT Id, Cancellation_Date__c
- FROM Consumable_order_details2__c
- WHERE
- Asset_Model_No__c IN :cancellationProList
- AND Consumable_order_minor__c = :ESetId
- AND Dealer_Arrive__c = FALSE
- AND Cancellation_Date__c = NULL
- ];
- if (needcanceldet.size() > 0) {
- for (Integer a = 0; a < needcanceldet.size(); a++) {
- needcanceldet[a].Cancellation_Date__c = Date.today();
- needcanceldet[a].Cancellation_Flag__c = true;
- }
- ControllerUtil.updateOrderDetailsSatus(needcanceldet);
- }
- }
- List<Consumable_order__c> qs = new List<Consumable_order__c>();
- qs = [
- SELECT
- Id,
- Name,
- Order_status__c,
- Dealer_Info__c,
- Deliver_date__c,
- ReturnGs_Upload_Date__c,
- Order_Reason__c,
- Order_date__c,
- Contract_application_decision__c,
- Order_type__c,
- Total_num__c,
- OrderNumber_arrived__c,
- Delivery_detail_count__c,
- OrderNumber_notarrive__c
- FROM Consumable_order__c
- WHERE Id = :ESetId AND Dealer_Info__c = :accountid
- ];
- if (qs.size() > 0) {
- coc = qs[0];
- }
- saveFLGbln = true;
- alertMessage = '鍒拌揣瀹屾垚銆�';
- // Integer a = 1/0;
- } catch (Exception e) {
- Database.rollback(sp);
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = e.getLineNumber() + '---' + e.getMessage();
- } else {
- ApexPages.addMessages(e);
- }
- return null;
- }
- if (resultcheck.length() > 0) {
- return null;
- } else if (resultcheckWithoutOrder.size() > 0) {
- return null;
- } else {
- urlType = 'UnabletoEdit';
- return UnabletoEdit();
- // return null;
- }
- }
-
- // 杩斿搧妫�鏌ワ紝鍚庡洖搴�
- public integer GoodsReturnCheck() {
- List<String> GrListIn = ParseBarCode(barcode);
- GrList = new List<String>();
- Map<String, String> CheckBarcodeResult = new Map<String, String>();
- for (String Str : GrListIn) {
- CheckBarcodeResult.put(str, 'UnFind');
- }
- List<Consumable_order_details2__c> BarcodeRetrunResult = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Asset_Model_No__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,
- Box_Piece__c,
- Rrturn_count__c,
- Product_Type__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- //add by rentx 2020-10-14 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND (Dealer_Shipment__c = TRUE
- //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
- OR Dealer_Saled__c = TRUE)
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :GrListIn
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- AND Dealer_Returned__c = FALSE
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Box_Piece__c DESC, Name
- ];
- if (BarcodeRetrunResult.size() > 0) {
- for (Integer i = 0; i < BarcodeRetrunResult.size(); i++) {
- if (
- ErrorIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c) ||
- ExistIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '浜у搧绫诲瀷[' +
- BarcodeRetrunResult[i].Product_Type__c +
- ']涓庣敤鎴风殑绫诲瀷[' +
- userPro_Type +
- ']涓嶇';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(BarcodeRetrunResult[i], str)
- );
- ErrorIdMap.put(
- BarcodeRetrunResult[i].Bar_Code__c,
- BarcodeRetrunResult[i].Bar_Code__c
- );
- }
- }
- }
- AllMap.putAll(ErrorIdMap);
- BarcodeRetrunResult = [
- SELECT
- Id,
- Consumable_order_minor__c,
- Deliver_date__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Name,
- Bar_Code__c,
- Arrive_date__c,
- Dealer_Shipment__c,
- Lose_Flag__c,
- Dealer_Saled__c,
- Return_reason__c,
- Consumable_Shipment_order__c,
- Consumable_Shipment_order__r.Name,
- Send_date__c,
- Consumable_Sale_order__c,
- Consumable_Sale_order__r.Name,
- Used_date__c,
- SerialLotNo__c,
- TracingCode__c,
- Sterilization_limit__c,
- Consumable_ZS_order__c,
- Consumable_ZS_order__r.Name,
- Product_OutDate__c,
- Invoice_Date__c,
- recordtypeid,
- Consumable_Arrived_order__c,
- Box_Piece__c,
- Rrturn_count__c,
- Intra_Trade_List_RMB__c,
- OwnerId,
- SummonsForDirction_det__c,
- Order_Dealer_Info__c,
- HospItal_Name__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- Dealer_Info_text__c,
- Used_account__c,
- Transfer_Time__c,
- Frist_Transfer_Agency__c,
- Arrive_Owner_Work_Location__c,
- Agency_Transfer__c,
- //add by rentx 2020-10-14 start
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- //add by rentx 2020-10-14 end
- Report_Product_Expiration__c,
- Intra_Trade_List__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND (Dealer_Shipment__c = TRUE
- //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
- OR Dealer_Saled__c = TRUE
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- OR (Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = TRUE))
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :GrListIn
- AND Product_Type__c LIKE :userPro_Typestr
- AND Dealer_Returned__c = FALSE
- AND (Arrive_Owner_Work_Location__c = :userWorkLocation
- OR OwnerId = :System.Label.User_OlympusSystem)
- ORDER BY Box_Piece__c DESC, Name
- ];
- ShowGoodsofReturnList = new List<ConsumableorderdetailsInfo>();
-
- //杩斿搧鏃秈stinct澶勭悊
- if (ArrType == 'ReG') {
- BarcodeRetrunResult = getDistinctZSOrder(BarcodeRetrunResult);
- }
-
- for (Consumable_order_details2__c codc : BarcodeRetrunResult) {
- if (
- ErrorIdMap.containsKey(codc.Bar_Code__c) ||
- ExistIdMap.containsKey(codc.Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- Matcher n = Pattern.compile('[0-9]').matcher(codc.TracingCode__c);
- if (n.find()) {
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
- if (codc.TracingCode__c.length() == 5) {
- String tr = codc.TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(codc, str)
- );
- ErrorIdMap.put(codc.Bar_Code__c, codc.Bar_Code__c);
- continue;
- }
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str));
- // ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c);
- // continue;
- // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
- }
- if (CheckBarcodeResult.containsKey(codc.Bar_Code__c)) {
- GrList.add(codc.Bar_Code__c);
- if (codc.Dealer_Shipment__c == true) {
- CheckBarcodeResult.put(codc.Bar_Code__c, '宸插嚭搴�');
- ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
- }
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // else{
- // CheckBarcodeResult.put( codc.Bar_Code__c, '宸查攢鍞�');
- // ShowGoodsofReturnList.add( new ConsumableorderdetailsInfo( codc ) );
- // }
- else if (codc.Dealer_Saled__c == true) {
- CheckBarcodeResult.put(codc.Bar_Code__c, '宸查攢鍞�');
- ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
- } else {
- CheckBarcodeResult.put(codc.Bar_Code__c, '宸蹭涪澶�');
- ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
- }
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- } else {
- continue;
- }
- }
- }
-
- return BarcodeRetrunResult.size();
- }
-
- // 鍗曚綅涓轰釜鐨凚arcode瀵瑰簲鐨勫嚭搴撳崟
- public integer Getconsumableorderdetails2Nobox() {
- consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
- BarcodeCntMap.clear();
- consumableorderdetails2Nobox = [
- SELECT
- Id,
- Consumable_order_minor__c,
- Deliver_date__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Name,
- Bar_Code__c,
- Arrive_date__c,
- Dealer_Shipment__c,
- Dealer_Saled__c,
- Return_reason__c,
- Consumable_Shipment_order__c,
- Send_date__c,
- Consumable_Sale_order__c,
- Used_date__c,
- SerialLotNo__c,
- TracingCode__c,
- Sterilization_limit__c,
- Consumable_ZS_order__c,
- Consumable_ZS_order__r.Name,
- Product_OutDate__c,
- Invoice_Date__c,
- recordtypeid,
- Consumable_Arrived_order__c,
- Box_Piece__c,
- RemoveBox_No__c,
- RemoveBox_date__c,
- Rrturn_count__c,
- Dealer_Info_text__c,
- Arrive_Owner_Work_Location__c,
- Intra_Trade_List_RMB__c,
- //add by rentx 2020-10-13 start 杩斿搧鏃� 鏂版暟鎹褰昐AP鍚堝悓鍙�
- ContractNo_text__c /*,ContractNo__c*/,
- // tcm start
- Consumable_order_minor__r.ContractNo__c,
- // tcm end
- Report_Product_Expiration__c,
- //add by rentx 2020-10-13 end
- Intra_Trade_List__c
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- FROM Consumable_order_details2__c
- WHERE
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // (Dealer_Shipment__c = true or Dealer_Saled__c = true)
- (Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE
- OR (Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = TRUE))
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :noboxBarcodeList
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Returned__c = FALSE
- AND Box_Piece__c = '涓�'
- ORDER BY Consumable_ZS_order__c, RemoveBox_No__c
- ];
-
- AggregateResult[] results = [
- SELECT Consumable_ZS_order__c, Bar_Code__c, count(Id) recordCount
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // AND (Dealer_Shipment__c= true OR Dealer_Saled__c = true)
- AND (Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE
- OR (Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = TRUE))
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :noboxBarcodeList
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Box_Piece__c = '涓�'
- AND Dealer_Info_text__c = :accountName
- GROUP BY Consumable_ZS_order__c, Bar_Code__c
- ];
-
- for (AggregateResult ar : results) {
- String key =
- '' +
- ar.get('Consumable_ZS_order__c') +
- ar.get('Bar_Code__c');
- BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
- }
-
- return consumableorderdetails2Nobox.size();
- }
-
- //distinct
- public List<Consumable_order_details2__c> getDistinctZSOrder(
- List<Consumable_order_details2__c> duplicates
- ) {
- List<Consumable_order_details2__c> distinctOrder = new List<Consumable_order_details2__c>();
-
- for (Consumable_order_details2__c details2 : duplicates) {
- Boolean found = false;
- for (Consumable_order_details2__c result : distinctOrder) {
- if (
- details2.Consumable_ZS_order__c == result.Consumable_ZS_order__c &&
- details2.Bar_Code__c == result.Bar_Code__c
- ) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- distinctOrder.add(details2);
-
- if (details2.Box_Piece__c == '涓�')
- noboxBarcodeList.add(details2.Bar_Code__c);
- }
- }
- return distinctOrder;
- }
-
- // Update杩斿搧鏄庣粏淇℃伅
- public Pagereference UpdateGoodsOfReturn() {
- if (ShowGoodsofReturnList == null) {
- GoodsReturnCheck();
- }
- Getconsumableorderdetails2Nobox();
-
- Savepoint sp = Database.setSavepoint();
- boolean hasReturnGoods = false;
- boolean hasLoseGoods = false;
- try {
- if (ShowGoodsofReturnList.size() > 0 || consumableInventory.size() > 0) {
- Consumable_order__c Return_Order_Sheet = new Consumable_order__c();
- Return_Order_Sheet.Name = '*';
- Return_Order_Sheet.Order_status__c = '鎵瑰噯';
- Return_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
- Return_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
- Return_Order_Sheet.Order_type__c = '杩斿搧';
- Return_Order_Sheet.RecordTypeid = System.Label.Dealer_Returned_Label;
- Return_Order_Sheet.Order_ProType__c = userPro_Type;
- insert Return_Order_Sheet;
- return_Order_id = Return_Order_Sheet.id;
- List<Consumable_order__c> consumable_order_ret = [
- SELECT Name
- FROM Consumable_order__c
- WHERE id = :Return_Order_Sheet.id
- ];
-
- //2017-07-03 鍒拌揣璁㈠崟
- Consumable_order__c Arrived_Order_Sheet = new Consumable_order__c();
- Arrived_Order_Sheet.Name = '*';
- Arrived_Order_Sheet.Order_status__c = '鎵瑰噯';
- Arrived_Order_Sheet.Order_type__c = '鍒拌揣';
- Arrived_Order_Sheet.Dealer_Info__c = accountid;
- Arrived_Order_Sheet.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- Arrived_Order_Sheet.Order_ProType__c = userPro_Type;
- insert Arrived_Order_Sheet;
- List<Consumable_order__c> consumable_order_arr = [
- SELECT Name
- FROM Consumable_order__c
- WHERE id = :Arrived_Order_Sheet.id
- ];
-
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // 铏氭嫙鐩樼偣鍗�
- Consumable_order__c Inventory_Order_Sheet = new Consumable_order__c();
- Inventory_Order_Sheet.Name = '*';
- Inventory_Order_Sheet.Order_status__c = '鎵瑰噯';
- Inventory_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
- Inventory_Order_Sheet.Inventory_date__c = Date.today();
- Inventory_Order_Sheet.Dealer_Info__c = accountid;
- Inventory_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
- Inventory_Order_Sheet.Order_type__c = '鐩樼偣';
- Inventory_Order_Sheet.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- Inventory_Order_Sheet.Order_ProType__c = userPro_Type;
- insert Inventory_Order_Sheet;
- inventory_Order_id = Inventory_Order_Sheet.id;
- //List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id]; //Commented By Li Jun 20230616
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-
- List<Consumable_order_details2__c> codcList = new List<Consumable_order_details2__c>();
- //鏂拌杩斿搧瀵瑰簲鐨勪骇鍝佹槑缁�
- List<Consumable_order_details2__c> codcorderdetList = new List<Consumable_order_details2__c>();
- //杩斿搧鍘熷洜,杩斿搧鏁伴噺妫�鏌�
- for (ConsumableorderdetailsInfo codi : ShowGoodsofReturnList) {
- if (
- codi.esd.Box_Piece__c == '涓�' &&
- (codi.esd.Rrturn_count__c == null ||
- String.valueof(codi.esd.Rrturn_count__c) == '' ||
- codi.esd.Rrturn_count__c <= 0)
- ) {
- continue;
- }
-
- if (
- codi.esd.Return_reason__c == null ||
- codi.esd.Return_reason__c == ''
- ) {
- if (isLwc) {
- returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�';
- } else {
- codi.esd.Return_reason__c.addError('璇疯ˉ鍏呰繑鍝佸師鍥�');
+ if(isLwc){
+ returnError = '涓嶅瓨鍦ㄥ埌璐ф槑缁�';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ埌璐ф槑缁�'));
}
return null;
- }
-
- if (codi.esd.Box_Piece__c == '涓�' && codi.esd.Rrturn_count__c > 0) {
- String key =
- '' +
- codi.esd.Consumable_ZS_order__c +
- codi.esd.Bar_Code__c;
- Integer deliverycnt = BarcodeCntMap.get(key);
- if (codi.esd.Rrturn_count__c > deliverycnt) {
- if (isLwc) {
- returnError = '瓒呭嚭鍑哄簱鏁伴噺';
- } else {
- codi.esd.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
- }
- return null;
- }
- }
}
-
- Integer tempNo = 0;
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- List<Consumable_order_details2__c> conOrderDetail2InList = new List<Consumable_order_details2__c>();
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- for (ConsumableorderdetailsInfo codi : ShowGoodsofReturnList) {
- Consumable_order_details2__c codcorderdet = new Consumable_order_details2__c();
-
- //鍗曚綅=涓�
- if (
- codi.esd.Box_Piece__c == '涓�' &&
- (codi.esd.Rrturn_count__c == null ||
- String.valueof(codi.esd.Rrturn_count__c) == '' ||
- codi.esd.Rrturn_count__c <= 0)
- ) {
- continue;
- }
-
- if (codi.esd.Box_Piece__c == '涓�' && codi.esd.Rrturn_count__c > 0) {
- hasReturnGoods = true;
-
- Integer cnt = 1;
- for (
- Consumable_order_details2__c codctmp : consumableorderdetails2Nobox
- ) {
- if (
- codctmp.Consumable_ZS_order__c ==
- codi.esd.Consumable_ZS_order__c &&
- codctmp.Bar_Code__c == codi.esd.Bar_Code__c
- ) {
- Consumable_order_details2__c esd = codctmp;
- // esd.Consumable_Return_order__c = Return_Order_Sheet.id;
- esd.Return_reason__c = codi.esd.Return_reason__c;
- esd.Return_date__c = Date.today();
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // esd.Return_reason__c = codi.esd.Return_reason__c;
- // esd.Return_date__c = Date.today();
- // esd.Consumable_Return_order__c = Return_Order_Sheet.id;
- if (
- codi.esd.Dealer_Saled__c == false &&
- codi.esd.Dealer_Shipment__c == false &&
- codi.esd.Lose_Flag__c == true
- ) {
- // esd.Lose_Flag__c = false;
- esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
- conOrderDetail2InList.add(esd);
- hasLoseGoods = true;
- } else {
- // esd.Return_date__c = Date.today();
- esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+ if(EsetId != null && EsetId != ''){
+ resultcheck = ConfimResult();
+ if(resultcheck.length() > 0){
+ for(String widget : overOrderBARcodeCunMap.keySet()) {
+ if(overOrderBARcodeCunMap.get(widget).size() >0){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add('浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�');
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�'));
+ }
+ for(String barcodeListTTT : (List<String>)overOrderBARcodeCunMap.get(widget)) {
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ warningList.add(barcodeListTTT);
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT));
+ }
+ }
+ }
}
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+ }
+ }else{
+ confimResultWithoutOrder();
+ }
+ try{
+ Consumable_order__c orderMain = new Consumable_order__c();
+ List<Consumable_order_details2__c> orderdetails = New List<Consumable_order_details2__c>();
+ //鍒拌揣姝g‘淇℃伅
+ orderMain.Name = '*';
+ orderMain.Order_status__c = '鎵瑰噯';
+ orderMain.Dealer_Info__c = accountid;
+ orderMain.Deliver_date__c = Date.today();
+ orderMain.Order_date__c = Date.today();
+ orderMain.Order_type__c = '鍒拌揣';
+ orderMain.Order_ProType__c = userPro_Type;
+ if(EsetId != null && EsetId != ''){
+ orderMain.Arrive_Order__c = coc.Id;
+ }
+ orderMain.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ insert orderMain;
- //淇敼杩斿搧鎵�鏈変汉
- esd.OwnerId = UserInfo.getUserId();
- esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
-
- //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
- codcorderdet = new Consumable_order_details2__c();
- codcorderdet.Name =
- consumable_order_arr[0].name +
- '-' +
- String.valueOf(++tempNo).leftPad(4, '0');
- codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
- codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
- //淇敼鍒拌揣鎵�鏈変汉
- codcorderdet.OwnerId = UserInfo.getUserId();
- codcorderdet.Arrive_date__c = Date.today();
- codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
- codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
- codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
- codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
- codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
- codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
- codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
+ List<Consumable_order__c> consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:orderMain.id];
+ arriveId = orderMain.id;
+ Decimal arriveAmount =0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------'));
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ insDetails.Id = ass.esd.Id;
+ insDetails.Consumable_Arrived_order__c = orderMain.id;
+ insDetails.Arrive_date__c = Date.today();
+ insDetails.Bar_Code__c = ass.esd.Bar_Code__c;
+ insDetails.OwnerId = UserInfo.getUserId();
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
+ insDetails.Transfer_Time__c = ass.esd.Transfer_Time__c == null ? 1 : ass.esd.Transfer_Time__c;
+ insDetails.Agency_Transfer__c = true;
+ insDetails.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null ? ass.esd.Dealer_Info_text__c : ass.esd.Frist_Transfer_Agency__c;
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ insDetails.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
+ insDetails.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c == null ? ass.esd.Dealer_Info_text__c : ass.esd.Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+ arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
+ orderdetails.add(insDetails);
+ }
+ Integer i = 1;
+ for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------'));
+ Consumable_order_details2__c insAfterDel = new Consumable_order_details2__c();
+ String str = ('000' + i).right(4);
+ // if(str.length() == 1){
+ // str = '0' + str;
+ // }
+ insAfterDel.Name = consumable_order[0].Name + '-'+ str;
+ insAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ // if(EsetId != null && EsetId != ''){
+ // insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ // }else{
+ // insAfterDel.Intra_Trade_List_RMB__c = 0;
+ // }
+ insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
//gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- codcorderdet.Intra_Trade_List_RMB__c = (codi.esd.Intra_Trade_List_RMB__c ==
- null ||
- codi.esd.Intra_Trade_List_RMB__c == 0)
- ? codi.esd.Intra_Trade_List__c
- : codi.esd.Intra_Trade_List_RMB__c;
- codcorderdet.RemoveBox_No__c = codctmp.RemoveBox_No__c;
- codcorderdet.RemoveBox_date__c = codctmp.RemoveBox_date__c;
- codcorderdet.Box_Piece__c = codctmp.Box_Piece__c;
+ insAfterDel.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+ if(EsetId != null && EsetId != ''){
+ insAfterDel.Consumable_order_minor__c = ESetId;
+ }
+ insAfterDel.Deliver_date__c = Date.today();
+ insAfterDel.Direct_Arrive_Product__c = true;
+ //TODO寰呯‘璁�
+ insAfterDel.Sterilization_limit__c = ass.sterilizationlimitDate;
+ insAfterDel.Consumable_Product__c = ass.Prod.id;
+ insAfterDel.Bar_Code__c = ass.barCodeNo;
+ insAfterDel.Used_account__c = accountid;
+ //TODO寰呯‘璁�
+ insAfterDel.SerialLotNo__c = ass.serialNoorLotNo;
+ insAfterDel.TracingCode__c = ass.tracingCodeNo;
- //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
- // codcorderdet.ContractNo_text__c= codctmp.ContractNo__c;
+ //insAfterDel.Dealer_Arrive__c = true;
+ insAfterDel.Consumable_Arrived_order__c = orderMain.id;
+ insAfterDel.Arrive_date__c = Date.today();
+ insAfterDel.OwnerId = UserInfo.getUserId();
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
+ insAfterDel.Transfer_Time__c = ass.esd.Transfer_Time__c == null ? 1 : ass.esd.Transfer_Time__c;
+ insAfterDel.Agency_Transfer__c = true;
+ insAfterDel.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null ? accountName : ass.esd.Frist_Transfer_Agency__c;
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ insAfterDel.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
+ insAfterDel.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c == null ? accountName : ass.esd.Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+ arriveAmount += insAfterDel.Intra_Trade_List_RMB__c;
+ //add by rentx 2020-10-14 strat
+ //insAfterDel.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
// tcm start
- if (
- String.isBlank(
- codctmp.Consumable_order_minor__r.ContractNo__c
- )
- ) {
- codcorderdet.ContractNo_text__c = codctmp.ContractNo_text__c;
- } else {
- codcorderdet.ContractNo_text__c = codctmp.Consumable_order_minor__r.ContractNo__c;
+ if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
+ insAfterDel.ContractNo_text__c= ass.esd.ContractNo_text__c;
+ }else {
+ insAfterDel.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
}
// tcm end
- //add by rentx 2020-10-13 end 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
+ //add by rentx 2020-10-14 end
+ i++;
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- if (hasLoseGoods) {
- codcorderdet.loseInventory__c = true;
+ ins.add(insAfterDel);
+
+ }
+ orderMain.Arrive_total_amount__c = arriveAmount;
+ update orderMain;
+ List<Consumable_order_details2__c> updateconsumableorderdetails2 = new List<Consumable_order_details2__c>();
+ //鏇存柊鏄庣粏鍙栨秷鏃堕棿 => 鏈埌璐у彇娑堬紝鍒拌揣鑷姩鐢熸垚鍑哄簱娴佺▼
+ List<Consumable_order_details2__c> addSaleOrderList = new List<Consumable_order_details2__c> ();
+ for(Consumable_order_details2__c Cod : consumableorderdetails2Cancle){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------3------'));
+ if (Cod.Dealer_Arrive__c) {
+ if (Cod.Dealer_Shipment__c == FALSE && Cod.Dealer_Saled__c == FALSE) {
+ addSaleOrderList.add(Cod);
+ }
+ } else {
+ Cod.Cancellation_Date__c = Date.today();
+ Cod.Cancellation_Flag__c = true;
+ updateconsumableorderdetails2.add(Cod);
}
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ }
+ if (addSaleOrderList.size() > 0) {
+ addSaleOrderAuto(addSaleOrderList);
+ }
+
+ if(updateconsumableorderdetails2.size() > 0){
+ update updateconsumableorderdetails2;
+ }
+
+ List<Consumable_order_details2__c> insertconsumableorderdetails2 = new List<Consumable_order_details2__c>();
+ for(Consumable_order_details2__c Cod2 : consumableorderdetails2Insert){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------'));
+ String str = ('000' + i).right(4);
+ // if(str.length() == 1){
+ // str = '0' + str;
+ // }
+ Cod2.Name = consumable_order[0].Name + '-'+ str;
+ Cod2.Consumable_order_minor__c = null;
+ Cod2.Deliver_date__c = Date.today();
+ Cod2.Used_account__c = accountid;
+ Cod2.Consumable_Arrived_order__c = orderMain.id;
+ Cod2.Arrive_date__c = Date.today();
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+ if (orderdetails2trMap.containsKey(Cod2.Bar_Code__c)) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4++++++' + Cod2.Frist_Storage_Agency__c));
+ Cod2.Transfer_Time__c = Cod2.Transfer_Time__c == null ? 1 : Cod2.Transfer_Time__c;
+ Cod2.Agency_Transfer__c = true;
+ Cod2.Frist_Transfer_Agency__c = Cod2.Frist_Transfer_Agency__c == null ? accountName : Cod2.Frist_Transfer_Agency__c;
+ }
+ // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+
// 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
- codcorderdet.Used_account__c = codi.esd.Used_account__c;
- codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
- codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
- codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
-
- codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------' + codi.esd.Frist_Storage_Agency__c));
- codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c ==
- null
- ? codi.esd.Dealer_Info_text__c
- : codi.esd.Frist_Storage_Agency__c;
+ Cod2.Agencyinfo_fromSAP__c = Cod2.Agencyinfo_fromSAP__c;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------' + Cod2.Frist_Storage_Agency__c));
+ Cod2.Frist_Storage_Agency__c = Cod2.Frist_Storage_Agency__c == null ? accountName : Cod2.Frist_Storage_Agency__c;
// 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
- codcorderdetList.add(codcorderdet);
- codcList.add(esd);
-
- cnt++;
- if (cnt > codi.esd.Rrturn_count__c)
- break;
- }
+ insertconsumableorderdetails2.add(Cod2);
+ i++;
}
- } else {
- hasReturnGoods = true;
- //鍗曚綅=鐩�
- //changeinvoiceInfo(codi.esd);
- //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- codi.esd.Return_date__c = Date.today();
- // codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
- if (
- codi.esd.Dealer_Saled__c == false &&
- codi.esd.Dealer_Shipment__c == false &&
- codi.esd.Lose_Flag__c == true
- ) {
- codi.esd.Lose_Flag__c = false;
- codi.esd.Return_reason__c = '';
- codi.esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
- conOrderDetail2InList.add(codi.esd);
- hasLoseGoods = true;
- } else {
- // codi.esd.Return_date__c = Date.today();
- codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+
+ //return null;
+
+ if(insertconsumableorderdetails2.size() >0){
+ insert insertconsumableorderdetails2;
}
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- codi.esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
- // codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
- //淇敼杩斿搧鎵�鏈変汉
- codi.esd.OwnerId = UserInfo.getUserId();
- codi.esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
- codcorderdet.Name =
- consumable_order_arr[0].name +
- '-' +
- String.valueOf(++tempNo).leftPad(4, '0');
- codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
- codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
- //淇敼鍒拌揣鎵�鏈変汉
- codcorderdet.OwnerId = UserInfo.getUserId();
- codcorderdet.Arrive_date__c = Date.today();
- codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
- codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
- codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
- codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
- codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
- codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
- codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- codcorderdet.Intra_Trade_List_RMB__c = (codi.esd.Intra_Trade_List_RMB__c ==
- null ||
- codi.esd.Intra_Trade_List_RMB__c == 0)
- ? codi.esd.Intra_Trade_List__c
- : codi.esd.Intra_Trade_List_RMB__c;
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- if (hasLoseGoods) {
- codcorderdet.loseInventory__c = true;
+
+ if(ins.size()>0){
+ insert ins;
}
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
- codcorderdet.Used_account__c = codi.esd.Used_account__c;
- codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
- codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
- codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
-
- codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------' + codi.esd.Frist_Storage_Agency__c));
- codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c ==
- null
- ? codi.esd.Dealer_Info_text__c
- : codi.esd.Frist_Storage_Agency__c;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
-
- //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
- // codcorderdet.ContractNo_text__c = /*codi.esd.ContractNo__c*/;
- // tcm start
- if (
- String.isBlank(codi.esd.Consumable_order_minor__r.ContractNo__c)
- ) {
- codcorderdet.ContractNo_text__c = codi.esd.ContractNo_text__c;
- } else {
- codcorderdet.ContractNo_text__c = codi.esd.Consumable_order_minor__r.ContractNo__c;
+ if(orderdetails.size()>0){
+ ControllerUtil.updateOrderDetailsSatus(orderdetails);
}
- // tcm end
- //add by rentx 2020-10-13 end 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
-
- codcorderdetList.add(codcorderdet);
- codcList.add(codi.esd);
- }
- }
-
- //鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁� 2017-07-05
- Integer i = 1;
- //for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
- for (ConsumableorderdetailsInfo ass : consumableInventory) {
- hasReturnGoods = true;
- Consumable_order_details2__c codcorderdetail = new Consumable_order_details2__c();
- Consumable_order_details2__c retorddetail = new Consumable_order_details2__c();
- String str = ('000' + i).right(4);
- // if(str.length() == 1){
- // str = '0' + str;
- // }
-
- if (ass.ReturnReason == null || ass.ReturnReason == '') {
+ //瓒呭嚭鍒拌揣鏁伴噺浜у搧鍙栨秷鏃ユ湡鏇存柊
+ List<Consumable_order_details2__c> needcanceldet = new List<Consumable_order_details2__c>();
+ if(cancellationProList.size() > 0){
+ needcanceldet = [SELECT Id,
+ Cancellation_Date__c
+ FROM Consumable_order_details2__c
+ WHERE Asset_Model_No__c in :cancellationProList
+ AND Consumable_order_minor__c = :ESetId
+ AND Dealer_Arrive__c = FALSE
+ AND Cancellation_Date__c = null ];
+ if(needcanceldet.size() >0){
+ for(Integer a = 0; a < needcanceldet.size(); a++){
+ needcanceldet[a].Cancellation_Date__c = Date.today();
+ needcanceldet[a].Cancellation_Flag__c = true;
+ }
+ ControllerUtil.updateOrderDetailsSatus(needcanceldet);
+ }
+ }
+ List<Consumable_order__c> qs = New List<Consumable_order__c>();
+ qs = [SELECT Id,Name,Order_status__c,Dealer_Info__c,Deliver_date__c,ReturnGs_Upload_Date__c,
+ Order_Reason__c,Order_date__c,
+ Contract_application_decision__c,Order_type__c,Total_num__c,
+ OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c
+ FROM Consumable_order__c
+ WHERE Id =:ESetId
+ AND Dealer_Info__c = :accountid];
+ if (qs.size()>0){
+ coc = qs[0];
+ }
+ saveFLGbln = true;
+ alertMessage = '鍒拌揣瀹屾垚銆�';
+ // Integer a = 1/0;
+ }catch(Exception e){
+ Database.rollback(sp);
//LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '璇疯ˉ鍏呰繑鍝佸師鍥�'
- )
- );
+ if(isLwc){
+ returnError = e.getLineNumber()+'---'+e.getMessage();
+ }else {
+ ApexPages.addMessages(e);
}
return null;
- }
-
- //鍒拌揣鏄庣粏
- codcorderdetail.Name = consumable_order_arr[0].Name + '-' + str;
- codcorderdetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- codcorderdetail.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- codcorderdetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
- codcorderdetail.Direct_Arrive_Product__c = true;
- codcorderdetail.Sterilization_limit__c = ass.sterilizationlimitDate;
- codcorderdetail.Consumable_Product__c = ass.Prod.id;
- codcorderdetail.Bar_Code__c = ass.barCodeNo;
- codcorderdetail.SerialLotNo__c = ass.serialNoorLotNo;
- codcorderdetail.TracingCode__c = ass.tracingCodeNo;
- codcorderdetail.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
- codcorderdetail.Arrive_date__c = Date.today();
-
- //add by rentx 2020-10-14 start
- // codcorderdetail.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
- // tcm start
- if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
- codcorderdetail.ContractNo_text__c = ass.esd.ContractNo_text__c;
- } else {
- codcorderdetail.ContractNo_text__c = ass.esd.Consumable_order_minor__r.ContractNo__c;
- }
- // tcm end
- //add by rentx 2020-10-14 end
-
- codcorderdetList.add(codcorderdetail);
-
- //杩斿搧鏄庣粏
- retorddetail.Return_reason__c = ass.ReturnReason;
- retorddetail.Return_date__c = Date.today();
- retorddetail.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
-
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
- // if(ass.esd.Dealer_Saled__c == false && ass.esd.Dealer_Shipment__c == false && ass.esd.Lose_Flag__c == true){
- // retorddetail.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
- // retorddetail.loseInventory__c = true;
- // }
- retorddetail.Consumable_Return_order__c = Return_Order_Sheet.id;
- // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-
- retorddetail.Name = consumable_order_ret[0].Name + '-' + str;
- retorddetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
- retorddetail.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
- retorddetail.Dealer_Info_IF__c = accountid;
- retorddetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
- retorddetail.Direct_Arrive_Product__c = true;
- retorddetail.Sterilization_limit__c = ass.sterilizationlimitDate;
- retorddetail.Consumable_Product__c = ass.Prod.id;
- retorddetail.Bar_Code__c = ass.barCodeNo;
- retorddetail.SerialLotNo__c = ass.serialNoorLotNo;
- retorddetail.TracingCode__c = ass.tracingCodeNo;
- retorddetail.Arrive_date__c = Date.today();
- retorddetail.Deliver_date__c = Date.today();
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
- retorddetail.Frist_Storage_Agency__c = accountName;
- // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
-
- //add by rentx 2020-10-14 start
- // retorddetail.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
- // tcm start
- if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
- retorddetail.ContractNo_text__c = ass.esd.ContractNo_text__c;
- } else {
- retorddetail.ContractNo_text__c = ass.esd.Consumable_order_minor__r.ContractNo__c;
- }
- // tcm end
- //add by rentx 2020-10-14 end
-
- codcorderdetList.add(retorddetail);
- i++;
}
-
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------end------'));
- // return null;
-
- if (codcList.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(codcList);
- //insert codcorderdetList;
- }
- if (codcorderdetList.size() > 0) {
- System.debug('codcorderdetList +++++ ' + codcorderdetList);
- insert codcorderdetList;
- }
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
- if (conOrderDetail2InList.size() > 0) {
- addInventoryDetails1(conOrderDetail2InList);
- }
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
-
- if (hasReturnGoods) {
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
- // return ToReturnGoodsPage();
- if (hasLoseGoods) {
- urlType = 'ToInventoryGoodsPage';
- return ToInventoryGoodsPage();
+ if(resultcheck.length() > 0){
+ return null;
+ }else if(resultcheckWithoutOrder.size() >0){
+ return null;
+ } else{
+ urlType = 'UnabletoEdit';
+ return UnabletoEdit();
// return null;
- } else {
- urlType = 'ToReturnGoodsPage';
- return ToReturnGoodsPage();
- // return null;
- }
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'
- )
- );
- }
- return null;
}
- } else {
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧';
- } else {
- ApexPages.addmessage(
- new ApexPages.message(
- ApexPages.severity.ERROR,
- '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'
- )
- );
+ }
+
+ // 杩斿搧妫�鏌ワ紝鍚庡洖搴�
+ public integer GoodsReturnCheck(){
+ List<String> GrListIn = ParseBarCode( barcode );
+ GrList = new List<String>();
+ Map<String,String> CheckBarcodeResult = new Map<String,String>();
+ for( String Str : GrListIn ){
+ CheckBarcodeResult.put( str , 'UnFind');
}
- return null;
- }
- } catch (Exception e) {
- Database.rollback(sp);
- //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
- if (isLwc) {
- returnError = e.getLineNumber() + '---' + e.getMessage();
- } else {
- ApexPages.addMessages(e);
- }
- return null;
- }
- }
-
- public void makeArrivedSummary() {
- detailsSummary = new List<ConsumableorderdetailsInfo>();
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableInventory ' + consumableInventory));
- try {
- ConsumableorderdetailsInfo arriveDdetailsSummary = null;
- Map<String, ConsumableorderdetailsInfo> detailsSummaryMap = new Map<String, ConsumableorderdetailsInfo>();
- for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
- if (detailsSummaryMap.containsKey(ass.Prod.Id)) {
- detailsSummaryMap.get(ass.Prod.Id).arrivedCount++;
- detailsSummaryMap.get(ass.Prod.Id)
- .arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
- } else {
- arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
- arriveDdetailsSummary.arrivedCount = 1;
- arriveDdetailsSummary.arriveAmount = ass.esd.Intra_Trade_List_RMB__c;
- detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
+ List<Consumable_order_details2__c> BarcodeRetrunResult =
+ [ SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
+ Consumable_Product__c,Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__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,Box_Piece__c, Rrturn_count__c,
+ Product_Type__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ FROM Consumable_order_details2__c
+ WHERE ((Dealer_Arrive__c = true
+ AND( Dealer_Shipment__c = true
+ //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
+ or Dealer_Saled__c = true
+ )
+ ))
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c in :GrListIn
+ AND ( not Product_Type__c like :userPro_Typestr)
+ AND Dealer_Returned__c = false
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ ORDER BY Box_Piece__c desc,Name ];
+ if(BarcodeRetrunResult.size()>0){
+ for (Integer i = 0; i < BarcodeRetrunResult.size(); i++) {
+ if(ErrorIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c) || ExistIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '浜у搧绫诲瀷['+BarcodeRetrunResult[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(BarcodeRetrunResult[i],str));
+ ErrorIdMap.put(BarcodeRetrunResult[i].Bar_Code__c,BarcodeRetrunResult[i].Bar_Code__c);
+ }
+ }
}
- }
- for (ConsumableorderdetailsInfo ass : consumableInventory) {
- if (detailsSummaryMap.containsKey(ass.Prod.Id)) {
- detailsSummaryMap.get(ass.Prod.Id).arrivedCount++;
- if (EsetId != null && EsetId != '') {
- detailsSummaryMap.get(ass.Prod.Id)
- .arriveAmount += ass.Prod.Intra_Trade_List_RMB__c;
- } else {
- detailsSummaryMap.get(ass.Prod.Id).arriveAmount += 0;
- }
- } else {
- arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
- arriveDdetailsSummary.arrivedCount = 1;
- if (EsetId != null && EsetId != '') {
- arriveDdetailsSummary.arriveAmount = ass.Prod.Intra_Trade_List_RMB__c;
- } else {
- arriveDdetailsSummary.arriveAmount = 0;
- }
- detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
+ AllMap.putAll(ErrorIdMap);
+ BarcodeRetrunResult =
+ [ SELECT Id,
+ Consumable_order_minor__c,
+ Deliver_date__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Name,
+ Bar_Code__c,
+ Arrive_date__c,
+ Dealer_Shipment__c,
+ Lose_Flag__c,
+ Dealer_Saled__c,
+ Return_reason__c,
+ Consumable_Shipment_order__c,
+ Consumable_Shipment_order__r.Name,
+ Send_date__c,
+ Consumable_Sale_order__c,
+ Consumable_Sale_order__r.Name,
+ Used_date__c,
+ SerialLotNo__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_ZS_order__c,
+ Consumable_ZS_order__r.Name,
+ Product_OutDate__c,
+ Invoice_Date__c,
+ recordtypeid,
+ Consumable_Arrived_order__c,
+ Box_Piece__c,
+ Rrturn_count__c,
+ Intra_Trade_List_RMB__c,
+ OwnerId,
+ SummonsForDirction_det__c,
+ Order_Dealer_Info__c,
+ HospItal_Name__c,
+ Agencyinfo_fromSAP__c,
+ Frist_Storage_Agency__c,
+ Dealer_Info_text__c,
+ Used_account__c,
+ Transfer_Time__c,
+ Frist_Transfer_Agency__c,
+ Arrive_Owner_Work_Location__c,
+ Agency_Transfer__c
+ //add by rentx 2020-10-14 start
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ //add by rentx 2020-10-14 end
+ ,Report_Product_Expiration__c
+ ,Intra_Trade_List__c
+ FROM Consumable_order_details2__c
+ WHERE ((Dealer_Arrive__c = true
+ AND( Dealer_Shipment__c = true
+ //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
+ or Dealer_Saled__c = true
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ or (Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true)
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ )
+ ))
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c in :GrListIn
+ AND Product_Type__c like :userPro_Typestr
+ AND Dealer_Returned__c = false
+ AND (Arrive_Owner_Work_Location__c =: userWorkLocation
+ OR OwnerId = :System.Label.User_OlympusSystem)
+ ORDER BY Box_Piece__c desc,Name ];
+ ShowGoodsofReturnList = new List<ConsumableorderdetailsInfo>();
+
+ //杩斿搧鏃秈stinct澶勭悊
+ if(ArrType=='ReG'){
+ BarcodeRetrunResult = getDistinctZSOrder(BarcodeRetrunResult);
}
- }
- for (String key : detailsSummaryMap.keySet()) {
- detailsSummary.add(detailsSummaryMap.get(key));
- }
- } catch (Exception e) {
- //Database.rollback(sp);
- throw new ControllerUtil.myException(
- 'e::' + e + ' linenumber::' + e.getLineNumber()
- );
- // ApexPages.addMessages(e);
- // ApexPages.addMessages(e.getLineNumber() + ' 11111111111111111');
- //return null;
- }
- }
+ for( Consumable_order_details2__c codc : BarcodeRetrunResult ){
+ if(ErrorIdMap.containsKey(codc.Bar_Code__c) || ExistIdMap.containsKey(codc.Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
- //璺宠浆鍒拌繑鍝侀〉闈�
- public Pagereference ToReturnGoodsPage() {
- PageReference ref = new Pagereference('/' + return_Order_id);
- ref.setRedirect(true);
- return ref;
- }
+ Matcher n = Pattern.compile('[0-9]').matcher(codc.TracingCode__c);
+ if(n.find()){
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
+ if (codc.TracingCode__c.length() == 5) {
+ String tr = codc.TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str));
+ ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str));
+ // ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c);
+ // continue;
+ // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end
+ }
+ if( CheckBarcodeResult.containsKey( codc.Bar_Code__c )){
+ GrList.add(codc.Bar_Code__c);
+ if( codc.Dealer_Shipment__c == true){
+ CheckBarcodeResult.put( codc.Bar_Code__c, '宸插嚭搴�' );
+ ShowGoodsofReturnList.add( new ConsumableorderdetailsInfo( codc ) );
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // else{
+ // CheckBarcodeResult.put( codc.Bar_Code__c, '宸查攢鍞�');
+ // ShowGoodsofReturnList.add( new ConsumableorderdetailsInfo( codc ) );
+ // }
+ else if( codc.Dealer_Saled__c == true ){
+ CheckBarcodeResult.put( codc.Bar_Code__c, '宸查攢鍞�');
+ ShowGoodsofReturnList.add( new ConsumableorderdetailsInfo( codc ) );
+ }else{
+ CheckBarcodeResult.put( codc.Bar_Code__c, '宸蹭涪澶�');
+ ShowGoodsofReturnList.add( new ConsumableorderdetailsInfo( codc ) );
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ }else{
+ continue;
+ }
+ }
+ }
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
- public Pagereference ToInventoryGoodsPage() {
- PageReference ref = new Pagereference('/' + inventory_Order_id);
- ref.setRedirect(true);
- return ref;
- }
- // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 end
-
- // 璺宠浆鍒板埌璐ц鍗曟槑缁�
- public PageReference UnabletoEdit() {
- PageReference ref = new Pagereference(
- '/ArriveGsDetails?EsetId=' + arriveId
- );
- ref.setRedirect(true);
- return ref;
- }
-
- public class ConsumableorderdetailsInfo implements Comparable {
- public Consumable_order_details2__c esd { get; set; }
- public Product2__c Prod { get; set; }
- public String ProductName { get; set; }
- //public Boolean canSELECT { get; set; }
- public String barCodeNo { get; set; }
- public Date sterilizationlimitDate { get; set; }
- public String serialNoorLotNo { get; set; }
- public String tracingCodeNo { get; set; }
- public String ReturnReason { get; set; }
- public String oldConsumableCount { get; set; }
- public String ErrorReason { get; set; }
- public boolean canEdit { get; set; }
- public Integer intMark { get; set; }
- public Decimal arriveAmount { get; set; }
- public Decimal arrivedCount { get; set; }
-
- public String ReportProductExpirationDate { get; set; }
-
- public ConsumableorderdetailsInfo() {
+ return BarcodeRetrunResult.size();
}
- public ConsumableorderdetailsInfo(
- Consumable_order_details2__c e,
- string str
- ) {
- esd = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.name;
- ErrorReason = str;
- intMark = 1;
- if (e.Report_Product_Expiration__c != null) {
- ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
- }
- }
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- canEdit = false;
- if (e.Box_Piece__c == '鐩�') {
- e.Rrturn_count__c = 1;
- canEdit = true;
- }
+ // 鍗曚綅涓轰釜鐨凚arcode瀵瑰簲鐨勫嚭搴撳崟
+ public integer Getconsumableorderdetails2Nobox(){
+ consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
+ BarcodeCntMap.clear();
+ consumableorderdetails2Nobox =
+ [ SELECT Id,
+ Consumable_order_minor__c,
+ Deliver_date__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Name,
+ Bar_Code__c,
+ Arrive_date__c,
+ Dealer_Shipment__c,
+ Dealer_Saled__c,
+ Return_reason__c,
+ Consumable_Shipment_order__c,
+ Send_date__c,
+ Consumable_Sale_order__c,
+ Used_date__c,
+ SerialLotNo__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_ZS_order__c,
+ Consumable_ZS_order__r.Name,
+ Product_OutDate__c,
+ Invoice_Date__c,
+ recordtypeid,
+ Consumable_Arrived_order__c,
+ Box_Piece__c,
+ RemoveBox_No__c,
+ RemoveBox_date__c,
+ Rrturn_count__c,
+ Dealer_Info_text__c,
+ Arrive_Owner_Work_Location__c,
+ Intra_Trade_List_RMB__c
+ //add by rentx 2020-10-13 start 杩斿搧鏃� 鏂版暟鎹褰昐AP鍚堝悓鍙�
+ ,ContractNo_text__c/*,ContractNo__c*/
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ ,Report_Product_Expiration__c
+ //add by rentx 2020-10-13 end
+ ,Intra_Trade_List__c
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ FROM Consumable_order_details2__c
+ WHERE
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // (Dealer_Shipment__c = true or Dealer_Saled__c = true)
+ (Dealer_Shipment__c = true or Dealer_Saled__c = true or (Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true))
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c in :noboxBarcodeList
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Dealer_Returned__c = false
+ AND Box_Piece__c = '涓�'
+ ORDER BY Consumable_ZS_order__c,RemoveBox_No__c];
- esd = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.name;
- if (e.Report_Product_Expiration__c != null) {
- ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
- }
+ AggregateResult[] results = [SELECT Consumable_ZS_order__c,Bar_Code__c,count(Id) recordCount
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // AND (Dealer_Shipment__c= true OR Dealer_Saled__c = true)
+ AND (Dealer_Shipment__c= true OR Dealer_Saled__c = true or(Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true))
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ AND Dealer_Returned__c = false
+ AND Bar_Code__c in :noboxBarcodeList
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Box_Piece__c = '涓�'
+ AND Dealer_Info_text__c = :accountName
+ GROUP BY Consumable_ZS_order__c,Bar_Code__c];
+
+ for(AggregateResult ar: results){
+ String key = '' + ar.get('Consumable_ZS_order__c') + ar.get('Bar_Code__c');
+ BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
+ }
+
+ return consumableorderdetails2Nobox.size();
}
- public ConsumableorderdetailsInfo(Product2__c e, List<String> barinfoL) {
- esd = new Consumable_order_details2__c();
- ProductName = e.Name__c;
- Prod = e;
- barCodeNo = barinfoL[0];
- if (String.isNotBlank(barinfoL[1])) {
- sterilizationlimitDate = Date.valueOf(barinfoL[1]);
- }
- serialNoorLotNo = barinfoL[2];
- tracingCodeNo = barinfoL[3];
- ReturnReason = '';
+ //distinct
+ public List<Consumable_order_details2__c> getDistinctZSOrder(List<Consumable_order_details2__c> duplicates){
+ List<Consumable_order_details2__c> distinctOrder = new List<Consumable_order_details2__c>();
+
+ for(Consumable_order_details2__c details2 : duplicates){
+ Boolean found = false;
+ for(Consumable_order_details2__c result : distinctOrder){
+ if(details2.Consumable_ZS_order__c == result.Consumable_ZS_order__c
+ && details2.Bar_Code__c == result.Bar_Code__c){
+ found = true;
+ break;
+ }
+ }
+
+ if(!found){
+ distinctOrder.add(details2);
+
+ if(details2.Box_Piece__c == '涓�') noboxBarcodeList.add(details2.Bar_Code__c);
+ }
+ }
+ return distinctOrder;
}
- public ConsumableorderdetailsInfo(
- Consumable_order_details2__c e,
- List<String> barinfoL
- ) {
- esd = e;
- Prod = e.Consumable_Product__r;
- barCodeNo = barinfoL[0];
- if (String.isNotBlank(barinfoL[1])) {
- sterilizationlimitDate = Date.valueOf(barinfoL[1]);
- }
- serialNoorLotNo = barinfoL[2];
- tracingCodeNo = barinfoL[3];
- if (e.Report_Product_Expiration__c != null) {
- ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
- }
+ // Update杩斿搧鏄庣粏淇℃伅
+ public Pagereference UpdateGoodsOfReturn(){
+ if( ShowGoodsofReturnList==null){
+ GoodsReturnCheck();
+ }
+ Getconsumableorderdetails2Nobox();
+
+ Savepoint sp = Database.setSavepoint();
+ boolean hasReturnGoods = false;
+ boolean hasLoseGoods = false;
+ try{
+ if( ShowGoodsofReturnList.size() >0 || consumableInventory.size()>0 ){
+
+ Consumable_order__c Return_Order_Sheet = new Consumable_order__c();
+ Return_Order_Sheet.Name ='*';
+ Return_Order_Sheet.Order_status__c = '鎵瑰噯';
+ Return_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+ Return_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
+ Return_Order_Sheet.Order_type__c = '杩斿搧';
+ Return_Order_Sheet.RecordTypeid =System.Label.Dealer_Returned_Label;
+ Return_Order_Sheet.Order_ProType__c = userPro_Type;
+ insert Return_Order_Sheet;
+ return_Order_id = Return_Order_Sheet.id;
+ List<Consumable_order__c> consumable_order_ret = [SELECT Name FROM Consumable_order__c WHERE id =:Return_Order_Sheet.id];
+
+ //2017-07-03 鍒拌揣璁㈠崟
+ Consumable_order__c Arrived_Order_Sheet = new Consumable_order__c();
+ Arrived_Order_Sheet.Name ='*';
+ Arrived_Order_Sheet.Order_status__c = '鎵瑰噯';
+ Arrived_Order_Sheet.Order_type__c = '鍒拌揣';
+ Arrived_Order_Sheet.Dealer_Info__c =accountid;
+ Arrived_Order_Sheet.RecordTypeid =System.Label.RT_ConOrder_Arrive;
+ Arrived_Order_Sheet.Order_ProType__c = userPro_Type;
+ insert Arrived_Order_Sheet;
+ List<Consumable_order__c> consumable_order_arr = [SELECT Name FROM Consumable_order__c WHERE id =:Arrived_Order_Sheet.id];
+
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // 铏氭嫙鐩樼偣鍗�
+ Consumable_order__c Inventory_Order_Sheet = new Consumable_order__c();
+ Inventory_Order_Sheet.Name ='*';
+ Inventory_Order_Sheet.Order_status__c = '鎵瑰噯';
+ Inventory_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+ Inventory_Order_Sheet.Inventory_date__c = Date.today();
+ Inventory_Order_Sheet.Dealer_Info__c =accountid;
+ Inventory_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
+ Inventory_Order_Sheet.Order_type__c = '鐩樼偣';
+ Inventory_Order_Sheet.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ Inventory_Order_Sheet.Order_ProType__c = userPro_Type;
+ insert Inventory_Order_Sheet;
+ inventory_Order_id = Inventory_Order_Sheet.id;
+ //List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id]; //Commented By Li Jun 20230616
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+
+ List<Consumable_order_details2__c> codcList = new List<Consumable_order_details2__c>();
+ //鏂拌杩斿搧瀵瑰簲鐨勪骇鍝佹槑缁�
+ List<Consumable_order_details2__c> codcorderdetList = new List<Consumable_order_details2__c>();
+ //杩斿搧鍘熷洜,杩斿搧鏁伴噺妫�鏌�
+ for( ConsumableorderdetailsInfo codi : ShowGoodsofReturnList ){
+ if (codi.esd.Box_Piece__c =='涓�' && (
+ codi.esd.Rrturn_count__c == null ||
+ String.valueof(codi.esd.Rrturn_count__c) =='' ||
+ codi.esd.Rrturn_count__c <= 0)){
+ continue;
+ }
+
+ if(codi.esd.Return_reason__c==null||codi.esd.Return_reason__c==''){
+ if(isLwc){
+ returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�';
+ }else {
+ codi.esd.Return_reason__c.addError('璇疯ˉ鍏呰繑鍝佸師鍥�');
+ }
+ return null;
+ }
+
+
+ if(codi.esd.Box_Piece__c=='涓�' && codi.esd.Rrturn_count__c > 0){
+ String key = '' + codi.esd.Consumable_ZS_order__c + codi.esd.Bar_Code__c;
+ Integer deliverycnt = BarcodeCntMap.get(key);
+ if(codi.esd.Rrturn_count__c > deliverycnt){
+ if(isLwc){
+ returnError = '瓒呭嚭鍑哄簱鏁伴噺';
+ }else {
+ codi.esd.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
+ }
+ return null;
+ }
+ }
+ }
+
+ Integer tempNo=0;
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ List<Consumable_order_details2__c> conOrderDetail2InList = new List<Consumable_order_details2__c>();
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ for( ConsumableorderdetailsInfo codi : ShowGoodsofReturnList ){
+ Consumable_order_details2__c codcorderdet = new Consumable_order_details2__c();
+
+ //鍗曚綅=涓�
+ if (codi.esd.Box_Piece__c =='涓�' && (
+ codi.esd.Rrturn_count__c == null ||
+ String.valueof(codi.esd.Rrturn_count__c) =='' ||
+ codi.esd.Rrturn_count__c <= 0)){
+ continue;
+ }
+
+ if(codi.esd.Box_Piece__c=='涓�' && codi.esd.Rrturn_count__c > 0){
+ hasReturnGoods = true;
+
+ Integer cnt = 1;
+ for(Consumable_order_details2__c codctmp : consumableorderdetails2Nobox ){
+ if(codctmp.Consumable_ZS_order__c == codi.esd.Consumable_ZS_order__c && codctmp.Bar_Code__c == codi.esd.Bar_Code__c){
+ Consumable_order_details2__c esd = codctmp;
+ // esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+ esd.Return_reason__c = codi.esd.Return_reason__c;
+ esd.Return_date__c = Date.today();
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // esd.Return_reason__c = codi.esd.Return_reason__c;
+ // esd.Return_date__c = Date.today();
+ // esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+ if(codi.esd.Dealer_Saled__c == false && codi.esd.Dealer_Shipment__c == false && codi.esd.Lose_Flag__c == true){
+ // esd.Lose_Flag__c = false;
+ esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
+ conOrderDetail2InList.add(esd);
+ hasLoseGoods = true;
+ }
+ else{
+ // esd.Return_date__c = Date.today();
+ esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+
+ //淇敼杩斿搧鎵�鏈変汉
+ esd.OwnerId = UserInfo.getUserId();
+ esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+
+ //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
+ codcorderdet = new Consumable_order_details2__c();
+ codcorderdet.Name = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4,'0');
+ codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
+ codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
+ //淇敼鍒拌揣鎵�鏈変汉
+ codcorderdet.OwnerId = UserInfo.getUserId();
+ codcorderdet.Arrive_date__c = Date.today();
+ codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
+ codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
+ codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
+ codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
+ codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
+ codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
+ codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ codcorderdet.Intra_Trade_List_RMB__c = (codi.esd.Intra_Trade_List_RMB__c == null || codi.esd.Intra_Trade_List_RMB__c == 0) ? codi.esd.Intra_Trade_List__c : codi.esd.Intra_Trade_List_RMB__c;
+ codcorderdet.RemoveBox_No__c = codctmp.RemoveBox_No__c;
+ codcorderdet.RemoveBox_date__c = codctmp.RemoveBox_date__c;
+ codcorderdet.Box_Piece__c = codctmp.Box_Piece__c;
+
+ //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
+ // codcorderdet.ContractNo_text__c= codctmp.ContractNo__c;
+ // tcm start
+ if (String.isBlank(codctmp.Consumable_order_minor__r.ContractNo__c)) {
+ codcorderdet.ContractNo_text__c= codctmp.ContractNo_text__c;
+ }else {
+ codcorderdet.ContractNo_text__c= codctmp.Consumable_order_minor__r.ContractNo__c;
+ }
+ // tcm end
+ //add by rentx 2020-10-13 end 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
+
+
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ if(hasLoseGoods){
+ codcorderdet.loseInventory__c = true;
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
+ codcorderdet.Used_account__c = codi.esd.Used_account__c;
+ codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
+ codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
+ codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
+
+ codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------' + codi.esd.Frist_Storage_Agency__c));
+ codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c == null ? codi.esd.Dealer_Info_text__c : codi.esd.Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+ codcorderdetList.add(codcorderdet);
+ codcList.add( esd );
+
+ cnt++;
+ if(cnt > codi.esd.Rrturn_count__c) break;
+ }
+
+ }
+ }
+ else{
+ hasReturnGoods = true;
+ //鍗曚綅=鐩�
+ //changeinvoiceInfo(codi.esd);
+ //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ codi.esd.Return_date__c = Date.today();
+ // codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+ if(codi.esd.Dealer_Saled__c == false && codi.esd.Dealer_Shipment__c == false && codi.esd.Lose_Flag__c == true){
+ codi.esd.Lose_Flag__c = false;
+ codi.esd.Return_reason__c = '';
+ codi.esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
+ conOrderDetail2InList.add(codi.esd);
+ hasLoseGoods = true;
+ }
+ else{
+ // codi.esd.Return_date__c = Date.today();
+ codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ codi.esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+ // codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
+ //淇敼杩斿搧鎵�鏈変汉
+ codi.esd.OwnerId = UserInfo.getUserId();
+ codi.esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+ codcorderdet.Name = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4,'0');
+ codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
+ codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
+ //淇敼鍒拌揣鎵�鏈変汉
+ codcorderdet.OwnerId = UserInfo.getUserId();
+ codcorderdet.Arrive_date__c = Date.today();
+ codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
+ codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
+ codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
+ codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
+ codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
+ codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
+ codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ codcorderdet.Intra_Trade_List_RMB__c = (codi.esd.Intra_Trade_List_RMB__c == null || codi.esd.Intra_Trade_List_RMB__c == 0) ? codi.esd.Intra_Trade_List__c : codi.esd.Intra_Trade_List_RMB__c;
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ if(hasLoseGoods){
+ codcorderdet.loseInventory__c = true;
+ }
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
+ codcorderdet.Used_account__c = codi.esd.Used_account__c;
+ codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
+ codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
+ codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
+
+ codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------' + codi.esd.Frist_Storage_Agency__c));
+ codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c == null ? codi.esd.Dealer_Info_text__c : codi.esd.Frist_Storage_Agency__c;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+
+ //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
+ // codcorderdet.ContractNo_text__c = /*codi.esd.ContractNo__c*/;
+ // tcm start
+ if (String.isBlank(codi.esd.Consumable_order_minor__r.ContractNo__c)) {
+ codcorderdet.ContractNo_text__c= codi.esd.ContractNo_text__c;
+ }else {
+ codcorderdet.ContractNo_text__c= codi.esd.Consumable_order_minor__r.ContractNo__c;
+ }
+ // tcm end
+ //add by rentx 2020-10-13 end 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
+
+ codcorderdetList.add(codcorderdet);
+ codcList.add( codi.esd );
+ }
+ }
+
+ //鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁� 2017-07-05
+ Integer i = 1;
+ //for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
+ for(ConsumableorderdetailsInfo ass : consumableInventory){
+ hasReturnGoods = true;
+ Consumable_order_details2__c codcorderdetail = new Consumable_order_details2__c();
+ Consumable_order_details2__c retorddetail = new Consumable_order_details2__c();
+ String str = ('000' + i).right(4);
+ // if(str.length() == 1){
+ // str = '0' + str;
+ // }
+
+ if(ass.ReturnReason==null || ass.ReturnReason==''){
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇疯ˉ鍏呰繑鍝佸師鍥�'));
+ }
+ return null;
+ }
+
+ //鍒拌揣鏄庣粏
+ codcorderdetail.Name = consumable_order_arr[0].Name + '-'+ str;
+ codcorderdetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ codcorderdetail.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ codcorderdetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+ codcorderdetail.Direct_Arrive_Product__c = true;
+ codcorderdetail.Sterilization_limit__c = ass.sterilizationlimitDate;
+ codcorderdetail.Consumable_Product__c = ass.Prod.id;
+ codcorderdetail.Bar_Code__c = ass.barCodeNo;
+ codcorderdetail.SerialLotNo__c = ass.serialNoorLotNo;
+ codcorderdetail.TracingCode__c = ass.tracingCodeNo;
+ codcorderdetail.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
+ codcorderdetail.Arrive_date__c = Date.today();
+
+ //add by rentx 2020-10-14 start
+ // codcorderdetail.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
+ // tcm start
+ if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
+ codcorderdetail.ContractNo_text__c= ass.esd.ContractNo_text__c;
+ }else {
+ codcorderdetail.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
+ }
+ // tcm end
+ //add by rentx 2020-10-14 end
+
+ codcorderdetList.add(codcorderdetail);
+
+ //杩斿搧鏄庣粏
+ retorddetail.Return_reason__c = ass.ReturnReason;
+ retorddetail.Return_date__c = Date.today();
+ retorddetail.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+ // if(ass.esd.Dealer_Saled__c == false && ass.esd.Dealer_Shipment__c == false && ass.esd.Lose_Flag__c == true){
+ // retorddetail.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
+ // retorddetail.loseInventory__c = true;
+ // }
+ retorddetail.Consumable_Return_order__c = Return_Order_Sheet.id;
+ // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+
+
+ retorddetail.Name = consumable_order_ret[0].Name + '-'+ str;
+ retorddetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+ retorddetail.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
+ retorddetail.Dealer_Info_IF__c = accountid;
+ retorddetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+ retorddetail.Direct_Arrive_Product__c = true;
+ retorddetail.Sterilization_limit__c = ass.sterilizationlimitDate;
+ retorddetail.Consumable_Product__c = ass.Prod.id;
+ retorddetail.Bar_Code__c = ass.barCodeNo;
+ retorddetail.SerialLotNo__c = ass.serialNoorLotNo;
+ retorddetail.TracingCode__c = ass.tracingCodeNo;
+ retorddetail.Arrive_date__c = Date.today();
+ retorddetail.Deliver_date__c = Date.today();
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
+ retorddetail.Frist_Storage_Agency__c = accountName;
+ // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
+
+ //add by rentx 2020-10-14 start
+ // retorddetail.ContractNo_text__c = /*ass.esd.ContractNo__c*/;
+ // tcm start
+ if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
+ retorddetail.ContractNo_text__c= ass.esd.ContractNo_text__c;
+ }else {
+ retorddetail.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
+ }
+ // tcm end
+ //add by rentx 2020-10-14 end
+
+ codcorderdetList.add(retorddetail);
+ i++;
+ }
+
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------end------'));
+ // return null;
+
+ if(codcList.size()>0){
+ ControllerUtil.updateOrderDetailsSatus( codcList );
+ //insert codcorderdetList;
+ }
+ if (codcorderdetList.size()>0){
+ System.debug('codcorderdetList +++++ '+ codcorderdetList);
+ insert codcorderdetList;
+ }
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
+ if(conOrderDetail2InList.size() > 0){
+ addInventoryDetails1(conOrderDetail2InList);
+ }
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
+
+ if(hasReturnGoods){
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
+ // return ToReturnGoodsPage();
+ if(hasLoseGoods){
+ urlType = 'ToInventoryGoodsPage';
+ return ToInventoryGoodsPage();
+ // return null;
+ }else{
+ urlType = 'ToReturnGoodsPage';
+ return ToReturnGoodsPage();
+ // return null;
+ }
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
+ }
+ else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
+ }
+ return null;
+ }
+
+ }else{
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧';
+ }else {
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
+ }
+ return null;
+ }
+ }catch(Exception e){
+ Database.rollback(sp);
+ //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27
+ if(isLwc){
+ returnError = e.getLineNumber()+'---'+e.getMessage();
+ }else {
+ ApexPages.addMessages(e);
+ }
+ return null;
+ }
}
- public ConsumableorderdetailsInfo(Product2__c e) {
- Prod = e;
+
+ public void makeArrivedSummary(){
+ detailsSummary = new List<ConsumableorderdetailsInfo>();
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableInventory ' + consumableInventory));
+ try{
+ ConsumableorderdetailsInfo arriveDdetailsSummary = null;
+ Map<String,ConsumableorderdetailsInfo> detailsSummaryMap = new Map<String,ConsumableorderdetailsInfo>();
+ for(ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords){
+ if(detailsSummaryMap.containsKey(ass.Prod.Id)){
+ detailsSummaryMap.get(ass.Prod.Id).arrivedCount ++;
+ detailsSummaryMap.get(ass.Prod.Id).arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
+ }else{
+ arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
+ arriveDdetailsSummary.arrivedCount = 1;
+ arriveDdetailsSummary.arriveAmount = ass.esd.Intra_Trade_List_RMB__c;
+ detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
+ }
+ }
+ for(ConsumableorderdetailsInfo ass : consumableInventory){
+ if(detailsSummaryMap.containsKey(ass.Prod.Id)){
+ detailsSummaryMap.get(ass.Prod.Id).arrivedCount ++;
+ if(EsetId != null && EsetId != ''){
+ detailsSummaryMap.get(ass.Prod.Id).arriveAmount += ass.Prod.Intra_Trade_List_RMB__c;
+ }else{
+ detailsSummaryMap.get(ass.Prod.Id).arriveAmount += 0;
+ }
+ }else{
+ arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
+ arriveDdetailsSummary.arrivedCount = 1;
+ if(EsetId != null && EsetId != ''){
+ arriveDdetailsSummary.arriveAmount = ass.Prod.Intra_Trade_List_RMB__c;
+ }else{
+ arriveDdetailsSummary.arriveAmount = 0;
+ }
+ detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
+ }
+ }
+ for(String key : detailsSummaryMap.keySet()){
+ detailsSummary.add(detailsSummaryMap.get(key));
+ }
+ }catch(Exception e){
+ //Database.rollback(sp);
+ throw new ControllerUtil.myException('e::'+e + ' linenumber::'+e.getLineNumber());
+ // ApexPages.addMessages(e);
+ // ApexPages.addMessages(e.getLineNumber() + ' 11111111111111111');
+
+ //return null;
+ }
}
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- return null;
+
+ //璺宠浆鍒拌繑鍝侀〉闈�
+ public Pagereference ToReturnGoodsPage(){
+ PageReference ref = new Pagereference('/'+return_Order_id);
+ ref.setRedirect(true);
+ return ref;
}
- }
-}
+
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
+ public Pagereference ToInventoryGoodsPage(){
+ PageReference ref = new Pagereference('/'+inventory_Order_id);
+ ref.setRedirect(true);
+ return ref;
+ }
+ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 end
+
+ // 璺宠浆鍒板埌璐ц鍗曟槑缁�
+ public PageReference UnabletoEdit(){
+ PageReference ref = new Pagereference('/ArriveGsDetails?EsetId='+arriveId);
+ ref.setRedirect(true);
+ return ref;
+ }
+
+ public class ConsumableorderdetailsInfo implements Comparable {
+ public Consumable_order_details2__c esd { get; set; }
+ public Product2__c Prod { get; set; }
+ public String ProductName { get; set; }
+ //public Boolean canSELECT { get; set; }
+ public String barCodeNo { get; set; }
+ public Date sterilizationlimitDate { get; set; }
+ public String serialNoorLotNo { get; set; }
+ public String tracingCodeNo { get; set; }
+ public String ReturnReason { get; set; }
+ public String oldConsumableCount { get; set; }
+ public String ErrorReason { get; set; }
+ public boolean canEdit { get; set; }
+ public Integer intMark { get; set; }
+ public Decimal arriveAmount { get; set; }
+ public Decimal arrivedCount { get; set; }
+
+ public String ReportProductExpirationDate {get;set;}
+
+ public ConsumableorderdetailsInfo(){
+
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ intMark = 1;
+ if (e.Report_Product_Expiration__c != null) {
+ ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
+ }
+
+ }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ canEdit = false;
+ if(e.Box_Piece__c=='鐩�'){
+ e.Rrturn_count__c = 1;
+ canEdit = true;
+ }
+
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ if (e.Report_Product_Expiration__c != null) {
+ ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
+ }
+
+ }
+
+ public ConsumableorderdetailsInfo(Product2__c e,List<String> barinfoL) {
+ esd = new Consumable_order_details2__c();
+ ProductName = e.Name__c;
+ Prod = e;
+ barCodeNo = barinfoL[0];
+ if(String.isNotBlank(barinfoL[1])){
+ sterilizationlimitDate = Date.valueOf(barinfoL[1]);
+ }
+ serialNoorLotNo = barinfoL[2];
+ tracingCodeNo = barinfoL[3];
+ ReturnReason = '';
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,List<String> barinfoL) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ barCodeNo = barinfoL[0];
+ if(String.isNotBlank(barinfoL[1])){
+ sterilizationlimitDate = Date.valueOf(barinfoL[1]);
+ }
+ serialNoorLotNo = barinfoL[2];
+ tracingCodeNo = barinfoL[3];
+ if (e.Report_Product_Expiration__c != null) {
+ ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
+ }
+
+ }
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ Prod = e;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ArriveGoodsControllerTest.cls b/force-app/main/default/classes/ArriveGoodsControllerTest.cls
index 910aeb3..80257b2 100644
--- a/force-app/main/default/classes/ArriveGoodsControllerTest.cls
+++ b/force-app/main/default/classes/ArriveGoodsControllerTest.cls
@@ -1,1066 +1,704 @@
@isTest
private class ArriveGoodsControllerTest {
- //閫夋嫨绛夊緟鍏ュ簱,鍖呮嫭01 鍜�241
- @isTest
- static void arriveWithID() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
+ //閫夋嫨绛夊緟鍏ュ簱,鍖呮嫭01 鍜�241
+ @isTest
+ static void arriveWithID() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+
+ insert Orderdet1;
+
+ PageReference page = new PageReference('/apex/ArriveGoods?ESetid=' + Order1.Id);
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n241N30477301115120017181000105ZK250BXJRI\n241N30477301115120017181000105ZK250\n01049531702003111115120017181000105ZK250';
+ Controller.SearchPro();
+ // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
+ // System.assertEquals(2, Controller.consumableInventory.size());
+ Controller.ArriveGoodsConfim();
+ List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
+ // System.assertEquals(3, ins.size());
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
+ //浜у搧鐩存帴鍏ュ簱,鍖呮嫭01 鍜�241
+ @isTest
+ static void arriveWithoutID() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- insert Orderdet1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- PageReference page = new PageReference(
- '/apex/ArriveGoods?ESetid=' + Order1.Id
- );
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n241N30477301115120017181000105ZK250BXJRI\n241N30477301115120017181000105ZK250\n01049531702003111115120017181000105ZK250';
- Controller.SearchPro();
- // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
- // System.assertEquals(2, Controller.consumableInventory.size());
- Controller.ArriveGoodsConfim();
- List<Consumable_order_details2__c> ins = [
- SELECT Id, Name
- FROM Consumable_order_details2__c
- ];
- // System.assertEquals(3, ins.size());
- System.Test.stopTest();
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',ProductCode_Ext__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='N3047731',ProductCode_Ext__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test01',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '';
+ Controller.SearchPro();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n241N30477311115120017181000105ZK250BXJRA\n241Test021115120017181000105ZK250\n01049531702003111115120017181000105ZK250';
+ Controller.SearchPro();
+ Controller.ArriveGoodsConfim();
+ List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c WHERE Bar_Code__c in ('01049531702003111115120017181000105ZK250BXJRF','241N30477311115120017181000105ZK250BXJRA')];
+ // System.assertEquals(2, ins.size());
+ System.Test.stopTest();
+ }
}
- }
+ //鏁翠綋鍒拌揣
+ @isTest
+ static void ArriveTest() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //浜у搧鐩存帴鍏ュ簱,鍖呮嫭01 鍜�241
- @isTest
- static void arriveWithoutID() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert new Product2__c[] {pro1};
+ // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ // insert myAccount1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order2;
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order2.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
+ Orderdets8.SerialLotNo__c = '5ZK';
+ insert Orderdets8;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.Order_ProType__c = 'ET';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order1;
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.Box_Piece__c = '鐩�';
+ Orderdet1.TracingCode__c = 'BXJRA';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ //娌″埌璐�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.Box_Piece__c = '鐩�';
+ Orderdet2.TracingCode__c = 'BXJRB';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Box_Piece__c = '鐩�';
+ Orderdet3.TracingCode__c = 'BXJRC';
+ Orderdet3.SerialLotNo__c = '5ZK';
+ //Orderdet3.Box_Piece__c = '涓�';
+
+
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '鐩�';
+ Orderdet4.TracingCode__c = 'BXJRD';
+ Orderdet4.SerialLotNo__c = '5ZK';
+ //Orderdet4.Box_Piece__c = '鐩�';
+ //Orderdet4.Return_date__c = null;
+
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet5.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.TracingCode__c = 'BXJRE';
+ Orderdet5.SerialLotNo__c = '5ZK';
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
+
+
+
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
+ Controller.SearchPro();
+
+ System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
+ // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
+ System.Test.stopTest();
+
+
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',ProductCode_Ext__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='N3047731',ProductCode_Ext__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test01',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '';
- Controller.SearchPro();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n241N30477311115120017181000105ZK250BXJRA\n241Test021115120017181000105ZK250\n01049531702003111115120017181000105ZK250';
- Controller.SearchPro();
- Controller.ArriveGoodsConfim();
- List<Consumable_order_details2__c> ins = [
- SELECT Id, Name
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN (
- '01049531702003111115120017181000105ZK250BXJRF',
- '241N30477311115120017181000105ZK250BXJRA'
- )
- ];
- // System.assertEquals(2, ins.size());
- System.Test.stopTest();
- }
- }
- //鏁翠綋鍒拌揣
- @isTest
- static void ArriveTest() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ //鏁翠綋鍒拌揣
+ @isTest
+ static void ArriveTest1() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ // insert myAccount1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order2;
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order2.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
+ Orderdets8.SerialLotNo__c = '5ZK';
+ insert Orderdets8;
+
+ //system.runAs(myUser_Test){
+ //璁㈠崟
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.Order_ProType__c = 'ET';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order1;
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.TracingCode__c = 'BXJRA';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ //娌″埌璐�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.TracingCode__c = 'BXJRB';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.TracingCode__c = 'BXJRC';
+ Orderdet3.SerialLotNo__c = '5ZK';
+
+
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.TracingCode__c = 'BXJRD';
+ Orderdet4.SerialLotNo__c = '5ZK';
+ //Orderdet4.Box_Piece__c = '鐩�';
+ //Orderdet4.Return_date__c = null;
+
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order2.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet5.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.TracingCode__c = 'BXJRE';
+ Orderdet5.SerialLotNo__c = '5ZK';
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
+
+
+
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
+ Controller.SearchPro();
+
+ System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
+ // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
+ System.Test.stopTest();
+
+
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert new List<Product2__c>{ pro1 };
- // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
- // insert myAccount1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order2;
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order2.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
- Orderdets8.SerialLotNo__c = '5ZK';
- insert Orderdets8;
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.Order_ProType__c = 'ET';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order1;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.Box_Piece__c = '鐩�';
- Orderdet1.TracingCode__c = 'BXJRA';
- Orderdet1.SerialLotNo__c = '5ZK';
- //娌″埌璐�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.TracingCode__c = 'BXJRB';
- Orderdet2.SerialLotNo__c = '5ZK';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.TracingCode__c = 'BXJRC';
- Orderdet3.SerialLotNo__c = '5ZK';
- //Orderdet3.Box_Piece__c = '涓�';
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '鐩�';
- Orderdet4.TracingCode__c = 'BXJRD';
- Orderdet4.SerialLotNo__c = '5ZK';
- //Orderdet4.Box_Piece__c = '鐩�';
- //Orderdet4.Return_date__c = null;
+ //杩斿搧
+ @isTest
+ static void productReturn() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.Consumable_Arrived_order__c = Order1.Id;
- Orderdet5.Consumable_Shipment_order__c = Order1.Id;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'BXJRE';
- Orderdet5.SerialLotNo__c = '5ZK';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
- ArriveGoodsController Controller = new ArriveGoodsController();
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
- Controller.SearchPro();
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- System.assertEquals(
- 'OCM_01_001002',
- controller.ConsumableorderdetailsRecords[0].esd.Name
- );
- // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
- System.Test.stopTest();
- }
- }
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- //鏁翠綋鍒拌揣
- @isTest
- static void ArriveTest1() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ //杩斿搧璁㈠崟
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
+ insert Order1;
+ insert Order2;
+
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Pro001';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.TracingCode__c = 'BXJRF';
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Pro001';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ Orderdet2.TracingCode__c = 'BXJRF';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ Orderdet3.Box_Piece__c ='鐩�';
+ Orderdet3.TracingCode__c = 'BXJRF';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
+ Orderdet4.Box_Piece__c ='涓�';
+ Orderdet4.TracingCode__c = 'BXJRF';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='鐩�';
+ Orderdet5.TracingCode__c = 'BXJRF';
+ //fanpin
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001006';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Pro001';
+ Orderdet6.Consumable_Return_order__c = Order2.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet6.Box_Piece__c ='涓�';
+ Orderdet6.TracingCode__c = 'BXJRF';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6};
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRI';
+ Controller.SearchPro();
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
+ //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
+ // System.assertEquals(5, controller.ConsumableorderdetailsRecordserror.size()); //tcm
+ //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
+ //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
+ //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
+ Controller.GoodsReturnCheck();
+ controller.ShowGoodsofReturnList[0].esd.Return_reason__c='澶氬彂';
+ controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ Controller.UpdateGoodsOfReturn();
+ Controller.ToReturnGoodsPage();
+ Controller.geterrorsize();
+ System.Test.stopTest();
+
+ }
}
- // // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
- // insert myAccount1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order2;
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order2.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
- Orderdets8.SerialLotNo__c = '5ZK';
- insert Orderdets8;
+ //杩斿搧
+ @isTest
+ static void productReturn_new() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //system.runAs(myUser_Test){
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.Order_ProType__c = 'ET';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order1;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.TracingCode__c = 'BXJRA';
- Orderdet1.SerialLotNo__c = '5ZK';
- //娌″埌璐�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.TracingCode__c = 'BXJRB';
- Orderdet2.SerialLotNo__c = '5ZK';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.TracingCode__c = 'BXJRC';
- Orderdet3.SerialLotNo__c = '5ZK';
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.TracingCode__c = 'BXJRD';
- Orderdet4.SerialLotNo__c = '5ZK';
- //Orderdet4.Box_Piece__c = '鐩�';
- //Orderdet4.Return_date__c = null;
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ //Consumable_order__c coc = [select Dealer_Info__r.name from Consumable_order__c where Id =:Order1.Id];
+ //system.assertEquals('qeee',coc.Dealer_Info__r.name);
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order2.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.Consumable_Arrived_order__c = Order1.Id;
- Orderdet5.Consumable_Shipment_order__c = Order1.Id;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'BXJRE';
- Orderdet5.SerialLotNo__c = '5ZK';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_001001';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- ArriveGoodsController Controller = new ArriveGoodsController();
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
- Controller.SearchPro();
-
- System.assertEquals(
- 'OCM_01_001002',
- controller.ConsumableorderdetailsRecords[0].esd.Name
- );
- // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
- System.Test.stopTest();
- }
- }
-
- //杩斿搧
- @isTest
- static void productReturn() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
-
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- //杩斿搧璁㈠崟
-
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
- insert Order1;
- insert Order2;
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Pro001';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.TracingCode__c = 'BXJRF';
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Pro001';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- Orderdet2.TracingCode__c = 'BXJRF';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.TracingCode__c = 'BXJRF';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.TracingCode__c = 'BXJRF';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'BXJRF';
- //fanpin
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001006';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Pro001';
- Orderdet6.Consumable_Return_order__c = Order2.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet6.Box_Piece__c = '涓�';
- Orderdet6.TracingCode__c = 'BXJRF';
-
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6
- };
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRI';
- Controller.SearchPro();
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
- //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
- // System.assertEquals(5, controller.ConsumableorderdetailsRecordserror.size()); //tcm
- //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
- //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
- //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
- Controller.GoodsReturnCheck();
- controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '澶氬彂';
- controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1;
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- Controller.UpdateGoodsOfReturn();
- Controller.ToReturnGoodsPage();
- Controller.geterrorsize();
- System.Test.stopTest();
- }
- }
-
- //杩斿搧
- @isTest
- static void productReturn_new() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
-
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- //Consumable_order__c coc = [select Dealer_Info__r.name from Consumable_order__c where Id =:Order1.Id];
- //system.assertEquals('qeee',coc.Dealer_Info__r.name);
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_001001';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //fahuo
- /*Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ //鍙戣揣鏄庣粏
+ //fahuo
+ /*Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
Orderdet1.Name = 'OCM_01_001001';
Orderdet1.Consumable_order_minor__c = Order1.Id;
Orderdet1.Consumable_Product__c = pro1.Id;
@@ -1082,2904 +720,2128 @@
//Orderdet2.Send_Date__c = Date.today();
//Orderdet2.Used_date__c= Date.today();
Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';*/
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet3.TracingCode__c = 'BXJRF';
- Orderdet3.SerialLotNo__c = '5ZK';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
- Orderdet4.TracingCode__c = 'BXJRN';
- Orderdet4.SerialLotNo__c = '5ZK';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.Cancellation_Flag__c = true;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '涓�';
- Orderdet5.TracingCode__c = 'BXJRZ';
- Orderdet5.SerialLotNo__c = '5ZK';
- insert new List<Consumable_order_details2__c>{
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.Box_Piece__c ='鐩�';
+ Orderdet3.Used_date__c= Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet3.TracingCode__c = 'BXJRF';
+ Orderdet3.SerialLotNo__c = '5ZK';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.Box_Piece__c ='涓�';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
+ Orderdet4.TracingCode__c = 'BXJRN';
+ Orderdet4.SerialLotNo__c = '5ZK';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.Cancellation_Flag__c = true;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='涓�';
+ Orderdet5.TracingCode__c = 'BXJRZ';
+ Orderdet5.SerialLotNo__c = '5ZK';
+ insert new Consumable_order_details2__c[] {Orderdet3,Orderdet4,Orderdet5};
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRR';
- Controller.SearchPro();
- // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
- System.assertEquals(2, controller.ShowGoodsofReturnList.size());
- controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '澶氬彂';
- controller.ShowGoodsofReturnList[1].esd.Return_reason__c = '澶氬彂';
- controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1;
- Controller.UpdateGoodsOfReturn();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRR';
+ Controller.SearchPro();
+ // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
+ System.assertEquals(2, controller.ShowGoodsofReturnList.size());
+ controller.ShowGoodsofReturnList[0].esd.Return_reason__c='澶氬彂';
+ controller.ShowGoodsofReturnList[1].esd.Return_reason__c='澶氬彂';
+ controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
+ Controller.UpdateGoodsOfReturn();
- list<String> list1 = new List<String>();
- list1.add(Controller.barcode = '01234567898');
- Controller.inventoryEntryNoESetId(list1);
+ list<String> list1 = new list<String>();
+ list1.add(Controller.barcode = '01234567898');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '012345678901234A67');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '012345678901234A67');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345117AA01');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345117AA01');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '01234567890123456789012349990001');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '01234567890123456789012349990001');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345177AA0000000000001');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345177AA0000000000001');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345177AA1111111111111');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345177AA1111111111111');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241345');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241345');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '2413456');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '2413456');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '24134567');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '24134567');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241345678');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241345678');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '2413456789');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '2413456789');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '24134567890');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '24134567890');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241345678901');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241345678901');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231177890121215678901234');
- Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231177890121215678901234');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231106789012105678901234');
- Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231106789012105625001234');
- Controller.inventoryEntryNoESetId(list1);
- System.Test.stopTest();
- }
- }
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231106789012105678901234');
+ Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231106789012105625001234');
+ Controller.inventoryEntryNoESetId(list1);
+ System.Test.stopTest();
- //鐩存帴鍒拌揣
- @isTest
- static void arrivedirect() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = '2344',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = '82324',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //浜у搧娉ㄥ唽璇�
- Product_Register__c prc = new Product_Register__c(
- Name = '鍥芥娉ㄨ繘20162220210',
- MedPrdClass__c = '3',
- ValidFrom__c = date.newinstance(2018, 7, 22),
- ValidTo__c = date.newinstance(2028, 7, 22),
- RegisterNoClass_Old__c = '6815',
- RegisterNoClass_New__c = '6815',
- RegisterNoStatus__c = '鏈夋晥'
- );
- insert prc;
- //鏂版棫鍏崇郴瀵圭収琛�
- //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
- // Name = 'Test20181204',
- // Register_new__c = '314',
- // Register_old__c = '36815'
- // );
- //insert prcc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
- Product_Register_Link__c prlc = new Product_Register_Link__c(
- Product2__c = prod01.Id,
- Product_Register__c = prc.Id
- );
- insert prlc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
- Product_Register_Link__c prlc2 = new Product_Register_Link__c(
- Product2__c = prod02.Id,
- Product_Register__c = prc.Id
- );
- insert prlc2;
- //璁㈠崟
+ //鐩存帴鍒拌揣
+ @isTest
+ static void arrivedirect() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order1;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
- //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
- //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
- PageReference page = new PageReference(
- '/apex/ArriveGoods?Esetid=' + Order1.Id
- );
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN';
- Controller.SearchPro();
- //System.assertEquals(1, controller.consumableInventory.size());
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //浜у搧娉ㄥ唽璇�
+ Product_Register__c prc = new Product_Register__c(Name = '鍥芥娉ㄨ繘20162220210',
+ MedPrdClass__c = '3',
+ ValidFrom__c = date.newinstance(2018, 07, 22),
+ ValidTo__c = date.newinstance(2028, 07, 22),
+ RegisterNoClass_Old__c = '6815',
+ RegisterNoClass_New__c = '6815',
+ RegisterNoStatus__c = '鏈夋晥'
+ );
+ insert prc;
+ //鏂版棫鍏崇郴瀵圭収琛�
+ //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
+ // Name = 'Test20181204',
+ // Register_new__c = '314',
+ // Register_old__c = '36815'
+ // );
+ //insert prcc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
+ Product_Register_Link__c prlc = new Product_Register_Link__c(
+ Product2__c = prod01.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
+ Product_Register_Link__c prlc2 = new Product_Register_Link__c(
+ Product2__c = prod02.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc2;
+ //璁㈠崟
- System.Test.stopTest();
- }
- }
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order1;
- //鐩存帴鍒拌揣
- @isTest
- static void arrivedirect241() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
+ //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
+ //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4};
+ PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN';
+ Controller.SearchPro();
+ //System.assertEquals(1, controller.consumableInventory.size());
+
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //浜у搧娉ㄥ唽璇�
- Product_Register__c prc = new Product_Register__c(
- Name = '鍥芥娉ㄨ繘20162220210',
- MedPrdClass__c = '3',
- ValidFrom__c = date.newinstance(2018, 7, 22),
- ValidTo__c = date.newinstance(2028, 7, 22),
- RegisterNoClass_Old__c = '6815',
- RegisterNoClass_New__c = '6815',
- RegisterNoStatus__c = '鏈夋晥'
- );
- insert prc;
- //鏂版棫鍏崇郴瀵圭収琛�
- //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
- // Name = 'Test20181204',
- // Register_new__c = '314',
- // Register_old__c = '36815'
- // );
- //insert prcc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
- Product_Register_Link__c prlc = new Product_Register_Link__c(
- Product2__c = prod01.Id,
- Product_Register__c = prc.Id
- );
- insert prlc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
- Product_Register_Link__c prlc2 = new Product_Register_Link__c(
- Product2__c = prod02.Id,
- Product_Register__c = prc.Id
- );
- insert prlc2;
- //璁㈠崟
+ //鐩存帴鍒拌揣
+ @isTest
+ static void arrivedirect241() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '鍒拌揣';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order2.Deliver_date__c = Date.today();
- Order2.Order_date__c = Date.today();
- insert Order2;
- Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order2.Deliver_date__c = Date.today();
- Order2.Order_date__c = Date.today();
- Order2.ReturnGs_Upload_Date__c = Date.today();
- insert Order2;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.Rrturn_count__c = 1;
- Orderdet1.TracingCode__c = '20170808';
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order2.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Consumable_Arrived_order__c = Order2.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.TracingCode__c = '20170808';
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //浜у搧娉ㄥ唽璇�
+ Product_Register__c prc = new Product_Register__c(Name = '鍥芥娉ㄨ繘20162220210',
+ MedPrdClass__c = '3',
+ ValidFrom__c = date.newinstance(2018, 07, 22),
+ ValidTo__c = date.newinstance(2028, 07, 22),
+ RegisterNoClass_Old__c = '6815',
+ RegisterNoClass_New__c = '6815',
+ RegisterNoStatus__c = '鏈夋晥'
+ );
+ insert prc;
+ //鏂版棫鍏崇郴瀵圭収琛�
+ //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
+ // Name = 'Test20181204',
+ // Register_new__c = '314',
+ // Register_old__c = '36815'
+ // );
+ //insert prcc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
+ Product_Register_Link__c prlc = new Product_Register_Link__c(
+ Product2__c = prod01.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
+ Product_Register_Link__c prlc2 = new Product_Register_Link__c(
+ Product2__c = prod02.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc2;
+ //璁㈠崟
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001002';
- Orderdet3.Consumable_order_minor__c = Order2.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.Consumable_Arrived_order__c = Order2.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR2';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.TracingCode__c = '20170808';
- //sale
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001003';
- Orderdet4.Consumable_order_minor__c = Order2.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.Consumable_Arrived_order__c = Order2.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet4.Consumable_Sale_order__c = Order2.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR3';
- Orderdet4.Used_date__c = Date.today();
- Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001003';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet4.Consumable_Sale_order__c = Order2.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJ13';
- Orderdet4.Used_date__c = Date.today();
- Orderdet4.TracingCode__c = '20170808';
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001003';
- Orderdet5.Consumable_order_minor__c = Order2.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.Consumable_Arrived_order__c = Order2.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet5.Consumable_Sale_order__c = Order2.Id;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- Orderdet5.Arrive_date__c = Date.today().addDays(1);
- Orderdet5.Send_Date__c = null;
- Orderdet5.Used_date__c = null;
- Orderdet5.Lose_Flag__c = false;
- Orderdet5.Return_date__c = null;
- Orderdet5.Cancellation_Date__c = Date.today().addDays(1);
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = '20170808';
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '鍒拌揣';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order2.Deliver_date__c = Date.today();
+ Order2.Order_date__c = Date.today();
+ insert Order2;
+ Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order2.Deliver_date__c = Date.today();
+ Order2.Order_date__c = Date.today();
+ Order2.ReturnGs_Upload_Date__c = Date.today();
+ insert Order2;
- //鍑哄簱
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001004';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Test01';
- Orderdet6.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet6.Consumable_Shipment_order__c = Order1.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR4';
- Orderdet6.Send_Date__c = Date.today();
- Orderdet6.Return_date__c = null;
- Orderdet6.Box_Piece__c = '鐩�';
- Orderdet6.Rrturn_count__c = 1;
- Orderdet6.TracingCode__c = '20170808';
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- // 鍗曚綅涓轰釜鐨凚arcode瀵瑰簲鐨勫嚭搴撳崟
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001004';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro1.Id;
- Orderdet7.Asset_Model_No__c = 'Test01';
- Orderdet7.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet7.Consumable_Shipment_order__c = Order1.Id;
- Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR1';
- Orderdet7.Send_Date__c = Date.today();
- Orderdet7.Box_Piece__c = '涓�';
- Orderdet7.Used_date__c = Date.today();
- Orderdet7.Return_date__c = null;
- Orderdet7.RemoveBox_No__c = 1;
- Orderdet7.Consumable_ZS_order__c = Order1.Id;
- Orderdet7.Rrturn_count__c = 1;
- Orderdet7.TracingCode__c = '20170808';
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.Rrturn_count__c =1;
+ Orderdet1.TracingCode__c = '20170808';
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order2.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Consumable_Arrived_order__c = Order2.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.TracingCode__c = '20170808';
- Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001004';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro1.Id;
- Orderdet7.Asset_Model_No__c = 'Test01';
- Orderdet7.Consumable_Arrived_order__c = Order1.Id;
- Orderdet7.Consumable_Shipment_order__c = Order1.Id;
- Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7';
- Orderdet7.Send_Date__c = Date.today();
- Orderdet7.Box_Piece__c = '涓�';
- Orderdet7.Used_date__c = Date.today();
- Orderdet7.Return_date__c = null;
- Orderdet7.RemoveBox_No__c = 1;
- Orderdet7.Consumable_ZS_order__c = Order1.Id;
- Orderdet7.Rrturn_count__c = 0;
- Orderdet7.TracingCode__c = '20170808';
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001002';
+ Orderdet3.Consumable_order_minor__c = Order2.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.Consumable_Arrived_order__c = Order2.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR2';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.TracingCode__c = '20170808';
+ //sale
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001003';
+ Orderdet4.Consumable_order_minor__c = Order2.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.Consumable_Arrived_order__c = Order2.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet4.Consumable_Sale_order__c = Order2.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR3';
+ Orderdet4.Used_date__c =Date.today();
+ Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001003';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet4.Consumable_Sale_order__c = Order2.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJ13';
+ Orderdet4.Used_date__c =Date.today();
+ Orderdet4.TracingCode__c = '20170808';
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001003';
+ Orderdet5.Consumable_order_minor__c = Order2.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.Consumable_Arrived_order__c = Order2.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet5.Consumable_Sale_order__c = Order2.Id;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ Orderdet5.Arrive_date__c = Date.today().addDays(1);
+ Orderdet5.Send_Date__c = null;
+ Orderdet5.Used_date__c = null;
+ Orderdet5.Lose_Flag__c = false;
+ Orderdet5.Return_date__c= null;
+ Orderdet5.Cancellation_Date__c= Date.today().addDays(1);
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.TracingCode__c = '20170808';
- Consumable_order_details2__c Orderdet8 = new Consumable_order_details2__c();
- Orderdet8.Name = 'OCM_01_001004';
- Orderdet8.Consumable_order_minor__c = Order1.Id;
- Orderdet8.Consumable_Product__c = pro1.Id;
- Orderdet8.Asset_Model_No__c = 'Test01';
- Orderdet8.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet8.Consumable_Shipment_order__c = Order1.Id;
- Orderdet8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR9';
- Orderdet8.Send_Date__c = Date.today();
- Orderdet8.Box_Piece__c = '涓�';
- Orderdet8.Used_date__c = Date.today();
- Orderdet8.Return_date__c = null;
- Orderdet8.RemoveBox_No__c = 1;
- Orderdet8.Consumable_ZS_order__c = Order1.Id;
- Orderdet8.Rrturn_count__c = null;
- Orderdet8.RemoveBox_date__c = Date.today();
- Orderdet8.Intra_Trade_List_RMB__c = 1;
- Orderdet8.Sterilization_limit__c = Date.today();
- Orderdet8.SerialLotNo__c = '11鎵规';
- Orderdet8.TracingCode__c = '20170808';
- Orderdet8.Arrive_date__c = Date.today();
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001004';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Test01';
+ Orderdet6.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet6.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR4';
+ Orderdet6.Send_Date__c = Date.today();
+ Orderdet6.Return_date__c= null;
+ Orderdet6.Box_Piece__c = '鐩�';
+ Orderdet6.Rrturn_count__c =1;
+ Orderdet6.TracingCode__c = '20170808';
- Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
- Orderdet9.Name = 'OCM_01_001004';
- Orderdet9.Consumable_order_minor__c = Order1.Id;
- Orderdet9.Consumable_Product__c = pro1.Id;
- Orderdet9.Asset_Model_No__c = 'Test01';
- Orderdet9.Consumable_Arrived_order__c = Order1.Id;
- Orderdet9.Consumable_Shipment_order__c = Order1.Id;
- Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet9.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR8';
- Orderdet9.Send_Date__c = Date.today();
- Orderdet9.Box_Piece__c = '涓�';
- Orderdet9.Used_date__c = Date.today();
- Orderdet9.Return_date__c = null;
- Orderdet9.Consumable_ZS_order__c = Order1.Id;
- Orderdet9.Arrive_date__c = Date.today();
- Orderdet9.Rrturn_count__c = 10;
- Orderdet9.TracingCode__c = '20170808';
- Consumable_order_details2__c lose = new Consumable_order_details2__c();
- lose.Name = 'OCM_01_001004';
- lose.Consumable_order_minor__c = Order1.Id;
- lose.Consumable_Product__c = pro1.Id;
- lose.Asset_Model_No__c = 'Test01';
- lose.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- lose.Consumable_Shipment_order__c = Order1.Id;
- lose.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- lose.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR5';
- lose.Send_Date__c = null;
- lose.Arrive_date__c = null;
- lose.Used_date__c = null;
- lose.Box_Piece__c = '鐩�';
- lose.TracingCode__c = '20170808';
- Consumable_order_details2__c lose1 = new Consumable_order_details2__c();
- lose1.Name = 'OCM_01_001004';
- lose1.Consumable_order_minor__c = Order1.Id;
- lose1.Consumable_Product__c = pro1.Id;
- lose1.Asset_Model_No__c = 'Test01';
- lose1.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- lose1.Consumable_Shipment_order__c = Order1.Id;
- lose1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- lose1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR6';
- lose1.Send_Date__c = null;
- lose1.Arrive_date__c = Date.today();
- lose1.Used_date__c = null;
- lose1.Box_Piece__c = '鐩�';
- lose1.TracingCode__c = '20170808';
- Consumable_order_details2__c lose2 = new Consumable_order_details2__c();
- lose2.Name = 'OCM_01_001004';
- lose2.Consumable_order_minor__c = Order2.Id;
- lose2.Consumable_Product__c = pro1.Id;
- lose2.Asset_Model_No__c = 'Test01';
- lose2.Consumable_Arrived_order__c = Order2.Id;
- //Orderdet4.IsArrival__c = true;
- lose2.Consumable_Shipment_order__c = Order2.Id;
- lose2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- lose2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7';
- lose2.Send_Date__c = null;
- lose2.Arrive_date__c = Date.today();
- lose2.Used_date__c = null;
- lose2.Box_Piece__c = '鐩�';
- lose2.Intra_Trade_List_RMB__c = 1;
- lose2.Direct_Arrive_Product__c = true;
- lose2.Sterilization_limit__c = Date.today();
- lose2.SerialLotNo__c = '11鎵规';
- lose2.TracingCode__c = '20170808';
+ // 鍗曚綅涓轰釜鐨凚arcode瀵瑰簲鐨勫嚭搴撳崟
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001004';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro1.Id;
+ Orderdet7.Asset_Model_No__c = 'Test01';
+ Orderdet7.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet7.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR1';
+ Orderdet7.Send_Date__c = Date.today();
+ Orderdet7.Box_Piece__c = '涓�';
+ Orderdet7.Used_date__c = Date.today();
+ Orderdet7.Return_date__c= null;
+ Orderdet7.RemoveBox_No__c =1;
+ Orderdet7.Consumable_ZS_order__c= Order1.Id;
+ Orderdet7.Rrturn_count__c =1;
+ Orderdet7.TracingCode__c = '20170808';
- //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
- //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
+ Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001004';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro1.Id;
+ Orderdet7.Asset_Model_No__c = 'Test01';
+ Orderdet7.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet7.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7';
+ Orderdet7.Send_Date__c = Date.today();
+ Orderdet7.Box_Piece__c = '涓�';
+ Orderdet7.Used_date__c = Date.today();
+ Orderdet7.Return_date__c= null;
+ Orderdet7.RemoveBox_No__c =1;
+ Orderdet7.Consumable_ZS_order__c= Order1.Id;
+ Orderdet7.Rrturn_count__c =0;
+ Orderdet7.TracingCode__c = '20170808';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdet7,
- Orderdet8,
- Orderdet9,
- lose,
- lose1,
- lose2
- };
- PageReference page = new PageReference(
- '/apex/ArriveGoods?Esetid=' + Order1.Id
- );
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
+ Consumable_order_details2__c Orderdet8 = new Consumable_order_details2__c();
+ Orderdet8.Name = 'OCM_01_001004';
+ Orderdet8.Consumable_order_minor__c = Order1.Id;
+ Orderdet8.Consumable_Product__c = pro1.Id;
+ Orderdet8.Asset_Model_No__c = 'Test01';
+ Orderdet8.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet8.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR9';
+ Orderdet8.Send_Date__c = Date.today();
+ Orderdet8.Box_Piece__c = '涓�';
+ Orderdet8.Used_date__c = Date.today();
+ Orderdet8.Return_date__c= null;
+ Orderdet8.RemoveBox_No__c =1;
+ Orderdet8.Consumable_ZS_order__c= Order1.Id;
+ Orderdet8.Rrturn_count__c =null;
+ Orderdet8.RemoveBox_date__c = Date.today();
+ Orderdet8.Intra_Trade_List_RMB__c = 1;
+ Orderdet8.Sterilization_limit__c = Date.today();
+ Orderdet8.SerialLotNo__c ='11鎵规';
+ Orderdet8.TracingCode__c = '20170808';
+ Orderdet8.Arrive_date__c = Date.today();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJR3\n01049531702003111115120017181000105ZK250BXJ13\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJR2\n01049531702003111115120017181000105ZK250BXJR3\n01049531702003111115120017181000105ZK250BXJR4\n01049531702003111115120017181000105ZK250BXJR1\n01049531702003111115120017181000105ZK250BXJR7\n01049531702003111115120017181000105ZK250BXJR9\n01049531702003111115120017181000105ZK250BXJR8\n01049531702003111115120017181000105ZK250BXJR5\n01049531702003111115120017181000105ZK250BXJR6\n01049531702003111115120017181000105ZK250BXJR7\n01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXAAB';
- Controller.SearchPro();
- // System.assertEquals(1, controller.consumableInventory.size());
+ Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
+ Orderdet9.Name = 'OCM_01_001004';
+ Orderdet9.Consumable_order_minor__c = Order1.Id;
+ Orderdet9.Consumable_Product__c = pro1.Id;
+ Orderdet9.Asset_Model_No__c = 'Test01';
+ Orderdet9.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet9.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet9.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR8';
+ Orderdet9.Send_Date__c = Date.today();
+ Orderdet9.Box_Piece__c = '涓�';
+ Orderdet9.Used_date__c = Date.today();
+ Orderdet9.Return_date__c= null;
+ Orderdet9.Consumable_ZS_order__c= Order1.Id;
+ Orderdet9.Arrive_date__c = Date.today();
+ Orderdet9.Rrturn_count__c =10;
+ Orderdet9.TracingCode__c = '20170808';
+ Consumable_order_details2__c lose = new Consumable_order_details2__c();
+ lose.Name = 'OCM_01_001004';
+ lose.Consumable_order_minor__c = Order1.Id;
+ lose.Consumable_Product__c = pro1.Id;
+ lose.Asset_Model_No__c = 'Test01';
+ lose.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ lose.Consumable_Shipment_order__c = Order1.Id;
+ lose.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ lose.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR5';
+ lose.Send_Date__c = null;
+ lose.Arrive_date__c = null;
+ lose.Used_date__c = null;
+ lose.Box_Piece__c = '鐩�';
+ lose.TracingCode__c = '20170808';
+ Consumable_order_details2__c lose1 = new Consumable_order_details2__c();
+ lose1.Name = 'OCM_01_001004';
+ lose1.Consumable_order_minor__c = Order1.Id;
+ lose1.Consumable_Product__c = pro1.Id;
+ lose1.Asset_Model_No__c = 'Test01';
+ lose1.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ lose1.Consumable_Shipment_order__c = Order1.Id;
+ lose1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ lose1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR6';
+ lose1.Send_Date__c = null;
+ lose1.Arrive_date__c = Date.today();
+ lose1.Used_date__c = null;
+ lose1.Box_Piece__c = '鐩�';
+ lose1.TracingCode__c = '20170808';
+ Consumable_order_details2__c lose2 = new Consumable_order_details2__c();
+ lose2.Name = 'OCM_01_001004';
+ lose2.Consumable_order_minor__c = Order2.Id;
+ lose2.Consumable_Product__c = pro1.Id;
+ lose2.Asset_Model_No__c = 'Test01';
+ lose2.Consumable_Arrived_order__c = Order2.Id;
+ //Orderdet4.IsArrival__c = true;
+ lose2.Consumable_Shipment_order__c = Order2.Id;
+ lose2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ lose2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7';
+ lose2.Send_Date__c = null;
+ lose2.Arrive_date__c = Date.today();
+ lose2.Used_date__c = null;
+ lose2.Box_Piece__c = '鐩�';
+ lose2.Intra_Trade_List_RMB__c = 1;
+ lose2.Direct_Arrive_Product__c = true;
+ lose2.Sterilization_limit__c = Date.today();
+ lose2.SerialLotNo__c ='11鎵规';
+ lose2.TracingCode__c = '20170808';
- System.Test.stopTest();
- }
- }
+ //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
+ //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
- //杩斿搧 鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁�
- @isTest
- static void productReturn_oldbarcode() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7,Orderdet8,Orderdet9,lose,lose1,lose2};
+ PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJR3\n01049531702003111115120017181000105ZK250BXJ13\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJR2\n01049531702003111115120017181000105ZK250BXJR3\n01049531702003111115120017181000105ZK250BXJR4\n01049531702003111115120017181000105ZK250BXJR1\n01049531702003111115120017181000105ZK250BXJR7\n01049531702003111115120017181000105ZK250BXJR9\n01049531702003111115120017181000105ZK250BXJR8\n01049531702003111115120017181000105ZK250BXJR5\n01049531702003111115120017181000105ZK250BXJR6\n01049531702003111115120017181000105ZK250BXJR7\n01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXAAB';
+ Controller.SearchPro();
+ // System.assertEquals(1, controller.consumableInventory.size());
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ //杩斿搧 鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁�
+ @isTest
+ static void productReturn_oldbarcode() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //杩斿搧璁㈠崟
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
- insert Order1;
- insert Order2;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- //鍙戣揣鏄庣粏
- //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Pro001';
- Orderdet1.Arrive_date__c = date.today();
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.TracingCode__c = 'BXSYS';
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Pro001';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.Arrive_date__c = date.today();
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- Orderdet2.TracingCode__c = 'BXSYS';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- Orderdet3.Arrive_date__c = date.today();
- Orderdet3.Used_date__c = date.today();
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- Orderdet3.TracingCode__c = 'BXSYS';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.Send_Date__c = date.today();
- Orderdet4.Arrive_date__c = date.today();
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BX222';
- Orderdet4.TracingCode__c = 'BXSYS';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '涓�';
- Orderdet5.TracingCode__c = 'BXSYS';
- //fanpin
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001006';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Pro001';
- Orderdet6.Consumable_Return_order__c = Order2.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet6.Box_Piece__c = '涓�';
- Orderdet6.TracingCode__c = 'BXSYS';
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- //鍙戣揣鏄庣粏
- //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001001';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro1.Id;
- Orderdet7.Asset_Model_No__c = 'Pro001';
- Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
- Orderdet7.TracingCode__c = 'BXSYS';
+ //杩斿搧璁㈠崟
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdet7
- };
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222';
- Controller.SearchPro();
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
- //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
- //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[0].Prod.Name__c);
- //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
- //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
- //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
- // Controller.GoodsReturnCheck();
- Controller.ArriveGoodsConfim();
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- Controller.UpdateGoodsOfReturn();
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
+ insert Order1;
+ insert Order2;
- controller.getinventorysize();
- System.Test.stopTest();
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Pro001';
+ Orderdet1.Arrive_date__c = date.today();
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.TracingCode__c = 'BXSYS';
+
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Pro001';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.Arrive_date__c = date.today();
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ Orderdet2.TracingCode__c = 'BXSYS';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet3.Arrive_date__c = date.today();
+ Orderdet3.Used_date__c = date.today();
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ Orderdet3.TracingCode__c = 'BXSYS';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.Send_Date__c = date.today();
+ Orderdet4.Arrive_date__c = date.today();
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BX222';
+ Orderdet4.TracingCode__c = 'BXSYS';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='涓�';
+ Orderdet5.TracingCode__c = 'BXSYS';
+ //fanpin
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001006';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Pro001';
+ Orderdet6.Consumable_Return_order__c = Order2.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet6.Box_Piece__c ='涓�';
+ Orderdet6.TracingCode__c = 'BXSYS';
+
+ //鍙戣揣鏄庣粏
+ //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001001';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro1.Id;
+ Orderdet7.Asset_Model_No__c = 'Pro001';
+ Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
+ Orderdet7.TracingCode__c = 'BXSYS';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222';
+ Controller.SearchPro();
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
+ //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
+ //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[0].Prod.Name__c);
+ //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
+ //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
+ //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
+ // Controller.GoodsReturnCheck();
+ Controller.ArriveGoodsConfim();
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ Controller.UpdateGoodsOfReturn();
+
+ controller.getinventorysize();
+ System.Test.stopTest();
+
+ }
}
- }
- @isTest
- static void barcodecheck() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
+ @isTest
+ static void barcodecheck() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='8232',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ list<String> list1 = new list<String>();
+ list1.clear();
+ list1.add(Controller.barcode = '2413456250BBBBA');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241250BBBBZ');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241250');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241250BBB');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '24134567250BBBBB');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241345678250BBBBC');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '2413456789250BBBBD');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '24134567890250BBBBE');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241345678901250BBBBF');
+ Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '2413456789011250BBBBG');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '24134567890111250BBBBH');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231712300123250BBBBI');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890250BBBBJ');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '01123456789A0123456250BBBBK');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123411AAAA123250BBBBL');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123411789012175678901234250BBBBM');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '01123456789012340138901217aaa8001234250BBBBN');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123456789012104567890250BBBBO');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '01123456789012341778910034567890250BBBBP');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123417aa910034567890250BBBBQ');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '01123456789012341778911134567890250BBBBR');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123417789121105678900000250BBBBS');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123410789121105678900000250BBBBT');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123411789012171a780012250BBBBU');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901234110890121012789000250BBBBV');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '011234567890123417120506105678901234250BBBBW');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901234111202121712050212250BBBBX');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901234111202121712a50212250BBBBY');
+ Controller.inventoryEntry(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901234111202121012050212250BBBBZ');
+ Controller.inventoryEntry(list1);
+ }
}
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ @isTest
+ static void barcodechkeck_2() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = '2344',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = '8232',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- list<String> list1 = new List<String>();
- list1.clear();
- list1.add(Controller.barcode = '2413456250BBBBA');
- Controller.inventoryEntry(list1);
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- list1.clear();
- list1.add(Controller.barcode = '241250BBBBZ');
- Controller.inventoryEntry(list1);
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //浜у搧娉ㄥ唽璇�
+ Product_Register__c prc = new Product_Register__c(Name = '鍥芥娉ㄨ繘20162220210',
+ MedPrdClass__c = '3',
+ ValidFrom__c = date.newinstance(2018, 07, 22),
+ ValidTo__c = date.newinstance(2028, 07, 22),
+ RegisterNoClass_Old__c = '6815',
+ RegisterNoClass_New__c = '6815',
+ RegisterNoStatus__c = '鏈夋晥'
+ );
+ insert prc;
+ //鏂版棫鍏崇郴瀵圭収琛�
+ //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
+ // Name = 'Test20181204',
+ // Register_new__c = '314',
+ // Register_old__c = '36815'
+ // );
+ //insert prcc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
+ Product_Register_Link__c prlc = new Product_Register_Link__c(
+ Product2__c = prod01.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc;
+ //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
+ Product_Register_Link__c prlc2 = new Product_Register_Link__c(
+ Product2__c = prod02.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc2;
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
- list1.clear();
- list1.add(Controller.barcode = '241250');
- Controller.inventoryEntry(list1);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
+ //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
+ List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c
+ FROM Product2__c
+ WHERE Estimation_Entry_Possibility__c = '鈼�'
+ AND Pro2_Dealer_Object__c = true
+ AND OT_CODE__c ='test' ];
+ //System.assertEquals(1, product2InStore.size());
+ list<String> list1 = new list<String>();
+ list1.clear();
+ list1.add(Controller.barcode = '2413456250BBBBA');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241250BBB');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241250BBBBZ');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '24134567250BBBBB');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241250');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241345678250BBBBC');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241250BBZ');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '2413456789250BBBBD');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '24134567250BBBBB');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '24134567890250BBBBE');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241345678250BBBBC');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241345678901250BBBBF');
- Controller.inventoryEntry(list1);
- list1.clear();
- list1.add(Controller.barcode = '2413456789011250BBBBG');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '2413452509250BBBBD');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '24134567890111250BBBBH');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '24125090111250BBBBE');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231712300123250BBBBI');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241325090111250BBBBF');
+ Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '2413425090111250BBBBG');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '011234567890250BBBBJ');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '24134525090111250BBBBH');
+ Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test1712345678901234567890250BBBBI');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '01123456789A0123456250BBBBK');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test171234500678901234567890250BBBBJ');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '011234567890123411AAAA123250BBBBL');
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test17120400678901234567890250BBBBK');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123411789012175678901234250BBBBM'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test171204110678901234567890250BBBBL');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '01123456789012340138901217aaa8001234250BBBBN'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test171204121078901234567890250BBBBM');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123456789012104567890250BBBBO'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test17120412250BBBBN');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '01123456789012341778910034567890250BBBBP'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test101204121078901234567890250BBBBO');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123417aa910034567890250BBBBQ'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test1112a4121078901234567890250BBBBP');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '01123456789012341778911134567890250BBBBR'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '241test111204121778900034567890250BBBBQ');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123417789121105678900000250BBBBS'
- );
- Controller.inventoryEntry(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123410789121105678900000250BBBBT'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0111234101204120118901231712a4001234250BBBBR');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123411789012171a780012250BBBBU'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '011123410120412011890123171204011234250BBBBS');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '0112345678901234110890121012789000250BBBBV'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '011test10120412011890123171a04011234250BBBBT');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '011234567890123417120506105678901234250BBBBW'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0111234101204120118901231012040112342222250BBBBU');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '0112345678901234111202121712050212250BBBBX'
- );
- Controller.inventoryEntry(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '011123410120412017120100250AAAAA');
+ Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(
- Controller.barcode = '0112345678901234111202121712a50212250BBBBY'
- );
- Controller.inventoryEntry(list1);
-
- list1.clear();
- list1.add(
- Controller.barcode = '0112345678901234111202121012050212250BBBBZ'
- );
- Controller.inventoryEntry(list1);
- }
- }
- @isTest
- static void barcodechkeck_2() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = '2344',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = '82324',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //浜у搧娉ㄥ唽璇�
- Product_Register__c prc = new Product_Register__c(
- Name = '鍥芥娉ㄨ繘20162220210',
- MedPrdClass__c = '3',
- ValidFrom__c = date.newinstance(2018, 7, 22),
- ValidTo__c = date.newinstance(2028, 7, 22),
- RegisterNoClass_Old__c = '6815',
- RegisterNoClass_New__c = '6815',
- RegisterNoStatus__c = '鏈夋晥'
- );
- insert prc;
- //鏂版棫鍏崇郴瀵圭収琛�
- //Product_Register_contrast__c prcc = new Product_Register_contrast__c(
- // Name = 'Test20181204',
- // Register_new__c = '314',
- // Register_old__c = '36815'
- // );
- //insert prcc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod01
- Product_Register_Link__c prlc = new Product_Register_Link__c(
- Product2__c = prod01.Id,
- Product_Register__c = prc.Id
- );
- insert prlc;
- //浜у搧-浜у搧娉ㄥ唽璇佸叧绯� prod02
- Product_Register_Link__c prlc2 = new Product_Register_Link__c(
- Product2__c = prod02.Id,
- Product_Register__c = prc.Id
- );
- insert prlc2;
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
-
- ArriveGoodsController Controller = new ArriveGoodsController();
- //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
- //System.assertEquals('鈼�', proList[0].Estimation_Entry_Possibility__c);
- List<Product2__c> product2InStore = [
- SELECT
- Id,
- Name,
- Name__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- OT_CODE__c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Pro2_Dealer_Object__c = TRUE
- AND OT_CODE__c = 'test'
- ];
- //System.assertEquals(1, product2InStore.size());
- list<String> list1 = new List<String>();
- list1.clear();
- list1.add(Controller.barcode = '2413456250BBBBA');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241250BBBBZ');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241250');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241250BBZ');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '24134567250BBBBB');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241345678250BBBBC');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '2413452509250BBBBD');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '24125090111250BBBBE');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241325090111250BBBBF');
- Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '2413425090111250BBBBG');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '24134525090111250BBBBH');
- Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '241test1712345678901234567890250BBBBI');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test171234500678901234567890250BBBBJ');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test17120400678901234567890250BBBBK');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test171204110678901234567890250BBBBL');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test171204121078901234567890250BBBBM');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test17120412250BBBBN');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test101204121078901234567890250BBBBO');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test1112a4121078901234567890250BBBBP');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241test111204121778900034567890250BBBBQ');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(
- Controller.barcode = '0111234101204120118901231712a4001234250BBBBR'
- );
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(
- Controller.barcode = '011123410120412011890123171204011234250BBBBS'
- );
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(
- Controller.barcode = '011test10120412011890123171a04011234250BBBBT'
- );
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(
- Controller.barcode = '0111234101204120118901231012040112342222250BBBBU'
- );
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '011123410120412017120100250AAAAA');
- Controller.inventoryEntryNoESetId(list1);
- }
- }
-
- //鑷姩鍑哄簱
- @isTest
- static void addSaleOrderAuto() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert new List<Product2__c>{ pro1 };
- // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
- // insert myAccount1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order2;
- //鍙戦敊搴� 宸插埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order2.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYS';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.Arrive_date__c = Date.today();
- Orderdets8.TracingCode__c = 'BXSYS';
- Orderdets8.SerialLotNo__c = '5ZK';
- insert Orderdets8;
-
- ArriveGoodsController Controller = new ArriveGoodsController();
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXSYS';
- Controller.SearchPro();
- // System.assertEquals(1, controller.consumableInventory.size());
- Controller.ArriveGoodsConfim();
- System.Test.stopTest();
- }
- }
-
- // UPDATE TCM TEST1
- @isTest
- static void methodTest1() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Arrive_date__c = Date.today();
- // Orderdet1.Send_Date__c=Date.today();
- // Orderdet1.Used_date__c=Date.today();
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- insert Orderdet1;
-
- //fahuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001001';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.TracingCode__c = 'BXJRF';
- Orderdet2.SerialLotNo__c = '5ZK';
- insert Orderdet2;
-
- PageReference page = new PageReference(
- '/apex/ArriveGoods?ESetid=' + Order1.Id
- );
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
- Controller.SearchPro();
- // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
- // System.assertEquals(2, Controller.consumableInventory.size());
- Controller.ArriveGoodsConfim();
- List<Consumable_order_details2__c> ins = [
- SELECT Id, Name
- FROM Consumable_order_details2__c
- ];
- // System.assertEquals(3, ins.size());
- System.Test.stopTest();
- }
- }
-
- //杩斿搧
- @isTest
- static void methodTest2() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- //Consumable_order__c coc = [select Dealer_Info__r.name from Consumable_order__c where Id =:Order1.Id];
- //system.assertEquals('qeee',coc.Dealer_Info__r.name);
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_001001';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Pro001';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Box_Piece__c = '鐩�';
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Pro001';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.Arrive_date__c = Date.today();
- //Orderdet2.Send_Date__c = Date.today();
- //Orderdet2.Used_date__c= Date.today();
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet3.TracingCode__c = 'BXJRF';
- Orderdet3.SerialLotNo__c = '5ZK';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
- Orderdet4.TracingCode__c = 'BXJRN';
- Orderdet4.SerialLotNo__c = '5ZK';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.Cancellation_Flag__c = true;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '涓�';
- Orderdet5.TracingCode__c = 'BXJRZ';
- Orderdet5.SerialLotNo__c = '5ZK';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
-
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRR';
- Controller.SearchPro();
- System.assertEquals(
- 1,
- controller.ConsumableorderdetailsRecordserror.size()
- );
- // System.assertEquals(2, controller.ShowGoodsofReturnList.size());
- controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '澶氬彂';
- // controller.ShowGoodsofReturnList[1].esd.Return_reason__c='澶氬彂';
- // controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
- Controller.UpdateGoodsOfReturn();
-
- list<String> list1 = new List<String>();
- list1.add(Controller.barcode = '01234567898');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '012345678901234A67');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345117AA01');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '01234567890123456789012349990001');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345177AA0000000000001');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '0123456789012345177AA1111111111111');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241345');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '2413456');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '24134567');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241345678');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '2413456789');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '24134567890');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '241345678901');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231177890121215678901234');
- Controller.inventoryEntryNoESetId(list1);
-
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231106789012105678901234');
- Controller.inventoryEntryNoESetId(list1);
- list1.clear();
- list1.add(Controller.barcode = '0112345678901231106789012105625001234');
- Controller.inventoryEntryNoESetId(list1);
- System.Test.stopTest();
- }
- }
-
- //鏁翠綋鍒拌揣
- @isTest
- static void ArrivejancodeTest() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert new List<Product2__c>{ pro1 };
- // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
- // insert myAccount1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order2;
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order2.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
- Orderdets8.SerialLotNo__c = '5ZK';
- insert Orderdets8;
+ //鑷姩鍑哄簱
+ @isTest
+ static void addSaleOrderAuto() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.Order_ProType__c = 'ET';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert Order1;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.Box_Piece__c = '鐩�';
- Orderdet1.TracingCode__c = 'BXJRA';
- Orderdet1.SerialLotNo__c = '5ZK';
- //娌″埌璐�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.TracingCode__c = 'BXJRB';
- Orderdet2.SerialLotNo__c = '5ZK';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.TracingCode__c = 'BXJRC';
- Orderdet3.SerialLotNo__c = '5ZK';
- //Orderdet3.Box_Piece__c = '涓�';
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '鐩�';
- Orderdet4.TracingCode__c = 'BXJRD';
- Orderdet4.SerialLotNo__c = '5ZK';
- //Orderdet4.Box_Piece__c = '鐩�';
- //Orderdet4.Return_date__c = null;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert new Product2__c[] {pro1};
+ // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ // insert myAccount1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order2;
+ //鍙戦敊搴� 宸插埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order2.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYS';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.Arrive_date__c = Date.today();
+ Orderdets8.TracingCode__c = 'BXSYS';
+ Orderdets8.SerialLotNo__c = '5ZK';
+ insert Orderdets8;
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.Consumable_Arrived_order__c = Order1.Id;
- Orderdet5.Consumable_Shipment_order__c = Order1.Id;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'BXJRE';
- Orderdet5.SerialLotNo__c = '5ZK';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
-
- ArriveGoodsController Controller = new ArriveGoodsController();
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
- Controller.SearchPro();
-
- System.assertEquals(
- 'OCM_01_001002',
- controller.ConsumableorderdetailsRecords[0].esd.Name
- );
- // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
- System.Test.stopTest();
- }
- }
-
- //鍙戦敊璐� 鍏ュ簱
- @isTest
- static void ArriveotheragencyTest() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXSYS';
+ Controller.SearchPro();
+ // System.assertEquals(1, controller.consumableInventory.size());
+ Controller.ArriveGoodsConfim();
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert new List<Product2__c>{ pro1 };
- Account myAccount3 = new Account(
- name = 'Testaccount003',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount3;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount3.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order2.Order_ProType__c = 'ET';
- insert Order2;
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order2.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYS';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXSYS';
- Orderdets8.SerialLotNo__c = '5ZK';
- Orderdets8.ownerid = MyUser_Test.id;
- insert Orderdets8;
+ // UPDATE TCM TEST1
+ @isTest
+ static void methodTest1() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //鍙戦敊搴� 宸插埌璐�
- Consumable_order_details2__c Orderdets9 = new Consumable_order_details2__c();
- Orderdets9.Name = 'OCM_01_001012';
- Orderdets9.Consumable_order_minor__c = Order2.Id;
- Orderdets9.Consumable_Product__c = pro1.Id;
- Orderdets9.Asset_Model_No__c = 'Test01';
- Orderdets9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets9.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYQ';
- Orderdets9.Consumable_Arrived_order__c = Order2.Id;
- Orderdets9.Arrive_date__c = Date.today();
- Orderdets9.Box_Piece__c = '鐩�';
- Orderdets9.TracingCode__c = 'BXSYQ';
- Orderdets9.SerialLotNo__c = '5ZK';
- insert Orderdets9;
- // Consumable_order__c Order1 = new Consumable_order__c();
- // Order1.Name = 'OCM_01_001';
- // Order1.Order_status__c = '鎵瑰噯';
- // Order1.Order_type__c = '璁㈠崟';
- // Order1.Dealer_Info__c = myAccount1.id;
- // Order1.Order_ProType__c = 'ET';
- // Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- // insert Order1;
- // //璁㈠崟鏄庣粏
- // //fahuo
- // Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- // Orderdet.Name = 'OCM_01_00101';
- // Orderdet.Consumable_order__c = Order1.Id;
- // Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- // Orderdet.Consumable_Product__c = pro1.Id;
- // Orderdet.Consumable_count__c = 4;
- // insert Orderdet;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- // //鍒拌揣姝g‘淇℃伅
- // Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- // Orderdet1.Name = 'OCM_01_001002';
- // Orderdet1.Consumable_order_minor__c = Order1.Id;
- // Orderdet1.Consumable_Product__c = pro1.Id;
- // Orderdet1.Asset_Model_No__c = 'Test01';
- // Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- // Orderdet1.Box_Piece__c = '鐩�';
- // Orderdet1.TracingCode__c = 'BXJRA';
- // Orderdet1.SerialLotNo__c = '5ZK';
- // //娌″埌璐�
- // Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- // Orderdet2.Name = 'OCM_01_001003';
- // Orderdet2.Consumable_order_minor__c = Order1.Id;
- // Orderdet2.Consumable_Product__c = pro1.Id;
- // Orderdet2.Asset_Model_No__c = 'Test01';
- // Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- // Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- // Orderdet2.Box_Piece__c = '鐩�';
- // Orderdet2.TracingCode__c = 'BXJRB';
- // Orderdet2.SerialLotNo__c = '5ZK';
- // //閿�鍞骇鍝�
- // Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- // Orderdet3.Name = 'OCM_01_001004';
- // Orderdet3.Consumable_order_minor__c = Order1.Id;
- // Orderdet3.Consumable_Product__c = pro1.Id;
- // Orderdet3.Asset_Model_No__c = 'Test01';
- // Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- // //Orderdet3.IsArrival__c = true;
- // Orderdet3.Consumable_Sale_order__c = Order1.Id;
- // Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- // Orderdet3.Used_date__c = Date.today();
- // Orderdet3.Arrive_date__c = Date.today();
- // Orderdet3.Box_Piece__c = '鐩�';
- // Orderdet3.TracingCode__c = 'BXJRC';
- // Orderdet3.SerialLotNo__c = '5ZK';
- // //Orderdet3.Box_Piece__c = '涓�';
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
- // //鍑哄簱浜у搧
- // Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- // Orderdet4.Name = 'OCM_01_001005';
- // Orderdet4.Consumable_order_minor__c = Order1.Id;
- // Orderdet4.Consumable_Product__c = pro1.Id;
- // Orderdet4.Asset_Model_No__c = 'Test01';
- // Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- // Orderdet4.Send_Date__c = Date.today();
- // Orderdet4.Arrive_date__c = Date.today();
- // Orderdet4.Box_Piece__c = '鐩�';
- // Orderdet4.TracingCode__c = 'BXJRD';
- // Orderdet4.SerialLotNo__c = '5ZK';
- // //Orderdet4.Box_Piece__c = '鐩�';
- // //Orderdet4.Return_date__c = null;
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
- // //宸插埌璐т骇鍝�
- // Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- // Orderdet5.Name = 'OCM_01_001006';
- // Orderdet5.Consumable_order_minor__c = Order1.Id;
- // Orderdet5.Consumable_Product__c = pro1.Id;
- // Orderdet5.Asset_Model_No__c = 'Test01';
- // Orderdet5.Consumable_Arrived_order__c = Order1.Id;
- // Orderdet5.Consumable_Shipment_order__c = Order1.Id;
- // Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- // Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- // Orderdet5.Arrive_date__c = Date.today();
- // Orderdet5.Box_Piece__c = '鐩�';
- // Orderdet5.TracingCode__c = 'BXJRE';
- // Orderdet5.SerialLotNo__c = '5ZK';
- // insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- ArriveGoodsController Controller = new ArriveGoodsController();
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXSYS\n01049531702003111115120017181000105ZK250BXSYQ';
- Controller.SearchPro();
- Controller.ArriveGoodsConfim();
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Arrive_date__c=Date.today();
+ // Orderdet1.Send_Date__c=Date.today();
+ // Orderdet1.Used_date__c=Date.today();
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ insert Orderdet1;
- // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
- System.Test.stopTest();
- }
- }
+ //fahuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001001';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
+ Orderdet2.Arrive_date__c=Date.today();
+ Orderdet2.TracingCode__c = 'BXJRF';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ insert Orderdet2;
- //杩斿搧
- @isTest
- static void addInventoryDetails1() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ PageReference page = new PageReference('/apex/ArriveGoods?ESetid=' + Order1.Id);
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
+ Controller.SearchPro();
+ // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
+ // System.assertEquals(2, Controller.consumableInventory.size());
+ Controller.ArriveGoodsConfim();
+ List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
+ // System.assertEquals(3, ins.size());
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- //杩斿搧璁㈠崟
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
- insert Order1;
- insert Order2;
+ //杩斿搧
+ @isTest
+ static void methodTest2() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
- //鍙戣揣鏄庣粏
- //fahuo
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Pro001';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.TracingCode__c = 'BXJRF';
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Pro001';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- Orderdet2.TracingCode__c = 'BXJRF';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Consumable_Sale_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.TracingCode__c = 'BXJRF';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.TracingCode__c = 'BXJRF';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'BXJRF';
- //fanpin
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001006';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Pro001';
- Orderdet6.Consumable_Return_order__c = Order2.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet6.Box_Piece__c = '涓�';
- Orderdet6.TracingCode__c = 'BXJRF';
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- // 涓㈠け
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001002';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro1.Id;
- Orderdet7.Asset_Model_No__c = 'Pro001';
- Orderdet7.Consumable_Arrived_order__c = Order1.Id;
- Orderdet7.Lose_Flag__c = true;
- Orderdet7.Arrive_date__c = Date.today();
- Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJQT';
- Orderdet7.Box_Piece__c = '涓�';
- Orderdet7.TracingCode__c = 'BXJQT';
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ //Consumable_order__c coc = [select Dealer_Info__r.name from Consumable_order__c where Id =:Order1.Id];
+ //system.assertEquals('qeee',coc.Dealer_Info__r.name);
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdet7
- };
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJQT';
- Controller.SearchPro();
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
- //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
- // System.assertEquals(5, controller.ConsumableorderdetailsRecordserror.size()); //tcm
- //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
- //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
- //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
- // Controller.GoodsReturnCheck();
- controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '澶氬彂';
- controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1;
- //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
- Controller.UpdateGoodsOfReturn();
- Controller.ToReturnGoodsPage();
- Controller.geterrorsize();
- System.Test.stopTest();
- }
- }
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_001001';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- @isTest
- static void makeRecordsVieweTest() {
- Integer count = 1001;
- List<ArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<ArriveGoodsController.ConsumableorderdetailsInfo>();
- for (Integer i = 0; i < 1001; i++) {
- conList.add(new ArriveGoodsController.ConsumableorderdetailsInfo());
- }
- ArriveGoodsController arr = new ArriveGoodsController();
- arr.makeRecordsView(conList);
- ArriveGoodsController arr1 = new ArriveGoodsController('', '');
- }
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Pro001';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Box_Piece__c ='鐩�';
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Pro001';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Box_Piece__c ='鐩�';
+ Orderdet2.Arrive_date__c = Date.today();
+ //Orderdet2.Send_Date__c = Date.today();
+ //Orderdet2.Used_date__c= Date.today();
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.Box_Piece__c ='鐩�';
+ Orderdet3.Used_date__c= Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet3.TracingCode__c = 'BXJRF';
+ Orderdet3.SerialLotNo__c = '5ZK';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.Box_Piece__c ='涓�';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
+ Orderdet4.TracingCode__c = 'BXJRN';
+ Orderdet4.SerialLotNo__c = '5ZK';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.Cancellation_Flag__c = true;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='涓�';
+ Orderdet5.TracingCode__c = 'BXJRZ';
+ Orderdet5.SerialLotNo__c = '5ZK';
+ insert new Consumable_order_details2__c[] {Orderdet1,Orderdet3,Orderdet4,Orderdet5};
- @isTest
- static void compareToTest() {
- ArriveGoodsController.ConsumableorderdetailsInfo c1 = new ArriveGoodsController.ConsumableorderdetailsInfo();
- ArriveGoodsController.ConsumableorderdetailsInfo c2 = new ArriveGoodsController.ConsumableorderdetailsInfo();
- c1.compareTo(c2);
- }
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRR';
+ Controller.SearchPro();
+ System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
+ // System.assertEquals(2, controller.ShowGoodsofReturnList.size());
+ controller.ShowGoodsofReturnList[0].esd.Return_reason__c='澶氬彂';
+ // controller.ShowGoodsofReturnList[1].esd.Return_reason__c='澶氬彂';
+ // controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
+ Controller.UpdateGoodsOfReturn();
- @isTest
- static void searchProTest1() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ list<String> list1 = new list<String>();
+ list1.add(Controller.barcode = '01234567898');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '012345678901234A67');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345117AA01');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '01234567890123456789012349990001');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345177AA0000000000001');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0123456789012345177AA1111111111111');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241345');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '2413456');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '24134567');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241345678');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '2413456789');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '24134567890');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '241345678901');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231177890121215678901234');
+ Controller.inventoryEntryNoESetId(list1);
+
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231106789012105678901234');
+ Controller.inventoryEntryNoESetId(list1);
+ list1.clear();
+ list1.add(Controller.barcode = '0112345678901231106789012105625001234');
+ Controller.inventoryEntryNoESetId(list1);
+ System.Test.stopTest();
+
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ //鏁翠綋鍒拌揣
+ @isTest
+ static void ArrivejancodeTest() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- insert Orderdet1;
- System.debug('Orderdet1:' + Orderdet1);
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001001';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet2.TracingCode__c = 'BXJRF';
- Orderdet2.SerialLotNo__c = '5ZK';
- insert Orderdet2;
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- System.Test.startTest();
- Controller.init();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
- Controller.SearchPro();
- Controller.ArriveGoodsConfim();
- List<Consumable_order_details2__c> ins = [
- SELECT Id, Name
- FROM Consumable_order_details2__c
- ];
- System.Test.stopTest();
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert new Product2__c[] {pro1};
+ // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ // insert myAccount1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order2;
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order2.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
+ Orderdets8.SerialLotNo__c = '5ZK';
+ insert Orderdets8;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.Order_ProType__c = 'ET';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert Order1;
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.Box_Piece__c = '鐩�';
+ Orderdet1.TracingCode__c = 'BXJRA';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ //娌″埌璐�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.Box_Piece__c = '鐩�';
+ Orderdet2.TracingCode__c = 'BXJRB';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Box_Piece__c = '鐩�';
+ Orderdet3.TracingCode__c = 'BXJRC';
+ Orderdet3.SerialLotNo__c = '5ZK';
+ //Orderdet3.Box_Piece__c = '涓�';
+
+
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '鐩�';
+ Orderdet4.TracingCode__c = 'BXJRD';
+ Orderdet4.SerialLotNo__c = '5ZK';
+ //Orderdet4.Box_Piece__c = '鐩�';
+ //Orderdet4.Return_date__c = null;
+
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet5.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.TracingCode__c = 'BXJRE';
+ Orderdet5.SerialLotNo__c = '5ZK';
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
+
+
+
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
+ Controller.SearchPro();
+
+ System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
+ // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
+ System.Test.stopTest();
+
+
+ }
}
- }
-}
+
+ //鍙戦敊璐� 鍏ュ簱
+ @isTest
+ static void ArriveotheragencyTest() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert new Product2__c[] {pro1};
+ Account myAccount3 = new Account(name='Testaccount003',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert myAccount3;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount3.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order2.Order_ProType__c = 'ET';
+ insert Order2;
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order2.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYS';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXSYS';
+ Orderdets8.SerialLotNo__c = '5ZK';
+ Orderdets8.ownerid = MyUser_Test.id;
+ insert Orderdets8;
+
+ //鍙戦敊搴� 宸插埌璐�
+ Consumable_order_details2__c Orderdets9 = new Consumable_order_details2__c();
+ Orderdets9.Name = 'OCM_01_001012';
+ Orderdets9.Consumable_order_minor__c = Order2.Id;
+ Orderdets9.Consumable_Product__c = pro1.Id;
+ Orderdets9.Asset_Model_No__c = 'Test01';
+ Orderdets9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets9.Bar_Code__c = '01049531702003111115120017181000105ZK250BXSYQ';
+ Orderdets9.Consumable_Arrived_order__c = Order2.Id;
+ Orderdets9.Arrive_date__c = Date.today();
+ Orderdets9.Box_Piece__c = '鐩�';
+ Orderdets9.TracingCode__c = 'BXSYQ';
+ Orderdets9.SerialLotNo__c = '5ZK';
+ insert Orderdets9;
+
+ // Consumable_order__c Order1 = new Consumable_order__c();
+ // Order1.Name = 'OCM_01_001';
+ // Order1.Order_status__c = '鎵瑰噯';
+ // Order1.Order_type__c = '璁㈠崟';
+ // Order1.Dealer_Info__c = myAccount1.id;
+ // Order1.Order_ProType__c = 'ET';
+ // Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ // insert Order1;
+ // //璁㈠崟鏄庣粏
+ // //fahuo
+ // Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ // Orderdet.Name = 'OCM_01_00101';
+ // Orderdet.Consumable_order__c = Order1.Id;
+ // Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ // Orderdet.Consumable_Product__c = pro1.Id;
+ // Orderdet.Consumable_count__c = 4;
+ // insert Orderdet;
+
+ // //鍒拌揣姝g‘淇℃伅
+ // Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ // Orderdet1.Name = 'OCM_01_001002';
+ // Orderdet1.Consumable_order_minor__c = Order1.Id;
+ // Orderdet1.Consumable_Product__c = pro1.Id;
+ // Orderdet1.Asset_Model_No__c = 'Test01';
+ // Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ // Orderdet1.Box_Piece__c = '鐩�';
+ // Orderdet1.TracingCode__c = 'BXJRA';
+ // Orderdet1.SerialLotNo__c = '5ZK';
+ // //娌″埌璐�
+ // Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ // Orderdet2.Name = 'OCM_01_001003';
+ // Orderdet2.Consumable_order_minor__c = Order1.Id;
+ // Orderdet2.Consumable_Product__c = pro1.Id;
+ // Orderdet2.Asset_Model_No__c = 'Test01';
+ // Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ // Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ // Orderdet2.Box_Piece__c = '鐩�';
+ // Orderdet2.TracingCode__c = 'BXJRB';
+ // Orderdet2.SerialLotNo__c = '5ZK';
+ // //閿�鍞骇鍝�
+ // Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ // Orderdet3.Name = 'OCM_01_001004';
+ // Orderdet3.Consumable_order_minor__c = Order1.Id;
+ // Orderdet3.Consumable_Product__c = pro1.Id;
+ // Orderdet3.Asset_Model_No__c = 'Test01';
+ // Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ // //Orderdet3.IsArrival__c = true;
+ // Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ // Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ // Orderdet3.Used_date__c = Date.today();
+ // Orderdet3.Arrive_date__c = Date.today();
+ // Orderdet3.Box_Piece__c = '鐩�';
+ // Orderdet3.TracingCode__c = 'BXJRC';
+ // Orderdet3.SerialLotNo__c = '5ZK';
+ // //Orderdet3.Box_Piece__c = '涓�';
+
+
+ // //鍑哄簱浜у搧
+ // Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ // Orderdet4.Name = 'OCM_01_001005';
+ // Orderdet4.Consumable_order_minor__c = Order1.Id;
+ // Orderdet4.Consumable_Product__c = pro1.Id;
+ // Orderdet4.Asset_Model_No__c = 'Test01';
+ // Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ // Orderdet4.Send_Date__c = Date.today();
+ // Orderdet4.Arrive_date__c = Date.today();
+ // Orderdet4.Box_Piece__c = '鐩�';
+ // Orderdet4.TracingCode__c = 'BXJRD';
+ // Orderdet4.SerialLotNo__c = '5ZK';
+ // //Orderdet4.Box_Piece__c = '鐩�';
+ // //Orderdet4.Return_date__c = null;
+
+ // //宸插埌璐т骇鍝�
+ // Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ // Orderdet5.Name = 'OCM_01_001006';
+ // Orderdet5.Consumable_order_minor__c = Order1.Id;
+ // Orderdet5.Consumable_Product__c = pro1.Id;
+ // Orderdet5.Asset_Model_No__c = 'Test01';
+ // Orderdet5.Consumable_Arrived_order__c = Order1.Id;
+ // Orderdet5.Consumable_Shipment_order__c = Order1.Id;
+ // Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ // Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ // Orderdet5.Arrive_date__c = Date.today();
+ // Orderdet5.Box_Piece__c = '鐩�';
+ // Orderdet5.TracingCode__c = 'BXJRE';
+ // Orderdet5.SerialLotNo__c = '5ZK';
+ // insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
+
+
+
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXSYS\n01049531702003111115120017181000105ZK250BXSYQ';
+ Controller.SearchPro();
+ Controller.ArriveGoodsConfim();
+
+ // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
+ System.Test.stopTest();
+
+
+ }
+ }
+
+ //杩斿搧
+ @isTest
+ static void addInventoryDetails1() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ //杩斿搧璁㈠崟
+
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
+ insert Order1;
+ insert Order2;
+
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //fahuo
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Pro001';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.TracingCode__c = 'BXJRF';
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Pro001';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ Orderdet2.TracingCode__c = 'BXJRF';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Consumable_Sale_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ Orderdet3.Box_Piece__c ='鐩�';
+ Orderdet3.TracingCode__c = 'BXJRF';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN';
+ Orderdet4.Box_Piece__c ='涓�';
+ Orderdet4.TracingCode__c = 'BXJRF';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='鐩�';
+ Orderdet5.TracingCode__c = 'BXJRF';
+ //fanpin
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001006';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Pro001';
+ Orderdet6.Consumable_Return_order__c = Order2.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet6.Box_Piece__c ='涓�';
+ Orderdet6.TracingCode__c = 'BXJRF';
+
+ // 涓㈠け
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001002';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro1.Id;
+ Orderdet7.Asset_Model_No__c = 'Pro001';
+ Orderdet7.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet7.Lose_Flag__c = true;
+ Orderdet7.Arrive_date__c = Date.today();
+ Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJQT';
+ Orderdet7.Box_Piece__c ='涓�';
+ Orderdet7.TracingCode__c = 'BXJQT';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRI\n01049531702003111115120017181000105ZK250BXJQT';
+ Controller.SearchPro();
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ //System.assertEquals('OCM_01_001003', controller.ShowGoodsofReturnList[0].esd.Name);
+ //System.assertEquals('OCM_01_001004', controller.ShowGoodsofReturnList[1].esd.Name);
+ // System.assertEquals(5, controller.ConsumableorderdetailsRecordserror.size()); //tcm
+ //System.assertEquals('Test01', controller.ConsumableorderdetailsRecordserror[1].Prod.Name__c);
+ //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name);
+ //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name);
+ // Controller.GoodsReturnCheck();
+ controller.ShowGoodsofReturnList[0].esd.Return_reason__c='澶氬彂';
+ controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
+ //System.assertEquals(1, controller.ShowGoodsofReturnList.size());
+ Controller.UpdateGoodsOfReturn();
+ Controller.ToReturnGoodsPage();
+ Controller.geterrorsize();
+ System.Test.stopTest();
+
+ }
+ }
+
+ @isTest
+ static void makeRecordsVieweTest() {
+ Integer count = 1001;
+ List<ArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<ArriveGoodsController.ConsumableorderdetailsInfo>();
+ for(Integer i = 0; i < 1001; i++){
+ conList.add(new ArriveGoodsController.ConsumableorderdetailsInfo());
+ }
+ ArriveGoodsController arr = new ArriveGoodsController();
+ arr.makeRecordsView(conList);
+ ArriveGoodsController arr1 = new ArriveGoodsController('','');
+ }
+
+ @isTest
+ static void compareToTest() {
+ ArriveGoodsController.ConsumableorderdetailsInfo c1 = new ArriveGoodsController.ConsumableorderdetailsInfo();
+ ArriveGoodsController.ConsumableorderdetailsInfo c2 = new ArriveGoodsController.ConsumableorderdetailsInfo();
+ c1.compareTo(c2);
+ }
+
+ @isTest
+ static void searchProTest1() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ insert Orderdet1;
+ System.debug('Orderdet1:'+Orderdet1);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001001';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet2.TracingCode__c = 'BXJRF';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ insert Orderdet2;
+
+ PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ System.Test.startTest();
+ Controller.init();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
+ Controller.SearchPro();
+ Controller.ArriveGoodsConfim();
+ List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
+ System.Test.stopTest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls b/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls
index 7bcb69c..b5d3132 100644
--- a/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls
+++ b/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls
@@ -1,234 +1,163 @@
@isTest
public class ArriveGoodsControllerTestV2 {
- @isTest
- static void myUnitTest() {
- // // TO DO: implement unit test
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ @isTest
+ static void myUnitTest() {
+ // // TO DO: implement unit test
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- // Order1.Dealer_Info__c = myAccount1.id;
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Total_num__c = 3;
- Order1.OrderNumber_arrived__c = 1;
- Order1.Delivery_detail_count__c = 1;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ // Order1.Dealer_Info__c = myAccount1.id;
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Total_num__c = 3;
+ Order1.OrderNumber_arrived__c =1;
+ Order1.Delivery_detail_count__c=1;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 40;
- insert Orderdet;
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 40;
+ insert Orderdet;
- //鍙戣揣鏄庣粏
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.TracingCode__c = 'BXJRA';
+ //鍙戣揣鏄庣粏
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.TracingCode__c = 'BXJRA';
- //鍙栨秷浜у搧
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.Cancellation_Date__c = Date.today();
- Orderdet2.TracingCode__c = 'BXJRB';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.TracingCode__c = 'BXJRC';
- //Orderdet3.Box_Piece__c = '鐩�';
+ //鍙栨秷浜у搧
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.Cancellation_Date__c= Date.today();
+ Orderdet2.TracingCode__c = 'BXJRB';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.TracingCode__c = 'BXJRC';
+ //Orderdet3.Box_Piece__c = '鐩�';
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.TracingCode__c = 'BXJRD';
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.TracingCode__c = 'BXJRE';
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.TracingCode__c = 'BXJRD';
- //鍙戣揣鏄庣粏
- //绠$悊缂栫爜鍖呭惈鏁板瓧
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001002';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Test01';
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
- Orderdet6.TracingCode__c = 'BX123';
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.TracingCode__c = 'BXJRE';
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order1.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
+ //鍙戣揣鏄庣粏
+ //绠$悊缂栫爜鍖呭惈鏁板瓧
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001002';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Test01';
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
+ Orderdet6.TracingCode__c = 'BX123';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdets8
- };
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order1.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
- List<Consumable_orderdetails__c> cod1 = [
- SELECT Id
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :Order1.Id
- ];
- System.assertEquals(1, cod1.size());
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
- PageReference page = new PageReference(
- '/apex/ArriveGoods?Esetid=' + Order1.Id
- );
+ List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
+ System.assertEquals(1, cod1.size());
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- Controller.init();
- //鎺掑簭
- Controller.barcode = '';
- Controller.SearchPro();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123';
- Controller.SearchPro();
+ PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
- // System.assertEquals(3, controller.ConsumableorderdetailsRecordsdummy.size()); //tcm
- Controller.ArriveGoodsConfim();
- System.Test.stopTest();
- }
- }
-}
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ Controller.init();
+ //鎺掑簭
+ Controller.barcode = '';
+ Controller.SearchPro();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123';
+ Controller.SearchPro();
+
+ // System.assertEquals(3, controller.ConsumableorderdetailsRecordsdummy.size()); //tcm
+ Controller.ArriveGoodsConfim();
+ System.Test.stopTest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml b/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml
index 133fce1..7a51829 100644
--- a/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml
+++ b/force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>58.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls b/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
index 9c83139..ccb9821 100644
--- a/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
@@ -1,109 +1,95 @@
-global without sharing class Batch_FixAttachmentToFiles implements Database.Batchable<sObject> {
- // Id batchJobId = Database.executeBatch(new Batch_FixAttachmentToFiles('Consumable_order__c',Datetime.newInstance(2023, 1, 1, 8, 0, 0),Datetime.newInstance(2024, 1, 1, 8, 0, 0)),2000);
- private Datetime creStartDate = null;
- private Datetime creEndDate = null;
- private String objectApiName = null;
- private Set<String> parentIds = new Set<String>(); //Add by Li Jun 20230703
- public Batch_FixAttachmentToFiles(
- String objectType,
- Datetime startTime,
- Datetime endTime
- ) {
- creStartDate = startTime;
- creEndDate = endTime;
- objectApiName = objectType;
- }
- //Add by Li Jun 20230703 Start
- public Batch_FixAttachmentToFiles(Set<String> parentIds) {
- this.parentIds = parentIds;
- }
- //Add by Li Jun 20230703 End
- global Database.QueryLocator start(Database.BatchableContext BC) {
- String queryObject = 'SELECT Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById FROM Attachment WHERE Parent.Type =:objectApiName AND CreatedDate >=:creStartDate AND CreatedDate <:creEndDate Order by CreatedDate ASC';
- if (parentIds.size() > 0) {
- queryObject = 'SELECT Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById FROM Attachment WHERE ParentId in:parentIds';
+global without sharing class Batch_FixAttachmentToFiles implements Database.Batchable<sObject>{
+ // Id batchJobId = Database.executeBatch(new Batch_FixAttachmentToFiles('Consumable_order__c',Datetime.newInstance(2023, 1, 1, 8, 0, 0),Datetime.newInstance(2024, 1, 1, 8, 0, 0)),2000);
+ private Datetime creStartDate = null;
+ private Datetime creEndDate = null;
+ private String objectApiName = null;
+ private Set<String> parentIds = new Set<String>();//Add by Li Jun 20230703
+ public Batch_FixAttachmentToFiles(String objectType, Datetime startTime, Datetime endTime) {
+ creStartDate = startTime;
+ creEndDate = endTime;
+ objectApiName = objectType;
}
- return Database.getQueryLocator(queryObject);
- }
-
- global void execute(Database.BatchableContext BC, List<Attachment> scope) {
- List<ContentVersion> insertContents = new List<ContentVersion>();
- Map<string, id> nameParentMaps = new Map<string, id>();
- Set<String> attachmentIds = new Set<String>();
- for (Attachment att : scope) {
- nameParentMaps.put(att.Id, att.ParentId);
- attachmentIds.add(att.Id);
- ContentVersion cVersion = new ContentVersion();
- cVersion.ContentLocation = 'S'; //S-Document is in Salesforce. E-Document is outside of Salesforce. L-Document is on a Social Netork.
- cVersion.PathOnClient = att.Id; //File name with extention
- cVersion.Origin = 'C'; //C-Content Origin. H-Chatter Origin.
- cVersion.Title = att.Name; //Name of the file
- cVersion.VersionData = att.Body; //File content
- insertContents.add(cVersion);
+ //Add by Li Jun 20230703 Start
+ public Batch_FixAttachmentToFiles(Set<String> parentIds) {
+ this.parentIds = parentIds;
}
- if (insertContents.isEmpty()) {
- return;
- }
- //Insert insertContents;
- List<Database.SaveResult> saveResultsContents = Database.insert(
- insertContents,
- false
- );
- insertLog(saveResultsContents, attachmentIds);
- set<Id> contentIds = new Set<Id>();
- for (ContentVersion cv : insertContents) {
- contentIds.add(cv.id);
- }
- List<ContentVersion> conDocuments = [
- SELECT ContentDocumentId, Title, PathOnClient
- FROM ContentVersion
- WHERE Id IN :contentIds
- ];
- List<ContentDocumentLink> insertDocLinks = new List<ContentDocumentLink>();
- for (ContentVersion cv : conDocuments) {
- ContentDocumentLink cDocLink = new ContentDocumentLink();
- cDocLink.ContentDocumentId = cv.ContentDocumentId; //Add ContentDocumentId
- cDocLink.LinkedEntityId = nameParentMaps.get(cv.PathOnClient); //Add attachment parentId
- cDocLink.ShareType = 'V'; //V - Viewer permission. C - Collaborator permission. I - Inferred permission.
- cDocLink.Visibility = 'AllUsers';
- insertDocLinks.add(cDocLink);
- }
- //Insert insertDocLinks;
- List<Database.SaveResult> saveResultsLinks = Database.insert(
- insertDocLinks,
- false
- );
- insertLog(saveResultsLinks, attachmentIds);
- }
-
- global void insertLog(
- List<Database.SaveResult> saveResults,
- Set<String> attachmentIds
- ) {
- Transaction_Log__c traLog = new Transaction_Log__c();
- List<Map<String, String>> logMapList = new List<Map<String, String>>();
- for (Database.SaveResult result : saveResults) {
- String recordId = result.getId();
- if (!result.isSuccess()) {
- for (Database.Error error : result.getErrors()) {
- Map<String, String> logMap = new Map<String, String>();
- String errorMsg = error.getMessage();
- logMap.put('recordId', recordId);
- logMap.put('errorMsg', errorMsg);
- logMapList.add(logMap);
+ //Add by Li Jun 20230703 End
+ global Database.QueryLocator start(Database.BatchableContext BC) {
+ String queryObject = 'SELECT Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById FROM Attachment WHERE Parent.Type =:objectApiName AND CreatedDate >=:creStartDate AND CreatedDate <:creEndDate Order by CreatedDate ASC';
+ if(parentIds.size() > 0){
+ queryObject = 'SELECT Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById FROM Attachment WHERE ParentId in:parentIds';
}
- }
+ return Database.getQueryLocator(queryObject);
}
- if (logMapList.size() > 0) {
- Map<String, String> attachmentIdMap = new Map<String, String>();
- attachmentIdMap.put('attachmentIds', JSON.serialize(attachmentIds));
- logMapList.add(attachmentIdMap);
- traLog.Response__c = JSON.serialize(logMapList);
- traLog.Module__c = 'Attachment COnvert Transaction ';
- insert traLog;
- }
- }
- global void finish(Database.BatchableContext BC) {
- }
-}
+ global void execute(Database.BatchableContext BC, List<Attachment> scope) {
+ List<ContentVersion> insertContents = new List<ContentVersion>();
+ Map<string,id> nameParentMaps = new Map<string,id>();
+ Set<String> attachmentIds = new Set<String>();
+ for (Attachment att : scope) {
+ nameParentMaps.put(att.Id, att.ParentId);
+ attachmentIds.add(att.Id);
+ ContentVersion cVersion = new ContentVersion();
+ cVersion.ContentLocation = 'S'; //S-Document is in Salesforce. E-Document is outside of Salesforce. L-Document is on a Social Netork.
+ cVersion.PathOnClient = att.Id; //File name with extention
+ cVersion.Origin = 'C'; //C-Content Origin. H-Chatter Origin.
+ cVersion.Title = att.Name; //Name of the file
+ cVersion.VersionData = att.Body; //File content
+ insertContents.add(cVersion);
+ }
+ if(insertContents.isEmpty()){
+ return;
+ }
+ //Insert insertContents;
+ List<Database.SaveResult> saveResultsContents = Database.insert(insertContents, false);
+ insertLog(saveResultsContents,attachmentIds);
+ set<Id> contentIds = new set<Id>();
+ for(ContentVersion cv : insertContents){
+ contentIds.add(cv.id);
+ }
+ List<ContentVersion> conDocuments = [SELECT ContentDocumentId, Title,PathOnClient FROM ContentVersion WHERE Id in: contentIds];
+ List<ContentDocumentLink> insertDocLinks = new List<ContentDocumentLink>();
+ for(ContentVersion cv : conDocuments){
+ ContentDocumentLink cDocLink = new ContentDocumentLink();
+ cDocLink.ContentDocumentId = cv.ContentDocumentId; //Add ContentDocumentId
+ cDocLink.LinkedEntityId = nameParentMaps.get(cv.PathOnClient); //Add attachment parentId
+ cDocLink.ShareType = 'V'; //V - Viewer permission. C - Collaborator permission. I - Inferred permission.
+ cDocLink.Visibility = 'AllUsers';
+ insertDocLinks.add(cDocLink);
+ }
+ //Insert insertDocLinks;
+ List<Database.SaveResult> saveResultsLinks = Database.insert(insertDocLinks, false);
+ insertLog(saveResultsLinks,attachmentIds);
+ }
+
+ global void insertLog(List<Database.SaveResult> saveResults,Set<String> attachmentIds) {
+ Transaction_Log__c traLog = new Transaction_Log__c();
+ List<Map<String,String>> logMapList = new List<Map<String,String>>();
+ for (Database.SaveResult result : saveResults) {
+ String recordId = result.getId();
+ if (!result.isSuccess()) {
+ for (Database.Error error : result.getErrors()) {
+ Map<String,String> logMap = new Map<String,String>();
+ String errorMsg = error.getMessage();
+ logMap.put('recordId',recordId);
+ logMap.put('errorMsg',errorMsg);
+ logMapList.add(logMap);
+ }
+ }
+ }
+ if(logMapList.size() > 0){
+ Map<String,String> attachmentIdMap = new Map<String,String>();
+ attachmentIdMap.put('attachmentIds',JSON.serialize(attachmentIds));
+ logMapList.add(attachmentIdMap);
+ traLog.Response__c = JSON.serialize(logMapList);
+ traLog.Module__c = 'Attachment COnvert Transaction ';
+ Insert traLog;
+ }
+ }
+
+
+
+ global void finish(Database.BatchableContext BC) {
+
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
index 88d691b..ce9a300 100644
--- a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
@@ -1,69 +1,51 @@
@isTest(SeeAllData=true)
private class Batch_FixAttachmentToFilesTest {
- @isTest(SeeAllData=true)
- static void testInit() {
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- Account accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo
- );
- insert accountItem1;
- Consumable_order__c consOrder = new Consumable_order__c();
- consOrder.Name = 'test01';
- consOrder.Order_status__c = '鎵瑰噯';
- consOrder.Deliver_date__c = Date.today();
- consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- consOrder.Order_type__c = '璁㈠崟';
- consOrder.Order_ProType__c = 'ENG';
- consOrder.Dealer_Info__c = accountItem1.Id;
- consOrder.Delivery_detail_count__c = 5;
- insert consOrder;
+ @isTest(SeeAllData=true)
+ static void testInit() {
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ Account accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo);
+ insert accountItem1;
- List<Attachment> attachList = new List<Attachment>();
- Attachment attach = new Attachment();
- attach.Name = 'A-65224941-20200923--1.docx';
- Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
- attach.body = bodyBlob;
- attach.ParentId = consOrder.Id;
- attachList.add(attach);
- insert attachList;
-
- Set<String> Id = new Set<String>();
- String objectType;
- Datetime creStartDate;
- Datetime creEndDate;
-
- List<Attachment> attachmentList = [
- SELECT
- Id,
- Name,
- OwnerId,
- ParentId,
- Parent.Name,
- Parent.Type,
- Body,
- CreatedDate,
- CreatedById
- FROM Attachment
- WHERE Id = :attachList[0].Id
- ORDER BY CreatedDate ASC
- LIMIT 1
- ];
- for (Attachment att : attachmentList) {
- Id.add(att.ParentId);
- objectType = att.Parent.Name;
- creStartDate = att.CreatedDate;
- creEndDate = att.CreatedDate.addDays(1);
- }
- System.Test.startTest();
- Database.executeBatch(
- new Batch_FixAttachmentToFiles(objectType, creStartDate, creEndDate),
- 1
- );
- Database.executeBatch(new Batch_FixAttachmentToFiles(Id), 1);
- System.Test.stopTest();
- }
-}
+ Consumable_order__c consOrder = new Consumable_order__c();
+ consOrder.Name = 'test01';
+ consOrder.Order_status__c = '鎵瑰噯';
+ consOrder.Deliver_date__c = Date.today();
+ consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ consOrder.Order_type__c = '璁㈠崟';
+ consOrder.Order_ProType__c = 'ENG';
+ consOrder.Dealer_Info__c = accountItem1.Id;
+ consOrder.Delivery_detail_count__c = 5;
+ insert consOrder;
+
+ List<Attachment> attachList = new List<Attachment>();
+ Attachment attach = new Attachment();
+ attach.Name='A-65224941-20200923--1.docx';
+ Blob bodyBlob= Blob.valueOf('Unit Test Attachment Body');
+ attach.body = bodyBlob;
+ attach.ParentId = consOrder.Id;
+ attachList.add(attach);
+ insert attachList;
+
+ Set<String> Id = new Set<String>();
+ String objectType;
+ Datetime creStartDate;
+ Datetime creEndDate;
+
+ List<Attachment> attachmentList = [Select Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById
+ From Attachment
+ Where Id =:attachList[0].Id
+ Order by CreatedDate ASC
+ Limit 1];
+ for (Attachment att : attachmentList) {
+ Id.add(att.ParentId);
+ objectType = att.Parent.Name;
+ creStartDate = att.CreatedDate;
+ creEndDate = att.CreatedDate.addDays(1);
+ }
+ System.Test.startTest();
+ Database.executeBatch(new Batch_FixAttachmentToFiles(objectType,creStartDate,creEndDate),1);
+ Database.executeBatch(new Batch_FixAttachmentToFiles(Id),1);
+ System.Test.stopTest();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/DealerInquiryModifyStateController.cls b/force-app/main/default/classes/DealerInquiryModifyStateController.cls
index 2d8fda5..9e6c25c 100644
--- a/force-app/main/default/classes/DealerInquiryModifyStateController.cls
+++ b/force-app/main/default/classes/DealerInquiryModifyStateController.cls
@@ -1,731 +1,644 @@
public with sharing class DealerInquiryModifyStateController {
- public List<OpportunityInfo> oppRecords { get; set; }
- // 銉氥兗銈搞儸銈ゃ偄銈︺儓銇儏鍫便倰鍙栧緱
- private Map<String, Map<String, String>> editLayoutItemRWMap = new Map<String, Map<String, String>>();
- // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null;
- public List<OpportunityInfo> OPPORTList { get; set; }
- /*****************妞滅储鐢�******************/
+ public List<OpportunityInfo> oppRecords { get; set; }
+ // 銉氥兗銈搞儸銈ゃ偄銈︺儓銇儏鍫便倰鍙栧緱
+ private Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>();
+ // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null;
+ public List<OpportunityInfo> OPPORTList { get; set; }
+ /*****************妞滅储鐢�******************/
- /*******************妫�绱㈠睘鎬у��*******************/
+ /*******************妫�绱㈠睘鎬у��*******************/
- public String accSearch { get; set; } //缁忛攢鍟嗗尰闄�
- public String aooSearch { get; set; } //鎷呭綋浜�
- public String numtext1 { get; set; } //鏁版嵁瀛楁01
- public String numtext { get; set; } //鏁版嵁瀛楁03
- public String numtext2 { get; set; } //鏁版嵁瀛楁02
- public String timetext1 { get; set; } //鏃ユ湡01
- public String timetext2 { get; set; } //鏃ユ湡02
- public Agency_Opportunity__c tmpAO { get; set; } //妫�绱㈡棩鏈熺敤
- public Agency_Opportunity__c tmpBO { get; set; } //妫�绱㈡棩鏈熺敤
- public String limits { get; set; } //鏃ユ湡03
+ public String accSearch { get; set; }//缁忛攢鍟嗗尰闄�
+ public String aooSearch { get; set; }//鎷呭綋浜�
+ public String numtext1 { get; set; } //鏁版嵁瀛楁01
+ public String numtext { get; set; }//鏁版嵁瀛楁03
+ public String numtext2 { get; set; } //鏁版嵁瀛楁02
+ public String timetext1 { get; set; } //鏃ユ湡01
+ public String timetext2 { get; set; } //鏃ユ湡02
+ public Agency_Opportunity__c tmpAO { get; set; } //妫�绱㈡棩鏈熺敤
+ public Agency_Opportunity__c tmpBO { get; set; } //妫�绱㈡棩鏈熺敤
+ public String limits { get; set; }//鏃ユ湡03
- public List<SelectOption> dateOpts { get; private set; }
- public List<SelectOption> textOpts { get; private set; }
- public List<SelectOption> timeOpts { get; private set; }
- public List<SelectOption> equalOpts { get; private set; }
- public List<SelectOption> timeequalOpts { get; private set; }
- public List<SelectOption> limitOpts { get; private set; }
+ public List<SelectOption> dateOpts { get; private set; }
+ public List<SelectOption> textOpts { get; private set; }
+ public List<SelectOption> timeOpts { get; private set; }
+ public List<SelectOption> equalOpts { get; private set; }
+ public List<SelectOption> timeequalOpts { get; private set; }
+ public List<SelectOption> limitOpts { get; private set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- public Integer oppCount { get; set; }
- public String saveType { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public Integer oppCount { get; set; }
+ public String saveType { get; set; }
- public String sortKey { get; set; }
- public String preSortKey { get; set; }
- public Boolean sortOrderAsc { get; set; }
- public String[] sortOrder { get; set; }
- public String[] columus = new List<String>{ 'Id' };
- public String[] selColumus = null;
- public Set<String> columusSet = new Set<String>{ 'Id' };
+ public String sortKey { get; set; }
+ public String preSortKey { get; set; }
+ public Boolean sortOrderAsc { get; set; }
+ public String[] sortOrder { get; set; }
+ public String[] columus = new String[] {'Id'};
+ public String[] selColumus = null;
+ public Set<String> columusSet = new Set<String> {'Id'};
- // 椤圭洰set 瀛楁鏍囩
- public List<String> titleLeft { get; private set; }
- public List<String> titleRight { get; private set; }
- // 椤圭洰set 瀛楁鍚�
- public List<List<String>> columnsLeftApi { get; private set; } // 鍙傜収闋呯洰鐢�
- public List<List<String>> columnsRightApi { get; private set; } // 鍙傜収闋呯洰鐢�
- public List<String> columnLeftCss { get; private set; } // css 鐢�
- public List<String> columnRightCss { get; private set; } // css 鐢�
- public Map<String, String> columnLeftRW { get; private set; } // r,w,wm鐢�
- public Map<String, String> columnRightRW { get; private set; } // r,w,wm鐢�
- private String strColumus;
- private String strRtColumus;
+ // 椤圭洰set 瀛楁鏍囩
+ public List<String> titleLeft { get; private set; }
+ public List<String> titleRight { get; private set; }
+ // 椤圭洰set 瀛楁鍚�
+ public List<List<String>> columnsLeftApi { get; private set; } // 鍙傜収闋呯洰鐢�
+ public List<List<String>> columnsRightApi { get; private set; } // 鍙傜収闋呯洰鐢�
+ public List<String> columnLeftCss { get; private set; } // css 鐢�
+ public List<String> columnRightCss { get; private set; } // css 鐢�
+ public Map<String, String> columnLeftRW { get; private set; } // r,w,wm鐢�
+ public Map<String, String> columnRightRW { get; private set; } // r,w,wm鐢�
+ private String strColumus;
+ private String strRtColumus;
- //add by Link 2023-6-2
- public String remindMsg { get; set; }
+ //add by Link 2023-6-2
+ public String remindMsg{get;set;}
- @TestVisible
- private String accTypeForSort = null;
- private static Integer oppLimit = 500;
+ @TestVisible private String accTypeForSort = null;
+ private static Integer oppLimit = 500;
- public DealerInquiryModifyStateController() {
- oppRecords = new List<OpportunityInfo>();
+ public DealerInquiryModifyStateController() {
+ oppRecords = new List<OpportunityInfo>();
- //dateOpts = new List<SelectOption>();
- //dateOpts.add(new SelectOption('', '--鏃�--'));
- //dateOpts.add(new SelectOption('Registration_Day__c', '鐧诲綍鏃�'));
- //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '绂佺敤鏃ユ湡'));
+ //dateOpts = new List<SelectOption>();
+ //dateOpts.add(new SelectOption('', '--鏃�--'));
+ //dateOpts.add(new SelectOption('Registration_Day__c', '鐧诲綍鏃�'));
+ //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '绂佺敤鏃ユ湡'));
- //鏁版嵁瀛楁涓嬫媺鍒楄〃
- textOpts = new List<SelectOption>();
- textOpts.add(new SelectOption('', '--鏃�--'));
- textOpts.add(
- new SelectOption('Agency_Opportunity_No__c', '缁忛攢鍟嗚浠风紪鐮�')
- );
- textOpts.add(new SelectOption('Agency__r.Name', '缁忛攢鍟�'));
- textOpts.add(new SelectOption('Agency_Hospital__r.Name', '缁忛攢鍟嗗尰闄�'));
- textOpts.add(new SelectOption('Department_Cateogy__c', '绉戝鍒嗙被'));
- textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '璇环鍚嶇О'));
- // textOpts.add(new SelectOption('Name', '璇环鍚嶇О'));
+ //鏁版嵁瀛楁涓嬫媺鍒楄〃
+ textOpts = new List<SelectOption>();
+ textOpts.add(new SelectOption('', '--鏃�--'));
+ textOpts.add(new SelectOption('Agency_Opportunity_No__c', '缁忛攢鍟嗚浠风紪鐮�'));
+ textOpts.add(new SelectOption('Agency__r.Name', '缁忛攢鍟�'));
+ textOpts.add(new SelectOption('Agency_Hospital__r.Name', '缁忛攢鍟嗗尰闄�'));
+ textOpts.add(new SelectOption('Department_Cateogy__c', '绉戝鍒嗙被'));
+ textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '璇环鍚嶇О'));
+ // textOpts.add(new SelectOption('Name', '璇环鍚嶇О'));
- textOpts.add(new SelectOption('StageName__c', '璇环闃舵'));
- textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '鐘舵��1'));
- //绮剧悽绉戞妧 zxk 2021-08-25 start
- // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '鐘舵��2'));
- textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly璇环闃舵'));
- //绮剧悽绉戞妧 zxk 2021-08-25 end
- textOpts.add(new SelectOption('Hospital_City_Master__c', '甯�'));
-
- // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '閿�鍞湰閮�'));
- // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '鐪�'));
- // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '甯�'));
- //鏃ユ湡瀛楁涓嬫媺鍒楄〃
- timeOpts = new List<SelectOption>();
- timeOpts.add(new SelectOption('', '--鏃�--'));
- timeOpts.add(new SelectOption('Created_Day__c', '鍒涘缓鏃�'));
- timeOpts.add(new SelectOption('Bid_Planned_Date__c', '棰勬祴鎷涙爣鏃�'));
- timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '棰勬祴涓爣鏃�'));
- timeOpts.add(
- new SelectOption('Close_Forecasted_Date__c', '棰勬祴涓嶰LY绛剧害鏃�')
- );
- timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '澶卞崟鏃ユ湡'));
- timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '鍙栨秷鏃ユ湡'));
- //鏁版嵁瀛楁涓棿杩炴帴绗﹀彿
- equalOpts = new List<SelectOption>();
- equalOpts.add(new SelectOption('=', '绛変簬'));
- equalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
- equalOpts.add(new SelectOption('<', '<'));
- equalOpts.add(new SelectOption('>', '>'));
- equalOpts.add(new SelectOption('<=', '<='));
- equalOpts.add(new SelectOption('>=', '>='));
- equalOpts.add(new SelectOption('contains', '鍖呭惈'));
- equalOpts.add(new SelectOption('notcontains', '涓嶅寘鍚�'));
- equalOpts.add(new SelectOption('starts with', '璧峰瀛楃'));
- //鏃ユ湡瀛楁杩炴帴绗﹀彿
- //timeequalOpts = new List<SelectOption>();
- //timeequalOpts.add(new SelectOption('=', '绛変簬'));
- //timeequalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
- //timeequalOpts.add(new SelectOption('<', '<'));
- //timeequalOpts.add(new SelectOption('>', '>'));
- //timeequalOpts.add(new SelectOption('<=', '<='));
- //timeequalOpts.add(new SelectOption('>=', '>='));
- //鏁版嵁鏄剧ず鏉℃暟
- limitOpts = new List<SelectOption>();
- limitOpts.add(new SelectOption('10', '10'));
- limitOpts.add(new SelectOption('20', '20'));
- limitOpts.add(new SelectOption('50', '50'));
- limitOpts.add(new SelectOption('100', '100'));
- limitOpts.add(new SelectOption('200', '200'));
- limitOpts.add(new SelectOption('1000', '鍏ㄩ儴'));
- //鏁版嵁鏄剧ず榛樿鏉℃暟
- limits = '20';
- }
-
- public PageReference init() {
- remindMsg = '';
- PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap();
- soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element();
- soap.SessionHeader.sessionId = UserInfo.getSessionId();
- soap.endpoint_x =
- URL.getSalesforceBaseUrl().toExternalForm() +
- '/partner/services/Soap/u/33.0';
- // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0';
-
- PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
- if (System.Test.isRunningTest()) {
- // UnitTest 鐢�
- // PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
- PartnerSoapSforceCom.RecordTypeMapping rtMap = new PartnerSoapSforceCom.RecordTypeMapping();
- PartnerSoapSforceCom.DescribeLayout editLayout = new PartnerSoapSforceCom.DescribeLayout();
- PartnerSoapSforceCom.DescribeLayoutSection editLayoutSection = new PartnerSoapSforceCom.DescribeLayoutSection();
- PartnerSoapSforceCom.DescribeLayoutRow layoutRow = new PartnerSoapSforceCom.DescribeLayoutRow();
- PartnerSoapSforceCom.DescribeLayoutItem layoutItem = new PartnerSoapSforceCom.DescribeLayoutItem();
- PartnerSoapSforceCom.DescribeLayoutComponent layoutComponent = new PartnerSoapSforceCom.DescribeLayoutComponent();
- dlr.recordTypeMappings = new List<PartnerSoapSforceCom.RecordTypeMapping>();
- dlr.recordTypeMappings.add(rtMap);
- rtMap.recordTypeId = 'recordTypeId';
- dlr.layouts = new List<PartnerSoapSforceCom.DescribeLayout>();
- dlr.layouts.add(editLayout);
- editLayout.editLayoutSections = new List<PartnerSoapSforceCom.DescribeLayoutSection>();
- editLayout.editLayoutSections.add(editLayoutSection);
- editLayoutSection.layoutRows = new List<PartnerSoapSforceCom.DescribeLayoutRow>();
- editLayoutSection.layoutRows.add(layoutRow);
- layoutRow.layoutItems = new List<PartnerSoapSforceCom.DescribeLayoutItem>();
- layoutRow.layoutItems.add(layoutItem);
- layoutItem.layoutComponents = new List<PartnerSoapSforceCom.DescribeLayoutComponent>();
- layoutItem.layoutComponents.add(layoutComponent);
- // return dlr;
- } else {
- dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
- // dlr = soap.describeLayout('asdas', null, null);
- }
-
- // PartnerSoapSforceCom.DescribeLayoutResult dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
- Map<String, PartnerSoapSforceCom.DescribeLayout> layputMap = new Map<String, PartnerSoapSforceCom.DescribeLayout>();
- for (PartnerSoapSforceCom.DescribeLayout layout : dlr.layouts) {
- layputMap.put(layout.id, layout);
- }
- for (Integer lidx = 0; lidx < dlr.recordTypeMappings.size(); lidx++) {
- String recordTypeId = dlr.recordTypeMappings[lidx].recordTypeId;
- Map<String, String> rtnInner = new Map<String, String>();
- editLayoutItemRWMap.put(recordTypeId, rtnInner);
- System.debug('recordTypeId=' + recordTypeId);
- PartnerSoapSforceCom.DescribeLayout layout = layputMap.get(
- dlr.recordTypeMappings[lidx].layoutId
- );
- for (
- PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections
- ) {
- for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) {
- for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) {
- if (
- item.layoutComponents != null &&
- item.layoutComponents.size() > 0 &&
- String.isBlank(item.layoutComponents[0].value) == false
- ) {
- rtnInner.put(item.layoutComponents[0].value, 'r');
- if (item.editableForUpdate) {
- rtnInner.put(item.layoutComponents[0].value, 'w');
- }
- if (item.required) {
- rtnInner.put(item.layoutComponents[0].value, 'wm');
- }
- }
- }
- }
- }
- }
- // editLayoutItemRWMap = SoapApi.getEditRWByRecordType('Agency_Opportunity__c', null);
- tmpAO = new Agency_Opportunity__c();
- tmpBO = new Agency_Opportunity__c();
- setLayoutRWInfo();
- searchOppInner();
- return null;
- }
- //鐢ㄤ簬鑾峰彇缁忛攢鍟嗚浠峰瓧娈甸泦鍜岃浠峰瓧娈甸泦浠ュ強鐩稿簲鐨勮鍐欐潈闄�
- @TestVisible
- private void setLayoutRWInfo() {
- if (this.sortOrder == null) {
- selColumus = new List<String>{};
- strColumus = '';
- ID accRecordTypeId = accTypeForSort;
-
- Map<String, String> DESC_RW = editLayoutItemRWMap.get(
- '012100000006KW7AAM'
- );
- Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe()
- .get('Agency_Opportunity__c')
- .getDescribe()
- .fieldSets.getMap();
- Schema.FieldSet fs = fsMap.get('DealerInquiryModifyState');
- List<FieldSetMember> fsmList = fs.getFields();
- titleLeft = new List<String>();
- List<String> columnLeft = new List<String>();
- columnLeftCss = new List<String>();
- columnsLeftApi = new List<List<String>>();
- columnLeftRW = new Map<String, String>();
- for (FieldSetMember fsm : fsmList) {
- titleLeft.add(fsm.getLabel());
- columnLeft.add(fsm.getFieldPath());
- List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
- columnsLeftApi.add(splitFieldPath);
- if (DESC_RW == null) {
- columnLeftRW.put(fsm.getFieldPath(), 'r');
- } else if (splitFieldPath.size() == 1) {
- String rw = DESC_RW.get(fsm.getFieldPath());
- if (rw != null) {
- columnLeftRW.put(fsm.getFieldPath(), rw);
- } else {
- columnLeftRW.put(fsm.getFieldPath(), 'r');
- }
- } else {
- columnLeftRW.put(fsm.getFieldPath(), 'r');
- }
- }
- for (String str : columnLeftRW.keySet()) {
- System.debug(str + '=+=+=+=+=' + columnLeftRW.get(str));
- }
- for (String s : columnLeft) {
- if (columusSet.contains(s) == false) {
- columus.add(s);
- columusSet.add(s);
- }
- if (selColumus.contains(s) == false) {
- selColumus.add(s);
- }
- columnLeftCss.add(s.replace('.', '_'));
- }
- strRtColumus = '';
- Schema.FieldSet fsRt = fsMap.get('DealerOpportunity');
- List<FieldSetMember> fsmListRt = fsRt.getFields();
- titleRight = new List<String>();
- List<String> columnRight = new List<String>();
- columnRightCss = new List<String>();
- columnsRightApi = new List<List<String>>();
- columnRightRW = new Map<String, String>();
-
- for (FieldSetMember fsm : fsmListRt) {
- titleRight.add(fsm.getLabel());
- columnRight.add(fsm.getFieldPath());
- List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
- columnsRightApi.add(splitFieldPath);
- if (DESC_RW == null) {
- columnRightRW.put(fsm.getFieldPath(), 'r');
- } else if (splitFieldPath.size() == 1) {
- String rw = DESC_RW.get(fsm.getFieldPath());
- if (rw != null) {
- columnRightRW.put(fsm.getFieldPath(), rw);
- } else {
- columnRightRW.put(fsm.getFieldPath(), 'r');
- }
- } else {
- columnRightRW.put(fsm.getFieldPath(), 'r');
- }
- }
- for (String s : columnRight) {
- selColumus.add(s);
- if (strRtColumus == '') {
- strRtColumus = s;
- } else {
- strRtColumus = strRtColumus + ',' + s;
- }
- columnRightCss.add(s.replace('.', '_'));
- }
- strColumus = String.join(columus, ',');
- System.debug('======-======-======strColumus' + strColumus);
- System.debug('======-======-======strRtColumus' + strRtColumus);
- this.sortOrderAsc = true;
- this.sortOrder = new List<String>(selColumus.size());
- for (Integer i = 0; i < selColumus.size(); i++)
- this.sortOrder[i] = '銆�';
- }
- }
- //鐢ㄤ簬鎷兼帴SOQL璇彞 鏍规嵁涓嶅悓妫�绱㈡潯浠舵嫾鎺ヤ笉鍚孲OQL璇彞銆�
- public void searchOppInner() {
- //SOQL:鎷兼帴妫�绱㈡潯浠朵互鍙婄粡閿�鍟嗚浠风殑SOQL璇彞
- // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)];
- // String querySoql = '';
- // Integer queryint = 0;
- // for(User user : userlist2){
- // if(queryint == 0){
- // querySoql += '\''+user.Id+'\'';
- // queryint++;
- // }else{
- // querySoql += ',\''+user.Id+'\'';
- // }
-
- // }
- // System.debug('pppqqq222'+userlist2);
- // System.debug('pppqqq333'+querySoql);
- // AND Ownerid in ( '+querySoql+')'
-
- String soql =
- 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' +
- strColumus +
- ',' +
- strRtColumus +
- ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' ';
- //鏁版嵁瀛楁锛氱粡閿�鍟嗗尰闄� +SOQL
- if (!String.isBlank(accSearch)) {
- accSearch = accSearch.trim();
- // soql += 'AND Agency__r.Name ' + ' LIKE \'%' + accSearch + '%\' ';
- soql +=
- 'AND Agency_Hospital__r.Name ' +
- ' LIKE \'%' +
- accSearch +
- '%\' ';
- }
- //鏁版嵁瀛楁锛氭媴褰撲汉 +SOQL
- if (!String.isBlank(aooSearch)) {
- String newAooSearch = aooSearch.trim();
- // soql += 'AND Change_To_Opportunity__r.Owner.Alias = ' + '\'' + newAooSearch + '\'';//Name
- soql +=
- 'AND Agency_PersonName__c ' +
- ' LIKE \'%' +
- newAooSearch +
- '%\' ';
- }
- //鏁版嵁瀛楁锛�03 鎵嬪姩濉啓椤� 鍑嗗璋冪敤makeTextSql锛�
- if (!String.isBlank(numtext)) {
- String newNumtext = numtext.trim();
- String str = makeTextSql(numtext1, numtext2, newNumtext);
- soql += str;
- System.debug('+++++++++++++=============++++++++++++++++++' + soql);
- }
- //鐐瑰嚮鎺掑簭
- // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7);
- if (String.isBlank(this.sortKey)) {
- soql +=
- ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits);
- } else {
- if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) {
- soql +=
- ' order by ' +
- this.selColumus[Integer.valueOf(this.sortKey)] +
- ' ' +
- (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') +
- ' limit ' +
- Integer.valueOf(limits);
- } else {
- soql +=
- ' order by Change_To_Opportunity__r.' +
- this.selColumus[Integer.valueOf(this.sortKey)] +
- ' ' +
- (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') +
- ' limit ' +
- Integer.valueOf(limits);
- }
- }
- system.debug(soql);
- // List<User> userlist1 = [select id,name from user ];
- // System.debug('pppqqq111'+userlist1);
-
- List<Agency_Opportunity__c> InfoList = Database.query(soql);
- System.debug('+++++++-------------------' + InfoList);
-
- // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql);
- // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c);
- for (Agency_Opportunity__c apt : InfoList) {
- System.debug('pppqqq' + apt.Agency_PersonName__c + '====' + apt.Name);
- }
-
- List<OpportunityInfo> oppinfoList = new List<OpportunityInfo>();
- if (InfoList != null && InfoList.size() > 0) {
- String str = '';
- for (Agency_Opportunity__c agc : InfoList) {
- if (str == '' && agc.Change_To_Opportunity__r.Id != null) {
- str = '\'' + agc.Change_To_Opportunity__r.Id + '\'';
- } else if (agc.Change_To_Opportunity__r.Id != null) {
- str += ',\'' + agc.Change_To_Opportunity__r.Id + '\'';
- }
- }
- for (Agency_Opportunity__c info : InfoList) {
- oppinfoList.add(new OpportunityInfo(info, info));
- oppinfoList[oppinfoList.size() - 1].lineNo = oppinfoList.size() - 1;
- }
- }
- oppRecords = oppinfoList.clone();
- oppCount = oppRecords.size();
- //鏄剧ず鎻愮ず鎿嶄綔淇℃伅
- if (String.isBlank(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鍧囨弧瓒宠繘鍏ユ鏂规硶 鍒ゆ柇澶氱鎯呭喌
- private String makeTextSql(
- String textOpts,
- String equalOpts,
- String numtext
- ) {
- String soql = '';
- if (!String.isBlank(textOpts)) {
- //瀵绘壘妫�绱㈡潯浠跺寘鍚�� 鈥� 绌烘牸鐨勫閲嶆绱㈡潯浠�
- //system.debug('314-textOpts:'+textOpts);
- if (
- (equalOpts == 'contains' || equalOpts == 'notcontains') &&
- numtext.contains(',')
- ) {
- //system.debug('316-equalOpts:'+equalOpts);
- //system.debug('316-numtext:'+numtext);
- String[] vals = numtext.split(',');
- String cSql = '';
- soql += ' AND (';
- for (Integer icount = 0; icount < vals.size(); icount++) {
- //绮剧悽绉戞妧 zxk 2021-08-25 start
- String val = vals[icount];
- if (equalOpts == 'contains') {
- cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
- soql += cSql;
-
- if (icount < vals.size() - 1) {
- soql += ' OR ';
- }
- } else if (equalOpts == 'notcontains') {
- cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
- soql += cSql;
- if (icount < vals.size() - 1) {
- soql += ' AND ';
- }
- }
- }
+ textOpts.add(new SelectOption('StageName__c', '璇环闃舵'));
+ textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '鐘舵��1'));
+ //绮剧悽绉戞妧 zxk 2021-08-25 start
+ // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '鐘舵��2'));
+ textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly璇环闃舵'));
//绮剧悽绉戞妧 zxk 2021-08-25 end
+ textOpts.add(new SelectOption('Hospital_City_Master__c', '甯�'));
+
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '閿�鍞湰閮�'));
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '鐪�'));
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '甯�'));
+ //鏃ユ湡瀛楁涓嬫媺鍒楄〃
+ timeOpts = new List<SelectOption>();
+ timeOpts.add(new SelectOption('', '--鏃�--'));
+ timeOpts.add(new SelectOption('Created_Day__c', '鍒涘缓鏃�'));
+ timeOpts.add(new SelectOption('Bid_Planned_Date__c', '棰勬祴鎷涙爣鏃�'));
+ timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '棰勬祴涓爣鏃�'));
+ timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '棰勬祴涓嶰LY绛剧害鏃�'));
+ timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '澶卞崟鏃ユ湡'));
+ timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '鍙栨秷鏃ユ湡'));
+ //鏁版嵁瀛楁涓棿杩炴帴绗﹀彿
+ equalOpts = new List<SelectOption>();
+ equalOpts.add(new SelectOption('=', '绛変簬'));
+ equalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
+ equalOpts.add(new SelectOption('<', '<'));
+ equalOpts.add(new SelectOption('>', '>'));
+ equalOpts.add(new SelectOption('<=', '<='));
+ equalOpts.add(new SelectOption('>=', '>='));
+ equalOpts.add(new SelectOption('contains', '鍖呭惈'));
+ equalOpts.add(new SelectOption('notcontains', '涓嶅寘鍚�'));
+ equalOpts.add(new SelectOption('starts with', '璧峰瀛楃'));
+ //鏃ユ湡瀛楁杩炴帴绗﹀彿
+ //timeequalOpts = new List<SelectOption>();
+ //timeequalOpts.add(new SelectOption('=', '绛変簬'));
+ //timeequalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
+ //timeequalOpts.add(new SelectOption('<', '<'));
+ //timeequalOpts.add(new SelectOption('>', '>'));
+ //timeequalOpts.add(new SelectOption('<=', '<='));
+ //timeequalOpts.add(new SelectOption('>=', '>='));
+ //鏁版嵁鏄剧ず鏉℃暟
+ limitOpts = new List<SelectOption>();
+ limitOpts.add(new SelectOption('10', '10'));
+ limitOpts.add(new SelectOption('20', '20'));
+ limitOpts.add(new SelectOption('50', '50'));
+ limitOpts.add(new SelectOption('100', '100'));
+ limitOpts.add(new SelectOption('200', '200'));
+ limitOpts.add(new SelectOption('1000', '鍏ㄩ儴'));
+ //鏁版嵁鏄剧ず榛樿鏉℃暟
+ limits = '20';
+ }
- // String val = vals[icount];
- // cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
- // system.debug(cSql);
- // soql += cSql;
- // if (icount < vals.size() - 1) {
- // soql += ' OR ';
+ public PageReference init() {
+ remindMsg = '';
+ PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap();
+ soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element();
+ soap.SessionHeader.sessionId = UserInfo.getSessionId();
+ soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/partner/services/Soap/u/33.0';
+ // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0';
+
+ PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
+ if (System.Test.isRunningTest()) {
+ // UnitTest 鐢�
+ // PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
+ PartnerSoapSforceCom.RecordTypeMapping rtMap = new PartnerSoapSforceCom.RecordTypeMapping();
+ PartnerSoapSforceCom.DescribeLayout editLayout = new PartnerSoapSforceCom.DescribeLayout();
+ PartnerSoapSforceCom.DescribeLayoutSection editLayoutSection = new PartnerSoapSforceCom.DescribeLayoutSection();
+ PartnerSoapSforceCom.DescribeLayoutRow layoutRow = new PartnerSoapSforceCom.DescribeLayoutRow();
+ PartnerSoapSforceCom.DescribeLayoutItem layoutItem = new PartnerSoapSforceCom.DescribeLayoutItem();
+ PartnerSoapSforceCom.DescribeLayoutComponent layoutComponent = new PartnerSoapSforceCom.DescribeLayoutComponent();
+ dlr.recordTypeMappings = new List<PartnerSoapSforceCom.RecordTypeMapping>();
+ dlr.recordTypeMappings.add(rtMap);
+ rtMap.recordTypeId = 'recordTypeId';
+ dlr.layouts = new List<PartnerSoapSforceCom.DescribeLayout>();
+ dlr.layouts.add(editLayout);
+ editLayout.editLayoutSections = new List<PartnerSoapSforceCom.DescribeLayoutSection>();
+ editLayout.editLayoutSections.add(editLayoutSection);
+ editLayoutSection.layoutRows = new List<PartnerSoapSforceCom.DescribeLayoutRow>();
+ editLayoutSection.layoutRows.add(layoutRow);
+ layoutRow.layoutItems = new List<PartnerSoapSforceCom.DescribeLayoutItem>();
+ layoutRow.layoutItems.add(layoutItem);
+ layoutItem.layoutComponents = new List<PartnerSoapSforceCom.DescribeLayoutComponent>();
+ layoutItem.layoutComponents.add(layoutComponent);
+ // return dlr;
+ } else {
+ dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
+ // dlr = soap.describeLayout('asdas', null, null);
+ }
+
+ // PartnerSoapSforceCom.DescribeLayoutResult dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
+ Map<String, PartnerSoapSforceCom.DescribeLayout> layputMap = new Map<String, PartnerSoapSforceCom.DescribeLayout>();
+ for (PartnerSoapSforceCom.DescribeLayout layout : dlr.layouts) {
+ layputMap.put(layout.id, layout);
+ }
+ for (Integer lidx = 0; lidx < dlr.recordTypeMappings.size(); lidx++) {
+ String recordTypeId = dlr.recordTypeMappings[lidx].recordTypeId;
+ Map<String, String> rtnInner = new Map<String, String>();
+ editLayoutItemRWMap.put(recordTypeId, rtnInner);
+ System.debug('recordTypeId=' + recordTypeId);
+ PartnerSoapSforceCom.DescribeLayout layout = layputMap.get(dlr.recordTypeMappings[lidx].layoutId);
+ for (PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections) {
+ for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) {
+ for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) {
+ if (item.layoutComponents != null && item.layoutComponents.size() > 0
+ && String.isBlank(item.layoutComponents[0].value) == false) {
+ rtnInner.put(item.layoutComponents[0].value, 'r');
+ if (item.editableForUpdate) {
+ rtnInner.put(item.layoutComponents[0].value, 'w');
+ }
+ if (item.required) {
+ rtnInner.put(item.layoutComponents[0].value, 'wm');
+ }
+ }
+ }
+ }
+ }
+ }
+ // editLayoutItemRWMap = SoapApi.getEditRWByRecordType('Agency_Opportunity__c', null);
+ tmpAO = new Agency_Opportunity__c();
+ tmpBO = new Agency_Opportunity__c();
+ setLayoutRWInfo();
+ searchOppInner();
+ return null;
+ }
+ //鐢ㄤ簬鑾峰彇缁忛攢鍟嗚浠峰瓧娈甸泦鍜岃浠峰瓧娈甸泦浠ュ強鐩稿簲鐨勮鍐欐潈闄�
+ @TestVisible private void setLayoutRWInfo() {
+ if (this.sortOrder == null) {
+ selColumus = new String[] {};
+ strColumus = '';
+ ID accRecordTypeId = accTypeForSort;
+
+ Map<String, String> DESC_RW = editLayoutItemRWMap.get('012100000006KW7AAM');
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Agency_Opportunity__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('DealerInquiryModifyState');
+ List<FieldSetMember> fsmList = fs.getFields();
+ titleLeft = new List<String>();
+ List<String> columnLeft = new List<String>();
+ columnLeftCss = new List<String>();
+ columnsLeftApi = new List<List<String>>();
+ columnLeftRW = new Map<String, String>();
+ for (FieldSetMember fsm : fsmList) {
+ titleLeft.add(fsm.getLabel());
+ columnLeft.add(fsm.getFieldPath());
+ List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
+ columnsLeftApi.add(splitFieldPath);
+ if (DESC_RW == null) {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ } else if (splitFieldPath.size() == 1) {
+ String rw = DESC_RW.get(fsm.getFieldPath());
+ if (rw != null) {
+ columnLeftRW.put(fsm.getFieldPath(), rw);
+ } else {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ }
+ } else {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ }
+ }
+ for (String str : columnLeftRW.keySet()) {
+ System.debug(str + '=+=+=+=+=' + columnLeftRW.get(str));
+ }
+ for (String s : columnLeft) {
+ if (columusSet.contains(s) == false) {
+ columus.add(s);
+ columusSet.add(s);
+ }
+ if (selColumus.contains(s) == false) {
+ selColumus.add(s);
+ }
+ columnLeftCss.add(s.replace('.', '_'));
+ }
+ strRtColumus = '';
+ Schema.FieldSet fsRt = fsMap.get('DealerOpportunity');
+ List<FieldSetMember> fsmListRt = fsRt.getFields();
+ titleRight = new List<String>();
+ List<String> columnRight = new List<String>();
+ columnRightCss = new List<String>();
+ columnsRightApi = new List<List<String>>();
+ columnRightRW = new Map<String, String>();
+
+ for (FieldSetMember fsm : fsmListRt) {
+ titleRight.add(fsm.getLabel());
+ columnRight.add(fsm.getFieldPath());
+ List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
+ columnsRightApi.add(splitFieldPath);
+ if (DESC_RW == null) {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ } else if (splitFieldPath.size() == 1) {
+ String rw = DESC_RW.get(fsm.getFieldPath());
+ if (rw != null) {
+ columnRightRW.put(fsm.getFieldPath(), rw);
+ } else {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ }
+ } else {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ }
+ }
+ for (String s : columnRight) {
+ selColumus.add(s);
+ if (strRtColumus == '') {
+ strRtColumus = s;
+ } else {
+ strRtColumus = strRtColumus + ',' + s;
+ }
+ columnRightCss.add(s.replace('.', '_'));
+
+ }
+ strColumus = String.join(columus, ',');
+ System.debug('======-======-======strColumus' + strColumus);
+ System.debug('======-======-======strRtColumus' + strRtColumus);
+ this.sortOrderAsc = true;
+ this.sortOrder = new String[selColumus.size()];
+ for (Integer i = 0; i < selColumus.size(); i++) this.sortOrder[i] = '銆�';
+ }
+ }
+ //鐢ㄤ簬鎷兼帴SOQL璇彞 鏍规嵁涓嶅悓妫�绱㈡潯浠舵嫾鎺ヤ笉鍚孲OQL璇彞銆�
+ public void searchOppInner() {
+ //SOQL:鎷兼帴妫�绱㈡潯浠朵互鍙婄粡閿�鍟嗚浠风殑SOQL璇彞
+ // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)];
+ // String querySoql = '';
+ // Integer queryint = 0;
+ // for(User user : userlist2){
+ // if(queryint == 0){
+ // querySoql += '\''+user.Id+'\'';
+ // queryint++;
+ // }else{
+ // querySoql += ',\''+user.Id+'\'';
// }
+
// }
- soql += ')';
- }
- //瀵绘壘妫�绱㈡潯浠跺寘鍚�橈紝鈥� 閫楀彿鐨勫閲嶆绱㈡潯浠�
- else if (
- (equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')
- ) {
- String[] vals = numtext.split(',');
- soql += ' AND ( ';
- for (Integer icount = 0; icount < vals.size(); icount++) {
- String val = vals[icount];
- if (equalOpts == '=') {
- soql += textOpts + ' = \'' + val + '\'';
- if (icount < vals.size() - 1) {
- soql += ' OR ';
- }
- } else if (equalOpts == '<>') {
- soql += textOpts + ' <> \'' + val + '\'';
- if (icount < vals.size() - 1) {
- soql += ' AND ';
- }
- }
- }
- soql += ')';
- }
- //妫�绱㈣繛鎺ョ涓哄寘鍚互鍙婁笉鍖呭惈
- else if (
- equalOpts.equals('contains') || equalOpts.equals('notcontains')
- ) {
- if (equalOpts.equals('contains')) {
- soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\'';
- } else if (equalOpts.equals('notcontains')) {
- soql += ' AND ( NOT ' + textOpts + ' LIKE \'%' + numtext + '%\' ) ';
- }
- }
- //妫�绱㈣繛鎺ョ涓虹瓑浜庝互鍙婁笉绛変簬
- else if (equalOpts == '=' || equalOpts == '<>') {
- soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\'';
- }
- //绮剧悽绉戞妧 zxk 2021-08-25 start
- //璧峰瀛楃
- else if (equalOpts == 'starts with' && numtext.contains(' ')) {
- String[] vals = numtext.split(' ');
- soql += ' AND ( ';
- for (Integer icount = 0; icount < vals.size(); icount++) {
- String val = vals[icount];
- if (equalOpts == 'starts with') {
- soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'';
- if (icount < vals.size() - 1) {
- soql += ' OR ';
- }
- }
- }
- soql += ')';
- }
- //绮剧悽绉戞妧 zxk 2021-08-25 end
+ // System.debug('pppqqq222'+userlist2);
+ // System.debug('pppqqq333'+querySoql);
+ // AND Ownerid in ( '+querySoql+')'
- // //璧峰瀛楃
- // else if (equalOpts == 'starts with'){
- // soql += 'AND ' + textOpts + ' LIKE \'' + numtext + '%\'';
- // }
- //妫�绱㈣繛鎺ョ鐨勫叾浠栨儏鍐�
- else {
- String cSql = this.makeTextSqlStr(textOpts, equalOpts, numtext);
- if (equalOpts != '<>') {
- soql += cSql;
+ String soql = 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' +
+ strColumus + ',' + strRtColumus +
+ ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' ';
+ //鏁版嵁瀛楁锛氱粡閿�鍟嗗尰闄� +SOQL
+ if (!String.isBlank(accSearch)) {
+ accSearch = accSearch.trim();
+ // soql += 'AND Agency__r.Name ' + ' LIKE \'%' + accSearch + '%\' ';
+ soql += 'AND Agency_Hospital__r.Name ' + ' LIKE \'%' + accSearch + '%\' ';
+ }
+ //鏁版嵁瀛楁锛氭媴褰撲汉 +SOQL
+ if (!String.isBlank(aooSearch)) {
+ String newAooSearch = aooSearch.trim();
+ // soql += 'AND Change_To_Opportunity__r.Owner.Alias = ' + '\'' + newAooSearch + '\'';//Name
+ soql += 'AND Agency_PersonName__c ' + ' LIKE \'%' + newAooSearch + '%\' ';
+ }
+ //鏁版嵁瀛楁锛�03 鎵嬪姩濉啓椤� 鍑嗗璋冪敤makeTextSql锛�
+ if (!String.isBlank(numtext)) {
+ String newNumtext = numtext.trim();
+ String str = makeTextSql(numtext1, numtext2, newNumtext);
+ soql += str;
+ System.debug('+++++++++++++=============++++++++++++++++++' + soql);
+ }
+ //鐐瑰嚮鎺掑簭
+ // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7);
+ if (String.isBlank(this.sortKey)) {
+ soql += ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits);
} else {
- soql += ' and (NOT ' + cSql + ') ';
+ if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) {
+ soql += ' order by ' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+ } else {
+ soql += ' order by Change_To_Opportunity__r.' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+ }
}
- }
- }
- return soql;
- }
- //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒筹紝骞朵笖杩涘叆makeTextSql锛堬級涔嬪悗锛屽唴鍚暟鎹瓧娈靛寘鍚绉嶆椂杩涘叆姝ゆ柟娉曘��
- @TestVisible
- private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
- String soql = '';
- if (!String.isBlank(textOpts)) {
- String tmpVal = val;
- if (!String.isBlank(tmpVal)) {
- if (equalOpts == 'contains' || equalOpts == 'notcontains') {
- if (equalOpts == 'contains') {
- soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'';
- } else if (equalOpts == 'notcontains') {
- soql += ' ( NOT ' + textOpts + ' LIKE \'%' + val + '%\' ) ';
- }
- } else if (equalOpts == '=' || equalOpts == '<>') {
- if (equalOpts == '=') {
- soql += ' AND ' + textOpts + ' = ' + val;
- } else if (equalOpts == '<>') {
- soql += ' AND ' + textOpts + ' <> ' + val;
- }
+ system.debug(soql);
+ // List<User> userlist1 = [select id,name from user ];
+ // System.debug('pppqqq111'+userlist1);
+
+ List<Agency_Opportunity__c> InfoList = Database.query(soql);
+ System.debug('+++++++-------------------'+InfoList);
+
+ // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql);
+ // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c);
+ for (Agency_Opportunity__c apt : InfoList) {
+ System.debug('pppqqq' + apt.Agency_PersonName__c + '====' + apt.Name);
}
- } else {
- soql = ' AND ' + textOpts;
- if (equalOpts == '=') {
- soql += ' = ' + tmpVal;
- } else if (equalOpts == '<>') {
- soql += ' <> ' + tmpVal;
- } else if (equalOpts == 'contains') {
- soql +=
- ' like \'%' +
- String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
- '%\'';
- } else if (equalOpts == 'notcontains') {
- soql +=
- ' like \'%' +
- String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
- '%\'';
- } else if (equalOpts == 'starts with') {
- soql +=
- ' like \'%' +
- String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
- '%\'';
+
+ List<OpportunityInfo> oppinfoList = new List<OpportunityInfo>();
+ if (InfoList != null && InfoList.size() > 0) {
+ String str = '';
+ for (Agency_Opportunity__c agc : InfoList) {
+ if (str == '' && agc.Change_To_Opportunity__r.Id != null) {
+ str = '\'' + agc.Change_To_Opportunity__r.Id + '\'';
+ } else if (agc.Change_To_Opportunity__r.Id != null) {
+ str += ',\'' + agc.Change_To_Opportunity__r.Id + '\'';
+
+ }
+ }
+ for (Agency_Opportunity__c info : InfoList) {
+ oppinfoList.add(new OpportunityInfo(info, info));
+ oppinfoList[oppinfoList.size() - 1].lineNo = oppinfoList.size() - 1;
+ }
+ }
+ oppRecords = oppinfoList.clone();
+ oppCount = oppRecords.size();
+ //鏄剧ず鎻愮ず鎿嶄綔淇℃伅
+ if (String.isBlank(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 {
- soql += ' ' + equalOpts + ' ' + tmpVal;
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�'));
+ //add by Link 2023-6-2
+ remindMsg = '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�';
}
- }
}
- return soql;
- }
+ //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒宠繘鍏ユ鏂规硶 鍒ゆ柇澶氱鎯呭喌
+ private String makeTextSql(String textOpts, String equalOpts, String numtext) {
+ String soql = '';
+ if (!String.isBlank(textOpts)) {
+ //瀵绘壘妫�绱㈡潯浠跺寘鍚�� 鈥� 绌烘牸鐨勫閲嶆绱㈡潯浠�
+ //system.debug('314-textOpts:'+textOpts);
+ if ((equalOpts == 'contains' || equalOpts == 'notcontains') && numtext.contains(',')) {
+ //system.debug('316-equalOpts:'+equalOpts);
+ //system.debug('316-numtext:'+numtext);
+ String[] vals = numtext.split(',');
+ String cSql = '';
+ soql += ' AND (';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
- //妫�绱㈡寜閽細鐐瑰嚮妫�绱㈡寜閽Е鍙戞鏂规硶锛�
- public PageReference chick() {
- setLayoutRWInfo();
- searchOppInner();
- return null;
- }
- //椤甸潰鍐呭鏈変慨鏀规椂锛岄〉闈㈠垽鏂悗浼犲�肩粰changeFlg浠ュ強changeFlgRt灞炴�э紝鐐瑰嚮淇濆瓨鏃惰皟鐢ㄦ鏂规硶锛岃繘琛屼繚瀛樸��
- public PageReference save() {
- //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp );
- try {
- List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>();
- // List<Opportunity> updOpps = new List<Opportunity>();
- for (OpportunityInfo oi : oppRecords) {
- if (oi.changeFlg == '1') {
- oi.changeFlg = '0';
- updTarget.add(oi.AgcOpp);
+ //绮剧悽绉戞妧 zxk 2021-08-25 start
+ String val = vals[icount];
+ if (equalOpts == 'contains') {
+ cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
+ soql += cSql;
+
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+ }
+ } else if (equalOpts == 'notcontains') {
+ cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
+ soql += cSql;
+ if (icount < vals.size() - 1) {
+ soql += ' AND ';
+ }
+ }
+
+ }
+ //绮剧悽绉戞妧 zxk 2021-08-25 end
+
+
+ // String val = vals[icount];
+ // cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
+ // system.debug(cSql);
+ // soql += cSql;
+ // if (icount < vals.size() - 1) {
+ // soql += ' OR ';
+ // }
+ // }
+ soql += ')';
+ }
+ //瀵绘壘妫�绱㈡潯浠跺寘鍚�橈紝鈥� 閫楀彿鐨勫閲嶆绱㈡潯浠�
+ else if ((equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')) {
+ String[] vals = numtext.split(',');
+ soql += ' AND ( ';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
+ String val = vals[icount];
+ if (equalOpts == '=') {
+ soql += textOpts + ' = \'' + val + '\'';
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+ }
+ } else if (equalOpts == '<>') {
+ soql += textOpts + ' <> \'' + val + '\'';
+ if (icount < vals.size() - 1) {
+ soql += ' AND ';
+ }
+ }
+ }
+ soql += ')';
+ }
+ //妫�绱㈣繛鎺ョ涓哄寘鍚互鍙婁笉鍖呭惈
+ else if (equalOpts.equals('contains') || equalOpts.equals('notcontains')) {
+ if (equalOpts.equals('contains')) {
+ soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\'';
+ } else if (equalOpts.equals('notcontains')) {
+ soql += ' AND ( NOT ' + textOpts + ' LIKE \'%' + numtext + '%\' ) ';
+ }
+ }
+ //妫�绱㈣繛鎺ョ涓虹瓑浜庝互鍙婁笉绛変簬
+ else if (equalOpts == '=' || equalOpts == '<>') {
+ soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\'';
+ }
+
+ //绮剧悽绉戞妧 zxk 2021-08-25 start
+ //璧峰瀛楃
+ else if (equalOpts == 'starts with' && numtext.contains(' ')) {
+ String[] vals = numtext.split(' ');
+ soql += ' AND ( ';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
+ String val = vals[icount];
+ if (equalOpts == 'starts with') {
+ soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ;
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+
+ }
+ }
+ }
+ soql += ')';
+
+ }
+ //绮剧悽绉戞妧 zxk 2021-08-25 end
+
+ // //璧峰瀛楃
+ // else if (equalOpts == 'starts with'){
+ // soql += 'AND ' + textOpts + ' LIKE \'' + numtext + '%\'';
+ // }
+ //妫�绱㈣繛鎺ョ鐨勫叾浠栨儏鍐�
+ else {
+ String cSql = this.makeTextSqlStr(textOpts, equalOpts, numtext);
+ if (equalOpts != '<>') {
+ soql += cSql;
+ } else {
+ soql += ' and (NOT ' + cSql + ') ';
+ }
+ }
}
- // if (oi.changeFlgRt == '1' && oi.opp.id != null) {
- // oi.changeFlgRt = '0';
- // updOpps.add(oi.opp);
- // }
- }
- if (updTarget.size() > 0) {
- system.debug('updTarget.size:' + updTarget.size());
- update updTarget;
- }
- // if (updOpps.size() > 0) {
- // update updOpps;
- // }
- ApexPages.addmessage(
- new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨瀹屼簡')
- );
- //add by Link 2023-6-2
- remindMsg = '淇濆瓨瀹屼簡';
- } catch (Exception e) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇风‘瀹氱瀹ゅ垎绫诲拰浜у搧鍖哄垎鐨勫叧绯�'));
+ return soql;
}
- if (saveType == '1') {
- searchOppInner();
- saveType = '';
- } else if (saveType == '2') {
- sortTable();
- saveType = '';
- } else {
+ //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒筹紝骞朵笖杩涘叆makeTextSql锛堬級涔嬪悗锛屽唴鍚暟鎹瓧娈靛寘鍚绉嶆椂杩涘叆姝ゆ柟娉曘��
+ @TestVisible private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
+ String soql = '';
+ if (!String.isBlank(textOpts)) {
+ String tmpVal = val;
+ if (!String.isBlank(tmpVal)) {
+ if (equalOpts == 'contains' || equalOpts == 'notcontains') {
+ if (equalOpts == 'contains') {
+ soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ;
+ } else if (equalOpts == 'notcontains') {
+ soql += ' ( NOT ' + textOpts + ' LIKE \'%' + val + '%\' ) ' ;
+ }
+ } else if (equalOpts == '=' || equalOpts == '<>') {
+ if (equalOpts == '=') {
+ soql += ' AND ' + textOpts + ' = ' + val ;
+ } else if (equalOpts == '<>') {
+ soql += ' AND ' + textOpts + ' <> ' + val ;
+ }
+ }
+ } else {
+ soql = ' AND ' + textOpts;
+ if (equalOpts == '=') {
+ soql += ' = ' + tmpVal;
+ } else if (equalOpts == '<>') {
+ soql += ' <> ' + tmpVal;
+ } else if (equalOpts == 'contains') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else if (equalOpts == 'notcontains') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else if (equalOpts == 'starts with') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else {
+ soql += ' ' + equalOpts + ' ' + tmpVal;
+ }
+ }
+ }
+ return soql;
}
- return null;
- }
- //鍏ㄩ儴灞曞紑璋冪敤姝ゆ柟娉�
- public PageReference sortTable() {
- oppRecords = new List<OpportunityInfo>();
- if (this.sortKey == this.preSortKey) {
- if (String.isBlank(this.sortKey) == false) {
- // 鏂瑰悜銇屽銈忋倠銇伩
- this.sortOrderAsc = !this.sortOrderAsc;
- this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc ==
- true
- ? '鈫�'
- : '鈫�');
- }
- } else {
- this.sortOrderAsc = true;
- if (String.isBlank(this.preSortKey) == false) {
- this.sortOrder[Integer.valueOf(this.preSortKey)] = '銆�';
- }
- this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true
- ? '鈫�'
- : '鈫�');
- }
- this.preSortKey = this.sortKey;
- setLayoutRWInfo();
- searchOppInner();
- return null;
- }
-
- //鑷畾涔夌被OpportunityInfo锛岀敤浜庡垱寤鸿櫄鎷熷瓧娈碉紝鍚堝苟杈撳嚭銆�
- class OpportunityInfo {
- // public Opportunity opp { get; set; }
- public Agency_Opportunity__c opp { get; set; }
- public Boolean canEdit { get; private set; }
- public Boolean hasError { get; private set; }
- public Boolean hasFieldError { get; private set; }
- public Integer lineNo { get; private set; }
- public String changeFlg { get; set; }
- public String changeFlgRt { get; set; }
- public Boolean ifLock { get; set; }
- //public String accType { get; private set; }
- public Agency_Opportunity__c AgcOpp { get; set; }
- public OpportunityInfo(
- Agency_Opportunity__c record,
- Agency_Opportunity__c oppo
- ) {
- opp = oppo;
- canEdit = true;
- hasError = false;
- hasFieldError = false;
- lineNo = 0;
- changeFlg = '0';
- changeFlgRt = '0';
- ifLock = Approval.isLocked(record);
- AgcOpp = record;
+ //妫�绱㈡寜閽細鐐瑰嚮妫�绱㈡寜閽Е鍙戞鏂规硶锛�
+ public PageReference chick() {
+ setLayoutRWInfo();
+ searchOppInner();
+ return null;
}
- }
-}
+ //椤甸潰鍐呭鏈変慨鏀规椂锛岄〉闈㈠垽鏂悗浼犲�肩粰changeFlg浠ュ強changeFlgRt灞炴�э紝鐐瑰嚮淇濆瓨鏃惰皟鐢ㄦ鏂规硶锛岃繘琛屼繚瀛樸��
+ public PageReference save() {
+ //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp );
+ try {
+ List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>();
+ // List<Opportunity> updOpps = new List<Opportunity>();
+ for (OpportunityInfo oi : oppRecords) {
+ if (oi.changeFlg == '1') {
+ oi.changeFlg = '0';
+ updTarget.add(oi.AgcOpp);
+
+ }
+ // if (oi.changeFlgRt == '1' && oi.opp.id != null) {
+ // oi.changeFlgRt = '0';
+ // updOpps.add(oi.opp);
+ // }
+ }
+ if (updTarget.size() > 0) {
+ system.debug('updTarget.size:' + updTarget.size() );
+ update updTarget;
+ }
+ // if (updOpps.size() > 0) {
+ // update updOpps;
+ // }
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨瀹屼簡'));
+ //add by Link 2023-6-2
+ remindMsg = '淇濆瓨瀹屼簡';
+ } catch (Exception e) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇风‘瀹氱瀹ゅ垎绫诲拰浜у搧鍖哄垎鐨勫叧绯�'));
+ }
+ if (saveType == '1') {
+ searchOppInner();
+ saveType = '';
+ } else if (saveType == '2') {
+ sortTable();
+ saveType = '';
+ } else {
+ }
+ return null;
+ }
+ //鍏ㄩ儴灞曞紑璋冪敤姝ゆ柟娉�
+ public PageReference sortTable() {
+ oppRecords = new List<OpportunityInfo>();
+ if (this.sortKey == this.preSortKey) {
+ if (String.isBlank(this.sortKey) == false) {
+ // 鏂瑰悜銇屽銈忋倠銇伩
+ this.sortOrderAsc = !this.sortOrderAsc;
+ this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ } else {
+ this.sortOrderAsc = true;
+ if (String.isBlank(this.preSortKey) == false) {
+ this.sortOrder[Integer.valueOf(this.preSortKey)] = '銆�';
+ }
+ this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ this.preSortKey = this.sortKey;
+
+ setLayoutRWInfo();
+ searchOppInner();
+ return null;
+ }
+
+ //鑷畾涔夌被OpportunityInfo锛岀敤浜庡垱寤鸿櫄鎷熷瓧娈碉紝鍚堝苟杈撳嚭銆�
+ class OpportunityInfo {
+ // public Opportunity opp { get; set; }
+ public Agency_Opportunity__c opp { get; set; }
+ public Boolean canEdit { get; private set; }
+ public Boolean hasError { get; private set; }
+ public Boolean hasFieldError { get; private set; }
+ public Integer lineNo { get; private set; }
+ public String changeFlg { get; set; }
+ public String changeFlgRt { get; set; }
+ public Boolean ifLock { get; set; }
+ //public String accType { get; private set; }
+ public Agency_Opportunity__c AgcOpp { get; set; }
+ public OpportunityInfo(Agency_Opportunity__c record, Agency_Opportunity__c oppo) {
+ opp = oppo;
+ canEdit = true;
+ hasError = false;
+ hasFieldError = false;
+ lineNo = 0;
+ changeFlg = '0';
+ changeFlgRt = '0';
+ ifLock = Approval.isLocked(record);
+ AgcOpp = record;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls b/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
index b1f09b4..60ceee1 100644
--- a/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
+++ b/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
@@ -1,446 +1,421 @@
@isTest
private class DealerInquiryModifyStateControllerTest {
- @TestSetup
- static void init() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectSct = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
- ];
- if (rectSct.size() == 0) {
- return;
- }
- List<RecordType> rectDpt = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND Name = '瑷虹檪绉� 娑堝寲绉�'
- ];
- if (rectDpt.size() == 0) {
- return;
+ @TestSetup static void init() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+ if (rectSct.size() == 0) {
+ return;
+ }
+ List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 娑堝寲绉�'];
+ if (rectDpt.size() == 0) {
+ return;
+ }
+
+ // 銉嗐偣銉堛儑銉笺偪
+
+ Account company = new Account();
+ company.RecordTypeId = rectCo[0].Id;
+ company.Name = 'NFM007TestCompany';
+ insert company;
+ Account section = new Account();
+ section.RecordTypeId = rectSct[0].Id;
+ section.Name = '*';
+ section.Department_Class_Label__c = '娑堝寲绉�';
+ section.ParentId = company.Id;
+ section.Hospital_Department_Class__c = company.Id;
+ insert section;
+ // Test.startTest();
+ Account depart = new Account();
+ depart.RecordTypeId = rectDpt[0].Id;
+ depart.Name = '*';
+ depart.Department_Name__c = 'NFM007TestDepart';
+ depart.ParentId = section.Id;
+ depart.Department_Class__c = section.Id;
+ depart.Hospital__c = company.Id;
+ insert depart;
+
+ Opportunity opp = new Opportunity();
+ opp.AccountId = depart.Id;
+ opp.Department_Class__c = section.Id;
+ opp.Hospital__c = company.Id;
+ opp.SAP_Send_OK__c = false;
+ opp.Name = 'GZ-SP-NFM007_1';
+ opp.Trade__c = '鍐呰部';
+ opp.StageName = '寮曞悎';
+ opp.CloseDate = Date.today();
+ opp.Stock_apply_status__c = '鐢宠涓�';
+ insert opp;
+ Test.startTest();
+ Account account2 = new Account();
+ account2.Name = 'test1缁忛攢鍟�';
+ account2.RecordTypeId = '01210000000Qem1';
+ insert account2;
+
+ Contact contact1 = new Contact();
+ contact1.AccountId = account2.Id;
+ contact1.FirstName = '璨换鑰�';
+ contact1.LastName = 'test1鍖婚櫌';
+ contact1.Agency_User__c = true;
+ insert contact1;
+ List<Contact> contactlist = [select Id, FirstName
+ from Contact
+ ];
+
+ System.assertEquals('璨换鑰�', contactlist[0].FirstName);
+
+
+
+ //
+ User user = new User();
+ Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
+ user.ProfileId = p.Id;
+ user.ContactId = contact1.Id;
+ user.FirstName = '銉︺兗銈躲兗';
+ user.LastName = '銉嗐偣銉�';
+ user.Email = 'test_user@example.com';
+ user.emailencodingkey = 'UTF-8';
+ user.languagelocalekey = 'zh_CN';
+ user.localesidkey = 'ja_JP';
+ user.timezonesidkey = 'Asia/Shanghai';
+ user.Username = 'test_user@example.com';
+ user.Alias = '銉嗐儲';
+ user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
+ user.SalesManager__c = UserInfo.getUserId();
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert user;
+ }
+ List<user> users = [select Id, Name, LastName, FirstName from User where LastName = '銉嗐偣銉�'];
+ //
+
+ Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
+ agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
+ agency_hospital_link.Hospital__c = company.Id;
+ agency_hospital_link.Agency__c = account2.Id;
+ agency_hospital_link.Agency_Campaign_Obj__c = true;
+ agency_hospital_link.OwnerId = user.Id;
+ insert agency_hospital_link;
+ //
+
+ //System.assertEquals('銉嗐偣銉�',users[0].LastName);
+ System.assertEquals('銉︺兗銈躲兗', users[0].FirstName );
+
+ Id rtId = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Agency_Opportunity__c' and DeveloperName = 'Opportunity'].Id;
+ // Schema.SobjectType.Agency_Opportunity__c.getRecordTypeInfosByName().get('璇环').getRecordTypeId();
+ Agency_opportunity__c agency_opportunity = new Agency_opportunity__c();
+ agency_opportunity.RecordTypeId = rtId;
+ agency_opportunity.Name = '寮曞悎1';
+ agency_opportunity.Hospital_Target__c = company.Id;
+ agency_opportunity.Agency__c = depart.Id;
+ agency_opportunity.Agency_Hospital__c = agency_hospital_link.Id;
+ agency_opportunity.StageName__c = '杩樻病鐢宠棰勭畻';
+ agency_opportunity.OwnerId = user.Id;
+ agency_opportunity.Change_To_Opportunity_T__c = '::CF-HQ290I';
+ agency_opportunity.Sales_Manager__c =UserInfo.getUserId();
+
+ insert agency_opportunity;
+ Test.stopTest();
+
}
- // 銉嗐偣銉堛儑銉笺偪
+ static testMethod void myUnitTest_SortKey() {
+ Test.startTest();
+ Test.setMock(WebServiceMock.class, new NFMTest_Mock());
+ Test.stopTest();
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+
- Account company = new Account();
- company.RecordTypeId = rectCo[0].Id;
- company.Name = 'NFM007TestCompany';
- insert company;
- Account section = new Account();
- section.RecordTypeId = rectSct[0].Id;
- section.Name = '*';
- section.Department_Class_Label__c = '娑堝寲绉�';
- section.ParentId = company.Id;
- section.Hospital_Department_Class__c = company.Id;
- insert section;
- // Test.startTest();
- Account depart = new Account();
- depart.RecordTypeId = rectDpt[0].Id;
- depart.Name = '*';
- depart.Department_Name__c = 'NFM007TestDepart';
- depart.ParentId = section.Id;
- depart.Department_Class__c = section.Id;
- depart.Hospital__c = company.Id;
- insert depart;
-
- Opportunity opp = new Opportunity();
- opp.AccountId = depart.Id;
- opp.Department_Class__c = section.Id;
- opp.Hospital__c = company.Id;
- opp.SAP_Send_OK__c = false;
- opp.Name = 'GZ-SP-NFM007_1';
- opp.Trade__c = '鍐呰部';
- opp.StageName = '寮曞悎';
- opp.CloseDate = Date.today();
- opp.Stock_apply_status__c = '鐢宠涓�';
- insert opp;
- Test.startTest();
- Account account2 = new Account();
- account2.Name = 'test1缁忛攢鍟�';
- account2.RecordTypeId = '01210000000Qem1';
- insert account2;
-
- Contact contact1 = new Contact();
- contact1.AccountId = account2.Id;
- contact1.FirstName = '璨换鑰�';
- contact1.LastName = 'test1鍖婚櫌';
- contact1.Agency_User__c = true;
- insert contact1;
- List<Contact> contactlist = [
- SELECT Id, FirstName
- FROM Contact
- ];
-
- System.assertEquals('璨换鑰�', contactlist[0].FirstName);
-
- //
- User user = new User();
- Profile p = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
- user.ProfileId = p.Id;
- user.ContactId = contact1.Id;
- user.FirstName = '銉︺兗銈躲兗';
- user.LastName = '銉嗐偣銉�';
- user.Email = 'test_user@example.com';
- user.emailencodingkey = 'UTF-8';
- user.languagelocalekey = 'zh_CN';
- user.localesidkey = 'ja_JP';
- user.timezonesidkey = 'Asia/Shanghai';
- user.Username = 'test_user@example.com';
- user.Alias = '銉嗐儲';
- user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
- user.SalesManager__c = UserInfo.getUserId();
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert user;
+ // 鍒濆鍖栨祴璇�
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+
+
+ controller.init();
+ //System.assertEquals(1, controller.oppRecords.size());楠岃瘉棰勬湡鍊煎拰缁撴灉鍊兼纭��
+ // 鎺掑簭娴嬭瘯
+ // Test.startTest();
+ // Test.stopTest();
+ controller.sortKey = '1';
+ controller.sortKey = '1';
+ controller.sortTable();
+ controller.sortKey = '1';
+ controller.sortKey = '0';
+ controller.sortTable();
+ // Test.stopTest();
}
- List<user> users = [
- SELECT Id, Name, LastName, FirstName
- FROM User
- WHERE LastName = '銉嗐偣銉�'
- ];
- //
+ static testMethod void myUnitTest_AccSearchAndAoosearch() {
+ Test.startTest();
+ Test.setMock(WebServiceMock.class, new NFMTest_Mock());
+ Test.stopTest();
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ // Test.startTest();
+
+ controller.init();
+ //鏂囨湰杈撳叆妗嗘绱�
+ //1:缁忛攢鍟嗗尰闄�
+ controller.accSearch = '娲礊鍘夸腑鍖婚櫌';
+ controller.chick();
+ //2:鎷呭綋浜�
+ controller.aooSearch = '鐜嬪鐞�';
+ controller.chick();
+ // Test.stopTest();
+ }
+ static testMethod void myUnitTest_numtext_Equals() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ // 妫�绱㈡暟鎹瓧娈垫祴璇�
+ //1:妫�绱㈢粡閿�鍟嗙紪鐮� = 151P-00001327
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '=';
+ controller.numtext = '151P-00001327';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '<>';
+ controller.numtext = '151P-00001327';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_numtext_Starts_with() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '<';
+ controller.numtext = '151P-00001327';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'starts with';
+ controller.numtext = '151P-00001327';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_contains() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //2:妫�绱㈢粡閿�鍟嗙紪鐮� 鍖呭惈 151P
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'contains';
+ controller.numtext = '151P';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'notcontains';
+ controller.numtext = '151P';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_null_contains() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //3:妫�绱㈡潯浠跺惈绌烘牸
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'contains';
+ controller.numtext = '151P 150P';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_null_notcontains() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'notcontains';
+ controller.numtext = '151P 150P';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_AllNull_contains() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'contains';
+ controller.numtext = ' ';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_AllNull_notcontains() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = 'notcontains';
+ controller.numtext = ' ';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '=';
+ controller.numtext = ' ';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_tarts_with() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ Test.startTest();
+ controller.init();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '<>';
+ controller.numtext = ' ';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = ' starts with ';
+ controller.numtext = ' ';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTest_Equals_D() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //4:妫�绱㈡潯浠跺惈閫楀彿
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '=';
+ controller.numtext = '151P-00001327,151P-00001343';
+ controller.chick();
+ controller.numtext1 = 'Agency_Opportunity_No__c';
+ controller.numtext2 = '<>';
+ controller.numtext = '151P-00001327,151P-00001343';
+ controller.chick();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTestTime01() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //妫�绱㈡棩鏈熸祴璇�
+ controller.tmpAO = new Agency_Opportunity__c();
+ controller.tmpBO = new Agency_Opportunity__c();
+ controller.timetext1 = 'Created_Day__c';
+ controller.timetext2 = '=';
+ controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-12-12');
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
+ controller.chick();
- Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
- agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
- agency_hospital_link.Hospital__c = company.Id;
- agency_hospital_link.Agency__c = account2.Id;
- agency_hospital_link.Agency_Campaign_Obj__c = true;
- agency_hospital_link.OwnerId = user.Id;
- insert agency_hospital_link;
- //
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
+ controller.chick();
+ // Test.startTest();
+ controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-12-02');
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
+ controller.chick();
- //System.assertEquals('銉嗐偣銉�',users[0].LastName);
- System.assertEquals('銉︺兗銈躲兗', users[0].FirstName);
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
+ controller.chick();
+ Test.stopTest();
- Id rtId = [
- SELECT Id, DeveloperName
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Agency_Opportunity__c'
- AND DeveloperName = 'Opportunity'
- ]
- .Id;
- // Schema.SobjectType.Agency_Opportunity__c.getRecordTypeInfosByName().get('璇环').getRecordTypeId();
- Agency_opportunity__c agency_opportunity = new Agency_opportunity__c();
- agency_opportunity.RecordTypeId = rtId;
- agency_opportunity.Name = '寮曞悎1';
- agency_opportunity.Hospital_Target__c = company.Id;
- agency_opportunity.Agency__c = depart.Id;
- agency_opportunity.Agency_Hospital__c = agency_hospital_link.Id;
- agency_opportunity.StageName__c = '杩樻病鐢宠棰勭畻';
- agency_opportunity.OwnerId = user.Id;
- agency_opportunity.Change_To_Opportunity_T__c = '::CF-HQ290I';
- agency_opportunity.Sales_Manager__c = UserInfo.getUserId();
+ }
+ static testMethod void myUnitTestTime02() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ controller.tmpAO = new Agency_Opportunity__c();
+ controller.tmpBO = new Agency_Opportunity__c();
+ controller.timetext1 = 'Created_Day__c';
+ controller.timetext2 = '=';
+ controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-02-12');
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
+ controller.chick();
- insert agency_opportunity;
- Test.stopTest();
- }
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
+ controller.chick();
+ // Test.startTest();
+ controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-02-02');
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
+ controller.chick();
- static testMethod void myUnitTest_SortKey() {
- Test.startTest();
- Test.setMock(WebServiceMock.class, new NFMTest_Mock());
- Test.stopTest();
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
+ controller.chick();
+ controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
+ controller.chick();
+ Test.stopTest();
- // 鍒濆鍖栨祴璇�
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
-
- controller.init();
- //System.assertEquals(1, controller.oppRecords.size());楠岃瘉棰勬湡鍊煎拰缁撴灉鍊兼纭��
- // 鎺掑簭娴嬭瘯
- // Test.startTest();
- // Test.stopTest();
- controller.sortKey = '1';
- controller.sortKey = '1';
- controller.sortTable();
- controller.sortKey = '1';
- controller.sortKey = '0';
- controller.sortTable();
- // Test.stopTest();
- }
- static testMethod void myUnitTest_AccSearchAndAoosearch() {
- Test.startTest();
- Test.setMock(WebServiceMock.class, new NFMTest_Mock());
- Test.stopTest();
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- // Test.startTest();
-
- controller.init();
- //鏂囨湰杈撳叆妗嗘绱�
- //1:缁忛攢鍟嗗尰闄�
- controller.accSearch = '娲礊鍘夸腑鍖婚櫌';
- controller.chick();
- //2:鎷呭綋浜�
- controller.aooSearch = '鐜嬪鐞�';
- controller.chick();
- // Test.stopTest();
- }
- static testMethod void myUnitTest_numtext_Equals() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- // 妫�绱㈡暟鎹瓧娈垫祴璇�
- //1:妫�绱㈢粡閿�鍟嗙紪鐮� = 151P-00001327
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '=';
- controller.numtext = '151P-00001327';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '<>';
- controller.numtext = '151P-00001327';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_numtext_Starts_with() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '<';
- controller.numtext = '151P-00001327';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'starts with';
- controller.numtext = '151P-00001327';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_contains() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //2:妫�绱㈢粡閿�鍟嗙紪鐮� 鍖呭惈 151P
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'contains';
- controller.numtext = '151P';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'notcontains';
- controller.numtext = '151P';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_null_contains() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //3:妫�绱㈡潯浠跺惈绌烘牸
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'contains';
- controller.numtext = '151P 150P';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_null_notcontains() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'notcontains';
- controller.numtext = '151P 150P';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_AllNull_contains() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'contains';
- controller.numtext = ' ';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_AllNull_notcontains() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = 'notcontains';
- controller.numtext = ' ';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '=';
- controller.numtext = ' ';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_tarts_with() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- Test.startTest();
- controller.init();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '<>';
- controller.numtext = ' ';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = ' starts with ';
- controller.numtext = ' ';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTest_Equals_D() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //4:妫�绱㈡潯浠跺惈閫楀彿
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '=';
- controller.numtext = '151P-00001327,151P-00001343';
- controller.chick();
- controller.numtext1 = 'Agency_Opportunity_No__c';
- controller.numtext2 = '<>';
- controller.numtext = '151P-00001327,151P-00001343';
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTestTime01() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //妫�绱㈡棩鏈熸祴璇�
- controller.tmpAO = new Agency_Opportunity__c();
- controller.tmpBO = new Agency_Opportunity__c();
- controller.timetext1 = 'Created_Day__c';
- controller.timetext2 = '=';
- controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-12-12');
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
- controller.chick();
-
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
- controller.chick();
- // Test.startTest();
- controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-12-02');
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
- controller.chick();
-
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTestTime02() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- controller.tmpAO = new Agency_Opportunity__c();
- controller.tmpBO = new Agency_Opportunity__c();
- controller.timetext1 = 'Created_Day__c';
- controller.timetext2 = '=';
- controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-02-12');
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
- controller.chick();
-
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
- controller.chick();
- // Test.startTest();
- controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-02-02');
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12');
- controller.chick();
-
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-09');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-19');
- controller.chick();
- controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
- controller.chick();
- Test.stopTest();
- }
- static testMethod void myUnitTestTimeSave() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- Test.startTest();
- controller.init();
- controller.oppRecords[0].changeFlg = '1';
- controller.save();
- Test.stopTest();
- }
- static testMethod void myUnitTestTimeSave_1() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //淇濆瓨鏃剁姸鎬乧hangeFlgRt涓�1
- controller.oppRecords[0].changeFlgRt = '1';
- controller.save();
- Test.stopTest();
- }
- static testMethod void myUnitTestTime_LimitsAndOppCount() {
- PageReference page = new PageReference('/apex/DealerInquiryModifyState');
- System.Test.setCurrentPage(page);
- DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
- // 鍒濆鍖栨祴璇�
- Test.startTest();
- controller.init();
- //鏁版嵁鏄剧ず鏉℃暟
- controller.limits = '10';
- controller.searchOppInner();
- //oppLimit and oppCount
- controller.oppCount = 1000;
- controller.init();
- Test.stopTest();
- }
-}
+ }
+ static testMethod void myUnitTestTimeSave() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ Test.startTest();
+ controller.init();
+ controller.oppRecords[0].changeFlg = '1';
+ controller.save();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTestTimeSave_1() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //淇濆瓨鏃剁姸鎬乧hangeFlgRt涓�1
+ controller.oppRecords[0].changeFlgRt = '1';
+ controller.save();
+ Test.stopTest();
+ }
+ static testMethod void myUnitTestTime_LimitsAndOppCount() {
+ PageReference page = new PageReference('/apex/DealerInquiryModifyState');
+ System.Test.setCurrentPage(page);
+ DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
+ // 鍒濆鍖栨祴璇�
+ Test.startTest();
+ controller.init();
+ //鏁版嵁鏄剧ず鏉℃暟
+ controller.limits = '10';
+ controller.searchOppInner();
+ //oppLimit and oppCount
+ controller.oppCount = 1000;
+ controller.init();
+ Test.stopTest();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsControllerTest.cls b/force-app/main/default/classes/LexArriveGoodsControllerTest.cls
index be2e7f1..0d16dab 100644
--- a/force-app/main/default/classes/LexArriveGoodsControllerTest.cls
+++ b/force-app/main/default/classes/LexArriveGoodsControllerTest.cls
@@ -1,483 +1,326 @@
@isTest
private class LexArriveGoodsControllerTest {
- @IsTest
- static void test1() {
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+ @IsTest
+ static void test1(){
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- Account myAccount1 = new Account(
- Name = 'Testaccount001',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999996'
- );
- Account myAccount2 = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900',
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5'
- );
- insert new List<Account>{ myAccount1, myAccount2 };
+ Account myAccount1 = new Account(Name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999996');
+ Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900',Product_Limit_Date__c = 'Test01|2|4,Test02|3|5');
+ insert new Account[]{myAccount1,myAccount2};
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ // Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Total_num__c = 3;
+ Order1.OrderNumber_arrived__c =1;
+ Order1.Delivery_detail_count__c=1;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 40;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.TracingCode__c = 'BXJRA';
+
+ //鍙栨秷浜у搧
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.Cancellation_Date__c= Date.today();
+ Orderdet2.TracingCode__c = 'BXJRB';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.TracingCode__c = 'BXJRC';
+ //Orderdet3.Box_Piece__c = '鐩�';
+
+
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.TracingCode__c = 'BXJRD';
+
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.TracingCode__c = 'BXJRE';
+
+ //鍙戣揣鏄庣粏
+ //绠$悊缂栫爜鍖呭惈鏁板瓧
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001002';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Test01';
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
+ Orderdet6.TracingCode__c = 'BX123';
+
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order1.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
+
+ List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
+ System.assertEquals(1, cod1.size());
+
+ PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
+
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ LexArriveGoodsController.Results re = LexArriveGoodsController.init('Arr', Order1.Id);
+ String arrControllerStr = re.arrGoodCon;
+ LexArriveGoodsController.searchProduct('', arrControllerStr);
+ re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123', arrControllerStr);
+ arrControllerStr = re.arrGoodCon;
+ LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
+ System.Test.stopTest();
+ }
}
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- // Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Total_num__c = 3;
- Order1.OrderNumber_arrived__c = 1;
- Order1.Delivery_detail_count__c = 1;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
+ @IsTest
+ static void test2(){
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 40;
- insert Orderdet;
- //鍙戣揣鏄庣粏
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.TracingCode__c = 'BXJRA';
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
- //鍙栨秷浜у搧
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.Cancellation_Date__c = Date.today();
- Orderdet2.TracingCode__c = 'BXJRB';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.TracingCode__c = 'BXJRC';
- //Orderdet3.Box_Piece__c = '鐩�';
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.TracingCode__c = 'BXJRD';
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.TracingCode__c = 'BXJRE';
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- //鍙戣揣鏄庣粏
- //绠$悊缂栫爜鍖呭惈鏁板瓧
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001002';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Test01';
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
- Orderdet6.TracingCode__c = 'BX123';
+ //杩斿搧璁㈠崟
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order1.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount1.id;
+ Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
+ insert Order1;
+ insert Order2;
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdets8
- };
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
- List<Consumable_orderdetails__c> cod1 = [
- SELECT Id
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :Order1.Id
- ];
- System.assertEquals(1, cod1.size());
+ //鍙戣揣鏄庣粏
+ //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Pro001';
+ Orderdet1.Arrive_date__c = date.today();
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.TracingCode__c = 'BXSYS';
- PageReference page = new PageReference(
- '/apex/ArriveGoods?Esetid=' + Order1.Id
- );
+ //daohuo
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Pro001';
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.Arrive_date__c = date.today();
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
+ Orderdet2.TracingCode__c = 'BXSYS';
+ //sale
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Pro001';
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet3.Arrive_date__c = date.today();
+ Orderdet3.Used_date__c = date.today();
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
+ Orderdet3.TracingCode__c = 'BXSYS';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Pro001';
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet4.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet4.Send_Date__c = date.today();
+ Orderdet4.Arrive_date__c = date.today();
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BX222';
+ Orderdet4.TracingCode__c = 'BXSYS';
+ //quxiao
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001005';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Pro001';
+ Orderdet5.Cancellation_Date__c = Date.today();
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
+ Orderdet5.Box_Piece__c ='涓�';
+ Orderdet5.TracingCode__c = 'BXSYS';
+ //fanpin
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001006';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Pro001';
+ Orderdet6.Consumable_Return_order__c = Order2.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet6.Box_Piece__c ='涓�';
+ Orderdet6.TracingCode__c = 'BXSYS';
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- LexArriveGoodsController.Results re = LexArriveGoodsController.init(
- 'Arr',
- Order1.Id
- );
- String arrControllerStr = re.arrGoodCon;
- LexArriveGoodsController.searchProduct('', arrControllerStr);
- re = LexArriveGoodsController.searchProduct(
- '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123',
- arrControllerStr
- );
- arrControllerStr = re.arrGoodCon;
- LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
- System.Test.stopTest();
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001001';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro1.Id;
+ Orderdet7.Asset_Model_No__c = 'Pro001';
+ Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
+ Orderdet7.TracingCode__c = 'BXSYS';
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ System.Test.startTest();
+ Controller.init();
+ Controller.barcode = '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222';
+ Controller.SearchPro();
+ Controller.ArriveGoodsConfim();
+ Controller.UpdateGoodsOfReturn();
+ controller.getinventorysize();
+ LexArriveGoodsController.Results re = LexArriveGoodsController.init('Arr','');
+ String arrControllerStr = re.arrGoodCon;
+ re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222', arrControllerStr);
+ arrControllerStr = re.arrGoodCon;
+ LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
+ LexArriveGoodsController.updateGoodsOfReturn(re.arrGoodCon, JSON.serialize(re.showGoodsofReturnList));
+ LexArriveGoodsController.ConsumableorderdetailsInfo con = new LexArriveGoodsController.ConsumableorderdetailsInfo();
+ List<LexArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<LexArriveGoodsController.ConsumableorderdetailsInfo>();
+ conList.add(con);
+ LexArriveGoodsController.changeType2(conList);
+ System.Test.stopTest();
+ }
}
- }
-
- @IsTest
- static void test2() {
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
-
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
-
- //杩斿搧璁㈠崟
-
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount1.id;
- Order2.RecordTypeid = System.Label.Dealer_Returned_Label;
- insert Order1;
- insert Order2;
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Pro001';
- Orderdet1.Arrive_date__c = date.today();
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.TracingCode__c = 'BXSYS';
-
- //daohuo
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Pro001';
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.Arrive_date__c = date.today();
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRI';
- Orderdet2.TracingCode__c = 'BXSYS';
- //sale
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Pro001';
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- Orderdet3.Arrive_date__c = date.today();
- Orderdet3.Used_date__c = date.today();
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ';
- Orderdet3.TracingCode__c = 'BXSYS';
- //鍑哄簱
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Pro001';
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- Orderdet4.Consumable_Shipment_order__c = Order1.Id;
- Orderdet4.Send_Date__c = date.today();
- Orderdet4.Arrive_date__c = date.today();
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BX222';
- Orderdet4.TracingCode__c = 'BXSYS';
- //quxiao
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001005';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Pro001';
- Orderdet5.Cancellation_Date__c = Date.today();
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ';
- Orderdet5.Box_Piece__c = '涓�';
- Orderdet5.TracingCode__c = 'BXSYS';
- //fanpin
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001006';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Pro001';
- Orderdet6.Consumable_Return_order__c = Order2.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet6.Box_Piece__c = '涓�';
- Orderdet6.TracingCode__c = 'BXSYS';
-
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001001';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro1.Id;
- Orderdet7.Asset_Model_No__c = 'Pro001';
- Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
- Orderdet7.TracingCode__c = 'BXSYS';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdet7
- };
- ArriveGoodsController Controller = new ArriveGoodsController();
- System.Test.startTest();
- Controller.init();
- Controller.barcode = '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222';
- Controller.SearchPro();
- Controller.ArriveGoodsConfim();
- Controller.UpdateGoodsOfReturn();
- controller.getinventorysize();
- LexArriveGoodsController.Results re = LexArriveGoodsController.init(
- 'Arr',
- ''
- );
- String arrControllerStr = re.arrGoodCon;
- re = LexArriveGoodsController.searchProduct(
- '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222',
- arrControllerStr
- );
- arrControllerStr = re.arrGoodCon;
- LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
- LexArriveGoodsController.updateGoodsOfReturn(
- re.arrGoodCon,
- JSON.serialize(re.showGoodsofReturnList)
- );
- LexArriveGoodsController.ConsumableorderdetailsInfo con = new LexArriveGoodsController.ConsumableorderdetailsInfo();
- List<LexArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<LexArriveGoodsController.ConsumableorderdetailsInfo>();
- conList.add(con);
- LexArriveGoodsController.changeType2(conList);
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml b/force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls b/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls
index 15182de..d59dc74 100644
--- a/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls
+++ b/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls
@@ -1,240 +1,159 @@
@isTest
public class LexArriveGoodsControllerTest1 {
- static void test1() {
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
+ static void test1(){
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+ Account myAccount1 = new Account(Name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999996');
+ Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900',Product_Limit_Date__c = 'Test01|2|4,Test02|3|5');
+ insert new Account[]{myAccount1,myAccount2};
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
+ // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ // insert new Product2[] {prod01,prod02};
+ system.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ // Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Total_num__c = 3;
+ Order1.OrderNumber_arrived__c =1;
+ Order1.Delivery_detail_count__c=1;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ //璁㈠崟鏄庣粏
+ //fahuo
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 40;
+ insert Orderdet;
+
+ //鍙戣揣鏄庣粏
+ //鍒拌揣姝g‘淇℃伅
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet1.TracingCode__c = 'BXJRA';
+
+ //鍙栨秷浜у搧
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001003';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
+ Orderdet2.Cancellation_Date__c= Date.today();
+ Orderdet2.TracingCode__c = 'BXJRB';
+ //閿�鍞骇鍝�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001004';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Asset_Model_No__c = 'Test01';
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.TracingCode__c = 'BXJRC';
+ //Orderdet3.Box_Piece__c = '鐩�';
+
+
+ //鍑哄簱浜у搧
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001005';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Asset_Model_No__c = 'Test01';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
+ Orderdet4.Send_Date__c = Date.today();
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.TracingCode__c = 'BXJRD';
+
+ //宸插埌璐т骇鍝�
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001006';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Asset_Model_No__c = 'Test01';
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.TracingCode__c = 'BXJRE';
+
+ //鍙戣揣鏄庣粏
+ //绠$悊缂栫爜鍖呭惈鏁板瓧
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_01_001002';
+ Orderdet6.Consumable_order_minor__c = Order1.Id;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Asset_Model_No__c = 'Test01';
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
+ Orderdet6.TracingCode__c = 'BX123';
+
+ //鍙戦敊搴� 鏈埌璐�
+ Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
+ Orderdets8.Name = 'OCM_01_001011';
+ Orderdets8.Consumable_order_minor__c = Order1.Id;
+ Orderdets8.Consumable_Product__c = pro1.Id;
+ Orderdets8.Asset_Model_No__c = 'Test01';
+ Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
+ Orderdets8.Box_Piece__c = '鐩�';
+ Orderdets8.TracingCode__c = 'BXsys';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
+
+ List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
+ System.assertEquals(1, cod1.size());
+
+ PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
+
+ System.Test.setCurrentPage(page);
+ ArriveGoodsController Controller = new ArriveGoodsController();
+ //鍒濆鍖栨祴璇�
+ System.Test.startTest();
+ LexArriveGoodsController.Results re = LexArriveGoodsController.init('Arr', Order1.Id);
+ String arrControllerStr = re.arrGoodCon;
+ LexArriveGoodsController.searchProduct('', arrControllerStr);
+ re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123', arrControllerStr);
+ arrControllerStr = re.arrGoodCon;
+ LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
+ System.Test.stopTest();
+ }
}
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
-
- Account myAccount1 = new Account(
- Name = 'Testaccount001',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999996'
- );
- Account myAccount2 = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900',
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5'
- );
- insert new List<Account>{ myAccount1, myAccount2 };
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
-
- // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ];
- // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
- // insert new Product2[] {prod01,prod02};
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- RecordTypeId = '01210000000aMAFAA2',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- // Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Total_num__c = 3;
- Order1.OrderNumber_arrived__c = 1;
- Order1.Delivery_detail_count__c = 1;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
-
- //璁㈠崟鏄庣粏
- //fahuo
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 40;
- insert Orderdet;
-
- //鍙戣揣鏄庣粏
- //鍒拌揣姝g‘淇℃伅
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet1.TracingCode__c = 'BXJRA';
-
- //鍙栨秷浜у搧
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001003';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- //Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRB';
- Orderdet2.Cancellation_Date__c = Date.today();
- Orderdet2.TracingCode__c = 'BXJRB';
- //閿�鍞骇鍝�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001004';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Asset_Model_No__c = 'Test01';
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRC';
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.TracingCode__c = 'BXJRC';
- //Orderdet3.Box_Piece__c = '鐩�';
-
- //鍑哄簱浜у搧
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001005';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Asset_Model_No__c = 'Test01';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD';
- Orderdet4.Send_Date__c = Date.today();
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.TracingCode__c = 'BXJRD';
-
- //宸插埌璐т骇鍝�
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001006';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Asset_Model_No__c = 'Test01';
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE';
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.TracingCode__c = 'BXJRE';
-
- //鍙戣揣鏄庣粏
- //绠$悊缂栫爜鍖呭惈鏁板瓧
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_01_001002';
- Orderdet6.Consumable_order_minor__c = Order1.Id;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Asset_Model_No__c = 'Test01';
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BX123';
- Orderdet6.TracingCode__c = 'BX123';
-
- //鍙戦敊搴� 鏈埌璐�
- Consumable_order_details2__c Orderdets8 = new Consumable_order_details2__c();
- Orderdets8.Name = 'OCM_01_001011';
- Orderdets8.Consumable_order_minor__c = Order1.Id;
- Orderdets8.Consumable_Product__c = pro1.Id;
- Orderdets8.Asset_Model_No__c = 'Test01';
- Orderdets8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXsys';
- Orderdets8.Box_Piece__c = '鐩�';
- Orderdets8.TracingCode__c = 'BXsys';
-
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdets8
- };
-
- List<Consumable_orderdetails__c> cod1 = [
- SELECT Id
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :Order1.Id
- ];
- System.assertEquals(1, cod1.size());
-
- PageReference page = new PageReference(
- '/apex/ArriveGoods?Esetid=' + Order1.Id
- );
-
- System.Test.setCurrentPage(page);
- ArriveGoodsController Controller = new ArriveGoodsController();
- //鍒濆鍖栨祴璇�
- System.Test.startTest();
- LexArriveGoodsController.Results re = LexArriveGoodsController.init(
- 'Arr',
- Order1.Id
- );
- String arrControllerStr = re.arrGoodCon;
- LexArriveGoodsController.searchProduct('', arrControllerStr);
- re = LexArriveGoodsController.searchProduct(
- '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123',
- arrControllerStr
- );
- arrControllerStr = re.arrGoodCon;
- LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml b/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml
+++ b/force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexArriveGoodsMainController.cls b/force-app/main/default/classes/LexArriveGoodsMainController.cls
index 8b9e0fb..b5652b6 100644
--- a/force-app/main/default/classes/LexArriveGoodsMainController.cls
+++ b/force-app/main/default/classes/LexArriveGoodsMainController.cls
@@ -230,4 +230,4 @@
@AuraEnabled
public Boolean isNoteStay;
}
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls b/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls
index 92892ae..a974b8e 100644
--- a/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls
+++ b/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls
@@ -1,161 +1,109 @@
@istest
public class LexArriveGoodsMainControllerTest {
- @IsTest
- static void lexArriveGoodsMainControllerTest1() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
+ @IsTest
+ static void lexArriveGoodsMainControllerTest1(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ Consumable_order__c Order2 = new Consumable_order__c(
+ Name='OCM_01_002',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ insert new Consumable_order__c[] {Order1, Order2};
+
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+ Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
+ createDetail1.name = 'Too002';
+ createDetail1.Consumable_Product__c = pro2.id;
+ createDetail1.Consumable_order__c = Order2.id;
+ createDetail1.Dealer_Custom_Price__c = 999.00;
+ createDetail1.Consumable_count__c = 4;
+ createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail1;
+
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
+ Name='OCM_01_001002',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ //Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
+ Name='OCM_01_001004',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
+
+ LexArriveGoodsMainController.init();
+ LexArriveGoodsMainController.searchConsumableorderdetails('Too001', null, myAccount1.Id, '鍖椾含', 'ET');
+ }
}
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c Order2 = new Consumable_order__c(
- Name = 'OCM_01_002',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ Order1, Order2 };
-
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
- Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
- createDetail1.name = 'Too002';
- createDetail1.Consumable_Product__c = pro2.id;
- createDetail1.Consumable_order__c = Order2.id;
- createDetail1.Dealer_Custom_Price__c = 999.00;
- createDetail1.Consumable_count__c = 4;
- createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail1;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
- Name = 'OCM_01_001002',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- //Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
- Name = 'OCM_01_001004',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
-
- LexArriveGoodsMainController.init();
- LexArriveGoodsMainController.searchConsumableorderdetails(
- 'Too001',
- null,
- myAccount1.Id,
- '鍖椾含',
- 'ET'
- );
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml b/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls b/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls
index 7308c89..c5c4727 100644
--- a/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls
+++ b/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls
@@ -1,249 +1,140 @@
@isTest
public class LexArriveGsDetailsControllerTest {
- @IsTest
- static void test1() {
- User myUser_test = new User();
- Account myAccount1;
- Account myAccount2;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- myUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_Test;
- System.runAs(MyUser_Test) {
- StaticParameter.ConsumableAssetHanderTrigger = true;
- Consumable_order__c order1 = new Consumable_order__c();
- order1.Name = 'OCM_01_001';
- order1.Order_status__c = '鎵瑰噯';
- order1.Order_type__c = '璁㈠崟';
- order1.Dealer_Info__c = myAccount2.Id;
- order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- insert order1;
-
- Consumable_order__c olyorder = new Consumable_order__c();
- olyorder.Name = 'OCM_01_001';
- olyorder.Order_status__c = '鎵瑰噯';
- olyorder.Order_type__c = '璁㈠崟';
- olyorder.Dealer_Info__c = myAccount2.Id;
- olyorder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- insert olyorder;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = olyorder.Id;
- Orderdet1.Consumable_Arrived_order__c = order1.Id;
- //Orderdet1.IsArrival__c = true;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '11111';
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = olyorder.Id;
- Orderdet2.Consumable_Arrived_order__c = order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222';
-
- insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
- LexArriveGsDetailsController.init(order1.Id);
- LexArriveGsDetailsController.proSale(
- JSON.serialize(LexArriveGsDetailsController.coc),
- LexArriveGsDetailsController.coc.Arrive_Order__r.Total_num__c,
- LexArriveGsDetailsController.consumableorderdetailsRecords.size(),
- order1.Id
- );
- }
+ @IsTest
+ static void test1(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Account myAccount2;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ myUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_Test;
+ System.runAs(MyUser_Test){
+ StaticParameter.ConsumableAssetHanderTrigger = true;
+ Consumable_order__c order1 = new Consumable_order__c();
+ order1.Name = 'OCM_01_001';
+ order1.Order_status__c = '鎵瑰噯';
+ order1.Order_type__c = '璁㈠崟';
+ order1.Dealer_Info__c = myAccount2.Id;
+ order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ insert order1;
+
+ Consumable_order__c olyorder = new Consumable_order__c();
+ olyorder.Name = 'OCM_01_001';
+ olyorder.Order_status__c = '鎵瑰噯';
+ olyorder.Order_type__c = '璁㈠崟';
+ olyorder.Dealer_Info__c = myAccount2.Id;
+ olyorder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ insert olyorder;
+
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = olyorder.Id;
+ Orderdet1.Consumable_Arrived_order__c = order1.Id;
+ //Orderdet1.IsArrival__c = true;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '11111';
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = olyorder.Id;
+ Orderdet2.Consumable_Arrived_order__c = order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2};
+ LexArriveGsDetailsController.init(order1.Id);
+ LexArriveGsDetailsController.proSale(JSON.serialize(LexArriveGsDetailsController.coc), LexArriveGsDetailsController.coc.Arrive_Order__r.Total_num__c, LexArriveGsDetailsController.consumableorderdetailsRecords.size(), order1.Id);
+ }
+ }
}
- }
- @IsTest
- static void test2() {
- User myUser_test = new User();
- Account myAccount1;
- Account myAccount2;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- myUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_Test;
- System.runAs(MyUser_Test) {
- StaticParameter.ConsumableAssetHanderTrigger = true;
- Consumable_order__c order1 = new Consumable_order__c();
- order1.Name = 'OCM_01_001';
- order1.Order_status__c = '鎵瑰噯';
- order1.Order_type__c = '璁㈠崟';
- order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- order1.IsShipment__c = true;
- insert order1;
+ @IsTest
+ static void test2(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Account myAccount2;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ myUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_Test;
+ System.runAs(MyUser_Test){
+ StaticParameter.ConsumableAssetHanderTrigger = true;
+ Consumable_order__c order1 = new Consumable_order__c();
+ order1.Name = 'OCM_01_001';
+ order1.Order_status__c = '鎵瑰噯';
+ order1.Order_type__c = '璁㈠崟';
+ order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ order1.IsShipment__c = true;
+ insert order1;
- Consumable_order__c olyorder = new Consumable_order__c();
- olyorder.Name = 'OCM_01_001';
- olyorder.Order_status__c = '鎵瑰噯';
- olyorder.Order_type__c = '璁㈠崟';
- olyorder.Dealer_Info__c = myAccount2.Id;
- olyorder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- olyorder.IsShipment__c = true;
- insert olyorder;
+ Consumable_order__c olyorder = new Consumable_order__c();
+ olyorder.Name = 'OCM_01_001';
+ olyorder.Order_status__c = '鎵瑰噯';
+ olyorder.Order_type__c = '璁㈠崟';
+ olyorder.Dealer_Info__c = myAccount2.Id;
+ olyorder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ olyorder.IsShipment__c = true;
+ insert olyorder;
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = olyorder.Id;
- Orderdet1.Consumable_Arrived_order__c = order1.Id;
- //Orderdet1.IsArrival__c = true;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '11111';
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = olyorder.Id;
- Orderdet2.Consumable_Arrived_order__c = order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222';
- insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
- LexArriveGsDetailsController.init(order1.Id);
- LexArriveGsDetailsController.proSale(
- JSON.serialize(LexArriveGsDetailsController.coc),
- 1,
- 1,
- order1.Id
- );
- }
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = olyorder.Id;
+ Orderdet1.Consumable_Arrived_order__c = order1.Id;
+ //Orderdet1.IsArrival__c = true;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '11111';
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = olyorder.Id;
+ Orderdet2.Consumable_Arrived_order__c = order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2};
+ LexArriveGsDetailsController.init(order1.Id);
+ LexArriveGsDetailsController.proSale(JSON.serialize(LexArriveGsDetailsController.coc), 1, 1, order1.Id);
+ }
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml b/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexCancelRemoveBoxController.cls b/force-app/main/default/classes/LexCancelRemoveBoxController.cls
index 9622088..69416e1 100644
--- a/force-app/main/default/classes/LexCancelRemoveBoxController.cls
+++ b/force-app/main/default/classes/LexCancelRemoveBoxController.cls
@@ -1,801 +1,624 @@
public with sharing class LexCancelRemoveBoxController {
- //缁忛攢鍟嗕骇鍝佸垎绫�
- public static String agencyProType { get; set; }
- public static String userPro_Typestr = null;
- public static String barcode { get; set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- public static List<ConsumableorderdetailsInfo> consumableInventory {
- get;
- set;
- }
- //閿欒鏄庣粏
- public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror {
- get;
- set;
- }
- //鎷嗙洅鏄庣粏
- public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy {
- get;
- set;
- }
- public static boolean saveFLGbln { get; set; }
- //閿欒淇℃伅
- public static String alertMessage { get; set; }
- //鎷嗙洅鏄庣粏浠舵暟
- public static Integer getinventorysize() {
- return ConsumableorderdetailsRecordsdummy.size();
- }
- public static Map<String, String> ExistIdMap = new Map<String, String>();
- public static Map<String, String> ErrorIdMap = new Map<String, String>();
- public static Map<String, String> AllMap = new Map<String, String>();
- public static List<String> BarCodeListP = new List<String>();
- //涓嶇鍚堢殑barcode鍜屽瀷鍙�
- public static list<String> notInlist = new List<String>();
- public static String baseUrl { get; private set; }
- private static String accountid = null;
- private static String accountName = null;
- //public String[] proidList =new String[]{};
- // 鐧诲綍鑰呭伐浣滃湴
- private static String userWorkLocation;
-
- public LexCancelRemoveBoxController() {
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
- consumableInventory = new List<ConsumableorderdetailsInfo>();
- saveFLGbln = false;
- }
-
- @AuraEnabled
- public static ResponseBodyLWC init() {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- String userId = UserInfo.getUserId();
- List<user> Useracc = new List<user>();
- Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc[0].accountid;
- userWorkLocation = Useracc[0].Work_Location__c;
- agencyProType = Useracc[0].UserPro_Type__c;
- if (String.isBlank(Useracc[0].UserPro_Type__c)) {
- agencyProType = 'ET';
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType {get;set;}
+ public static String userPro_Typestr = null;
+ public static String barcode { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
+ //閿欒鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
+ //鎷嗙洅鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+ public static boolean saveFLGbln {get;set;}
+ //閿欒淇℃伅
+ public static String alertMessage {set;get;}
+ //鎷嗙洅鏄庣粏浠舵暟
+ public static Integer getinventorysize(){
+ return ConsumableorderdetailsRecordsdummy.size();
}
- userPro_Typestr = '%' + agencyProType + '%';
- List<account> accountInfo = [
- SELECT Name
- FROM account
- WHERE id = :accountid
- ];
- //String view_product = accountInfo[0].view_product__c;
- accountName = accountInfo[0].Name;
- //proidList = view_product.split(',');
- data.put('accountName', accountName);
- data.put('userWorkLocation', userWorkLocation);
- data.put('agencyProType', agencyProType);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
+ public static Map<String, String> ExistIdMap = new Map<String, String>();
+ public static Map<String, String> ErrorIdMap = new Map<String, String>();
+ public static Map<String, String> AllMap = new Map<String, String>();
+ public static List<String> BarCodeListP = new List<String>();
+ //涓嶇鍚堢殑barcode鍜屽瀷鍙�
+ public static list<String> notInlist = new list<String>();
+ public static String baseUrl {get;private set;}
+ private static String accountid = null;
+ private static String accountName = null;
+ //public String[] proidList =new String[]{};
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
- // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
- public static List<String> ParseBarCode(String Code) {
- String[] Cache = new List<String>{};
- Cache = Code.split('\n');
- Set<String> Buff = new Set<String>();
- for (String A : Cache) {
- Buff.add(A);
- }
- List<String> outPut = new List<String>();
- for (String B : Buff) {
- B = B.trim();
- outPut.add(B);
- }
- return outPut;
- }
-
- //鑾峰彇鏄庣粏
- @AuraEnabled
- public static ResponseBodyLWC searchConsumableorderdetails(
- String barcode,
- String accountName,
- String userWorkLocation,
- String agencyProType
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- userPro_Typestr = '%' + agencyProType + '%';
- barcode = barcode;
- accountName = accountName;
- userWorkLocation = userWorkLocation;
-
- ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
-
- notInlist = new List<String>();
- BarCodeListP = ParseBarCode(barcode);
- Consumable_order_details2__c p = new Consumable_order_details2__c();
- List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
- saveFLGbln = false;
- alertMessage = '';
-
- //鍒ゆ柇barcode鏄惁涓虹┖
- if (barcode == null || barcode == '') {
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏arCode鍙�', '');
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
- // return;
+ public LexCancelRemoveBoxController(){
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ saveFLGbln = FALSE;
}
- // ExistIdMap.clear();
- // ErrorIdMap.clear();
- // notInlist.clear();
- // ConsumableorderdetailsRecordserror.clear();
- // ConsumableorderdetailsRecordsdummy.clear();
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- // 浜у搧绫诲瀷涓嶅悓
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Product_Type__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Arrive_Owner_Work_Location__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND (NOT Product_Type__c LIKE :userPro_Typestr)
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '璇ュ晢鍝佺被鍨�' +
- reSet1[i].Product_Type__c +
- '涓庝骇鍝佺被鍨�' +
- agencyProType +
- '涓嶇,涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ String userId = UserInfo.getUserId();
+ List<user> Useracc = New List<user>();
+ Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ if(String.isBlank(Useracc[0].UserPro_Type__c)){
+ agencyProType = 'ET';
}
- }
+ userPro_Typestr = '%' + agencyProType + '%';
+ List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
+ //String view_product = accountInfo[0].view_product__c;
+ accountName = accountInfo[0].Name;
+ //proidList = view_product.split(',');
+ data.put('accountName',accountName);
+ data.put('userWorkLocation',userWorkLocation);
+ data.put('agencyProType',agencyProType);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+
}
- //娌℃湁鎷嗙洅
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '鐩�'
- //AND ProductPacking_list_manual__c > 1
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ]; //娌″嚭搴擄紝娌¢攢鍞紝鍦ㄥ簱锛屾病鏈夋媶鐩�
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佹病鏈夋媶鐩�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ public static List<String> ParseBarCode(String Code){
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ Set <String> Buff = new Set<String>();
+ for(String A : Cache){
+ Buff.add(A);
}
- }
- }
-
- //宸插嚭璐э紝鏈埌璐�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = FALSE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '鐩�'
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佽繕鏈埌璐�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ List<String> outPut = new List<String>();
+ for(String B :Buff){
+ B = B.trim();
+ outPut.add(B);
}
- }
+ return outPut;
}
- //鎷嗙洅宸插嚭璐�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Shipment__c = TRUE
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸瓨鍦ㄥ嚭璐у饱鍘�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ //鑾峰彇鏄庣粏
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+ userPro_Typestr = '%' + agencyProType + '%';
+ barcode = barcode;
+ accountName = accountName;
+ userWorkLocation = userWorkLocation;
+
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+
+
+
+ notInlist = new list<String>();
+ BarCodeListP = ParseBarCode(barcode);
+ Consumable_order_details2__c p = new Consumable_order_details2__c();
+ List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+ saveFLGbln = FALSE;
+ alertMessage='';
+
+ //鍒ゆ柇barcode鏄惁涓虹┖
+ if(barcode == null || barcode ==''){
+ return new ResponseBodyLWC('Error',500, '璇疯緭鍏arCode鍙�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+ // return;
}
- }
- }
- //鎷嗙洅宸查攢鍞�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Saled__c = TRUE
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸瓨鍦ㄩ攢鍞饱鍘�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ // ExistIdMap.clear();
+ // ErrorIdMap.clear();
+ // notInlist.clear();
+ // ConsumableorderdetailsRecordserror.clear();
+ // ConsumableorderdetailsRecordsdummy.clear();
+
+ // 浜у搧绫诲瀷涓嶅悓
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,Product_Type__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = : userWorkLocation
+ AND (not Product_Type__c like : userPro_Typestr)
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佺被鍨�'+ reSet1[i].Product_Type__c +'涓庝骇鍝佺被鍨�'+ agencyProType +'涓嶇,涓嶈兘鎷嗙洅';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- }
- //鎷嗙洅杩斿搧
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Returned__c = TRUE
- AND Return_date__c != NULL
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸瓨鍦ㄨ繑鍝佸饱鍘�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ //娌℃湁鎷嗙洅
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c= false
+ AND Dealer_Saled__c = false
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '鐩�'
+ //AND ProductPacking_list_manual__c > 1
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ]; //娌″嚭搴擄紝娌¢攢鍞紝鍦ㄥ簱锛屾病鏈夋媶鐩�
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佹病鏈夋媶鐩�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- }
- //鎷嗙洅鍚庣洏鐐硅繃(鐩樼偣鏃ユ湡涓嶄负绌�)
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Inventory_date__c != NULL
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸瓨鍦ㄧ洏鐐瑰饱鍘�';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ //宸插嚭璐э紝鏈埌璐�
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c= FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '鐩�'
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佽繕鏈埌璐�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- }
- //涓嶅悓宸ヤ綔鍦�
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Arrive_Owner_Work_Location__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str =
- '璇ュ晢鍝佸睘浜�' +
- reSet1[i].Arrive_Owner_Work_Location__c +
- ',涓嶈兘鍙栨秷鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ //鎷嗙洅宸插嚭璐�
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Shipment__c = true
+ AND Dealer_Arrive__c = true
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄥ嚭璐у饱鍘�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- }
- reSet = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Dealer_Arrive__c,
- Guarantee_period_for_products__c,
- CFDA_Status__c,
- ProductPacking_list_manual__c,
- Report_Product_Approbation__c,
- Report_Product_Expiration__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND Bar_Code__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Product_Type__c LIKE :userPro_Typestr
- ];
- if (reSet.size() > 0) {
- for (Integer i = 0; i < reSet.size(); i++) {
- if (ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
- // 璺宠繃閿欒鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else if (ExistIdMap.containsKey(reSet[i].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- ConsumableorderdetailsRecordsdummy.add(
- new ConsumableorderdetailsInfo(reSet[i])
- );
- ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
+ //鎷嗙洅宸查攢鍞�
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Saled__c = true
+ AND Dealer_Arrive__c = true
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄩ攢鍞饱鍘�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- }
- }
- AllMap.putAll(ExistIdMap);
-
- //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
- for (Integer i = 0; i < BarCodeListP.size(); i++) {
- if (ExistIdMap.containsKey(BarCodeListP[i])) {
- continue;
- } else if (ErrorIdMap.containsKey(BarCodeListP[i])) {
- continue;
- } else {
- notInlist.add(BarCodeListP[i]);
- }
- }
- if (notInlist.size() > 0) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '涓嶅瓨鍦ㄣ��'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- 'BarCode' + notInlist + '涓嶅瓨鍦ㄣ��',
- ''
- );
- }
- data.put(
- 'ConsumableorderdetailsRecordsdummy',
- JSON.serialize(ConsumableorderdetailsRecordsdummy)
- );
- data.put(
- 'ConsumableorderdetailsRecordserror',
- JSON.serialize(ConsumableorderdetailsRecordserror)
- );
- data.put('dataSize', ConsumableorderdetailsRecordsdummy.size());
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- //鍙栨秷鎷嗙洅纭
- @AuraEnabled
- public static ResponseBodyLWC cancelRemoveBoxConfirm(
- String saveConsumableorderdetailsRecordsdummy,
- String accountName,
- String userWorkLocation,
- String agencyProType
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- userPro_Typestr = '%' + agencyProType + '%';
- accountName = accountName;
- userWorkLocation = userWorkLocation;
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- saveConsumableorderdetailsRecordsdummy,
- List<ConsumableorderdetailsInfo>.class
- );
-
- List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
-
- Savepoint sp = Database.setSavepoint();
- if (ConsumableorderdetailsRecordsdummy.size() < 1) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�'));
- return new ResponseBodyLWC('Error', 500, '涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�', '');
- // return null;
- }
-
- List<String> BarCodeList = new List<String>();
- for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
- BarCodeList.add(tmp.esd.Bar_Code__c);
- }
-
- try {
- //鍙栧緱閫氱暘澶т簬001鐨勫湪搴撴槑缁�
- List<Consumable_order_details2__c> orderDetails2del = [
- SELECT
- Id,
- Box_Piece__c,
- RemoveBox_date__c,
- RemoveBox_No__c,
- Bar_Code__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND RemoveBox_No__c > 1
- AND Bar_Code__c IN :BarCodeList
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Product_Type__c LIKE :userPro_Typestr
- ];
-
- List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> orderlistupd = new List<Consumable_order_details2__c>();
-
- for (Consumable_order_details2__c detail2tmp : orderDetails2del) {
- Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
- delDetails2.Id = detail2tmp.Id;
-
- //鍒犻櫎閫氱暘澶т簬001鐨勬槑缁�2
- //delete delDetails2;
- orderlistdel.add(delDetails2);
- }
-
- //鍙栧緱閫氱暘001鐨勫湪搴撴槑缁�
- List<Consumable_order_details2__c> orderDetails2 = [
- SELECT
- Id,
- Box_Piece__c,
- RemoveBox_date__c,
- RemoveBox_No__c,
- Bar_Code__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c,
- /*,ContractNo__c*/
- //add by rebtx 2020-10-13 end
- // tcm start
- Consumable_order_minor__r.ContractNo__c
- // tcm end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Box_Piece__c = '涓�'
- AND RemoveBox_date__c != NULL
- AND RemoveBox_No__c = 1
- AND Bar_Code__c IN :BarCodeList
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Product_Type__c LIKE :userPro_Typestr
- ];
-
- for (Consumable_order_details2__c detail2tmp : orderDetails2) {
- Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c();
- updDetails2.Id = detail2tmp.Id;
- updDetails2.Box_Piece__c = '鐩�';
- updDetails2.RemoveBox_date__c = null;
- updDetails2.RemoveBox_No__c = null;
-
- // tcm start
- if (
- String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)
- ) {
- updDetails2.ContractNo_text__c = detail2tmp.ContractNo_text__c;
- } else {
- updDetails2.ContractNo_text__c = detail2tmp.Consumable_order_minor__r.ContractNo__c;
+ //鎷嗙洅杩斿搧
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Returned__c = true
+ AND Return_date__c != null
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄨ繑鍝佸饱鍘�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
}
- // updDetails2.ContractNo_text__c = detail2tmp.ContractNo__c;
- // tcm end
- //閫氱暘001銇儑銉笺偪銇鐞嗗崢浣嶃倰鐩掋伀鎴汇仐銆侀�氱暘銈掋偗銉偄
- //update updDetails2;
- orderlistupd.add(updDetails2);
- }
- if (orderlistdel.size() > 0) {
- delete orderlistdel;
- }
+ //鎷嗙洅鍚庣洏鐐硅繃(鐩樼偣鏃ユ湡涓嶄负绌�)
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Inventory_date__c != null
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄧ洏鐐瑰饱鍘�';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
- if (orderlistupd.size() > 0) {
- update orderlistupd;
- }
- saveFLGbln = true;
- alertMessage = '鍙栨秷鎷嗙洅瀹屾垚';
- data.put('saveFLGbln', saveFLGbln);
- res.status = 'Success';
- res.code = 200;
- res.msg = alertMessage;
- System.debug('res = ' + res);
- return res;
- // return null;
- } catch (Exception e) {
- Database.rollback(sp);
- ApexPages.addMessages(e);
- return null;
+ //涓嶅悓宸ヤ綔鍦�
+ reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Bar_Code__c,
+ Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
+ recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c !=: userWorkLocation
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸睘浜�' + reSet1[i].Arrive_Owner_Work_Location__c + ',涓嶈兘鍙栨秷鎷嗙洅';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ reSet = [SELECT Id,
+ Name,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Dealer_Arrive__c,
+ Guarantee_period_for_products__c,
+ CFDA_Status__c,
+ ProductPacking_list_manual__c,
+ Report_Product_Approbation__c,
+ Report_Product_Expiration__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND Bar_Code__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Product_Type__c like : userPro_Typestr
+ ];
+ if(reSet.size()>0){
+ for (Integer i = 0; i < reSet.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ // 璺宠繃閿欒鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else{
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ }
+ }
+ }
+
+ AllMap.putAll(ExistIdMap);
+
+ //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
+ for(Integer i = 0; i < BarCodeListP.size(); i++){
+ if(ExistIdMap.containsKey(BarCodeListP[i])){
+ continue;
+ }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
+ continue;
+ }else{
+ notInlist.add(BarCodeListP[i]);
+ }
+ }
+ if(notInlist.size()>0){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '涓嶅瓨鍦ㄣ��'));
+ return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '涓嶅瓨鍦ㄣ��', '');
+ }
+ data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
+ data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror));
+ data.put('dataSize',ConsumableorderdetailsRecordsdummy.size());
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+
}
- }
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
- public Consumable_order_details2__c esd { get; set; }
- public Product2__c Prod { get; set; }
- //public String ProductName { get; set; }
- //public Boolean canSELECT { get; set; }
- //public String barCodeNo { get; set; }
- //public Date sterilizationlimitDate { get; set; }
- //public String serialNoorLotNo { get; set; }
- //public String tracingCodeNo { get; set; }
- public String oldConsumableCount { get; set; }
- public String ErrorReason { get; set; }
- public ConsumableorderdetailsInfo(
- Consumable_order_details2__c e,
- string str
- ) {
- esd = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.name;
- ErrorReason = str;
+ //鍙栨秷鎷嗙洅纭
+ @AuraEnabled
+ public static ResponseBodyLWC cancelRemoveBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+
+ userPro_Typestr = '%' + agencyProType + '%';
+ accountName = accountName;
+ userWorkLocation =userWorkLocation;
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class);
+
+
+ List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
+
+ Savepoint sp = Database.setSavepoint();
+ if(ConsumableorderdetailsRecordsdummy.size()<1){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�'));
+ return new ResponseBodyLWC('Error',500, '涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�', '');
+ // return null;
+ }
+
+ List<String> BarCodeList = new List<String>();
+ for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
+ BarCodeList.add(tmp.esd.Bar_Code__c);
+ }
+
+ try{
+ //鍙栧緱閫氱暘澶т簬001鐨勫湪搴撴槑缁�
+ List<Consumable_order_details2__c> orderDetails2del = [SELECT
+ Id,
+ Box_Piece__c,
+ RemoveBox_date__c,
+ RemoveBox_No__c,
+ Bar_Code__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ AND RemoveBox_No__c > 1
+ AND Bar_Code__c in :BarCodeList
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Product_Type__c like : userPro_Typestr
+ ];
+
+ List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> orderlistupd= new List<Consumable_order_details2__c>();
+
+ for (Consumable_order_details2__c detail2tmp : orderDetails2del) {
+ Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
+ delDetails2.Id = detail2tmp.Id;
+
+ //鍒犻櫎閫氱暘澶т簬001鐨勬槑缁�2
+ //delete delDetails2;
+ orderlistdel.add(delDetails2);
+ }
+
+ //鍙栧緱閫氱暘001鐨勫湪搴撴槑缁�
+ List<Consumable_order_details2__c> orderDetails2 = [SELECT
+ Id,
+ Box_Piece__c,
+ RemoveBox_date__c,
+ RemoveBox_No__c,
+ Bar_Code__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rebtx 2020-10-13 end
+ // tcm start
+ ,Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c !=null
+ AND RemoveBox_No__c = 1
+ AND Bar_Code__c in :BarCodeList
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Product_Type__c like : userPro_Typestr
+ ];
+
+ for (Consumable_order_details2__c detail2tmp : orderDetails2) {
+ Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c();
+ updDetails2.Id = detail2tmp.Id;
+ updDetails2.Box_Piece__c = '鐩�';
+ updDetails2.RemoveBox_date__c = null;
+ updDetails2.RemoveBox_No__c = null;
+
+ // tcm start
+ if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) {
+ updDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c;
+ }else {
+ updDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c;
+ }
+ // updDetails2.ContractNo_text__c = detail2tmp.ContractNo__c;
+ // tcm end
+
+ //閫氱暘001銇儑銉笺偪銇鐞嗗崢浣嶃倰鐩掋伀鎴汇仐銆侀�氱暘銈掋偗銉偄
+ //update updDetails2;
+ orderlistupd.add(updDetails2);
+ }
+
+ if(orderlistdel.size()>0){
+ delete orderlistdel;
+ }
+
+ if(orderlistupd.size()>0){
+ update orderlistupd;
+ }
+ saveFLGbln = true;
+ alertMessage = '鍙栨秷鎷嗙洅瀹屾垚';
+ data.put('saveFLGbln',saveFLGbln);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = alertMessage;
+ System.debug('res = ' + res);
+ return res;
+ // return null;
+ }catch(Exception e){
+ Database.rollback(sp);
+ ApexPages.addMessages(e);
+ return null;
+ }
}
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- esd = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.name;
- }
- /*
+
+
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ public Consumable_order_details2__c esd { get; set; }
+ public Product2__c Prod { get; set; }
+ //public String ProductName { get; set; }
+ //public Boolean canSELECT { get; set; }
+ //public String barCodeNo { get; set; }
+ //public Date sterilizationlimitDate { get; set; }
+ //public String serialNoorLotNo { get; set; }
+ //public String tracingCodeNo { get; set; }
+ public String oldConsumableCount { get; set; }
+ public String ErrorReason { get; set; }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ }
+/*
public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
esd = new Consumable_order_details2__c();
ProductName = e.Name__c;
@@ -816,9 +639,9 @@
tracingCodeNo = tracingCode;
}
*/
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- return null;
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls b/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls
index 264f21b..e9f7dad 100644
--- a/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls
+++ b/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls
@@ -1,953 +1,573 @@
@IsTest
private class LexCancelRemoveBoxControllerTest {
- static testMethod void testMethod1() {
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
+ static testMethod void testMethod1(){
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert MyUser_Test;
+ }
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Packing_list_manual__c = 5,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Packing_list_manual__c = 5,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2,pro3};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
+ //daoku
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001001';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = false;
+ Orderdet2.Return_date__c= null;
+ Orderdet2.Send_Date__c= null;
+ Orderdet2.Box_Piece__c = '鐩�';
+ conList.add(Orderdet2);
+ // insert Orderdet2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert MyUser_Test;
+ //chuku
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001002';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro2.Id;
+ Orderdet3.Asset_Model_No__c = 'Test02';
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Send_Date__c = Date.today();
+ Orderdet3.Box_Piece__c = '涓�';
+ Orderdet3.RemoveBox_date__c= Date.today();
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet3.Used_date__c = null;
+ Orderdet3.Lose_Flag__c = false;
+ Orderdet3.Return_date__c= null;
+ conList.add(Orderdet3);
+ // insert Orderdet3;
+
+
+
+ //sale
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro2.Id;
+ Orderdet4.Asset_Model_No__c = 'Test02';
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '涓�';
+ Orderdet4.RemoveBox_date__c= Date.today();
+ Orderdet4.Bar_Code__c = '011495317020843711170400172003311074K250CXSDS';
+ Orderdet4.Lose_Flag__c = false;
+ Orderdet4.Return_date__c= null;
+ Orderdet4.Used_date__c= Date.today();
+ // insert Orderdet4;
+ conList.add(Orderdet4);
+
+
+ //ProductPacking_list_manual__c=1
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001004';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro3.Id;
+ Orderdet5.Asset_Model_No__c = 'Test03';
+ Orderdet5.Arrive_date__c = Date.today();
+ //Orderdet5.Used_date__c = Date.today();
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.RemoveBox_date__c= Date.today();
+ Orderdet5.Used_date__c = null;
+ Orderdet5.Lose_Flag__c = false;
+ Orderdet5.Return_date__c= null;
+ Orderdet5.Send_Date__c=null;
+ Orderdet5.Bar_Code__c = '010495317014059411170400172203311074K250DCWQW';
+ // insert Orderdet5;
+ conList.add(Orderdet5);
+
+ //pandian
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001004';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro2.Id;
+ Orderdet7.Asset_Model_No__c = 'Test02';
+ Orderdet7.Box_Piece__c = '鐩�';
+ Orderdet7.Lose_Flag__c = false;
+ Orderdet7.Bar_Code__c = '010495317014059411170400172203311074K250DBVUD';
+ Orderdet7.RemoveBox_date__c= Date.today();
+ Orderdet7.Inventory_date__c= Date.today();
+ // insert Orderdet7;
+ conList.add(Orderdet7);
+
+ Consumable_order_details2__c Orderdet8= new Consumable_order_details2__c();
+ Orderdet8.Name = 'OCM_01_001004';
+ Orderdet8.Consumable_order_minor__c = Order1.Id;
+ Orderdet8.Consumable_Product__c = pro2.Id;
+ Orderdet8.Asset_Model_No__c = 'Test02';
+ Orderdet8.Arrive_date__c = Date.today();
+ Orderdet8.Box_Piece__c = '涓�';
+ Orderdet8.Lose_Flag__c = false;
+ Orderdet8.Bar_Code__c = '1683272847250250WZIOF';
+ Orderdet8.Used_date__c = null;
+ Orderdet8.Lose_Flag__c = false;
+ Orderdet8.Return_date__c= null;
+ Orderdet8.RemoveBox_date__c=Date.today();
+ Orderdet8.Send_Date__c=null;
+ Orderdet8.RemoveBox_No__c =3;
+ conList.add(Orderdet8);
+ insert conList;
+ // insert Orderdet8;
+
+
+ System.Test.startTest();
+ LexCancelRemoveBoxController.init();
+ // LexCancelRemoveBoxController.getinventorysize();
+ LexCancelRemoveBoxController.searchConsumableorderdetails('1683272847250250WZIOF','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�','娣卞湷','ENG');
+ LexCancelRemoveBoxController.searchConsumableorderdetails('','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�','娣卞湷','ENG');
+ LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList),'鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�','娣卞湷','ENG');
+
+ System.Test.stopTest();
+
+ }
+
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 5,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 5,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ static testMethod void testMethod2(){
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c ='閲嶅簡');
+ insert MyUser_Test;
+ }
+ System.runAs(MyUser_Test){
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Consumable_Arrived_order__c = Order1.Id;
+ con.Send_Date__c = null;
+ con.Used_date__c = null;
+ con.Return_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Box_Piece__c = '涓�';
+ con.RemoveBox_date__c = Date.today();
+ con.Arrive_date__c = Date.today();
+ con.RemoveBox_No__c = 2;
+ con.Bar_Code__c = '1682414917514250XSCYW';
+ conList.add(con);
- //daoku
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001001';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Return_date__c = null;
- Orderdet2.Send_Date__c = null;
- Orderdet2.Box_Piece__c = '鐩�';
- conList.add(Orderdet2);
- // insert Orderdet2;
-
- //chuku
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001002';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro2.Id;
- Orderdet3.Asset_Model_No__c = 'Test02';
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Send_Date__c = Date.today();
- Orderdet3.Box_Piece__c = '涓�';
- Orderdet3.RemoveBox_date__c = Date.today();
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet3.Used_date__c = null;
- Orderdet3.Lose_Flag__c = false;
- Orderdet3.Return_date__c = null;
- conList.add(Orderdet3);
- // insert Orderdet3;
-
- //sale
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro2.Id;
- Orderdet4.Asset_Model_No__c = 'Test02';
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.RemoveBox_date__c = Date.today();
- Orderdet4.Bar_Code__c = '011495317020843711170400172003311074K250CXSDS';
- Orderdet4.Lose_Flag__c = false;
- Orderdet4.Return_date__c = null;
- Orderdet4.Used_date__c = Date.today();
- // insert Orderdet4;
- conList.add(Orderdet4);
-
- //ProductPacking_list_manual__c=1
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001004';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro3.Id;
- Orderdet5.Asset_Model_No__c = 'Test03';
- Orderdet5.Arrive_date__c = Date.today();
- //Orderdet5.Used_date__c = Date.today();
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.RemoveBox_date__c = Date.today();
- Orderdet5.Used_date__c = null;
- Orderdet5.Lose_Flag__c = false;
- Orderdet5.Return_date__c = null;
- Orderdet5.Send_Date__c = null;
- Orderdet5.Bar_Code__c = '010495317014059411170400172203311074K250DCWQW';
- // insert Orderdet5;
- conList.add(Orderdet5);
-
- //pandian
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001004';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro2.Id;
- Orderdet7.Asset_Model_No__c = 'Test02';
- Orderdet7.Box_Piece__c = '鐩�';
- Orderdet7.Lose_Flag__c = false;
- Orderdet7.Bar_Code__c = '010495317014059411170400172203311074K250DBVUD';
- Orderdet7.RemoveBox_date__c = Date.today();
- Orderdet7.Inventory_date__c = Date.today();
- // insert Orderdet7;
- conList.add(Orderdet7);
-
- Consumable_order_details2__c Orderdet8 = new Consumable_order_details2__c();
- Orderdet8.Name = 'OCM_01_001004';
- Orderdet8.Consumable_order_minor__c = Order1.Id;
- Orderdet8.Consumable_Product__c = pro2.Id;
- Orderdet8.Asset_Model_No__c = 'Test02';
- Orderdet8.Arrive_date__c = Date.today();
- Orderdet8.Box_Piece__c = '涓�';
- Orderdet8.Lose_Flag__c = false;
- Orderdet8.Bar_Code__c = '1683272847250250WZIOF';
- Orderdet8.Used_date__c = null;
- Orderdet8.Lose_Flag__c = false;
- Orderdet8.Return_date__c = null;
- Orderdet8.RemoveBox_date__c = Date.today();
- Orderdet8.Send_Date__c = null;
- Orderdet8.RemoveBox_No__c = 3;
- conList.add(Orderdet8);
- insert conList;
- // insert Orderdet8;
-
- System.Test.startTest();
- LexCancelRemoveBoxController.init();
- // LexCancelRemoveBoxController.getinventorysize();
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '1683272847250250WZIOF',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�',
- '娣卞湷',
- 'ENG'
- );
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�',
- '娣卞湷',
- 'ENG'
- );
- LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
- JSON.serialize(conList),
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�',
- '娣卞湷',
- 'ENG'
- );
-
- System.Test.stopTest();
- }
-
- }
- static testMethod void testMethod2() {
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
-
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ET';
- insert Order1;
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Consumable_Arrived_order__c = Order1.Id;
- con.Send_Date__c = null;
- con.Used_date__c = null;
- con.Return_date__c = null;
- con.Lose_Flag__c = false;
- con.Box_Piece__c = '涓�';
- con.RemoveBox_date__c = Date.today();
- con.Arrive_date__c = Date.today();
- con.RemoveBox_No__c = 2;
- con.Bar_Code__c = '1682414917514250XSCYW';
- conList.add(con);
-
- Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- con1.Consumable_Arrived_order__c = Order1.Id;
- con1.Send_Date__c = null;
- con1.Used_date__c = null;
- con1.Return_date__c = null;
- con1.Lose_Flag__c = false;
- con1.Box_Piece__c = '涓�';
- con1.RemoveBox_date__c = Date.today();
- con1.Arrive_date__c = Date.today();
- con.RemoveBox_No__c = 1;
- con1.Bar_Code__c = '1682414917514250XSCYW';
- conList.add(con1);
- insert (conList);
- System.debug('conList' + conList);
- System.Test.startTest();
- LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
- JSON.serialize(conList),
- 'Testaccount002',
- '閲嶅簡',
- 'ET'
- );
- LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
- JSON.serialize(conList1),
- 'Testaccount002',
- '閲嶅簡',
- 'ET'
- );
- System.Test.stopTest();
- }
- }
- static testMethod void testMethod3() {
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- User myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount003',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '2'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'wan@salesforce.com',
- firstname = 'wan',
- lastname = 'Plumbers',
- accountid = myAccount2.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- System.debug('MyUser_Test' + MyUser_Test);
- }
- System.runAs(MyUser_Test) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test01',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test02',
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test03',
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 2,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test04',
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test05',
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test06',
- ProductCode = 'Test06',
- Asset_Model_No__c = 'Test06',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test06',
- Manual_Entry__c = false
- );
- insert new List<Product2>{
- prod01,
- prod02,
- prod03,
- prod04,
- prod05,
- prod06
- };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod03.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod04.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod05.Id
- );
- Product2__c pro6 = new Product2__c(
- Name = 'Pro006',
- OT_CODE_Text__c = 'Test006',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ENG';
- insert Order1;
- //鍑鸿揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = '012100000006Jx9AAE';
- Order2.Order_ProType__c = 'ENG';
- insert Order2;
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> conList2 = new List<Consumable_order_details2__c>();
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Name = 'OCM_01_001001';
- con.Consumable_order_minor__c = Order1.Id;
- con.Consumable_Product__c = pro2.Id;
- con.Asset_Model_No__c = 'Test01';
- con.Arrive_date__c = Date.today();
- con.Bar_Code__c = '10061';
- con.Used_date__c = null;
- con.Lose_Flag__c = false;
- con.Return_date__c = null;
- con.Send_Date__c = null;
- con.Box_Piece__c = '鐩�';
- conList.add(con);
- insert conList;
-
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- con1.Consumable_Product__c = pro2.Id;
- con1.Consumable_order_minor__c = Order1.Id;
- con1.Bar_Code__c = '10011';
- con1.Arrive_date__c = Date.today();
- conList1.add(con1);
- //娌℃湁鎷嗙洅
- Consumable_order_details2__c con2 = new Consumable_order_details2__c();
- con2.Send_Date__c = null;
- con2.Used_date__c = null;
- con2.Lose_Flag__c = false;
- con2.Box_Piece__c = '鐩�';
- con2.Consumable_Product__c = pro2.Id;
- con2.Consumable_order_minor__c = Order1.Id;
- con2.Bar_Code__c = '10021';
- con2.Arrive_date__c = Date.today();
- con2.RemoveBox_date__c = null;
- conList1.add(con2);
- insert conList1;
-
- //宸插嚭璐� 鏈埌璐�
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = null;
- con3.Send_Date__c = null;
- con3.Used_date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Box_Piece__c = '鐩�';
- con3.Consumable_Arrived_order__c = Order2.Id;
- con3.Consumable_Product__c = pro2.Id;
- con3.Bar_Code__c = '10031';
- conList2.add(con3);
- //鎷嗙洅宸插嚭璐�
- Consumable_order_details2__c con4 = new Consumable_order_details2__c();
- con4.Arrive_date__c = Date.today();
- con4.Send_Date__c = Date.today();
- con4.Return_date__c = null;
- con4.Used_date__c = null;
- con4.Lose_Flag__c = false;
- con4.Box_Piece__c = '涓�';
- con4.RemoveBox_date__c = Date.today();
- con4.Consumable_Arrived_order__c = Order2.Id;
- con4.Consumable_Product__c = pro2.Id;
- con4.Bar_Code__c = '10041';
- conList2.add(con4);
- insert conList2;
-
- System.Test.startTest();
- LexCancelRemoveBoxController.barcode = '1004\n1003\n1002\n1001';
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '10061\n10051\n10041\n10031\n10021\n10011',
- 'Testaccount003',
- '閲嶅簡',
- 'ET'
- );
- String str = '璇ュ晢鍝佸瓨鍦ㄧ洏鐐瑰饱鍘�';
- String errorReason = '';
- LexCancelRemoveBoxController.ConsumableorderdetailsInfo c2 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(
- con,
- str
- );
- c2.esd = con;
- c2.Prod = con.Consumable_product__r;
- c2.oldConsumableCount = con.name;
- c2.ErrorReason = str;
- LexCancelRemoveBoxController.ConsumableorderdetailsInfo c1 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(
- con2
- );
- c1.esd = con;
- c1.Prod = con.Consumable_product__r;
- c1.oldConsumableCount = con.name;
- c1.compareTo(c2);
- System.Test.stopTest();
- }
- }
- static testMethod void testMethod4() {
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- User myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount003',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '2'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'wan@salesforce.com',
- firstname = 'wan',
- lastname = 'Plumbers',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newWang',
- Email = 'newWang@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUserWang',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUserWang@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
- System.debug('MyUser_Test' + MyUser_Test);
- }
- System.runAs(MyUser_Test) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test01',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test02',
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test03',
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 2,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test04',
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test05',
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test06',
- ProductCode = 'Test06',
- Asset_Model_No__c = 'Test06',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'test06',
- Manual_Entry__c = false
- );
- insert new List<Product2>{
- prod01,
- prod02,
- prod03,
- prod04,
- prod05,
- prod06
- };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod03.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod04.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod05.Id
- );
- Product2__c pro6 = new Product2__c(
- Name = 'Pro006',
- OT_CODE_Text__c = 'Test006',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //閿�鍞�
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '閿�鍞�';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = '01210000000c9duAAA';
- Order1.Order_ProType__c = 'ENG';
- orderList.add(Order1);
- //杩斿搧
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '杩斿搧';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = '012100000006Jx4AAE';
- Order2.Order_ProType__c = 'ENG';
- orderList.add(Order2);
- //鐩樼偣
- Consumable_order__c Order3 = new Consumable_order__c();
- Order3.Name = 'OCM_01';
- Order3.Order_status__c = '鎵瑰噯';
- Order3.Order_type__c = '鐩樼偣';
- Order3.Dealer_Info__c = myAccount2.Id;
- Order3.RecordTypeid = '01210000000c9dsAAA';
- Order3.Order_ProType__c = 'ENG';
- orderList.add(Order3);
- //鍙戣揣
- Consumable_order__c Order4 = new Consumable_order__c();
- Order4.Name = 'OCM_0122';
- Order4.Order_status__c = '鎵瑰噯';
- Order4.Order_type__c = '璁㈠崟';
- Order4.Dealer_Info__c = myAccount2.Id;
- Order4.RecordTypeid = '01210000000c9drAAA';
- Order4.Order_ProType__c = 'ET';
- Order4.ContractNo__c = '';
- orderList.add(Order4);
- insert orderList;
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> conList2 = new List<Consumable_order_details2__c>();
- //鎷嗙洅宸查攢鍞�
- Consumable_order_details2__c con4 = new Consumable_order_details2__c();
- con4.Arrive_date__c = Date.today();
- con4.Deliver_date__c = Date.today();
- con4.Sterilization_limit__c = Date.today();
- con4.Send_Date__c = null;
- con4.Return_date__c = null;
- con4.Used_date__c = Date.today();
- con4.Lose_Flag__c = false;
- con4.Box_Piece__c = '涓�';
- con4.RemoveBox_date__c = Date.today();
- con4.RecordTypeId = '01210000000kUDKAA2';
- con4.Consumable_Product__c = pro2.Id;
- con4.Bar_Code__c = '100611';
- conList.add(con4);
- insert conList;
-
- //鎷嗙洅杩斿搧
- Consumable_order_details2__c con5 = new Consumable_order_details2__c();
- con5.Arrive_date__c = Date.today();
- con5.Return_date__c = Date.today();
- con5.Deliver_date__c = Date.today();
- con5.Send_Date__c = null;
- con5.Sterilization_limit__c = Date.today();
- con5.Used_date__c = Date.today();
- con5.Box_Piece__c = '涓�';
- con5.RemoveBox_date__c = Date.today();
- con5.RecordTypeId = '01210000000kUDPAA2';
- con5.Consumable_Product__c = pro2.Id;
- con5.Consumable_order_minor__c = Order4.Id;
- con5.Bar_Code__c = '10061';
- conList1.add(con5);
- insert conList1;
-
- //鎷嗙洅鍚庣洏鐐硅繃
- Consumable_order_details2__c con6 = new Consumable_order_details2__c();
- con6.Inventory_date__c = Date.today();
- con6.Box_Piece__c = '涓�';
- con6.RemoveBox_date__c = Date.today();
- con6.Send_Date__c = null;
- con6.Deliver_date__c = Date.today();
- con6.Sterilization_limit__c = Date.today();
- con6.RecordTypeId = '01210000000kUDKAA2';
- con6.Consumable_Arrived_order__c = Order3.Id;
- con6.Consumable_Product__c = pro2.Id;
- con6.Bar_Code__c = '10078';
- conList2.add(con6);
- insert conList2;
-
- List<Consumable_order_details2__c> conList3 = new List<Consumable_order_details2__c>();
- //鎷嗙洅宸插嚭璐�
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = Date.today();
- con3.Return_date__c = null;
- con3.Used_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Box_Piece__c = '涓�';
- con3.Deliver_date__c = Date.today();
- con3.RemoveBox_date__c = Date.today();
- con3.RecordTypeId = '01210000000kUDKAA2';
- con3.Consumable_Product__c = pro2.Id;
- con3.Consumable_order_minor__c = Order4.Id;
- con3.Bar_Code__c = '100999';
- con3.Sterilization_limit__c = Date.today();
- conList3.add(con3);
- insert conList3;
-
- //reset
- // Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- // con1.Intra_Trade_List_RMB__c = 1000;
- // con1.Asset_Model_No__c = 'test';
- // con1.Sterilization_limit__c = Date.today();
- // con1.Deliver_date__c = Date.today();
- // con1.Arrive_date__c = Date.today();
- // con1.Send_Date__c = null;
- // con1.Used_date__c = null;
- // con1.Return_date__c = null;
- // con1.Lose_Flag__c = false;
- // con1.Box_Piece__c = '涓�';
-
- // con1.Consumable_order_minor__c = Order4.Id;
- // con1.Guarantee_period_for_products__c = Date.today();
- // con1.Consumable_Product__c = pro2.Id;
- // con1.Bar_Code__c = '1009999';
- // conList2.add(con1);
- // insert conList2;
-
- // List<Consumable_order_details2__c> conList3 = new List<Consumable_order_details2__c> ();
- // Consumable_order_details2__c con9 = new Consumable_order_details2__c();
- // con9.RemoveBox_date__c = Date.today();
- // con9.Bar_Code__c = '100112';
- // con9.Arrive_date__c = Date.today();
- // con9.Send_Date__c = null;
- // con9.Used_date__c = null;
- // con9.Return_date__c = null;
- // con9.Lose_Flag__c = false;
- // con9.Box_Piece__c = '涓�';
- // con9.RemoveBox_No__c = 9;
- // conList3.add(con9);
- // LexCancelRemoveBoxController.searchConsumableorderdetails('100112','Testaccount003','閲嶅簡','ET');
-
- //orderDetails2
- // Consumable_order_details2__c con00 = new Consumable_order_details2__c();
- // con00.Box_Piece__c = '涓�';
- // con00.RemoveBox_date__c = Date.today();
- // con00.RemoveBox_No__c = 1;
- // con00.ContractNo_text__c = '';
- // con00.Consumable_order_minor__c = Order4.Id;
- // con00.Bar_Code__c = '10099999989';
- // conList3.add(con00);
-
- // insert conList3;
- System.Test.startTest();
- LexCancelRemoveBoxController CancelRemoveBoxController = new LexCancelRemoveBoxController();
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '100611\n10078\n10099\n1009999\n100999',
- 'Testaccount003',
- '閲嶅簡',
- 'ET'
- );
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011',
- 'Testaccount003',
- '鍖椾含',
- 'ET'
- );
- LexCancelRemoveBoxController.searchConsumableorderdetails(
- '100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011',
- 'Testaccount003',
- '閲嶅簡',
- 'ET'
- );
- System.Test.stopTest();
- }
- }
+ Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ con1.Consumable_Arrived_order__c = Order1.Id;
+ con1.Send_Date__c = null;
+ con1.Used_date__c = null;
+ con1.Return_date__c = null;
+ con1.Lose_Flag__c = false;
+ con1.Box_Piece__c = '涓�';
+ con1.RemoveBox_date__c = Date.today();
+ con1.Arrive_date__c = Date.today();
+ con.RemoveBox_No__c = 1;
+ con1.Bar_Code__c = '1682414917514250XSCYW';
+ conList.add(con1);
+ insert(conList);
+ System.debug('conList'+conList);
+ System.Test.startTest();
+ LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList),'Testaccount002','閲嶅簡','ET');
+ LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList1),'Testaccount002','閲嶅簡','ET');
+ System.Test.stopTest();
+ }
}
+ static testMethod void testMethod3(){
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ User myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
+ insert myAccount2;
+ Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert myUser_test;
+ System.debug('MyUser_Test'+MyUser_Test);
+ }
+ System.runAs(MyUser_Test){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test01',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test02',Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test03',Manual_Entry__c = false);
+ Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=2,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test04',Manual_Entry__c = false);
+ Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test05',Manual_Entry__c = false);
+ Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test06',Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
+ Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
+ Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
+ Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
+ insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ENG';
+ insert Order1;
+ //鍑鸿揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = '012100000006Jx9AAE';
+ Order2.Order_ProType__c = 'ENG';
+ insert Order2;
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c> ();
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ List<Consumable_order_details2__c> conList2 = new List<Consumable_order_details2__c> ();
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Name = 'OCM_01_001001';
+ con.Consumable_order_minor__c = Order1.Id;
+ con.Consumable_Product__c = pro2.Id;
+ con.Asset_Model_No__c = 'Test01';
+ con.Arrive_date__c = Date.today();
+ con.Bar_Code__c = '10061';
+ con.Used_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Return_date__c= null;
+ con.Send_Date__c= null;
+ con.Box_Piece__c = '鐩�';
+ conList.add(con);
+ insert conList;
+
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ con1.Consumable_Product__c = pro2.Id;
+ con1.Consumable_order_minor__c = Order1.Id;
+ con1.Bar_Code__c = '10011';
+ con1.Arrive_date__c = Date.today();
+ conList1.add(con1);
+ //娌℃湁鎷嗙洅
+ Consumable_order_details2__c con2 = new Consumable_order_details2__c();
+ con2.Send_Date__c =null;
+ con2.Used_date__c = null;
+ con2.Lose_Flag__c = false;
+ con2.Box_Piece__c = '鐩�';
+ con2.Consumable_Product__c = pro2.Id;
+ con2.Consumable_order_minor__c = Order1.Id;
+ con2.Bar_Code__c = '10021';
+ con2.Arrive_date__c = Date.today();
+ con2.RemoveBox_date__c = null;
+ conList1.add(con2);
+ insert conList1;
+
+ //宸插嚭璐� 鏈埌璐�
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = null;
+ con3.Send_Date__c =null;
+ con3.Used_date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Box_Piece__c = '鐩�';
+ con3.Consumable_Arrived_order__c = Order2.Id;
+ con3.Consumable_Product__c = pro2.Id;
+ con3.Bar_Code__c = '10031';
+ conList2.add(con3);
+ //鎷嗙洅宸插嚭璐�
+ Consumable_order_details2__c con4 = new Consumable_order_details2__c();
+ con4.Arrive_date__c = Date.today();
+ con4.Send_Date__c = Date.today();
+ con4.Return_date__c = null;
+ con4.Used_date__c = null;
+ con4.Lose_Flag__c = false;
+ con4.Box_Piece__c = '涓�';
+ con4.RemoveBox_date__c = Date.today();
+ con4.Consumable_Arrived_order__c = Order2.Id;
+ con4.Consumable_Product__c = pro2.Id;
+ con4.Bar_Code__c = '10041';
+ conList2.add(con4);
+ insert conList2;
+
+ System.Test.startTest();
+ LexCancelRemoveBoxController.barcode = '1004\n1003\n1002\n1001';
+ LexCancelRemoveBoxController.searchConsumableorderdetails('10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','閲嶅簡','ET');
+ String str = '璇ュ晢鍝佸瓨鍦ㄧ洏鐐瑰饱鍘�';
+ String errorReason = '';
+ LexCancelRemoveBoxController.ConsumableorderdetailsInfo c2 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(con,str);
+ c2.esd = con;
+ c2.Prod = con.Consumable_product__r;
+ c2.oldConsumableCount = con.name;
+ c2.ErrorReason = str;
+ LexCancelRemoveBoxController.ConsumableorderdetailsInfo c1 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(con2);
+ c1.esd = con;
+ c1.Prod = con.Consumable_product__r;
+ c1.oldConsumableCount = con.name;
+ c1.compareTo(c2);
+ System.Test.stopTest();
+ }
+ }
+ static testMethod void testMethod4(){
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ User myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
+ insert myAccount2;
+ Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newWang',Email='newWang@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUserWang', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUserWang@testorg.com',Work_Location__c ='閲嶅簡');
+ insert MyUser_Test;
+ System.debug('MyUser_Test'+MyUser_Test);
+ }
+ System.runAs(MyUser_Test){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test01',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test02',Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test03',Manual_Entry__c = false);
+ Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=2,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test04',Manual_Entry__c = false);
+ Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test05',Manual_Entry__c = false);
+ Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test06',Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
+ Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
+ Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
+ Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
+ insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //閿�鍞�
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '閿�鍞�';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = '01210000000c9duAAA';
+ Order1.Order_ProType__c = 'ENG';
+ orderList.add(Order1);
+ //杩斿搧
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '杩斿搧';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = '012100000006Jx4AAE';
+ Order2.Order_ProType__c = 'ENG';
+ orderList.add(Order2);
+ //鐩樼偣
+ Consumable_order__c Order3 = new Consumable_order__c();
+ Order3.Name = 'OCM_01';
+ Order3.Order_status__c = '鎵瑰噯';
+ Order3.Order_type__c = '鐩樼偣';
+ Order3.Dealer_Info__c = myAccount2.Id;
+ Order3.RecordTypeid = '01210000000c9dsAAA';
+ Order3.Order_ProType__c = 'ENG';
+ orderList.add(Order3);
+ //鍙戣揣
+ Consumable_order__c Order4 = new Consumable_order__c();
+ Order4.Name = 'OCM_0122';
+ Order4.Order_status__c = '鎵瑰噯';
+ Order4.Order_type__c = '璁㈠崟';
+ Order4.Dealer_Info__c = myAccount2.Id;
+ Order4.RecordTypeid = '01210000000c9drAAA';
+ Order4.Order_ProType__c = 'ET';
+ Order4.ContractNo__c = '';
+ orderList.add(Order4);
+ insert orderList;
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c> ();
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ List<Consumable_order_details2__c> conList2 = new List<Consumable_order_details2__c> ();
+ //鎷嗙洅宸查攢鍞�
+ Consumable_order_details2__c con4 = new Consumable_order_details2__c();
+ con4.Arrive_date__c = Date.today();
+ con4.Deliver_date__c = Date.today();
+ con4.Sterilization_limit__c = Date.today();
+ con4.Send_Date__c = null;
+ con4.Return_date__c = null;
+ con4.Used_date__c = Date.today();
+ con4.Lose_Flag__c = false;
+ con4.Box_Piece__c = '涓�';
+ con4.RemoveBox_date__c = Date.today();
+ con4.RecordTypeId = '01210000000kUDKAA2';
+ con4.Consumable_Product__c = pro2.Id;
+ con4.Bar_Code__c = '100611';
+ conList.add(con4);
+ insert conList;
+
+ //鎷嗙洅杩斿搧
+ Consumable_order_details2__c con5 = new Consumable_order_details2__c();
+ con5.Arrive_date__c = Date.today();
+ con5.Return_date__c = Date.today();
+ con5.Deliver_date__c = Date.today();
+ con5.Send_Date__c = null;
+ con5.Sterilization_limit__c = Date.today();
+ con5.Used_date__c = Date.today();
+ con5.Box_Piece__c = '涓�';
+ con5.RemoveBox_date__c = Date.today();
+ con5.RecordTypeId = '01210000000kUDPAA2';
+ con5.Consumable_Product__c = pro2.Id;
+ con5.Consumable_order_minor__c = Order4.Id;
+ con5.Bar_Code__c = '10061';
+ conList1.add(con5);
+ insert conList1;
+
+ //鎷嗙洅鍚庣洏鐐硅繃
+ Consumable_order_details2__c con6 = new Consumable_order_details2__c();
+ con6.Inventory_date__c = Date.today();
+ con6.Box_Piece__c = '涓�';
+ con6.RemoveBox_date__c = Date.today();
+ con6.Send_Date__c = null;
+ con6.Deliver_date__c = Date.today();
+ con6.Sterilization_limit__c = Date.today();
+ con6.RecordTypeId = '01210000000kUDKAA2';
+ con6.Consumable_Arrived_order__c = Order3.Id;
+ con6.Consumable_Product__c = pro2.Id;
+ con6.Bar_Code__c = '10078';
+ conList2.add(con6);
+ insert conList2;
+
+ List<Consumable_order_details2__c> conList3 = new List<Consumable_order_details2__c> ();
+ //鎷嗙洅宸插嚭璐�
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c = Date.today();
+ con3.Return_date__c = null;
+ con3.Used_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Box_Piece__c = '涓�';
+ con3.Deliver_date__c = Date.today();
+ con3.RemoveBox_date__c = Date.today();
+ con3.RecordTypeId = '01210000000kUDKAA2';
+ con3.Consumable_Product__c = pro2.Id;
+ con3.Consumable_order_minor__c = Order4.Id;
+ con3.Bar_Code__c = '100999';
+ con3.Sterilization_limit__c = Date.today();
+ conList3.add(con3);
+ insert conList3;
+
+
+ //reset
+ // Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ // con1.Intra_Trade_List_RMB__c = 1000;
+ // con1.Asset_Model_No__c = 'test';
+ // con1.Sterilization_limit__c = Date.today();
+ // con1.Deliver_date__c = Date.today();
+ // con1.Arrive_date__c = Date.today();
+ // con1.Send_Date__c = null;
+ // con1.Used_date__c = null;
+ // con1.Return_date__c = null;
+ // con1.Lose_Flag__c = false;
+ // con1.Box_Piece__c = '涓�';
+
+ // con1.Consumable_order_minor__c = Order4.Id;
+ // con1.Guarantee_period_for_products__c = Date.today();
+ // con1.Consumable_Product__c = pro2.Id;
+ // con1.Bar_Code__c = '1009999';
+ // conList2.add(con1);
+ // insert conList2;
+
+ // List<Consumable_order_details2__c> conList3 = new List<Consumable_order_details2__c> ();
+ // Consumable_order_details2__c con9 = new Consumable_order_details2__c();
+ // con9.RemoveBox_date__c = Date.today();
+ // con9.Bar_Code__c = '100112';
+ // con9.Arrive_date__c = Date.today();
+ // con9.Send_Date__c = null;
+ // con9.Used_date__c = null;
+ // con9.Return_date__c = null;
+ // con9.Lose_Flag__c = false;
+ // con9.Box_Piece__c = '涓�';
+ // con9.RemoveBox_No__c = 9;
+ // conList3.add(con9);
+ // LexCancelRemoveBoxController.searchConsumableorderdetails('100112','Testaccount003','閲嶅簡','ET');
+
+
+
+ //orderDetails2
+ // Consumable_order_details2__c con00 = new Consumable_order_details2__c();
+ // con00.Box_Piece__c = '涓�';
+ // con00.RemoveBox_date__c = Date.today();
+ // con00.RemoveBox_No__c = 1;
+ // con00.ContractNo_text__c = '';
+ // con00.Consumable_order_minor__c = Order4.Id;
+ // con00.Bar_Code__c = '10099999989';
+ // conList3.add(con00);
+
+ // insert conList3;
+ System.Test.startTest();
+ LexCancelRemoveBoxController CancelRemoveBoxController = new LexCancelRemoveBoxController();
+ LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10099\n1009999\n100999','Testaccount003','閲嶅簡','ET');
+ LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','鍖椾含','ET');
+ LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','閲嶅簡','ET');
+ System.Test.stopTest();
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml b/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConInvoiceListTest.cls b/force-app/main/default/classes/LexConInvoiceListTest.cls
index 837de78..87f57b6 100644
--- a/force-app/main/default/classes/LexConInvoiceListTest.cls
+++ b/force-app/main/default/classes/LexConInvoiceListTest.cls
@@ -1,205 +1,85 @@
@isTest
-private class LexConInvoiceListTest {
- static testMethod void conInvoiceListTestinit() {
- user myUser_test;
- Account myAccount2;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id
- );
- myAccount2 = new Account(
- name = 'testaccount002',
- RecordTypeId = rectHos[0].Id
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- Consumable_order__c TestList1 = new Consumable_order__c(
- Name = 'Test1',
- Invoice_Date__c = Date.today(),
- Dealer_info__c = myAccount1.Id,
- Invoice_status__c = '鑽夋涓�',
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '鍙戠エ',
- recordtypeid = System.Label.RT_ConOrder_Invoice,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c TestList2 = new Consumable_order__c(
- Name = 'Test2',
- Invoice_Date__c = Date.today(),
- Dealer_info__c = myAccount1.Id,
- Invoice_status__c = '鎻愪氦',
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '鍙戠エ',
- recordtypeid = System.Label.RT_ConOrder_Invoice,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ TestList1, TestList2 };
- LexConInvoiceList.init();
- // ConInvoiceListController CDC = new ConInvoiceListController();
- // CDC.init();
- // System.assertEquals('Test1', CDC.raesList[0].name);
- // System.assertEquals('Test2', CDC.raesList[1].name);
- // CDC.SortLimited();
- // System.assertEquals('Test1', CDC.raesList[0].name);
- // System.assertEquals('Test2', CDC.raesList[1].name);
- }
- }
- //妫�绱�
- static testMethod void invoiceCodeSearchTest() {
- user myUser_test;
- Account myAccount2;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id
- );
- myAccount2 = new Account(
- name = 'testaccount002',
- RecordTypeId = rectHos[0].Id
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- }
+private class LexConInvoiceListTest
+{
+ static testMethod void conInvoiceListTestinit(){
+ user myUser_test;
+ Account myAccount2;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id );
+ myAccount2 = new Account(name='testaccount002',RecordTypeId = rectHos[0].Id );
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '鍖椾含');
+ insert myUser_test;
- System.runAs(myUser_test) {
- Consumable_order__c TestList1 = new Consumable_order__c(
- Name = 'Test1',
- Invoice_Date__c = Date.today(),
- Dealer_info__c = myAccount1.Id,
- Invoice_status__c = '鑽夋涓�',
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '鍙戠エ',
- recordtypeid = System.Label.RT_ConOrder_Invoice,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c TestList2 = new Consumable_order__c(
- Name = 'Test2',
- Invoice_Date__c = Date.today(),
- Dealer_info__c = myAccount1.Id,
- Invoice_status__c = '鎻愪氦',
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '鍙戠エ',
- recordtypeid = System.Label.RT_ConOrder_Invoice,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ TestList1, TestList2 };
- LexConInvoiceList CDC = new LexConInvoiceList();
- LexConInvoiceList.init();
- LexConInvoiceList.invoiceCodeSearch(
- Date.today(),
- Date.today(),
- '鎻愪氦',
- 'test',
- 'test1',
- '0010l00001ajxZ2AAI',
- '鍖椾含',
- 'ET'
- );
- // CDC.init();
- // System.assertEquals('Test1', CDC.raesList[0].name);
- // System.assertEquals('Test2', CDC.raesList[1].name);
- // CDC.coc.Invoice_status__c = '鎻愪氦';
- // CDC.invoiceCodeSearch();
- // System.assertEquals(1, CDC.raesList.size());
- // CDC.clearUp();
- // System.assertEquals(2, CDC.raesList.size());
+ }
+ system.runAs(myUser_test){
+ Consumable_order__c TestList1 = new Consumable_order__c(Name='Test1',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='鑽夋涓�',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='鍙戠エ',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
+ Consumable_order__c TestList2 = new Consumable_order__c(Name='Test2',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='鎻愪氦',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='鍙戠エ',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
+ insert new Consumable_order__c[]{TestList1,TestList2};
+ LexConInvoiceList.init();
+ // ConInvoiceListController CDC = new ConInvoiceListController();
+ // CDC.init();
+ // System.assertEquals('Test1', CDC.raesList[0].name);
+ // System.assertEquals('Test2', CDC.raesList[1].name);
+ // CDC.SortLimited();
+ // System.assertEquals('Test1', CDC.raesList[0].name);
+ // System.assertEquals('Test2', CDC.raesList[1].name);
+ }
}
- }
-}
+ //妫�绱�
+ static testMethod void invoiceCodeSearchTest(){
+ user myUser_test;
+ Account myAccount2;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id );
+ myAccount2 = new Account(name='testaccount002',RecordTypeId = rectHos[0].Id );
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '鍖椾含');
+ insert myUser_test;
+
+ }
+
+ system.runAs(myUser_test){
+ Consumable_order__c TestList1 = new Consumable_order__c(Name='Test1',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='鑽夋涓�',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='鍙戠エ',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
+ Consumable_order__c TestList2 = new Consumable_order__c(Name='Test2',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='鎻愪氦',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='鍙戠エ',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
+ insert new Consumable_order__c[]{TestList1,TestList2};
+ LexConInvoiceList CDC = new LexConInvoiceList();
+ LexConInvoiceList.init();
+ LexConInvoiceList.invoiceCodeSearch(Date.today(),Date.today(),'鎻愪氦','test','test1','0010l00001ajxZ2AAI','鍖椾含','ET');
+ // CDC.init();
+ // System.assertEquals('Test1', CDC.raesList[0].name);
+ // System.assertEquals('Test2', CDC.raesList[1].name);
+ // CDC.coc.Invoice_status__c = '鎻愪氦';
+ // CDC.invoiceCodeSearch();
+ // System.assertEquals(1, CDC.raesList.size());
+ // CDC.clearUp();
+ // System.assertEquals(2, CDC.raesList.size());
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml b/force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConInvoiceViewController.cls b/force-app/main/default/classes/LexConInvoiceViewController.cls
index 69b9a57..5a2f230 100644
--- a/force-app/main/default/classes/LexConInvoiceViewController.cls
+++ b/force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -1,1962 +1,1683 @@
public without sharing class LexConInvoiceViewController {
- public static String agencyProType { get; set; }
- public static Consumable_order__c coc { get; set; }
- public static Consumable_order__c outbound { get; set; }
- public static String invoiceId { get; set; }
- public static String orderRemind { get; set; }
- public static String deliveryId { get; set; }
- public static String reopen { get; set; }
- public static Decimal sumPrice { get; set; }
- public static Boolean isChange { get; set; }
- public static String accountid { get; set; }
- public static String userId { get; set; }
- public static String errorMsg { get; set; }
+ public static String agencyProType { get; set; }
+ public static Consumable_order__c coc { get; set; }
+ public static Consumable_order__c outbound { get; set; }
+ public static String invoiceId { get; set; }
+ public static String orderRemind { get; set; }
+ public static String deliveryId { get; set; }
+ public static String reopen { get; set; }
+ public static Decimal sumPrice { get; set; }
+ public static Boolean isChange { get; set; }
+ public static String accountid { get; set; }
+ public static String userId { get; set; }
+ public static String errorMsg { get; set; }
- public static Boolean getdone() {
- return (invoiceOrderdetail1Recoeds.size() > 0);
- }
-
- public static Boolean getExistOutbound() {
- return (coc.Outbound_order__c != null);
- }
-
- public static String getInvoiceName() {
- return (coc.Name);
- }
- public static List<Consumable_Orderdetails__c> conoList { get; set; }
-
- public static String shipmentAccount {
- get {
- return (coc.ShipmentAccount__c);
+ public static Boolean getdone() {
+ return (invoiceOrderdetail1Recoeds.size() > 0);
}
- }
- public static String statusEdit = '';
- public static Boolean editAble { get; set; }
- public static List<InvoiceOrderInfo> invoiceOrderRecoeds { get; set; }
- public static List<InvoiceOrderInfo> invoiceOrderdetail1Recoeds { get; set; }
- public static List<InvoiceOrderInfo> invoiceOrderRecoedschange { get; set; }
- public static List<InvoiceOrderInfo> attachmentRecoeds { get; set; }
- public static List<Consumable_order__c> invoiceOrderList { get; set; }
- public static List<Consumable_order__c> invoiceOrderSelectedList { get; set; }
- public static Map<String, Decimal> ordermx1defaultMap { get; set; }
- public static Map<String, Decimal> outorderMoneytMap { get; set; }
- public static Map<String, Consumable_Orderdetails__c> outordercountMap {
- get;
- set;
- }
- public static List<String> outOrderStringList { get; set; }
- public static List<SelectOption> provinceOpts { get; set; }
- public static Map<String, String> provinceOptsMap { get; set; }
- public static String SecondDealer { get; set; }
- public static String HospitalInfo { get; set; }
- public static String HospitalName { get; set; }
- public static Integer invoiceOrderRecoedsCount {
- get {
- return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size();
+ public static Boolean getExistOutbound() {
+ return (coc.Outbound_order__c != null);
}
- }
- public static list<Dealer_elationship__c> Dealerelationship { get; set; }
- public static String[] orderby = new List<String>{
- 'Outbound_Date__c',
- 'Name',
- 'ShipmentAccount__c'
- };
- public static String sortKey { get; set; }
- public static String preSortKey { get; set; }
- public static Boolean sortOrderAsc { get; set; }
- public static String[] sortOrder { get; set; }
- public static String userWorkLocation { get; set; }
-
- //椤甸潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init(
- String invoiceId,
- String statusEdit,
- String deliveryId
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- provinceOpts = new List<SelectOption>();
- provinceOptsMap = new Map<String, String>();
- invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
- attachmentRecoeds = new List<InvoiceOrderInfo>();
- invoiceOrderdetail1Recoeds = new List<InvoiceOrderInfo>();
- invoiceOrderRecoedschange = new List<InvoiceOrderInfo>();
- orderRemind = '';
- isChange = false;
- conoList = new List<Consumable_Orderdetails__c>();
- outorderMoneytMap = new Map<String, Decimal>();
- outOrderStringList = new List<String>();
- outordercountMap = new Map<String, Consumable_Orderdetails__c>();
-
- sumPrice = 0;
- // this.sortKey = '1';
- // this.preSortKey = '1';
- // this.sortOrderAsc = false;
- // this.sortOrder = new List<String>(2);
- // this.sortOrder = new List<String>{ ' ', ' ', ' ', ' ' };
-
- invoiceId = invoiceId;
- statusEdit = statusEdit;
- deliveryId = deliveryId;
-
- if (
- invoiceId != null &&
- invoiceId != '' &&
- (statusEdit == '' ||
- statusEdit == null)
- ) {
- editAble = false;
- } else if (
- (invoiceId == null || invoiceId == '') &&
- (statusEdit == '' ||
- statusEdit == null)
- ) {
- editAble = true;
- } else if (
- invoiceId != null &&
- invoiceId != '' &&
- statusEdit != '' &&
- statusEdit != null
- ) {
- editAble = true;
+ public static String getInvoiceName() {
+ return (coc.Name);
}
- userId = UserInfo.getUserId();
- List<user> Useracc = new List<user>();
- Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc[0].accountid;
- userWorkLocation = Useracc[0].Work_Location__c;
- agencyProType = Useracc[0].UserPro_Type__c;
- if (String.isBlank(Useracc[0].UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- coc = new Consumable_order__c();
+ public static List<Consumable_Orderdetails__c> conoList { get; set; }
- Dealerelationship = [
- SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
- FROM Dealer_elationship__c
- WHERE Dealer_principal__c = :accountid
- ];
- List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
- AgencyHospitalLink = [
- SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c
- FROM Agency_Hospital_Link__c
- WHERE Agency__c = :accountId
- ];
- // 鏂拌
- if (invoiceId == null || invoiceId == '') {
- if (deliveryId == null || deliveryId == '') {
- String msoql = makeSoql();
- invoiceOrderList = Database.query(msoql);
- for (Integer i = 0; i < invoiceOrderList.size(); i++) {
- invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
+ public static String shipmentAccount {
+ get {
+ return (coc.ShipmentAccount__c);
}
- } else {
- if (statusEdit == '' || statusEdit == null) {
- EditAble = false;
- } else if (statusEdit != '' && statusEdit != null) {
- EditAble = true;
+ }
+ public static String statusEdit = '';
+ public static Boolean editAble { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderRecoeds { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderdetail1Recoeds { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderRecoedschange { get; set; }
+ public static List<InvoiceOrderInfo> attachmentRecoeds { get; set; }
+ public static List<Consumable_order__c> invoiceOrderList { get; set; }
+ public static List<Consumable_order__c> invoiceOrderSelectedList { get; set; }
+ public static Map<String, Decimal> ordermx1defaultMap { get; set; }
+ public static Map<String, Decimal> outorderMoneytMap { get; set; }
+ public static Map<String, Consumable_Orderdetails__c> outordercountMap { get; set; }
+ public static List<String> outOrderStringList { get; set; }
+ public static List<SelectOption> provinceOpts { get; set; }
+ public static Map<String, String> provinceOptsMap { get; set; }
+ public static String SecondDealer { get; set; }
+ public static String HospitalInfo { get; set; }
+ public static String HospitalName { get; set; }
+
+ public static Integer invoiceOrderRecoedsCount {
+ get {
+ return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size();
}
- coc = [
- SELECT
- Id,
- Name,
- Invoice_status__c,
- Invoice_Date__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForHospital__c,
- Order_ForHospital__r.Name,
- Order_date__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- SummonsForDirction__c,
- Order_ForCustomerText__c,
- Invoice_Note__c,
- Invoice_attachment__c,
- Invoicedet_attachment__c,
- Outbound_order__c
- FROM Consumable_order__c
- WHERE Id = :deliveryId
+ }
+
+ public static list<Dealer_elationship__c> Dealerelationship { get; set; }
+ public static String[] orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; set; }
+ public static Boolean sortOrderAsc { get; set; }
+ public static String[] sortOrder { get; set; }
+ public static String userWorkLocation { get; set; }
+
+ //椤甸潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String invoiceId, String statusEdit, String deliveryId) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
+ attachmentRecoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderdetail1Recoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderRecoedschange = new List<InvoiceOrderInfo>();
+ orderRemind = '';
+ isChange = false;
+ conoList = new List<Consumable_Orderdetails__c>();
+ outorderMoneytMap = new Map<String, Decimal>();
+ outOrderStringList = new List<String>();
+ outordercountMap = new Map<String, Consumable_Orderdetails__c>();
+
+ sumPrice = 0;
+ // this.sortKey = '1';
+ // this.preSortKey = '1';
+ // this.sortOrderAsc = false;
+ // this.sortOrder = new List<String>(2);
+ // this.sortOrder = new List<String>{ ' ', ' ', ' ', ' ' };
+
+ invoiceId = invoiceId;
+ statusEdit = statusEdit;
+ deliveryId = deliveryId;
+
+ if (invoiceId != null && invoiceId != '' && (statusEdit == '' || statusEdit == null)) {
+ editAble = false;
+ } else if ((invoiceId == null || invoiceId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (invoiceId != null && invoiceId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ List<user> Useracc = new List<user>();
+ Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ coc = new Consumable_order__c();
+
+ Dealerelationship = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__c = :accountid
];
- coc.Name = '';
- if (coc.Order_ForDealer__c != null) {
- SecondDealer = coc.Order_ForDealer__c;
- }
-
- if (coc.Order_ForHospital__c != null) {
- HospitalInfo = coc.Order_ForHospital__c;
- HospitalName = coc.Order_ForHospital__r.Name;
- }
-
- //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
- invoiceOrderSelectedList = [
- SELECT
- Id,
- Order_ForDealer__r.Name,
- Order_ForHospital__r.Name,
- Order_ForDealerText__c,
- Name,
- Outbound_Date__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- SummonsForDirction__c,
- Shipment_total_amount__c,
- RrturnPro_total_amount__c,
- Total_Invoiced_Procount__c,
- InvoiceNotPro_total_amount__c,
- InvoiceNotPro_money__c,
- Invoice_total_amount__c,
- Billed_Status__c
- FROM Consumable_order__c
- WHERE Id = :deliveryId
- ORDER BY Name
+ List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
+ AgencyHospitalLink = [
+ SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId
];
- for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
- invoiceOrderRecoeds.add(
- new InvoiceOrderInfo(invoiceOrderSelectedList[i])
- );
- }
- }
- } else {
- coc = [
- SELECT
- Id,
- Name,
- Invoice_status__c,
- Invoice_Date__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForHospital__c,
- Order_ForHospital__r.Name,
- Order_date__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- SummonsForDirction__c,
- Order_ForCustomerText__c,
- Invoice_Note__c,
- Invoice_attachment__c,
- Invoicedet_attachment__c,
- Outbound_order__c
- FROM Consumable_order__c
- WHERE Id = :invoiceId AND Order_type__c = '鍙戠エ'
- ];
- if (coc.Order_ForDealer__c != null) {
- SecondDealer = coc.Order_ForDealer__c;
- }
- if (coc.Order_ForHospital__c != null) {
- HospitalInfo = coc.Order_ForHospital__c;
- HospitalName = coc.Order_ForHospital__r.Name;
- }
- //鍒伴摼鎺ヨ〃涓煡鎵惧叧鑱斿嚭搴撳崟
- List<Consumable_order_LinkTable__c> outOrderList = [
- SELECT Outboundorder_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE Invoice_Code_link__c = :invoiceId
- ];
- for (Integer i = 0; i < outOrderList.size(); i++) {
- outOrderStringList.add(outOrderList[i].Outboundorder_Code_link__c);
- }
- //鍙栧緱鍑哄簱鍗曚俊鎭�
- invoiceOrderSelectedList = [
- SELECT
- Id,
- Order_ForDealer__r.Name,
- Order_ForHospital__r.Name,
- Order_ForDealerText__c,
- Name,
- Outbound_Date__c,
- ShipmentAccount__c,
- Shipment_total_amount__c,
- RrturnPro_total_amount__c,
- Total_Invoiced_Procount__c,
- InvoiceNotPro_total_amount__c,
- InvoiceNotPro_money__c,
- Invoice_total_amount__c,
- Billed_Status__c
- FROM Consumable_order__c
- WHERE
- Id IN :outOrderStringList
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- ORDER BY Name
- ];
- for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
- outorderMoneytMap.put(invoiceOrderSelectedList[i].id, 0);
- invoiceOrderRecoeds.add(
- new InvoiceOrderInfo(invoiceOrderSelectedList[i])
- );
- }
- if (String.isNotBlank(deliveryId)) {
- //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
- isChange = true;
- invoiceOrderSelectedList = [
- SELECT
- Id,
- Order_ForDealer__r.Name,
- Order_ForHospital__r.Name,
- Order_ForDealerText__c,
- Name,
- Outbound_Date__c,
- ShipmentAccount__c,
- Shipment_total_amount__c,
- RrturnPro_total_amount__c,
- Total_Invoiced_Procount__c,
- InvoiceNotPro_total_amount__c,
- InvoiceNotPro_money__c,
- Invoice_total_amount__c,
- Billed_Status__c
- FROM Consumable_order__c
- WHERE
- Id = :deliveryId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- ORDER BY Name
- ];
- for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
- if (!outorderMoneytMap.containsKey(invoiceOrderSelectedList[i].Id)) {
- invoiceOrderRecoeds.add(
- new InvoiceOrderInfo(invoiceOrderSelectedList[i])
- );
- invoiceOrderRecoedschange.add(
- new InvoiceOrderInfo(invoiceOrderSelectedList[i])
- );
- }
- }
- }
- //鍙戠エ鏄庣粏涓�瑙�
- List<Consumable_Orderdetails__c> countDel = [
- SELECT
- Id,
- Consumable_ZS_order__c,
- Name,
- Consumable_order__c,
- Invoicedet1_OD_link__c,
- Invoicedet1_OD_link__r.Name,
- Consumable_order__r.Name,
- Product_OutDate__c,
- Asset_Model_No__c,
- Invoice_Unitprice__c,
- Delivery_List_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- InvoicedProCost_RMB__c,
- Box_Piece__c,
- Invoice_Unit__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :invoiceId
- ORDER BY Invoicedet1_OD_link__c
- ];
- if (countDel.size() > 0) {
- for (Integer i = 0; i < countDel.size(); i++) {
- outordercountMap.put(
- countDel[i].Invoicedet1_OD_link__c + countDel[i].Asset_Model_No__c,
- countDel[i]
- );
- if (
- outorderMoneytMap.containsKey(countDel[i].Invoicedet1_OD_link__c)
- ) {
- outorderMoneytMap.put(
- countDel[i].Invoicedet1_OD_link__c,
- outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) +
- countDel[i].InvoicedProCost_RMB__c
- );
- }
- invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i]));
- }
- }
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (outorderMoneytMap.containsKey(ass.esd.id)) {
- ass.needInvoiceCount = outorderMoneytMap.get(ass.esd.id);
- }
- ass.check = true;
- }
- }
-
- if (SecondDealer == null || SecondDealer == '') {
- provinceOpts.add(new SelectOption('', '-鏃�-'));
- provinceOptsMap.put('', '-鏃�-');
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- );
- }
- } else {
- provinceOpts.add(new SelectOption('', '-鏃�-'));
- provinceOptsMap.put('', '-鏃�-');
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- if (Dealerelationship[i].Dealer_subordinate__r.Name == SecondDealer) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- SecondDealer
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- SecondDealer
- );
- }
- }
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- );
- }
- }
- }
-
- Map<String, String> consumableaccessoriesMap = new Map<String, String>();
- Map<String, String> invorceOrderIdMap = new Map<String, String>();
- List<Consumable_accessories_invoice__c> consumableaccessories = [
- SELECT Id, Name, Attachment_ID__c, Accessories_type__c
- FROM Consumable_accessories_invoice__c
- WHERE Invoice_code__c = :invoiceId
- ];
- System.debug('consumableaccessories = ' + consumableaccessories);
- if (consumableaccessories.size() > 0) {
- for (Integer i = 0; i < consumableaccessories.size(); i++) {
- consumableaccessoriesMap.put(
- consumableaccessories[i].Attachment_ID__c,
- consumableaccessories[i].Accessories_type__c
- );
- invorceOrderIdMap.put(
- consumableaccessories[i].Attachment_ID__c,
- consumableaccessories[i].Id
- );
- }
- }
-
- //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId];
- // if (attachmentinfo.size() > 0) {
- // for (Integer i = 0; i < attachmentinfo.size(); i++) {
- // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
- // }
- // }
- List<ContentDocumentLink> links = [
- SELECT Id, ContentDocumentId
- FROM ContentDocumentLink
- WHERE LinkedEntityId = :invoiceId
- ];
- if (links != null && links.size() > 0) {
- List<String> documentIds = new List<String>();
- for (ContentDocumentLink link : links) {
- 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 InvoiceOrderInfo(cvInfo[i]));
- }
- }
- }
- // List<ContentVersion> cvInfo = [
- // SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
- // FROM ContentVersion
- // WHERE FirstPublishLocationId = :invoiceId
- // ];
- // if (cvInfo.size() > 0) {
- // for (Integer i = 0; i < cvInfo.size(); i++) {
- // attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
- // }
- // }
- System.debug('attachmentRecoeds = ' + attachmentRecoeds);
- System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap);
- for (InvoiceOrderInfo ass : attachmentRecoeds) {
- if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) {
- ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id);
- ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id);
- }
- }
- data.put('EditAble', EditAble);
- data.put('isChange', isChange);
- data.put('coc', coc);
- data.put('ExistOutbound', getExistOutbound());
- data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
- data.put('provinceOptsMap', provinceOptsMap);
- data.put('HospitalName', HospitalName);
- data.put('HospitalInfo', HospitalInfo);
- data.put('agencyProType', agencyProType);
- data.put('userWorkLocation', userWorkLocation);
- data.put('done', getdone());
- data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds);
- data.put('accountid', accountid);
- data.put('invoiceOrderRecoedschange', invoiceOrderRecoedschange);
- data.put('attachmentRecoeds', attachmentRecoeds);
- data.put('outOrderStringList', outOrderStringList);
- data.put('outordercountMap', outordercountMap);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- //淇濆瓨
- @AuraEnabled
- public static ResponseBodyLWC save(
- Consumable_order__c cocLwc,
- String HospitalNameLwc,
- String HospitalInfoLwc,
- String SecondDealerLwc,
- String invoiceOrderRecoedsLwc,
- String deliveryIdLwc,
- String invoiceIdLwc,
- String accountidLwc,
- String agencyProTypeLwc,
- String reopenLwc,
- String invoiceOrderRecoedschangeLwc
- ) {
- System.debug('enter LexConInvoiceViewController.save success');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- coc = cocLwc;
- HospitalName = HospitalNameLwc;
- HospitalInfo = HospitalInfoLwc;
- System.debug('HospitalInfo = ' + HospitalInfo);
- SecondDealer = SecondDealerLwc;
- errorMsg = '';
- deliveryId = deliveryIdLwc;
- invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(
- invoiceOrderRecoedsLwc,
- List<InvoiceOrderInfo>.class
- );
- invoiceId = invoiceIdLwc;
- accountid = accountidLwc;
- agencyProType = agencyProTypeLwc;
- reopen = reopenLwc;
- invoiceOrderRecoedschange = (List<InvoiceOrderInfo>) JSON.deserialize(
- invoiceOrderRecoedschangeLwc,
- List<InvoiceOrderInfo>.class
- );
-
- List<String> chukudanID = new List<String>();
- if (coc.Name == '' || coc.Name == null) {
- // coc.Name.addError('璇峰綍鍏ュ彂绁ㄥ彿');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄥ彿', '');
- }
- if (coc.Invoice_Date__c == null) {
- // coc.Invoice_Date__c.addError('璇峰綍鍏ュ彂绁ㄦ棩鏈�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄦ棩鏈�', '');
- }
- if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) {
- // coc.addError('蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�',
- ''
- );
- }
- if (
- HospitalInfo != null &&
- HospitalInfo != '' &&
- String.isNotEmpty(SecondDealer)
- ) {
- //coc.addError('璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�');
- errorMsg += '璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�';
- }
- if (HospitalInfo != null && HospitalInfo != '') {
- if (coc.Order_ForCustomerText__c == null) {
- // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
- }
- } else {
- if (coc.Order_ForCustomerText__c != null) {
- // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
- }
- }
- String shipmentAccountString = '';
- if (HospitalInfo != null) {
- shipmentAccountString = HospitalInfo;
- } else if (String.isNotEmpty(SecondDealer)) {
- shipmentAccountString = SecondDealer;
- } else {
- shipmentAccountString = coc.Order_ForDealerText__c == null
- ? ''
- : coc.Order_ForDealerText__c;
- }
-
- Integer x = 0;
- List<String> invoiceOrderAccountList = new List<String>();
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (String.isBlank(deliveryId)) {
- if (ass.check == true) {
- x++;
- System.debug(shipmentAccountString);
- if (HospitalInfo != null && HospitalInfo != '') {
- if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- if (String.isNotEmpty(SecondDealer)) {
- if (
- ass.esd.Order_ForDealer__c != shipmentAccountString &&
- ass.esd.Order_ForDealerText__c != shipmentAccountString
- ) {
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- if (
- coc.Order_ForDealerText__c != null &&
- (HospitalInfo == null ||
- HospitalInfo == '')
- ) {
- if (
- (ass.esd.Order_ForDealerText__c != null ||
- ass.esd.Order_ForDealerText__c != '') &&
- ass.esd.ShipmentAccount__c != shipmentAccountString
- ) {
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- }
- } else {
- if (HospitalInfo != null && HospitalInfo != '') {
- System.debug(
- '++++++++++++' +
- ass.esd.Order_ForHospital__c +
- ' ' +
- shipmentAccountString
- );
- if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
- System.debug(
- 'HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString'
- );
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- //if (String.isNotEmpty(SecondDealer)) {
- if (String.isNotEmpty(SecondDealer)) {
- if (ass.esd.Order_ForDealer__c != shipmentAccountString) {
- System.debug(
- 'String.isNotEmpty(SecondDealer) ass.esd.Order_ForHospital__c != shipmentAccountString'
- );
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- if (
- coc.Order_ForDealerText__c != null &&
- (HospitalInfo == null ||
- HospitalInfo == '')
- ) {
- if (
- (ass.esd.Order_ForDealerText__c != null ||
- ass.esd.Order_ForDealerText__c != '') &&
- ass.esd.ShipmentAccount__c != shipmentAccountString
- ) {
- System.debug(
- 'HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'
- );
- invoiceOrderAccountList.add(ass.esd.Name);
- }
- }
- }
- }
- // invoiceOrderAccountList.add('12345');
- if (invoiceOrderAccountList.size() > 0) {
- orderRemind =
- invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒';
- // coc.addError(invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒',
- ''
- );
- } else {
- orderRemind = '';
- }
- if (String.isBlank(deliveryId)) {
- if (x < 1) {
- // coc.addError('璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�',
- ''
- );
- }
- }
- Consumable_order__c invoiceHead = new Consumable_order__c();
- List<String> outOrderIdList = new List<String>();
- List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
- Map<String, String> insertDetMap = new Map<String, String>();
- Map<String, String> deleteDetMap = new Map<String, String>();
- //鏂板缓鍙戠エ鏃�
- Savepoint sp = Database.setSavepoint();
- try {
- if (String.isBlank(invoiceId)) {
- invoiceHead.Name = coc.Name;
- if (
- coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c)
- )
- coc.Invoice_status__c = '鑽夋涓�';
- invoiceHead.Order_type__c = '鍙戠エ';
- invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
- invoiceHead.Dealer_Info__c = accountid;
- invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
- invoiceHead.Invoice_status__c = '鑽夋涓�';
- invoiceHead.Order_ProType__c = agencyProType;
- invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- //if (deliveryId != null) {
- if (String.isNotBlank(deliveryId)) {
- invoiceHead.Outbound_order__c = deliveryId;
- }
- invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // if (SecondDealer == null) {
- if (String.isBlank(SecondDealer)) {
- if (HospitalInfo != null && HospitalInfo != '') {
- invoiceHead.Order_ForHospital__c = HospitalInfo;
- }
- } else {
- invoiceHead.Order_ForDealer__c = SecondDealer;
- }
- invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
- if (Test.isRunningTest()) {
- invoiceHead.Order_ForHospital__c = null;
- }
- insert invoiceHead;
- invoiceId = invoiceHead.Id;
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- cocinfo = [
- SELECT
- Id,
- Name,
- Invoice_status__c,
- Invoice_Date__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForHospital__c,
- Order_date__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- SummonsForDirction__c,
- Order_ForCustomerText__c,
- Invoice_Note__c,
- Invoice_attachment__c,
- Invoicedet_attachment__c,
- Outbound_order__c
- FROM Consumable_order__c
- WHERE Id = :invoiceId
- ];
- if (cocinfo.size() > 0) {
- invoiceHead = cocinfo[0];
- }
- if (!String.isBlank(deliveryId)) {
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- chukudanID.add(ass.esd.Id);
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
- }
- } else {
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (!String.isBlank(deliveryId)) {
- chukudanID.add(ass.esd.Id);
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ // 鏂拌
+ if (invoiceId == null || invoiceId == '') {
+ if (deliveryId == null || deliveryId == '') {
+ String msoql = makeSoql();
+ invoiceOrderList = Database.query(msoql);
+ for (Integer i = 0; i < invoiceOrderList.size(); i++) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
+ }
} else {
- if (ass.check == true) {
- chukudanID.add(ass.esd.Id);
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
- } else {
- //deleteDetMap.put(ass.esd.Id,invoiceHead.Id);
- }
+ if (statusEdit == '' || statusEdit == null) {
+ EditAble = false;
+ } else if (statusEdit != '' && statusEdit != null) {
+ EditAble = true;
+ }
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_ForHospital__r.Name,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId
+ ];
+ coc.Name = '';
+ if (coc.Order_ForDealer__c != null) {
+ SecondDealer = coc.Order_ForDealer__c;
+ }
+
+ if (coc.Order_ForHospital__c != null) {
+ HospitalInfo = coc.Order_ForHospital__c;
+ HospitalName = coc.Order_ForHospital__r.Name;
+ }
+
+ //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
}
- }
- }
- //鏂板缓鍙戠エ鏄庣粏1
- if (chukudanID.size() > 0) {
- newinvoicedetails1(chukudanID);
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'deleteDetMap +++++' + deleteDetMap.size()));
- //return null;
- if (insertDetMap.size() > 0) {
- for (String field : insertDetMap.keySet()) {
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id
- FROM Consumable_order_LinkTable__c
- WHERE
- Outboundorder_Code_link__c = :field
- AND Invoice_Code_link__c = :insertDetMap.get(field)
+ } else {
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_ForHospital__r.Name,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId AND Order_type__c = '鍙戠エ'
];
- if (existLinkinfo.size() < 1) {
- Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
- invoiceLink.Name = field + insertDetMap.get(field);
- invoiceLink.Outboundorder_Code_link__c = field;
- invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
- invoiceLinkList.add(invoiceLink);
+ if (coc.Order_ForDealer__c != null) {
+ SecondDealer = coc.Order_ForDealer__c;
}
- }
- upsert invoiceLinkList;
- }
- } else if (
- String.isNotBlank(reopen) &&
- reopen.equals('isreopen') &&
- String.isNotBlank(invoiceId)
- ) {
- System.debug('杩涘叆reopen');
- invoiceHead.Name = coc.Name;
- invoiceHead.Order_type__c = '鍙戠エ';
- invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
- invoiceHead.Dealer_Info__c = accountid;
- invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
- invoiceHead.Invoice_status__c = '鑽夋涓�';
- invoiceHead.Order_ProType__c = agencyProType;
- invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- //if (deliveryId != null) {
- if (String.isNotBlank(deliveryId)) {
- invoiceHead.Outbound_order__c = deliveryId;
- }
- invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //if (SecondDealer == null) {
- if (String.isBlank(SecondDealer)) {
- if (HospitalInfo != null && HospitalInfo != '') {
- invoiceHead.Order_ForHospital__c = HospitalInfo;
- }
- } else {
- invoiceHead.Order_ForDealer__c = SecondDealer;
- }
- invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
- if (Test.isRunningTest()) {
- invoiceHead.Order_ForHospital__c = null;
- }
- insert invoiceHead;
- System.debug('invoiceHead = ' + invoiceHead);
-
- List<String> updateChukudanId = new List<String>();
- //鑾峰彇鍘熷彂绁ㄧ浉鍏宠仈鐨勯摼鎺ヨ〃淇℃伅
- List<Consumable_order_LinkTable__c> tLinkList = [
- SELECT Outboundorder_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE Invoice_Code_link__c = :invoiceId
- ];
-
- for (Consumable_order_LinkTable__c colc : tLinkList) {
- colc.Invoice_Code_link__c = invoiceHead.Id;
- updateChukudanId.add(colc.Outboundorder_Code_link__c);
- }
- System.debug('tLinkList = ' + tLinkList);
- update tLinkList;
- //鏇存柊鍙戠エ鏄庣粏淇℃伅
- //鑾峰彇鍑哄簱鍗�,璁剧疆鍏宠仈鍏崇郴
- //鑾峰彇鍑哄簱鍗曟槑缁嗕俊鎭�,鍥犱负鍑哄簱鍗曚俊鎭拰鍑哄簱鍗曟槑缁嗕俊鎭槸鍏宠仈鐨�,鎵�鏈夊彧闇�瑕佸洖婊氬嚭搴撳崟鏄庣粏淇℃伅鍗冲彲
-
- Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>();
- List<Consumable_Orderdetails__c> tempCountList = [
- SELECT
- Id,
- Consumable_order__c,
- Asset_Model_No__c,
- InvoicedProCost_RMB__c,
- Invoicedet1_OD_link__c,
- InvoicedProduct_RMB__c,
- Invoiced_Procount__c,
- Invoiced_BoxCount__c,
- Invoice_Unit__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :invoiceId
- ];
- for (Consumable_Orderdetails__c cocTemp : tempCountList) {
- cocTemp.Consumable_order__c = invoiceHead.Id;
- tempCocMap.put(
- cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c,
- cocTemp
- );
- }
- System.debug('tempCountList = ' + tempCountList);
- update tempCountList;
- List<Consumable_Orderdetails__c> updateFromList = [
- SELECT
- Id,
- Consumable_order__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoice_Unitprice__c,
- Box_Piece__c,
- Invoice_Unit__c,
- Consumable_order__r.Invoice_total_amount__c,
- ProductPacking_list_manual__c,
- InvoicedProduct_RMB__c,
- Invoiced_BoxCount__c,
- Shipment_amount__c,
- Asset_Model_No__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c IN :updateChukudanId
- ];
- for (Consumable_Orderdetails__c corderc : updateFromList) {
- String tempStr =
- corderc.Consumable_order__c + corderc.Asset_Model_No__c;
- if (tempCocMap.get(tempStr) != null) {
- //璁剧疆宸插彂绁ㄩ噾棰� 鍑哄簱鍗曠殑宸插彂绁ㄩ噾棰� - 鍙戠エ鐨勫彂绁ㄩ噾棰�
- corderc.InvoicedProCost_RMB__c =
- corderc.InvoicedProCost_RMB__c -
- tempCocMap.get(tempStr).InvoicedProduct_RMB__c;
- //璁剧疆宸插彂绁ㄦ暟閲� 鍑哄簱鍗曠殑宸插彂绁ㄦ暟閲� - 鍙戠エ鐨勫彂绁ㄦ暟閲�(鐩�)
- corderc.Invoiced_Procount__c =
- corderc.Invoiced_Procount__c -
- tempCocMap.get(tempStr).Invoiced_BoxCount__c;
- //璁剧疆鍙戠エ鍗曚环
- if (
- corderc.Box_Piece__c == '鐩�' &&
- corderc.Invoice_Unit__c == '涓�'
- ) {
- corderc.Invoice_Unitprice__c =
- corderc.Delivery_List_RMB__c /
- corderc.ProductPacking_list_manual__c;
- } else {
- corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c;
+ if (coc.Order_ForHospital__c != null) {
+ HospitalInfo = coc.Order_ForHospital__c;
+ HospitalName = coc.Order_ForHospital__r.Name;
}
- }
- }
-
- Consumable_order__c tempcoc = new Consumable_order__c();
- tempcoc.Id = invoiceId;
- System.debug('tempcoc = ' + tempcoc);
- delete tempcoc;
- invoiceId = invoiceHead.Id;
- System.debug('updateFromList = ' + updateFromList);
- update updateFromList;
- //--------------------------------------------------------------------------
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (ass.check == true) {
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
- } else {
- outOrderIdList.add(ass.esd.Id);
- deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
- }
- }
- if (outOrderIdList.size() > 0) {
- getdefaultMapinfo(outOrderIdList);
- }
- //琚�変腑鐨勫嚭搴撳崟闆嗗悎
- if (insertDetMap.size() > 0) {
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE
- Outboundorder_Code_link__c IN :insertDetMap.keySet()
- AND Invoice_Code_link__c = :invoiceHead.Id
- ];
- //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
- List<String> templist2 = new List<String>();
- for (Consumable_order_LinkTable__c colc : existLinkinfo) {
- templist2.add(colc.Outboundorder_Code_link__c);
- }
- //鑾峰彇璇ュ嚭搴撳崟
- for (String field : insertDetMap.keySet()) {
- if (!templist2.contains(field)) {
- //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
- chukudanID.add(field);
- Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
- invoiceLink.Name = field + insertDetMap.get(field);
- invoiceLink.Outboundorder_Code_link__c = field;
- invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
- invoiceLinkList.add(invoiceLink);
- }
- }
- System.debug('invoiceLinkList = ' + invoiceLinkList);
- upsert invoiceLinkList;
- }
- //鍒犻櫎鍑哄簱鍗曢摼鎺ヨ〃
- if (deleteDetMap.size() > 0) {
- List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
- deleteOutboundorder(deleteDetMap, invoiceHead.Id);
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE
- Outboundorder_Code_link__c IN :deleteDetMap.keySet()
- AND Invoice_Code_link__c = :invoiceHead.Id
- ];
- for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
- if (
- deleteDetMap.get(colctemp.Outboundorder_Code_link__c) ==
- colctemp.Invoice_Code_link__c
- ) {
- //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
- invoiceLinkdetList.add(colctemp);
- }
- }
- System.debug('invoiceLinkdetList = ' + invoiceLinkdetList);
- delete invoiceLinkdetList;
- }
- //鏂板缓鍙戠エ鏄庣粏1
- System.debug('===>' + chukudanID);
- System.debug('===>' + chukudanID.size());
- if (chukudanID.size() > 0) {
- newinvoicedetails1(chukudanID);
- }
- } else {
- //CHAN-BSS5SQ update by rentongxiao 2020-09-04 end
- //缂栬緫鍚庝繚瀛�
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- cocinfo = [
- SELECT
- Id,
- Name,
- Invoice_status__c,
- Invoice_Date__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForHospital__c,
- Order_date__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- SummonsForDirction__c,
- Order_ForCustomerText__c,
- Invoice_Note__c,
- Invoice_attachment__c,
- Invoicedet_attachment__c,
- Outbound_order__c
- FROM Consumable_order__c
- WHERE Id = :invoiceId
- ];
- if (cocinfo.size() > 0) {
- invoiceHead = cocinfo[0];
- }
- if (String.isNotBlank(deliveryId)) {
- for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) {
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
- }
-
- //鎹㈣揣鍗曚骇鍝佹暟閲�
- Map<String, Decimal> needchangeOrderProcountMap = new Map<String, Decimal>();
- Map<String, Decimal> returnProcountMap = new Map<String, Decimal>();
- Map<String, Decimal> changeOrderProcountMap = new Map<String, Decimal>();
- List<Consumable_Orderdetails__c> detaliFromList = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Unit__c,
- Box_Piece__c,
- Invoice_Cost_RMB__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :deliveryId
- ];
- for (Consumable_Orderdetails__c changeOD : detaliFromList) {
- needchangeOrderProcountMap.put(
- changeOD.Asset_Model_No__c,
- changeOD.Shipment_Count__c
- );
- }
- //鍙戠エ杩斿搧淇℃伅
- List<Consumable_Orderdetails__c> returnCountList = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_Unit__c,
- Box_Piece__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :invoiceId
- ];
-
- for (Consumable_Orderdetails__c changeOD : returnCountList) {
- if (changeOD.RrturnPro_count__c > 0) {
- if (returnProcountMap.containsKey(changeOD.Asset_Model_No__c)) {
- returnProcountMap.put(
- changeOD.Asset_Model_No__c,
- returnProcountMap.get(changeOD.Asset_Model_No__c) +
- changeOD.RrturnPro_count__c
- );
- } else {
- returnProcountMap.put(
- changeOD.Asset_Model_No__c,
- changeOD.RrturnPro_count__c
- );
- }
- }
- }
-
- //宸叉崲璐у崟鍑哄簱鏁伴噺淇℃伅
- List<Consumable_Orderdetails__c> returnCount1List = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_Unit__c,
- Box_Piece__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c IN (
+ //鍒伴摼鎺ヨ〃涓煡鎵惧叧鑱斿嚭搴撳崟
+ List<Consumable_order_LinkTable__c> outOrderList = [
SELECT Outboundorder_Code_link__c
FROM Consumable_order_LinkTable__c
WHERE Invoice_Code_link__c = :invoiceId
- )
- AND Consumable_order__r.Onchange_order__c = TRUE
- AND Consumable_order__c != :deliveryId
- ];
- for (Consumable_Orderdetails__c changeOD : returnCount1List) {
- changeOrderProcountMap.put(
- changeOD.Asset_Model_No__c,
- changeOD.Shipment_Count__c
- );
- }
- outOrderchange(insertDetMap);
- } else {
- invoiceHead.Name = coc.Name;
- invoiceHead.Invoice_status__c = coc.Invoice_status__c;
- invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
- invoiceHead.Dealer_Info__c = accountid;
- invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
- invoiceHead.Invoice_status__c = '鑽夋涓�';
- invoiceHead.Order_ProType__c = agencyProType;
- invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'HospitalName +++++' + HospitalName));
- //return null;
- if (HospitalName != null && HospitalName != '') {
- if (HospitalInfo != null && HospitalInfo != '') {
- invoiceHead.Order_ForHospital__c = HospitalInfo;
- }
- } else {
- invoiceHead.Order_ForHospital__c = null;
- }
- invoiceHead.Order_ForDealer__c = SecondDealer == ''
- ? null
- : SecondDealer;
- invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
- update invoiceHead;
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (ass.check == true) {
- insertDetMap.put(ass.esd.Id, invoiceHead.Id);
- } else {
- outOrderIdList.add(ass.esd.Id);
- deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
- }
- }
- if (outOrderIdList.size() > 0) {
- getdefaultMapinfo(outOrderIdList);
- }
- //CHAN-BSS5SQ update by rentongxiao 2020-09-08 start
- //琚�変腑鐨勫嚭搴撳崟闆嗗悎
- if (insertDetMap.size() > 0) {
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE
- Outboundorder_Code_link__c IN :insertDetMap.keySet()
- AND Invoice_Code_link__c = :invoiceHead.Id
];
- //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
- List<String> templist2 = new List<String>();
- for (Consumable_order_LinkTable__c colc : existLinkinfo) {
- templist2.add(colc.Outboundorder_Code_link__c);
+ for (Integer i = 0; i < outOrderList.size(); i++) {
+ outOrderStringList.add(outOrderList[i].Outboundorder_Code_link__c);
}
- //鑾峰彇璇ュ嚭搴撳崟
+ //鍙栧緱鍑哄簱鍗曚俊鎭�
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id IN :outOrderStringList AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ outorderMoneytMap.put(invoiceOrderSelectedList[i].id, 0);
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
+ if (String.isNotBlank(deliveryId)) {
+ //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
+ isChange = true;
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ if (!outorderMoneytMap.containsKey(invoiceOrderSelectedList[i].Id)) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ invoiceOrderRecoedschange.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
+ }
+ }
+ //鍙戠エ鏄庣粏涓�瑙�
+ List<Consumable_Orderdetails__c> countDel = [
+ SELECT
+ Id,
+ Consumable_ZS_order__c,
+ Name,
+ Consumable_order__c,
+ Invoicedet1_OD_link__c,
+ Invoicedet1_OD_link__r.Name,
+ Consumable_order__r.Name,
+ Product_OutDate__c,
+ Asset_Model_No__c,
+ Invoice_Unitprice__c,
+ Delivery_List_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ InvoicedProCost_RMB__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ORDER BY Invoicedet1_OD_link__c
+ ];
+ if (countDel.size() > 0) {
+ for (Integer i = 0; i < countDel.size(); i++) {
+ outordercountMap.put(countDel[i].Invoicedet1_OD_link__c + countDel[i].Asset_Model_No__c, countDel[i]);
+ if (outorderMoneytMap.containsKey(countDel[i].Invoicedet1_OD_link__c)) {
+ outorderMoneytMap.put(
+ countDel[i].Invoicedet1_OD_link__c,
+ outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) + countDel[i].InvoicedProCost_RMB__c
+ );
+ }
+ invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i]));
+ }
+ }
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (outorderMoneytMap.containsKey(ass.esd.id)) {
+ ass.needInvoiceCount = outorderMoneytMap.get(ass.esd.id);
+ }
+ ass.check = true;
+ }
+ }
+
+ if (SecondDealer == null || SecondDealer == '') {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ } else {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__r.Name == SecondDealer) {
+ provinceOpts.add(new SelectOption(Dealerelationship[i].Dealer_subordinate__c, SecondDealer));
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, SecondDealer);
+ }
+ }
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ }
+ }
+
+ Map<String, String> consumableaccessoriesMap = new Map<String, String>();
+ Map<String, String> invorceOrderIdMap = new Map<String, String>();
+ List<Consumable_accessories_invoice__c> consumableaccessories = [
+ SELECT Id, Name, Attachment_ID__c, Accessories_type__c
+ FROM Consumable_accessories_invoice__c
+ WHERE Invoice_code__c = :invoiceId
+ ];
+ System.debug('consumableaccessories = ' + consumableaccessories);
+ if (consumableaccessories.size() > 0) {
+ for (Integer i = 0; i < consumableaccessories.size(); i++) {
+ consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c);
+ invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id);
+ }
+ }
+
+ //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId];
+ // if (attachmentinfo.size() > 0) {
+ // for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
+ // }
+ // }
+ List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :invoiceId];
+ if (links != null && links.size() > 0) {
+ List<String> documentIds = new List<String>();
+ for (ContentDocumentLink link : links) {
+ 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 InvoiceOrderInfo(cvInfo[i]));
+ }
+ }
+ }
+ // List<ContentVersion> cvInfo = [
+ // SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
+ // FROM ContentVersion
+ // WHERE FirstPublishLocationId = :invoiceId
+ // ];
+ // if (cvInfo.size() > 0) {
+ // for (Integer i = 0; i < cvInfo.size(); i++) {
+ // attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
+ // }
+ // }
+ System.debug('attachmentRecoeds = ' + attachmentRecoeds);
+ System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap);
+ for (InvoiceOrderInfo ass : attachmentRecoeds) {
+ if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) {
+ ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id);
+ ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id);
+ }
+ }
+ data.put('EditAble', EditAble);
+ data.put('isChange', isChange);
+ data.put('coc', coc);
+ data.put('ExistOutbound', getExistOutbound());
+ data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
+ data.put('provinceOptsMap', provinceOptsMap);
+ data.put('HospitalName', HospitalName);
+ data.put('HospitalInfo', HospitalInfo);
+ data.put('agencyProType', agencyProType);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('done', getdone());
+ data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds);
+ data.put('accountid', accountid);
+ data.put('invoiceOrderRecoedschange', invoiceOrderRecoedschange);
+ data.put('attachmentRecoeds', attachmentRecoeds);
+ data.put('outOrderStringList', outOrderStringList);
+ data.put('outordercountMap', outordercountMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //淇濆瓨
+ @AuraEnabled
+ public static ResponseBodyLWC save(
+ Consumable_order__c cocLwc,
+ String HospitalNameLwc,
+ String HospitalInfoLwc,
+ String SecondDealerLwc,
+ String invoiceOrderRecoedsLwc,
+ String deliveryIdLwc,
+ String invoiceIdLwc,
+ String accountidLwc,
+ String agencyProTypeLwc,
+ String reopenLwc,
+ String invoiceOrderRecoedschangeLwc
+ ) {
+ System.debug('enter LexConInvoiceViewController.save success');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ coc = cocLwc;
+ HospitalName = HospitalNameLwc;
+ HospitalInfo = HospitalInfoLwc;
+ System.debug('HospitalInfo = ' + HospitalInfo);
+ SecondDealer = SecondDealerLwc;
+ errorMsg = '';
+ deliveryId = deliveryIdLwc;
+ invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class);
+ invoiceId = invoiceIdLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ reopen = reopenLwc;
+ invoiceOrderRecoedschange = (List<InvoiceOrderInfo>) JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class);
+
+ List<String> chukudanID = new List<String>();
+ if (coc.Name == '' || coc.Name == null) {
+ // coc.Name.addError('璇峰綍鍏ュ彂绁ㄥ彿');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄥ彿', '');
+ }
+ if (coc.Invoice_Date__c == null) {
+ // coc.Invoice_Date__c.addError('璇峰綍鍏ュ彂绁ㄦ棩鏈�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄦ棩鏈�', '');
+ }
+ if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) {
+ // coc.addError('蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�', '');
+ }
+ if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) {
+ //coc.addError('璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�');
+ errorMsg += '璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�';
+ }
+ if (HospitalInfo != null && HospitalInfo != '') {
+ if (coc.Order_ForCustomerText__c == null) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else {
+ if (coc.Order_ForCustomerText__c != null) {
+ // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
+ }
+ }
+ String shipmentAccountString = '';
+ if (HospitalInfo != null) {
+ shipmentAccountString = HospitalInfo;
+ } else if (String.isNotEmpty(SecondDealer)) {
+ shipmentAccountString = SecondDealer;
+ } else {
+ shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c;
+ }
+
+ Integer x = 0;
+ List<String> invoiceOrderAccountList = new List<String>();
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (String.isBlank(deliveryId)) {
+ if (ass.check == true) {
+ x++;
+ System.debug(shipmentAccountString);
+ if (HospitalInfo != null && HospitalInfo != '') {
+ if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (String.isNotEmpty(SecondDealer)) {
+ if (
+ ass.esd.Order_ForDealer__c != shipmentAccountString &&
+ ass.esd.Order_ForDealerText__c != shipmentAccountString
+ ) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) {
+ if (
+ (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
+ ass.esd.ShipmentAccount__c != shipmentAccountString
+ ) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ }
+ } else {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + ' ' + shipmentAccountString);
+ if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
+ System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString');
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ //if (String.isNotEmpty(SecondDealer)) {
+ if (String.isNotEmpty(SecondDealer)) {
+ if (ass.esd.Order_ForDealer__c != shipmentAccountString) {
+ System.debug('String.isNotEmpty(SecondDealer) ass.esd.Order_ForHospital__c != shipmentAccountString');
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) {
+ if (
+ (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
+ ass.esd.ShipmentAccount__c != shipmentAccountString
+ ) {
+ System.debug(
+ 'HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'
+ );
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ }
+ }
+ // invoiceOrderAccountList.add('12345');
+ if (invoiceOrderAccountList.size() > 0) {
+ orderRemind = invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒';
+ // coc.addError(invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒', '');
+ } else {
+ orderRemind = '';
+ }
+ if (String.isBlank(deliveryId)) {
+ if (x < 1) {
+ // coc.addError('璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�', '');
+ }
+ }
+ Consumable_order__c invoiceHead = new Consumable_order__c();
+ List<String> outOrderIdList = new List<String>();
+ List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
+ Map<String, String> insertDetMap = new Map<String, String>();
+ Map<String, String> deleteDetMap = new Map<String, String>();
+ //鏂板缓鍙戠エ鏃�
+ Savepoint sp = Database.setSavepoint();
+ try {
+ if (String.isBlank(invoiceId)) {
+ invoiceHead.Name = coc.Name;
+ if (coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c))
+ coc.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_type__c = '鍙戠エ';
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //if (deliveryId != null) {
+ if (String.isNotBlank(deliveryId)) {
+ invoiceHead.Outbound_order__c = deliveryId;
+ }
+ invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // if (SecondDealer == null) {
+ if (String.isBlank(SecondDealer)) {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForDealer__c = SecondDealer;
+ }
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ if(Test.isRunningTest()){
+ invoiceHead.Order_ForHospital__c = null;
+ }
+ insert invoiceHead;
+ invoiceId = invoiceHead.Id;
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ if (cocinfo.size() > 0) {
+ invoiceHead = cocinfo[0];
+ }
+ if (!String.isBlank(deliveryId)) {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ } else {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (!String.isBlank(deliveryId)) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ if (ass.check == true) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ //deleteDetMap.put(ass.esd.Id,invoiceHead.Id);
+ }
+ }
+ }
+ }
+ //鏂板缓鍙戠エ鏄庣粏1
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'deleteDetMap +++++' + deleteDetMap.size()));
+ //return null;
+ if (insertDetMap.size() > 0) {
+ for (String field : insertDetMap.keySet()) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c = :field AND Invoice_Code_link__c = :insertDetMap.get(field)
+ ];
+ if (existLinkinfo.size() < 1) {
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ upsert invoiceLinkList;
+ }
+ } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) {
+ System.debug('杩涘叆reopen');
+ invoiceHead.Name = coc.Name;
+ invoiceHead.Order_type__c = '鍙戠エ';
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //if (deliveryId != null) {
+ if (String.isNotBlank(deliveryId)) {
+ invoiceHead.Outbound_order__c = deliveryId;
+ }
+ invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //if (SecondDealer == null) {
+ if (String.isBlank(SecondDealer)) {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForDealer__c = SecondDealer;
+ }
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ if(Test.isRunningTest()){
+ invoiceHead.Order_ForHospital__c = null;
+ }
+ insert invoiceHead;
+ System.debug('invoiceHead = ' + invoiceHead);
+
+ List<String> updateChukudanId = new List<String>();
+ //鑾峰彇鍘熷彂绁ㄧ浉鍏宠仈鐨勯摼鎺ヨ〃淇℃伅
+ List<Consumable_order_LinkTable__c> tLinkList = [
+ SELECT Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Invoice_Code_link__c = :invoiceId
+ ];
+
+ for (Consumable_order_LinkTable__c colc : tLinkList) {
+ colc.Invoice_Code_link__c = invoiceHead.Id;
+ updateChukudanId.add(colc.Outboundorder_Code_link__c);
+ }
+ System.debug('tLinkList = ' + tLinkList);
+ update tLinkList;
+ //鏇存柊鍙戠エ鏄庣粏淇℃伅
+ //鑾峰彇鍑哄簱鍗�,璁剧疆鍏宠仈鍏崇郴
+ //鑾峰彇鍑哄簱鍗曟槑缁嗕俊鎭�,鍥犱负鍑哄簱鍗曚俊鎭拰鍑哄簱鍗曟槑缁嗕俊鎭槸鍏宠仈鐨�,鎵�鏈夊彧闇�瑕佸洖婊氬嚭搴撳崟鏄庣粏淇℃伅鍗冲彲
+
+ Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> tempCountList = [
+ SELECT
+ Id,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ InvoicedProCost_RMB__c,
+ Invoicedet1_OD_link__c,
+ InvoicedProduct_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_BoxCount__c,
+ Invoice_Unit__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ for (Consumable_Orderdetails__c cocTemp : tempCountList) {
+ cocTemp.Consumable_order__c = invoiceHead.Id;
+ tempCocMap.put(cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c, cocTemp);
+ }
+ System.debug('tempCountList = ' + tempCountList);
+ update tempCountList;
+ List<Consumable_Orderdetails__c> updateFromList = [
+ SELECT
+ Id,
+ Consumable_order__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoice_Unitprice__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ Consumable_order__r.Invoice_total_amount__c,
+ ProductPacking_list_manual__c,
+ InvoicedProduct_RMB__c,
+ Invoiced_BoxCount__c,
+ Shipment_amount__c,
+ Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :updateChukudanId
+ ];
+ for (Consumable_Orderdetails__c corderc : updateFromList) {
+ String tempStr = corderc.Consumable_order__c + corderc.Asset_Model_No__c;
+ if (tempCocMap.get(tempStr) != null) {
+ //璁剧疆宸插彂绁ㄩ噾棰� 鍑哄簱鍗曠殑宸插彂绁ㄩ噾棰� - 鍙戠エ鐨勫彂绁ㄩ噾棰�
+ corderc.InvoicedProCost_RMB__c = corderc.InvoicedProCost_RMB__c - tempCocMap.get(tempStr).InvoicedProduct_RMB__c;
+ //璁剧疆宸插彂绁ㄦ暟閲� 鍑哄簱鍗曠殑宸插彂绁ㄦ暟閲� - 鍙戠エ鐨勫彂绁ㄦ暟閲�(鐩�)
+ corderc.Invoiced_Procount__c = corderc.Invoiced_Procount__c - tempCocMap.get(tempStr).Invoiced_BoxCount__c;
+ //璁剧疆鍙戠エ鍗曚环
+ if (corderc.Box_Piece__c == '鐩�' && corderc.Invoice_Unit__c == '涓�') {
+ corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c / corderc.ProductPacking_list_manual__c;
+ } else {
+ corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c;
+ }
+ }
+ }
+
+ Consumable_order__c tempcoc = new Consumable_order__c();
+ tempcoc.Id = invoiceId;
+ System.debug('tempcoc = ' + tempcoc);
+ delete tempcoc;
+ invoiceId = invoiceHead.Id;
+ System.debug('updateFromList = ' + updateFromList);
+ update updateFromList;
+ //--------------------------------------------------------------------------
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (ass.check == true) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ outOrderIdList.add(ass.esd.Id);
+ deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ }
+ if (outOrderIdList.size() > 0) {
+ getdefaultMapinfo(outOrderIdList);
+ }
+ //琚�変腑鐨勫嚭搴撳崟闆嗗悎
+ if (insertDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
+ List<String> templist2 = new List<String>();
+ for (Consumable_order_LinkTable__c colc : existLinkinfo) {
+ templist2.add(colc.Outboundorder_Code_link__c);
+ }
+ //鑾峰彇璇ュ嚭搴撳崟
+ for (String field : insertDetMap.keySet()) {
+ if (!templist2.contains(field)) {
+ //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
+ chukudanID.add(field);
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ System.debug('invoiceLinkList = ' + invoiceLinkList);
+ upsert invoiceLinkList;
+ }
+ //鍒犻櫎鍑哄簱鍗曢摼鎺ヨ〃
+ if (deleteDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
+ deleteOutboundorder(deleteDetMap, invoiceHead.Id);
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
+ if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
+ //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
+ invoiceLinkdetList.add(colctemp);
+ }
+ }
+ System.debug('invoiceLinkdetList = ' + invoiceLinkdetList);
+ delete invoiceLinkdetList;
+ }
+ //鏂板缓鍙戠エ鏄庣粏1
+ System.debug('===>' + chukudanID);
+ System.debug('===>' + chukudanID.size());
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ } else {
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-04 end
+ //缂栬緫鍚庝繚瀛�
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ if (cocinfo.size() > 0) {
+ invoiceHead = cocinfo[0];
+ }
+ if (String.isNotBlank(deliveryId)) {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+
+ //鎹㈣揣鍗曚骇鍝佹暟閲�
+ Map<String, Decimal> needchangeOrderProcountMap = new Map<String, Decimal>();
+ Map<String, Decimal> returnProcountMap = new Map<String, Decimal>();
+ Map<String, Decimal> changeOrderProcountMap = new Map<String, Decimal>();
+ List<Consumable_Orderdetails__c> detaliFromList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Invoice_Cost_RMB__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :deliveryId
+ ];
+ for (Consumable_Orderdetails__c changeOD : detaliFromList) {
+ needchangeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
+ }
+ //鍙戠エ杩斿搧淇℃伅
+ List<Consumable_Orderdetails__c> returnCountList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Box_Piece__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+
+ for (Consumable_Orderdetails__c changeOD : returnCountList) {
+ if (changeOD.RrturnPro_count__c > 0) {
+ if (returnProcountMap.containsKey(changeOD.Asset_Model_No__c)) {
+ returnProcountMap.put(
+ changeOD.Asset_Model_No__c,
+ returnProcountMap.get(changeOD.Asset_Model_No__c) + changeOD.RrturnPro_count__c
+ );
+ } else {
+ returnProcountMap.put(changeOD.Asset_Model_No__c, changeOD.RrturnPro_count__c);
+ }
+ }
+ }
+
+ //宸叉崲璐у崟鍑哄簱鏁伴噺淇℃伅
+ List<Consumable_Orderdetails__c> returnCount1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Box_Piece__c
+ FROM Consumable_Orderdetails__c
+ WHERE
+ Consumable_order__c IN (
+ SELECT Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Invoice_Code_link__c = :invoiceId
+ )
+ AND Consumable_order__r.Onchange_order__c = TRUE
+ AND Consumable_order__c != :deliveryId
+ ];
+ for (Consumable_Orderdetails__c changeOD : returnCount1List) {
+ changeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
+ }
+ outOrderchange(insertDetMap);
+ } else {
+ invoiceHead.Name = coc.Name;
+ invoiceHead.Invoice_status__c = coc.Invoice_status__c;
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'HospitalName +++++' + HospitalName));
+ //return null;
+ if (HospitalName != null && HospitalName != '') {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForHospital__c = null;
+ }
+ invoiceHead.Order_ForDealer__c = SecondDealer == '' ? null : SecondDealer;
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ update invoiceHead;
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (ass.check == true) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ outOrderIdList.add(ass.esd.Id);
+ deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ }
+ if (outOrderIdList.size() > 0) {
+ getdefaultMapinfo(outOrderIdList);
+ }
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-08 start
+ //琚�変腑鐨勫嚭搴撳崟闆嗗悎
+ if (insertDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
+ List<String> templist2 = new List<String>();
+ for (Consumable_order_LinkTable__c colc : existLinkinfo) {
+ templist2.add(colc.Outboundorder_Code_link__c);
+ }
+ //鑾峰彇璇ュ嚭搴撳崟
+ for (String field : insertDetMap.keySet()) {
+ if (!templist2.contains(field)) {
+ //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
+ chukudanID.add(field);
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ upsert invoiceLinkList;
+ }
+ if (deleteDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
+ deleteOutboundorder(deleteDetMap, invoiceHead.Id);
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
+ if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
+ //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
+ invoiceLinkdetList.add(colctemp);
+ }
+ }
+ delete invoiceLinkdetList;
+ }
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end
+ //鏂板缓鍙戠エ鏄庣粏1
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ // return null;
+ System.debug('Exception ex = ' + ex.getMessage() + ex.getLineNumber());
+ errorMsg += ex.getMessage() + ex.getLineNumber();
+ }
+ data.put('invoiceId', invoiceId);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static void newinvoicedetails1(List<String> chukudanID) {
+ //鏂拌鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
+ //鍑哄簱鍗曟槑缁嗘洿鏂�
+ List<Consumable_Orderdetails__c> outOrderList1 = new List<Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> detaliFromList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Consumable_Product__c,
+ Intra_Trade_List_RMB__c,
+ Dealer_Custom_Price__c,
+ Sum_of_money__c,
+ Box_Piece__c,
+ Used_date__c,
+ Send_date__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :chukudanID AND InvoiceProNot_count__c > 0
+ ];
+
+ for (Integer i = 0; i < detaliFromList.size(); i++) {
+ Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
+ invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c;
+ invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c;
+ String str = string.valueOf(i + 1);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ invoiceInsert1.Name =
+ coc.Name +
+ '-' +
+ detaliFromList[i].Name.substring(detaliFromList[i].Name.length() - 7, detaliFromList[i].Name.length());
+ invoiceInsert1.Shipment_Count__c = detaliFromList[i].InvoiceProNot_count__c;
+ invoiceInsert1.Consumable_Product__c = detaliFromList[i].Consumable_Product__c;
+ invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i].Intra_Trade_List_RMB__c;
+ invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i].Delivery_List_RMB__c;
+ invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i].Dealer_Custom_Price__c;
+ invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+
+ if (detaliFromList[i].Box_Piece__c == '鐩�' && detaliFromList[i].Invoice_Unit__c == '涓�') {
+ invoiceInsert1.Invoice_Unitprice__c =
+ detaliFromList[i].Delivery_List_RMB__c / detaliFromList[i].ProductPacking_list_manual__c;
+ } else {
+ invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i].Delivery_List_RMB__c;
+ }
+ invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c;
+ invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c;
+ if (detaliFromList[i].Invoiced_Procount__c == null)
+ detaliFromList[i].Invoiced_Procount__c = 0;
+ if (detaliFromList[i].RrturnPro_count__c == null)
+ detaliFromList[i].RrturnPro_count__c = 0;
+ invoiceInsert1.Invoiced_Count__c = detaliFromList[i].InvoiceProNot_count__c;
+ if (detaliFromList[i].InvoicedProCost_RMB__c == null)
+ detaliFromList[i].InvoicedProCost_RMB__c = 0;
+ invoiceInsert1.InvoicedProCost_RMB__c = invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c;
+ invoiceInsert1.Consumable_order__c = invoiceId;
+ invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i].Consumable_order__c;
+ invoiceorderList1.add(invoiceInsert1);
+ }
+ System.debug('invoiceorderList1 +++++' + invoiceorderList1.size());
+ Savepoint sp = Database.setSavepoint();
+ System.debug('invoiceorderList1 = ' + invoiceorderList1);
+ if (invoiceorderList1.size() > 0) {
+ try {
+ System.debug('invoiceorderList1 = ' + invoiceorderList1);
+ insert invoiceorderList1;
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ //ApexPages.addMessages(ex);
+ errorMsg += ex.getMessage();
+ }
+ }
+ }
+
+ public static void getdefaultMapinfo(List<String> orderIdList) {
+ List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>();
+ existLinkinfo = [
+ SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :orderIdList
+ ];
+ // for (Integer i = 0; i < existLinkinfo.size(); i++) {
+ // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0);
+ // }
+ }
+
+ public static void deleteOutboundorder(Map<String, String> deleteMap, String value) {
+ //鍒犻櫎鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> detInvoicedet1List = [
+ SELECT Id, Consumable_Shipment_order__c, Consumable_Sale_order__c, Consumable_product__c, Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet()
+ ];
+ System.debug('detInvoicedet1List = ' + detInvoicedet1List);
+ delete detInvoicedet1List;
+ }
+
+ //鎹㈣揣鍗曢摼鎺ヨ〃 鍙戠エ鏄庣粏2鍋氭垚
+ public static void outOrderchange(Map<String, String> insertDetMap) {
+ List<string> chukudanID = new List<string>();
+ List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
+ Consumable_order__c p = new Consumable_order__c();
+ if (insertDetMap.size() > 0) {
for (String field : insertDetMap.keySet()) {
- if (!templist2.contains(field)) {
- //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c = :field
+ ];
+ if (existLinkinfo.size() > 0) {
+ delete existLinkinfo;
+ }
chukudanID.add(field);
Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
invoiceLink.Name = field + insertDetMap.get(field);
invoiceLink.Outboundorder_Code_link__c = field;
invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
invoiceLinkList.add(invoiceLink);
- }
+ p.Id = field;
+ p.ConInvoice_Code__c = insertDetMap.get(field);
+ p.Onchange_order__c = true;
+ update p;
}
- upsert invoiceLinkList;
- }
- if (deleteDetMap.size() > 0) {
- List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
- deleteOutboundorder(deleteDetMap, invoiceHead.Id);
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE
- Outboundorder_Code_link__c IN :deleteDetMap.keySet()
- AND Invoice_Code_link__c = :invoiceHead.Id
- ];
- for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
- if (
- deleteDetMap.get(colctemp.Outboundorder_Code_link__c) ==
- colctemp.Invoice_Code_link__c
- ) {
- //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
- invoiceLinkdetList.add(colctemp);
- }
- }
- delete invoiceLinkdetList;
- }
- //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end
- //鏂板缓鍙戠エ鏄庣粏1
- if (chukudanID.size() > 0) {
- newinvoicedetails1(chukudanID);
- }
+ insert invoiceLinkList;
}
- }
- } catch (Exception ex) {
- Database.rollback(sp);
- // ApexPages.addMessages(ex);
- // return null;
- System.debug('Exception ex = ' + ex.getMessage() + ex.getLineNumber());
- errorMsg += ex.getMessage() + ex.getLineNumber();
- }
- data.put('invoiceId', invoiceId);
- res.status = 'Success';
- res.code = 200;
- res.msg = errorMsg;
- System.debug('res = ' + res);
- return res;
- }
-
- public static void newinvoicedetails1(List<String> chukudanID) {
- //鏂拌鍙戠エ鏄庣粏1
- List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
- //鍑哄簱鍗曟槑缁嗘洿鏂�
- List<Consumable_Orderdetails__c> outOrderList1 = new List<Consumable_Orderdetails__c>();
- List<Consumable_Orderdetails__c> detaliFromList = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Consumable_Product__c,
- Intra_Trade_List_RMB__c,
- Dealer_Custom_Price__c,
- Sum_of_money__c,
- Box_Piece__c,
- Used_date__c,
- Send_date__c,
- Invoice_Unit__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c IN :chukudanID AND InvoiceProNot_count__c > 0
- ];
-
- for (Integer i = 0; i < detaliFromList.size(); i++) {
- Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
- invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c;
- invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c;
- String str = string.valueOf(i + 1);
- if (str.length() == 1) {
- str = '0' + str;
- }
- invoiceInsert1.Name =
- coc.Name +
- '-' +
- detaliFromList[i]
- .Name.substring(
- detaliFromList[i].Name.length() - 7,
- detaliFromList[i].Name.length()
- );
- invoiceInsert1.Shipment_Count__c = detaliFromList[i]
- .InvoiceProNot_count__c;
- invoiceInsert1.Consumable_Product__c = detaliFromList[i]
- .Consumable_Product__c;
- invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i]
- .Intra_Trade_List_RMB__c;
- invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i]
- .Delivery_List_RMB__c;
- invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i]
- .Dealer_Custom_Price__c;
- invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
-
- if (
- detaliFromList[i].Box_Piece__c == '鐩�' &&
- detaliFromList[i].Invoice_Unit__c == '涓�'
- ) {
- invoiceInsert1.Invoice_Unitprice__c =
- detaliFromList[i].Delivery_List_RMB__c /
- detaliFromList[i].ProductPacking_list_manual__c;
- } else {
- invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i]
- .Delivery_List_RMB__c;
- }
- invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c;
- invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c;
- if (detaliFromList[i].Invoiced_Procount__c == null)
- detaliFromList[i].Invoiced_Procount__c = 0;
- if (detaliFromList[i].RrturnPro_count__c == null)
- detaliFromList[i].RrturnPro_count__c = 0;
- invoiceInsert1.Invoiced_Count__c = detaliFromList[i]
- .InvoiceProNot_count__c;
- if (detaliFromList[i].InvoicedProCost_RMB__c == null)
- detaliFromList[i].InvoicedProCost_RMB__c = 0;
- invoiceInsert1.InvoicedProCost_RMB__c =
- invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c;
- invoiceInsert1.Consumable_order__c = invoiceId;
- invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i]
- .Consumable_order__c;
- invoiceorderList1.add(invoiceInsert1);
- }
- System.debug('invoiceorderList1 +++++' + invoiceorderList1.size());
- Savepoint sp = Database.setSavepoint();
- System.debug('invoiceorderList1 = ' + invoiceorderList1);
- if (invoiceorderList1.size() > 0) {
- try {
- System.debug('invoiceorderList1 = ' + invoiceorderList1);
- insert invoiceorderList1;
- } catch (Exception ex) {
- Database.rollback(sp);
- //ApexPages.addMessages(ex);
- errorMsg += ex.getMessage();
- }
- }
- }
-
- public static void getdefaultMapinfo(List<String> orderIdList) {
- List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>();
- existLinkinfo = [
- SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c IN :orderIdList
- ];
- // for (Integer i = 0; i < existLinkinfo.size(); i++) {
- // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0);
- // }
- }
-
- public static void deleteOutboundorder(
- Map<String, String> deleteMap,
- String value
- ) {
- //鍒犻櫎鍙戠エ鏄庣粏1
- List<Consumable_Orderdetails__c> detInvoicedet1List = [
- SELECT
- Id,
- Consumable_Shipment_order__c,
- Consumable_Sale_order__c,
- Consumable_product__c,
- Asset_Model_No__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c = :value
- AND Invoicedet1_OD_link__c = :deleteMap.keySet()
- ];
- System.debug('detInvoicedet1List = ' + detInvoicedet1List);
- delete detInvoicedet1List;
- }
-
- //鎹㈣揣鍗曢摼鎺ヨ〃 鍙戠エ鏄庣粏2鍋氭垚
- public static void outOrderchange(Map<String, String> insertDetMap) {
- List<string> chukudanID = new List<string>();
- List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
- Consumable_order__c p = new Consumable_order__c();
- if (insertDetMap.size() > 0) {
- for (String field : insertDetMap.keySet()) {
- List<Consumable_order_LinkTable__c> existLinkinfo = [
- SELECT Id
- FROM Consumable_order_LinkTable__c
- WHERE Outboundorder_Code_link__c = :field
+ //鎹㈣揣鍑哄簱鍗曟槑缁�1鏇存柊
+ List<Consumable_Orderdetails__c> detaliFrom1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Consumable_Sale_order__r.Name,
+ Consumable_Shipment_order__r.Name
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :chukudanID
];
- if (existLinkinfo.size() > 0) {
- delete existLinkinfo;
+ for (Consumable_Orderdetails__c changeOD : detaliFrom1List) {
+ changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c;
}
- chukudanID.add(field);
- Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
- invoiceLink.Name = field + insertDetMap.get(field);
- invoiceLink.Outboundorder_Code_link__c = field;
- invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
- invoiceLinkList.add(invoiceLink);
- p.Id = field;
- p.ConInvoice_Code__c = insertDetMap.get(field);
- p.Onchange_order__c = true;
- update p;
- }
- insert invoiceLinkList;
+ update detaliFrom1List;
}
- //鎹㈣揣鍑哄簱鍗曟槑缁�1鏇存柊
- List<Consumable_Orderdetails__c> detaliFrom1List = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Invoice_Unit__c,
- Box_Piece__c,
- Consumable_Sale_order__r.Name,
- Consumable_Shipment_order__r.Name
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c IN :chukudanID
- ];
- for (Consumable_Orderdetails__c changeOD : detaliFrom1List) {
- changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c;
+
+ //涓婁紶ContentVersion闄勪欢
+ @AuraEnabled
+ public static String saveFile(Id recordId, String fileName, String base64Data) {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = recordId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ System.debug('cv.Id = ' + cv.Id);
+ return cv.Id;
}
- update detaliFrom1List;
- }
- //涓婁紶ContentVersion闄勪欢
- @AuraEnabled
- public static String saveFile(
- Id recordId,
- String fileName,
- String base64Data
- ) {
- base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
- ContentVersion cv = new ContentVersion();
- cv.Title = fileName;
- cv.PathOnClient = '/' + fileName;
- cv.FirstPublishLocationId = recordId;
- cv.VersionData = EncodingUtil.base64Decode(base64Data);
- cv.IsMajorVersion = true;
- insert cv;
- System.debug('cv.Id = ' + cv.Id);
- return cv.Id;
- }
-
- // 淇濆瓨闄勪欢
- @AuraEnabled
- public static ResponseBodyLWC saveAttachment(
- String attachmentRecoedsLwc,
- String invoiceId
- ) {
- System.debug('杩涘叆 saveAttachment');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- invoiceId = invoiceId;
- attachmentRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(
- attachmentRecoedsLwc,
- List<InvoiceOrderInfo>.class
- );
- System.debug('attachmentRecoeds = ' + attachmentRecoeds);
- try {
- Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c();
- for (InvoiceOrderInfo ass : attachmentRecoeds) {
- if (!String.isBlank(ass.mailSelectOptsin)) {
- attachmentdetails.Id = ass.invoiceOrderId;
- attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId;
- attachmentdetails.Accessories_type__c = ass.mailSelectOptsin;
- if (String.isBlank(ass.invoiceOrderId)) {
- attachmentdetails.Invoice_code__c = invoiceId;
- }
- upsert attachmentdetails;
+ // 淇濆瓨闄勪欢
+ @AuraEnabled
+ public static ResponseBodyLWC saveAttachment(String attachmentRecoedsLwc, String invoiceId) {
+ System.debug('杩涘叆 saveAttachment');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ invoiceId = invoiceId;
+ attachmentRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(attachmentRecoedsLwc, List<InvoiceOrderInfo>.class);
+ System.debug('attachmentRecoeds = ' + attachmentRecoeds);
+ try {
+ Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c();
+ for (InvoiceOrderInfo ass : attachmentRecoeds) {
+ if (!String.isBlank(ass.mailSelectOptsin)) {
+ attachmentdetails.Id = ass.invoiceOrderId;
+ attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId;
+ attachmentdetails.Accessories_type__c = ass.mailSelectOptsin;
+ if (String.isBlank(ass.invoiceOrderId)) {
+ attachmentdetails.Invoice_code__c = invoiceId;
+ }
+ upsert attachmentdetails;
+ }
+ }
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
}
- }
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- // 妫�绱�(鏈紑鍙戠エ鍑哄簱鍗�)
- @AuraEnabled
- public static ResponseBodyLWC InvoiceorderSearch(
- Consumable_order__c cocLwc,
- String invoiceIdLwc,
- String accountidLwc,
- String userWorkLocationLwc,
- String agencyProTypeLwc,
- String HospitalInfoLwc,
- String SecondDealerLwc,
- String invoiceOrderRecoedsLwc
- ) {
- System.debug('杩涘叆 InvoiceorderSearch');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ // 妫�绱�(鏈紑鍙戠エ鍑哄簱鍗�)
+ @AuraEnabled
+ public static ResponseBodyLWC InvoiceorderSearch(
+ Consumable_order__c cocLwc,
+ String invoiceIdLwc,
+ String accountidLwc,
+ String userWorkLocationLwc,
+ String agencyProTypeLwc,
+ String HospitalInfoLwc,
+ String SecondDealerLwc,
+ String invoiceOrderRecoedsLwc
+ ) {
+ System.debug('杩涘叆 InvoiceorderSearch');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- coc = cocLwc;
- HospitalInfo = HospitalInfoLwc;
- SecondDealer = SecondDealerLwc;
- errorMsg = '';
- invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(
- invoiceOrderRecoedsLwc,
- List<InvoiceOrderInfo>.class
- );
- invoiceId = invoiceIdLwc;
- accountid = accountidLwc;
- agencyProType = agencyProTypeLwc;
- userWorkLocation = userWorkLocationLwc;
+ coc = cocLwc;
+ HospitalInfo = HospitalInfoLwc;
+ SecondDealer = SecondDealerLwc;
+ errorMsg = '';
+ invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class);
+ invoiceId = invoiceIdLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
- Map<String, String> invoiceOrderMap = new Map<String, String>();
- String msoql = '';
- List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>();
- if (String.isBlank(invoiceId)) {
- msoql = makeSoql();
- } else {
- msoql = makeSoqlInit();
- }
- invoiceOrderList = new List<Consumable_order__c>();
- invoiceOrderList = Database.query(msoql);
- for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
- if (ass.check == true) {
- invoiceOrderdetailMid.add(ass);
- invoiceOrderMap.put(ass.esd.Name, ass.esd.Name);
- }
- }
- invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
- invoiceOrderRecoeds.addAll(invoiceOrderdetailMid);
- for (Integer i = 0; i < invoiceOrderList.size(); i++) {
- if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) {
- } else {
- invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
- invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name);
- }
- }
- data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- private static String makeSoql() {
- String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
- soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
- soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
- soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
- soql += ' ) ';
- soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
- soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
- soql += ' AND Billed_Status__c != \'鍏ㄩ儴寮�绁╘'';
- soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\'';
- if (HospitalInfo != null && HospitalInfo != '') {
- soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
- }
- if (String.isNotEmpty(SecondDealer)) {
- soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
- }
- if (coc.Order_ForDealerText__c != null) {
- soql +=
- ' AND ShipmentAccount__c = \'' +
- coc.Order_ForDealerText__c +
- '\'';
- }
- soql += ' AND InvoiceNotPro_total_amount__c > 0';
- soql += ' AND Onchange_order__c = false limit 1000';
- return soql;
- }
-
- private static String makeSoqlInit() {
- String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
- soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
- soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
- soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
- soql += ' ) ';
- soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
- soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
- soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\' ';
- if (HospitalInfo != null && HospitalInfo != '') {
- soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
- }
- if (SecondDealer != null) {
- soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
- }
- if (coc.Order_ForDealerText__c != null) {
- soql +=
- ' AND ShipmentAccount__c = \'' +
- coc.Order_ForDealerText__c +
- '\'';
- }
- soql += ' AND InvoiceNotPro_total_amount__c > 0';
- soql += ' AND Onchange_order__c = false limit 1000';
- return soql;
- }
-
- // 鍒犻櫎鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC deleteButton(
- String invoiceIdLwc,
- Consumable_order__c cocLwc
- ) {
- System.debug('杩涘叆 deleteButton');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- coc = cocLwc;
- invoiceId = invoiceIdLwc;
- system.debug('====invoiceId==========>' + invoiceId);
- List<Consumable_Orderdetails__c> consList = [
- SELECT id, Consumable_order__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :invoiceId
- ];
- try {
- system.debug('====cons==========>' + consList);
- delete consList;
- if (coc.id == invoiceId && coc.Invoice_status__c == '鑽夋涓�') {
- delete coc;
- }
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- } catch (Exception e) {
- // ApexPages.addMessages(e);
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + ' ' + e.getLineNumber(),
- ''
- );
- }
- }
-
- // 鎻愪氦鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC approval(
- List<String> outOrderStringListLwc,
- Map<String, Consumable_Orderdetails__c> outordercountMapLwc,
- String invoiceIdLwc
- ) {
- System.debug('杩涘叆 approval');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- outOrderStringList = outOrderStringListLwc;
- outordercountMap = outordercountMapLwc;
- invoiceId = invoiceIdLwc;
- //鏇存柊鍙戠エ鏄庣粏2閾炬帴
- Consumable_order__c P = new Consumable_order__c();
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>();
- //鏇存柊鍑哄簱鍗曟槑缁�1
- List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>();
- //闇�瑕佹洿鏂板嚭搴撳崟鏄庣粏1
- List<Consumable_Orderdetails__c> outOrderdet1List = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_order__r.Name,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Box_Piece__c,
- Invoice_Unit__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c IN :outOrderStringList
- ];
- for (Integer i = 0; i < outOrderdet1List.size(); i++) {
- if (
- outordercountMap.containsKey(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- ) {
- Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c();
- invoiceUpdte1.Id = outOrderdet1List[i].Id;
- invoiceUpdte1.Invoice_Unit__c = outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoice_Unit__c;
- if (
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Box_Piece__c == '鐩�' &&
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoice_Unit__c == '涓�'
- ) {
- Decimal OldinvoicedProcount = 0;
- OldinvoicedProcount = (outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoiced_Count__c /
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .ProductPacking_list_manual__c)
- .setScale(2);
- invoiceUpdte1.Invoiced_Procount__c =
- outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount;
+ Map<String, String> invoiceOrderMap = new Map<String, String>();
+ String msoql = '';
+ List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>();
+ if (String.isBlank(invoiceId)) {
+ msoql = makeSoql();
} else {
- invoiceUpdte1.Invoiced_Procount__c =
- outOrderdet1List[i].Invoiced_Procount__c +
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoiced_Count__c;
+ msoql = makeSoqlInit();
}
- invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get(
- 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;
- if (
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Box_Piece__c == '鐩�' &&
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoice_Unit__c == '涓�'
- ) {
- invoicedProcount = (outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoiced_Count__c /
- outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .ProductPacking_list_manual__c)
- .setScale(2);
- } else {
- invoicedProcount = outordercountMap.get(
- outOrderdet1List[i].Consumable_order__c +
- outOrderdet1List[i].Asset_Model_No__c
- )
- .Invoiced_Count__c;
+ invoiceOrderList = new List<Consumable_order__c>();
+ invoiceOrderList = Database.query(msoql);
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (ass.check == true) {
+ invoiceOrderdetailMid.add(ass);
+ invoiceOrderMap.put(ass.esd.Name, ass.esd.Name);
+ }
}
- System.debug(
- '鍙戠エ鏁伴噺===>' + outOrderdet1List[i].InvoiceProNot_count__c
- );
- System.debug('杩樻病鍙戠エ鏁伴噺===>' + invoicedProcount);
-
- if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.Error,
- // '鍑哄簱鍗�' +
- // outOrderdet1List[i].Consumable_order__r.Name +
- // '涓紝' +
- // outOrderdet1List[i].Asset_Model_No__c +
- // '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧'
- // )
- // );
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍑哄簱鍗�' +
- outOrderdet1List[i].Consumable_order__r.Name +
- '涓紝' +
- outOrderdet1List[i].Asset_Model_No__c +
- '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧',
- ''
- );
+ invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderRecoeds.addAll(invoiceOrderdetailMid);
+ for (Integer i = 0; i < invoiceOrderList.size(); i++) {
+ if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) {
+ } else {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
+ invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name);
+ }
}
+ data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
- outOrderdetUp1List.add(invoiceUpdte1);
- }
+ private static String makeSoql() {
+ String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
+ soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
+ soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
+ soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
+ soql += ' ) ';
+ soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
+ soql += ' AND Billed_Status__c != \'鍏ㄩ儴寮�绁╘'';
+ soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\'';
+ if (HospitalInfo != null && HospitalInfo != '') {
+ soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
+ }
+ if (String.isNotEmpty(SecondDealer)) {
+ soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
+ }
+ if (coc.Order_ForDealerText__c != null) {
+ soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
+ }
+ soql += ' AND InvoiceNotPro_total_amount__c > 0';
+ soql += ' AND Onchange_order__c = false limit 1000';
+ return soql;
}
- Savepoint sp = Database.setSavepoint();
- try {
- //鍑哄簱鍗曟槑缁�1鏇存柊
- if (outOrderdetUp1List.size() > 0) {
- ControllerUtil.updateOrderDetails1Satus(outOrderdetUp1List);
- }
- //鍙戠エ鐘舵�佹洿鏂�
- cocinfo = [
- SELECT
- Id,
- Name,
- Invoice_status__c,
- Dealer_Info__c,
- Order_ForHospital__c,
- SummonsForDirction__c
- FROM Consumable_order__c
- WHERE Id = :invoiceId
- ];
- System.debug('cocinfo = ' + cocinfo);
- if (cocinfo.size() > 0) {
- p = cocinfo[0];
- }
- System.debug('p = ' + p);
- p.Invoice_status__c = '鎻愪氦';
- update p;
- } catch (Exception ex) {
- Database.rollback(sp);
- // ApexPages.addMessages(ex);
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- ex.getMessage() + ' ' + ex.getLineNumber(),
- ''
- );
- }
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- @TestVisible
- class InvoiceOrderInfo implements Comparable {
- @AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Boolean oldCheck { get; set; }
- @AuraEnabled
- public Consumable_order__c esd { get; set; }
- @AuraEnabled
- public Consumable_Orderdetails__c esdet { get; set; }
- @AuraEnabled
- public Attachment attach { get; set; }
- @AuraEnabled
- public ContentVersion cvInfo { get; set; }
- @AuraEnabled
- public String mailSelectOptsin { get; set; }
- public List<SelectOption> mailSelectOpts { get; set; }
- @AuraEnabled
- public Map<String, String> mailSelectOptsMap { get; set; }
- @AuraEnabled
- public String invoiceOrderId { get; set; }
- @AuraEnabled
- public Decimal needInvoiceCount { get; set; }
- // 鍑哄簱璁㈠崟
- public InvoiceOrderInfo(Consumable_order__c e) {
- check = false;
- oldCheck = false;
- esd = e;
- needInvoiceCount = 0;
+ private static String makeSoqlInit() {
+ String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
+ soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
+ soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
+ soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
+ soql += ' ) ';
+ soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
+ soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\' ';
+ if (HospitalInfo != null && HospitalInfo != '') {
+ soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
+ }
+ if (SecondDealer != null) {
+ soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
+ }
+ if (coc.Order_ForDealerText__c != null) {
+ soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
+ }
+ soql += ' AND InvoiceNotPro_total_amount__c > 0';
+ soql += ' AND Onchange_order__c = false limit 1000';
+ return soql;
}
- // 鍑哄簱璁㈠崟鏄庣粏1
- public InvoiceOrderInfo(Consumable_Orderdetails__c e) {
- esdet = e;
+
+ // 鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC deleteButton(String invoiceIdLwc, Consumable_order__c cocLwc) {
+ System.debug('杩涘叆 deleteButton');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ coc = cocLwc;
+ invoiceId = invoiceIdLwc;
+ system.debug('====invoiceId==========>' + invoiceId);
+ List<Consumable_Orderdetails__c> consList = [
+ SELECT id, Consumable_order__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ try {
+ system.debug('====cons==========>' + consList);
+ delete consList;
+ if (coc.id == invoiceId && coc.Invoice_status__c == '鑽夋涓�') {
+ delete coc;
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
+ }
}
- //闄勪欢
- public InvoiceOrderInfo(Attachment e) {
- attach = e;
- mailSelectOpts = new List<SelectOption>();
- mailSelectOpts.add(new SelectOption('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�'));
- mailSelectOpts.add(new SelectOption('鍙戠エ', '鍙戠エ'));
- mailSelectOpts.add(new SelectOption('鏄庣粏', '鏄庣粏'));
+
+ // 鎻愪氦鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC approval(
+ List<String> outOrderStringListLwc,
+ Map<String, Consumable_Orderdetails__c> outordercountMapLwc,
+ String invoiceIdLwc
+ ) {
+ System.debug('杩涘叆 approval');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ outOrderStringList = outOrderStringListLwc;
+ outordercountMap = outordercountMapLwc;
+ invoiceId = invoiceIdLwc;
+ //鏇存柊鍙戠エ鏄庣粏2閾炬帴
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>();
+ //鏇存柊鍑哄簱鍗曟槑缁�1
+ List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>();
+ //闇�瑕佹洿鏂板嚭搴撳崟鏄庣粏1
+ List<Consumable_Orderdetails__c> outOrderdet1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_order__r.Name,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Box_Piece__c,
+ Invoice_Unit__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :outOrderStringList
+ ];
+ for (Integer i = 0; i < outOrderdet1List.size(); i++) {
+ if (outordercountMap.containsKey(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)) {
+ Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c();
+ invoiceUpdte1.Id = outOrderdet1List[i].Id;
+ invoiceUpdte1.Invoice_Unit__c = outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoice_Unit__c;
+ if (
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c ==
+ '鐩�' &&
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c ==
+ '涓�'
+ ) {
+ Decimal OldinvoicedProcount = 0;
+ OldinvoicedProcount = (outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoiced_Count__c /
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .ProductPacking_list_manual__c)
+ .setScale(2);
+ invoiceUpdte1.Invoiced_Procount__c = outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount;
+ } else {
+ invoiceUpdte1.Invoiced_Procount__c =
+ outOrderdet1List[i].Invoiced_Procount__c +
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .Invoiced_Count__c;
+ }
+ invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoice_Unitprice__c;
+ 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;
+ if (
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c ==
+ '鐩�' &&
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c ==
+ '涓�'
+ ) {
+ invoicedProcount = (outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoiced_Count__c /
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .ProductPacking_list_manual__c)
+ .setScale(2);
+ } else {
+ invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .Invoiced_Count__c;
+ }
+ System.debug('鍙戠エ鏁伴噺===>' + outOrderdet1List[i].InvoiceProNot_count__c);
+ System.debug('杩樻病鍙戠エ鏁伴噺===>' + invoicedProcount);
+
+ if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.Error,
+ // '鍑哄簱鍗�' +
+ // outOrderdet1List[i].Consumable_order__r.Name +
+ // '涓紝' +
+ // outOrderdet1List[i].Asset_Model_No__c +
+ // '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧'
+ // )
+ // );
+ // return null;
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '鍑哄簱鍗�' +
+ outOrderdet1List[i].Consumable_order__r.Name +
+ '涓紝' +
+ outOrderdet1List[i].Asset_Model_No__c +
+ '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧',
+ ''
+ );
+ }
+
+ outOrderdetUp1List.add(invoiceUpdte1);
+ }
+ }
+ Savepoint sp = Database.setSavepoint();
+ try {
+ //鍑哄簱鍗曟槑缁�1鏇存柊
+ if (outOrderdetUp1List.size() > 0) {
+ ControllerUtil.updateOrderDetails1Satus(outOrderdetUp1List);
+ }
+ //鍙戠エ鐘舵�佹洿鏂�
+ cocinfo = [
+ SELECT Id, Name, Invoice_status__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ System.debug('cocinfo = ' + cocinfo);
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ System.debug('p = ' + p);
+ p.Invoice_status__c = '鎻愪氦';
+ update p;
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ex.getMessage() + ' ' + ex.getLineNumber(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- //ContentVersion
- public InvoiceOrderInfo(ContentVersion cv) {
- cvInfo = cv;
- mailSelectOptsMap = new Map<String, String>();
- mailSelectOptsMap.put('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�');
- mailSelectOptsMap.put('鍙戠エ', '鍙戠エ');
- mailSelectOptsMap.put('鏄庣粏', '鏄庣粏');
+ @TestVisible
+ class InvoiceOrderInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_order__c esd { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esdet { get; set; }
+ @AuraEnabled
+ public Attachment attach { get; set; }
+ @AuraEnabled
+ public ContentVersion cvInfo { get; set; }
+ @AuraEnabled
+ public String mailSelectOptsin { get; set; }
+ public List<SelectOption> mailSelectOpts { get; set; }
+ @AuraEnabled
+ public Map<String, String> mailSelectOptsMap { get; set; }
+ @AuraEnabled
+ public String invoiceOrderId { get; set; }
+ @AuraEnabled
+ public Decimal needInvoiceCount { get; set; }
+
+ // 鍑哄簱璁㈠崟
+ public InvoiceOrderInfo(Consumable_order__c e) {
+ check = false;
+ oldCheck = false;
+ esd = e;
+ needInvoiceCount = 0;
+ }
+ // 鍑哄簱璁㈠崟鏄庣粏1
+ public InvoiceOrderInfo(Consumable_Orderdetails__c e) {
+ esdet = e;
+ }
+ //闄勪欢
+ public InvoiceOrderInfo(Attachment e) {
+ attach = e;
+ mailSelectOpts = new List<SelectOption>();
+ mailSelectOpts.add(new SelectOption('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�'));
+ mailSelectOpts.add(new SelectOption('鍙戠エ', '鍙戠エ'));
+ mailSelectOpts.add(new SelectOption('鏄庣粏', '鏄庣粏'));
+ }
+ //ContentVersion
+ public InvoiceOrderInfo(ContentVersion cv) {
+ cvInfo = cv;
+ mailSelectOptsMap = new Map<String, String>();
+ mailSelectOptsMap.put('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�');
+ mailSelectOptsMap.put('鍙戠エ', '鍙戠エ');
+ mailSelectOptsMap.put('鏄庣粏', '鏄庣粏');
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
}
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- return null;
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls b/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls
index 132a36a..f6d9e72 100644
--- a/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls
+++ b/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls
@@ -1,4125 +1,2390 @@
@isTest
-private class LexConInvoiceViewControllerTest { //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
- public static user myUser_test;
- public static Account myAccount1;
- public static Account hosp1;
- public static Account agency1;
- public static List<RecordType> rectHos;
- public static Account agency2;
- @testSetup
- static void setupTestData() {
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- //浜岀骇缁忛攢鍟哠econdDealer
- agency1 = new Account(
- name = 'Testhosp001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id
- );
- agency2 = new Account(
- name = 'Testhosp002',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id
- );
- //缁忛攢鍟�
- myAccount1 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert agency1;
- insert agency2;
- insert myAccount1;
- //瀹㈡埛鍚岺ospitalInfo
- hosp1 = new Account(
- name = 'Testhosp001',
- Dealer_discount__c = 10,
- RecordTypeId = rectHos[0].Id
- );
- Account hosp2 = new Account(
- name = 'Testhosp002',
- Dealer_discount__c = 10,
- RecordTypeId = rectHos[0].Id
- );
- insert hosp1;
-
- Dealer_elationship__c dealerelationship = new Dealer_elationship__c(
- Dealer_principal__c = myAccount1.id,
- Dealer_subordinate__c = agency1.id
- );
- insert dealerelationship;
- Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(
- Dealer_principal__c = myAccount1.id,
- Dealer_subordinate__c = agency2.id
- );
- insert dealerelationship1;
-
- Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c(
- Hospital__c = hosp1.id,
- Agency__c = myAccount1.id
- );
- insert agencyHospitalLink1;
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
- }
-
- }
- static testMethod void conInvoiceViewTestedit_1() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
-
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- // invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- System.Test.startTest();
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
-
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = invoiceorder.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3
- };
-
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.saveAttachment(
- JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
- invoiceorder.Id
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- LexConInvoiceViewController.deleteButton(testList1.Id, testList1);
- LexConInvoiceViewController.deleteButton('234567', testList1);
- // LexConInvoiceViewController.saveFile(invoiceorder.Id,'Test','TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K');
- try {
- LexConInvoiceViewController.saveFile(invoiceorder.Id, 'Test', '');
- } catch (Exception e) {
- system.debug('Test');
- }
- LexConInvoiceViewController.outbound = testList2;
- LexConInvoiceViewController.getInvoiceName();
- // LexConInvoiceViewController.shipmentAccount = '222';
- Map<String, Decimal> ordermx1defaultMap = new Map<String, Decimal>();
- LexConInvoiceViewController.ordermx1defaultMap = ordermx1defaultMap;
- Map<String, String> deleteMap = new Map<String, String>();
- LexConInvoiceViewController.deleteOutboundorder(deleteMap, '');
- // LexConInvoiceViewController.invoiceOrderRecoedsCount
- LexConInvoiceViewController.orderby = new List<String>{
- 'Outbound_Date__c',
- 'Name',
- 'ShipmentAccount__c'
- };
- LexConInvoiceViewController.sortKey = 'test';
- LexConInvoiceViewController.preSortKey = 'test';
- LexConInvoiceViewController.sortOrderAsc = false;
- LexConInvoiceViewController.sortOrder = new List<String>{
- 'Outbound_Date__c',
- 'Name',
- 'ShipmentAccount__c'
- };
- List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
- List<String> chukudanID = new List<String>();
- chukudanID.add(testList2.Id);
- chukudanID.add(testList1.Id);
- LexConInvoiceViewController.newinvoicedetails1(chukudanID);
- Map<String, String> insertDetMap = new Map<String, String>();
- insertDetMap.put('Outboundorder_Code_link__c', testList1.Id);
- // LexConInvoiceViewController.outOrderchange(insertDetMap);
- LexConInvoiceViewController.getdefaultMapinfo(chukudanID);
-
- System.Test.stopTest();
- }
- }
-
- //鏂板缓鍙戠エ invoiceId=null
-
- static testMethod void conInvoiceViewTestedit_2() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- // invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- System.Test.startTest();
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
-
- // LexConInvoiceViewController.HospitalInfo = hosp1.id;
- System.Test.stopTest();
- }
- }
- //鏂板缓鍙戠エ invoiceId=null error check
-
- static testMethod void conInvoiceViewTestedit_3() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert new List<Product2__c>{ pro1 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?invoiceId=' +
- invoiceorder.Id +
- '&KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
- System.Test.startTest();
-
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
-
- // LexConInvoiceViewController.init();
-
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- // LexConInvoiceViewController.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- System.debug('===>hosp1.id' + hosp1.id);
- LexConInvoiceViewController.invoiceId = null;
- System.Test.stopTest();
- }
- }
-
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId== NULL and deliveryId== NULL
- static testMethod void conInvoiceViewTestinit() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
-
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
- //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
- //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- //insert new Consumable_order__c[]{testList1,testList2};
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable2',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable2;
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_002001';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Shipment_Count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
-
- //鍑哄簱鍗�2鏄庣粏2
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_002002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList2.id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Shipment_Count__c = 1;
- orderdet4.Consumable_product__c = pro2.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- //闄勪欢
- Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
- caic.Attachment_ID__c = acc.Id;
- caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
- caic.Invoice_code__c = invoiceorder.id;
- insert caic;
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- //contest.deliveryId=testList1.id;
- System.Test.startTest();
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- System.Test.stopTest();
- }
- }
-
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId== NULL and deliveryId<> NULL
- static testMethod void conInvoiceViewTestinit_1() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
- //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
- //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- //insert new Consumable_order__c[]{testList1,testList2};
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable2',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable2;
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_002001';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Shipment_Count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
-
- //鍑哄簱鍗�2鏄庣粏2
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_002002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList2.id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Shipment_Count__c = 1;
- orderdet4.Consumable_product__c = pro2.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- //闄勪欢
- Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
- caic.Attachment_ID__c = acc.Id;
- caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
- caic.Invoice_code__c = invoiceorder.id;
- insert caic;
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?invoiceId=' + invoiceorder.id
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- // contest.deliveryId=testList1.id;
- System.Test.startTest();
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- System.Test.stopTest();
- }
- }
-
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId<> NULL
- static testMethod void conInvoiceViewTestinit_2() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
- //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
- //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- //insert new Consumable_order__c[]{testList1,testList2};
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable2',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable2;
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_002001';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Shipment_Count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
-
- //鍑哄簱鍗�2鏄庣粏2
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_002002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList2.id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Shipment_Count__c = 1;
- orderdet4.Consumable_product__c = pro2.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- //闄勪欢
- Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
- caic.Attachment_ID__c = acc.Id;
- caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
- caic.Invoice_code__c = invoiceorder.id;
- insert caic;
- // PageReference page = new PageReference('/apex/ConInvoiceView?KeyWords=Redirect');
- // page.setRedirect(true);
- // System.Test.setCurrentPage(page);
-
- // ConInvoiceViewController conTest = new ConInvoiceViewController();
- // contest.deliveryId=testList1.id;
- // conTest.invoiceId =invoiceorder.Id;
- System.Test.startTest();
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
-
- // conTest.init();
-
- //System.assertEquals(false, conTest.getdone());
- //System.assertEquals(false, conTest.getExistOutbound());
- //System.assertEquals('invoice01', conTest.getInvoiceName());
- //System.assertEquals(2, conTest.invoiceOrderRecoedsCount);
- // conTest.InvoiceorderSearch();
-
- // conTest.SortLimited();
- System.Test.stopTest();
- }
- }
- static testMethod void conInvoiceViewTestoutOrderchange() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- System.Test.startTest();
- insert testList1;
- insert testList2;
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
-
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- System.Test.stopTest();
- }
- }
-
- static testMethod void conInvoiceViewTestgetdefaultMapinfo() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- // invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- System.Test.startTest();
- insert testList1;
- insert testList2;
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
-
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?invoiceId=' +
- invoiceorder.Id +
- '&KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- System.Test.stopTest();
- }
- }
-
- //浠庡嚭搴撳崟鐩存帴寮�绁�
- static testMethod void conInvoiceViewRedirectTest() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
- //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
- //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- testList1.Order_date__c = Date.today().addDays(2);
- testList2.Order_date__c = Date.today().addDays(2);
- testList1.Deliver_date__c = Date.today();
- testList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- //insert new Consumable_order__c[]{testList1,testList2};
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable2',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable2;
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_002001';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Shipment_Count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
-
- //鍑哄簱鍗�2鏄庣粏2
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_002002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList2.id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Shipment_Count__c = 1;
- orderdet4.Consumable_product__c = pro2.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- //闄勪欢
- Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
- caic.Attachment_ID__c = acc.Id;
- caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
- caic.Invoice_code__c = invoiceorder.id;
- insert caic;
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?deliveryId=' + testList1.Id + '&KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- System.Test.startTest();
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- LexConInvoiceViewController.saveAttachment(
- JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
- invoiceorder.Id
- );
- // LexConInvoiceViewController.saveAttachment(JSON.serialize(caic),invoiceorder.Id);
- System.Test.stopTest();
- }
- }
-
- //鎻愪氦
- static testMethod void conInvoiceViewTestapproval() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false,
- Packing_list_manual__c = 5
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
- //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
- //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- RecordTypeId = System.Label.RT_ConOrder_Sale,
- Dealer_info__c = acc.Id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- RecordTypeId = System.Label.RT_ConOrder_Sale,
- Dealer_info__c = acc.Id
- );
- testList1.Order_date__c = Date.today().addDays(2);
- testList2.Order_date__c = Date.today().addDays(2);
- testList1.Deliver_date__c = Date.today();
- testList2.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- //insert new Consumable_order__c[]{testList1,testList2};
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable2',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable2;
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_Orderdetails__c orderdet1 = new Consumable_Orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Invoiced_Count__c = 10;
- orderdet1.Delivery_List_RMB__c = 200;
- orderdet1.Box_Piece__c = '鐩�';
- orderdet1.Invoice_Unit__c = '涓�';
- // orderdet1.Shipment_Count__c = 50;
- // orderdet1.Invoiced_Procount__c = 5;
- // orderdet1.RrturnPro_count__c = 5;
-
- Consumable_Orderdetails__c orderdet12 = new Consumable_Orderdetails__c();
- orderdet12.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet12.Consumable_order__c = testList1.Id;
- orderdet12.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet12.Consumable_count__c = 1;
- orderdet12.Consumable_product__c = pro1.Id;
- orderdet12.Invoiced_Count__c = 30;
- orderdet12.Delivery_List_RMB__c = 200;
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_Orderdetails__c orderdet2 = new Consumable_Orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = invoiceorder.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_Orderdetails__c orderdet3 = new Consumable_Orderdetails__c();
- orderdet3.Name = 'Test1_002001';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = invoiceorder.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Shipment_Count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
-
- //鍑哄簱鍗�2鏄庣粏2
- Consumable_Orderdetails__c orderdet4 = new Consumable_Orderdetails__c();
- orderdet4.Name = 'Test1_002002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList2.id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Shipment_Count__c = 1;
- orderdet4.Consumable_product__c = pro2.Id;
- insert new List<Consumable_Orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4,
- orderdet12
- };
-
- List<String> conorList = new List<String>();
- conorList.add(testList1.Id);
-
- // List<Consumable_Orderdetails__c> outOrderdet1List1 = new List<Consumable_Orderdetails__c>();
- // outOrderdet1List1.add(orderdet1);
-
- List<Consumable_Orderdetails__c> outOrderdet1List = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_order__r.Name,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Box_Piece__c,
- Invoice_Unit__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Id = :orderdet1.Id
- ];
-
- System.debug('outOrderdet1List' + outOrderdet1List);
- List<Consumable_Orderdetails__c> outOrderdet1List1 = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_order__r.Name,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Box_Piece__c,
- Invoice_Unit__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Id = :orderdet12.Id
- ];
-
- Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>();
- Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
- for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
- if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
- tempCocMap.put(
- cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
- cocTemp
- );
+private class LexConInvoiceViewControllerTest
+{ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
+ public static user myUser_test;
+ public static Account myAccount1;
+ public static Account hosp1;
+ public static Account agency1;
+ public static List<RecordType> rectHos;
+ public static Account agency2;
+ @testSetup
+ static void setupTestData() {
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
}
- }
- for (Consumable_Orderdetails__c cocTemp : outOrderdet1List1) {
- if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
- tempCocMap1.put(
- cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
- cocTemp
- );
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
}
- }
+ //浜岀骇缁忛攢鍟哠econdDealer
+ agency1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
+ agency2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
+ //缁忛攢鍟�
+ myAccount1 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert agency1;
+ insert agency2;
+ insert myAccount1;
+ //瀹㈡埛鍚岺ospitalInfo
+ hosp1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id);
+ Account hosp2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id);
+ insert hosp1;
- System.debug('tempCocMap===>' + tempCocMap);
- //闄勪欢
- Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
- caic.Attachment_ID__c = acc.Id;
- caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
- caic.Invoice_code__c = invoiceorder.id;
- insert caic;
+ Dealer_elationship__c dealerelationship = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency1.id);
+ insert dealerelationship;
+ Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency2.id);
+ insert dealerelationship1;
+
+ Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c(Hospital__c = hosp1.id,Agency__c = myAccount1.id);
+ insert agencyHospitalLink1;
- System.Test.startTest();
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- LexConInvoiceViewController.approval(
- conorList,
- tempCocMap,
- invoiceorder.id
- );
- LexConInvoiceViewController.approval(
- conorList,
- tempCocMap1,
- invoiceorder.id
- );
- System.Test.stopTest();
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c ='閲嶅簡');
+ insert MyUser_Test;
}
- }
- //鎻愪氦鍙戠エ
- static testMethod void conInvoice_approval() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ }
+ static testMethod void conInvoiceViewTestedit_1(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+
- //鍑哄簱鍗�1
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- recordtypeid = System.Label.RT_ConOrder_Sale,
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- // Order_ForHospital__c=hosp1.Id,
- Dealer_Info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- insert testList1;
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001';
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
- orderdet1.Shipment_Count__c = 1;
- orderdet1.Delivery_List_RMB__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Shipment_Count__c = 50;
- orderdet1.Invoiced_Procount__c = 5;
- orderdet1.RrturnPro_count__c = 5;
- insert orderdet1;
- List<String> conorList = new List<String>();
- conorList.add(testList1.Id);
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
- orderdet2.Name = 'Test1_001001';
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- orderdet2.Consumable_Sale_order__c = testList1.Id;
- orderdet2.Deliver_date__c = Date.today();
- orderdet2.Arrive_date__c = Date.today();
- orderdet2.Used_date__c = Date.today();
- orderdet2.Consumable_product__c = pro1.Id;
- insert orderdet2;
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ // invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // invoiceorder.Order_ForHospital__c =hosp1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- insert invoiceorder;
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
- //鍙戠エ鏄庣粏1
- Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
- invoicedet1.Name = 'invoice01_01';
- invoicedet1.Consumable_order__c = invoiceorder.Id;
- invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet1.Invoiced_Count__c = 1;
- invoicedet1.Invoice_Unitprice__c = 1;
- invoicedet1.Consumable_product__c = pro1.Id;
- invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
- insert invoicedet1;
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ System.Test.startTest();
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- List<Consumable_Orderdetails__c> outOrderdet1List = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_order__r.Name,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Box_Piece__c,
- Invoice_Unit__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Id = :orderdet1.Id
- ];
- Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
- for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
- if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
- tempCocMap1.put(
- cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
- cocTemp
- );
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = invoiceorder.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3};
+
+
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ LexConInvoiceViewController.deleteButton(testList1.Id,testList1);
+ LexConInvoiceViewController.deleteButton('234567',testList1);
+ // LexConInvoiceViewController.saveFile(invoiceorder.Id,'Test','TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K');
+ try{
+ LexConInvoiceViewController.saveFile(invoiceorder.Id,'Test','');
+ }catch(Exception e){
+ system.debug('Test');
+
+ }
+ LexConInvoiceViewController.outbound = testList2;
+ LexConInvoiceViewController.getInvoiceName();
+ // LexConInvoiceViewController.shipmentAccount = '222';
+ Map<String, Decimal> ordermx1defaultMap = new Map<String, Decimal>();
+ LexConInvoiceViewController.ordermx1defaultMap = ordermx1defaultMap;
+ Map<String, String> deleteMap = new Map<String, String>();
+ LexConInvoiceViewController.deleteOutboundorder(deleteMap,'');
+ // LexConInvoiceViewController.invoiceOrderRecoedsCount
+ LexConInvoiceViewController.orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
+ LexConInvoiceViewController.sortKey = 'test';
+ LexConInvoiceViewController.preSortKey = 'test';
+ LexConInvoiceViewController.sortOrderAsc = false;
+ LexConInvoiceViewController.sortOrder = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
+ List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
+ List<String> chukudanID = new List<String>();
+ chukudanID.add(testList2.Id);
+ chukudanID.add(testList1.Id);
+ LexConInvoiceViewController.newinvoicedetails1(chukudanID);
+ Map<String, String> insertDetMap = new Map<String, String>();
+ insertDetMap.put('Outboundorder_Code_link__c',testList1.Id);
+ // LexConInvoiceViewController.outOrderchange(insertDetMap);
+ LexConInvoiceViewController.getdefaultMapinfo(chukudanID);
+
+
+
+
+ System.Test.stopTest();
+
}
- }
-
- System.Test.startTest();
-
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- orderdet1.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = acc.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- acc.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- acc.id,
- invoiceOrderRecoeds
- );
- LexConInvoiceViewController.approval(
- conorList,
- tempCocMap1,
- invoiceorder.id
- );
- LexConInvoiceViewController.approval(conorList, tempCocMap1, '2345678');
-
- // conTest.init();
-
- // System.assertEquals(1, conTest.invoiceOrderRecoeds.size());
- // conTest.approval();
- System.Test.stopTest();
}
- }
- //CHAN-BSS5SQ update by rentongxiao 2020-08-26 start
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
- static testMethod void rentestreopen() {
+
+ //鏂板缓鍙戠エ invoiceId=null
+
+ static testMethod void conInvoiceViewTestedit_2(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ // invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+
+ System.Test.startTest();
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+
+
+ // LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ System.Test.stopTest();
+
+ }
+ }
+ //鏂板缓鍙戠エ invoiceId=null error check
+
+ static testMethod void conInvoiceViewTestedit_3(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert new Product2__c[] {pro1};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+
+ PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+ System.Test.startTest();
+
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+
+
+
+ // LexConInvoiceViewController.init();
+
+ LexConInvoiceViewController.invoiceId =invoiceorder.Id;
+ // LexConInvoiceViewController.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ System.debug('===>hosp1.id'+hosp1.id);
+ LexConInvoiceViewController.invoiceId =null;
+ System.Test.stopTest();
+
+
+ }
+ }
+
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId== NULL and deliveryId== NULL
+ static testMethod void conInvoiceViewTestinit(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+ //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ //insert new Consumable_order__c[]{testList1,testList2};
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable2;
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_002001';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Shipment_Count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
+
+ //鍑哄簱鍗�2鏄庣粏2
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test1_002002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList2.id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Shipment_Count__c = 1;
+ orderdet4.Consumable_product__c = pro2.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
+ //闄勪欢
+ Consumable_accessories_invoice__c caic= new Consumable_accessories_invoice__c();
+ caic.Attachment_ID__c = acc.Id;
+ caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
+ caic.Invoice_code__c = invoiceorder.id;
+ insert caic;
+ PageReference page = new PageReference('/apex/ConInvoiceView?KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+
+ //contest.deliveryId=testList1.id;
+ System.Test.startTest();
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ System.Test.stopTest();
+ }
+ }
+
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId== NULL and deliveryId<> NULL
+ static testMethod void conInvoiceViewTestinit_1(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+ //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ //insert new Consumable_order__c[]{testList1,testList2};
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable2;
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_002001';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Shipment_Count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
+
+ //鍑哄簱鍗�2鏄庣粏2
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test1_002002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList2.id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Shipment_Count__c = 1;
+ orderdet4.Consumable_product__c = pro2.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
+ //闄勪欢
+ Consumable_accessories_invoice__c caic= new Consumable_accessories_invoice__c();
+ caic.Attachment_ID__c = acc.Id;
+ caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
+ caic.Invoice_code__c = invoiceorder.id;
+ insert caic;
+ PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.id);
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+
+
+ // contest.deliveryId=testList1.id;
+ System.Test.startTest();
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ System.Test.stopTest();
+
+ }
+ }
+
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エinvoiceId<> NULL
+ static testMethod void conInvoiceViewTestinit_2(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+ //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ //insert new Consumable_order__c[]{testList1,testList2};
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable2;
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_002001';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Shipment_Count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
+
+ //鍑哄簱鍗�2鏄庣粏2
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test1_002002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList2.id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Shipment_Count__c = 1;
+ orderdet4.Consumable_product__c = pro2.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
+ //闄勪欢
+ Consumable_accessories_invoice__c caic= new Consumable_accessories_invoice__c();
+ caic.Attachment_ID__c = acc.Id;
+ caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
+ caic.Invoice_code__c = invoiceorder.id;
+ insert caic;
+ // PageReference page = new PageReference('/apex/ConInvoiceView?KeyWords=Redirect');
+ // page.setRedirect(true);
+ // System.Test.setCurrentPage(page);
+
+ // ConInvoiceViewController conTest = new ConInvoiceViewController();
+ // contest.deliveryId=testList1.id;
+ // conTest.invoiceId =invoiceorder.Id;
+ System.Test.startTest();
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+
+
+
+
+ // conTest.init();
+
+ //System.assertEquals(false, conTest.getdone());
+ //System.assertEquals(false, conTest.getExistOutbound());
+ //System.assertEquals('invoice01', conTest.getInvoiceName());
+ //System.assertEquals(2, conTest.invoiceOrderRecoedsCount);
+ // conTest.InvoiceorderSearch();
+
+ // conTest.SortLimited();
+ System.Test.stopTest();
+
+ }
+ }
+ static testMethod void conInvoiceViewTestoutOrderchange(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ System.Test.startTest();
+ insert testList1;
+ insert testList2;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
+
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ System.Test.stopTest();
+
+ }
+ }
+
+ static testMethod void conInvoiceViewTestgetdefaultMapinfo(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ // invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
+
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ System.Test.startTest();
+ insert testList1;
+ insert testList2;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
+
+ PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+
+
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ System.Test.stopTest();
+ }
+ }
+
+ //浠庡嚭搴撳崟鐩存帴寮�绁�
+ static testMethod void conInvoiceViewRedirectTest(){
user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鎻愪氦';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+ //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ testList1.Order_date__c = Date.today().addDays(2);
+ testList2.Order_date__c = Date.today().addDays(2);
+ testList1.Deliver_date__c = Date.today();
+ testList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ //insert new Consumable_order__c[]{testList1,testList2};
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable2;
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_002001';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Shipment_Count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
- Consumable_order__c testList3 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList3.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- TestList3.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- insert testList3;
- System.Test.startTest();
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList3.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- insert order_LinkTable2;
- insert order_LinkTable3;
+ //鍑哄簱鍗�2鏄庣粏2
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test1_002002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList2.id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Shipment_Count__c = 1;
+ orderdet4.Consumable_product__c = pro2.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
+ //闄勪欢
+ Consumable_accessories_invoice__c caic= new Consumable_accessories_invoice__c();
+ caic.Attachment_ID__c = acc.Id;
+ caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
+ caic.Invoice_code__c = invoiceorder.id;
+ insert caic;
+ PageReference page = new PageReference('/apex/ConInvoiceView?deliveryId='+testList1.Id+'&KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
+
+ System.Test.startTest();
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
-
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test3_001002';
- //orderdet3.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Consumable_product__c = pro1.Id;
- insert orderdet3;
-
- //鍑哄簱鍗�3鏄庣粏1
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test3_001002';
- //orderdet4.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList3.Id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Consumable_product__c = pro1.Id;
- insert orderdet4;
-
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?invoiceId=' +
- invoiceorder.Id +
- '&reopen=isreopen&KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
-
- // ConInvoiceViewController conTest = new ConInvoiceViewController();
-
- // conTest.init();
-
- // conTest.invoiceId =invoiceorder.Id;
- // conTest.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- // conTest.HospitalInfo = hosp1.id;
- // //conTest.SecondDealer = agency1.id;
- // //conTest.coc.Order_ForDealer__c = agency1.id;
- // conTest.coc.Name = 'invoice002';
- // conTest.coc.Order_ForCustomerText__c = 'AA';
- // conTest.coc.Order_ForHospital__c = hosp1.id;
- // conTest.coc.Invoice_Date__c = Date.today();
-
- // //conTest.SortLimited();
- // //conTest.InvoiceorderSearch();
- // System.assertEquals(3, conTest.invoiceOrderRecoeds.size());
- // conTest.invoiceOrderRecoeds[0].esd.Order_ForCustomerText__c = 'AA';
- // conTest.invoiceOrderRecoeds[0].esd.Order_ForHospital__c =hosp1.Id;
- // conTest.invoiceOrderRecoeds[0].esd.Order_ForDealer__c = agency1.id;
-
- // conTest.invoiceOrderRecoeds[1].esd.Order_ForCustomerText__c = 'AA';
- // conTest.invoiceOrderRecoeds[1].esd.Order_ForHospital__c =hosp1.Id;
- // conTest.invoiceOrderRecoeds[1].esd.Order_ForDealer__c = agency1.id;
-
- // conTest.invoiceOrderRecoeds[2].esd.Order_ForCustomerText__c = 'AA';
- // conTest.invoiceOrderRecoeds[2].esd.Order_ForHospital__c =hosp1.Id;
- // conTest.invoiceOrderRecoeds[2].esd.Order_ForDealer__c = agency1.id;
-
- // conTest.invoiceOrderRecoeds[0].check= true;
- // conTest.invoiceOrderRecoeds[1].check= false;
- // conTest.invoiceOrderRecoeds[2].check= true;
-
- // conTest.save();
- // //System.assertEquals('123',conTest.testTmp);
- // conTest.nvoiceorderremind();
- // conTest.saveAttachment();
-
- // conTest.getdone();
- // conTest.getExistOutbound();
- // conTest.getInvoiceName();
- System.Test.stopTest();
- }
- }
-
- //CHAN-BSS5SQ update by rentongxiao 2020-08-26 end
- //CHAN-BSS5SQ update by rentongxiao 2020-08-26 start
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
- static testMethod void rentestreopen001() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鎻愪氦';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- //invoiceorder.Order_ForHospital__c =hosp1.Id;
- //invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList3 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList3.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- TestList3.Deliver_date__c = Date.today();
- insert testList1;
- insert testList2;
- insert testList3;
- System.Test.startTest();
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList2.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList3.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
- insert order_LinkTable2;
- insert order_LinkTable3;
-
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
-
- //鍑哄簱鍗�2鏄庣粏1
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test3_001002';
- //orderdet3.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList2.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Consumable_product__c = pro1.Id;
- insert orderdet3;
-
- //鍑哄簱鍗�3鏄庣粏1
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test3_001002';
- //orderdet4.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList3.Id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Consumable_product__c = pro1.Id;
- insert orderdet4;
-
- PageReference page = new PageReference(
- '/apex/ConInvoiceView?invoiceId=' +
- invoiceorder.Id +
- '&reopen=isreopen&KeyWords=Redirect'
- );
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
-
- LexConInvoiceViewController.init(
- invoiceorder.id,
- 'Redirect',
- testList2.Id
- );
- LexConInvoiceViewController conTest = new LexConInvoiceViewController();
- LexConInvoiceViewController.HospitalInfo = hosp1.id;
- LexConInvoiceViewController.SecondDealer = agency1.id;
- LexConInvoiceViewController.invoiceId = invoiceorder.Id;
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- '娴庡畞浠诲煄鍎掓祹鍖婚櫌',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.InvoiceorderSearch(
- testList1,
- invoiceorder.Id,
- acc.Id,
- '閲嶅簡',
- 'ET',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds
- );
- System.Test.stopTest();
- }
- }
- //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
- static testMethod void allinit() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍑嗗鏁版嵁
- // Consumable_order__c Id = deliveryId //鍑哄簱鍗�
- // Consumable_order__c
- // WHERE Id = :invoiceId AND Order_type__c = '鍙戠エ'
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
-
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // invoiceorder.Order_ForHospital__c =hosp1.Id;
- // invoiceorder.Order_ForDealer__c = agency1.Id;
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- invoiceorder = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :invoiceorder.id
- ];
- //鍑哄簱鍗�
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Order_ForCustomerText__c = ''
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Deliver_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
-
- Consumable_order__c testList3 = new Consumable_order__c();
- testList3.Summons_Sale_Status__c = '鍑鸿揣';
- testList3.SummonsStatus_c__c = '宸插畬鎴�';
- testList3.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- testList3.Order_status__c = '鑽夋涓�';
- testList3.Order_type__c = '浼犵エ';
- testList3.Dealer_info__c = acc.Id;
- testList3.Order_ForCustomerText__c = '娑堝寲绉�';
-
- insert testList1;
- insert testList2;
- insert testList3;
-
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder.Id
- );
- insert order_LinkTable1;
-
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
-
- //鍑哄簱鍗�1鏄庣粏2
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
-
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = invoiceorder.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Consumable_product__c = pro1.Id;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3
- };
-
- //鍙戠エ闄勪欢
- Consumable_accessories_invoice__c cai = new Consumable_accessories_invoice__c();
- cai.Invoice_code__c = invoiceorder.Id;
- insert cai;
-
- System.Test.startTest();
-
- LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
- LexConInvoiceViewController.init('', '', testList1.Id);
- LexConInvoiceViewController.init(invoiceorder.Id, '', '');
- LexConInvoiceViewController.init('', '', '');
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList1.Id
- );
- LexConInvoiceViewController.init('', 'Redirect', '');
- LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
- System.debug(
- 'order==>' + LexConInvoiceViewController.invoiceOrderRecoeds
- );
-
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList2,
- 'Testhosp001',
- '',
- '',
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList3,
- 'Testhosp001',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList2,
- 'Testhosp001',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
-
- //淇濆瓨
- // LexConInvoiceViewController.save(testList1,'娴嬭瘯鍖婚櫌',hosp1.Id,agency1.Id,'',testList1.Id,invoiceorder.Id,myAccount1.Id,'ET');
- System.Test.stopTest();
- }
- }
- static testMethod void allsave() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // invoiceorder.Order_ForHospital__c = '';
- // invoiceorder.Order_ForDealer__c = '';
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- // LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- null,
- null,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.saveAttachment(
- JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
- invoiceorder.Id
- );
- }
- }
- static testMethod void allsave1() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // invoiceorder.Order_ForHospital__c = '';
- // invoiceorder.Order_ForDealer__c = '';
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today(),
- Order_ForCustomerText__c = '娑堝寲绉�'
- );
- insert testList1;
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today(),
- Order_ForDealerText__c = 'Test'
- );
- insert testList2;
-
- LexConInvoiceViewController.init(
- invoiceorder.Id,
- 'Redirect',
- testList2.Id
- );
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- String invoiceOrderRecoeds = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoeds
- );
- List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
- for (
- LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds
- ) {
- ass.check = true;
- test1.add(ass);
- }
- System.debug('test1==>' + test1);
- System.debug(
- 'invoiceOrderRecoedschangeLwc==>' + invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- hosp1.id,
- agency1.id,
- invoiceOrderRecoeds,
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- '',
- '',
- JSON.serialize(test1),
- testList1.Id,
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- 'Testhosp001',
- '',
- '',
- JSON.serialize(test1),
- '',
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- '闈掑矝鐩堟捣鍖婚櫌',
- hosp1.id,
- agency1.id,
- '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
- '',
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- testList1,
- '闈掑矝鐩堟捣鍖婚櫌',
- hosp1.id,
- agency1.id,
- '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
- '',
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- }
- }
-
- static testMethod void allsave2() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice01';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- // invoiceorder.Order_ForHospital__c = '';
- // invoiceorder.Order_ForDealer__c = '';
- invoiceorder.Dealer_Info__c = acc.Id;
- //invoiceorder.Order_ProType__c = 'ET';
- insert invoiceorder;
-
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today(),
- Order_ForDealerText__c = 'Test'
- );
- insert testList2;
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- insert testList1;
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- //閫夋嫨寮�绁ㄥ崟
- LexConInvoiceViewController.save(
- testList2,
- '闈掑矝鐩堟捣鍖婚櫌',
- '',
- agency2.id,
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
- '',
- invoiceorder.Id,
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
+ // LexConInvoiceViewController.saveAttachment(JSON.serialize(caic),invoiceorder.Id);
+ System.Test.stopTest();
+ }
}
- }
+
+ //鎻愪氦
+ static testMethod void conInvoiceViewTestapproval(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false,Packing_list_manual__c = 5);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- static testMethod void allsave3() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+ //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ RecordTypeId = System.Label.RT_ConOrder_Sale,
+ Dealer_info__c=acc.Id);
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ RecordTypeId = System.Label.RT_ConOrder_Sale,
+ Dealer_info__c=acc.Id);
+ testList1.Order_date__c = Date.today().addDays(2);
+ testList2.Order_date__c = Date.today().addDays(2);
+ testList1.Deliver_date__c = Date.today();
+ testList2.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ //insert new Consumable_order__c[]{testList1,testList2};
+
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = '202306164590';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder.Invoice_Note__c = '4444';
- invoiceorder.RecordTypeid = '012100000006JxEAAU';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- insert invoiceorder;
- // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- insert testList2;
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable2;
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_Orderdetails__c orderdet1 = new Consumable_Orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ orderdet1.Invoiced_Count__c = 10;
+ orderdet1.Delivery_List_RMB__c = 200;
+ orderdet1.Box_Piece__c = '鐩�';
+ orderdet1.Invoice_Unit__c = '涓�';
+ // orderdet1.Shipment_Count__c = 50;
+ // orderdet1.Invoiced_Procount__c = 5;
+ // orderdet1.RrturnPro_count__c = 5;
+
- List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = invoiceorder.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Shipment_Count__c = 10;
- orderdet1.Invoiced_Procount__c = 4;
- orderdet1.RrturnPro_count__c = 2;
- conList.add(orderdet1);
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- LexConInvoiceViewController.save(
- invoiceorder,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001g0uyhAAA',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
- '',
- '',
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- LexConInvoiceViewController.save(
- invoiceorder,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001g0uyhAAA',
- agency1.Id,
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
- testList2.Id,
- '',
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
- List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
- for (
- LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds
- ) {
- ass.check = true;
- test1.add(ass);
- }
- System.debug('test1==>' + test1);
- LexConInvoiceViewController.save(
- invoiceorder,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001g0uyhAAA',
- '',
- JSON.serialize(test1),
- '',
- '',
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
+ Consumable_Orderdetails__c orderdet12 = new Consumable_Orderdetails__c();
+ orderdet12.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet12.Consumable_order__c = testList1.Id;
+ orderdet12.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet12.Consumable_count__c = 1;
+ orderdet12.Consumable_product__c = pro1.Id;
+ orderdet12.Invoiced_Count__c = 30;
+ orderdet12.Delivery_List_RMB__c = 200;
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_Orderdetails__c orderdet2 = new Consumable_Orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = invoiceorder.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_Orderdetails__c orderdet3 = new Consumable_Orderdetails__c();
+ orderdet3.Name = 'Test1_002001';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = invoiceorder.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Shipment_Count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
+
+ //鍑哄簱鍗�2鏄庣粏2
+ Consumable_Orderdetails__c orderdet4 = new Consumable_Orderdetails__c();
+ orderdet4.Name = 'Test1_002002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList2.id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Shipment_Count__c = 1;
+ orderdet4.Consumable_product__c = pro2.Id;
+ insert new Consumable_Orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4,orderdet12};
+
+ List<String> conorList = new List<String>();
+ conorList.add(testList1.Id);
+
+ // List<Consumable_Orderdetails__c> outOrderdet1List1 = new List<Consumable_Orderdetails__c>();
+ // outOrderdet1List1.add(orderdet1);
+
+ List<Consumable_Orderdetails__c> outOrderdet1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_order__r.Name,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Id = :orderdet1.Id
+ ];
+
+ System.debug('outOrderdet1List'+outOrderdet1List);
+ List<Consumable_Orderdetails__c> outOrderdet1List1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_order__r.Name,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Id = :orderdet12.Id
+ ];
+
+ Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>();
+ Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
+ for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
+ if(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c!=null){
+ tempCocMap.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
+ }
+ }
+ for (Consumable_Orderdetails__c cocTemp : outOrderdet1List1) {
+ if(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c!=null){
+ tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
+ }
+ }
+
+ System.debug('tempCocMap===>'+tempCocMap);
+ //闄勪欢
+ Consumable_accessories_invoice__c caic= new Consumable_accessories_invoice__c();
+ caic.Attachment_ID__c = acc.Id;
+ caic.Accessories_type__c = '鍙戠エ鍜屾槑缁�';
+ caic.Invoice_code__c = invoiceorder.id;
+ insert caic;
+
+
+ System.Test.startTest();
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ LexConInvoiceViewController.approval(conorList,tempCocMap,invoiceorder.id);
+ LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id);
+ System.Test.stopTest();
+ }
}
- }
+ //鎻愪氦鍙戠エ
+ static testMethod void conInvoice_approval(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- static testMethod void allsave4() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
- Account agency1 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp001'
- LIMIT 1
- ];
- Account agency2 = [
- SELECT Id
- FROM Account
- WHERE name = 'Testhosp002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = '202306164590';
- invoiceorder.Invoice_Date__c = Date.today();
- // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder.Invoice_Note__c = '4444';
- invoiceorder.RecordTypeid = '012100000006JxEAAU';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- insert invoiceorder;
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder1 = new Consumable_order__c();
- invoiceorder1.Name = '202306164590';
- invoiceorder1.Invoice_Date__c = Date.today();
- invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder1.Invoice_Note__c = '4444';
- invoiceorder1.RecordTypeid = '012100000006JxEAAU';
- invoiceorder1.Invoice_status__c = '鑽夋涓�';
- invoiceorder1.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- insert invoiceorder1;
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
- // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- insert testList2;
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- //涓嶉渶瑕佽緭鍏ョ瀹�
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '',
- agency1.Id,
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
- testList2.Id,
- '',
- acc.Id,
- 'ET',
- '',
- invoiceOrderRecoedschangeLwc
- );
+ //鍑哄簱鍗�1
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ recordtypeid = System.Label.RT_ConOrder_Sale,
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ // Order_ForHospital__c=hosp1.Id,
+ Dealer_Info__c = acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ insert testList1;
- //LexConInvoiceViewController.save(invoiceorder,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
- // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder1.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001';
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
+ orderdet1.Shipment_Count__c = 1;
+ orderdet1.Delivery_List_RMB__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ orderdet1.Shipment_Count__c = 50;
+ orderdet1.Invoiced_Procount__c = 5;
+ orderdet1.RrturnPro_count__c = 5;
+ insert orderdet1;
+ List<String> conorList = new List<String>();
+ conorList.add(testList1.Id);
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
+ orderdet2.Name = 'Test1_001001';
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ orderdet2.Consumable_Sale_order__c = testList1.Id;
+ orderdet2.Deliver_date__c = Date.today();
+ orderdet2.Arrive_date__c = Date.today();
+ orderdet2.Used_date__c = Date.today();
+ orderdet2.Consumable_product__c = pro1.Id;
+ insert orderdet2;
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // invoiceorder.Order_ForHospital__c =hosp1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ insert invoiceorder;
+
+ //鍙戠エ鏄庣粏1
+ Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
+ invoicedet1.Name = 'invoice01_01';
+ invoicedet1.Consumable_order__c = invoiceorder.Id;
+ invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ invoicedet1.Invoiced_Count__c = 1;
+ invoicedet1.Invoice_Unitprice__c = 1;
+ invoicedet1.Consumable_product__c = pro1.Id;
+ invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
+ insert invoicedet1;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ List<Consumable_Orderdetails__c> outOrderdet1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_order__r.Name,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Id = :orderdet1.Id
+ ];
+ Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
+ for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
+ if(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c!=null){
+ tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
+ }
+ }
+
+
+ System.Test.startTest();
+
+
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',orderdet1.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = acc.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,acc.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,acc.id,invoiceOrderRecoeds);
+ LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id);
+ LexConInvoiceViewController.approval(conorList,tempCocMap1,'2345678');
+
+
+
+
+
+ // conTest.init();
+
+ // System.assertEquals(1, conTest.invoiceOrderRecoeds.size());
+ // conTest.approval();
+ System.Test.stopTest();
+
+ }
}
- }
- static testMethod void allsave5() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
+ //CHAN-BSS5SQ update by rentongxiao 2020-08-26 start
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
+ static testMethod void rentestreopen(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = '202306164590';
- invoiceorder.Invoice_Date__c = Date.today();
- // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder.Invoice_Note__c = '4444';
- invoiceorder.RecordTypeid = '012100000006JxEAAU';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder);
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder1 = new Consumable_order__c();
- invoiceorder1.Name = '202306164590';
- invoiceorder1.Invoice_Date__c = Date.today();
- invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder1.Invoice_Note__c = '4444';
- invoiceorder1.RecordTypeid = '012100000006JxEAAU';
- invoiceorder1.Invoice_status__c = '鑽夋涓�';
- invoiceorder1.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder1);
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- orderList.add(testList2);
- //鍑哄簱鍗�
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- orderList.add(testList1);
- insert orderList;
- List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = invoiceorder1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Shipment_Count__c = 10;
- orderdet1.Invoiced_Procount__c = 4;
- orderdet1.RrturnPro_count__c = 2;
- conList.add(orderdet1);
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鎻愪氦';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = invoiceorder1.Id
- );
- insert order_LinkTable1;
- Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
- upDateform.Name = 'Test1_001001';
- upDateform.Consumable_order__c = invoiceorder1.Id;
- upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- upDateform.Consumable_count__c = 1;
- upDateform.Consumable_product__c = pro1.Id;
- upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
- conList.add(upDateform);
- insert conList;
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001k1K9ZAAU',
- '',
- '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
- testList1.Id,
- invoiceorder1.Id,
- acc.Id,
- 'ET',
- 'isreopen',
- invoiceOrderRecoedschangeLwc
- );
- // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,'',myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList3.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ TestList3.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ insert testList3;
+ System.Test.startTest();
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ insert order_LinkTable2;
+ insert order_LinkTable3;
+
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
+
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test3_001002';
+ //orderdet3.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Consumable_product__c = pro1.Id;
+ insert orderdet3;
+
+ //鍑哄簱鍗�3鏄庣粏1
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test3_001002';
+ //orderdet4.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList3.Id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Consumable_product__c = pro1.Id;
+ insert orderdet4;
+
+ PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+
+
+
+
+ // ConInvoiceViewController conTest = new ConInvoiceViewController();
+
+ // conTest.init();
+
+ // conTest.invoiceId =invoiceorder.Id;
+ // conTest.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ // conTest.HospitalInfo = hosp1.id;
+ // //conTest.SecondDealer = agency1.id;
+ // //conTest.coc.Order_ForDealer__c = agency1.id;
+ // conTest.coc.Name = 'invoice002';
+ // conTest.coc.Order_ForCustomerText__c = 'AA';
+ // conTest.coc.Order_ForHospital__c = hosp1.id;
+ // conTest.coc.Invoice_Date__c = Date.today();
+
+
+ // //conTest.SortLimited();
+ // //conTest.InvoiceorderSearch();
+ // System.assertEquals(3, conTest.invoiceOrderRecoeds.size());
+ // conTest.invoiceOrderRecoeds[0].esd.Order_ForCustomerText__c = 'AA';
+ // conTest.invoiceOrderRecoeds[0].esd.Order_ForHospital__c =hosp1.Id;
+ // conTest.invoiceOrderRecoeds[0].esd.Order_ForDealer__c = agency1.id;
+
+ // conTest.invoiceOrderRecoeds[1].esd.Order_ForCustomerText__c = 'AA';
+ // conTest.invoiceOrderRecoeds[1].esd.Order_ForHospital__c =hosp1.Id;
+ // conTest.invoiceOrderRecoeds[1].esd.Order_ForDealer__c = agency1.id;
+
+
+ // conTest.invoiceOrderRecoeds[2].esd.Order_ForCustomerText__c = 'AA';
+ // conTest.invoiceOrderRecoeds[2].esd.Order_ForHospital__c =hosp1.Id;
+ // conTest.invoiceOrderRecoeds[2].esd.Order_ForDealer__c = agency1.id;
+
+ // conTest.invoiceOrderRecoeds[0].check= true;
+ // conTest.invoiceOrderRecoeds[1].check= false;
+ // conTest.invoiceOrderRecoeds[2].check= true;
+
+ // conTest.save();
+ // //System.assertEquals('123',conTest.testTmp);
+ // conTest.nvoiceorderremind();
+ // conTest.saveAttachment();
+
+ // conTest.getdone();
+ // conTest.getExistOutbound();
+ // conTest.getInvoiceName();
+ System.Test.stopTest();
+
+ }
}
- }
- static testMethod void allsave6() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
+ //CHAN-BSS5SQ update by rentongxiao 2020-08-26 end
+ //CHAN-BSS5SQ update by rentongxiao 2020-08-26 start
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
+ static testMethod void rentestreopen001(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = '202306164590';
- invoiceorder.Invoice_Date__c = Date.today();
- // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder.Invoice_Note__c = '4444';
- invoiceorder.RecordTypeid = '012100000006JxEAAU';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder);
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder1 = new Consumable_order__c();
- invoiceorder1.Name = '202306164590';
- invoiceorder1.Invoice_Date__c = Date.today();
- invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder1.Invoice_Note__c = '4444';
- invoiceorder1.RecordTypeid = '012100000006JxEAAU';
- invoiceorder1.Invoice_status__c = '鑽夋涓�';
- invoiceorder1.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder1);
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- orderList.add(testList2);
- //鍑哄簱鍗�
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- orderList.add(testList1);
- insert orderList;
- List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- conList.add(orderdet1);
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鎻愪氦';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //invoiceorder.Order_ForHospital__c =hosp1.Id;
+ //invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = invoiceorder1.Id,
- Invoice_Code_link__c = invoiceorder1.Id
- );
- insert order_LinkTable1;
- Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
- upDateform.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- upDateform.Consumable_order__c = invoiceorder1.Id;
- upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- upDateform.Consumable_count__c = 1;
- upDateform.Consumable_product__c = pro1.Id;
- upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
- upDateform.RrturnPro_count__c = 10;
- conList.add(upDateform);
- insert conList;
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001k1K9ZAAU',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
- testList1.Id,
- invoiceorder1.Id,
- acc.Id,
- 'ET',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
- );
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001k1K9ZAAU',
- '',
- '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
- '',
- invoiceorder1.Id,
- acc.Id,
- 'ET',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
- );
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001k1K9ZAAU',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
- '',
- invoiceorder1.Id,
- acc.Id,
- 'ET',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
- );
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+
+ Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList3.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
+ TestList3.Deliver_date__c = Date.today();
+ insert testList1;
+ insert testList2;
+ insert testList3;
+ System.Test.startTest();
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
+ Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+ insert order_LinkTable2;
+ insert order_LinkTable3;
+
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
+
+ //鍑哄簱鍗�2鏄庣粏1
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test3_001002';
+ //orderdet3.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = testList2.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Consumable_product__c = pro1.Id;
+ insert orderdet3;
+
+ //鍑哄簱鍗�3鏄庣粏1
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test3_001002';
+ //orderdet4.Consumable_principal__c = testList2.Id;
+ orderdet4.Consumable_order__c = testList3.Id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Consumable_product__c = pro1.Id;
+ insert orderdet4;
+
+ PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+
+ LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
+ LexConInvoiceViewController conTest = new LexConInvoiceViewController();
+ LexConInvoiceViewController.HospitalInfo = hosp1.id;
+ LexConInvoiceViewController.SecondDealer = agency1.id;
+ LexConInvoiceViewController.invoiceId = invoiceorder.Id;
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'娴庡畞浠诲煄鍎掓祹鍖婚櫌',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'閲嶅簡','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
+ System.Test.stopTest();
+
+ }
}
- }
+ //鏂板缓鍙戠エ 浠ュ強缂栬緫鍙戠エ invoiceId<>null
+ static testMethod void allinit(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ //鍑嗗鏁版嵁
+ // Consumable_order__c Id = deliveryId //鍑哄簱鍗�
+ // Consumable_order__c
+ // WHERE Id = :invoiceId AND Order_type__c = '鍙戠エ'
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // invoiceorder.Order_ForHospital__c =hosp1.Id;
+ // invoiceorder.Order_ForDealer__c = agency1.Id;
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
- static testMethod void allsave7() {
- user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
- Account acc = [
- SELECT Id
- FROM Account
- WHERE name = 'Testaccount002'
- LIMIT 1
- ];
- System.runAs(curUser) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
+ invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ //鍑哄簱鍗�
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = '202306164590';
- invoiceorder.Invoice_Date__c = Date.today();
- // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder.Invoice_Note__c = '4444';
- invoiceorder.RecordTypeid = '012100000006JxEAAU';
- invoiceorder.Invoice_status__c = '鑽夋涓�';
- invoiceorder.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder);
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder1 = new Consumable_order__c();
- invoiceorder1.Name = '202306164590';
- invoiceorder1.Invoice_Date__c = Date.today();
- invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
- invoiceorder1.Invoice_Note__c = '4444';
- invoiceorder1.RecordTypeid = '012100000006JxEAAU';
- invoiceorder1.Invoice_status__c = '鑽夋涓�';
- invoiceorder1.Order_type__c = '鍙戠エ';
- // invoiceorder.Order_ForHospital__c = hosp1.Id;
- orderList.add(invoiceorder1);
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id,
- Invoice_Date__c = Date.today()
- );
- orderList.add(testList2);
- //鍑哄簱鍗�
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = acc.Id
- );
- orderList.add(testList1);
- insert orderList;
- List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
- //鍑哄簱鍗�1鏄庣粏1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- conList.add(orderdet1);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,Order_ForCustomerText__c = '');
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Deliver_date__c = Date.today();
+ TestList2.Deliver_date__c = Date.today();
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = invoiceorder1.Id,
- Invoice_Code_link__c = invoiceorder1.Id
- );
- insert order_LinkTable1;
- Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
- upDateform.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- upDateform.Consumable_order__c = invoiceorder1.Id;
- upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- upDateform.Consumable_count__c = 1;
- upDateform.Consumable_product__c = pro1.Id;
- upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
- upDateform.RrturnPro_count__c = 10;
- conList.add(upDateform);
- insert conList;
- String invoiceOrderRecoedschangeLwc = JSON.serialize(
- LexConInvoiceViewController.invoiceOrderRecoedschange
- );
- LexConInvoiceViewController.save(
- invoiceorder1,
- '娼嶅煄鐜颁唬闂ㄨ瘖閮�',
- '0011000001k1K9ZAAU',
- '',
- '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
- '',
- invoiceorder1.Id,
- acc.Id,
- 'ET',
- '',
- '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
- );
- // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,myAccount1.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ Consumable_order__c testList3 = new Consumable_order__c();
+ testList3.Summons_Sale_Status__c='鍑鸿揣';
+ testList3.SummonsStatus_c__c='宸插畬鎴�';
+ testList3.SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌';
+ testList3.Order_status__c='鑽夋涓�';
+ testList3.Order_type__c='浼犵エ';
+ testList3.Dealer_info__c=acc.Id;
+ testList3.Order_ForCustomerText__c = '娑堝寲绉�';
+
+ insert testList1;
+ insert testList2;
+ insert testList3;
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
+ insert order_LinkTable1;
+
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+
+ //鍑哄簱鍗�1鏄庣粏2
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro1.Id;
+
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_001002';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Consumable_order__c = invoiceorder.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Consumable_product__c = pro1.Id;
+ insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3};
+
+ //鍙戠エ闄勪欢
+ Consumable_accessories_invoice__c cai = new Consumable_accessories_invoice__c();
+ cai.Invoice_code__c = invoiceorder.Id;
+ insert cai;
+
+ System.Test.startTest();
+
+ LexConInvoiceViewController.init(invoiceorder.Id,'',testList1.Id);
+ LexConInvoiceViewController.init('','',testList1.Id);
+ LexConInvoiceViewController.init(invoiceorder.Id,'','');
+ LexConInvoiceViewController.init('','','');
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.init('','Redirect','');
+ LexConInvoiceViewController.init('','Redirect',testList1.Id);
+ System.debug('order==>'+LexConInvoiceViewController.invoiceOrderRecoeds);
+
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList2,'Testhosp001','','',invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList3,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList2,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+
+ //淇濆瓨
+ // LexConInvoiceViewController.save(testList1,'娴嬭瘯鍖婚櫌',hosp1.Id,agency1.Id,'',testList1.Id,invoiceorder.Id,myAccount1.Id,'ET');
+ System.Test.stopTest();
+ }
}
- }
+ static testMethod void allsave(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // invoiceorder.Order_ForHospital__c = '';
+ // invoiceorder.Order_ForDealer__c = '';
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ // LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
+ LexConInvoiceViewController.save(testList1,'Testhosp001',null,null,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
+ }
}
+static testMethod void allsave1(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // invoiceorder.Order_ForHospital__c = '';
+ // invoiceorder.Order_ForDealer__c = '';
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today(),Order_ForCustomerText__c = '娑堝寲绉�');
+ insert testList1;
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test');
+ insert testList2;
+
+
+ LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList2.Id);
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
+ List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
+ for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){
+ ass.check = true;
+ test1.add(ass);
+ }
+ System.debug('test1==>'+test1);
+ System.debug('invoiceOrderRecoedschangeLwc==>'+invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),'',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'闈掑矝鐩堟捣鍖婚櫌',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(testList1,'闈掑矝鐩堟捣鍖婚櫌',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+
+ }
+}
+
+
+static testMethod void allsave2(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice01';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // invoiceorder.Order_ForHospital__c = '';
+ // invoiceorder.Order_ForDealer__c = '';
+ invoiceorder.Dealer_Info__c=acc.Id;
+ //invoiceorder.Order_ProType__c = 'ET';
+ insert invoiceorder;
+
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test');
+ insert testList2;
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ insert testList1;
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ //閫夋嫨寮�绁ㄥ崟
+ LexConInvoiceViewController.save(testList2,'闈掑矝鐩堟捣鍖婚櫌','',agency2.id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ }
+
+}
+
+
+
+static testMethod void allsave3(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='202306164590';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder.Invoice_Note__c = '4444';
+ invoiceorder.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ insert invoiceorder;
+ // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+ insert testList2;
+
+ List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = invoiceorder.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ orderdet1.Shipment_Count__c = 10;
+ orderdet1.Invoiced_Procount__c = 4;
+ orderdet1.RrturnPro_count__c = 2;
+ conList.add(orderdet1);
+
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ LexConInvoiceViewController.save(invoiceorder,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001g0uyhAAA','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]','','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ LexConInvoiceViewController.save(invoiceorder,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001g0uyhAAA',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+
+ List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
+ for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){
+ ass.check = true;
+ test1.add(ass);
+ }
+ System.debug('test1==>'+test1);
+ LexConInvoiceViewController.save(invoiceorder,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001g0uyhAAA','',JSON.serialize(test1),'','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+ }
+
+}
+
+
+static testMethod void allsave4(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ Account hosp1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
+ Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
+ system.runAs(curUser){
+
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='202306164590';
+ invoiceorder.Invoice_Date__c = Date.today();
+ // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder.Invoice_Note__c = '4444';
+ invoiceorder.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ insert invoiceorder;
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder1 = new Consumable_order__c();
+ invoiceorder1.Name='202306164590';
+ invoiceorder1.Invoice_Date__c = Date.today();
+ invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder1.Invoice_Note__c = '4444';
+ invoiceorder1.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder1.Invoice_status__c='鑽夋涓�';
+ invoiceorder1.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ insert invoiceorder1;
+
+
+
+ // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+
+ insert testList2;
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ //涓嶉渶瑕佽緭鍏ョ瀹�
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
+
+
+
+
+ //LexConInvoiceViewController.save(invoiceorder,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+ // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "娼嶅煄鐜颁唬闂ㄨ瘖閮�", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "娼嶅煄鐜颁唬闂ㄨ瘖閮�","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder1.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+
+ }
+}
+
+static testMethod void allsave5(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='202306164590';
+ invoiceorder.Invoice_Date__c = Date.today();
+ // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder.Invoice_Note__c = '4444';
+ invoiceorder.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder);
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder1 = new Consumable_order__c();
+ invoiceorder1.Name='202306164590';
+ invoiceorder1.Invoice_Date__c = Date.today();
+ invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder1.Invoice_Note__c = '4444';
+ invoiceorder1.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder1.Invoice_status__c='鑽夋涓�';
+ invoiceorder1.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder1);
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+ orderList.add(testList2);
+ //鍑哄簱鍗�
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ orderList.add(testList1);
+ insert orderList;
+ List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = invoiceorder1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ orderdet1.Shipment_Count__c = 10;
+ orderdet1.Invoiced_Procount__c = 4;
+ orderdet1.RrturnPro_count__c = 2;
+ conList.add(orderdet1);
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder1.Id);
+ insert order_LinkTable1;
+ Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
+ upDateform.Name = 'Test1_001001';
+ upDateform.Consumable_order__c = invoiceorder1.Id;
+ upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ upDateform.Consumable_count__c = 1;
+ upDateform.Consumable_product__c = pro1.Id;
+ upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
+ conList.add(upDateform);
+ insert conList;
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+ // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,'',myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
+ }
+}
+
+static testMethod void allsave6(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='202306164590';
+ invoiceorder.Invoice_Date__c = Date.today();
+ // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder.Invoice_Note__c = '4444';
+ invoiceorder.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder);
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder1 = new Consumable_order__c();
+ invoiceorder1.Name='202306164590';
+ invoiceorder1.Invoice_Date__c = Date.today();
+ invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder1.Invoice_Note__c = '4444';
+ invoiceorder1.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder1.Invoice_status__c='鑽夋涓�';
+ invoiceorder1.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder1);
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+ orderList.add(testList2);
+ //鍑哄簱鍗�
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ orderList.add(testList1);
+ insert orderList;
+ List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ conList.add(orderdet1);
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id);
+ insert order_LinkTable1;
+ Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
+ upDateform.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ upDateform.Consumable_order__c = invoiceorder1.Id;
+ upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ upDateform.Consumable_count__c = 1;
+ upDateform.Consumable_product__c = pro1.Id;
+ upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
+ upDateform.RrturnPro_count__c = 10;
+ conList.add(upDateform);
+ insert conList;
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ }
+}
+
+static testMethod void allsave7(){
+ user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
+ Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
+ system.runAs(curUser){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02};
+
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='202306164590';
+ invoiceorder.Invoice_Date__c = Date.today();
+ // invoiceorder.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder.Invoice_Note__c = '4444';
+ invoiceorder.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder.Invoice_status__c='鑽夋涓�';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder);
+ //鍙戠エ淇℃伅
+ Consumable_order__c invoiceorder1 = new Consumable_order__c();
+ invoiceorder1.Name='202306164590';
+ invoiceorder1.Invoice_Date__c = Date.today();
+ invoiceorder1.Order_ForCustomerText__c = '娑堝寲绉�';
+ invoiceorder1.Invoice_Note__c = '4444';
+ invoiceorder1.RecordTypeid = '012100000006JxEAAU';
+ invoiceorder1.Invoice_status__c='鑽夋涓�';
+ invoiceorder1.Order_type__c = '鍙戠エ';
+ // invoiceorder.Order_ForHospital__c = hosp1.Id;
+ orderList.add(invoiceorder1);
+ Consumable_order__c testList2 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id,
+ Invoice_Date__c = Date.today());
+ orderList.add(testList2);
+ //鍑哄簱鍗�
+ Consumable_order__c testList1 = new Consumable_order__c(
+ Name='Test1',
+ Summons_Sale_Status__c='鍑鸿揣',
+ SummonsStatus_c__c='宸插畬鎴�',
+ SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',
+ Order_status__c='鑽夋涓�',
+ Order_type__c='浼犵エ',
+ Dealer_info__c=acc.Id);
+ orderList.add(testList1);
+ insert orderList;
+ List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
+ //鍑哄簱鍗�1鏄庣粏1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ conList.add(orderdet1);
+
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id);
+ insert order_LinkTable1;
+ Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
+ upDateform.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ upDateform.Consumable_order__c = invoiceorder1.Id;
+ upDateform.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ upDateform.Consumable_count__c = 1;
+ upDateform.Consumable_product__c = pro1.Id;
+ upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
+ upDateform.RrturnPro_count__c = 10;
+ conList.add(upDateform);
+ insert conList;
+ String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
+ LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ // LexConInvoiceViewController.save(invoiceorder1,'娼嶅煄鐜颁唬闂ㄨ瘖閮�','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,myAccount1.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "闈掑矝鐩堟捣鍖婚櫌","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "杩樻病寮�绁�","Order_ForHospital__r": {"Name": "闈掑矝鐩堟捣鍖婚櫌","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
+ }
+}
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConInvoicedetailsController.cls b/force-app/main/default/classes/LexConInvoicedetailsController.cls
index 58d5e81..b863861 100644
--- a/force-app/main/default/classes/LexConInvoicedetailsController.cls
+++ b/force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -1,511 +1,398 @@
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; }
- //鍑哄簱鍗旾D
- private static String orderId { get; set; }
- //鍙戠エ鍗旾D
- private static String invoiceId { get; set; }
- //鍑哄簱鍗曟槑缁�1锛岀敾闈㈡樉绀轰娇鐢�
- public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records {
- get;
- set;
- }
- //鏄庣粏鏁伴噺
- public static Integer invoiceOrderRecoedsCount {
- get {
- return consumableorderdetails1Records == null
- ? 0
- : consumableorderdetails1Records.size();
- }
- }
-
- //椤甸潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init(String orderIdLwc, String invoiceIdLwc) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- orderId = orderIdLwc;
- invoiceId = invoiceIdLwc;
- consumableorderdetails1Records = new List<ConsumableorderdetailsInfo>();
- sumPrice = 0;
- coc = new Consumable_order__c();
- //鍑哄簱鍗曚俊鎭�
- coc = [
- SELECT Id, Name, Outbound_Date__c, Order_ForDealerText__c, Dealer_Info__c
- FROM Consumable_order__c
- WHERE Id = :orderId
- ];
- //鍙戠エ淇℃伅
- invoicecode = [
- SELECT
- Id,
- Name,
- ShipmentAccount__c,
- Order_ForCustomerText__c,
- Order_ForDealerText__c,
- Dealer_Info__c
- FROM Consumable_order__c
- WHERE Id = :invoiceId
- ];
- //鍙戠エ鏄庣粏1
- Map<String, Consumable_Orderdetails__c> invoiceorderdet1CountMap = new Map<String, Consumable_Orderdetails__c>();
- List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Count__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Invoice_Unit__c,
- Invoicedet1_OD_link__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c = :invoiceId
- AND Invoicedet1_OD_link__c = :orderId
- ];
- for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
- invoiceorderdet1CountMap.put(
- invoiceorderdetails1[i].Asset_Model_No__c,
- invoiceorderdetails1[i]
- );
- }
+ //鍑哄簱鍗旾D
+ private static String orderId { get; set; }
+ //鍙戠エ鍗旾D
+ private static String invoiceId { get; set; }
//鍑哄簱鍗曟槑缁�1锛岀敾闈㈡樉绀轰娇鐢�
- List<Consumable_Orderdetails__c> consumableorderdetails1 = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Count__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Consumable_Product__c,
- Intra_Trade_List_RMB__c,
- Dealer_Custom_Price__c,
- Sum_of_money__c,
- Used_date__c,
- Send_date__c,
- Box_Piece__c,
- Invoice_Unit__c,
- Consumable_Product__r.Packing_list_manual__c,
- ProductPacking_list_manual__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :orderId
- ];
- System.debug('consumableorderdetails1===>' + consumableorderdetails1);
- for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
- consumableorderdetails1Records.add(
- new ConsumableorderdetailsInfo(consumableorderdetails1[i])
- );
+ public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; }
+ //鏄庣粏鏁伴噺
+ public static Integer invoiceOrderRecoedsCount {
+ get {
+ return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size();
+ }
}
- for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
- if (invoiceorderdet1CountMap.containsKey(ass.esd.Asset_Model_No__c)) {
- ass.check = true;
- if (
- invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c)
- .Invoice_Unit__c == null ||
- invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c)
- .Invoice_Unit__c == ''
- ) {
- ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
- } else {
- ass.esd.Invoice_Unit__c = invoiceorderdet1CountMap.get(
- ass.esd.Asset_Model_No__c
- )
- .Invoice_Unit__c;
- }
- if (
- invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c)
- .Invoiced_Count__c == null ||
- invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c)
- .Invoiced_Count__c == 0
- ) {
- ass.invoiceCount = ass.esd.Invoiced_Count__c;
- } else {
- ass.invoiceCount = invoiceorderdet1CountMap.get(
- ass.esd.Asset_Model_No__c
- )
- .Invoiced_Count__c;
- }
- if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
- ass.esd.Invoice_Unitprice__c =
- ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
- } else {
- ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ //椤甸潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String orderIdLwc, String invoiceIdLwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ orderId = orderIdLwc;
+ invoiceId = invoiceIdLwc;
+ consumableorderdetails1Records = new List<ConsumableorderdetailsInfo>();
+ sumPrice = 0;
+ coc = new Consumable_order__c();
+ //鍑哄簱鍗曚俊鎭�
+ coc = [SELECT Id, Name, Outbound_Date__c, Order_ForDealerText__c, Dealer_Info__c FROM Consumable_order__c WHERE Id = :orderId];
+ //鍙戠エ淇℃伅
+ invoicecode = [
+ SELECT Id, Name, ShipmentAccount__c, Order_ForCustomerText__c, Order_ForDealerText__c, Dealer_Info__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ //鍙戠エ鏄庣粏1
+ Map<String, Consumable_Orderdetails__c> invoiceorderdet1CountMap = new Map<String, Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Invoicedet1_OD_link__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId
+ ];
+ for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
+ invoiceorderdet1CountMap.put(invoiceorderdetails1[i].Asset_Model_No__c, invoiceorderdetails1[i]);
}
- Decimal invoiceAllprice = 0.00;
- invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c)
- .setScale(2);
- ass.invoiceAllprice = invoiceAllprice;
- } else {
- ass.invoiceCount = ass.esd.InvoiceProNot_count__c;
- ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
- ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
- }
+ //鍑哄簱鍗曟槑缁�1锛岀敾闈㈡樉绀轰娇鐢�
+ List<Consumable_Orderdetails__c> consumableorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Consumable_Product__c,
+ Intra_Trade_List_RMB__c,
+ Dealer_Custom_Price__c,
+ Sum_of_money__c,
+ Used_date__c,
+ Send_date__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ Consumable_Product__r.Packing_list_manual__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :orderId
+ ];
+ System.debug('consumableorderdetails1===>' + consumableorderdetails1);
+ for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
+ consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ if (invoiceorderdet1CountMap.containsKey(ass.esd.Asset_Model_No__c)) {
+ ass.check = true;
+ if (
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == null ||
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == ''
+ ) {
+ ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
+ } else {
+ ass.esd.Invoice_Unit__c = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c;
+ }
+ if (
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == null ||
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == 0
+ ) {
+ ass.invoiceCount = ass.esd.Invoiced_Count__c;
+ } else {
+ ass.invoiceCount = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c;
+ }
+
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ Decimal invoiceAllprice = 0.00;
+ invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c).setScale(2);
+ ass.invoiceAllprice = invoiceAllprice;
+ } else {
+ ass.invoiceCount = ass.esd.InvoiceProNot_count__c;
+ ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ }
+ data.put('invoicecode', invoicecode);
+ data.put('coc', coc);
+ data.put('consumableorderdetails1Records', consumableorderdetails1Records);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- data.put('invoicecode', invoicecode);
- data.put('coc', coc);
- data.put('consumableorderdetails1Records', consumableorderdetails1Records);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- @AuraEnabled
- public static ResponseBodyLWC save(
- String consumableorderdetails1RecordsLwc,
- String invoiceIdLwc,
- String orderIdLwc
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ @AuraEnabled
+ public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc, String invoiceIdLwc, String orderIdLwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- consumableorderdetails1Records = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetails1RecordsLwc,
- List<ConsumableorderdetailsInfo>.class
- );
- invoiceId = invoiceIdLwc;
- orderId = orderIdLwc;
- System.debug(
- 'consumableorderdetails1Records = ' + consumableorderdetails1Records
- );
- System.debug('invoiceId = ' + invoiceId);
- System.debug('orderId = ' + orderId);
-
- Savepoint sp = Database.setSavepoint();
- //鏂拌鍙戠エ鏄庣粏1
- List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
- //鏇存柊鍙戠エ鏄庣粏1
- List<Consumable_Orderdetails__c> invoiceorderUpList1 = new List<Consumable_Orderdetails__c>();
- //鍒犻櫎鍙戠エ鏄庣粏1
- List<Consumable_Orderdetails__c> invoiceorderDeList1 = new List<Consumable_Orderdetails__c>();
-
- Map<String, Consumable_Orderdetails__c> invoiceordet1Map = new Map<String, Consumable_Orderdetails__c>();
-
- List<String> consumableorderList = new List<String>();
- List<String> consumableNameList = new List<String>();
- try {
- //鏇存柊鍑哄簱鍗曟槑缁�1
- for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
- consumableorderList.add(ass.esd.Asset_Model_No__c);
- }
-
- //鍙戠エ鏄庣粏1鑾峰彇
- List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Count__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_No__c,
- Invoice_Unit__c,
- Box_Piece__c,
- Invoicedet1_OD_link__c
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c = :invoiceId
- AND Invoicedet1_OD_link__c = :orderId
- AND Asset_Model_No__c IN :consumableorderList
- ];
- for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
- invoiceordet1Map.put(
- invoiceorderdetails1[i].Invoicedet1_OD_link__c +
- invoiceorderdetails1[i].Asset_Model_No__c,
- invoiceorderdetails1[i]
+ consumableorderdetails1Records = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetails1RecordsLwc,
+ List<ConsumableorderdetailsInfo>.class
);
- }
- List<Consumable_Orderdetails__c> invoicedetails1count = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Invoicedet1_OD_link__c,
- Asset_Model_No__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Count__c,
- Shipment_Count__c,
- RrturnPro_count__c,
- Delivery_List_RMB__c,
- InvoicedProCost_RMB__c,
- Invoiced_Procount__c,
- Invoiced_Count__c,
- Sum_of_money__c,
- Invoice_Unitprice__c,
- InvoiceProNot_count__c,
- Invoice_Cost_RMB__c,
- Invoice_Unit__c,
- Invoice_No__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :invoiceId
- ];
- Integer invoiceRecordscon = invoicedetails1count.size() + 1;
+ invoiceId = invoiceIdLwc;
+ orderId = orderIdLwc;
+ System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
+ System.debug('invoiceId = ' + invoiceId);
+ System.debug('orderId = ' + orderId);
- for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
- if (ass.check == true && ass.invoiceCount > 0) {
- if (String.isEmpty(String.valueOf(ass.invoiceCount))) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒'));
+ Savepoint sp = Database.setSavepoint();
+ //鏂拌鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
+ //鏇存柊鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderUpList1 = new List<Consumable_Orderdetails__c>();
+ //鍒犻櫎鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderDeList1 = new List<Consumable_Orderdetails__c>();
+
+ Map<String, Consumable_Orderdetails__c> invoiceordet1Map = new Map<String, Consumable_Orderdetails__c>();
+
+ List<String> consumableorderList = new List<String>();
+ List<String> consumableNameList = new List<String>();
+ try {
+ //鏇存柊鍑哄簱鍗曟槑缁�1
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ consumableorderList.add(ass.esd.Asset_Model_No__c);
+ }
+
+ //鍙戠エ鏄庣粏1鑾峰彇
+ List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Invoicedet1_OD_link__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId AND Asset_Model_No__c IN :consumableorderList
+ ];
+ for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
+ invoiceordet1Map.put(
+ invoiceorderdetails1[i].Invoicedet1_OD_link__c + invoiceorderdetails1[i].Asset_Model_No__c,
+ invoiceorderdetails1[i]
+ );
+ }
+ List<Consumable_Orderdetails__c> invoicedetails1count = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Invoicedet1_OD_link__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Sum_of_money__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Invoice_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ Integer invoiceRecordscon = invoicedetails1count.size() + 1;
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ if (ass.check == true && ass.invoiceCount > 0) {
+ if (String.isEmpty(String.valueOf(ass.invoiceCount))) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒', '');
+ }
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ if (ass.invoiceCount > (ass.esd.InvoiceProNot_count__c * ass.Packing_list_manual).setScale(0)) {
+ // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�', '');
+ }
+ } else {
+ if (ass.invoiceCount > ass.esd.InvoiceProNot_count__c) {
+ // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�', '');
+ }
+ }
+
+ //if(ass.esd.Invoice_Unit__c =='涓�'){
+ String invoiceCount = String.valueOf(ass.invoiceCount);
+ if (!Pattern.matches('^\\+{0,1}[1-9]\\d*', invoiceCount)) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�', '');
+ }
+ //}
+
+ if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Shipment_Count__c = ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoiced_Count__c = ass.invoiceCount;
+ //invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Delivery_List_RMB__c * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)
+ .Invoice_Unit__c = ass.esd.Invoice_Unit__c;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Box_Piece__c = ass.esd.Box_Piece__c;
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c =
+ (ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual) * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoice_Unitprice__c =
+ ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c =
+ ass.esd.Delivery_List_RMB__c * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)
+ .Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+
+ invoiceorderUpList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c));
+ invoiceRecordscon++;
+ } else {
+ String str = string.valueOf(invoiceRecordscon);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
+ invoiceInsert1.Used_date__c = ass.esd.Used_date__c;
+ invoiceInsert1.Send_date__c = ass.esd.Send_date__c;
+ invoiceInsert1.Name =
+ invoicecode.Name +
+ '-' +
+ ass.esd.Name.substring(ass.esd.Name.length() - 7, ass.esd.Name.length());
+ invoiceInsert1.Shipment_Count__c = ass.invoiceCount;
+ invoiceInsert1.Consumable_Product__c = ass.esd.Consumable_Product__c;
+ invoiceInsert1.Intra_Trade_List_RMB__c = ass.esd.Intra_Trade_List_RMB__c;
+ invoiceInsert1.Delivery_List_RMB__c = ass.esd.Delivery_List_RMB__c;
+ invoiceInsert1.Dealer_Custom_Price__c = ass.esd.Dealer_Custom_Price__c;
+ invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ //invoiceInsert1.Invoice_Unitprice__c = ass.esd.Invoice_Unitprice__c;
+ invoiceInsert1.Invoice_Unit__c = ass.esd.Invoice_Unit__c;
+ invoiceInsert1.Box_Piece__c = ass.esd.Box_Piece__c;
+ if (ass.esd.Invoiced_Procount__c == null)
+ ass.esd.Invoiced_Procount__c = 0;
+ invoiceInsert1.Invoiced_Count__c = ass.invoiceCount;
+ if (ass.esd.InvoicedProCost_RMB__c == null)
+ ass.esd.InvoicedProCost_RMB__c = 0;
+ invoiceInsert1.InvoicedProCost_RMB__c = ass.invoiceCount * invoiceInsert1.Invoice_Unitprice__c;
+ invoiceInsert1.Consumable_order__c = invoiceId;
+ invoiceInsert1.Invoicedet1_OD_link__c = orderId;
+ invoiceRecordscon++;
+ invoiceorderList1.add(invoiceInsert1);
+ }
+ } else {
+ if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) {
+ invoiceorderDeList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c));
+ }
+ }
+ }
+
+ if (invoiceorderList1.size() > 0) {
+ insert invoiceorderList1;
+ }
+ if (invoiceorderUpList1.size() > 0) {
+ update invoiceorderUpList1;
+ }
+ if (invoiceorderDeList1.size() > 0) {
+ delete invoiceorderDeList1;
+ }
+ } catch (Exception e) {
+ ApexPages.addmessages(e);
+ // Database.rollback(sp);
// return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒', '');
- }
- if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
- if (
- ass.invoiceCount >
- (ass.esd.InvoiceProNot_count__c * ass.Packing_list_manual)
- .setScale(0)
- ) {
- // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�',
- ''
- );
- }
- } else {
- if (ass.invoiceCount > ass.esd.InvoiceProNot_count__c) {
- // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�',
- ''
- );
- }
- }
-
- //if(ass.esd.Invoice_Unit__c =='涓�'){
- String invoiceCount = String.valueOf(ass.invoiceCount);
- if (!Pattern.matches('^\\+{0,1}[1-9]\\d*', invoiceCount)) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�', '');
- }
- //}
-
- if (
- invoiceordet1Map.containsKey(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- ) {
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Shipment_Count__c = ass.invoiceCount;
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Invoiced_Count__c = ass.invoiceCount;
- //invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Delivery_List_RMB__c * ass.invoiceCount;
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Invoice_Unit__c = ass.esd.Invoice_Unit__c;
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Box_Piece__c = ass.esd.Box_Piece__c;
- if (
- ass.esd.Box_Piece__c == '鐩�' &&
- ass.esd.Invoice_Unit__c == '涓�'
- ) {
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .InvoicedProCost_RMB__c =
- (ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual) *
- ass.invoiceCount;
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Invoice_Unitprice__c =
- ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
- } else {
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .InvoicedProCost_RMB__c =
- ass.esd.Delivery_List_RMB__c * ass.invoiceCount;
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- .Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
- }
-
- invoiceorderUpList1.add(
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- );
- invoiceRecordscon++;
- } else {
- String str = string.valueOf(invoiceRecordscon);
- if (str.length() == 1) {
- str = '0' + str;
- }
- Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
- invoiceInsert1.Used_date__c = ass.esd.Used_date__c;
- invoiceInsert1.Send_date__c = ass.esd.Send_date__c;
- invoiceInsert1.Name =
- invoicecode.Name +
- '-' +
- ass.esd.Name.substring(
- ass.esd.Name.length() - 7,
- ass.esd.Name.length()
- );
- invoiceInsert1.Shipment_Count__c = ass.invoiceCount;
- invoiceInsert1.Consumable_Product__c = ass.esd.Consumable_Product__c;
- invoiceInsert1.Intra_Trade_List_RMB__c = ass.esd.Intra_Trade_List_RMB__c;
- invoiceInsert1.Delivery_List_RMB__c = ass.esd.Delivery_List_RMB__c;
- invoiceInsert1.Dealer_Custom_Price__c = ass.esd.Dealer_Custom_Price__c;
- invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- if (
- ass.esd.Box_Piece__c == '鐩�' &&
- ass.esd.Invoice_Unit__c == '涓�'
- ) {
- invoiceInsert1.Invoice_Unitprice__c =
- ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
- } else {
- invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
- }
- //invoiceInsert1.Invoice_Unitprice__c = ass.esd.Invoice_Unitprice__c;
- invoiceInsert1.Invoice_Unit__c = ass.esd.Invoice_Unit__c;
- invoiceInsert1.Box_Piece__c = ass.esd.Box_Piece__c;
- if (ass.esd.Invoiced_Procount__c == null)
- ass.esd.Invoiced_Procount__c = 0;
- invoiceInsert1.Invoiced_Count__c = ass.invoiceCount;
- if (ass.esd.InvoicedProCost_RMB__c == null)
- ass.esd.InvoicedProCost_RMB__c = 0;
- invoiceInsert1.InvoicedProCost_RMB__c =
- ass.invoiceCount * invoiceInsert1.Invoice_Unitprice__c;
- invoiceInsert1.Consumable_order__c = invoiceId;
- invoiceInsert1.Invoicedet1_OD_link__c = orderId;
- invoiceRecordscon++;
- invoiceorderList1.add(invoiceInsert1);
- }
- } else {
- if (
- invoiceordet1Map.containsKey(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- ) {
- invoiceorderDeList1.add(
- invoiceordet1Map.get(
- ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c
- )
- );
- }
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
}
- }
-
- if (invoiceorderList1.size() > 0) {
- insert invoiceorderList1;
- }
- if (invoiceorderUpList1.size() > 0) {
- update invoiceorderUpList1;
- }
- if (invoiceorderDeList1.size() > 0) {
- delete invoiceorderDeList1;
- }
- } catch (Exception e) {
- ApexPages.addmessages(e);
- // Database.rollback(sp);
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + ' ' + e.getLineNumber(),
- ''
- );
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- // Data Bean
- @TestVisible
- class ConsumableorderdetailsInfo {
- @AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Boolean oldCheck { get; set; }
- @AuraEnabled
- public Consumable_Orderdetails__c esd { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Decimal invoiceCount { get; set; }
- @AuraEnabled
- public Decimal invoiceAllprice { get; set; }
- @AuraEnabled
- public Decimal Packing_list_manual { get; set; }
- public List<SelectOption> Invoice_UnitOpts { get; set; }
- @AuraEnabled
- public Map<String, String> Invoice_UnitOptsMap { get; set; }
- // 娑堣�楀搧浜у搧鏄庣粏
- public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
- check = false;
- oldCheck = false;
- esd = e;
- Prod = e.Consumable_Product__r;
- invoiceAllprice = 0;
+ // Data Bean
+ @TestVisible
+ class ConsumableorderdetailsInfo {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal invoiceCount { get; set; }
+ @AuraEnabled
+ public Decimal invoiceAllprice { get; set; }
+ @AuraEnabled
+ public Decimal Packing_list_manual { get; set; }
+ public List<SelectOption> Invoice_UnitOpts { get; set; }
+ @AuraEnabled
+ public Map<String, String> Invoice_UnitOptsMap { get; set; }
+ // 娑堣�楀搧浜у搧鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = false;
+ oldCheck = false;
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ invoiceAllprice = 0;
- Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c;
- if (!Test.isRunningTest()) {
- Invoice_UnitOpts = new List<SelectOption>();
- Invoice_UnitOpts.add(new SelectOption('鐩�', '鐩�'));
- Invoice_UnitOpts.add(new SelectOption('涓�', '涓�'));
- }
+ 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_UnitOptsMap.put('鐩�', '鐩�');
- Invoice_UnitOptsMap.put('涓�', '涓�');
+ Invoice_UnitOptsMap = new Map<String, String>();
+ Invoice_UnitOptsMap.put('鐩�', '鐩�');
+ Invoice_UnitOptsMap.put('涓�', '涓�');
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
index 1ece459..db10c23 100644
--- a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
+++ b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
@@ -1,406 +1,259 @@
@isTest
private class LexConInvoicedetailsControllerTest {
- @isTest
- static void all() {
- User myUser_test;
- Account myAccount1;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- Name = 'testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id
- );
- myAccount2 = new Account(
- Name = 'testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectHos[0].Id
- );
- insert myAccount1;
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
+ @isTest
+ static void all() {
+ User myUser_test;
+ Account myAccount1;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(Name='testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id );
+ myAccount2 = new Account(Name='testaccount002',Dealer_discount__c =20,RecordTypeId = rectHos[0].Id );
+ insert myAccount1;
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
+ Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=2,Manual_Entry__c = false);
+ Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
+ Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
+ Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
+ Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
+ Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
+ insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
+ //鍙戠エ
+ Consumable_order__c invoiceorder = new Consumable_order__c();
+ invoiceorder.Name='invoice02';
+ invoiceorder.Order_type__c = '鍙戠エ';
+ invoiceorder.Invoice_status__c='宸插畬鎴�';
+ invoiceorder.Invoice_Date__c = Date.today();
+ invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ invoiceorder.Dealer_info__c= myAccount1.Id;
+ // createId.Order_ForHospital__c = myAccount2.Id;
+ invoiceorder.SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌';
+ invoiceorder.Order_status__c='鑽夋涓�';
+ insert invoiceorder;
+
+ //鍑哄簱鍗曚俊鎭�
+ //鍑哄簱鍗�
+ Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='鑽夋涓�',Order_type__c='浼犵エ',Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='鍑鸿揣',SummonsStatus_c__c='宸插畬鎴�',SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌',Order_status__c='宸叉彁浜�',Order_type__c='浼犵エ',Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
+ TestList1.Order_date__c = Date.today().addDays(2);
+ TestList2.Order_date__c = Date.today().addDays(2);
+ TestList1.Order_date__c = Date.today();
+ TestList2.Deliver_date__c=Date.today();
+ insert new Consumable_order__c[]{testList1,testList2};
+
+ List<Consumable_Orderdetails__c> invoiceList = new List<Consumable_Orderdetails__c>();
+ //鍙戠エ鏄庣粏1
+ Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
+ invoicedet1.Name = 'invoicetest1_001001';
+ invoicedet1.Consumable_order__c = invoiceorder.id;
+ invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ invoicedet1.Consumable_count__c = 1;
+ invoicedet1.Consumable_product__c = pro1.Id;
+ invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
+ invoicedet1.Box_Piece__c = '鐩�';
+ invoicedet1.Shipment_Count__c = 1;
+ invoicedet1.Invoice_Unitprice__c = 1;
+ invoicedet1.Delivery_List_RMB__c = 1;
+ invoicedet1.InvoicedProCost_RMB__c =1;
+ invoicedet1.Invoice_Unit__c = '涓�';
+ invoicedet1.Invoiced_Procount__c = 3;
+ invoicedet1.RrturnPro_count__c =3;
+ invoiceList.add(invoicedet1);
+
+ Consumable_orderdetails__c invoicedet2 = new Consumable_orderdetails__c();
+ invoicedet2.Name = 'invoiceTest1_001002';
+ invoicedet2.Consumable_order__c = invoiceorder.Id;
+ invoicedet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ invoicedet2.Consumable_count__c = 1;
+ invoicedet2.Consumable_product__c = pro2.Id;
+ invoicedet2.Invoicedet1_OD_link__c = testList2.Id;
+ invoicedet2.Box_Piece__c = '鐩�';
+ invoicedet2.Shipment_Count__c = 1;
+ invoicedet2.Invoice_Unitprice__c = 1;
+ invoicedet2.Delivery_List_RMB__c = 1;
+ invoicedet2.InvoicedProCost_RMB__c =1;
+ invoicedet2.Invoice_Unit__c = '涓�';
+ invoicedet2.Invoiced_Procount__c = 3;
+ invoicedet2.RrturnPro_count__c =3;
+ invoiceList.add(invoicedet2);
+
+ Consumable_orderdetails__c invoicedet3 = new Consumable_orderdetails__c();
+ invoicedet3.Name = 'invoiceTest1_001003';
+ invoicedet3.Consumable_order__c = invoiceorder.Id;
+ invoicedet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ invoicedet3.Consumable_count__c = 1;
+ invoicedet3.Consumable_product__c = pro2.Id;
+ invoicedet3.Invoicedet1_OD_link__c = testList2.Id;
+ invoicedet3.Box_Piece__c = '涓�';
+ invoicedet3.Shipment_Count__c = 1;
+ invoicedet3.Invoice_Unit__c = '鐩�';
+ invoicedet3.Delivery_List_RMB__c = 2.0;
+ invoicedet3.Invoice_Unitprice__c = 1;
+ invoicedet3.InvoicedProCost_RMB__c = 1;
+ invoicedet3.Invoiced_Procount__c = 3;
+ invoicedet3.RrturnPro_count__c =3;
+ invoiceList.add(invoicedet3);
+ insert invoiceList;
+
+ List<Consumable_Orderdetails__c> codList = new List<Consumable_Orderdetails__c>();
+ //鍑哄簱鍗曟槑缁�1
+ Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
+ orderdet1.Name = 'Test1_001001';
+ //orderdet1.Consumable_principal__c = testList1.Id;
+ orderdet1.Consumable_order__c = testList1.Id;
+ orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet1.Consumable_count__c = 1;
+ orderdet1.Consumable_product__c = pro1.Id;
+ orderdet1.Box_Piece__c = '鐩�';
+ orderdet1.Shipment_Count__c = 11;
+ orderdet1.Delivery_List_RMB__c = 2.0;
+ orderdet1.Invoice_Unitprice__c = 1;
+ orderdet1.InvoicedProCost_RMB__c = 1;
+ orderdet1.Invoiced_Procount__c = 3;
+ orderdet1.RrturnPro_count__c =3;
+ orderdet1.Invoice_Unit__c = '涓�';
+ codList.add(orderdet1);
+
+ Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
+ orderdet2.Name = 'Test1_0010011';
+ orderdet2.Consumable_order__c = testList1.Id;
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet2.Consumable_count__c = 1;
+ orderdet2.Consumable_product__c = pro2.Id;
+ orderdet2.Box_Piece__c = '涓�';
+ orderdet2.Shipment_Count__c = 11;
+ orderdet2.Delivery_List_RMB__c = 2.0;
+ orderdet2.Invoice_Unitprice__c = 1;
+ orderdet2.InvoicedProCost_RMB__c = 1;
+ orderdet2.Invoiced_Procount__c = 3;
+ orderdet2.RrturnPro_count__c =3;
+ orderdet2.Invoice_Unit__c = '鐩�';
+ codList.add(orderdet2);
+
+ Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
+ orderdet3.Name = 'Test1_0010012';
+ orderdet3.Consumable_order__c = testList1.Id;
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet3.Consumable_count__c = 1;
+ orderdet3.Consumable_product__c = pro2.Id;
+ orderdet3.Box_Piece__c = '鐩�';
+ orderdet3.Shipment_Count__c = 10;
+ orderdet3.Delivery_List_RMB__c = 2.0;
+ orderdet3.Invoice_Unitprice__c = 1;
+ orderdet3.InvoicedProCost_RMB__c = 1;
+ orderdet3.Invoiced_Procount__c = 3;
+ orderdet3.RrturnPro_count__c =3;
+ orderdet3.Invoice_Unit__c = '涓�';
+ orderdet3.Invoiced_Count__c= 3;
+ codList.add(orderdet3);
+
+
+ Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
+ orderdet4.Name = 'Test1_0010031';
+ orderdet4.Consumable_order__c = testList1.Id;
+ orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet4.Consumable_count__c = 1;
+ orderdet4.Consumable_product__c = pro1.Id;
+ orderdet4.Box_Piece__c = '涓�';
+ orderdet4.Shipment_Count__c = 10;
+ orderdet4.Delivery_List_RMB__c = 2.0;
+ orderdet4.Invoice_Unitprice__c = 1;
+ orderdet4.InvoicedProCost_RMB__c = 1;
+ orderdet4.Invoiced_Procount__c = 3;
+ orderdet4.RrturnPro_count__c =3;
+ orderdet4.Invoice_Unit__c = '鐩�';
+ orderdet4.Invoiced_Count__c= 3;
+ codList.add(orderdet4);
+
+ Consumable_orderdetails__c orderdet5 = new Consumable_orderdetails__c();
+ orderdet5.Name = 'Test1_001002';
+ orderdet5.Consumable_order__c = testList1.Id;
+ orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet5.Consumable_count__c = 1;
+ orderdet5.Box_Piece__c = '鐩�';
+ orderdet5.Consumable_product__c = pro2.Id;
+ orderdet5.Invoice_Unit__c = '涓�';
+ orderdet5.Shipment_Count__c = 11;
+ orderdet5.Delivery_List_RMB__c = 2.0;
+ orderdet5.Invoiced_Procount__c = 3;
+ orderdet5.RrturnPro_count__c =3;
+ orderdet5.Invoiced_Count__c= 3;
+ codList.add(orderdet5);
+
+ Consumable_orderdetails__c orderdet6 = new Consumable_orderdetails__c();
+ orderdet6.Name = 'Test1_001003';
+ orderdet6.Consumable_order__c = testList1.Id;
+ orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet6.Consumable_count__c = 1;
+ orderdet6.Box_Piece__c = '鐩�';
+ orderdet6.Consumable_product__c = pro1.Id;
+ orderdet6.Invoice_Unit__c = '鐩�';
+ orderdet6.Shipment_Count__c = 11;
+ orderdet6.Delivery_List_RMB__c = 2.0;
+ orderdet6.Invoiced_Procount__c = 3;
+ orderdet6.RrturnPro_count__c =3;
+ orderdet6.Invoiced_Count__c= 3;
+ codList.add(orderdet6);
+
+ Consumable_orderdetails__c orderdet7 = new Consumable_orderdetails__c();
+ orderdet7.Name = 'Test1_001004';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet7.Consumable_order__c = testList1.Id;
+ orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet7.Consumable_count__c = 1;
+ orderdet7.Box_Piece__c = '鐩�';
+ orderdet7.Consumable_product__c = pro2.Id;
+ orderdet7.Invoice_Unit__c = '涓�';
+ orderdet7.Shipment_Count__c = 11;
+ orderdet7.Delivery_List_RMB__c = 2.0;
+ orderdet7.Invoiced_Procount__c = 3;
+ orderdet7.Invoiced_Count__c= 3;
+ orderdet7.RrturnPro_count__c =3;
+ codList.add(orderdet7);
+ insert codList;
+
+ LexConInvoicedetailsController.init(testList1.Id,invoiceorder.Id);
+ //搴忓垪鍖朖son
+
+
+ System.Test.startTest();
+ System.debug('===>鏁版嵁'+LexConInvoicedetailsController.consumableorderdetails1Records);
+ List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList = LexConInvoicedetailsController.consumableorderdetails1Records;
+ LexConInvoicedetailsController.save(JSON.serialize(LexConInvoicedetailsController.consumableorderdetails1Records),invoiceorder.Id,testList1.Id);
+
+ List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList1 = new List<LexConInvoicedetailsController.ConsumableorderdetailsInfo>();
+ for(LexConInvoicedetailsController.ConsumableorderdetailsInfo ass:inList){
+ ass.check= true;
+ ass.invoiceCount= 1;
+ ass.esd.Invoice_Unit__c = '涓�';
+ inList1.add(ass);
+ }
+ LexConInvoicedetailsController.save(JSON.serialize(inList1),invoiceorder.Id,testList1.Id);
+ System.Test.stopTest();
+
+ }
}
- System.runAs(myUser_test) {
- //浜у搧淇℃伅
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 2,
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test06',
- ProductCode = 'Test06',
- Asset_Model_No__c = 'Test06',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{
- prod01,
- prod02,
- prod03,
- prod04,
- prod05,
- prod06
- };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod03.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod04.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod05.Id
- );
- Product2__c pro6 = new Product2__c(
- Name = 'Pro006',
- OT_CODE_Text__c = 'Test006',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
- //鍙戠エ
- Consumable_order__c invoiceorder = new Consumable_order__c();
- invoiceorder.Name = 'invoice02';
- invoiceorder.Order_type__c = '鍙戠エ';
- invoiceorder.Invoice_status__c = '宸插畬鎴�';
- invoiceorder.Invoice_Date__c = Date.today();
- invoiceorder.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- invoiceorder.Dealer_info__c = myAccount1.Id;
- // createId.Order_ForHospital__c = myAccount2.Id;
- invoiceorder.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- invoiceorder.Order_status__c = '鑽夋涓�';
- insert invoiceorder;
-
- //鍑哄簱鍗曚俊鎭�
- //鍑哄簱鍗�
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = myAccount1.Id,
- ConInvoice_Code__c = invoiceorder.id
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'Test2',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = myAccount1.Id,
- ConInvoice_Code__c = invoiceorder.id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Order_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert new List<Consumable_order__c>{ testList1, testList2 };
-
- List<Consumable_Orderdetails__c> invoiceList = new List<Consumable_Orderdetails__c>();
- //鍙戠エ鏄庣粏1
- Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
- invoicedet1.Name = 'invoicetest1_001001';
- invoicedet1.Consumable_order__c = invoiceorder.id;
- invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet1.Consumable_count__c = 1;
- invoicedet1.Consumable_product__c = pro1.Id;
- invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
- invoicedet1.Box_Piece__c = '鐩�';
- invoicedet1.Shipment_Count__c = 1;
- invoicedet1.Invoice_Unitprice__c = 1;
- invoicedet1.Delivery_List_RMB__c = 1;
- invoicedet1.InvoicedProCost_RMB__c = 1;
- invoicedet1.Invoice_Unit__c = '涓�';
- invoicedet1.Invoiced_Procount__c = 3;
- invoicedet1.RrturnPro_count__c = 3;
- invoiceList.add(invoicedet1);
-
- Consumable_orderdetails__c invoicedet2 = new Consumable_orderdetails__c();
- invoicedet2.Name = 'invoiceTest1_001002';
- invoicedet2.Consumable_order__c = invoiceorder.Id;
- invoicedet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet2.Consumable_count__c = 1;
- invoicedet2.Consumable_product__c = pro2.Id;
- invoicedet2.Invoicedet1_OD_link__c = testList2.Id;
- invoicedet2.Box_Piece__c = '鐩�';
- invoicedet2.Shipment_Count__c = 1;
- invoicedet2.Invoice_Unitprice__c = 1;
- invoicedet2.Delivery_List_RMB__c = 1;
- invoicedet2.InvoicedProCost_RMB__c = 1;
- invoicedet2.Invoice_Unit__c = '涓�';
- invoicedet2.Invoiced_Procount__c = 3;
- invoicedet2.RrturnPro_count__c = 3;
- invoiceList.add(invoicedet2);
-
- Consumable_orderdetails__c invoicedet3 = new Consumable_orderdetails__c();
- invoicedet3.Name = 'invoiceTest1_001003';
- invoicedet3.Consumable_order__c = invoiceorder.Id;
- invoicedet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet3.Consumable_count__c = 1;
- invoicedet3.Consumable_product__c = pro2.Id;
- invoicedet3.Invoicedet1_OD_link__c = testList2.Id;
- invoicedet3.Box_Piece__c = '涓�';
- invoicedet3.Shipment_Count__c = 1;
- invoicedet3.Invoice_Unit__c = '鐩�';
- invoicedet3.Delivery_List_RMB__c = 2.0;
- invoicedet3.Invoice_Unitprice__c = 1;
- invoicedet3.InvoicedProCost_RMB__c = 1;
- invoicedet3.Invoiced_Procount__c = 3;
- invoicedet3.RrturnPro_count__c = 3;
- invoiceList.add(invoicedet3);
- insert invoiceList;
-
- List<Consumable_Orderdetails__c> codList = new List<Consumable_Orderdetails__c>();
- //鍑哄簱鍗曟槑缁�1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Box_Piece__c = '鐩�';
- orderdet1.Shipment_Count__c = 11;
- orderdet1.Delivery_List_RMB__c = 2.0;
- orderdet1.Invoice_Unitprice__c = 1;
- orderdet1.InvoicedProCost_RMB__c = 1;
- orderdet1.Invoiced_Procount__c = 3;
- orderdet1.RrturnPro_count__c = 3;
- orderdet1.Invoice_Unit__c = '涓�';
- codList.add(orderdet1);
-
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_0010011';
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro2.Id;
- orderdet2.Box_Piece__c = '涓�';
- orderdet2.Shipment_Count__c = 11;
- orderdet2.Delivery_List_RMB__c = 2.0;
- orderdet2.Invoice_Unitprice__c = 1;
- orderdet2.InvoicedProCost_RMB__c = 1;
- orderdet2.Invoiced_Procount__c = 3;
- orderdet2.RrturnPro_count__c = 3;
- orderdet2.Invoice_Unit__c = '鐩�';
- codList.add(orderdet2);
-
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_0010012';
- orderdet3.Consumable_order__c = testList1.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Consumable_product__c = pro2.Id;
- orderdet3.Box_Piece__c = '鐩�';
- orderdet3.Shipment_Count__c = 10;
- orderdet3.Delivery_List_RMB__c = 2.0;
- orderdet3.Invoice_Unitprice__c = 1;
- orderdet3.InvoicedProCost_RMB__c = 1;
- orderdet3.Invoiced_Procount__c = 3;
- orderdet3.RrturnPro_count__c = 3;
- orderdet3.Invoice_Unit__c = '涓�';
- orderdet3.Invoiced_Count__c = 3;
- codList.add(orderdet3);
-
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_0010031';
- orderdet4.Consumable_order__c = testList1.Id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Consumable_product__c = pro1.Id;
- orderdet4.Box_Piece__c = '涓�';
- orderdet4.Shipment_Count__c = 10;
- orderdet4.Delivery_List_RMB__c = 2.0;
- orderdet4.Invoice_Unitprice__c = 1;
- orderdet4.InvoicedProCost_RMB__c = 1;
- orderdet4.Invoiced_Procount__c = 3;
- orderdet4.RrturnPro_count__c = 3;
- orderdet4.Invoice_Unit__c = '鐩�';
- orderdet4.Invoiced_Count__c = 3;
- codList.add(orderdet4);
-
- Consumable_orderdetails__c orderdet5 = new Consumable_orderdetails__c();
- orderdet5.Name = 'Test1_001002';
- orderdet5.Consumable_order__c = testList1.Id;
- orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet5.Consumable_count__c = 1;
- orderdet5.Box_Piece__c = '鐩�';
- orderdet5.Consumable_product__c = pro2.Id;
- orderdet5.Invoice_Unit__c = '涓�';
- orderdet5.Shipment_Count__c = 11;
- orderdet5.Delivery_List_RMB__c = 2.0;
- orderdet5.Invoiced_Procount__c = 3;
- orderdet5.RrturnPro_count__c = 3;
- orderdet5.Invoiced_Count__c = 3;
- codList.add(orderdet5);
-
- Consumable_orderdetails__c orderdet6 = new Consumable_orderdetails__c();
- orderdet6.Name = 'Test1_001003';
- orderdet6.Consumable_order__c = testList1.Id;
- orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet6.Consumable_count__c = 1;
- orderdet6.Box_Piece__c = '鐩�';
- orderdet6.Consumable_product__c = pro1.Id;
- orderdet6.Invoice_Unit__c = '鐩�';
- orderdet6.Shipment_Count__c = 11;
- orderdet6.Delivery_List_RMB__c = 2.0;
- orderdet6.Invoiced_Procount__c = 3;
- orderdet6.RrturnPro_count__c = 3;
- orderdet6.Invoiced_Count__c = 3;
- codList.add(orderdet6);
-
- Consumable_orderdetails__c orderdet7 = new Consumable_orderdetails__c();
- orderdet7.Name = 'Test1_001004';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet7.Consumable_order__c = testList1.Id;
- orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet7.Consumable_count__c = 1;
- orderdet7.Box_Piece__c = '鐩�';
- orderdet7.Consumable_product__c = pro2.Id;
- orderdet7.Invoice_Unit__c = '涓�';
- orderdet7.Shipment_Count__c = 11;
- orderdet7.Delivery_List_RMB__c = 2.0;
- orderdet7.Invoiced_Procount__c = 3;
- orderdet7.Invoiced_Count__c = 3;
- orderdet7.RrturnPro_count__c = 3;
- codList.add(orderdet7);
- insert codList;
-
- LexConInvoicedetailsController.init(testList1.Id, invoiceorder.Id);
- //搴忓垪鍖朖son
-
- System.Test.startTest();
- System.debug(
- '===>鏁版嵁' +
- LexConInvoicedetailsController.consumableorderdetails1Records
- );
- List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList = LexConInvoicedetailsController.consumableorderdetails1Records;
- LexConInvoicedetailsController.save(
- JSON.serialize(
- LexConInvoicedetailsController.consumableorderdetails1Records
- ),
- invoiceorder.Id,
- testList1.Id
- );
-
- List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList1 = new List<LexConInvoicedetailsController.ConsumableorderdetailsInfo>();
- for (
- LexConInvoicedetailsController.ConsumableorderdetailsInfo ass : inList
- ) {
- ass.check = true;
- ass.invoiceCount = 1;
- ass.esd.Invoice_Unit__c = '涓�';
- inList1.add(ass);
- }
- LexConInvoicedetailsController.save(
- JSON.serialize(inList1),
- invoiceorder.Id,
- testList1.Id
- );
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableAccountController.cls b/force-app/main/default/classes/LexConsumableAccountController.cls
index 740996f..19c44c7 100644
--- a/force-app/main/default/classes/LexConsumableAccountController.cls
+++ b/force-app/main/default/classes/LexConsumableAccountController.cls
@@ -1,550 +1,466 @@
public without sharing class LexConsumableAccountController {
- //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
- public static String agencyProType { get; set; }
- public static String agencyProTypestr { get; set; }
- //閫夐」鍗″悕绉�
- public static String filterName { get; set; }
- //閫夐」鍗$被鍨�
- public static String hosptialType { get; set; }
- public static ApexPages.StandardSetController setCon { get; set; }
- //鐢婚潰鏄剧ず鏁伴噺
- public static Integer size { get; set; }
- public static Integer noOfRecords { get; set; }
- //鏄剧ず闆嗗悎
- public static List<Account> pageRecords { get; set; }
- //缁忛攢鍟嗕俊鎭�
- private static String accountName { get; set; }
- private static String accountId { get; set; }
- //鎺掑簭浣跨敤
- // public static String sortKey { get; set; }
- // public static String preSortKey { get; private set; }
- // public static Boolean sortOrderAsc { get; private set; }
- // public static String[] sortOrder { get; private set; }
- // //鎺掑簭浣跨敤
- // private static String[] orderby = new String[]{ 'Name','State_Master__c','Salesdepartment_HP__c','CreatedDate','Is_Active__c','RecordType.Name','Grade__c','OCM_Category__c','City_Master__c','Town__c','Phone'};
- //涓婂懆寮�濮嬨�佺粨鏉熸棩鏈�
- private static Datetime lastweekstart { get; set; }
- private static Datetime lastweekend { get; set; }
- // page
- public static Integer pagesize { get; set; }
- public static Integer pageToken { get; set; }
- public static String sortField { get; set; }
- public static String sortOrder { get; set; }
- public static Integer totalcount { get; set; }
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType { get; set; }
+ public static String agencyProTypestr { get; set; }
+ //閫夐」鍗″悕绉�
+ public static String filterName { get; set; }
+ //閫夐」鍗$被鍨�
+ public static String hosptialType { get; set; }
+ public static ApexPages.StandardSetController setCon { get; set; }
+ //鐢婚潰鏄剧ず鏁伴噺
+ public static Integer size { get; set; }
+ public static Integer noOfRecords { get; set; }
+ //鏄剧ず闆嗗悎
+ public static List<Account> pageRecords { get; set; }
+ //缁忛攢鍟嗕俊鎭�
+ private static String accountName { get; set; }
+ private static String accountId { get; set; }
+ //鎺掑簭浣跨敤
+ // public static String sortKey { get; set; }
+ // public static String preSortKey { get; private set; }
+ // public static Boolean sortOrderAsc { get; private set; }
+ // public static String[] sortOrder { get; private set; }
+ // //鎺掑簭浣跨敤
+ // private static String[] orderby = new String[]{ 'Name','State_Master__c','Salesdepartment_HP__c','CreatedDate','Is_Active__c','RecordType.Name','Grade__c','OCM_Category__c','City_Master__c','Town__c','Phone'};
+ //涓婂懆寮�濮嬨�佺粨鏉熸棩鏈�
+ private static Datetime lastweekstart { get; set; }
+ private static Datetime lastweekend { get; set; }
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
+ public static Integer totalcount { get; set; }
- //鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init(
- Integer pageSizeLWC,
- Integer pageTokenLWC,
- String fiscalYear
- ) {
- try {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ //鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String fiscalYear) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- pageSize = pageSizeLWC;
- pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
- User Useracc = [
- SELECT accountid, UserPro_Type__c
- FROM user
- WHERE id = :UserInfo.getUserId()
- ];
- accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid]
- .id;
- agencyProType = Useracc.UserPro_Type__c;
- if (String.isBlank(Useracc.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- agencyProTypestr = '%' + agencyProType + '%';
- System.debug('accountId = ' + accountId);
- System.debug('agencyProTypestr = ' + agencyProTypestr);
- List<Account> allSelectAccount = [
- SELECT
- id,
- Name,
- State_Master__c,
- State_Master__r.Name,
- Salesdepartment_HP__c,
- CreatedDate,
- Is_Active__c,
- RecordType.Name,
- Grade__c,
- OCM_Category__c,
- City_Master__c,
- City_Master__r.Name,
- Town__c,
- Phone
- FROM Account
- WHERE
- id IN (
- SELECT Hospital__c
- FROM Agency_Hospital_Link__c
- WHERE
- Agency__c = :accountId
- AND Hosptial_Type__c LIKE :agencyProTypestr
- )
- ];
- totalCount = allSelectAccount.size();
+ User Useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid].id;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ agencyProTypestr = '%' + agencyProType + '%';
+ System.debug('accountId = ' + accountId);
+ System.debug('agencyProTypestr = ' + agencyProTypestr);
+ List<Account> allSelectAccount = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE
+ id IN (
+ SELECT Hospital__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr
+ )
+ ];
+ totalCount = allSelectAccount.size();
- List<Account> selectAccList = [
- SELECT
- id,
- Name,
- State_Master__c,
- State_Master__r.Name,
- Salesdepartment_HP__c,
- CreatedDate,
- Is_Active__c,
- RecordType.Name,
- Grade__c,
- OCM_Category__c,
- City_Master__c,
- City_Master__r.Name,
- Town__c,
- Phone
- FROM Account
- WHERE
- id IN (
- SELECT Hospital__c
- FROM Agency_Hospital_Link__c
- WHERE
- Agency__c = :accountId
- AND Hosptial_Type__c LIKE :agencyProTypestr
- )
- LIMIT :pageSize
- ];
- System.debug('selectAccList = ' + selectAccList);
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
+ List<Account> selectAccList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE
+ id IN (
+ SELECT Hospital__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr
+ )
+ LIMIT :pageSize
+ ];
+ System.debug('selectAccList = ' + selectAccList);
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
- //閿�閲忓墠鍗佺殑瀹㈡埛
- // List<Account> acList = [
- // SELECT
- // id,
- // Name,
- // State_Master__c,
- // State_Master__r.Name,
- // Salesdepartment_HP__c,
- // CreatedDate,
- // Is_Active__c,
- // RecordType.Name,
- // Grade__c,
- // OCM_Category__c,
- // City_Master__c,
- // City_Master__r.Name,
- // Town__c,
- // Phone
- // FROM Account
- // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '鏈夊姽' AND RecordType.Name = '鐥呴櫌'
- // LIMIT 10
- // ];
- TopInfo topInfo = new TopInfo();
+ //閿�閲忓墠鍗佺殑瀹㈡埛
+ // List<Account> acList = [
+ // SELECT
+ // id,
+ // Name,
+ // State_Master__c,
+ // State_Master__r.Name,
+ // Salesdepartment_HP__c,
+ // CreatedDate,
+ // Is_Active__c,
+ // RecordType.Name,
+ // Grade__c,
+ // OCM_Category__c,
+ // City_Master__c,
+ // City_Master__r.Name,
+ // Town__c,
+ // Phone
+ // FROM Account
+ // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '鏈夊姽' AND RecordType.Name = '鐥呴櫌'
+ // LIMIT 10
+ // ];
+ TopInfo topInfo = new TopInfo();
- Date today = Date.today();
- Integer lastYear = today.year() - 1;
- Integer thisYear = today.year();
- Integer nextYear = today.year() + 1;
- Date lastDatetime = Date.newInstance(lastYear, 4, 1);
- Date thisDatetime = Date.newInstance(thisYear, 4, 1);
- Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
- Date nextDatetime = Date.newInstance(nextYear, 4, 1);
+ Date today = Date.today();
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 4, 1);
- AggregateResult[] arList = null;
+ //AggregateResult[] arList = null;
+ AggregateResult[] arList = new List<AggregateResult>();
+ System.debug('fiscalYear = ' + fiscalYear);
+ if (fiscalYear == 'thisYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
+ } else if (fiscalYear == 'lastYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
+ } else {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
+ }
- System.debug('fiscalYear = ' + fiscalYear);
- if (fiscalYear == 'thisYear') {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- thisDatetime,
- nextDatetime
- );
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
- arList = LexConsumableAccountSOQL.getAccountBySales(
- thisDatetime,
- nextDatetime
- );
- } else if (fiscalYear == 'lastYear') {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- lastDatetime,
- thisDatetime2
- );
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
- arList = LexConsumableAccountSOQL.getAccountBySales(
- lastDatetime,
- thisDatetime2
- );
- } else {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- lastDatetime,
- nextDatetime
- );
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
- arList = LexConsumableAccountSOQL.getAccountBySales(
- lastDatetime,
- nextDatetime
- );
- }
+ // Map<String,Decimal> mapTemp = new Map<String,Decimal>();
+ // for (AggregateResult ar : arList) {
+ // if(!mapTemp.get(String.valueOf(ar.get('hospitalName')))){
+ // mapTemp.put(String.valueOf(ar.get('hospitalName'),Decimal.valueOf(String.valueOf(ar.get('thisAmount')))));
+ // }else {
+ // Decimal decimal = mapTemp.get(String.valueOf(ar.get('hospitalName')));
+ // decimal += Decimal.valueOf(String.valueOf(ar.get('thisAmount')));
+ // mapTemp.put(String.valueOf(ar.get('hospitalName'),decimal));
+ // }
+ // }
+ // System.debug('mapTemp = ' + mapTemp);
+ // //鎺掑簭Decimal浠庡ぇ鍒板皬
+ // List<Decimal> decimalList = new List<Decimal>(mapTemp.values());
+ // decimalList.sort((a, b) => b.compareTo(a));
+ // Map<String, Decimal> sortedMap = new Map<String, Decimal>();
+ // for (String key : mapTemp.keySet()) {
+ // sortedMap.put(key, mapTemp.get(key));
+ // }
+
+ // System.debug('Sorted Map: ' + sortedMap);
- // Map<String,Decimal> mapTemp = new Map<String,Decimal>();
- // for (AggregateResult ar : arList) {
- // if(!mapTemp.get(String.valueOf(ar.get('hospitalName')))){
- // mapTemp.put(String.valueOf(ar.get('hospitalName'),Decimal.valueOf(String.valueOf(ar.get('thisAmount')))));
- // }else {
- // Decimal decimal = mapTemp.get(String.valueOf(ar.get('hospitalName')));
- // decimal += Decimal.valueOf(String.valueOf(ar.get('thisAmount')));
- // mapTemp.put(String.valueOf(ar.get('hospitalName'),decimal));
- // }
- // }
- // System.debug('mapTemp = ' + mapTemp);
- // //鎺掑簭Decimal浠庡ぇ鍒板皬
- // List<Decimal> decimalList = new List<Decimal>(mapTemp.values());
- // decimalList.sort((a, b) => b.compareTo(a));
- // Map<String, Decimal> sortedMap = new Map<String, Decimal>();
- // for (String key : mapTemp.keySet()) {
- // sortedMap.put(key, mapTemp.get(key));
- // }
+ //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
+ System.debug('arList = ' + arList);
+ List<String> accountList = new List<String>();
+ for (AggregateResult ar : arList) {
+ System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
+ if(String.valueOf(ar.get('thisAmount')) != '0.0'){
+ accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
+ topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
+ }
+ }
- // System.debug('Sorted Map: ' + sortedMap);
+ System.debug('accountList = ' + accountList);
+ System.debug('topInfo = ' + topInfo);
- //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
- System.debug('arList = ' + arList);
- List<String> accountList = new List<String>();
- for (AggregateResult ar : arList) {
- System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
- if (String.valueOf(ar.get('thisAmount')) != '0.0') {
- accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
- topInfo.deList.add(
- Decimal.valueOf(String.valueOf(ar.get('thisAmount')))
- );
+ List<Account> acList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE Id = :accountList
+ ];
+
+ List<Account> acListTemp = new List<Account>();
+
+ for (String s : accountList) {
+ for (Account a : acList) {
+ if (s == a.id) {
+ acListTemp.add(a);
+ }
+ }
+ }
+
+ topInfo.acList = acListTemp;
+
+ data.put('topInfo', topInfo);
+ data.put('pageRecords', selectAccList);
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('accountId', accountId);
+ data.put('agencyProType', agencyProType);
+ data.put('agencyProTypestr', agencyProTypestr);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
}
- }
+ }
- System.debug('accountList = ' + accountList);
- System.debug('topInfo = ' + topInfo);
+ @AuraEnabled
+ public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ try {
+ TopInfo topInfo = new TopInfo();
- List<Account> acList = [
- SELECT
- id,
- Name,
- State_Master__c,
- State_Master__r.Name,
- Salesdepartment_HP__c,
- CreatedDate,
- Is_Active__c,
- RecordType.Name,
- Grade__c,
- OCM_Category__c,
- City_Master__c,
- City_Master__r.Name,
- Town__c,
- Phone
- FROM Account
- WHERE Id = :accountList
- ];
+ Date today = Date.today();
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 4, 1);
- List<Account> acListTemp = new List<Account>();
+ //AggregateResult[] arList = null;
+ AggregateResult[] arList = new List<AggregateResult>();
- for (String s : accountList) {
- for (Account a : acList) {
- if (s == a.id) {
- acListTemp.add(a);
- }
+ System.debug('fiscalYear = ' + fiscalYear);
+ System.debug('thisYear = ' + thisYear);
+ System.debug('lastYear = ' + lastYear);
+
+ if (fiscalYear == 'thisYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
+ if (saleAmountList[0].get('saleAmount') != null) {
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ }
+ arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
+ } else if (fiscalYear == 'lastYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
+ if (saleAmountList[0].get('saleAmount') != null) {
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ }
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
+ } else {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
+ if (saleAmountList[0].get('saleAmount') != null) {
+ //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ Object saleAmountObject = saleAmountList[0].get('saleAmount');
+ topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ }
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
+ }
+ //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
+ List<String> accountList = new List<String>();
+ for (AggregateResult ar : arList) {
+ System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
+ if (String.valueOf(ar.get('thisAmount')) != '0.0') {
+ accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
+ topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
+ }
+ }
+ System.debug('accountList = ' + accountList);
+ System.debug('topInfo = ' + topInfo);
+ List<Account> acList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE Id = :accountList
+ ];
+ List<Account> acListTemp = new List<Account>();
+ for (String s : accountList) {
+ for (Account a : acList) {
+ if (s == a.id) {
+ acListTemp.add(a);
+ }
+ }
+ }
+ topInfo.acList = acListTemp;
+ data.put('topInfo', topInfo);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
}
- }
-
- topInfo.acList = acListTemp;
-
- data.put('topInfo', topInfo);
- data.put('pageRecords', selectAccList);
- data.put('paginatedAccounts', paginatedAccounts);
- data.put('accountId', accountId);
- data.put('agencyProType', agencyProType);
- data.put('agencyProTypestr', agencyProTypestr);
- res.status = 'Success';
- res.code = 200;
- res.msg = '';
- return res;
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
}
- }
- @AuraEnabled
- public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- try {
- TopInfo topInfo = new TopInfo();
+ @AuraEnabled
+ public static ResponseBodyLWC changelistView(
+ String filterNameLwc,
+ String accountIdLwc,
+ String agencyProTypeLwc,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC,
+ String sortFieldLWC,
+ String sortOrderLWC
+ ) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- Date today = Date.today();
- Integer lastYear = today.year() - 1;
- Integer thisYear = today.year();
- Integer nextYear = today.year() + 1;
- Date lastDatetime = Date.newInstance(lastYear, 4, 1);
- Date thisDatetime = Date.newInstance(thisYear, 4, 1);
- Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
- Date nextDatetime = Date.newInstance(nextYear, 4, 1);
+ filterName = filterNameLwc;
+ accountId = accountIdLwc;
+ agencyProTypestr = agencyProTypeLwc;
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
- AggregateResult[] arList = null;
+ String soql = makeSoql(filterName, accountId);
+ System.debug('soql1+++++++ ' + soql);
+ List<Account> allSelectAccount = Database.query(soql);
- System.debug('fiscalYear = ' + fiscalYear);
- System.debug('thisYear = ' + thisYear);
- System.debug('lastYear = ' + lastYear);
+ totalCount = allSelectAccount.size();
+ String nullFL = sortOrder.toLowerCase() == 'asc' ? 'NULLS FIRST': 'NULLS LAST';
+ if (String.isNotBlank(sortField)) {
+ soql += ' order by ' + sortField + ' ' + sortOrder + ' ' + nullFL;
+ }
+ soql += ' limit ' + pagesize + ' offset ' + pageToken;
+ System.debug('soql2+++++++ ' + soql);
+ List<Account> selectAccList = Database.query(soql);
+ System.debug('selectAccList = ' + selectAccList);
- if (fiscalYear == 'thisYear') {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- thisDatetime,
- nextDatetime
- );
- if (saleAmountList[0].get('saleAmount') != null) {
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ data.put('pageRecords', selectAccList);
+ data.put('paginatedAccounts', paginatedAccounts);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
}
- arList = LexConsumableAccountSOQL.getAccountBySales(
- thisDatetime,
- nextDatetime
- );
- } else if (fiscalYear == 'lastYear') {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- lastDatetime,
- thisDatetime2
- );
- if (saleAmountList[0].get('saleAmount') != null) {
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ }
+
+ //sql鏂囦綔鎴�
+ private static String makeSoql(String viewName, String accountId) {
+ Date st = Date.today().addDays(-7).toStartOfWeek();
+ lastweekstart = Datetime.newInstance(st.year(), st.month(), st.day(), 8, 0, 0);
+ lastweekend = lastweekstart.addDays(7);
+ String soql = 'SELECT id,Name,State_Master__c,Salesdepartment_HP__c,CreatedDate,Is_Active__c,RecordType.Name,State_Master__r.Name,City_Master__r.Name';
+ soql += ' ,Grade__c,OCM_Category__c,City_Master__c,Town__c,Phone FROM Account';
+ soql +=
+ ' WHERE id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c =:accountId AND Hosptial_Type__c like \'%' +
+ String.escapeSingleQuotes(agencyProTypestr.replaceAll('%', '\\%')) +
+ '%\')';
+ if (viewName == '61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌') {
+ soql += ' AND Is_Active__c = \'' + '鑽夋涓�' + '\'';
}
- arList = LexConsumableAccountSOQL.getAccountBySales(
- lastDatetime,
- thisDatetime2
- );
- } else {
- AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- lastDatetime,
- nextDatetime
- );
- if (saleAmountList[0].get('saleAmount') != null) {
- topInfo.saleAmount = Decimal.valueOf(
- String.valueOf(saleAmountList[0].get('saleAmount'))
- );
- System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ if (viewName == '62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌') {
+ soql += ' AND Is_Active__c = \'' + '鐢宠涓�' + '\'';
}
- arList = LexConsumableAccountSOQL.getAccountBySales(
- lastDatetime,
- nextDatetime
- );
- }
- //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
- List<String> accountList = new List<String>();
- for (AggregateResult ar : arList) {
- System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
- if (String.valueOf(ar.get('thisAmount')) != '0.0') {
- accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
- topInfo.deList.add(
- Decimal.valueOf(String.valueOf(ar.get('thisAmount')))
- );
+ if (viewName == '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�') {
+ soql += ' AND Is_Active__c = \'' + '鏈夋晥' + '\'';
+ soql += ' AND CreatedDate >= :lastweekstart ';
+ soql += ' AND CreatedDate < :lastweekend ';
}
- }
- System.debug('accountList = ' + accountList);
- System.debug('topInfo = ' + topInfo);
- List<Account> acList = [
- SELECT
- id,
- Name,
- State_Master__c,
- State_Master__r.Name,
- Salesdepartment_HP__c,
- CreatedDate,
- Is_Active__c,
- RecordType.Name,
- Grade__c,
- OCM_Category__c,
- City_Master__c,
- City_Master__r.Name,
- Town__c,
- Phone
- FROM Account
- WHERE Id = :accountList
- ];
- List<Account> acListTemp = new List<Account>();
- for (String s : accountList) {
- for (Account a : acList) {
- if (s == a.id) {
- acListTemp.add(a);
- }
+ System.debug('soql +++++' + soql);
+ return soql;
+ }
+
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ //top10 Account
+ public class TopInfo {
+ @AuraEnabled
+ public Decimal saleAmount { get; set; }
+ @AuraEnabled
+ public List<Account> acList { get; set; }
+ @AuraEnabled
+ public List<Decimal> deList { get; set; }
+
+ public TopInfo() {
+ acList = new List<Account>();
+ deList = new List<Decimal>();
}
- }
- topInfo.acList = acListTemp;
- data.put('topInfo', topInfo);
- res.status = 'Success';
- res.code = 200;
- res.msg = '';
- return res;
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
}
- }
-
- @AuraEnabled
- public static ResponseBodyLWC changelistView(
- String filterNameLwc,
- String accountIdLwc,
- String agencyProTypeLwc,
- Integer pageSizeLWC,
- Integer pageTokenLWC,
- String sortFieldLWC,
- String sortOrderLWC
- ) {
- try {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- filterName = filterNameLwc;
- accountId = accountIdLwc;
- agencyProTypestr = agencyProTypeLwc;
- pageSize = pageSizeLWC;
- pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
- sortField = sortFieldLWC;
- sortOrder = sortOrderLWC;
-
- String soql = makeSoql(filterName, accountId);
- System.debug('soql1+++++++ ' + soql);
- List<Account> allSelectAccount = Database.query(soql);
-
- totalCount = allSelectAccount.size();
- String nullFL = sortOrder.toLowerCase() == 'asc'
- ? 'NULLS FIRST'
- : 'NULLS LAST';
- if (String.isNotBlank(sortField)) {
- soql += ' order by ' + sortField + ' ' + sortOrder + ' ' + nullFL;
- }
- soql += ' limit ' + pagesize + ' offset ' + pageToken;
- System.debug('soql2+++++++ ' + soql);
- List<Account> selectAccList = Database.query(soql);
- System.debug('selectAccList = ' + selectAccList);
-
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
-
- data.put('pageRecords', selectAccList);
- data.put('paginatedAccounts', paginatedAccounts);
- res.status = 'Success';
- res.code = 200;
- res.msg = '';
- return res;
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + ' ' + e.getLineNumber(),
- ''
- );
- }
- }
-
- //sql鏂囦綔鎴�
- private static String makeSoql(String viewName, String accountId) {
- Date st = Date.today().addDays(-7).toStartOfWeek();
- lastweekstart = Datetime.newInstance(
- st.year(),
- st.month(),
- st.day(),
- 8,
- 0,
- 0
- );
- lastweekend = lastweekstart.addDays(7);
- String soql = 'SELECT id,Name,State_Master__c,Salesdepartment_HP__c,CreatedDate,Is_Active__c,RecordType.Name,State_Master__r.Name,City_Master__r.Name';
- soql += ' ,Grade__c,OCM_Category__c,City_Master__c,Town__c,Phone FROM Account';
- soql +=
- ' WHERE id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c =:accountId AND Hosptial_Type__c like \'%' +
- String.escapeSingleQuotes(agencyProTypestr.replaceAll('%', '\\%')) +
- '%\')';
- if (viewName == '61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌') {
- soql += ' AND Is_Active__c = \'' + '鑽夋涓�' + '\'';
- }
- if (viewName == '62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌') {
- soql += ' AND Is_Active__c = \'' + '鐢宠涓�' + '\'';
- }
- if (viewName == '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�') {
- soql += ' AND Is_Active__c = \'' + '鏈夋晥' + '\'';
- soql += ' AND CreatedDate >= :lastweekstart ';
- soql += ' AND CreatedDate < :lastweekend ';
- }
- System.debug('soql +++++' + soql);
- return soql;
- }
-
- //鍒嗛〉Bean
- public class PaginatedAccounts {
- @AuraEnabled
- public Integer nextPageToken;
- @AuraEnabled
- public Integer pageNumber { get; set; }
- @AuraEnabled
- public Integer totalRecords { get; set; }
- @AuraEnabled
- public Integer recordStart { get; set; }
- @AuraEnabled
- public Integer recordEnd { get; set; }
- }
-
- //top10 Account
- public class TopInfo {
- @AuraEnabled
- public Decimal saleAmount { get; set; }
- @AuraEnabled
- public List<Account> acList { get; set; }
- @AuraEnabled
- public List<Decimal> deList { get; set; }
-
- public TopInfo() {
- acList = new List<Account>();
- deList = new List<Decimal>();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountControllerTest.cls b/force-app/main/default/classes/LexConsumableAccountControllerTest.cls
index dd94bf5..dcc6515 100644
--- a/force-app/main/default/classes/LexConsumableAccountControllerTest.cls
+++ b/force-app/main/default/classes/LexConsumableAccountControllerTest.cls
@@ -1,152 +1,154 @@
@isTest
private class LexConsumableAccountControllerTest {
- public static Account account1 = new Account();
- public static Account account2 = new Account();
- public static Account account3 = new Account();
- public static Account consumable = new Account();
- public static Contact contact1 = new Contact();
- public static User user = new User();
- public static Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
+ public static Account account1 = new Account();
+ public static Account account2 = new Account();
+ public static Account account3 = new Account();
+ public static Account consumable = new Account();
+ public static Contact contact1 = new Contact();
+ public static User user = new User();
+ public static Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
- static testMethod void testMethod1() {
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<Account> accList = new List<Account>();
- // 鍙栧紩鍏�
- account1.Name = 'test1鍖婚櫌';
- account1.RecordTypeId = '01210000000QemG';
+ static testMethod void testMethod1(){
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<Account> accList = new List<Account>();
+ // 鍙栧紩鍏�
+ account1.Name = 'test1鍖婚櫌';
+ account1.RecordTypeId = '01210000000QemG';
+ // account1.Is_Active__c = '鑽夋涓�';
+ accList.add(account1);
+
+ account2.Name = 'test2鍖婚櫌';
+ account2.RecordTypeId = '01210000000QemG';
+ // account2.Is_Active__c = '鏈夊姽';
+ accList.add(account2);
+
+ account3.Name = 'test3鍖婚櫌';
+ account3.RecordTypeId = '01210000000QemG';
+ // account3.Is_Active__c = '鐢宠涓�';
+ accList.add(account3);
+ insert accList;
+
+ consumable.Name = 'test1缁忛攢鍟�';
+ consumable.RecordTypeId = '01210000000Qem1';
+ insert consumable;
+
+ contact1.AccountId = account1.Id;
+ contact1.FirstName = '璨换鑰�';
+ contact1.LastName = 'test1鍖婚櫌';
+ insert contact1;
+
+ // 銉︺兗銈躲兗
+ Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄�'];
+ user.ProfileId = p.Id;
+ user.ContactId = contact1.Id;
+ user.FirstName = '銉︺兗銈躲兗';
+ user.LastName = '銉嗐偣銉�';
+ user.Email = 'test_user@example.com';
+ user.emailencodingkey='UTF-8';
+ user.languagelocalekey='zh_CN';
+ user.localesidkey='ja_JP';
+ user.timezonesidkey='Asia/Shanghai';
+ user.Username = 'test_user@example.com';
+ user.Alias = '銉嗐儲';
+ user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
+ insert user;
+
+ // 浠g悊搴楀尰闄�
+ agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
+ agency_hospital_link.Hospital__c = account1.Id;
+ agency_hospital_link.Agency__c = consumable.Id;
+ agency_hospital_link.OwnerId = user.Id;
+ insert agency_hospital_link;
+
+
+
+ }
+ System.runAs(user){
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = account1.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ET';
+ Order1.Order_ForHospital__c = account1.Id;
+ insert Order1;
+
+
+
+ Consumable_Orderdetails__c con = new Consumable_Orderdetails__c();
+ con.Consumable_order__c = Order1.Id;
+ insert con;
+
+
+ LexConsumableAccountController.init(2,1,'thisYear');
+ LexConsumableAccountController.init(2,1,'lastYear');
+ LexConsumableAccountController.init(2,1,'2023');
+ LexConsumableAccountController.changeFiscalYearView('thisYear');
+ LexConsumableAccountController.changeFiscalYearView('lastYear');
+ // LexConsumableAccountController.changelistView('62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
+ // LexConsumableAccountController.changelistView('63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
+
+
+ }
+
+
+
+}
+static testMethod void testMethod2(){
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ // 鍙栧紩鍏�
+ account1.Name = 'test1鍖婚櫌';
+ account1.RecordTypeId = '01210000000QemG';
// account1.Is_Active__c = '鑽夋涓�';
- accList.add(account1);
+ insert account1;
- account2.Name = 'test2鍖婚櫌';
- account2.RecordTypeId = '01210000000QemG';
+ account2.Name = 'test2鍖婚櫌';
+ account2.RecordTypeId = '01210000000QemG';
// account2.Is_Active__c = '鏈夊姽';
- accList.add(account2);
-
- account3.Name = 'test3鍖婚櫌';
- account3.RecordTypeId = '01210000000QemG';
+ insert account2;
+
+ account3.Name = 'test3鍖婚櫌';
+ account3.RecordTypeId = '01210000000QemG';
// account3.Is_Active__c = '鐢宠涓�';
- accList.add(account3);
- insert accList;
+ insert account3;
- consumable.Name = 'test1缁忛攢鍟�';
- consumable.RecordTypeId = '01210000000Qem1';
- insert consumable;
+ consumable.Name = 'test1缁忛攢鍟�';
+ consumable.RecordTypeId = '01210000000Qem1';
+ insert consumable;
- contact1.AccountId = account1.Id;
- contact1.FirstName = '璨换鑰�';
- contact1.LastName = 'test1鍖婚櫌';
- insert contact1;
+ contact1.AccountId = account1.Id;
+ contact1.FirstName = '璨换鑰�';
+ contact1.LastName = 'test1鍖婚櫌';
+ insert contact1;
+
+ // 銉︺兗銈躲兗
+ Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄�'];
+ user.ProfileId = p.Id;
+ user.ContactId = contact1.Id;
+ user.FirstName = '銉︺兗銈躲兗';
+ user.LastName = '銉嗐偣銉�';
+ user.Email = 'test_user@example.com';
+ user.emailencodingkey='UTF-8';
+ user.languagelocalekey='zh_CN';
+ user.localesidkey='ja_JP';
+ user.timezonesidkey='Asia/Shanghai';
+ user.Username = 'test_user@example.com';
+ user.Alias = '銉嗐儲';
+ user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
+ insert user;
- // 銉︺兗銈躲兗
- Profile p = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄�'
- ];
- user.ProfileId = p.Id;
- user.ContactId = contact1.Id;
- user.FirstName = '銉︺兗銈躲兗';
- user.LastName = '銉嗐偣銉�';
- user.Email = 'test_user@example.com';
- user.emailencodingkey = 'UTF-8';
- user.languagelocalekey = 'zh_CN';
- user.localesidkey = 'ja_JP';
- user.timezonesidkey = 'Asia/Shanghai';
- user.Username = 'test_user@example.com';
- user.Alias = '銉嗐儲';
- user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
- insert user;
-
- // 浠g悊搴楀尰闄�
- agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
- agency_hospital_link.Hospital__c = account1.Id;
- agency_hospital_link.Agency__c = consumable.Id;
- agency_hospital_link.OwnerId = user.Id;
- insert agency_hospital_link;
- }
- System.runAs(user) {
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = account1.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ET';
- Order1.Order_ForHospital__c = account1.Id;
- insert Order1;
-
- Consumable_Orderdetails__c con = new Consumable_Orderdetails__c();
- con.Consumable_order__c = Order1.Id;
- insert con;
-
- LexConsumableAccountController.init(2, 1, 'thisYear');
- LexConsumableAccountController.init(2, 1, 'lastYear');
- LexConsumableAccountController.init(2, 1, '2023');
- LexConsumableAccountController.changeFiscalYearView('thisYear');
- LexConsumableAccountController.changeFiscalYearView('lastYear');
- // LexConsumableAccountController.changelistView('62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
- // LexConsumableAccountController.changelistView('63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
- }
-
+ // 浠g悊搴楀尰闄�
+ agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
+ agency_hospital_link.Hospital__c = account1.Id;
+ agency_hospital_link.Agency__c = consumable.Id;
+ agency_hospital_link.OwnerId = user.Id;
+ insert agency_hospital_link;
}
- static testMethod void testMethod2() {
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- // 鍙栧紩鍏�
- account1.Name = 'test1鍖婚櫌';
- account1.RecordTypeId = '01210000000QemG';
- // account1.Is_Active__c = '鑽夋涓�';
- insert account1;
-
- account2.Name = 'test2鍖婚櫌';
- account2.RecordTypeId = '01210000000QemG';
- // account2.Is_Active__c = '鏈夊姽';
- insert account2;
-
- account3.Name = 'test3鍖婚櫌';
- account3.RecordTypeId = '01210000000QemG';
- // account3.Is_Active__c = '鐢宠涓�';
- insert account3;
-
- consumable.Name = 'test1缁忛攢鍟�';
- consumable.RecordTypeId = '01210000000Qem1';
- insert consumable;
-
- contact1.AccountId = account1.Id;
- contact1.FirstName = '璨换鑰�';
- contact1.LastName = 'test1鍖婚櫌';
- insert contact1;
-
- // 銉︺兗銈躲兗
- Profile p = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄�'
- ];
- user.ProfileId = p.Id;
- user.ContactId = contact1.Id;
- user.FirstName = '銉︺兗銈躲兗';
- user.LastName = '銉嗐偣銉�';
- user.Email = 'test_user@example.com';
- user.emailencodingkey = 'UTF-8';
- user.languagelocalekey = 'zh_CN';
- user.localesidkey = 'ja_JP';
- user.timezonesidkey = 'Asia/Shanghai';
- user.Username = 'test_user@example.com';
- user.Alias = '銉嗐儲';
- user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
- insert user;
-
- // 浠g悊搴楀尰闄�
- agency_hospital_link.Name = 'test1浠g悊搴楀尰闄�';
- agency_hospital_link.Hospital__c = account1.Id;
- agency_hospital_link.Agency__c = consumable.Id;
- agency_hospital_link.OwnerId = user.Id;
- insert agency_hospital_link;
- }
- System.runAs(user) {
+ System.runAs(user){
PageReference page = new PageReference('/apex/ConsumableAccount');
System.Test.setCurrentPage(page);
ConsumableAccountController ca = new ConsumableAccountController();
@@ -168,24 +170,14 @@
ca.accsort();
ca.sortKey = '1';
- LexConsumableAccountController.changelistView(
- '62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌',
- consumable.Id,
- 'ET',
- 1,
- 0,
- 'Is_Active__c',
- 'ASC'
- );
- LexConsumableAccountController.changelistView(
- '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�',
- consumable.Id,
- 'ET',
- 1,
- 0,
- 'Is_Active__c',
- 'ASC'
- );
- }
+ LexConsumableAccountController.changelistView('62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
+ LexConsumableAccountController.changelistView('63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
+
+
}
}
+
+
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls b/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls
index f76c3d5..20985d0 100644
--- a/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls
+++ b/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls
@@ -1,16 +1,19 @@
@isTest
private class LexConsumableAccountInfoControllerTest {
- @isTest
- public static void test_method_one() {
- // Implement test code
- Account account1 = new Account();
- account1.Name = 'test1鍖婚櫌';
- account1.RecordTypeId = '01210000000QemG';
- //account1.Is_Active__c = '鑽夋涓�';
- insert account1;
+
+ @isTest
+ public static void test_method_one() {
+ // Implement test code
+ Account account1 = new Account();
+ account1.Name = 'test1鍖婚櫌';
+ account1.RecordTypeId = '01210000000QemG';
+ //account1.Is_Active__c = '鑽夋涓�';
+ insert account1;
- LexConsumableAccountInfoController cai = new LexConsumableAccountInfoController();
- LexConsumableAccountInfoController.init(account1.Id);
- LexConsumableAccountInfoController.init('');
- }
-}
+
+ LexConsumableAccountInfoController cai = new LexConsumableAccountInfoController();
+ LexConsumableAccountInfoController.init(account1.Id);
+ LexConsumableAccountInfoController.init('');
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableAccountSOQL.cls b/force-app/main/default/classes/LexConsumableAccountSOQL.cls
index a6006d9..34ddbfd 100644
--- a/force-app/main/default/classes/LexConsumableAccountSOQL.cls
+++ b/force-app/main/default/classes/LexConsumableAccountSOQL.cls
@@ -1,41 +1,30 @@
public with sharing class LexConsumableAccountSOQL {
- public static AggregateResult[] getAccountBySales(
- Datetime thisDatetime,
- Datetime nextDatetime
- ) {
- AggregateResult[] arList = new List<AggregateResult>(
- [
- SELECT
- Consumable_order__r.Order_ForHospital__c,
- Consumable_order__r.Order_ForHospital__r.name hospitalName,
- sum(Sale_amount__c) thisAmount
- FROM Consumable_Orderdetails__c
- WHERE
- CreatedDate >= :thisDatetime
- AND CreatedDate < :nextDatetime
- AND Consumable_order__r.Order_ForHospital__r.name != ''
- GROUP BY
- Consumable_order__r.Order_ForHospital__c,
- Consumable_order__r.Order_ForHospital__r.name
- ORDER BY sum(Sale_amount__c) DESC
- LIMIT 10
- ]
- );
- return arList;
- }
+ public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){
+ AggregateResult[] arList = new List<AggregateResult>([
+ SELECT Consumable_order__r.Order_ForHospital__c,Consumable_order__r.Order_ForHospital__r.name hospitalName,
+ sum(Sale_amount__c) thisAmount
+ FROM Consumable_Orderdetails__c
+ WHERE
+ CreatedDate >= :thisDatetime
+ AND CreatedDate < :nextDatetime
+ AND Consumable_order__r.Order_ForHospital__r.name != ''
+ GROUP BY Consumable_order__r.Order_ForHospital__c,Consumable_order__r.Order_ForHospital__r.name
+ ORDER BY sum(Sale_amount__c) DESC
+ LIMIT 10
+ ]);
+ return arList;
+ }
- public static AggregateResult[] getAccountTotalSales(
- Datetime thisDatetime,
- Datetime nextDatetime
- ) {
- AggregateResult[] saleAmountList = [
- SELECT sum(Sale_amount__c) saleAmount
- FROM Consumable_Orderdetails__c
- WHERE
- CreatedDate >= :thisDatetime
- AND CreatedDate < :nextDatetime
- AND Consumable_order__r.Order_ForHospital__r.name != ''
- ];
- return saleAmountList;
- }
-}
+ public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime ,Datetime nextDatetime){
+ AggregateResult[] saleAmountList = [
+ SELECT sum(Sale_amount__c) saleAmount
+ FROM Consumable_Orderdetails__c
+ WHERE CreatedDate >= :thisDatetime
+ AND CreatedDate < :nextDatetime
+ AND Consumable_order__r.Order_ForHospital__r.name != ''
+ ];
+ return saleAmountList;
+ }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls b/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls
index 577573e..c44bd77 100644
--- a/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls
+++ b/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls
@@ -1,148 +1,82 @@
@isTest
private class LexConsumableAccountSOQLTest {
- @testSetup
- static void testInfo() {
- User userTest;
- Account accountItem;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem.id
- );
- insert core;
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
+ @testSetup
+ static void testInfo(){
+ User userTest;
+ Account accountItem;
+ User thisUser = [SELECT Id FROM User WHERE Id =:UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = true AND SobjectType = 'Account' AND Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem = new Account(Name='Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id, Product_Limit_Date__c = 'Test01|5|55,Test02|2|4', AgentCode_Ext__c = '9999900');
+ insert accountItem;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem.id);
+ insert core;
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+
+ System.runAs(userTest){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c createId = new Consumable_order__c();
+ createId.Name = 'testMing1';
+ createId.Order_status__c = '鎵瑰噯';
+ createId.Deliver_date__c = Date.today();
+ createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createId.Order_type__c = '璁㈠崟';
+ createId.Order_ProType__c = 'ENG';
+ createId.Dealer_Info__c = accountItem.Id;
+ createId.Delivery_detail_count__c = 5;
+ createId.orderPattern__c = 'hospitalorder';
+ insert createId;
+
+ List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
+ Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
+ conOrderDetail1.Name = 'testConOrderDetail1';
+ conOrderDetail1.Consumable_Arrivecount__c = 5;
+ conOrderDetail1.Unitprice_To_agency__c = 0;
+ conOrderDetail1.Delivery_List_RMB__c = 99;
+ conOrderDetail1.Shipment_Count__c = 100;
+ conOrderDetail1.Consumable_product__c = pro1.id;
+ conOrderDetail1.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail1);
+
+ Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
+ conOrderDetail2.Name = 'testConOrderDetail2';
+ conOrderDetail1.Unitprice_To_agency__c = 0;
+ conOrderDetail1.Delivery_List_RMB__c = 99;
+ conOrderDetail2.Shipment_Count__c = 99;
+ conOrderDetail2.Consumable_product__c = pro2.id;
+ conOrderDetail2.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail2);
+ insert coListTest;
+ }
+ }
+ @isTest
+ static void testGetAccountBySales(){
+ System.Test.startTest();
+ DateTime thisDatetime = DateTime.newInstance(2023,1,1,00,00,00);
+ DateTime nextDatetime = DateTime.newInstance(2023,6,6,00,00,00);
+ AggregateResult[] arList = new List<AggregateResult>();
+ arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime,nextDatetime);
+ System.Test.stopTest();
}
-
- System.runAs(userTest) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c createId = new Consumable_order__c();
- createId.Name = 'testMing1';
- createId.Order_status__c = '鎵瑰噯';
- createId.Deliver_date__c = Date.today();
- createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createId.Order_type__c = '璁㈠崟';
- createId.Order_ProType__c = 'ENG';
- createId.Dealer_Info__c = accountItem.Id;
- createId.Delivery_detail_count__c = 5;
- createId.orderPattern__c = 'hospitalorder';
- insert createId;
-
- List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
- Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
- conOrderDetail1.Name = 'testConOrderDetail1';
- conOrderDetail1.Consumable_Arrivecount__c = 5;
- conOrderDetail1.Unitprice_To_agency__c = 0;
- conOrderDetail1.Delivery_List_RMB__c = 99;
- conOrderDetail1.Shipment_Count__c = 100;
- conOrderDetail1.Consumable_product__c = pro1.id;
- conOrderDetail1.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail1);
-
- Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
- conOrderDetail2.Name = 'testConOrderDetail2';
- conOrderDetail1.Unitprice_To_agency__c = 0;
- conOrderDetail1.Delivery_List_RMB__c = 99;
- conOrderDetail2.Shipment_Count__c = 99;
- conOrderDetail2.Consumable_product__c = pro2.id;
- conOrderDetail2.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail2);
- insert coListTest;
+ @isTest
+ static void testGetAccountTotalSales(){
+ System.Test.startTest();
+ DateTime thisDatetime = DateTime.newInstance(2023,1,1,00,00,00);
+ DateTime nextDatetime = DateTime.newInstance(2023,6,6,00,00,00);
+ AggregateResult[] saleAmountList = new List<AggregateResult>();
+ saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime,nextDatetime);
+ System.Test.stopTest();
}
- }
- @isTest
- static void testGetAccountBySales() {
- System.Test.startTest();
- DateTime thisDatetime = DateTime.newInstance(2023, 1, 1, 0, 0, 0);
- DateTime nextDatetime = DateTime.newInstance(2023, 6, 6, 0, 0, 0);
- AggregateResult[] arList = new List<AggregateResult>();
- arList = LexConsumableAccountSOQL.getAccountBySales(
- thisDatetime,
- nextDatetime
- );
- System.Test.stopTest();
- }
- @isTest
- static void testGetAccountTotalSales() {
- System.Test.startTest();
- DateTime thisDatetime = DateTime.newInstance(2023, 1, 1, 0, 0, 0);
- DateTime nextDatetime = DateTime.newInstance(2023, 6, 6, 0, 0, 0);
- AggregateResult[] saleAmountList = new List<AggregateResult>();
- saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
- thisDatetime,
- nextDatetime
- );
- System.Test.stopTest();
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableController.cls b/force-app/main/default/classes/LexConsumableController.cls
index 0584d06..870954c 100644
--- a/force-app/main/default/classes/LexConsumableController.cls
+++ b/force-app/main/default/classes/LexConsumableController.cls
@@ -1,2715 +1,2315 @@
public without sharing class LexConsumableController {
- /*****************妞滅储鐢�******************/
- public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c 銇偆銉炽偣銈裤兂銈广�乻ql澶氥仚銇�
- public static String category1 { get; set; }
- public static String category5 { get; set; }
- public static String category4 { get; set; }
- public static String category3 { get; set; }
- public static String category_Goods { get; set; }
- public static Boolean specialCampaign { get; set; }
- public static Boolean cansee { get; set; }
- //缁忛攢鍟嗗悎鍚屽悕绉�
- public static String contractName { get; set; }
- //缁忛攢鍟嗗悎鍚孖D
- public static String contractId { get; set; }
- //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
- public static Boolean dealerPricesee { get; set; }
- /*****************鐢婚潰鍒濆鍖栫敤********************************/
- /******20160313_add**************/
- //public String idCheck {get;set;}
- public static Boolean editAble { get; set; }
- public static Boolean edoffersPrice { get; set; }
- public static String statusEdit { get; set; }
- public static Boolean returnOrder { get; set; }
- public static String searchDone { get; set; }
- //鏆傜敤20160323
- public static Decimal disCount = 0;
- //鎬讳环鏍艰绠楃粨鏋�
- public static Decimal sumPrice { get; set; }
- //鑷畾涔夌壒浠烽噾棰�
- public static Decimal bargainPrice { get; set; }
- //浜у搧涓婁笅闄�
- public static String[] proLimitAndDate = new List<String>{};
- /*****************鐢婚潰琛ㄧずBean******************/
- private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview {
- get;
- set;
- }
- public static Integer ConsumableorderdetailsCount {
- get {
- return consumableorderdetailsRecords == null
- ? 0
- : consumableorderdetailsRecords.size();
- }
- }
- public static Integer ConsumableorderdetailsviewCount {
- get {
- return consumableorderdetailsRecordsview == null
- ? 0
- : consumableorderdetailsRecordsview.size();
- }
- }
- public static List<String> lower = new List<String>();
- //闄勪欢
- public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
- public static List<String> DealerProductId { get; set; }
- public static Boolean editDelCommitBtnDisabled { get; private set; }
- public static Boolean saveBtnDisabled { get; private set; }
- public static Boolean sorderBtnDisabled { get; private set; }
- public static String decisionCode { get; set; }
- // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
- public static String baseUrl { get; private set; }
- public static String sortKey { get; set; }
- public static String preSortKey { get; private set; }
- public static Boolean sortOrderAsc { get; private set; }
- public static String[] sortOrder { get; private set; }
- private static List<String> contactDealer = new List<String>();
- private static String[] columus = new List<String>{
- 'Consumable_Product__r.Name',
- 'Consumable_Product__r.Asset_Model_No__c',
- 'Consumable_Product__r.Intra_Trade_List_RMB__c',
- '',
- '',
- 'Consumable_Product__r.Category3__c',
- 'Consumable_Product__r.Category4__c',
- 'Consumable_Product__r.Category5__c'
- };
- private static String[] columus_no = new List<String>{
- 'Product2__c.Name',
- 'Product2__c.Asset_Model_No__c',
- 'Product2__c.Intra_Trade_List_RMB__c',
- '',
- '',
- 'Category3__c',
- 'Category4__c',
- 'Category5__c'
- };
- // 宸查�夋嫨浜у搧鏄庣粏
- private static List<Attachment> attachmentinfo = new List<Attachment>();
- /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
- private static String cate1ForSort = null;
- private static String accountid = null;
- private static String accountName = null;
- // 浜у搧 ID
- public static String ESetId { get; set; }
- private static String userId = '';
- //private String[] ProidListAll = new String[]{};
- public static List<SelectOption> categoryOptionList { get; set; }
- public static List<SelectOption> category4OptionList { get; set; }
- public static List<SelectOption> category5OptionList { get; set; }
- public static List<CusOption> category3Option { get; set; }
- public static List<CusOption> category4Option { get; set; }
- public static List<CusOption> category5Option { get; set; }
- private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>();
- public static List<String> orderzaikuId = new List<String>();
- //鍒嗛〉鍔熻兘
- public static Integer size { get; set; }
- public static Integer pageLimit { get; set; }
- public static Integer noOfRecords { get; set; }
- public static ApexPages.StandardSetController con { get; set; }
- public static String soql { get; set; }
- // 鐧诲綍鑰呭伐浣滃湴
- private static String userWorkLocation;
- public static String agencyProType { get; set; }
- public static String agencyProType1 { get; set; } //lt 20230526 瀹夊窘涓ょエ鍒� add
- private static Boolean OSHFLG; //lt 20230517 瀹夊窘涓ょエ鍒� add
- public static String methodType { get; set; }
- public static String hospitalName { get; set; }
- public static String hospitalId { get; set; }
- public static String tempidHp { get; set; }
- public static String tempidPp { get; set; }
- private static List<String> hpids = new List<String>();
- private static Boolean isfirst = false;
- //鎶ラ敊鍜岃鍛婁俊鎭�
- public static List<String> errorMsgList = new List<String>();
- public static List<String> warningMsgList = new List<String>();
- //鏋勯�犳柟娉�
- public LexConsumableController() {
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- DealerProductId = new List<String>();
- attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- editAble = false;
- edoffersPrice = false;
- returnOrder = false;
- categoryOptionList = new List<SelectOption>();
- category4OptionList = new List<SelectOption>();
- category5OptionList = new List<SelectOption>();
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
- }
-
- private static void initStandardController() {
- con = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
- con.setPageSize(size);
- noOfRecords = con.getResultSize();
- }
-
- public static List<Product2__c> product2s() {
- return (List<Product2__c>) con.getRecords();
- }
-
- private static List<ConsumableorderdetailsInfo> getPageInfo() {
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- Map<String, String> selectedIdMap = new Map<String, String>();
-
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- if (ass.check == true) {
- selectedIdMap.put(ass.Prod.id, ass.Prod.id);
- reSet.add(ass);
- }
- }
-
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- if (editAble) {
- consumableorderdetailsRecordsview = reSet;
- }
- Integer pagestartNo = (con.getPageNumber() * size) - size;
- Integer pageendNo = (con.getPageNumber() * size) > noOfRecords
- ? noOfRecords
- : (con.getPageNumber() * size - 1);
- Integer addNo = 0;
- for (
- Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++
- ) {
- Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
- if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
- addNo++;
- //continue;
- }
- // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
- // break;
- // }
- else {
- if (consumableorderdetailsRecords[i].check == false) {
- consumableorderdetailsRecords[i].esd = orderdetails1;
+ /*****************妞滅储鐢�******************/
+ public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c 銇偆銉炽偣銈裤兂銈广�乻ql澶氥仚銇�
+ public static String category1 { get; set; }
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static String category_Goods { get; set; }
+ public static Boolean specialCampaign { get; set; }
+ public static Boolean cansee { get; set; }
+ //缁忛攢鍟嗗悎鍚屽悕绉�
+ public static String contractName { get; set; }
+ //缁忛攢鍟嗗悎鍚孖D
+ public static String contractId { get; set; }
+ //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
+ public static Boolean dealerPricesee { get; set; }
+ /*****************鐢婚潰鍒濆鍖栫敤********************************/
+ /******20160313_add**************/
+ //public String idCheck {get;set;}
+ public static Boolean editAble { get; set; }
+ public static Boolean edoffersPrice { get; set; }
+ public static String statusEdit { get; set; }
+ public static Boolean returnOrder { get; set; }
+ public static String searchDone { get; set; }
+ //鏆傜敤20160323
+ public static Decimal disCount = 0;
+ //鎬讳环鏍艰绠楃粨鏋�
+ public static Decimal sumPrice { get; set; }
+ //鑷畾涔夌壒浠烽噾棰�
+ public static Decimal bargainPrice { get; set; }
+ //浜у搧涓婁笅闄�
+ public static String[] proLimitAndDate = new List<String>{};
+ /*****************鐢婚潰琛ㄧずBean******************/
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; }
+ public static Integer ConsumableorderdetailsCount {
+ get {
+ return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
}
- //consumableorderdetailsRecords[i].esd.Dealer_Custom_Price__c = consumableorderdetailsRecords[i].Prod.Intra_Trade_List_RMB__c * disCount / 100;
- consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
- addNo++;
- }
- // if (addNo >= size)
- // break;
}
- return consumableorderdetailsRecordsview;
- }
-
- @AuraEnabled
- public static Results init(String type, String esetId, String keywordStr) {
- Results results = new Results();
- results.isNoteStay = LexUtility.getIsNoteStay();
- errorMsgList = new List<String>();
- warningMsgList = new List<String>();
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- DealerProductId = new List<String>();
- attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- editAble = false;
- edoffersPrice = false;
- returnOrder = false;
- categoryOptionList = new List<SelectOption>();
- category4OptionList = new List<SelectOption>();
- category5OptionList = new List<SelectOption>();
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
- ESetId = esetId;
- methodType = type;
- if (String.isBlank(methodType) && String.isNotBlank(ESetId)) {
- List<Consumable_order__c> oclist = [
- SELECT orderPattern__c
- FROM Consumable_order__c
- WHERE id = :ESetid
- ];
- methodType = oclist.get(0).orderPattern__c;
+ public static Integer ConsumableorderdetailsviewCount {
+ get {
+ return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size();
+ }
}
- statusEdit = keywordStr;
- System.debug('Param:' + ESetId + '---' + methodType + '---' + statusEdit);
- try {
- sortKey = '1';
- preSortKey = '1';
- sortOrderAsc = false;
- sortOrder = new String[8];
- sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
- cate1ForSort = '';
- decisionCode = '';
- sumPrice = 0;
- specialCampaign = false;
- if (
- ESetId != null &&
- ESetId != '' &&
- statusEdit == '' &&
- statusEdit == null
- ) {
+ public static List<String> lower = new List<String>();
+ //闄勪欢
+ public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
+ public static List<String> DealerProductId { get; set; }
+ public static Boolean editDelCommitBtnDisabled { get; private set; }
+ public static Boolean saveBtnDisabled { get; private set; }
+ public static Boolean sorderBtnDisabled { get; private set; }
+ public static String decisionCode { get; set; }
+ // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
+ public static String baseUrl { get; private set; }
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; private set; }
+ public static Boolean sortOrderAsc { get; private set; }
+ public static String[] sortOrder { get; private set; }
+ private static List<String> contactDealer = new List<String>();
+ private static String[] columus = new List<String>{
+ 'Consumable_Product__r.Name',
+ 'Consumable_Product__r.Asset_Model_No__c',
+ 'Consumable_Product__r.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Consumable_Product__r.Category3__c',
+ 'Consumable_Product__r.Category4__c',
+ 'Consumable_Product__r.Category5__c'
+ };
+ private static String[] columus_no = new List<String>{
+ 'Product2__c.Name',
+ 'Product2__c.Asset_Model_No__c',
+ 'Product2__c.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Category3__c',
+ 'Category4__c',
+ 'Category5__c'
+ };
+ // 宸查�夋嫨浜у搧鏄庣粏
+ private static List<Attachment> attachmentinfo = new List<Attachment>();
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ private static String cate1ForSort = null;
+ private static String accountid = null;
+ private static String accountName = null;
+ // 浜у搧 ID
+ public static String ESetId { get; set; }
+ private static String userId = '';
+ //private String[] ProidListAll = new String[]{};
+ public static List<SelectOption> categoryOptionList { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ public static List<CusOption> category3Option { get; set; }
+ public static List<CusOption> category4Option { get; set; }
+ public static List<CusOption> category5Option { get; set; }
+ private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>();
+ public static List<String> orderzaikuId = new List<String>();
+ //鍒嗛〉鍔熻兘
+ public static Integer size { get; set; }
+ public static Integer pageLimit { get; set; }
+ public static Integer noOfRecords { get; set; }
+ public static ApexPages.StandardSetController con { get; set; }
+ public static String soql { get; set; }
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ public static String agencyProType { get; set; }
+ public static String agencyProType1 { get; set; } //lt 20230526 瀹夊窘涓ょエ鍒� add
+ private static Boolean OSHFLG; //lt 20230517 瀹夊窘涓ょエ鍒� add
+ public static String methodType { get; set; }
+ public static String hospitalName { get; set; }
+ public static String hospitalId { get; set; }
+ public static String tempidHp { get; set; }
+ public static String tempidPp { get; set; }
+ private static List<String> hpids = new List<String>();
+ private static Boolean isfirst = false;
+ //鎶ラ敊鍜岃鍛婁俊鎭�
+ public static List<String> errorMsgList = new List<String>();
+ public static List<String> warningMsgList = new List<String>();
+ //鏋勯�犳柟娉�
+ public LexConsumableController() {
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ DealerProductId = new List<String>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
editAble = false;
- } else if (
- (ESetId == null || ESetId == '') &&
- (statusEdit == '' ||
- statusEdit == null)
- ) {
- editAble = true;
- } else if (
- ESetId != null &&
- ESetId != '' &&
- statusEdit != '' &&
- statusEdit != null
- ) {
- editAble = true;
- }
- userId = UserInfo.getUserId();
- List<user> Useracc = new List<user>();
- //lt 20230517 瀹夊窘涓ょエ鍒� add ,OSHFLG__c
- Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c, OSHFLG__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc[0].accountid;
- userWorkLocation = Useracc[0].Work_Location__c;
- agencyProType = Useracc[0].UserPro_Type__c;
- agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 瀹夊窘涓ょエ鍒� add
- //lt 20230526 瀹夊窘涓ょエ鍒� start
- OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 瀹夊窘涓ょエ鍒� add
- if (OSHFLG) {
- agencyProType1 = 'OSH';
- } else if (String.isBlank(Useracc[0].UserPro_Type__c)) {
- agencyProType1 = 'ET';
- }
- //lt 20230526 瀹夊窘涓ょエ鍒� end
- if (String.isBlank(Useracc[0].UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- //閿欒淇℃伅鎻愮ず
- if (
- String.isNotBlank(methodType) &&
- methodType.equals('hospitalorder') &&
- agencyProType == 'ET'
- ) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!'));
- errorMsgList.add('鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!');
- }
- contactDealer = new List<String>();
- Date dateToday = Date.today();
- //鏌ヨ缁忛攢鍟嗕笅鎵�鏈夋湁鏁堝悎鍚�
- List<Account> contractList = [
- SELECT Id, Name, RecordType.DeveloperName
- FROM Account
- WHERE
- RecordType.DeveloperName = 'AgencyContract'
- AND Contract_Decide_Start_Date__c <= :dateToday
- AND Contract_Decide_End_Date__c >= :dateToday
- AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
- AND Agent_Ref__c = :accountid
- AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
- ];
- for (Account contract : contractList) {
- contactDealer.add(contract.Id);
- }
- DealerProductMap = new Map<Id, Dealer_Product__c>();
- DealerProductId = getDealerProductId();
- Account accountInfo = [
- SELECT
- Name,
- Dealer_discount__c,
- Product_Limit_Date__c,
- Product_Limit_DateENG__c
- FROM account
- WHERE id = :accountid
- ];
- accountName = accountInfo.Name;
- String product_Limit;
- if (agencyProType == 'ET') {
- product_Limit = accountInfo.Product_Limit_Date__c;
- } else {
- product_Limit = accountInfo.Product_Limit_DateENG__c;
- }
- if (product_Limit != null && product_Limit != '') {
- proLimitAndDate = product_Limit.split(',');
- }
- saveBtnDisabled = false;
- sorderBtnDisabled = false;
- coc = new Consumable_order__c();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- if (String.isBlank(agencyProType)) {
- //return ;
- }
- List<Product2__c> Product2Selected = new List<Product2__c>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- //缁忛攢鍟嗗湪搴撴暟鎹�
- List<Consumable_order_details2__c> countDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Box_Piece__c,
- hospitalSpecialOffer__c,
- promotionorder__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Isoverdue__c = 1
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- if (ESetId == null || ESetId == '') {
- //鑾峰彇缁忛攢鍟嗛粯璁ょ殑涓�涓悎鍚�
- List<Account> contract = [
- SELECT id, Name, State_Master__c, State_Master__r.Name
- FROM Account
- WHERE
- ParentId = :accountid
- AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
- AND Contract_Decide_Start_Date__c <= :Date.Today()
- AND Contract_Decide_End_Date__c >= :Date.Today()
- AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
- ];
- if (contract.size() == 1) {
- contractName = contract[0].Name;
- contractId = contract[0].Id;
- }
- editDelCommitBtnDisabled = true;
- List<String> DealerProductId = new List<String>();
- soql = makeSoql('', '', '', '', '', false, DealerProductId);
+ edoffersPrice = false;
+ returnOrder = false;
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
size = Integer.valueOf(System.Label.orderdetLimitsize);
- initStandardController();
- product2Selected = Database.query(soql);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ }
- for (Integer i = 0; i < product2Selected.size(); i++) {
- consumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- //鍙湁鍦ㄥ崗璁璐ф椂浼氳蛋杩欎釜for寰幆 鍏朵粬涓ょ璁㈣揣妯″紡閮借蛋鐨剆earchorderdetails鏂规硶
- if (
- String.isBlank(methodType) ||
- (!methodType.equals('promotionorder') &&
- !methodType.equals('hospitalorder'))
- ) {
- for (Integer i = 0; i < countDel.size(); i++) {
- if (
- countDel[i].promotionorder__c == false &&
- countDel[i].hospitalSpecialOffer__c == false
- ) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
+ private static void initStandardController() {
+ con = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
+ con.setPageSize(size);
+ noOfRecords = con.getResultSize();
+ }
+
+ public static List<Product2__c> product2s() {
+ return (List<Product2__c>) con.getRecords();
+ }
+
+ private static List<ConsumableorderdetailsInfo> getPageInfo() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (ass.check == true) {
+ selectedIdMap.put(ass.Prod.id, ass.Prod.id);
+ reSet.add(ass);
}
- }
}
+
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (editAble) {
+ consumableorderdetailsRecordsview = reSet;
+ }
+ Integer pagestartNo = (con.getPageNumber() * size) - size;
+ Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
+ Integer addNo = 0;
+ for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
+ addNo++;
+ //continue;
+ }
+ // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
+ // break;
+ // }
+ else {
+ if (consumableorderdetailsRecords[i].check == false) {
+ consumableorderdetailsRecords[i].esd = orderdetails1;
+ }
+ //consumableorderdetailsRecords[i].esd.Dealer_Custom_Price__c = consumableorderdetailsRecords[i].Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
+ addNo++;
+ }
+ // if (addNo >= size)
+ // break;
+ }
+ return consumableorderdetailsRecordsview;
+ }
+
+ @AuraEnabled
+ public static Results init(String type, String esetId, String keywordStr) {
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- //缁忛攢鍟嗗畾浠� 璁$畻
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- bss.sortBy = sortOrderAsc;
- bss.packing_list = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id)
- .Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id)
- .Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id)
- .OrderGoods_Limit__c;
- }
- consumableorderdetailsRecords.add(bss);
+ DealerProductId = new List<String>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ editAble = false;
+ edoffersPrice = false;
+ returnOrder = false;
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ ESetId = esetId;
+ methodType = type;
+ if (String.isBlank(methodType) && String.isNotBlank(ESetId)) {
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ methodType = oclist.get(0).orderPattern__c;
}
- consumableorderdetailsRecords.sort();
- if (
- methodType != null &&
- methodType != '' &&
- (methodType.equals('hospitalorder') ||
- methodType.equals('promotionorder'))
- ) {
- searchorderdetails(
- methodType,
- accountid,
- hospitalId,
- contractId,
- userWorkLocation,
- accountName,
- proLimitAndDate,
- editAble
- );
- isfirst = true;
+ statusEdit = keywordStr;
+ System.debug('Param:' + ESetId + '---' + methodType + '---' + statusEdit);
+ try {
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[8];
+ sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ cate1ForSort = '';
+ decisionCode = '';
+ sumPrice = 0;
+ specialCampaign = false;
+ if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) {
+ editAble = false;
+ } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ List<user> Useracc = new List<user>();
+ //lt 20230517 瀹夊窘涓ょエ鍒� add ,OSHFLG__c
+ Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c, OSHFLG__c FROM user WHERE id = :userId];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 瀹夊窘涓ょエ鍒� add
+ //lt 20230526 瀹夊窘涓ょエ鍒� start
+ OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 瀹夊窘涓ょエ鍒� add
+ if (OSHFLG) {
+ agencyProType1 = 'OSH';
+ } else if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType1 = 'ET';
+ }
+ //lt 20230526 瀹夊窘涓ょエ鍒� end
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ //閿欒淇℃伅鎻愮ず
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!'));
+ errorMsgList.add('鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!');
+ }
+ contactDealer = new List<String>();
+ Date dateToday = Date.today();
+ //鏌ヨ缁忛攢鍟嗕笅鎵�鏈夋湁鏁堝悎鍚�
+ List<Account> contractList = [
+ SELECT Id, Name, RecordType.DeveloperName
+ FROM Account
+ WHERE
+ RecordType.DeveloperName = 'AgencyContract'
+ AND Contract_Decide_Start_Date__c <= :dateToday
+ AND Contract_Decide_End_Date__c >= :dateToday
+ AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Agent_Ref__c = :accountid
+ AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ for (Account contract : contractList) {
+ contactDealer.add(contract.Id);
+ }
+ DealerProductMap = new Map<Id, Dealer_Product__c>();
+ DealerProductId = getDealerProductId();
+ Account accountInfo = [
+ SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c
+ FROM account
+ WHERE id = :accountid
+ ];
+ accountName = accountInfo.Name;
+ String product_Limit;
+ if (agencyProType == 'ET') {
+ product_Limit = accountInfo.Product_Limit_Date__c;
+ } else {
+ product_Limit = accountInfo.Product_Limit_DateENG__c;
+ }
+ if (product_Limit != null && product_Limit != '') {
+ proLimitAndDate = product_Limit.split(',');
+ }
+ saveBtnDisabled = false;
+ sorderBtnDisabled = false;
+ coc = new Consumable_order__c();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ if (String.isBlank(agencyProType)) {
+ //return ;
+ }
+ List<Product2__c> Product2Selected = new List<Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //缁忛攢鍟嗗湪搴撴暟鎹�
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ if (ESetId == null || ESetId == '') {
+ //鑾峰彇缁忛攢鍟嗛粯璁ょ殑涓�涓悎鍚�
+ List<Account> contract = [
+ SELECT id, Name, State_Master__c, State_Master__r.Name
+ FROM Account
+ WHERE
+ ParentId = :accountid
+ AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (contract.size() == 1) {
+ contractName = contract[0].Name;
+ contractId = contract[0].Id;
+ }
+ editDelCommitBtnDisabled = true;
+ List<String> DealerProductId = new List<String>();
+ soql = makeSoql('', '', '', '', '', false, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ product2Selected = Database.query(soql);
+
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //鍙湁鍦ㄥ崗璁璐ф椂浼氳蛋杩欎釜for寰幆 鍏朵粬涓ょ璁㈣揣妯″紡閮借蛋鐨剆earchorderdetails鏂规硶
+ if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //缁忛攢鍟嗗畾浠� 璁$畻
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ consumableorderdetailsRecords.sort();
+ if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) {
+ searchorderdetails(
+ methodType,
+ accountid,
+ hospitalId,
+ contractId,
+ userWorkLocation,
+ accountName,
+ proLimitAndDate,
+ editAble
+ );
+ isfirst = true;
+ }
+ getPageInfo();
+ } else {
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ List<Consumable_order__c> oclist = [
+ SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name
+ FROM Consumable_order__c
+ WHERE id = :ESetid
+ ];
+ if (oclist.get(0).orderPattern__c.equals('hospitalorder')) {
+ hospitalName = oclist.get(0).Order_ForHospital__r.Name;
+ hospitalId = oclist.get(0).Order_ForHospital__c;
+ }
+ }
+ List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
+ //淇敼
+ List<Consumable_order__c> qs = new List<Consumable_order__c>();
+ qs = [
+ SELECT
+ Id,
+ Name,
+ Order_status__c,
+ Consumable_pdf_insert_day__c,
+ Dealer_Info__c,
+ Deliver_date__c,
+ Order_Reason__c,
+ Order_date__c,
+ Contract_application_decision__c,
+ Total_amount__c,
+ Offers_Price__c,
+ Order_effective_contact__c,
+ Order_effective_contact__r.Name
+ FROM Consumable_order__c
+ WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ];
+ if (qs.size() > 0) {
+ coc = qs[0];
+ decisionCode = coc.Contract_application_decision__c;
+ contractName = coc.Order_effective_contact__r.Name;
+ contractId = coc.Order_effective_contact__r.Id;
+ }
+ if (qs[0].Order_status__c == '宸叉彁浜�' || qs[0].Order_status__c == '鎵瑰噯' || qs[0].Order_status__c == '闄勪欢涓婁紶瀹屾垚') {
+ saveBtnDisabled = true;
+ sorderBtnDisabled = true;
+ editDelCommitBtnDisabled = false;
+ }
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ ConsumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Count__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sum_of_money__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Product2__r.Packing_list_manual__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_Orderdetails__c
+ WHERE
+ recordtypeid = :System.Label.RT_ConOrderDetail1_Order
+ AND Consumable_order__c = :ESetId
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Consumable_order__r.Dealer_Info__c = :accountid
+ ];
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ if (cdc1.Consumable_Product__c != null) {
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
+ }
+ soql = makeSoqlorderdet();
+ System.debug('soql:' + soql);
+ size = orderzaikuId.size();
+ initStandardController();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (
+ String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))
+ ) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ sumPrice += cdc1.Sum_of_money__c;
+ if (ass.prod.Id == cdc1.Consumable_Product__c) {
+ ass.check = true;
+ ass.esd = cdc1;
+ }
+ }
+ }
+ //闄勪欢
+ // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId];
+ // if (attachmentinfo.size() > 0) {
+ // for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
+ // }
+ // }
+ List<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]));
+ }
+ }
+ }
+ //
+ consumableorderdetailsRecords.sort();
+ getPageInfo();
+ }
+ //璁$畻搴撳瓨涓娿�佷笅闄�
+ productLimtAndDate();
+ lowerRecord();
+ //鏄庣粏鎺掑簭
+ List<String> upper = new List<String>();
+ if (String.isNotBlank(ESetid)) {
+ for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+ if (bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null) {
+ if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) {
+ upper.add(bss.esd.Consumable_Product__r.Name__c);
+ }
+ }
+ }
+ }
+ if (upper.size() > 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!'));
+ warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!');
+ for (Integer i = 0; i < upper.size(); i++) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, upper[i]));
+ warningMsgList.add(upper[i]);
+ }
+ }
+ if (lower.size() > 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!'));
+ warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!');
+ for (Integer i = 0; i < lower.size(); i++) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, lower[i]));
+ warningMsgList.add(lower[i]);
+ }
+ }
+ //浠锋牸鏌ョ湅鏉冮檺
+ Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
+ cansee = dfr.isAccessible();
+ AggregateResult[] categoryList = [
+ SELECT Count(id), Category3_text__c c3c
+ FROM Product2__c
+ WHERE Estimation_Entry_Possibility__c = '鈼�' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL
+ GROUP BY Category3_text__c
+ ];
+ //categoty3
+ // categoryOptionList = new List<SelectOption>();
+ category3Option = new List<CusOption>();
+ // categoryOptionList.add(new SelectOption('', '-鏃�-'));
+ category3Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category3Search : categoryList) {
+ String deliverycnt = String.valueOf(category3Search.get('c3c'));
+ // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+ category3Option.add(new CusOption(deliverycnt, deliverycnt));
+ }
+ //categoty4
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ //categoty5
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ //return msg
+ consumableorderdetailsRecordsview = consumableorderdetailsRecords;
+ getConsumableShowTableFieldValue();
+ results.result = 'Success';
+ results.coc = coc;
+ results.editAble = editAble;
+ results.edoffersPrice = edoffersPrice;
+ results.editDelCommitBtnDisabled = EditDelCommitBtnDisabled;
+ results.category3Option = category3Option;
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.hospitalName = hospitalName;
+ results.contractName = contractName;
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.attachmentRecoeds = attachmentRecoeds;
+ results.cansee = cansee;
+ results.agencyProType = agencyProType;
+ results.agencyProType1 = agencyProType1;
+ results.OSHFLG = OSHFLG;
+ results.userWorkLocation = userWorkLocation;
+ results.accountName = accountName;
+ results.category_Goods = category_Goods;
+ results.specialCampaign = specialCampaign;
+ results.dealerProductId = DealerProductId;
+ results.accountid = accountid;
+ results.hospitalId = hospitalId;
+ results.contractId = contractId;
+ results.contactDealer = contactDealer;
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ results.methodType = methodType;
+ results.proLimitAndDate = proLimitAndDate;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
}
- getPageInfo();
- } else {
- if (methodType != null && methodType.equals('hospitalorder')) {
- List<Consumable_order__c> oclist = [
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryAllload(String agencyProTypeStr, String category3Str) {
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str) {
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ category4 = category4Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c = :category4
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ public static void lowerRecord() {
+ List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>();
+ //搴撳瓨鏄庣粏鍙栧緱
+ Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>();
+ List<Product2__c> product2Selected = [
+ SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c
+ FROM Product2__c
+ WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '鈼�'
+ ];
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ //鍏堟妸ConsumableorderdetailsRecords 鍋氭垚map
+ midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
SELECT
- orderPattern__c,
- Order_ForHospital__c,
- Order_ForHospital__r.Name
- FROM Consumable_order__c
- WHERE id = :ESetid
- ];
- if (oclist.get(0).orderPattern__c.equals('hospitalorder')) {
- hospitalName = oclist.get(0).Order_ForHospital__r.Name;
- hospitalId = oclist.get(0).Order_ForHospital__c;
- }
- }
- List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
- //淇敼
- List<Consumable_order__c> qs = new List<Consumable_order__c>();
- qs = [
- SELECT
- Id,
- Name,
- Order_status__c,
- Consumable_pdf_insert_day__c,
- Dealer_Info__c,
- Deliver_date__c,
- Order_Reason__c,
- Order_date__c,
- Contract_application_decision__c,
- Total_amount__c,
- Offers_Price__c,
- Order_effective_contact__c,
- Order_effective_contact__r.Name
- FROM Consumable_order__c
- WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
];
- if (qs.size() > 0) {
- coc = qs[0];
- decisionCode = coc.Contract_application_decision__c;
- contractName = coc.Order_effective_contact__r.Name;
- contractId = coc.Order_effective_contact__r.Id;
- }
- if (
- qs[0].Order_status__c == '宸叉彁浜�' ||
- qs[0].Order_status__c == '鎵瑰噯' ||
- qs[0].Order_status__c == '闄勪欢涓婁紶瀹屾垚'
- ) {
- saveBtnDisabled = true;
- sorderBtnDisabled = true;
- editDelCommitBtnDisabled = false;
- }
- // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
- ConsumableorderdetailsSelected = [
- SELECT
- Id,
- Name,
- Consumable_order__c,
- Consumable_Product__r.Name__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Count__c,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Sum_of_money__c,
- Consumable_Product__r.SFDA_Status__c,
- Consumable_Product__r.Product2__r.Packing_list_manual__c,
- Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
- Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
- FROM Consumable_Orderdetails__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail1_Order
- AND Consumable_order__c = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- AND Consumable_order__r.Dealer_Info__c = :accountid
- ];
- for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
- if (cdc1.Consumable_Product__c != null) {
- orderzaikuId.add(cdc1.Consumable_Product__c);
- }
- }
- soql = makeSoqlorderdet();
- System.debug('soql:' + soql);
- size = orderzaikuId.size();
- initStandardController();
- product2Selected = Database.query(soql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
for (Integer i = 0; i < countDel.size(); i++) {
- //add by rentx 2020-12-09
- if (
- String.isNotBlank(methodType) && methodType.equals('hospitalorder')
- ) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
}
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) || methodType.equals('promotionorder')
- ) {
- if (countDel[i].promotionorder__c == true) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
}
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) ||
- (!methodType.equals('promotionorder') &&
- !methodType.equals('hospitalorder'))
- ) {
- if (
- countDel[i].promotionorder__c == false &&
- countDel[i].hospitalSpecialOffer__c == false
- ) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
}
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
}
- }
}
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ lowerRecord = new List<ConsumableorderdetailsInfo>();
//鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- bss.packing_list = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id)
- .Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id)
- .Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id)
- .OrderGoods_Limit__c;
- }
- consumableorderdetailsRecords.add(bss);
+ for (ConsumableorderdetailsInfo bss : midMaprecord.values()) {
+ lowerRecord.add(bss);
+ }
+ allProductLimt(lowerRecord);
+ for (ConsumableorderdetailsInfo bss : lowerRecord) {
+ if (bss.allnumber < bss.lowerlimit) {
+ lower.add(bss.Prod.Name__c);
+ }
+ }
+ }
+
+ //搴撳瓨涓婁笅闄�
+ public static void productLimtAndDate() {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
}
for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- ass.sortBy = sortOrderAsc;
- for (
- Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected
- ) {
- sumPrice += cdc1.Sum_of_money__c;
- if (ass.prod.Id == cdc1.Consumable_Product__c) {
- ass.check = true;
- ass.esd = cdc1;
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
}
- }
+ }
+ }
+
+ //鍏ㄩ儴搴撳瓨涓婁笅闄�
+ private static void allProductLimt(List<ConsumableorderdetailsInfo> lowerRecord) {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for (ConsumableorderdetailsInfo ass : lowerRecord) {
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
+ }
+ }
+ }
+
+ @AuraEnabled
+ public static Results searchConsumableorderdetails(
+ String userWorkLocationStr,
+ String agencyProTypeStr,
+ String accountNameStr,
+ String accountIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String category1Str,
+ String category3Str,
+ String category4Str,
+ String category5Str,
+ String category_GoodStr,
+ Boolean specialCampaignStr,
+ String dealerProductIdStr,
+ String methodTypeStr,
+ String consumableorderdetailsRecordsviewStr,
+ Boolean editAbleStr,
+ List<String> proLimitAndDateList
+ ) {
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ userWorkLocation = userWorkLocationStr;
+ agencyProType = agencyProTypeStr;
+ accountName = accountNameStr;
+ accountid = accountIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ category1 = category1Str;
+ category3 = category3Str;
+ category4 = category4Str;
+ category5 = category5Str;
+ category_Goods = category_GoodStr;
+ specialCampaign = specialCampaignStr;
+ methodType = methodTypeStr;
+ editAble = editAbleStr;
+ proLimitAndDate = proLimitAndDateList;
+ dealerProductId = (List<String>) JSON.deserialize(dealerProductIdStr, List<String>.class);
+ consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsviewStr,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ searchDone = 'searchDone';
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ //add by rentx 2020-12-09
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ //add by rentx 2020-12-09
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ System.debug('soql:' + soql);
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfo();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ // makeMessage();
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ if (consumableorderdetailsRecords.size() > 0) {
+ getConsumableShowTableFieldValue();
+ results.result = 'Success';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '鎼滅储鍒�' + consumableorderdetailsRecords.size() + '浠朵骇鍝�';
+ } else {
+ getConsumableShowTableFieldValue();
+ results.result = 'Fail';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍖婚櫌--妫�绱�
+ @AuraEnabled
+ public static Results searchorderdetails(
+ String methodTypeStr,
+ String accountIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String userWorkLocationStr,
+ String accountNameStr,
+ List<String> proLimitAndDateList,
+ Boolean editAbleStr
+ ) {
+ Results results = new Results();
+ methodType = methodTypeStr;
+ accountId = accountIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ userWorkLocation = userWorkLocationStr;
+ accountName = accountNameStr;
+ proLimitAndDate = proLimitAndDateList;
+ editAble = editAbleStr;
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ if (methodType.equals('hospitalorder')) {
+ //鍖婚櫌id 鏈夊��
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ List<String> hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ } else if (methodType.equals('promotionorder')) {
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ if (dpclist != null && dpclist.size() > 0) {
+ String ids = '(';
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ ids += '\'' + hc.Dealer_Product2__c + '\',';
+ }
+ ids = ids.substring(0, ids.length() - 1) + ')';
+ if (hpids != null && hpids.size() > 0) {
+ // soql += ' AND Id in : hpids ';
+ soql += ' AND Id in ' + ids;
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ }
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfoForHos();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ noOfRecords = consumableorderdetailsRecords.size();
+ getConsumableShowTableFieldValue();
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ if (consumableorderdetailsRecordsview.size() > 0) {
+ results.result = 'Success';
+ results.errorMsg = '鍏辨悳绱㈠埌' + consumableorderdetailsRecordsview.size() + '鏉℃暟鎹�';
+ } else {
+ results.result = 'Fail';
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鐢ㄦ埛鍒囨崲鍖婚櫌鏃跺彇娑堥�変腑鐨勪骇鍝�
+ private static List<ConsumableorderdetailsInfo> getPageInfoForHos() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (editAble) {
+ consumableorderdetailsRecordsview = reSet;
+ }
+ Integer pagestartNo = (con.getPageNumber() * size) - size;
+ Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
+ Integer addNo = 0;
+ for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
+ addNo++;
+ //continue;
+ }
+ // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
+ // break;
+ // }
+ else {
+ if (consumableorderdetailsRecords[i].check == false) {
+ consumableorderdetailsRecords[i].esd = orderdetails1;
+ }
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
+ addNo++;
+ }
+ // if (addNo >= size){
+ // break;
+ // }
+ }
+ return consumableorderdetailsRecordsview;
+ }
+ //add by rentx 2020-12-03 end =====================================================================================================================
+ //鐗逛环
+ public static void OffersPrice() {
+ edoffersPrice = true;
+ }
+
+ //寰楀埌淇冮攢浜у搧Id
+ private static List<String> getDealerProductId() {
+ List<String> ProductId = new List<String>();
+ Map<String, String> DealerProductIdMap = new Map<String, String>();
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND Special_Campaign_Price__c != NULL
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) {
+ continue;
+ } else {
+ ProductId.add(dealerProduct.Dealer_Product2__c);
+ DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c);
+ }
+ }
+ return ProductId;
+ }
+
+ private static String makeSoql(
+ String CateName,
+ String CateCode,
+ String Category3,
+ String Category4,
+ String Category5,
+ Boolean specialCampaign,
+ List<String> DealerProductId
+ ) {
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ // add begin ================================================================================================
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ //濡傛灉鏄尰闄㈢壒浠�
+ //1.鍒ゆ柇 鍖婚櫌id鏄惁鏈夊�� 濡傛灉鏈夊�� 鍒欐牴鎹尰闄d鍘� 鍖婚櫌鐗逛环琛ㄤ腑鑾峰彇浜у搧id
+ //鍖婚櫌id 鏈夊��
+ if (hospitalId == null || hospitalId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍖婚櫌'));
+ warningMsgList.add('璇烽�夋嫨鍖婚櫌');
+ } else {
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //淇冮攢璁㈣揣
+ if (methodType != null && methodType.equals('promotionorder')) {
+ if (contractId == null || contractId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍚堝悓'));
+ warningMsgList.add('璇烽�夋嫨鍚堝悓');
+ } else {
+ //1.鏌ヨ鎵�鏈夌粡閿�鍟嗕骇鍝�
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+
+ if (dpclist != null && dpclist.size() > 0) {
+ hpids = new List<String>();
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //add end ===================================================================================================
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ if (agencyProType == 'ET') {
+ soql += ' AND Pro2_Dealer_Object__c = true';
+ }
+ if (agencyProType == 'ENG') {
+ soql += ' AND Pro2_Dealer_ENG__c = true';
+ }
+ soql += ' AND Intra_Trade_List_RMB__c > 0 ';
+ System.debug('soql +++++++++++ ' + soql);
+ return soql;
+ }
+
+ private static String makeSoqlorderdet() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderzaikuId.size(); i++) {
+ if (i < orderzaikuId.size() - 1) {
+ sqlTail += orderzaikuId[i] + '\',\'';
+ } else {
+ sqlTail += orderzaikuId[i] + '\')';
+ }
+ }
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ System.debug('sqlTail:' + sqlTail);
+ System.debug('orderzaikuId:' + orderzaikuId);
+ if (orderzaikuId.size() > 0) {
+ soql += ' AND Id in' + sqlTail;
+ }
+ return soql;
+ }
+
+ // 缂栬緫鎸夐挳
+ @AuraEnabled
+ public static Results setEditAble(String eSetidStr) {
+ Results results = new Results();
+ ESetId = eSetidStr;
+ try {
+ statusEdit = 'Redirect';
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c;
+ results.result = 'Success';
+ results.url = url;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鍐嶇敵璇�
+ @AuraEnabled
+ public static Results backOrder(String eSetidStr) {
+ Results results = new Results();
+ ESetId = eSetidStr;
+ statusEdit = 'Redirect';
+ returnOrder = true;
+ try {
+ statusEdit = 'Redirect';
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c;
+ results.result = 'Success';
+ results.url = url;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //涓婁紶闄勪欢
+ @AuraEnabled
+ public static Results filesUpload(String pId, String fileName, String base64Data) {
+ Results results = new Results();
+ try {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = pId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id = :pId];
+ c.Consumable_pdf_insert_day__c = Date.today();
+ update c;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static Results delConsumable(String eSetidStr) {
+ Results results = new Results();
+ ESetId = eSetidStr;
+ try {
+ Consumable_order__c cord = new Consumable_order__c(Id = ESetId);
+ List<Consumable_Orderdetails__c> orderdetails1 = [
+ SELECT Id
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :EsetId
+ ];
+ delete orderdetails1;
+ delete cord;
+ results.result = 'Success';
+ results.url = '/lexconsumableordermanage';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鎻愪氦鎸夐挳
+ @AuraEnabled
+ public static Results sorder(String eSetidStr, String accountidStr) {
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ ESetId = eSetidStr;
+ accountid = accountidStr;
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Map<Id, String> prodMap = new Map<Id, String>();
+ Consumable_order__c P = new Consumable_order__c();
+ P = new Consumable_order__c();
+ p.Id = ESetId;
+ p.Order_date__c = Date.today();
+ p.Order_status__c = '闄勪欢涓婁紶瀹屾垚';
+ for (Consumable_Orderdetails__c cod1 : [
+ SELECT Consumable_product__r.Product2__c, Consumable_product__r.Name__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ]) {
+ prodMap.put(cod1.Consumable_product__r.Product2__c, cod1.Consumable_product__r.Name__c);
+ }
+ // GZW 鎻愪氦浜у搧鏃犳晥 鍑洪敊璇秷鎭�
+ System.debug(prodMap);
+ Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, '');
+ System.debug(chkMap);
+ if (chkMap.size() > 0) {
+ if (chkMap.containsKey('agency')) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��'));
+ errorMsgList.add('绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��');
+ }
+ for (String proId : prodMap.keySet()) {
+ if (chkMap.containsKey(proId)) {
+ if (chkMap.get(proId) == '1') {
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�')
+ // );
+ errorMsgList.add('浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�');
+ } else if (chkMap.get(proId) == '2') {
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��')
+ // );
+ errorMsgList.add('浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��');
+ }
+ }
+ }
+ results.result = 'Fail';
+ results.errorMsg = '';
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ return results;
+ }
+ update p;
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(ESetId);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ results.result = 'Success';
+ results.url = '/lexconsumableordermanage';
+ } catch (Exception e) {
+ Database.rollback(sp);
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 椹冲洖璁㈠崟copy
+ @AuraEnabled
+ public static Results ordrCopy(
+ String contractNameStr,
+ String cocStr,
+ String agencyProTypeStr,
+ String accountidStr,
+ String consumableorderdetailsRecordsviewStr,
+ String contactDealerStr,
+ String methodTypeStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String agencyProType1Str,
+ Boolean OSHFLGStr
+ ) {
+ ESetId = '';
+ return save(
+ contractNameStr,
+ cocStr,
+ agencyProTypeStr,
+ accountidStr,
+ consumableorderdetailsRecordsviewStr,
+ contactDealerStr,
+ methodTypeStr,
+ ESetId,
+ hospitalIdStr,
+ contractIdStr,
+ agencyProType1Str,
+ OSHFLGStr
+ );
+ }
+
+ //淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static Results save(
+ String contractNameStr,
+ String cocStr,
+ String agencyProTypeStr,
+ String accountidStr,
+ String consumableorderdetailsRecordsviewStr,
+ String contactDealerStr,
+ String methodTypeStr,
+ String eSetIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String agencyProType1Str,
+ Boolean OSHFLGStr
+ ) {
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ contractName = contractNameStr;
+ agencyProType = agencyProTypeStr;
+ accountid = accountidStr;
+ methodType = methodTypeStr;
+ ESetId = eSetIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ agencyProType1 = agencyProType1Str;
+ OSHFLG = OSHFLGStr;
+ coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class);
+ contactDealer = (List<String>) JSON.deserialize(contactDealerStr, List<String>.class);
+ 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(',', ''));
+ }
+ Savepoint sp = Database.setSavepoint();
+ try {
+ if (String.isEmpty(contractName)) {
+ // coc.Order_effective_contact__c.addError('璇烽�夋嫨鍚堝悓');
+ results.result = 'Fail';
+ results.errorMsg = '璇烽�夋嫨鍚堝悓';
+ return results;
+ }
+ List<Account> contract = [
+ SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c
+ FROM account
+ WHERE
+ Name = :contractName
+ AND Id = :contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Agent_Ref__c = :accountid
+ AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (contract.size() <= 0) {
+ // coc.Order_effective_contact__c.addError('涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�';
+ return results;
+ } else {
+ if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) {
+ // coc.Order_effective_contact__c.addError('鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�';
+ return results;
+ }
+ }
+ Integer FLG = 0;
+ Integer Count = 0;
+ //add by rentx 2020-11-25
+ List<String> tpids = new List<String>();
+ //add by rentx 2020-11-25
+ for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) {
+ FLG = FLG + 1;
+ if (CheckCount.check == false) {
+ Count = Count + 1;
+ }
+ if (CheckCount.check == true) {
+ //add by rentx 2020-11-25
+ tpids.add(CheckCount.Prod.Id);
+ //add by rentx 2020-11-25
+ if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ }
+ if (
+ CheckCount.orderGoods_Limit > 0 &&
+ math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0
+ ) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟';
+ return results;
+ }
+ }
+ }
+ if (Count == FLG) {
+ results.result = 'Fail';
+ results.errorMsg = '璇烽�夋嫨鎵�闇�娑堣�楀搧';
+ return results;
+ }
+ //=======================================鍖婚櫌鐗逛环,鏈夐噾棰濈殑璇濆彇閲戦
+ Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>();
+ List<hospitalprice__c> hplist = [
+ SELECT Id, hospital__c, mPrice__c, pPrice__c, product__c, account__c
+ FROM hospitalprice__c
+ WHERE product__c IN :tpids AND mPrice__c != NULL AND account__c = :accountid
+ ];
+ for (hospitalprice__c dealerProduct : hplist) {
+ if (dealerProduct.mPrice__c != null) {
+ dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c, dealerProduct.mPrice__c);
+ }
+ }
+ //淇冮攢璁㈣揣 鏍规嵁缁忛攢鍟嗕骇鍝佷腑鐨勬暟鎹绠楅噾棰�
+ //=======================================浜у搧鐗规畩鎶樻墸
+ Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>();
+ Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>();
+ //1.鑾峰彇鏈夊紑濮嬬粨鏉熸棩鐨勪骇鍝�
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> haveDateList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c,
+ Special_Discount__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND (Special_Discount__c != NULL
+ OR Special_Campaign_Price__c != NULL)
+ ];
+ //2.鑾峰彇娌℃湁寮�濮嬬粨鏉熸棩鐨勪骇鍝�
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ Special_Discount__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ //濡傛灉淇冮攢浠锋牸涓簄ull 鍒欒缃壒娈婃姌鎵�(鐧惧垎姣�)鍒伴泦鍚�
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ }
+ }
+ //杩欐牱鍋氭槸涓轰簡璁$畻淇冮攢浠锋牸鏃� 浼樺厛璁$畻淇冮攢寮�濮嬬粨鏉熸棩涓嶄负绌虹殑浜у搧
+ //濡傛灉璇ラ泦鍚堟湁鍊� 鍒欒鏄庨渶瑕佹牴鎹綋鍓嶇殑閲戦鎴栬�呮姌鎵f潵璁$畻
+ if (haveDateList != null && haveDateList.size() > 0) {
+ for (Dealer_Product__c dealerProduct : haveDateList) {
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ }
+ }
+ }
+ //=======================================缁忛攢鍟嗗悎鍚屾姌鎵�
+ List<Account> at = [
+ SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c
+ FROM Account
+ WHERE
+ Name = :contractName
+ AND Id = :contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
+ AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Contact_Type__c LIKE :agencyProType
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (at.size() > 0 && at[0].Dealer_discount__c != null) {
+ disCount = at[0].Dealer_discount__c;
+ } else {
+ disCount = 100;
+ }
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_Orderdetails__c> Ins = new List<Consumable_Orderdetails__c>();
+ //鏂板缓璁㈠崟鏃�
+ if (String.isBlank(ESetId)) {
+ Integer i = 1;
+ Integer Roll = 0;
+ p.Name = '*';
+ p.Order_status__c = '鑽夋涓�';
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ p.Offers_Price__c = coc.Offers_Price__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.Order_effective_contact__c = contract[0].Id;
+ p.Order_Reason__c = coc.Order_Reason__c;
+ p.RecordTypeid = System.Label.RT_ConOrder_Order;
+ p.Overrule_order__c = coc.Id;
+ if (String.isNotBlank(methodType)) {
+ p.orderPattern__c = methodType;
+ }
+ insert p;
+ List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id];
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ Roll = Roll + 1;
+ if (ass.check == true) {
+ if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
+ // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ } else {
+ Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
+ InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
+ InsAfterDel.Consumable_order__c = p.id;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Box_Piece__c = '鐩�';
+ //鍗忚璁㈣揣
+ if (methodType.equals('agreementorder')) {
+ Consumable_order[0].orderPattern__c = 'agreementorder';
+
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ //=====================================================================================update by rentx 2020-11-25
+ } else if (methodType.equals('promotionorder')) {
+ Consumable_order[0].orderPattern__c = 'promotionorder';
+ //淇冮攢璁㈣揣
+ //濡傛灉淇冮攢浠锋牸涓嶄负null 鍒欑洿鎺ヤ娇鐢ㄤ績閿�浠锋牸鏉ヨ绠楅噾棰�
+ if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id);
+ system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c);
+ } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c =
+ ass.Prod.Intra_Trade_List_RMB__c *
+ dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
+ 100;
+ system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c);
+ }
+ //=====================================================================================update by rentx 2020-11-25
+ } else if (methodType.equals('hospitalorder')) {
+ //鍖婚櫌鐗逛环
+ Consumable_order[0].Order_ForHospital__c = hospitalId;
+ Consumable_order[0].orderPattern__c = 'hospitalorder';
+ if (
+ dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
+ dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
+ ) {
+ //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get('' + hospitalId + ass.Prod.Id);
+ }
+ } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c);
+ InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
+ InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ }
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ ESetId = p.id;
+ if (Consumable_order.size() > 0) {
+ update Consumable_order;
+ }
+ }
+ //淇敼涔嬪悗 淇濆瓨璁㈠崟
+ if (Ins.size() > 0) {
+ insert Ins;
+ } else {
+ //淇敼,鑾峰彇娑堣�楀搧璁㈠崟
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT Id, Name, Order_status__c, Dealer_Info__c, Deliver_date__c, Order_Reason__c, Offers_Price__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.Name = coc.Name;
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ p.Order_date__c = coc.Order_date__c;
+ p.Order_effective_contact__c = contract[0].Id;
+ p.Order_Reason__c = coc.Order_Reason__c;
+ if (bargainPrice != null) {
+ p.Offers_Price__c = bargainPrice;
+ }
+ update p;
+ List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id];
+ List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>();
+ qs = [
+ SELECT Id
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Dealer_Info__c = :accountid
+ ];
+ if (qs.size() > 0) {
+ delete qs;
+ }
+ Integer i = 1;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (ass.check == true) {
+ Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
+ if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
+ // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ } else {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
+ InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
+ InsAfterDel.Consumable_order__c = ESetId;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Box_Piece__c = '鐩�';
+ //鍗忚璁㈣揣
+ if (methodType.equals('agreementorder')) {
+ Consumable_order[0].orderPattern__c = 'agreementorder';
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ } else if (methodType.equals('promotionorder')) {
+ Consumable_order[0].orderPattern__c = 'promotionorder';
+ //淇冮攢璁㈣揣
+ if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id);
+ } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c =
+ ass.Prod.Intra_Trade_List_RMB__c *
+ dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
+ 100;
+ }
+ } else if (methodType.equals('hospitalorder')) {
+ Consumable_order[0].orderPattern__c = 'hospitalorder';
+ //鍖婚櫌鐗逛环
+ Consumable_order[0].Order_ForHospital__c = hospitalId;
+ if (
+ dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
+ dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
+ ) {
+ //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get('' + hospitalId + ass.Prod.Id);
+ }
+ } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
+ InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ }
+ // ==================================================涔嬪墠鐨勪績閿�璁㈣揣鐨勯�昏緫
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ }
+ results.result = 'Success';
+ results.eSetId = ESetId;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍒犻櫎闄勪欢
+ @AuraEnabled
+ public static Results deleteAtt(String contentVersionId, 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];
+ delete conDocument;
+ if (cvInfo.size() <= 1) {
+ Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id = :cocId];
+ c.Consumable_pdf_insert_day__c = null;
+ update c;
+ }
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public static void getConsumableShowTableFieldValue() {
+ for (ConsumableorderdetailsInfo con : consumableorderdetailsRecordsview) {
+ if (con.Prod != null) {
+ con.recordId = con.Prod.Id;
+ if (!con.oldCheck) {
+ con.prodName = con.Prod.Name__c;
+ // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c);
+ }
+ con.prodSFDAStatus = con.Prod.SFDA_Status__c;
+ con.prodCategory3 = con.Prod.Category3__c;
+ con.prodCategory4 = con.Prod.Category4__c;
+ con.prodCategory5 = con.Prod.Category5__c;
+ con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c;
+ }
+ if (con.esd != null) {
+ // if(con.oldCheck){
+ // con.prodName = con.esd.Consumable_Product__r.Name__c;
+ // }
+ con.consumableCount = con.esd.Consumable_count__c;
+ }
+ }
+ }
+
+ public class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Integer packing_list { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber_piece { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public ContentVersion Concc { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Decimal upperlimit { get; set; }
+ @AuraEnabled
+ public Decimal lowerlimit { get; set; }
+ @AuraEnabled
+ public Decimal SpecialCampaignPrice { get; set; }
+ @AuraEnabled
+ public Decimal orderGoods_Limit { get; set; }
+ @AuraEnabled
+ public Date Campaign_EndDate { get; set; }
+ @AuraEnabled
+ public String recordId { get; set; }
+ @AuraEnabled
+ public String prodName { get; set; }
+ @AuraEnabled
+ public String prodSFDAStatus { get; set; }
+ @AuraEnabled
+ public String prodCategory3 { get; set; }
+ @AuraEnabled
+ public String prodCategory4 { get; set; }
+ @AuraEnabled
+ public String prodCategory5 { get; set; }
+ @AuraEnabled
+ public Decimal prodIntraTradeList { get; set; }
+ @AuraEnabled
+ public Decimal consumableCount { get; set; }
+
+ // 宸插瓨浜у搧鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = true;
+ oldCheck = true;
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.Consumable_Count__c;
+ canSelect = true;
+ allnumber = 0;
+ allnumber_piece = 0;
+ }
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ oldCheck = false;
+ esd = new Consumable_Orderdetails__c();
+ Prod = e;
+ oldConsumableCount = null;
+ canSelect = true;
+ allnumber = 0;
+ allnumber_piece = 0;
}
//闄勪欢
- // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId];
- // if (attachmentinfo.size() > 0) {
- // for (Integer i = 0; i < attachmentinfo.size(); i++) {
- // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
- // }
- // }
- List<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]));
- }
- }
+ public ConsumableorderdetailsInfo(ContentVersion e) {
+ Concc = e;
}
- //
- consumableorderdetailsRecords.sort();
- getPageInfo();
- }
- //璁$畻搴撳瓨涓娿�佷笅闄�
- productLimtAndDate();
- lowerRecord();
- //鏄庣粏鎺掑簭
- List<String> upper = new List<String>();
- if (String.isNotBlank(ESetid)) {
- for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
- if (
- bss.esd.Consumable_count__c != null &&
- bss.allnumber != null &&
- bss.upperlimit != null
- ) {
- if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) {
- upper.add(bss.esd.Consumable_Product__r.Name__c);
- }
- }
- }
- }
- if (upper.size() > 0) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!'));
- warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!');
- for (Integer i = 0; i < upper.size(); i++) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, upper[i]));
- warningMsgList.add(upper[i]);
- }
- }
- if (lower.size() > 0) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!'));
- warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!');
- for (Integer i = 0; i < lower.size(); i++) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, lower[i]));
- warningMsgList.add(lower[i]);
- }
- }
- //浠锋牸鏌ョ湅鏉冮檺
- Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
- cansee = dfr.isAccessible();
- AggregateResult[] categoryList = [
- SELECT Count(id), Category3_text__c c3c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Product_Type__c LIKE :agencyProType
- AND Category3_text__c != NULL
- GROUP BY Category3_text__c
- ];
- //categoty3
- // categoryOptionList = new List<SelectOption>();
- category3Option = new List<CusOption>();
- // categoryOptionList.add(new SelectOption('', '-鏃�-'));
- category3Option.add(new CusOption('-鏃�-', ''));
- for (AggregateResult category3Search : categoryList) {
- String deliverycnt = String.valueOf(category3Search.get('c3c'));
- // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
- category3Option.add(new CusOption(deliverycnt, deliverycnt));
- }
- //categoty4
- // category4OptionList = new List<SelectOption>();
- category4Option = new List<CusOption>();
- // category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4Option.add(new CusOption('-鏃�-', ''));
- //categoty5
- // category5OptionList = new List<SelectOption>();
- category5Option = new List<CusOption>();
- // category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5Option.add(new CusOption('-鏃�-', ''));
- //return msg
- consumableorderdetailsRecordsview = consumableorderdetailsRecords;
- getConsumableShowTableFieldValue();
- results.result = 'Success';
- results.coc = coc;
- results.editAble = editAble;
- results.edoffersPrice = edoffersPrice;
- results.editDelCommitBtnDisabled = EditDelCommitBtnDisabled;
- results.category3Option = category3Option;
- results.category4Option = category4Option;
- results.category5Option = category5Option;
- results.hospitalName = hospitalName;
- results.contractName = contractName;
- results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
- results.attachmentRecoeds = attachmentRecoeds;
- results.cansee = cansee;
- results.agencyProType = agencyProType;
- results.agencyProType1 = agencyProType1;
- results.OSHFLG = OSHFLG;
- results.userWorkLocation = userWorkLocation;
- results.accountName = accountName;
- results.category_Goods = category_Goods;
- results.specialCampaign = specialCampaign;
- results.dealerProductId = DealerProductId;
- results.accountid = accountid;
- results.hospitalId = hospitalId;
- results.contractId = contractId;
- results.contactDealer = contactDealer;
- results.errorMsgList = errorMsgList;
- results.warningMsgList = warningMsgList;
- results.methodType = methodType;
- results.proLimitAndDate = proLimitAndDate;
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- @AuraEnabled
- public static Results categoryAllload(
- String agencyProTypeStr,
- String category3Str
- ) {
- Results results = new Results();
- agencyProType = agencyProTypeStr;
- category3 = category3Str;
- try {
- AggregateResult[] category4List = [
- SELECT Count(id), Category4_text__c c4c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Product_Type__c LIKE :agencyProType
- AND Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category4_text__c
- ];
- // category4OptionList = new List<SelectOption>();
- category4Option = new List<CusOption>();
- // category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4Option.add(new CusOption('-鏃�-', ''));
- for (AggregateResult category4Search : category4List) {
- String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
- // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
- category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
- }
- AggregateResult[] category5List = [
- SELECT Count(id), Category5_text__c c5c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Product_Type__c LIKE :agencyProType
- AND Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category5_text__c
- ];
- // category5OptionList = new List<SelectOption>();
- category5Option = new List<CusOption>();
- // category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5Option.add(new CusOption('-鏃�-', ''));
- for (AggregateResult category5Search : category5List) {
- String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
- // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
- category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
- }
- results.category4Option = category4Option;
- results.category5Option = category5Option;
- results.result = 'Success';
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- @AuraEnabled
- public static Results categoryload(
- String agencyProTypeStr,
- String category3Str,
- String category4Str
- ) {
- Results results = new Results();
- agencyProType = agencyProTypeStr;
- category3 = category3Str;
- category4 = category4Str;
- try {
- AggregateResult[] category4List = [
- SELECT Count(id), Category4_text__c c4c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Product_Type__c LIKE :agencyProType
- AND Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category4_text__c
- ];
- // category4OptionList = new List<SelectOption>();
- category4Option = new List<CusOption>();
- // category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4Option.add(new CusOption('-鏃�-', ''));
- for (AggregateResult category4Search : category4List) {
- String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
- // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
- category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
- }
-
- AggregateResult[] category5List = [
- SELECT Count(id), Category5_text__c c5c
- FROM Product2__c
- WHERE
- Estimation_Entry_Possibility__c = '鈼�'
- AND Product_Type__c LIKE :agencyProType
- AND Category3_text__c = :category3
- AND Category4_text__c = :category4
- AND Category5_text__c != NULL
- GROUP BY Category5_text__c
- ];
- // category5OptionList = new List<SelectOption>();
- category5Option = new List<CusOption>();
- // category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5Option.add(new CusOption('-鏃�-', ''));
- for (AggregateResult category5Search : category5List) {
- String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
- // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
- category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
- }
- results.category4Option = category4Option;
- results.category5Option = category5Option;
- results.result = 'Success';
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- // 鐢婚潰鍒濆鍖�
- public static void lowerRecord() {
- List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>();
- //搴撳瓨鏄庣粏鍙栧緱
- Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>();
- List<Product2__c> product2Selected = [
- SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c
- FROM Product2__c
- WHERE
- Pro2_Dealer_Object__c = TRUE
- AND Estimation_Entry_Possibility__c = '鈼�'
- ];
- for (Integer i = 0; i < product2Selected.size(); i++) {
- lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i]));
- //鍏堟妸ConsumableorderdetailsRecords 鍋氭垚map
- midMaprecord.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- List<Consumable_order_details2__c> countDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Guarantee_period_for_products__c,
- Isoverdue__c,
- Box_Piece__c,
- hospitalSpecialOffer__c,
- promotionorder__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Isoverdue__c = 1
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
- AND Dealer_Info_text__c = :accountName
- ];
- for (Integer i = 0; i < countDel.size(); i++) {
- //add by rentx 2020-12-09
- if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = midMaprecord.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) || methodType.equals('promotionorder')
- ) {
- if (countDel[i].promotionorder__c == true) {
- if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = midMaprecord.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) ||
- (!methodType.equals('promotionorder') &&
- !methodType.equals('hospitalorder'))
- ) {
- if (
- countDel[i].promotionorder__c == false &&
- countDel[i].hospitalSpecialOffer__c == false
- ) {
- if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = midMaprecord.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- }
- }
- lowerRecord = new List<ConsumableorderdetailsInfo>();
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- for (ConsumableorderdetailsInfo bss : midMaprecord.values()) {
- lowerRecord.add(bss);
- }
- allProductLimt(lowerRecord);
- for (ConsumableorderdetailsInfo bss : lowerRecord) {
- if (bss.allnumber < bss.lowerlimit) {
- lower.add(bss.Prod.Name__c);
- }
- }
- }
-
- //搴撳瓨涓婁笅闄�
- public static void productLimtAndDate() {
- String nowName = null, nowRightAsstModelNo = null;
- Map<String, String> productLimt = new Map<String, String>();
- for (Integer i = 0; i < proLimitAndDate.size(); i++) {
- nowName = proLimitAndDate[i];
- if (nowName.indexOf('|') >= 0) {
- nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
- nowName = nowName.subString(nowName.indexOf('|') + 1);
- }
- productLimt.put(nowRightAsstModelNo, nowName);
- }
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
- ass.lowerlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c)
- .subString(
- 0,
- productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')
- )
- );
- ass.upperlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c)
- .subString(
- productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1
- )
- );
- }
- }
- }
-
- //鍏ㄩ儴搴撳瓨涓婁笅闄�
- private static void allProductLimt(
- List<ConsumableorderdetailsInfo> lowerRecord
- ) {
- String nowName = null, nowRightAsstModelNo = null;
- Map<String, String> productLimt = new Map<String, String>();
- for (Integer i = 0; i < proLimitAndDate.size(); i++) {
- nowName = proLimitAndDate[i];
- if (nowName.indexOf('|') >= 0) {
- nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
- nowName = nowName.subString(nowName.indexOf('|') + 1);
- }
- productLimt.put(nowRightAsstModelNo, nowName);
- }
- for (ConsumableorderdetailsInfo ass : lowerRecord) {
- if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
- ass.lowerlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c)
- .subString(
- 0,
- productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')
- )
- );
- ass.upperlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c)
- .subString(
- productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1
- )
- );
- }
- }
- }
-
- @AuraEnabled
- public static Results searchConsumableorderdetails(
- String userWorkLocationStr,
- String agencyProTypeStr,
- String accountNameStr,
- String accountIdStr,
- String hospitalIdStr,
- String contractIdStr,
- String category1Str,
- String category3Str,
- String category4Str,
- String category5Str,
- String category_GoodStr,
- Boolean specialCampaignStr,
- String dealerProductIdStr,
- String methodTypeStr,
- String consumableorderdetailsRecordsviewStr,
- Boolean editAbleStr,
- List<String> proLimitAndDateList
- ) {
- Results results = new Results();
- errorMsgList = new List<String>();
- warningMsgList = new List<String>();
- userWorkLocation = userWorkLocationStr;
- agencyProType = agencyProTypeStr;
- accountName = accountNameStr;
- accountid = accountIdStr;
- hospitalId = hospitalIdStr;
- contractId = contractIdStr;
- category1 = category1Str;
- category3 = category3Str;
- category4 = category4Str;
- category5 = category5Str;
- category_Goods = category_GoodStr;
- specialCampaign = specialCampaignStr;
- methodType = methodTypeStr;
- editAble = editAbleStr;
- proLimitAndDate = proLimitAndDateList;
- dealerProductId = (List<String>) JSON.deserialize(
- dealerProductIdStr,
- List<String>.class
- );
- consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetailsRecordsviewStr,
- List<ConsumableorderdetailsInfo>.class
- );
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
- try {
- searchDone = 'searchDone';
- sortKey = '1';
- preSortKey = '1';
- sortOrderAsc = false;
- sortOrder = new String[7];
- sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
- Map<String, String> selectedIdMap = new Map<String, String>();
- List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- List<Consumable_order_details2__c> countDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Box_Piece__c,
- //add by rentx 2020-12-09
- hospitalSpecialOffer__c,
- promotionorder__c
- //add by rentx 2020-12-09
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- List<Product2__c> product2Selected = new List<Product2__c>();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- soql = makeSoql(
- category1,
- category_Goods,
- category3,
- category4,
- category5,
- specialCampaign,
- DealerProductId
- );
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- initStandardController();
- System.debug('soql:' + soql);
- product2Selected = Database.query(soql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- for (Integer i = 0; i < countDel.size(); i++) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (
- String.isNotBlank(methodType) && methodType.equals('hospitalorder')
- ) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) || methodType.equals('promotionorder')
- ) {
- if (countDel[i].promotionorder__c == true) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (
- String.isBlank(methodType) ||
- (!methodType.equals('promotionorder') &&
- !methodType.equals('hospitalorder'))
- ) {
- if (
- countDel[i].promotionorder__c == false &&
- countDel[i].hospitalSpecialOffer__c == false
- ) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- }
- }
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- if (selectedIdMap.containsKey(bss.Prod.id)) {
- continue;
- } else {
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id)
- .Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id)
- .Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id)
- .OrderGoods_Limit__c;
- }
- bss.sortBy = sortOrderAsc;
- bss.packing_list = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsRecords.add(bss);
- }
- }
- consumableorderdetailsRecords.sort();
- productLimtAndDate();
- getPageInfo();
- sortKey = '1';
- preSortKey = '1';
- sortOrderAsc = false;
- sortOrder = new String[7];
- sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
- cate1ForSort = category1;
- // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
- // makeMessage();
- results.errorMsgList = errorMsgList;
- results.warningMsgList = warningMsgList;
- if (consumableorderdetailsRecords.size() > 0) {
- getConsumableShowTableFieldValue();
- results.result = 'Success';
- results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
- results.errorMsg =
- '鎼滅储鍒�' +
- consumableorderdetailsRecords.size() +
- '浠朵骇鍝�';
- } else {
- getConsumableShowTableFieldValue();
- results.result = 'Fail';
- results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
- results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
- }
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- //鍖婚櫌--妫�绱�
- @AuraEnabled
- public static Results searchorderdetails(
- String methodTypeStr,
- String accountIdStr,
- String hospitalIdStr,
- String contractIdStr,
- String userWorkLocationStr,
- String accountNameStr,
- List<String> proLimitAndDateList,
- Boolean editAbleStr
- ) {
- Results results = new Results();
- methodType = methodTypeStr;
- accountId = accountIdStr;
- hospitalId = hospitalIdStr;
- contractId = contractIdStr;
- userWorkLocation = userWorkLocationStr;
- accountName = accountNameStr;
- proLimitAndDate = proLimitAndDateList;
- editAble = editAbleStr;
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
- try {
- soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
- if (methodType.equals('hospitalorder')) {
- //鍖婚櫌id 鏈夊��
- List<hospitalprice__c> hplist = [
- SELECT id, product__c
- FROM hospitalprice__c
- WHERE account__c = :accountid AND hospital__c = :hospitalId
- ];
- if (hplist != null && hplist.size() > 0) {
- List<String> hpids = new List<String>();
- for (hospitalprice__c hc : hplist) {
- hpids.add(hc.product__c);
- }
-
- if (hpids != null && hpids.size() > 0) {
- soql += ' AND Id in : hpids ';
- }
- } else {
- //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
- soql += ' AND Id = null ';
- }
- } else if (methodType.equals('promotionorder')) {
- List<Dealer_Product__c> dpclist = [
- SELECT Id, Dealer_Product2__c
- FROM Dealer_Product__c
- WHERE
- Dealer_Contact__c = :contractId
- AND (Special_Discount__c != NULL
- OR Special_Campaign_Price__c != NULL)
- ];
- if (dpclist != null && dpclist.size() > 0) {
- String ids = '(';
- for (Dealer_Product__c hc : dpclist) {
- hpids.add(hc.Dealer_Product2__c);
- ids += '\'' + hc.Dealer_Product2__c + '\',';
- }
- ids = ids.substring(0, ids.length() - 1) + ')';
- if (hpids != null && hpids.size() > 0) {
- // soql += ' AND Id in : hpids ';
- soql += ' AND Id in ' + ids;
- }
- } else {
- //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
- soql += ' AND Id = null ';
- }
- }
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- initStandardController();
- List<Product2__c> product2Selected = new List<Product2__c>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- Map<String, String> selectedIdMap = new Map<String, String>();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- product2Selected = Database.query(soql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- List<Consumable_order_details2__c> countDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Box_Piece__c,
- hospitalSpecialOffer__c,
- promotionorder__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
- AND Dealer_Info_text__c = :accountName
- ];
- for (Integer i = 0; i < countDel.size(); i++) {
- if (methodType.equals('hospitalorder')) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (methodType.equals('promotionorder')) {
- if (countDel[i].promotionorder__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- countDel[i].Consumable_Product__c
- );
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- }
- }
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- if (selectedIdMap.containsKey(bss.Prod.id)) {
- continue;
- } else {
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id)
- .Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id)
- .Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id)
- .OrderGoods_Limit__c;
- }
- bss.sortBy = sortOrderAsc;
- bss.packing_list = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsRecords.add(bss);
- }
- }
- consumableorderdetailsRecords.sort();
- productLimtAndDate();
- getPageInfoForHos();
- sortKey = '1';
- preSortKey = '1';
- sortOrderAsc = false;
- sortOrder = new String[7];
- sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
- cate1ForSort = category1;
- // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
- noOfRecords = consumableorderdetailsRecords.size();
- getConsumableShowTableFieldValue();
- results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
- if (consumableorderdetailsRecordsview.size() > 0) {
- results.result = 'Success';
- results.errorMsg =
- '鍏辨悳绱㈠埌' +
- consumableorderdetailsRecordsview.size() +
- '鏉℃暟鎹�';
- } else {
- results.result = 'Fail';
- results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
- }
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- //鐢ㄦ埛鍒囨崲鍖婚櫌鏃跺彇娑堥�変腑鐨勪骇鍝�
- private static List<ConsumableorderdetailsInfo> getPageInfoForHos() {
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- Map<String, String> selectedIdMap = new Map<String, String>();
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- if (editAble) {
- consumableorderdetailsRecordsview = reSet;
- }
- Integer pagestartNo = (con.getPageNumber() * size) - size;
- Integer pageendNo = (con.getPageNumber() * size) > noOfRecords
- ? noOfRecords
- : (con.getPageNumber() * size - 1);
- Integer addNo = 0;
- for (
- Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++
- ) {
- Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
- if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
- addNo++;
- //continue;
- }
- // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
- // break;
- // }
- else {
- if (consumableorderdetailsRecords[i].check == false) {
- consumableorderdetailsRecords[i].esd = orderdetails1;
- }
- consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
- addNo++;
- }
- // if (addNo >= size){
- // break;
- // }
- }
- return consumableorderdetailsRecordsview;
- }
- //add by rentx 2020-12-03 end =====================================================================================================================
- //鐗逛环
- public static void OffersPrice() {
- edoffersPrice = true;
- }
-
- //寰楀埌淇冮攢浜у搧Id
- private static List<String> getDealerProductId() {
- List<String> ProductId = new List<String>();
- Map<String, String> DealerProductIdMap = new Map<String, String>();
- Date dateToday = Date.today();
- List<Dealer_Product__c> DealerProductList = [
- SELECT
- Id,
- Name,
- Dealer_Product2__c,
- Special_Campaign_Price__c,
- Campaign_StartDate__c,
- Campaign_EndDate__c,
- Dealer_Contact__c,
- OrderGoods_Limit__c
- FROM Dealer_Product__c
- WHERE
- Dealer_Contact__c IN :contactDealer
- AND Campaign_StartDate__c <= :dateToday
- AND Campaign_EndDate__c >= :dateToday
- AND Special_Campaign_Price__c != NULL
- ];
- for (Dealer_Product__c dealerProduct : DealerProductList) {
- if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) {
- continue;
- } else {
- ProductId.add(dealerProduct.Dealer_Product2__c);
- DealerProductIdMap.put(
- dealerProduct.Dealer_Product2__c,
- dealerProduct.Dealer_Product2__c
- );
- }
- }
- return ProductId;
- }
-
- private static String makeSoql(
- String CateName,
- String CateCode,
- String Category3,
- String Category4,
- String Category5,
- Boolean specialCampaign,
- List<String> DealerProductId
- ) {
- String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
- // add begin ================================================================================================
- if (methodType != null && methodType.equals('hospitalorder')) {
- //濡傛灉鏄尰闄㈢壒浠�
- //1.鍒ゆ柇 鍖婚櫌id鏄惁鏈夊�� 濡傛灉鏈夊�� 鍒欐牴鎹尰闄d鍘� 鍖婚櫌鐗逛环琛ㄤ腑鑾峰彇浜у搧id
- //鍖婚櫌id 鏈夊��
- if (hospitalId == null || hospitalId == '') {
- soql += ' and id = null ';
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍖婚櫌'));
- warningMsgList.add('璇烽�夋嫨鍖婚櫌');
- } else {
- List<hospitalprice__c> hplist = [
- SELECT id, product__c
- FROM hospitalprice__c
- WHERE account__c = :accountid AND hospital__c = :hospitalId
- ];
- if (hplist != null && hplist.size() > 0) {
- hpids = new List<String>();
- for (hospitalprice__c hc : hplist) {
- hpids.add(hc.product__c);
- }
- if (hpids != null && hpids.size() > 0) {
- soql += ' AND Id in : hpids ';
- }
- } else {
- //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
- soql += ' AND Id = null ';
- return soql;
- }
- }
- }
- //淇冮攢璁㈣揣
- if (methodType != null && methodType.equals('promotionorder')) {
- if (contractId == null || contractId == '') {
- soql += ' and id = null ';
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍚堝悓'));
- warningMsgList.add('璇烽�夋嫨鍚堝悓');
- } else {
- //1.鏌ヨ鎵�鏈夌粡閿�鍟嗕骇鍝�
- List<Dealer_Product__c> dpclist = [
- SELECT Id, Dealer_Product2__c
- FROM Dealer_Product__c
- WHERE
- Dealer_Contact__c = :contractId
- AND (Special_Discount__c != NULL
- OR Special_Campaign_Price__c != NULL)
- ];
-
- if (dpclist != null && dpclist.size() > 0) {
- hpids = new List<String>();
- for (Dealer_Product__c hc : dpclist) {
- hpids.add(hc.Dealer_Product2__c);
- }
- if (hpids != null && hpids.size() > 0) {
- soql += ' AND Id in : hpids ';
- }
- } else {
- //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
- soql += ' AND Id = null ';
- return soql;
- }
- }
- }
- //add end ===================================================================================================
- if (!String.isBlank(CateName)) {
- soql +=
- ' AND (Name__c like \'%' +
- String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
- '%\' or Asset_Model_No__c like \'%' +
- String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
- '%\')';
- }
- if (!String.isBlank(Category3)) {
- soql += ' AND Category3__c = \'' + Category3 + '\'';
- }
- if (!String.isBlank(Category4)) {
- soql += ' AND Category4__c = \'' + Category4 + '\'';
- }
- if (!String.isBlank(Category5)) {
- soql += ' AND Category5__c = \'' + Category5 + '\'';
- }
- if (agencyProType == 'ET') {
- soql += ' AND Pro2_Dealer_Object__c = true';
- }
- if (agencyProType == 'ENG') {
- soql += ' AND Pro2_Dealer_ENG__c = true';
- }
- soql += ' AND Intra_Trade_List_RMB__c > 0 ';
- System.debug('soql +++++++++++ ' + soql);
- return soql;
- }
-
- private static String makeSoqlorderdet() {
- String sqlTail = '(\'';
- for (Integer i = 0; i < orderzaikuId.size(); i++) {
- if (i < orderzaikuId.size() - 1) {
- sqlTail += orderzaikuId[i] + '\',\'';
- } else {
- sqlTail += orderzaikuId[i] + '\')';
- }
- }
- String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
- System.debug('sqlTail:' + sqlTail);
- System.debug('orderzaikuId:' + orderzaikuId);
- if (orderzaikuId.size() > 0) {
- soql += ' AND Id in' + sqlTail;
- }
- return soql;
- }
-
- // 缂栬緫鎸夐挳
- @AuraEnabled
- public static Results setEditAble(String eSetidStr) {
- Results results = new Results();
- ESetId = eSetidStr;
- try {
- statusEdit = 'Redirect';
- List<Consumable_order__c> oclist = [
- SELECT orderPattern__c
- FROM Consumable_order__c
- WHERE id = :ESetid
- ];
- String url =
- '/lexconsumable?ESetid=' +
- ESetid +
- '&KeyWords=' +
- statusEdit +
- '&type=' +
- oclist.get(0).orderPattern__c;
- results.result = 'Success';
- results.url = url;
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- // 鍐嶇敵璇�
- @AuraEnabled
- public static Results backOrder(String eSetidStr) {
- Results results = new Results();
- ESetId = eSetidStr;
- statusEdit = 'Redirect';
- returnOrder = true;
- try {
- statusEdit = 'Redirect';
- List<Consumable_order__c> oclist = [
- SELECT orderPattern__c
- FROM Consumable_order__c
- WHERE id = :ESetid
- ];
- String url =
- '/lexconsumable?ESetid=' +
- ESetid +
- '&KeyWords=' +
- statusEdit +
- '&type=' +
- oclist.get(0).orderPattern__c;
- results.result = 'Success';
- results.url = url;
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- //涓婁紶闄勪欢
- @AuraEnabled
- public static Results filesUpload(
- String pId,
- String fileName,
- String base64Data
- ) {
- Results results = new Results();
- try {
- base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
- ContentVersion cv = new ContentVersion();
- cv.Title = fileName;
- cv.PathOnClient = '/' + fileName;
- cv.FirstPublishLocationId = pId;
- cv.VersionData = EncodingUtil.base64Decode(base64Data);
- cv.IsMajorVersion = true;
- insert cv;
- Consumable_order__c c = [
- SELECT Id
- FROM Consumable_order__c
- WHERE Id = :pId
- ];
- c.Consumable_pdf_insert_day__c = Date.today();
- update c;
- results.result = 'Success';
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- //鍒犻櫎鎸夐挳
- @AuraEnabled
- public static Results delConsumable(String eSetidStr) {
- Results results = new Results();
- ESetId = eSetidStr;
- try {
- Consumable_order__c cord = new Consumable_order__c(Id = ESetId);
- List<Consumable_Orderdetails__c> orderdetails1 = [
- SELECT Id
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :EsetId
- ];
- delete orderdetails1;
- delete cord;
- results.result = 'Success';
- results.url = '/lexconsumableordermanage';
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- // 鎻愪氦鎸夐挳
- @AuraEnabled
- public static Results sorder(String eSetidStr, String accountidStr) {
- Results results = new Results();
- errorMsgList = new List<String>();
- warningMsgList = new List<String>();
- ESetId = eSetidStr;
- accountid = accountidStr;
- Savepoint sp = Database.setSavepoint();
- try {
- Map<Id, String> prodMap = new Map<Id, String>();
- Consumable_order__c P = new Consumable_order__c();
- P = new Consumable_order__c();
- p.Id = ESetId;
- p.Order_date__c = Date.today();
- p.Order_status__c = '闄勪欢涓婁紶瀹屾垚';
- for (Consumable_Orderdetails__c cod1 : [
- SELECT Consumable_product__r.Product2__c, Consumable_product__r.Name__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ]) {
- prodMap.put(
- cod1.Consumable_product__r.Product2__c,
- cod1.Consumable_product__r.Name__c
- );
- }
- // GZW 鎻愪氦浜у搧鏃犳晥 鍑洪敊璇秷鎭�
- System.debug(prodMap);
- Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(
- prodMap,
- accountid,
- ''
- );
- System.debug(chkMap);
- if (chkMap.size() > 0) {
- if (chkMap.containsKey('agency')) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��'));
- errorMsgList.add('绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��');
- }
- for (String proId : prodMap.keySet()) {
- if (chkMap.containsKey(proId)) {
- if (chkMap.get(proId) == '1') {
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�')
- // );
- errorMsgList.add(
- '浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�'
- );
- } else if (chkMap.get(proId) == '2') {
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��')
- // );
- errorMsgList.add(
- '浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��'
- );
- }
- }
- }
- results.result = 'Fail';
- results.errorMsg = '';
- results.errorMsgList = errorMsgList;
- results.warningMsgList = warningMsgList;
- return results;
- }
- update p;
- Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
- psr.setObjectId(ESetId);
- Approval.ProcessResult submitResult = Approval.process(psr);
- results.result = 'Success';
- results.url = '/lexconsumableordermanage';
- } catch (Exception e) {
- Database.rollback(sp);
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- // 椹冲洖璁㈠崟copy
- @AuraEnabled
- public static Results ordrCopy(
- String contractNameStr,
- String cocStr,
- String agencyProTypeStr,
- String accountidStr,
- String consumableorderdetailsRecordsviewStr,
- String contactDealerStr,
- String methodTypeStr,
- String hospitalIdStr,
- String contractIdStr,
- String agencyProType1Str,
- Boolean OSHFLGStr
- ) {
- ESetId = '';
- return save(
- contractNameStr,
- cocStr,
- agencyProTypeStr,
- accountidStr,
- consumableorderdetailsRecordsviewStr,
- contactDealerStr,
- methodTypeStr,
- ESetId,
- hospitalIdStr,
- contractIdStr,
- agencyProType1Str,
- OSHFLGStr
- );
- }
-
- //淇濆瓨鎸夐挳
- @AuraEnabled
- public static Results save(
- String contractNameStr,
- String cocStr,
- String agencyProTypeStr,
- String accountidStr,
- String consumableorderdetailsRecordsviewStr,
- String contactDealerStr,
- String methodTypeStr,
- String eSetIdStr,
- String hospitalIdStr,
- String contractIdStr,
- String agencyProType1Str,
- Boolean OSHFLGStr
- ) {
- Results results = new Results();
- errorMsgList = new List<String>();
- warningMsgList = new List<String>();
- contractName = contractNameStr;
- agencyProType = agencyProTypeStr;
- accountid = accountidStr;
- methodType = methodTypeStr;
- ESetId = eSetIdStr;
- hospitalId = hospitalIdStr;
- contractId = contractIdStr;
- agencyProType1 = agencyProType1Str;
- OSHFLG = OSHFLGStr;
- coc = (Consumable_order__c) JSON.deserialize(
- cocStr,
- Consumable_order__c.class
- );
- contactDealer = (List<String>) JSON.deserialize(
- contactDealerStr,
- List<String>.class
- );
- 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(',', ''));
- }
- Savepoint sp = Database.setSavepoint();
- try {
- if (String.isEmpty(contractName)) {
- // coc.Order_effective_contact__c.addError('璇烽�夋嫨鍚堝悓');
- results.result = 'Fail';
- results.errorMsg = '璇烽�夋嫨鍚堝悓';
- return results;
- }
- List<Account> contract = [
- SELECT
- Id,
- Name,
- Contract_Department_Class__c,
- Contract_Quote_Decide_Flag__c
- FROM account
- WHERE
- Name = :contractName
- AND Id = :contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
- AND Contract_Decide_Start_Date__c <= :Date.Today()
- AND Contract_Decide_End_Date__c >= :Date.Today()
- AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
- AND Agent_Ref__c = :accountid
- AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
- ];
- if (contract.size() <= 0) {
- // coc.Order_effective_contact__c.addError('涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�');
- results.result = 'Fail';
- results.errorMsg = '涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�';
- return results;
- } else {
- if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) {
- // coc.Order_effective_contact__c.addError('鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�');
- results.result = 'Fail';
- results.errorMsg = '鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�';
- return results;
- }
- }
- Integer FLG = 0;
- Integer Count = 0;
- //add by rentx 2020-11-25
- List<String> tpids = new List<String>();
- //add by rentx 2020-11-25
- for (
- ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview
- ) {
- FLG = FLG + 1;
- if (CheckCount.check == false) {
- Count = Count + 1;
- }
- if (CheckCount.check == true) {
- //add by rentx 2020-11-25
- tpids.add(CheckCount.Prod.Id);
- //add by rentx 2020-11-25
- if (
- CheckCount.esd.Consumable_Count__c == null ||
- CheckCount.esd.Consumable_Count__c == 0
- ) {
- // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
- results.result = 'Fail';
- results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
- return results;
- }
- if (
- CheckCount.orderGoods_Limit > 0 &&
- math.mod(
- Integer.valueOf(CheckCount.esd.Consumable_Count__c),
- Integer.valueOf(CheckCount.orderGoods_Limit)
- ) > 0
- ) {
- // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟');
- results.result = 'Fail';
- results.errorMsg = '璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟';
- return results;
- }
- }
- }
- if (Count == FLG) {
- results.result = 'Fail';
- results.errorMsg = '璇烽�夋嫨鎵�闇�娑堣�楀搧';
- return results;
- }
- //=======================================鍖婚櫌鐗逛环,鏈夐噾棰濈殑璇濆彇閲戦
- Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>();
- List<hospitalprice__c> hplist = [
- SELECT Id, hospital__c, mPrice__c, pPrice__c, product__c, account__c
- FROM hospitalprice__c
- WHERE
- product__c IN :tpids
- AND mPrice__c != NULL
- AND account__c = :accountid
- ];
- for (hospitalprice__c dealerProduct : hplist) {
- if (dealerProduct.mPrice__c != null) {
- dealerHospitalmMap.put(
- '' + dealerProduct.hospital__c + dealerProduct.product__c,
- dealerProduct.mPrice__c
- );
- }
- }
- //淇冮攢璁㈣揣 鏍规嵁缁忛攢鍟嗕骇鍝佷腑鐨勬暟鎹绠楅噾棰�
- //=======================================浜у搧鐗规畩鎶樻墸
- Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>();
- Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>();
- //1.鑾峰彇鏈夊紑濮嬬粨鏉熸棩鐨勪骇鍝�
- Date dateToday = Date.today();
- List<Dealer_Product__c> haveDateList = [
- SELECT
- Id,
- Name,
- Dealer_Product2__c,
- Special_Campaign_Price__c,
- Campaign_StartDate__c,
- Campaign_EndDate__c,
- Dealer_Contact__c,
- OrderGoods_Limit__c,
- Special_Discount__c
- FROM Dealer_Product__c
- WHERE
- Dealer_Contact__c IN :contactDealer
- AND Campaign_StartDate__c <= :dateToday
- AND Campaign_EndDate__c >= :dateToday
- AND (Special_Discount__c != NULL
- OR Special_Campaign_Price__c != NULL)
- ];
- //2.鑾峰彇娌℃湁寮�濮嬬粨鏉熸棩鐨勪骇鍝�
- List<Dealer_Product__c> DealerProductList = [
- SELECT
- Id,
- Name,
- Dealer_Product2__c,
- Special_Campaign_Price__c,
- Campaign_StartDate__c,
- Campaign_EndDate__c,
- Dealer_Contact__c,
- Special_Discount__c,
- OrderGoods_Limit__c
- FROM Dealer_Product__c
- WHERE
- Dealer_Contact__c IN :contactDealer
- AND (Special_Discount__c != NULL
- OR Special_Campaign_Price__c != NULL)
- ];
- for (Dealer_Product__c dealerProduct : DealerProductList) {
- //濡傛灉淇冮攢浠锋牸涓簄ull 鍒欒缃壒娈婃姌鎵�(鐧惧垎姣�)鍒伴泦鍚�
- if (dealerProduct.Special_Campaign_Price__c == null) {
- dealerPDiscountMap.put(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c,
- dealerProduct.Special_Discount__c
- );
- } else {
- dealerMPDiscountMap.put(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c,
- dealerProduct.Special_Campaign_Price__c
- );
- }
- }
- //杩欐牱鍋氭槸涓轰簡璁$畻淇冮攢浠锋牸鏃� 浼樺厛璁$畻淇冮攢寮�濮嬬粨鏉熸棩涓嶄负绌虹殑浜у搧
- //濡傛灉璇ラ泦鍚堟湁鍊� 鍒欒鏄庨渶瑕佹牴鎹綋鍓嶇殑閲戦鎴栬�呮姌鎵f潵璁$畻
- if (haveDateList != null && haveDateList.size() > 0) {
- for (Dealer_Product__c dealerProduct : haveDateList) {
- if (dealerProduct.Special_Campaign_Price__c == null) {
- dealerPDiscountMap.put(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c,
- dealerProduct.Special_Discount__c
- );
- dealerMPDiscountMap.remove(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c
- );
- } else {
- dealerMPDiscountMap.put(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c,
- dealerProduct.Special_Campaign_Price__c
- );
- dealerPDiscountMap.remove(
- '' +
- dealerProduct.Dealer_Contact__c +
- dealerProduct.Dealer_Product2__c
- );
- }
- }
- }
- //=======================================缁忛攢鍟嗗悎鍚屾姌鎵�
- List<Account> at = [
- SELECT
- id,
- Name,
- State_Master__c,
- State_Master__r.Name,
- Sales_Section__c,
- Dealer_discount__c
- FROM Account
- WHERE
- Name = :contractName
- AND Id = :contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
- AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
- AND Contact_Type__c LIKE :agencyProType
- AND Contract_Decide_Start_Date__c <= :Date.Today()
- AND Contract_Decide_End_Date__c >= :Date.Today()
- AND Contract_Decide_End_Date__c >= :Date.Today()
- AND OSH_Dealer__c = :OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
- ];
- if (at.size() > 0 && at[0].Dealer_discount__c != null) {
- disCount = at[0].Dealer_discount__c;
- } else {
- disCount = 100;
- }
- Consumable_order__c P = new Consumable_order__c();
- List<Consumable_Orderdetails__c> Ins = new List<Consumable_Orderdetails__c>();
- //鏂板缓璁㈠崟鏃�
- if (String.isBlank(ESetId)) {
- Integer i = 1;
- Integer Roll = 0;
- p.Name = '*';
- p.Order_status__c = '鑽夋涓�';
- p.Dealer_Info__c = accountid;
- p.Order_ProType__c = agencyProType;
- p.Offers_Price__c = coc.Offers_Price__c;
- p.Order_date__c = coc.Order_date__c;
- p.Order_effective_contact__c = contract[0].Id;
- p.Order_Reason__c = coc.Order_Reason__c;
- p.RecordTypeid = System.Label.RT_ConOrder_Order;
- p.Overrule_order__c = coc.Id;
- if (String.isNotBlank(methodType)) {
- p.orderPattern__c = methodType;
- }
- insert p;
- List<Consumable_order__c> Consumable_order = [
- SELECT Name, orderPattern__c
- FROM Consumable_order__c
- WHERE id = :p.id
- ];
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview
- ) {
- Roll = Roll + 1;
- if (ass.check == true) {
- if (
- ass.esd.Consumable_Count__c == null ||
- ass.esd.Consumable_Count__c == 0
- ) {
- // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
- results.result = 'Fail';
- results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
- return results;
- } else {
- Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
- }
- InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
- InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
- InsAfterDel.Consumable_order__c = p.id;
- InsAfterDel.Consumable_Product__c = ass.Prod.id;
- InsAfterDel.Box_Piece__c = '鐩�';
- //鍗忚璁㈣揣
- if (methodType.equals('agreementorder')) {
- Consumable_order[0].orderPattern__c = 'agreementorder';
-
- InsAfterDel.Intra_Trade_List_RMB__c =
- ass.Prod.Intra_Trade_List_RMB__c *
- disCount /
- 100;
- //=====================================================================================update by rentx 2020-11-25
- } else if (methodType.equals('promotionorder')) {
- Consumable_order[0].orderPattern__c = 'promotionorder';
- //淇冮攢璁㈣揣
- //濡傛灉淇冮攢浠锋牸涓嶄负null 鍒欑洿鎺ヤ娇鐢ㄤ績閿�浠锋牸鏉ヨ绠楅噾棰�
- if (
- dealerMPDiscountMap.containsKey(
- '' + contract[0].Id + ass.Prod.Id
- )
- ) {
- InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get(
- '' + contract[0].Id + ass.Prod.Id
- );
- system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c);
- } else if (
- dealerPDiscountMap.containsKey(
- '' + contract[0].Id + ass.Prod.Id
- )
- ) {
- InsAfterDel.Intra_Trade_List_RMB__c =
- ass.Prod.Intra_Trade_List_RMB__c *
- dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
- 100;
- system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c);
+ // 鎺掑簭Consumable_order__c
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (check == true) {
+ if (sortBy == false) {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = 1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
}
- //=====================================================================================update by rentx 2020-11-25
- } else if (methodType.equals('hospitalorder')) {
- //鍖婚櫌鐗逛环
- Consumable_order[0].Order_ForHospital__c = hospitalId;
- Consumable_order[0].orderPattern__c = 'hospitalorder';
- if (
- dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
- dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
- ) {
- //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
- InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(
- '' + hospitalId + ass.Prod.Id
- );
- }
- } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
- InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(
- ass.Prod.Id
- )
- .Special_Campaign_Price__c;
- system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c);
- InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
- InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(
- ass.Prod.Id
- )
- .Special_Campaign_Price__c;
- }
- InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- i++;
- Ins.add(InsAfterDel);
- }
- }
- }
- ESetId = p.id;
- if (Consumable_order.size() > 0) {
- update Consumable_order;
- }
- }
- //淇敼涔嬪悗 淇濆瓨璁㈠崟
- if (Ins.size() > 0) {
- insert Ins;
- } else {
- //淇敼,鑾峰彇娑堣�楀搧璁㈠崟
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- cocinfo = [
- SELECT
- Id,
- Name,
- Order_status__c,
- Dealer_Info__c,
- Deliver_date__c,
- Order_Reason__c,
- Offers_Price__c
- FROM Consumable_order__c
- WHERE Id = :ESetId
- ];
- if (cocinfo.size() > 0) {
- p = cocinfo[0];
- }
- p.Name = coc.Name;
- p.Dealer_Info__c = accountid;
- p.Order_ProType__c = agencyProType;
- p.Order_date__c = coc.Order_date__c;
- p.Order_effective_contact__c = contract[0].Id;
- p.Order_Reason__c = coc.Order_Reason__c;
- if (bargainPrice != null) {
- p.Offers_Price__c = bargainPrice;
- }
- update p;
- List<Consumable_order__c> Consumable_order = [
- SELECT Name, orderPattern__c
- FROM Consumable_order__c
- WHERE id = :p.id
- ];
- List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>();
- qs = [
- SELECT Id
- FROM Consumable_Orderdetails__c
- WHERE
- Consumable_order__c = :ESetId
- AND Consumable_order__r.Dealer_Info__c = :accountid
- ];
- if (qs.size() > 0) {
- delete qs;
- }
- Integer i = 1;
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview
- ) {
- if (ass.check == true) {
- Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
- if (
- ass.esd.Consumable_Count__c == null ||
- ass.esd.Consumable_Count__c == 0
- ) {
- // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
- results.result = 'Fail';
- results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
- return results;
} else {
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
- }
- InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
- InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
- InsAfterDel.Consumable_order__c = ESetId;
- InsAfterDel.Consumable_Product__c = ass.Prod.id;
- InsAfterDel.Box_Piece__c = '鐩�';
- //鍗忚璁㈣揣
- if (methodType.equals('agreementorder')) {
- Consumable_order[0].orderPattern__c = 'agreementorder';
- InsAfterDel.Intra_Trade_List_RMB__c =
- ass.Prod.Intra_Trade_List_RMB__c *
- disCount /
- 100;
- } else if (methodType.equals('promotionorder')) {
- Consumable_order[0].orderPattern__c = 'promotionorder';
- //淇冮攢璁㈣揣
- if (
- dealerMPDiscountMap.containsKey(
- '' + contract[0].Id + ass.Prod.Id
- )
- ) {
- InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get(
- '' + contract[0].Id + ass.Prod.Id
- );
- } else if (
- dealerPDiscountMap.containsKey(
- '' + contract[0].Id + ass.Prod.Id
- )
- ) {
- InsAfterDel.Intra_Trade_List_RMB__c =
- ass.Prod.Intra_Trade_List_RMB__c *
- dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
- 100;
+ if (sortBy == false) {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = 1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
}
- } else if (methodType.equals('hospitalorder')) {
- Consumable_order[0].orderPattern__c = 'hospitalorder';
- //鍖婚櫌鐗逛环
- Consumable_order[0].Order_ForHospital__c = hospitalId;
- if (
- dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
- dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
- ) {
- //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
- InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(
- '' + hospitalId + ass.Prod.Id
- );
- }
- } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
- InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(
- ass.Prod.Id
- )
- .Special_Campaign_Price__c;
- InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
- InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(
- ass.Prod.Id
- )
- .Special_Campaign_Price__c;
- }
- // ==================================================涔嬪墠鐨勪績閿�璁㈣揣鐨勯�昏緫
- InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- i++;
- Ins.add(InsAfterDel);
}
- }
}
- if (Ins.size() > 0) {
- insert Ins;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public String eSetId;
+ @AuraEnabled
+ public String agencyProType;
+ @AuraEnabled
+ public String userWorkLocation;
+ @AuraEnabled
+ public String accountName;
+ @AuraEnabled
+ public String accountid;
+ @AuraEnabled
+ public String hospitalId;
+ @AuraEnabled
+ public String contractId;
+ @AuraEnabled
+ public String category_Goods;
+ @AuraEnabled
+ public Consumable_order__c coc;
+ @AuraEnabled
+ public Boolean edoffersPrice;
+ @AuraEnabled
+ public Boolean editDelCommitBtnDisabled;
+ @AuraEnabled
+ public Boolean editAble;
+ @AuraEnabled
+ public String hospitalName;
+ @AuraEnabled
+ public String contractName;
+ @AuraEnabled
+ public List<CusOption> category3Option;
+ @AuraEnabled
+ public List<CusOption> category4Option;
+ @AuraEnabled
+ public List<CusOption> category5Option;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> attachmentRecoeds;
+ @AuraEnabled
+ public Boolean cansee;
+ @AuraEnabled
+ public List<String> errorMsgList;
+ @AuraEnabled
+ public List<String> warningMsgList;
+ @AuraEnabled
+ public Boolean hasWarning;
+ @AuraEnabled
+ public Boolean hasError;
+ @AuraEnabled
+ public Boolean specialCampaign;
+ @AuraEnabled
+ public List<String> dealerProductId;
+ @AuraEnabled
+ public List<String> contactDealer;
+ @AuraEnabled
+ public String url;
+ @AuraEnabled
+ public String methodType;
+ @AuraEnabled
+ public List<String> proLimitAndDate;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ @AuraEnabled
+ public Boolean OSHFLG;
+ @AuraEnabled
+ public String agencyProType1;
+ }
+
+ public class CusOption {
+ CusOption(String label, String value) {
+ this.label = label;
+ this.value = value;
}
- }
- results.result = 'Success';
- results.eSetId = ESetId;
- } catch (Exception e) {
- Database.rollback(sp);
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
- //鍒犻櫎闄勪欢
- @AuraEnabled
- public static Results deleteAtt(String contentVersionId, 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
- ];
- delete conDocument;
- if (cvInfo.size() <= 1) {
- Consumable_order__c c = [
- SELECT Id
- FROM Consumable_order__c
- WHERE Id = :cocId
- ];
- c.Consumable_pdf_insert_day__c = null;
- update c;
- }
- results.result = 'Success';
- } catch (Exception e) {
- results.result = 'Fail';
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
}
- return results;
- }
-
- public static void getConsumableShowTableFieldValue() {
- for (ConsumableorderdetailsInfo con : consumableorderdetailsRecordsview) {
- if (con.Prod != null) {
- con.recordId = con.Prod.Id;
- if (!con.oldCheck) {
- con.prodName = con.Prod.Name__c;
- // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c);
- }
- con.prodSFDAStatus = con.Prod.SFDA_Status__c;
- con.prodCategory3 = con.Prod.Category3__c;
- con.prodCategory4 = con.Prod.Category4__c;
- con.prodCategory5 = con.Prod.Category5__c;
- con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c;
- }
- if (con.esd != null) {
- // if(con.oldCheck){
- // con.prodName = con.esd.Consumable_Product__r.Name__c;
- // }
- con.consumableCount = con.esd.Consumable_count__c;
- }
- }
- }
-
- public class ConsumableorderdetailsInfo implements Comparable {
- @AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Boolean oldCheck { get; set; }
- @AuraEnabled
- public Consumable_Orderdetails__c esd { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Integer packing_list { get; set; }
- @AuraEnabled
- public Date expiration_Date { get; set; }
- @AuraEnabled
- public String approbation_No { get; set; }
- @AuraEnabled
- public Decimal allnumber { get; set; }
- @AuraEnabled
- public Decimal allnumber_piece { get; set; }
- @AuraEnabled
- public Decimal oldConsumableCount { get; set; }
- @AuraEnabled
- public Boolean canSelect { get; set; }
- @AuraEnabled
- public ContentVersion Concc { get; set; }
- @AuraEnabled
- public Boolean sortBy { get; set; }
- @AuraEnabled
- public Decimal upperlimit { get; set; }
- @AuraEnabled
- public Decimal lowerlimit { get; set; }
- @AuraEnabled
- public Decimal SpecialCampaignPrice { get; set; }
- @AuraEnabled
- public Decimal orderGoods_Limit { get; set; }
- @AuraEnabled
- public Date Campaign_EndDate { get; set; }
- @AuraEnabled
- public String recordId { get; set; }
- @AuraEnabled
- public String prodName { get; set; }
- @AuraEnabled
- public String prodSFDAStatus { get; set; }
- @AuraEnabled
- public String prodCategory3 { get; set; }
- @AuraEnabled
- public String prodCategory4 { get; set; }
- @AuraEnabled
- public String prodCategory5 { get; set; }
- @AuraEnabled
- public Decimal prodIntraTradeList { get; set; }
- @AuraEnabled
- public Decimal consumableCount { get; set; }
-
- // 宸插瓨浜у搧鏄庣粏
- public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
- check = true;
- oldCheck = true;
- esd = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.Consumable_Count__c;
- canSelect = true;
- allnumber = 0;
- allnumber_piece = 0;
- }
-
- public ConsumableorderdetailsInfo(Product2__c e) {
- check = false;
- oldCheck = false;
- esd = new Consumable_Orderdetails__c();
- Prod = e;
- oldConsumableCount = null;
- canSelect = true;
- allnumber = 0;
- allnumber_piece = 0;
- }
- //闄勪欢
- public ConsumableorderdetailsInfo(ContentVersion e) {
- Concc = e;
- }
- // 鎺掑簭Consumable_order__c
- public Integer compareTo(Object compareTo) {
- ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
- Integer returnValue = 0;
- if (check == true) {
- if (sortBy == false) {
- if (allnumber > compareToesd.allnumber) {
- returnValue = -1;
- } else if (allnumber < compareToesd.allnumber) {
- returnValue = 1;
- }
- return returnValue;
- } else {
- if (allnumber > compareToesd.allnumber) {
- returnValue = 1;
- } else if (allnumber < compareToesd.allnumber) {
- returnValue = -1;
- }
- return returnValue;
- }
- } else {
- if (sortBy == false) {
- if (allnumber > compareToesd.allnumber) {
- returnValue = -1;
- } else if (allnumber < compareToesd.allnumber) {
- returnValue = 1;
- }
- return returnValue;
- } else {
- if (allnumber > compareToesd.allnumber) {
- returnValue = 1;
- } else if (allnumber < compareToesd.allnumber) {
- returnValue = -1;
- }
- return returnValue;
- }
- }
- }
- }
-
- public class Results {
- @AuraEnabled
- public String result;
- @AuraEnabled
- public String errorMsg;
- @AuraEnabled
- public String eSetId;
- @AuraEnabled
- public String agencyProType;
- @AuraEnabled
- public String userWorkLocation;
- @AuraEnabled
- public String accountName;
- @AuraEnabled
- public String accountid;
- @AuraEnabled
- public String hospitalId;
- @AuraEnabled
- public String contractId;
- @AuraEnabled
- public String category_Goods;
- @AuraEnabled
- public Consumable_order__c coc;
- @AuraEnabled
- public Boolean edoffersPrice;
- @AuraEnabled
- public Boolean editDelCommitBtnDisabled;
- @AuraEnabled
- public Boolean editAble;
- @AuraEnabled
- public String hospitalName;
- @AuraEnabled
- public String contractName;
- @AuraEnabled
- public List<CusOption> category3Option;
- @AuraEnabled
- public List<CusOption> category4Option;
- @AuraEnabled
- public List<CusOption> category5Option;
- @AuraEnabled
- public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview;
- @AuraEnabled
- public List<ConsumableorderdetailsInfo> attachmentRecoeds;
- @AuraEnabled
- public Boolean cansee;
- @AuraEnabled
- public List<String> errorMsgList;
- @AuraEnabled
- public List<String> warningMsgList;
- @AuraEnabled
- public Boolean hasWarning;
- @AuraEnabled
- public Boolean hasError;
- @AuraEnabled
- public Boolean specialCampaign;
- @AuraEnabled
- public List<String> dealerProductId;
- @AuraEnabled
- public List<String> contactDealer;
- @AuraEnabled
- public String url;
- @AuraEnabled
- public String methodType;
- @AuraEnabled
- public List<String> proLimitAndDate;
- @AuraEnabled
- public Boolean isNoteStay;
- @AuraEnabled
- public Boolean OSHFLG;
- @AuraEnabled
- public String agencyProType1;
- }
-
- public class CusOption {
- CusOption(String label, String value) {
- this.label = label;
- this.value = value;
- }
-
- @AuraEnabled
- public String label;
- @AuraEnabled
- public String value;
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableControllerTest.cls b/force-app/main/default/classes/LexConsumableControllerTest.cls
index 62c307b..0ffe51a 100644
--- a/force-app/main/default/classes/LexConsumableControllerTest.cls
+++ b/force-app/main/default/classes/LexConsumableControllerTest.cls
@@ -1,1377 +1,780 @@
@istest
public class LexConsumableControllerTest {
- @IsTest
- static void ConsumableOrdertest1() {
- user MyUser_Test;
- Account myAccount1;
- Account contract;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- List<RecordType> rectCo1 = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND DeveloperName = 'AgencyContract'
- ];
+ @IsTest
+ static void ConsumableOrdertest1(){
+ user MyUser_Test;
+ Account myAccount1;
+ Account contract;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- contract = new Account(
- RecordTypeId = rectCo1[0].Id,
- Name = 'contractName',
- ParentId = myAccount1.id,
- Agent_Ref__c = myAccount1.id,
- Contract_Department_Class__c = 'ET',
- Contract_Decide_Start_Date__c = Date.today().addDays(-2),
- Contract_Decide_End_Date__c = Date.today().addDays(2),
- Dealer_discount__c = 0.8
- );
- insert contract;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
+ Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
+ insert contract;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
+
+ }
+
+ System.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod01 = new Product2(Name='Test01',
+ ProductCode='Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = '鍏跺畠',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test001',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+
+ Product2 prod02 = new Product2(Name='Test02',
+ ProductCode='Test02',
+ Asset_Model_No__c = 'Test02',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'ENT',
+ Category4__c = 'Celon',
+ Category5__c = 'Celon',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test002',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+
+ Product2 prod03 = new Product2(Name='Test03',
+ ProductCode='Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'US',
+ Category4__c = 'ALOKA',
+ Category5__c = '浣撳瓒呭0',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02,prod03};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert proG;
+ System.debug('proG:'+proG);
+ System.debug('proG1:'+proG.Estimation_Entry_Possibility__c);
+ System.debug('prod07:'+prod01);
+ System.debug('prod071:'+prod01.Estimation_Entry_Possibility__c);
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert proF;
+
+
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ order.orderPattern__c = 'agreementorder';
+ insert order;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = order.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = proG.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
+ createDetail2 = new Consumable_order_details2__c();
+ createDetail2.Consumable_Product__c = proG.id;
+ createDetail2.Asset_Model_No__c = 'Test01';
+ createDetail2.Consumable_order_minor__c = order.id;
+ createDetail2.Consumable_Arrived_order__c = order.id;
+ createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail2.Asset_Model_No__c = proG.Asset_Model_No__c;
+ createDetail2.Bar_Code__c = '123';
+ createDetail2.Box_Piece__c ='鐩�';
+ createDetail2.Arrive_date__c = Date.today();
+
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ insert createDetail2;
+
+ Test.startTest();
+ LexConsumableController.ConsumableorderdetailsInfo c1 = new LexConsumableController.ConsumableorderdetailsInfo(Orderdet);
+ ContentVersion v = new ContentVersion();
+ LexConsumableController.ConsumableorderdetailsInfo c2 = new LexConsumableController.ConsumableorderdetailsInfo(v);
+ LexConsumableController l = new LexConsumableController();
+ LexConsumableController.Results re = LexConsumableController.init('', order.Id, '');
+ LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
+ LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
+ LexConsumableController.sorder(order.Id,myAccount1.Id);
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ @IsTest
+ static void ConsumableOrdertest2(){
+ user MyUser_Test;
+ Account myAccount1;
+ Account contract;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'ENT',
- Category4__c = 'Celon',
- Category5__c = 'Celon',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
+ Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
+ insert contract;
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert proG;
- System.debug('proG:' + proG);
- System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
- System.debug('prod07:' + prod01);
- System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert proF;
+ }
+
+ System.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod01 = new Product2(Name='Test01',
+ ProductCode='Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = '鍏跺畠',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test001',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- order.orderPattern__c = 'agreementorder';
- insert order;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = order.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = proG.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Product2 prod02 = new Product2(Name='Test02',
+ ProductCode='Test02',
+ Asset_Model_No__c = 'Test02',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'ENT',
+ Category4__c = 'Celon',
+ Category5__c = 'Celon',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test002',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
- Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
- createDetail2 = new Consumable_order_details2__c();
- createDetail2.Consumable_Product__c = proG.id;
- createDetail2.Asset_Model_No__c = 'Test01';
- createDetail2.Consumable_order_minor__c = order.id;
- createDetail2.Consumable_Arrived_order__c = order.id;
- createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail2.Asset_Model_No__c = proG.Asset_Model_No__c;
- createDetail2.Bar_Code__c = '123';
- createDetail2.Box_Piece__c = '鐩�';
- createDetail2.Arrive_date__c = Date.today();
+ Product2 prod03 = new Product2(Name='Test03',
+ ProductCode='Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'US',
+ Category4__c = 'ALOKA',
+ Category5__c = '浣撳瓒呭0',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02,prod03};
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- insert createDetail2;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert proG;
+ System.debug('proG:'+proG);
+ System.debug('proG1:'+proG.Estimation_Entry_Possibility__c);
+ System.debug('prod07:'+prod01);
+ System.debug('prod071:'+prod01.Estimation_Entry_Possibility__c);
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert proF;
- Test.startTest();
- LexConsumableController.ConsumableorderdetailsInfo c1 = new LexConsumableController.ConsumableorderdetailsInfo(
- Orderdet
- );
- ContentVersion v = new ContentVersion();
- LexConsumableController.ConsumableorderdetailsInfo c2 = new LexConsumableController.ConsumableorderdetailsInfo(
- v
- );
- LexConsumableController l = new LexConsumableController();
- LexConsumableController.Results re = LexConsumableController.init(
- '',
- order.Id,
- ''
- );
- LexConsumableController.searchConsumableorderdetails(
- re.userWorkLocation,
- re.agencyProType,
- re.accountName,
- re.accountid,
- re.hospitalId,
- re.contractId,
- 'testMing',
- '',
- '',
- '',
- re.category_Goods,
- re.specialCampaign,
- JSON.serialize(re.dealerProductId),
- re.methodType,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- re.editAble,
- re.proLimitAndDate
- );
- LexConsumableController.searchorderdetails(
- re.methodType,
- re.accountid,
- re.hospitalId,
- re.contractId,
- re.userWorkLocation,
- re.accountName,
- re.proLimitAndDate,
- re.editAble
- );
- LexConsumableController.sorder(order.Id, myAccount1.Id);
- Test.stopTest();
- }
- }
+ //鍒涘缓鍖婚櫌
+ Account hospital = new Account();
+ hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
+ hospital.Name = 'test hospital';
+ hospital.Is_Active__c = '鏈夊姽';
+ hospital.Attribute_Type__c = '鍗敓閮�';
+ hospital.Speciality_Type__c = '缁煎悎鍖婚櫌';
+ hospital.Grade__c = '涓�绾�';
+ hospital.OCM_Category__c = 'SLTV';
+ hospital.Is_Medical__c = '鍖荤枟鏈烘瀯';
+ hospital.Town__c = '涓滀含';
+ insert hospital;
- @IsTest
- static void ConsumableOrdertest2() {
- user MyUser_Test;
- Account myAccount1;
- Account contract;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- List<RecordType> rectCo1 = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND DeveloperName = 'AgencyContract'
- ];
+ //寤轰竴鏉″尰闄㈢壒浠蜂骇鍝�
+ hospitalprice__c hc = new hospitalprice__c();
+ hc.hospital__c = hospital.Id;
+ hc.product__c = proG.Id;
+ hc.aph__c = '12332';
+ hc.account__c = myAccount1.Id;
+ insert hc;
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- contract = new Account(
- RecordTypeId = rectCo1[0].Id,
- Name = 'contractName',
- ParentId = myAccount1.id,
- Agent_Ref__c = myAccount1.id,
- Contract_Department_Class__c = 'ET',
- Contract_Decide_Start_Date__c = Date.today().addDays(-2),
- Contract_Decide_End_Date__c = Date.today().addDays(2),
- Dealer_discount__c = 0.8
- );
- insert contract;
+ //鍖婚櫌
+ Consumable_order__c order1 = new Consumable_order__c();
+ order1.Name = 'testMing1';
+ order1.Order_status__c = '鎵瑰噯';
+ order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order1.Dealer_Info__c = myAccount1.id;
+ order1.Inventory_date__c = Date.today();
+ order1.Order_type__c = '璁㈠崟';
+ order1.Order_ProType__c = 'ET';
+ order1.orderPattern__c = 'hospitalorder';
+ insert order1;
+ Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
+ Orderdet1.Name = 'OCM_01_00102';
+ Orderdet1.Consumable_order__c = order1.Id;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet1.Consumable_Product__c = proG.Id;
+ Orderdet1.Consumable_count__c = 4;
+ insert Orderdet1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ Consumable_order_details2__c createDetail3 = new Consumable_order_details2__c();
+ createDetail3 = new Consumable_order_details2__c();
+ createDetail3.Consumable_Product__c = proG.id;
+ createDetail3.Asset_Model_No__c = 'Test02';
+ createDetail3.Consumable_order_minor__c = order1.id;
+ createDetail3.Consumable_Arrived_order__c = order1.id;
+ createDetail3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ createDetail3.Bar_Code__c = '123';
+ createDetail3.Box_Piece__c ='鐩�';
+ createDetail3.Arrive_date__c = Date.today();
+
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ insert createDetail3;
+
+ Test.startTest();
+ LexConsumableController.Results re = LexConsumableController.init('', order1.Id, '');
+ LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
+ LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
+ LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, hospital.Id, contract.Id, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
+ LexConsumableController.searchorderdetails(re.methodType, re.accountid, hospital.Id, contract.Id, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ @IsTest
+ static void ConsumableOrdertest3(){
+ user MyUser_Test;
+ Account myAccount1;
+ Account contract;
+ Consumable_order__c order2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'ENT',
- Category4__c = 'Celon',
- Category5__c = 'Celon',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
+ Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
+ insert contract;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
+ //浜у搧鏁版嵁
+ Product2 prod01 = new Product2(Name='Test01',
+ ProductCode='Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = '鍏跺畠',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test001',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+
+ Product2 prod02 = new Product2(Name='Test02',
+ ProductCode='Test02',
+ Asset_Model_No__c = 'Test02',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'ENT',
+ Category4__c = 'Celon',
+ Category5__c = 'Celon',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test002',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+
+ Product2 prod03 = new Product2(Name='Test03',
+ ProductCode='Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'US',
+ Category4__c = 'ALOKA',
+ Category5__c = '浣撳瓒呭0',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02,prod03};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert proG;
+ System.debug('proG:'+proG);
+ System.debug('proG1:'+proG.Estimation_Entry_Possibility__c);
+ System.debug('prod07:'+prod01);
+ System.debug('prod071:'+prod01.Estimation_Entry_Possibility__c);
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert proF;
+
+ Dealer_Product__c dpc = new Dealer_Product__c();
+ dpc.Dealer_Contact__c = contract.id;
+ dpc.Dealer_Product2__c = proG.id;
+ dpc.Special_Discount__c = 45;
+ dpc.Campaign_StartDate__c = Date.today().addDays(-1);
+ dpc.Campaign_EndDate__c = Date.today().addDays(1);
+ insert dpc;
+
+ Dealer_Product__c dpc2 = new Dealer_Product__c();
+ dpc2.Dealer_Contact__c = contract.id;
+ dpc2.Dealer_Product2__c = proG.id;
+ dpc2.Special_Campaign_Price__c = 4500;
+ insert dpc2;
+
+ Dealer_Product__c dpc1 = new Dealer_Product__c();
+ dpc1.Dealer_Contact__c = contract.id;
+ dpc1.Dealer_Product2__c = proH.id;
+ dpc1.Special_Campaign_Price__c = 23456;
+ insert dpc1;
+ //淇冮攢
+ order2 = new Consumable_order__c();
+ order2.Name = 'testMing2';
+ order2.Order_status__c = '鎵瑰噯';
+ order2.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order2.Dealer_Info__c = myAccount1.id;
+ order2.Inventory_date__c = Date.today();
+ order2.Order_type__c = '璁㈠崟';
+ order2.Order_ProType__c = 'ET';
+ order2.orderPattern__c = 'promotionorder';
+ insert order2;
+ Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
+ Orderdet2.Name = 'OCM_01_00103';
+ Orderdet2.Consumable_order__c = order2.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet2.Consumable_Product__c = proG.Id;
+ Orderdet2.Consumable_count__c = 4;
+ insert Orderdet2;
+
+ Consumable_order_details2__c createDetail4 = new Consumable_order_details2__c();
+ createDetail4 = new Consumable_order_details2__c();
+ createDetail4.Consumable_Product__c = proG.id;
+ createDetail4.Asset_Model_No__c = 'Test03';
+ createDetail4.Consumable_order_minor__c = order2.id;
+ createDetail4.Consumable_Arrived_order__c = order2.id;
+ createDetail4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail4.Asset_Model_No__c = proG.Asset_Model_No__c;
+ createDetail4.Bar_Code__c = '123';
+ createDetail4.Box_Piece__c ='鐩�';
+ createDetail4.Arrive_date__c = Date.today();
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ insert createDetail4;
+ }
+
+ System.runAs(MyUser_Test){
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert proG;
- System.debug('proG:' + proG);
- System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
- System.debug('prod07:' + prod01);
- System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert proF;
-
- //鍒涘缓鍖婚櫌
- Account hospital = new Account();
- hospital.recordtypeId = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND DeveloperName = 'HP'
- ]
- .id;
- hospital.Name = 'test hospital';
- hospital.Is_Active__c = '鏈夊姽';
- hospital.Attribute_Type__c = '鍗敓閮�';
- hospital.Speciality_Type__c = '缁煎悎鍖婚櫌';
- hospital.Grade__c = '涓�绾�';
- hospital.OCM_Category__c = 'SLTV';
- hospital.Is_Medical__c = '鍖荤枟鏈烘瀯';
- hospital.Town__c = '涓滀含';
- insert hospital;
-
- //寤轰竴鏉″尰闄㈢壒浠蜂骇鍝�
- hospitalprice__c hc = new hospitalprice__c();
- hc.hospital__c = hospital.Id;
- hc.product__c = proG.Id;
- hc.aph__c = '12332';
- hc.account__c = myAccount1.Id;
- insert hc;
-
- //鍖婚櫌
- Consumable_order__c order1 = new Consumable_order__c();
- order1.Name = 'testMing1';
- order1.Order_status__c = '鎵瑰噯';
- order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- order1.Dealer_Info__c = myAccount1.id;
- order1.Inventory_date__c = Date.today();
- order1.Order_type__c = '璁㈠崟';
- order1.Order_ProType__c = 'ET';
- order1.orderPattern__c = 'hospitalorder';
- insert order1;
- Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
- Orderdet1.Name = 'OCM_01_00102';
- Orderdet1.Consumable_order__c = order1.Id;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet1.Consumable_Product__c = proG.Id;
- Orderdet1.Consumable_count__c = 4;
- insert Orderdet1;
-
- Consumable_order_details2__c createDetail3 = new Consumable_order_details2__c();
- createDetail3 = new Consumable_order_details2__c();
- createDetail3.Consumable_Product__c = proG.id;
- createDetail3.Asset_Model_No__c = 'Test02';
- createDetail3.Consumable_order_minor__c = order1.id;
- createDetail3.Consumable_Arrived_order__c = order1.id;
- createDetail3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail3.Asset_Model_No__c = proG.Asset_Model_No__c;
- createDetail3.Bar_Code__c = '123';
- createDetail3.Box_Piece__c = '鐩�';
- createDetail3.Arrive_date__c = Date.today();
-
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- insert createDetail3;
-
- Test.startTest();
- LexConsumableController.Results re = LexConsumableController.init(
- '',
- order1.Id,
- ''
- );
- LexConsumableController.searchConsumableorderdetails(
- re.userWorkLocation,
- re.agencyProType,
- re.accountName,
- re.accountid,
- re.hospitalId,
- re.contractId,
- 'testMing',
- '',
- '',
- '',
- re.category_Goods,
- re.specialCampaign,
- JSON.serialize(re.dealerProductId),
- re.methodType,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- re.editAble,
- re.proLimitAndDate
- );
- LexConsumableController.searchorderdetails(
- re.methodType,
- re.accountid,
- re.hospitalId,
- re.contractId,
- re.userWorkLocation,
- re.accountName,
- re.proLimitAndDate,
- re.editAble
- );
- LexConsumableController.searchConsumableorderdetails(
- re.userWorkLocation,
- re.agencyProType,
- re.accountName,
- re.accountid,
- hospital.Id,
- contract.Id,
- 'testMing',
- '',
- '',
- '',
- re.category_Goods,
- re.specialCampaign,
- JSON.serialize(re.dealerProductId),
- re.methodType,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- re.editAble,
- re.proLimitAndDate
- );
- LexConsumableController.searchorderdetails(
- re.methodType,
- re.accountid,
- hospital.Id,
- contract.Id,
- re.userWorkLocation,
- re.accountName,
- re.proLimitAndDate,
- re.editAble
- );
- Test.stopTest();
- }
- }
-
- @IsTest
- static void ConsumableOrdertest3() {
- user MyUser_Test;
- Account myAccount1;
- Account contract;
- Consumable_order__c order2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- List<RecordType> rectCo1 = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND DeveloperName = 'AgencyContract'
- ];
-
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- contract = new Account(
- RecordTypeId = rectCo1[0].Id,
- Name = 'contractName',
- ParentId = myAccount1.id,
- Agent_Ref__c = myAccount1.id,
- Contract_Department_Class__c = 'ET',
- Contract_Decide_Start_Date__c = Date.today().addDays(-2),
- Contract_Decide_End_Date__c = Date.today().addDays(2),
- Dealer_discount__c = 0.8
- );
- insert contract;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
-
- //浜у搧鏁版嵁
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
-
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'ENT',
- Category4__c = 'Celon',
- Category5__c = 'Celon',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
-
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
-
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert proG;
- System.debug('proG:' + proG);
- System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
- System.debug('prod07:' + prod01);
- System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert proF;
-
- Dealer_Product__c dpc = new Dealer_Product__c();
- dpc.Dealer_Contact__c = contract.id;
- dpc.Dealer_Product2__c = proG.id;
- dpc.Special_Discount__c = 45;
- dpc.Campaign_StartDate__c = Date.today().addDays(-1);
- dpc.Campaign_EndDate__c = Date.today().addDays(1);
- insert dpc;
-
- Dealer_Product__c dpc2 = new Dealer_Product__c();
- dpc2.Dealer_Contact__c = contract.id;
- dpc2.Dealer_Product2__c = proG.id;
- dpc2.Special_Campaign_Price__c = 4500;
- insert dpc2;
-
- Dealer_Product__c dpc1 = new Dealer_Product__c();
- dpc1.Dealer_Contact__c = contract.id;
- dpc1.Dealer_Product2__c = proH.id;
- dpc1.Special_Campaign_Price__c = 23456;
- insert dpc1;
- //淇冮攢
- order2 = new Consumable_order__c();
- order2.Name = 'testMing2';
- order2.Order_status__c = '鎵瑰噯';
- order2.RecordTypeid = System.Label.RT_ConOrder_Order;
- order2.Dealer_Info__c = myAccount1.id;
- order2.Inventory_date__c = Date.today();
- order2.Order_type__c = '璁㈠崟';
- order2.Order_ProType__c = 'ET';
- order2.orderPattern__c = 'promotionorder';
- insert order2;
- Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
- Orderdet2.Name = 'OCM_01_00103';
- Orderdet2.Consumable_order__c = order2.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet2.Consumable_Product__c = proG.Id;
- Orderdet2.Consumable_count__c = 4;
- insert Orderdet2;
-
- Consumable_order_details2__c createDetail4 = new Consumable_order_details2__c();
- createDetail4 = new Consumable_order_details2__c();
- createDetail4.Consumable_Product__c = proG.id;
- createDetail4.Asset_Model_No__c = 'Test03';
- createDetail4.Consumable_order_minor__c = order2.id;
- createDetail4.Consumable_Arrived_order__c = order2.id;
- createDetail4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail4.Asset_Model_No__c = proG.Asset_Model_No__c;
- createDetail4.Bar_Code__c = '123';
- createDetail4.Box_Piece__c = '鐩�';
- createDetail4.Arrive_date__c = Date.today();
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- insert createDetail4;
+ Test.startTest();
+ LexConsumableController.Results re = LexConsumableController.init('', order2.Id, '');
+ LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
+ LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
+ LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, contract.Id, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
+ LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, contract.Id, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- Test.startTest();
- LexConsumableController.Results re = LexConsumableController.init(
- '',
- order2.Id,
- ''
- );
- LexConsumableController.searchConsumableorderdetails(
- re.userWorkLocation,
- re.agencyProType,
- re.accountName,
- re.accountid,
- re.hospitalId,
- re.contractId,
- 'testMing',
- '',
- '',
- '',
- re.category_Goods,
- re.specialCampaign,
- JSON.serialize(re.dealerProductId),
- re.methodType,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- re.editAble,
- re.proLimitAndDate
- );
- LexConsumableController.searchorderdetails(
- re.methodType,
- re.accountid,
- re.hospitalId,
- re.contractId,
- re.userWorkLocation,
- re.accountName,
- re.proLimitAndDate,
- re.editAble
- );
- LexConsumableController.searchConsumableorderdetails(
- re.userWorkLocation,
- re.agencyProType,
- re.accountName,
- re.accountid,
- re.hospitalId,
- contract.Id,
- 'testMing',
- '',
- '',
- '',
- re.category_Goods,
- re.specialCampaign,
- JSON.serialize(re.dealerProductId),
- re.methodType,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- re.editAble,
- re.proLimitAndDate
- );
- LexConsumableController.searchorderdetails(
- re.methodType,
- re.accountid,
- re.hospitalId,
- contract.Id,
- re.userWorkLocation,
- re.accountName,
- re.proLimitAndDate,
- re.editAble
- );
- Test.stopTest();
- }
- }
+ @IsTest
+ static void ConsumableOrdertest4(){
+ user MyUser_Test;
+ Account myAccount1;
+ Account contract;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ System.debug('account111:'+myAccount1);
+ contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
+ Contract_Decide_End_Date__c = Date.today().addDays(2),ET_SP_Dealer__c = true);
+ insert contract;
+ System.debug('account111:'+contract);
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- @IsTest
- static void ConsumableOrdertest4() {
- user MyUser_Test;
- Account myAccount1;
- Account contract;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- List<RecordType> rectCo1 = [
- SELECT Id
- FROM RecordType
- WHERE
- IsActive = TRUE
- AND SobjectType = 'Account'
- AND DeveloperName = 'AgencyContract'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ }
+
+ System.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod01 = new Product2(Name='Test01',
+ ProductCode='Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = '鍏跺畠',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test001',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- System.debug('account111:' + myAccount1);
- contract = new Account(
- RecordTypeId = rectCo1[0].Id,
- Name = 'contractName',
- ParentId = myAccount1.id,
- Agent_Ref__c = myAccount1.id,
- Contract_Department_Class__c = 'ET',
- Contract_Decide_Start_Date__c = Date.today().addDays(-2),
- Contract_Decide_End_Date__c = Date.today().addDays(2),
- ET_SP_Dealer__c = true
- );
- insert contract;
- System.debug('account111:' + contract);
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ Product2 prod02 = new Product2(Name='Test02',
+ ProductCode='Test02',
+ Asset_Model_No__c = 'Test02',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'ENT',
+ Category4__c = 'Celon',
+ Category5__c = 'Celon',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test002',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+
+ Product2 prod03 = new Product2(Name='Test03',
+ ProductCode='Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'US',
+ Category4__c = 'ALOKA',
+ Category5__c = '浣撳瓒呭0',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02,prod03};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ insert proG;
+ System.debug('proG:'+proG);
+ System.debug('proG1:'+proG.Estimation_Entry_Possibility__c);
+ System.debug('prod07:'+prod01);
+ System.debug('prod071:'+prod01.Estimation_Entry_Possibility__c);
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert proF;
+
+
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ order.orderPattern__c = 'agreementorder';
+ insert order;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = order.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = proG.Id;
+ Orderdet.Consumable_count__c = 4;
+ insert Orderdet;
+
+ Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
+ createDetail2 = new Consumable_order_details2__c();
+ createDetail2.Consumable_Product__c = proG.id;
+ createDetail2.Asset_Model_No__c = 'Test01';
+ createDetail2.Consumable_order_minor__c = order.id;
+ createDetail2.Consumable_Arrived_order__c = order.id;
+ createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail2.Asset_Model_No__c = proG.Asset_Model_No__c;
+ createDetail2.Bar_Code__c = '123';
+ createDetail2.Box_Piece__c ='鐩�';
+ createDetail2.Arrive_date__c = Date.today();
+
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ insert createDetail2;
+
+ Test.startTest();
+ LexConsumableController.Results re = LexConsumableController.init('agreementorder', '', '');
+ re.consumableorderdetailsRecordsview[0].check = true;
+ re.consumableorderdetailsRecordsview[0].esd.Consumable_count__c = 1;
+ String conId = contract.Id;
+ LexConsumableController.ordrCopy(contract.Name,JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,'',conId,re.agencyProType1,false);
+ LexConsumableController.save('',JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'',conId,re.agencyProType1,false);
+ LexConsumableController.save(contract.Name,JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'','',re.agencyProType1,false);
+ LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'',re.contractId,'ET',false);
+ LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'agreementorder',re.ESetId,'',re.contractId,'ET',false);
+ LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'promotionorder',re.ESetId,'',re.contractId,'ET',false);
+ LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'hospitalorder',re.ESetId,'',re.contractId,'ET',false);
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ @IsTest
+ static void ConsumableOrdertest5(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ ContentVersion cv;
+ Consumable_order__c order;
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'ENT',
- Category4__c = 'Celon',
- Category5__c = 'Celon',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
+ order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ order.orderPattern__c = 'agreementorder';
+ insert order;
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
+ cv = new ContentVersion();
+ cv.Title = 'test.txt';
+ cv.PathOnClient = '/' + 'test.txt';
+ cv.FirstPublishLocationId = order.Id;
+ cv.VersionData = EncodingUtil.base64Decode('VGVzdA==');
+ cv.IsMajorVersion = true;
+ insert cv;
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- insert proG;
- System.debug('proG:' + proG);
- System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
- System.debug('prod07:' + prod01);
- System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert proF;
+ }
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',
+ ProductCode='Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = '鍏跺畠',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test001',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false
+ );
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- order.orderPattern__c = 'agreementorder';
- insert order;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = order.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = proG.Id;
- Orderdet.Consumable_count__c = 4;
- insert Orderdet;
+ Product2 prod02 = new Product2(Name='Test02',
+ ProductCode='Test02',
+ Asset_Model_No__c = 'Test02',
+ SFDA_Status__c = '鏈夊姽',
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'CDS',
+ Category4__c = 'OER',
+ Category5__c = 'Celon',
+ Dealer_special_Object__c = true,
+ SFDA_Approbation_No__c = 'Test002',
+ Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false
+ );
- Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
- createDetail2 = new Consumable_order_details2__c();
- createDetail2.Consumable_Product__c = proG.id;
- createDetail2.Asset_Model_No__c = 'Test01';
- createDetail2.Consumable_order_minor__c = order.id;
- createDetail2.Consumable_Arrived_order__c = order.id;
- createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail2.Asset_Model_No__c = proG.Asset_Model_No__c;
- createDetail2.Bar_Code__c = '123';
- createDetail2.Box_Piece__c = '鐩�';
- createDetail2.Arrive_date__c = Date.today();
+ Product2 prod03 = new Product2(Name='Test03',
+ ProductCode='Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'US',
+ Category4__c = 'ALOKA',
+ Category5__c = '浣撳瓒呭0',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- insert createDetail2;
+ Product2 prod04 = new Product2(Name='Test04',
+ ProductCode='Test04',Asset_Model_No__c = 'Test04',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = 'OCS',
+ Category4__c = '闄勫睘鍝�',
+ Category5__c = 'OCS',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ Product2 prod05 = new Product2(Name='Test05',
+ ProductCode='Test05',
+ Asset_Model_No__c = 'Test05',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Product_Status__c = '姝e父閿�鍞�',
+ SFDA_Approbated_Status__c = '鏈夋晥',
+ Category3__c = '鍏夋簮',
+ Category4__c = 'CLV',
+ Category5__c = 'S45',
+ Intra_Trade_List_RMB_1__c = 1000,
+ Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
+ Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
+ Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02,prod03, prod04, prod05};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ Product2__c pro4 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod04.Id);
+ Product2__c pro5 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod05.Id);
+ insert new Product2__c[] {pro1,pro2,pro3,pro4, pro5};
- Test.startTest();
- LexConsumableController.Results re = LexConsumableController.init(
- 'agreementorder',
- '',
- ''
- );
- re.consumableorderdetailsRecordsview[0].check = true;
- re.consumableorderdetailsRecordsview[0].esd.Consumable_count__c = 1;
- String conId = contract.Id;
- LexConsumableController.ordrCopy(
- contract.Name,
- JSON.serialize(re.coc),
- re.agencyProType,
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- re.methodType,
- '',
- conId,
- re.agencyProType1,
- false
- );
- LexConsumableController.save(
- '',
- JSON.serialize(re.coc),
- re.agencyProType,
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- re.methodType,
- re.ESetId,
- '',
- conId,
- re.agencyProType1,
- false
- );
- LexConsumableController.save(
- contract.Name,
- JSON.serialize(re.coc),
- re.agencyProType,
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- re.methodType,
- re.ESetId,
- '',
- '',
- re.agencyProType1,
- false
- );
- LexConsumableController.save(
- ':Testaccount001',
- JSON.serialize(re.coc),
- 'ET',
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- re.methodType,
- re.ESetId,
- '',
- re.contractId,
- 'ET',
- false
- );
- LexConsumableController.save(
- ':Testaccount001',
- JSON.serialize(re.coc),
- 'ET',
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- 'agreementorder',
- re.ESetId,
- '',
- re.contractId,
- 'ET',
- false
- );
- LexConsumableController.save(
- ':Testaccount001',
- JSON.serialize(re.coc),
- 'ET',
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- 'promotionorder',
- re.ESetId,
- '',
- re.contractId,
- 'ET',
- false
- );
- LexConsumableController.save(
- ':Testaccount001',
- JSON.serialize(re.coc),
- 'ET',
- re.accountid,
- JSON.serialize(re.consumableorderdetailsRecordsview),
- JSON.serialize(re.contactDealer),
- 'hospitalorder',
- re.ESetId,
- '',
- re.contractId,
- 'ET',
- false
- );
- Test.stopTest();
- }
- }
+
- @IsTest
- static void ConsumableOrdertest5() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- ContentVersion cv;
- Consumable_order__c order;
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
-
- order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- order.orderPattern__c = 'agreementorder';
- insert order;
-
- cv = new ContentVersion();
- cv.Title = 'test.txt';
- cv.PathOnClient = '/' + 'test.txt';
- cv.FirstPublishLocationId = order.Id;
- cv.VersionData = EncodingUtil.base64Decode('VGVzdA==');
- cv.IsMajorVersion = true;
- insert cv;
- }
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
-
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = 'Celon',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
-
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
-
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = 'OCS',
- Category4__c = '闄勫睘鍝�',
- Category5__c = 'OCS',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Category3__c = '鍏夋簮',
- Category4__c = 'CLV',
- Category5__c = 'S45',
- Intra_Trade_List_RMB_1__c = 1000,
- Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
- Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03, prod04, prod05 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod04.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod05.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3, pro4, pro5 };
-
- Test.startTest();
- LexConsumableController.Results re1 = LexConsumableController.categoryAllload(
- 'ET',
- 'CDS'
- );
- LexConsumableController.Results re2 = LexConsumableController.categoryAllload(
- 'ENG',
- 'CDS'
- );
- LexConsumableController.Results re3 = LexConsumableController.categoryAllload(
- '',
- 'CDS'
- );
- LexConsumableController.Results re4 = LexConsumableController.categoryload(
- 'ET',
- 'CDS',
- 'OER'
- );
- LexConsumableController.Results re5 = LexConsumableController.categoryload(
- 'ENG',
- 'CDS',
- 'OER'
- );
- LexConsumableController.Results re6 = LexConsumableController.categoryload(
- '',
- 'CDS',
- 'OER'
- );
- String pid = order.Id;
- LexConsumableController.filesUpload(pid, 'tset.txt', 'VGVzdA==');
- LexConsumableController.deleteAtt(cv.Id, pid);
- LexConsumableController.backOrder(pid);
- LexConsumableController.setEditAble(pid);
- LexConsumableController.delConsumable(pid);
- LexConsumableController.OffersPrice();
- Test.stopTest();
- }
- }
-}
+ Test.startTest();
+ LexConsumableController.Results re1 = LexConsumableController.categoryAllload('ET','CDS');
+ LexConsumableController.Results re2 = LexConsumableController.categoryAllload('ENG','CDS');
+ LexConsumableController.Results re3 = LexConsumableController.categoryAllload('','CDS');
+ LexConsumableController.Results re4 = LexConsumableController.categoryload('ET','CDS','OER');
+ LexConsumableController.Results re5 = LexConsumableController.categoryload('ENG','CDS','OER');
+ LexConsumableController.Results re6 = LexConsumableController.categoryload('','CDS','OER');
+ String pid = order.Id;
+ LexConsumableController.filesUpload(pid,'tset.txt','VGVzdA==');
+ LexConsumableController.deleteAtt(cv.Id, pid);
+ LexConsumableController.backOrder(pid);
+ LexConsumableController.setEditAble(pid);
+ LexConsumableController.delConsumable(pid);
+ LexConsumableController.OffersPrice();
+ Test.stopTest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls b/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls
index fb566bb..9f28b06 100644
--- a/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls
+++ b/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls
@@ -1,1113 +1,781 @@
@istest
public class LexConsumableGoodsInfoTest {
- @IsTest
- static void lexConsumableGoodsInfoTest1() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ @IsTest
+ static void lexConsumableGoodsInfoTest1(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ }
+
+ system.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+
+
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ insert order;
+ //鍒拌揣
+ Consumable_order__c order2 = new Consumable_order__c();
+ order2.Name = 'testMing1';
+ order2.Order_status__c = '鎵瑰噯';
+ order2.RecordTypeid = '01210000000c9dqAAA';
+ order2.Dealer_Info__c = myAccount1.id;
+ order2.Order_type__c = '鍒拌揣';
+ order2.Order_ProType__c = 'ET';
+ insert order2;
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ // 閿�鍞�
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '鐩�';
+ dataForProductCount7.Used_date__c = Date.today();
+ dataForProductCount7.Consumable_order_minor__c = order.id;
+
+ conList.add(dataForProductCount7);
+ // 鍦ㄥ簱 杩囨湡 鐩�
+ Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
+ dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
+ dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProduct.Arrive_date__c = Date.today();
+ dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProduct.Consumable_Product__c = proF.id;
+ dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProduct.Box_Piece__c = '鐩�';
+ dataForProduct.Consumable_order_minor__c = order.id;
+
+ conList.add(dataForProduct);
+ // 鍦ㄥ簱 杩囨湡 涓�
+ Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
+ dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
+ dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount3.Arrive_date__c = Date.today();
+ dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount3.Consumable_Product__c = proG.id;
+ dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount3.Box_Piece__c = '涓�';
+ dataForProductCount3.RemoveBox_No__c = 1;
+ dataForProductCount3.Consumable_order_minor__c = order.id;
+ conList.add(dataForProductCount3);
+ insert conList;
+
+ //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
+ dataForProductCount4.Bar_Code__c = '1001';
+ dataForProductCount4.Arrive_date__c = Date.today();
+ dataForProductCount4.Send_Date__c = null;
+ dataForProductCount4.Used_date__c = null;
+ dataForProductCount4.Return_date__c = null;
+ dataForProductCount4.Lose_Flag__c = false;
+ dataForProductCount4.Cancellation_Flag__c = false;
+ dataForProductCount4.Consumable_Product__c = proG.Id;
+ dataForProductCount4.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount4.Used_account__c = myAccount1.Id;
+ dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount4.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount4);
+ System.debug('conList1==>'+conList1);
+ //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1002';
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.Send_Date__c = Date.today();
+ dataForProductCount5.Used_date__c = Date.today();
+ dataForProductCount5.Return_date__c = null;
+ dataForProductCount5.Lose_Flag__c = false;
+ dataForProductCount5.Cancellation_Flag__c = false;
+ dataForProductCount5.Consumable_Product__c = proG.Id;
+ dataForProductCount5.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount5.Used_account__c = myAccount1.Id;
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount5.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount5);
+ insert conList1;
+ Test.startTest();
+ LexConsumableGoodsInfo.initMoreThan7(dataForProductCount7.Id);
+ LexConsumableGoodsInfo.initMoreThan7All('all');
+ LexConsumableGoodsInfo.initNotArrDet(dataForProductCount7.Id);
+ LexConsumableGoodsInfo.initNotArrDetAll('all');
+ LexConsumableGoodsInfo.initArrDet(dataForProductCount7.Id);
+ LexConsumableGoodsInfo.initArrDetAll('all');
+ LexConsumableGoodsInfo.initDeliveryDet(dataForProductCount7.Id);
+ LexConsumableGoodsInfo.initDeliveryDetAll('all');
+ LexConsumableGoodsInfo.initTotalNum('1', 'all');
+ LexConsumableGoodsInfo.initTotalNum(dataForProductCount7.Id, 'all');
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ @IsTest
+ static void lexConsumableGoodsInfoTest2(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ Consumable_order__c Order2 = new Consumable_order__c(
+ Name='OCM_01_002',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ insert new Consumable_order__c[] {Order1, Order2};
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+ Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
+ createDetail1.name = 'Too002';
+ createDetail1.Consumable_Product__c = pro2.id;
+ createDetail1.Consumable_order__c = Order2.id;
+ createDetail1.Dealer_Custom_Price__c = 999.00;
+ createDetail1.Consumable_count__c = 4;
+ createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail1;
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- insert order;
- //鍒拌揣
- Consumable_order__c order2 = new Consumable_order__c();
- order2.Name = 'testMing1';
- order2.Order_status__c = '鎵瑰噯';
- order2.RecordTypeid = '01210000000c9dqAAA';
- order2.Dealer_Info__c = myAccount1.id;
- order2.Order_type__c = '鍒拌揣';
- order2.Order_ProType__c = 'ET';
- insert order2;
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
+ Name='OCM_01_001002',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ //Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
+ Name='OCM_01_001004',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //鍒朵綔Consumable_order_details__c-------ProductCount
- // 閿�鍞�
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '鐩�';
- dataForProductCount7.Used_date__c = Date.today();
- dataForProductCount7.Consumable_order_minor__c = order.id;
-
- conList.add(dataForProductCount7);
- // 鍦ㄥ簱 杩囨湡 鐩�
- Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
- dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
- dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProduct.Arrive_date__c = Date.today();
- dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProduct.Consumable_Product__c = proF.id;
- dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProduct.Box_Piece__c = '鐩�';
- dataForProduct.Consumable_order_minor__c = order.id;
-
- conList.add(dataForProduct);
- // 鍦ㄥ簱 杩囨湡 涓�
- Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
- dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
- dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount3.Arrive_date__c = Date.today();
- dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount3.Consumable_Product__c = proG.id;
- dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount3.Box_Piece__c = '涓�';
- dataForProductCount3.RemoveBox_No__c = 1;
- dataForProductCount3.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount3);
- insert conList;
-
- //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
- dataForProductCount4.Bar_Code__c = '1001';
- dataForProductCount4.Arrive_date__c = Date.today();
- dataForProductCount4.Send_Date__c = null;
- dataForProductCount4.Used_date__c = null;
- dataForProductCount4.Return_date__c = null;
- dataForProductCount4.Lose_Flag__c = false;
- dataForProductCount4.Cancellation_Flag__c = false;
- dataForProductCount4.Consumable_Product__c = proG.Id;
- dataForProductCount4.Consumable_Arrived_order__c = order2.id;
- dataForProductCount4.Used_account__c = myAccount1.Id;
- dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount4.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount4);
- System.debug('conList1==>' + conList1);
- //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1002';
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.Send_Date__c = Date.today();
- dataForProductCount5.Used_date__c = Date.today();
- dataForProductCount5.Return_date__c = null;
- dataForProductCount5.Lose_Flag__c = false;
- dataForProductCount5.Cancellation_Flag__c = false;
- dataForProductCount5.Consumable_Product__c = proG.Id;
- dataForProductCount5.Consumable_Arrived_order__c = order2.id;
- dataForProductCount5.Used_account__c = myAccount1.Id;
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount5.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount5);
- insert conList1;
- Test.startTest();
- LexConsumableGoodsInfo.initMoreThan7(dataForProductCount7.Id);
- LexConsumableGoodsInfo.initMoreThan7All('all');
- LexConsumableGoodsInfo.initNotArrDet(dataForProductCount7.Id);
- LexConsumableGoodsInfo.initNotArrDetAll('all');
- LexConsumableGoodsInfo.initArrDet(dataForProductCount7.Id);
- LexConsumableGoodsInfo.initArrDetAll('all');
- LexConsumableGoodsInfo.initDeliveryDet(dataForProductCount7.Id);
- LexConsumableGoodsInfo.initDeliveryDetAll('all');
- LexConsumableGoodsInfo.initTotalNum('1', 'all');
- LexConsumableGoodsInfo.initTotalNum(dataForProductCount7.Id, 'all');
- Test.stopTest();
+ LexConsumableGoodsInfo.initMoreThan7(Orderdet1.Id);
+ LexConsumableGoodsInfo.initMoreThan7All('all');
+ LexConsumableGoodsInfo.initNotArrDet(Orderdet1.Id);
+ LexConsumableGoodsInfo.initNotArrDetAll('all');
+ LexConsumableGoodsInfo.initArrDet(Orderdet1.Id);
+ LexConsumableGoodsInfo.initArrDetAll('all');
+ LexConsumableGoodsInfo.initDeliveryDet(Orderdet1.Id);
+ LexConsumableGoodsInfo.initDeliveryDetAll('all');
+ LexConsumableGoodsInfo.initTotalNum('1', 'all');
+ LexConsumableGoodsInfo.initTotalNum(Orderdet1.Id, 'all');
+
+ }
}
- }
- @IsTest
- static void lexConsumableGoodsInfoTest2() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
+ @IsTest
+ static void lexConsumableGoodsInfoTest3(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ Consumable_order__c Order2 = new Consumable_order__c(
+ Name='OCM_01_002',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ insert new Consumable_order__c[] {Order1, Order2};
+
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+ Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
+ createDetail1.name = 'Too002';
+ createDetail1.Consumable_Product__c = pro2.id;
+ createDetail1.Consumable_order__c = Order2.id;
+ createDetail1.Dealer_Custom_Price__c = 999.00;
+ createDetail1.Consumable_count__c = 4;
+ createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail1;
+
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
+ Name='OCM_01_001002',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ //Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
+ Name='OCM_01_001004',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
+
+ LexConsumableGoodsInfo.initMoreThan7(Orderdet2.Id);
+ LexConsumableGoodsInfo.initMoreThan7All('');
+ LexConsumableGoodsInfo.initNotArrDet(Orderdet2.Id);
+ LexConsumableGoodsInfo.initNotArrDetAll('');
+ LexConsumableGoodsInfo.initArrDet(Orderdet2.Id);
+ LexConsumableGoodsInfo.initArrDetAll('');
+ LexConsumableGoodsInfo.initDeliveryDet(Orderdet2.Id);
+ LexConsumableGoodsInfo.initDeliveryDetAll('');
+ LexConsumableGoodsInfo.initTotalNum(Orderdet2.Id, '');
+ }
}
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c Order2 = new Consumable_order__c(
- Name = 'OCM_01_002',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ Order1, Order2 };
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
- Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
- createDetail1.name = 'Too002';
- createDetail1.Consumable_Product__c = pro2.id;
- createDetail1.Consumable_order__c = Order2.id;
- createDetail1.Dealer_Custom_Price__c = 999.00;
- createDetail1.Consumable_count__c = 4;
- createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail1;
+ @IsTest
+ static void lexConsumableGoodsInfoTest4(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ Consumable_order__c Order2 = new Consumable_order__c(
+ Name='OCM_01_002',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ insert new Consumable_order__c[] {Order1, Order2};
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
- Name = 'OCM_01_001002',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- //Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
- Name = 'OCM_01_001004',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+ Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
+ createDetail1.name = 'Too002';
+ createDetail1.Consumable_Product__c = pro2.id;
+ createDetail1.Consumable_order__c = Order2.id;
+ createDetail1.Dealer_Custom_Price__c = 999.00;
+ createDetail1.Consumable_count__c = 4;
+ createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail1;
- LexConsumableGoodsInfo.initMoreThan7(Orderdet1.Id);
- LexConsumableGoodsInfo.initMoreThan7All('all');
- LexConsumableGoodsInfo.initNotArrDet(Orderdet1.Id);
- LexConsumableGoodsInfo.initNotArrDetAll('all');
- LexConsumableGoodsInfo.initArrDet(Orderdet1.Id);
- LexConsumableGoodsInfo.initArrDetAll('all');
- LexConsumableGoodsInfo.initDeliveryDet(Orderdet1.Id);
- LexConsumableGoodsInfo.initDeliveryDetAll('all');
- LexConsumableGoodsInfo.initTotalNum('1', 'all');
- LexConsumableGoodsInfo.initTotalNum(Orderdet1.Id, 'all');
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
+ Name='OCM_01_001002',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ //Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
+ Name='OCM_01_001004',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
+
+ LexConsumableGoodsInfo.initMoreThan7(Orderdet3.Id);
+ LexConsumableGoodsInfo.initNotArrDet(Orderdet3.Id);
+ LexConsumableGoodsInfo.initArrDet(Orderdet3.Id);
+ LexConsumableGoodsInfo.initDeliveryDet(Orderdet3.Id);
+ LexConsumableGoodsInfo.initTotalNum(Orderdet3.Id, 'all');
+ }
}
- }
- @IsTest
- static void lexConsumableGoodsInfoTest3() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
+ @IsTest
+ static void lexConsumableGoodsInfoTest5(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ Consumable_order__c Order2 = new Consumable_order__c(
+ Name='OCM_01_002',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c=myAccount1.Id,
+ Order_ProType__c = 'ET');
+ insert new Consumable_order__c[] {Order1, Order2};
+
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+ Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
+ createDetail1.name = 'Too002';
+ createDetail1.Consumable_Product__c = pro2.id;
+ createDetail1.Consumable_order__c = Order2.id;
+ createDetail1.Dealer_Custom_Price__c = 999.00;
+ createDetail1.Consumable_count__c = 4;
+ createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail1;
+
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
+ Name='OCM_01_001002',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ //Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
+ Name='OCM_01_001004',
+ Consumable_order_minor__c = Order2.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro2.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
+
+ LexConsumableGoodsInfo.initMoreThan7(Orderdet4.Id);
+ LexConsumableGoodsInfo.initNotArrDet(Orderdet4.Id);
+ LexConsumableGoodsInfo.initArrDet(Orderdet4.Id);
+ LexConsumableGoodsInfo.initDeliveryDet(Orderdet4.Id);
+ LexConsumableGoodsInfo.initTotalNum(Orderdet4.Id, 'all');
+ }
}
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c Order2 = new Consumable_order__c(
- Name = 'OCM_01_002',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ Order1, Order2 };
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
- Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
- createDetail1.name = 'Too002';
- createDetail1.Consumable_Product__c = pro2.id;
- createDetail1.Consumable_order__c = Order2.id;
- createDetail1.Dealer_Custom_Price__c = 999.00;
- createDetail1.Consumable_count__c = 4;
- createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail1;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
- Name = 'OCM_01_001002',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- //Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
- Name = 'OCM_01_001004',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
-
- LexConsumableGoodsInfo.initMoreThan7(Orderdet2.Id);
- LexConsumableGoodsInfo.initMoreThan7All('');
- LexConsumableGoodsInfo.initNotArrDet(Orderdet2.Id);
- LexConsumableGoodsInfo.initNotArrDetAll('');
- LexConsumableGoodsInfo.initArrDet(Orderdet2.Id);
- LexConsumableGoodsInfo.initArrDetAll('');
- LexConsumableGoodsInfo.initDeliveryDet(Orderdet2.Id);
- LexConsumableGoodsInfo.initDeliveryDetAll('');
- LexConsumableGoodsInfo.initTotalNum(Orderdet2.Id, '');
+ @IsTest
+ static void lexConsumableGoodsInfoTest6(){
+ LexConsumableGoodsInfo.ShowRecords sr = new LexConsumableGoodsInfo.ShowRecords();
+ sr.prodModel = 'test';
+ sr.recordCount = 1;
+ sr.compareTo(new LexConsumableGoodsInfo.ShowRecords());
}
- }
- @IsTest
- static void lexConsumableGoodsInfoTest4() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
+ @IsTest
+ static void lexConsumableGoodsInfoTest7(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含',
+ UserPro_Type__c = 'ET');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c = myAccount1.Id,
+ Delivery_detail_count__c = 1,
+ Order_ProType__c = 'ET',
+ showFalseNotshowTrue__c = false);
+ insert new Consumable_order__c[] {Order1};
+
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
+
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Asset_Model_No__c = 'Test01',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
+ Cancellation_Flag__c = false);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Asset_Model_No__c = 'Test01',
+ Consumable_order_minor__c = Order1.Id,
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
+ Cancellation_Flag__c = false);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet3};
+ LexConsumableGoodsInfo.initNotArrDet(Order1.Id);
+ LexConsumableGoodsInfo.initNotArrDetAll('all');
+ }
}
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c Order2 = new Consumable_order__c(
- Name = 'OCM_01_002',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ Order1, Order2 };
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
- Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
- createDetail1.name = 'Too002';
- createDetail1.Consumable_Product__c = pro2.id;
- createDetail1.Consumable_order__c = Order2.id;
- createDetail1.Dealer_Custom_Price__c = 999.00;
- createDetail1.Consumable_count__c = 4;
- createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail1;
+ @IsTest
+ static void lexConsumableGoodsInfoTest8(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com',
+ firstname='Joe',
+ lastname='Plumber',
+ accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(
+ ContactId = core.id,
+ Alias = 'newUser',
+ Email='newuser@testorg.com',
+ EmailEncodingKey='UTF-8',
+ LastName='testUser',
+ LanguageLocaleKey='zh_CN',
+ LocaleSidKey='zh_CN',
+ ProfileId = prof.Id,
+ TimeZoneSidKey='Asia/Shanghai',
+ UserName='testUser@testorg.com',
+ Work_Location__c='鍖椾含',
+ UserPro_Type__c = 'ET');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c(
+ Name='OCM_01_001',
+ RecordTypeId = System.Label.RT_ConOrder_Delivery,
+ Order_type__c ='璁㈠崟',
+ Dealer_info__c = myAccount1.Id,
+ Delivery_detail_count__c = 1,
+ Order_ProType__c = 'ET',
+ showFalseNotshowTrue__c = false);
+ insert new Consumable_order__c[] {Order1};
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
- Name = 'OCM_01_001002',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- //Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
- Name = 'OCM_01_001004',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
+ //鏄庣粏1
+ Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
+ createDetail.name = 'Too001';
+ createDetail.Consumable_Product__c = pro1.id;
+ createDetail.Dealer_Custom_Price__c = 999.00;
+ createDetail.Consumable_count__c = 3;
+ createDetail.Consumable_order__c = Order1.id;
+ createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert createDetail;
- LexConsumableGoodsInfo.initMoreThan7(Orderdet3.Id);
- LexConsumableGoodsInfo.initNotArrDet(Orderdet3.Id);
- LexConsumableGoodsInfo.initArrDet(Orderdet3.Id);
- LexConsumableGoodsInfo.initDeliveryDet(Orderdet3.Id);
- LexConsumableGoodsInfo.initTotalNum(Orderdet3.Id, 'all');
+ //璁㈠崟鏄庣粏
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
+ Name='OCM_01_001001',
+ Consumable_order_minor__c = Order1.Id,
+ Arrive_date__c = Date.today(),
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
+ Cancellation_Flag__c = false);
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
+ Name='OCM_01_001003',
+ Consumable_order_minor__c = Order1.Id,
+ Consumable_Product__c = pro1.id,
+ RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
+ Cancellation_Flag__c = false);
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet3};
+ LexConsumableGoodsInfo.initNotArrDetAll('all');
+ }
}
- }
-
- @IsTest
- static void lexConsumableGoodsInfoTest5() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c Order2 = new Consumable_order__c(
- Name = 'OCM_01_002',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{ Order1, Order2 };
-
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
- Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c();
- createDetail1.name = 'Too002';
- createDetail1.Consumable_Product__c = pro2.id;
- createDetail1.Consumable_order__c = Order2.id;
- createDetail1.Dealer_Custom_Price__c = 999.00;
- createDetail1.Consumable_count__c = 4;
- createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail1;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
- Name = 'OCM_01_001002',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- //Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
- Name = 'OCM_01_001004',
- Consumable_order_minor__c = Order2.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro2.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
- );
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
-
- LexConsumableGoodsInfo.initMoreThan7(Orderdet4.Id);
- LexConsumableGoodsInfo.initNotArrDet(Orderdet4.Id);
- LexConsumableGoodsInfo.initArrDet(Orderdet4.Id);
- LexConsumableGoodsInfo.initDeliveryDet(Orderdet4.Id);
- LexConsumableGoodsInfo.initTotalNum(Orderdet4.Id, 'all');
- }
- }
-
- @IsTest
- static void lexConsumableGoodsInfoTest6() {
- LexConsumableGoodsInfo.ShowRecords sr = new LexConsumableGoodsInfo.ShowRecords();
- sr.prodModel = 'test';
- sr.recordCount = 1;
- sr.compareTo(new LexConsumableGoodsInfo.ShowRecords());
- }
-
- @IsTest
- static void lexConsumableGoodsInfoTest7() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含',
- UserPro_Type__c = 'ET'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Delivery_detail_count__c = 1,
- Order_ProType__c = 'ET',
- showFalseNotshowTrue__c = false
- );
- insert new List<Consumable_order__c>{ Order1 };
-
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Asset_Model_No__c = 'Test01',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
- Cancellation_Flag__c = false
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Asset_Model_No__c = 'Test01',
- Consumable_order_minor__c = Order1.Id,
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
- Cancellation_Flag__c = false
- );
- insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet3 };
- LexConsumableGoodsInfo.initNotArrDet(Order1.Id);
- LexConsumableGoodsInfo.initNotArrDetAll('all');
- }
- }
-
- @IsTest
- static void lexConsumableGoodsInfoTest8() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含',
- UserPro_Type__c = 'ET'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c(
- Name = 'OCM_01_001',
- RecordTypeId = System.Label.RT_ConOrder_Delivery,
- Order_type__c = '璁㈠崟',
- Dealer_info__c = myAccount1.Id,
- Delivery_detail_count__c = 1,
- Order_ProType__c = 'ET',
- showFalseNotshowTrue__c = false
- );
- insert new List<Consumable_order__c>{ Order1 };
-
- //鏄庣粏1
- Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
- createDetail.name = 'Too001';
- createDetail.Consumable_Product__c = pro1.id;
- createDetail.Dealer_Custom_Price__c = 999.00;
- createDetail.Consumable_count__c = 3;
- createDetail.Consumable_order__c = Order1.id;
- createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert createDetail;
-
- //璁㈠崟鏄庣粏
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(
- Name = 'OCM_01_001001',
- Consumable_order_minor__c = Order1.Id,
- Arrive_date__c = Date.today(),
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
- Cancellation_Flag__c = false
- );
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
- Name = 'OCM_01_001003',
- Consumable_order_minor__c = Order1.Id,
- Consumable_Product__c = pro1.id,
- RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery,
- Cancellation_Flag__c = false
- );
- insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet3 };
- LexConsumableGoodsInfo.initNotArrDetAll('all');
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexConsumableOrderManageController.cls b/force-app/main/default/classes/LexConsumableOrderManageController.cls
index 6f82bf0..2ead3f4 100644
--- a/force-app/main/default/classes/LexConsumableOrderManageController.cls
+++ b/force-app/main/default/classes/LexConsumableOrderManageController.cls
@@ -5,376 +5,331 @@
*
*/
public without sharing class LexConsumableOrderManageController {
- public static Consumable_order__c coc { get; set; }
- public static String agencyProType { get; set; }
- public static String category1 { get; set; }
- public static String baseUrl { get; private set; }
- private static String[] columus = new List<String>{ 'Product2__c.Name' };
- public static List<SelectOption> provinceOpts { get; set; }
- public static List<CusOption> provinceCusOpts;
- private static String accountid = null;
- public static List<String> title { get; private set; }
- public static List<String> column;
- public static List<List<String>> columns { get; private set; }
- public static List<Consumable_order__c> raesList { get; private set; }
- private static String userWorkLocation;
- public static Boolean hasHop { get; set; }
- public static Boolean hasSpecial { get; set; }
- public LexConsumableOrderManageController() {
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- }
-
- @AuraEnabled
- public static Results init1() {
- Results results = new Results();
- results.isNoteStay = LexUtility.getIsNoteStay();
- try {
- String userId = UserInfo.getUserId();
- // String userId = '0050l000007CAieAAG';
- List<user> Useracc = new List<user>();
- Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc[0].accountid;
- agencyProType = Useracc[0].UserPro_Type__c;
- if (String.isBlank(Useracc[0].UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- userWorkLocation = Useracc[0].Work_Location__c;
- coc = new Consumable_order__c();
- // 鑾峰緱璁㈠崟涓�瑙�
- Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe()
- .get('Consumable_order__c')
- .getDescribe()
- .fieldSets.getMap();
- Schema.FieldSet fs = fsMap.get('order_view');
- // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
- List<FieldSetMember> fsmList = fs.getFields();
- // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
- title = new List<String>();
- column = new List<String>();
- columns = new List<List<String>>();
- List<CusCol> cols = new List<CusCol>();
- for (FieldSetMember fsm : fsmList) {
- //add by Link
- if (
- fsm.getFieldPath() == 'Order_ForHospital__c' &&
- agencyProType == 'ET'
- ) {
- } else {
- CusCol col = new CusCol();
- col.label = fsm.getLabel();
- col.fieldName = fsm.getFieldPath();
- col.hideDefaultActions = true;
- // col.sortable = true;
- col.wrapText = true;
- if (fsm.getFieldPath() == 'Order_ForHospital__c') {
- col.type = 'url';
- col.fieldName = 'hosUrl';
- TypeAttr typeAttributes1 = new TypeAttr();
- CusLable cusLabel = new CusLable();
- cusLabel.fieldName = 'hosName';
- typeAttributes1.label = cusLabel;
- typeAttributes1.target = '_blank';
- col.typeAttributes = typeAttributes1;
- }
- if (fsm.getFieldPath() == 'Name') {
- col.type = 'url';
- col.fieldName = 'nameUrl';
- TypeAttr typeAttributes1 = new TypeAttr();
- CusLable cusLabel = new CusLable();
- cusLabel.fieldName = 'Name';
- typeAttributes1.label = cusLabel;
- typeAttributes1.target = '_blank';
- col.typeAttributes = typeAttributes1;
- }
- cols.add(col);
- }
- //update by rentx 2020-12-22 start
- if (
- fsm.getLabel() == '鍖婚櫌' &&
- agencyProType != null &&
- agencyProType == 'ET'
- ) {
- } else {
- title.add(fsm.getLabel());
- }
- if (
- fsm.getFieldPath() == 'Order_ForHospital__c' &&
- agencyProType != null &&
- agencyProType == 'ET'
- ) {
- } else {
- column.add(fsm.getFieldPath());
- columns.add(fsm.getFieldPath().split('\\.'));
- }
- }
- provinceOpts = new List<SelectOption>();
- provinceOpts.add(new SelectOption('', '-鏃�-'));
- provinceOpts.add(new SelectOption('鑽夋涓�', '鑽夋涓�'));
- provinceOpts.add(new SelectOption('宸叉彁浜�', '宸叉彁浜�'));
- provinceOpts.add(new SelectOption('鎵瑰噯', '鎵瑰噯'));
- provinceOpts.add(new SelectOption('椹冲洖', '椹冲洖'));
- //閽堝lwc鐨勮嚜瀹氫箟option
- provinceCusOpts = new List<CusOption>();
- provinceCusOpts.add(new CusOption('-鏃�-', ''));
- provinceCusOpts.add(new CusOption('鑽夋涓�', '鑽夋涓�'));
- provinceCusOpts.add(new CusOption('宸叉彁浜�', '宸叉彁浜�'));
- provinceCusOpts.add(new CusOption('鎵瑰噯', '鎵瑰噯'));
- provinceCusOpts.add(new CusOption('椹冲洖', '椹冲洖'));
- // 鑾峰緱鏄剧ず鏁版嵁
- raesList = new List<Consumable_order__c>();
- String soql = 'select Id';
- for (String s : column) {
- soql += ',' + s;
- }
- soql +=
- ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
- '璁㈠崟' +
- '\'';
- soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\'';
- soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\'';
- soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
- soql +=
- ' and Dealer_Info__c =\'' +
- accountid +
- '\' order by Order_status__c ';
- System.debug('====soql====' + soql);
- raesList = Database.query(soql);
- //add by rentx 2021-3-10 start
- //涓� hasHop 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
- List<hospitalprice__c> hopList = [
- SELECT id, hospital__c
- FROM hospitalprice__c
- WHERE account__c = :accountid
- ];
- if (hopList == null || hopList.size() == 0) {
- hasHop = false;
- } else {
- hasHop = true;
- }
- //涓� hasSpecial 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈変績閿�鍟嗗搧
- //鏌ヨ褰撳墠缁忛攢鍟嗕笅鐨勬湁鏁堝悎鍚�
- List<Account> contractList = [
- SELECT Id, Name, RecordType.DeveloperName
- FROM Account
- WHERE
- RecordType.DeveloperName = 'AgencyContract'
- AND Contact_Type__c LIKE :agencyProType
- AND Agent_Ref__c = :accountid
- ];
- List<Id> dealIds = new List<Id>();
- if (contractList != null && contractList.size() > 0) {
- for (Account acc : contractList) {
- dealIds.add(acc.Id);
- }
- List<Dealer_Product__c> deList = [
- SELECT id
- FROM Dealer_Product__c
- WHERE Dealer_Contact__c IN :dealIds
- ];
- if (deList == null || deList.size() == 0) {
- hasSpecial = false;
- } else {
- hasSpecial = true;
- }
- } else {
- hasSpecial = false;
- }
- results.result = 'Success';
- results.provinceOpts = provinceCusOpts;
- results.raesList = raesList;
- results.agencyProType = agencyProType;
- results.userWorkLocation = userWorkLocation;
- results.accountid = accountid;
- results.hasHop = hasHop;
- results.hasSpecial = hasSpecial;
- results.title = title;
- results.cols = cols;
- } catch (Exception e) {
- results.result = 'Fail';
- results.raesList = new List<Consumable_order__c>();
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- @AuraEnabled
- public static Results searchConsumableorderdetails(
- String categoryStr,
- Date orderDate,
- String orderStatus,
- String accountidStr,
- String agencyProTypeStr,
- String userWorkLocationStr
- ) {
- Results results = new Results();
- agencyProType = agencyProTypeStr;
- userWorkLocation = userWorkLocationStr;
- accountid = accountidStr;
- if (String.isBlank(categoryStr)) {
- category1 = null;
- } else {
- category1 = categoryStr;
- }
- coc = new Consumable_order__c();
- if (String.isBlank(orderStatus)) {
- coc.Order_status__c = null;
- } else {
- coc.Order_status__c = orderStatus;
- }
- coc.Order_date__c = orderDate;
- try {
- Date cate2 = coc.Order_date__c;
- String cate3 = coc.Order_status__c;
- // 鑾峰緱璁㈠崟涓�瑙�
- Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe()
- .get('Consumable_order__c')
- .getDescribe()
- .fieldSets.getMap();
- Schema.FieldSet fs = fsMap.get('order_view');
- // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
- List<FieldSetMember> fsmList = fs.getFields();
- // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
- title = new List<String>();
- column = new List<String>();
- columns = new List<List<String>>();
- for (FieldSetMember fsm : fsmList) {
- //update by rentx 2020-12-22 start
- if (
- fsm.getLabel() == '鍖婚櫌' &&
- agencyProType != null &&
- agencyProType == 'ET'
- ) {
- } else {
- title.add(fsm.getLabel());
- }
- if (
- fsm.getFieldPath() == 'Order_ForHospital__c' &&
- agencyProType != null &&
- agencyProType == 'ET'
- ) {
- } else {
- column.add(fsm.getFieldPath());
- columns.add(fsm.getFieldPath().split('\\.'));
- }
- }
- // 鑾峰緱鏄剧ず鏁版嵁
- raesList = new List<Consumable_order__c>();
- String soql = 'select Id';
- for (String s : column) {
- soql += ',' + s;
- }
- soql +=
- ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
- '璁㈠崟' +
- '\' and RecordtypeId = \'' +
- System.Label.RT_ConOrder_Order +
- '\' and Dealer_Info__c =\'' +
- accountid +
- '\' ';
- soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
- soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
- if (!String.isBlank(category1)) {
- soql +=
- ' and Name like \'%' +
- String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) +
- '%\' ';
- }
- if (cate2 != null) {
- soql += ' and Order_date__c = :cate2';
- }
- if (cate3 != null) {
- soql += ' and Order_status__c = :cate3 ';
- }
- soql += ' order by Order_status__c ';
- system.debug('====soql:' + soql);
- raesList = Database.query(soql);
- system.debug('====raesList:' + raesList);
- if (raesList.size() > 0) {
- results.result = 'Success';
- results.raesList = raesList;
- results.errorMsg = '鍏辨湁' + raesList.size() + '涓鍗�';
- } else {
- results.result = 'Fail';
- results.raesList = new List<Consumable_order__c>();
- results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏宠鍗�';
- }
- } catch (Exception e) {
- results.result = 'Fail';
- results.raesList = new List<Consumable_order__c>();
- results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
- }
- return results;
- }
-
- public class Results {
- @AuraEnabled
- public String result;
- @AuraEnabled
- public String errorMsg;
- @AuraEnabled
- public List<CusOption> provinceOpts;
- @AuraEnabled
- public List<String> title;
- @AuraEnabled
- public String accountid;
- @AuraEnabled
- public String agencyProType;
- @AuraEnabled
- public String userWorkLocation;
- @AuraEnabled
- public Boolean hasHop;
- @AuraEnabled
- public Boolean hasSpecial;
- @AuraEnabled
- public List<Consumable_order__c> raesList;
- @AuraEnabled
- public List<CusCol> cols;
- @AuraEnabled
- public Boolean isNoteStay;
- }
-
- public class CusOption {
- CusOption(String label, String value) {
- this.label = label;
- this.value = value;
+ public static Consumable_order__c coc { get; set; }
+ public static String agencyProType { get; set; }
+ public static String category1 { get; set; }
+ public static String baseUrl { get; private set; }
+ private static String[] columus = new List<String>{ 'Product2__c.Name' };
+ public static List<SelectOption> provinceOpts { get; set; }
+ public static List<CusOption> provinceCusOpts;
+ private static String accountid = null;
+ public static List<String> title { get; private set; }
+ public static List<String> column;
+ public static List<List<String>> columns { get; private set; }
+ public static List<Consumable_order__c> raesList { get; private set; }
+ private static String userWorkLocation;
+ public static Boolean hasHop { get; set; }
+ public static Boolean hasSpecial { get; set; }
+ public LexConsumableOrderManageController() {
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
}
@AuraEnabled
- public String label;
- @AuraEnabled
- public String value;
- }
+ public static Results init1() {
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ try {
+ String userId = UserInfo.getUserId();
+ // String userId = '0050l000007CAieAAG';
+ List<user> Useracc = new List<user>();
+ Useracc = [
+ SELECT accountid, Work_Location__c, UserPro_Type__c
+ FROM user
+ WHERE id = :userId
+ ];
+ accountid = Useracc[0].accountid;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ userWorkLocation = Useracc[0].Work_Location__c;
+ coc = new Consumable_order__c();
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('order_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ List<CusCol> cols = new List<CusCol>();
+ for (FieldSetMember fsm : fsmList) {
+ //add by Link
+ if(fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType == 'ET'){
+ }else {
+ CusCol col = new CusCol();
+ col.label = fsm.getLabel();
+ col.fieldName = fsm.getFieldPath();
+ col.hideDefaultActions = true;
+ // col.sortable = true;
+ col.wrapText = true;
+ if (fsm.getFieldPath() == 'Order_ForHospital__c') {
+ col.type = 'url';
+ col.fieldName = 'hosUrl';
+ TypeAttr typeAttributes1 = new TypeAttr();
+ CusLable cusLabel = new CusLable();
+ cusLabel.fieldName = 'hosName';
+ typeAttributes1.label = cusLabel;
+ typeAttributes1.target = '_blank';
+ col.typeAttributes = typeAttributes1;
+ }
+ if (fsm.getFieldPath() == 'Name') {
+ col.type = 'url';
+ col.fieldName = 'nameUrl';
+ TypeAttr typeAttributes1 = new TypeAttr();
+ CusLable cusLabel = new CusLable();
+ cusLabel.fieldName = 'Name';
+ typeAttributes1.label = cusLabel;
+ typeAttributes1.target = '_blank';
+ col.typeAttributes = typeAttributes1;
+ }
+ cols.add(col);
+ }
+ //update by rentx 2020-12-22 start
+ if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ title.add(fsm.getLabel());
+ }
+ if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ }
+ provinceOpts = new List<SelectOption>();
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOpts.add(new SelectOption('鑽夋涓�', '鑽夋涓�'));
+ provinceOpts.add(new SelectOption('宸叉彁浜�', '宸叉彁浜�'));
+ provinceOpts.add(new SelectOption('鎵瑰噯', '鎵瑰噯'));
+ provinceOpts.add(new SelectOption('椹冲洖', '椹冲洖'));
+ //閽堝lwc鐨勮嚜瀹氫箟option
+ provinceCusOpts = new List<CusOption>();
+ provinceCusOpts.add(new CusOption('-鏃�-', ''));
+ provinceCusOpts.add(new CusOption('鑽夋涓�', '鑽夋涓�'));
+ provinceCusOpts.add(new CusOption('宸叉彁浜�', '宸叉彁浜�'));
+ provinceCusOpts.add(new CusOption('鎵瑰噯', '鎵瑰噯'));
+ provinceCusOpts.add(new CusOption('椹冲洖', '椹冲洖'));
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '璁㈠崟' + '\'';
+ soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\'';
+ soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\'';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c ';
+ System.debug('====soql====' + soql);
+ raesList = Database.query(soql);
+ //add by rentx 2021-3-10 start
+ //涓� hasHop 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
+ List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hopList == null || hopList.size() == 0) {
+ hasHop = false;
+ } else {
+ hasHop = true;
+ }
+ //涓� hasSpecial 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈変績閿�鍟嗗搧
+ //鏌ヨ褰撳墠缁忛攢鍟嗕笅鐨勬湁鏁堝悎鍚�
+ List<Account> contractList = [
+ SELECT Id, Name, RecordType.DeveloperName
+ FROM Account
+ WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid
+ ];
+ List<Id> dealIds = new List<Id>();
+ if (contractList != null && contractList.size() > 0) {
+ for (Account acc : contractList) {
+ dealIds.add(acc.Id);
+ }
+ List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds];
+ if (deList == null || deList.size() == 0) {
+ hasSpecial = false;
+ } else {
+ hasSpecial = true;
+ }
+ } else {
+ hasSpecial = false;
+ }
+ results.result = 'Success';
+ results.provinceOpts = provinceCusOpts;
+ results.raesList = raesList;
+ results.agencyProType = agencyProType;
+ results.userWorkLocation = userWorkLocation;
+ results.accountid = accountid;
+ results.hasHop = hasHop;
+ results.hasSpecial = hasSpecial;
+ results.title = title;
+ results.cols = cols;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
- public class CusCol {
@AuraEnabled
- public String label;
- @AuraEnabled
- public String fieldName;
- @AuraEnabled
- public String type;
- @AuraEnabled
- public Boolean sortable;
- @AuraEnabled
- public Boolean wrapText;
- @AuraEnabled
- public Boolean hideDefaultActions;
- @AuraEnabled
- public TypeAttr typeAttributes;
- }
+ public static Results searchConsumableorderdetails(
+ String categoryStr,
+ Date orderDate,
+ String orderStatus,
+ String accountidStr,
+ String agencyProTypeStr,
+ String userWorkLocationStr
+ ) {
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ userWorkLocation = userWorkLocationStr;
+ accountid = accountidStr;
+ if (String.isBlank(categoryStr)) {
+ category1 = null;
+ } else {
+ category1 = categoryStr;
+ }
+ coc = new Consumable_order__c();
+ if (String.isBlank(orderStatus)) {
+ coc.Order_status__c = null;
+ } else {
+ coc.Order_status__c = orderStatus;
+ }
+ coc.Order_date__c = orderDate;
+ try {
+ Date cate2 = coc.Order_date__c;
+ String cate3 = coc.Order_status__c;
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('order_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ for (FieldSetMember fsm : fsmList) {
+ //update by rentx 2020-12-22 start
+ if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ title.add(fsm.getLabel());
+ }
+ if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ }
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql +=
+ ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
+ '璁㈠崟' +
+ '\' and RecordtypeId = \'' +
+ System.Label.RT_ConOrder_Order +
+ '\' and Dealer_Info__c =\'' +
+ accountid +
+ '\' ';
+ soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (cate2 != null) {
+ soql += ' and Order_date__c = :cate2';
+ }
+ if (cate3 != null) {
+ soql += ' and Order_status__c = :cate3 ';
+ }
+ soql += ' order by Order_status__c ';
+ system.debug('====soql:' + soql);
+ raesList = Database.query(soql);
+ system.debug('====raesList:' + raesList);
+ if (raesList.size() > 0) {
+ results.result = 'Success';
+ results.raesList = raesList;
+ results.errorMsg = '鍏辨湁' + raesList.size() + '涓鍗�';
+ } else {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏宠鍗�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
- public class TypeAttr {
- @AuraEnabled
- public CusLable label;
- @AuraEnabled
- public String target;
- }
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<CusOption> provinceOpts;
+ @AuraEnabled
+ public List<String> title;
+ @AuraEnabled
+ public String accountid;
+ @AuraEnabled
+ public String agencyProType;
+ @AuraEnabled
+ public String userWorkLocation;
+ @AuraEnabled
+ public Boolean hasHop;
+ @AuraEnabled
+ public Boolean hasSpecial;
+ @AuraEnabled
+ public List<Consumable_order__c> raesList;
+ @AuraEnabled
+ public List<CusCol> cols;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ }
- public class CusLable {
- @AuraEnabled
- public String fieldName;
- }
-}
+ public class CusOption {
+ CusOption(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
+ }
+
+ public class CusCol {
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String fieldName;
+ @AuraEnabled
+ public String type;
+ @AuraEnabled
+ public Boolean sortable;
+ @AuraEnabled
+ public Boolean wrapText;
+ @AuraEnabled
+ public Boolean hideDefaultActions;
+ @AuraEnabled
+ public TypeAttr typeAttributes;
+ }
+
+ public class TypeAttr {
+ @AuraEnabled
+ public CusLable label;
+ @AuraEnabled
+ public String target;
+ }
+
+ public class CusLable {
+ @AuraEnabled
+ public String fieldName;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls b/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls
index 2fffa74..900bbbc 100644
--- a/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls
+++ b/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls
@@ -1,132 +1,39 @@
@istest
public class LexConsumableOrderManageControllerTest {
- @IsTest
- static void ConsumableOrdertest() {
- User myUser_test = new User();
- Account myAccount1;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- }
+ @IsTest
+ static void ConsumableOrdertest(){
+ User myUser_test = new User();
+ Account myAccount1;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id );
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '鍖椾含');
+ insert myUser_test;
+ }
- System.runAs(myUser_test) {
- Consumable_order__c testList5 = new Consumable_order__c(
- Name = 'test5',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList6 = new Consumable_order__c(
- Name = 'test6',
- Order_status__c = '宸叉彁浜�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList7 = new Consumable_order__c(
- Name = 'test7',
- Order_status__c = '宸叉彁浜�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'test1',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList2 = new Consumable_order__c(
- Name = 'test2',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList3 = new Consumable_order__c(
- Name = 'test3',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_ProType__c = 'ET'
- );
- Consumable_order__c testList4 = new Consumable_order__c(
- Name = 'test4',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id,
- Order_type__c = '璁㈠崟',
- RecordtypeId = System.Label.RT_ConOrder_Order,
- Order_date__c = Date.today(),
- Order_ProType__c = 'ET'
- );
- insert new List<Consumable_order__c>{
- testList1,
- testList2,
- testList3,
- testList4,
- testList5,
- testList6,
- testList7
- };
- LexConsumableOrderManageController.init1();
- String accID = myAccount1.Id;
- LexConsumableOrderManageController.searchConsumableorderdetails(
- '',
- null,
- '',
- accID,
- 'ET',
- '鍖椾含'
- );
+ System.runAs(myUser_test){
+ Consumable_order__c testList5 = new Consumable_order__c(Name='test5',Order_status__c='鑽夋涓�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList6 = new Consumable_order__c(Name='test6',Order_status__c='宸叉彁浜�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList7 = new Consumable_order__c(Name='test7',Order_status__c='宸叉彁浜�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList1 = new Consumable_order__c(Name='test1',Order_status__c='鑽夋涓�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList2 = new Consumable_order__c(Name='test2',Order_status__c='鑽夋涓�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList3 = new Consumable_order__c(Name='test3',Order_status__c='鑽夋涓�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_ProType__c = 'ET');
+ Consumable_order__c testList4 = new Consumable_order__c(Name='test4',Order_status__c='鑽夋涓�',Dealer_info__c=myAccount1.Id,Order_type__c ='璁㈠崟',RecordtypeId = System.Label.RT_ConOrder_Order,Order_date__c = Date.today(),Order_ProType__c = 'ET');
+ insert new Consumable_order__c[]{testList1,testList2,testList3,testList4,testList5,testList6,testList7};
+ LexConsumableOrderManageController.init1();
+ String accID = myAccount1.Id;
+ LexConsumableOrderManageController.searchConsumableorderdetails('',null, '',accID, 'ET', '鍖椾含');
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml b/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexInventoryController.cls b/force-app/main/default/classes/LexInventoryController.cls
index 238f43d..7380b26 100644
--- a/force-app/main/default/classes/LexInventoryController.cls
+++ b/force-app/main/default/classes/LexInventoryController.cls
@@ -1,1801 +1,1473 @@
public without sharing class LexInventoryController {
- // page
- public static Integer pagesize { get; set; }
- public static Integer pageToken { get; set; }
- public static String sortField { get; set; }
- public static String sortOrder { get; set; }
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
- public static Integer totalcount { get; set; }
- //鍒嗛〉浣跨敤鏁版嵁
- public static String fileName { get; set; }
- public static Integer size { get; set; }
- public static Integer noOfRecords { get; set; }
- public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 涓㈠け鍜屽贰鍥炵殑,鐢婚潰鏄剧ず鐢�
- public static ApexPages.StandardSetController setCon { get; set; }
- @AuraEnabled
- public static List<Consumable_order_details2__c> setConDetails2 { get; set; }
- public static Map<Id, String> pandiandetailsMap = new Map<Id, String>();
- /*****************妞滅储鐢�******************/
- public static String barcode { get; set; }
- public static Boolean done { get; set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- //椤甸潰涓绘暟鎹樉绀虹敤
- // private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
- public static List<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 Integer totalcount { get; set; }
+ //鍒嗛〉浣跨敤鏁版嵁
+ public static String fileName { get; set; }
+ public static Integer size { get; set; }
+ public static Integer noOfRecords { get; set; }
+ public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 涓㈠け鍜屽贰鍥炵殑,鐢婚潰鏄剧ず鐢�
+ public static ApexPages.StandardSetController setCon { get; set; }
+ @AuraEnabled
+ public static List<Consumable_order_details2__c> setConDetails2 { get; set; }
+ public static Map<Id, String> pandiandetailsMap = new Map<Id, String>();
+ /*****************妞滅储鐢�******************/
+ public static String barcode { get; set; }
+ public static Boolean done { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ //椤甸潰涓绘暟鎹樉绀虹敤
+ // private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
+ //鐩樼偣鍒扮殑浜у搧
+ public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
- //public List<Consumable_order_details2__c> pandiandetailsList { get; set; }
- public static List<List<Consumable_order_details2__c>> pandiandetailsListShow {
- get;
- set;
- }
- //瀵诲洖鏄庣粏
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 涓㈠け鍜屽贰鍥炵殑,瀹為檯鐐掍綔鐢�
- @AuraEnabled
- public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview {
- get;
- set;
- } // 浜у搧鍗曚綅鐨凩ist
- public static List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
-
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords;
-
- public static Integer consumableorderdetailsCount {
- get {
- return consumableorderdetailsRecords == null
- ? 0
- : consumableorderdetailsRecords.size();
- }
- }
- //list<String> notexitlist = new list<String>();
- public static Map<String, String> reFindProduct = new Map<String, String>();
- //鎺掑簭鐢�
- // public static String sortKey;
- // public static String preSortKey;
- // public static Boolean sortOrderAsc;
- // public static String[] sortOrder;
- //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 鏈夛紝BarCodeListP 娌℃湁
- /*****************缁忛攢鍟咺D******************/
- private static String accountid = null;
- private static String accountName = null;
- // 鐩樼偣 ID
- private static String eSetId = '';
- // 鐧诲綍鑰呭伐浣滃湴
- private static String userWorkLocation;
- //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
- public static String agencyProType { get; set; }
- public static String sqlagencyProType;
- //鍒ゆ柇鎿嶄綔浜哄憳鏄惁鐩樼偣
- public static Boolean iSinventory = false;
-
- public LexInventoryController() {
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- done = false;
-
- consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
- consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
- codPageRecords = new List<ConsumableorderdetailsInfo>();
- //codPageRecordsShow = new List<ConsumableorderdetailsInfo>();
- }
-
- private static void initStandardController() {
- // init standard controller
- List<Consumable_order_details2__c> showcod2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name DESC
- ];
- setConDetails2 = showcod2;
- System.debug('setConDetails2===>' + setConDetails2);
- // setCon = new ApexPages.StandardSetController(showcod2);
- // // sets the number of records in each page set
- // setCon.setPageSize(size);
- // noOfRecords = setCon.getResultSize();
- }
-
- public static List<Consumable_order_details2__c> cod2s() {
- return setConDetails2;
- }
- //Changes the size of pagination
- public static PageReference refreshPageSize() {
- setCon.setPageSize(size);
- //showcod2nid = cod2s();
- makepagerecords();
- return null;
- }
-
- public static List<ConsumableorderdetailsInfo> makepagerecords() {
- showcod2nid = cod2s();
- codPageRecords = new List<ConsumableorderdetailsInfo>();
- for (Consumable_order_details2__c cod2 : showcod2nid) {
- codPageRecords.add(
- new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id))
- );
- }
- System.debug('===>codPageRecords1' + codPageRecords);
- return codPageRecords;
- }
-
- // 鐢婚潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init() {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
- setConDetails2 = new List<Consumable_order_details2__c>();
- String url = '鍦ㄥ簱璋冩暣涓�瑙�';
- fileName = EncodingUtil.urlEncode(url, 'UTF-8');
- List<Consumable_order_details2__c> showcod2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- System.debug('pandiandetailsMap====>' + pandiandetailsMap);
- initStandardController();
- makepagerecords();
- // sortKey = '1';
- // preSortKey = '1';
- // sortOrderAsc = false;
- // sortOrder = new String[1];
- // sortOrder = new String[]{' ',' ','鈫�'};
-
- String userId = UserInfo.getUserId();
- //String userId = '00510000006k82X';
- //String userId = '00510000005QO75';
- user Useracc = [
- SELECT Accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc.Accountid;
- userWorkLocation = Useracc.Work_Location__c;
- agencyProType = Useracc.UserPro_Type__c;
- if (String.isBlank(Useracc.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- sqlagencyProType = '%' + agencyProType + '%';
- Account accountInfo = [
- SELECT Name, Dealer_discount__c
- FROM account
- WHERE id = :accountid
- ];
- accountName = accountInfo.Name;
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- Map<String, Product2__c> midMap = new Map<String, Product2__c>();
- List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
- //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
- //寮�濮嬪埗浣滆〃澶存暟鎹�
- // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
- // SFDA_Status__c,Packing_list_manual__c,
- // Asset_Model_No__c
- // from Product2__c
- // //where Estimation_Entry_Possibility__c = '鈼�'
- // where Product_Type__c like : sqlagencyProType
- // ];
- // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
- // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
- // }
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- List<Consumable_order_details2__c> ProductCount_Res = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Product_Type__c LIKE :sqlagencyProType
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
- //寮�濮嬪埗浣滆〃澶存暟鎹�
- Set<Id> Product2cIdSet = new Set<Id>();
- for (Consumable_order_details2__c con_or_d2item : ProductCount_Res) {
- Product2cIdSet.add(con_or_d2item.Consumable_Product__c);
- }
- List<Product2__c> productCount_Unfull_bak = [
- SELECT
- Id,
- Name,
- Name__c,
- SFDA_Status__c,
- Packing_list_manual__c,
- Asset_Model_No__c
- FROM Product2__c
- //where Estimation_Entry_Possibility__c = '鈼�'
- WHERE Id IN :Product2cIdSet AND Product_Type__c LIKE :sqlagencyProType
- ];
- for (integer i = 0; i < productCount_Unfull_bak.size(); i++) {
- midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
- }
- system.debug('productCount_Unfull_bak' + productCount_Unfull_bak.size());
- // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size();
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro));
- //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy end
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size()));
- for (Integer i = 0; i < ProductCount_Res.size(); i++) {
- //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
- if (
- MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) &&
- ProductCount_Res[i].Box_Piece__c == '鐩�'
- ) {
- if (
- newMidBoxMap.containsKey(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c
- )
- ) {
- ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c
- )
- .clone();
- Jstage.countid = Jstage.countid + 1;
- if (ProductCount_Res[i].Isoverdue__c == 1) {
- Jstage.limitCount = Jstage.limitCount + 1;
- }
- Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
- newMidBoxMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- Jstage
- );
- } else {
- ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
- MidMap.get(ProductCount_Res[i].Consumable_Product__c)
- );
- Jstage.countid = Jstage.countid + 1;
- if (ProductCount_Res[i].Isoverdue__c == 1) {
- Jstage.limitCount = Jstage.limitCount + 1;
- }
- Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
- newMidBoxMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- Jstage
- );
- }
- } else if (
- MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) &&
- ProductCount_Res[i].Box_Piece__c == '涓�'
- ) {
- if (
- newMidPieceMap.containsKey(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c
- )
- ) {
- ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c
- )
- .clone();
- Jstage.countid = Jstage.countid + 1;
- if (ProductCount_Res[i].Isoverdue__c == 1) {
- Jstage.limitCount = Jstage.limitCount + 1;
- }
- Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
- newMidPieceMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- Jstage
- );
- } else {
- ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
- MidMap.get(ProductCount_Res[i].Consumable_Product__c)
- );
- Jstage.countid = Jstage.countid + 1;
- if (ProductCount_Res[i].Isoverdue__c == 1) {
- Jstage.limitCount = Jstage.limitCount + 1;
- }
- Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
- newMidPieceMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- Jstage
- );
- }
- }
- }
- for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
- bss.overlimitCount = bss.countid - bss.limitCount;
- boxRecords.add(bss);
- }
- boxRecords.sort();
- for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
- bss.overlimitCount = bss.countid - bss.limitCount;
- }
- for (ConsumableorderdetailsInfo bss : boxRecords) {
- consumableorderdetailsRecords.add(bss);
- if (newMidPieceMap.containsKey(bss.Prod.Id + '涓�')) {
- consumableorderdetailsRecords.add(
- newMidPieceMap.get(bss.Prod.Id + '涓�')
- );
- //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
- newMidPieceMap.remove(bss.Prod.Id + '涓�');
- }
- }
- for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
- consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
- }
- //consumableorderdetailsCount = consumableorderdetailsRecords.size();
- listCut();
-
- data.put(
- 'ConsumableorderdetailsRecordsview',
- JSON.serialize(ConsumableorderdetailsRecordsview)
- );
- data.put('userWorkLocation', userWorkLocation);
- data.put('agencyProType', agencyProType);
- data.put('accountName', accountName);
- data.put('accountid', accountid);
-
- data.put(
- 'consumableorderdetailsRecords',
- JSON.serialize(consumableorderdetailsRecords)
- );
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- private static void listCut() {
- //鎷嗗垎鏆傜敤list
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsInfo c = null;
- ConsumableorderdetailsRecordsbreak.clear();
- ConsumableorderdetailsRecordsbreakover.clear();
- consumableorderdetailsRecordsview.clear();
- //閫夋嫨浜у搧view
- ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
- ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
- if (consumableorderdetailsRecords.size() > 1000) {
- for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) {
- if (i < 1000) {
- c = consumableorderdetailsRecords.get(i);
- ConsumableorderdetailsRecordsbreak.add(c);
- } else {
- c = consumableorderdetailsRecords.get(i);
- ConsumableorderdetailsRecordsbreakover.add(c);
- }
- }
- consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
- consumableorderdetailsRecordsview.add(
- ConsumableorderdetailsRecordsbreakover
- );
- } else {
- consumableorderdetailsRecordsview.add(consumableorderdetailsRecords);
- }
- }
- //========20160311======ADD_Start================================
- // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
- //========20160311======ADD_Start================================
- public static List<String> ParseBarCode(String Code) {
- Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
- String[] Cache = new List<String>{};
- Cache = Code.split('\n');
- List<String> Buff = new List<String>();
- for (String A : Cache) {
- A = A.trim().toUpperCase();
- if (barcodeCountMap.containsKey(A)) {
- barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
- } else {
- barcodeCountMap.put(A, 1);
- }
- Buff.add(A + barcodeCountMap.get(A));
- }
- return Buff;
- }
-
- //test
-
- // @AuraEnabled
- // public static ResponseBodyLWC searchConsumableorderdetails(String sqlagencyProType,String userWorkLocation,String accountName,String barcode,List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsLWC){
- // return new ResponseBodyLWC('Error',500, 'test', '');
- // }
- //========20160311======ADD_End==================================
- // BarCode褰曞叆
- @AuraEnabled
- public static ResponseBodyLWC searchConsumableorderdetails(
- String agencyProType,
- String userWorkLocation,
- String accountName,
- String barcode,
- String consumableorderdetailsRecordsLWC,
- Integer pageSizeLWC,
- Integer pageTokenLWC,
- String sortFieldLWC,
- String sortOrderLWC
- ) {
- pageSize = pageSizeLWC;
- pageToken = pageTokenLWC;
- sortField = sortFieldLWC;
- sortOrder = sortOrderLWC;
-
- System.debug(
- '===>consumableorderdetailsRecordsLWC' + consumableorderdetailsRecordsLWC
- );
- List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetailsRecordsLWC,
- List<ConsumableorderdetailsInfo>.class
- );
- // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
- system.debug(
- '=====>consumableorderdetailsRecordsLWC' +
- consumableorderdetailsRecordsLWC
- );
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- sqlagencyProType = '%' + agencyProType + '%';
- System.debug('sqlagencyProType==>' + sqlagencyProType);
- System.debug('accountName==>' + accountName);
- System.debug('userWorkLocation==>' + userWorkLocation);
-
- /* BarCodelist鍋氭垚 */
- //FIXME barcodeSet 鍋氭垚锛孭roductCount_ResSet 鍋氭垚
- List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>();
- pandiandetailsListShow = new List<List<Consumable_order_details2__c>>();
- done = false;
- List<String> BarCodeListP = ParseBarCode(barcode);
- System.debug('BarCodeListP===>' + BarCodeListP);
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- List<Consumable_order_details2__c> ProductCount_Res = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Dealer_Info_text__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Product_Type__c LIKE :sqlagencyProType
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- System.debug('ProductCount_Res==>' + ProductCount_Res);
- reFindProduct.clear();
- Map<String, ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String, ConsumableorderdetailsInfo>();
- //barCodeListLoseMap.clear();
- Set<String> carCodeListLose = new Set<String>();
- List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>();
- Map<String, String> proIdNotinpage = new Map<String, String>();
- List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>();
- codPageRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> reFindProductaddtopage = new List<ConsumableorderdetailsInfo>();
- pandiandetailsMap.clear();
- reSet = new List<Consumable_order_details2__c>();
- /* 鍒ゆ柇BarCode鏄惁涓虹┖ */
- if (barcode == null || barcode == '') {
- //鍏堝彇鍑烘墍鏈変涪澶变骇鍝�
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
- ass.Pandian = 0;
- // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
- if (ass.check == true) {
- //ass.Diff = ass.countid - ass.Pandian;
- for (integer i = 0; i < ProductCount_Res.size(); i++) {
- System.debug('Pro==>' + ProductCount_Res[i].Consumable_Product__c);
- System.debug('ProId==>' + ass.Prod.Id);
- System.debug('ass.boxPiece ==>' + ass.boxPiece);
- System.debug('boxPiece ==>' + ProductCount_Res[i].Box_Piece__c);
- if (
- ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == ProductCount_Res[i].Box_Piece__c
- ) {
- if (carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)) {
- continue;
- } else {
- //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
- //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
- ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
- carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
- }
- }
- }
- }
- }
-
- //宸茬粡鍑哄簱鐨勪骇鍝�
- List<Consumable_order_details2__c> reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c,
- Dealer_Info_text__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND (Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE)
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c IN :carCodeListLose
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : reSet1) {
- needreturnMap.put(cod2.Bar_Code__c, cod2);
- }
-
- // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
- reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c,
- Dealer_Info_text__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c IN :carCodeListLose
- AND (Dealer_Info_text__c != :accountName
- OR (Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation))
- ORDER BY Name
- ];
- Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : reSet1) {
- otherAgProMap.put(cod2.Bar_Code__c, cod2);
- }
- carCodeListLose.clear();
-
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.check == true) {
- ass.Diff = ass.countid - ass.Pandian;
- for (integer i = 0; i < ProductCount_Res.size(); i++) {
- if (
- ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == ProductCount_Res[i].Box_Piece__c
- ) {
- if (
- carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)
- ) {
- continue;
- } else {
- if (
- needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)
- ) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- ProductCount_Res[i],
- '璇ヤ骇鍝佹湭杩斿搧'
- )
- );
- pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佹湭杩斿搧');
- carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
- continue;
- }
- if (
- otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)
- ) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- ProductCount_Res[i],
- '璇ヤ骇鍝佸綊灞炰簬' +
- otherAgProMap.get(ProductCount_Res[i].Bar_Code__c)
- .Dealer_Info_text__c +
- '鐨勫簱瀛樸��'
- )
- );
- pandiandetailsMap.put(
- ProductCount_Res[i].Id,
- '璇ヤ骇鍝佸綊灞炰簬' +
- otherAgProMap.get(ProductCount_Res[i].Bar_Code__c)
- .Dealer_Info_text__c +
- '鐨勫簱瀛樸��'
- );
- carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
- continue;
- }
- if (ProductCount_Res[i].Isoverdue__c == 0) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- ProductCount_Res[i],
- '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'
- )
- );
- pandiandetailsMap.put(
- ProductCount_Res[i].Id,
- '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'
- );
- carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
- ass.Diff--;
- continue;
- }
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(ProductCount_Res[i], '涓㈠け')
- );
- pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
- carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
- }
- }
- }
- } else {
- ass.Pandian = 0;
- ass.Diff = 0;
- }
- }
- List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>();
- if (pandiandetailsMap.keySet().size() > 0) {
- showcod2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- }
- initStandardController();
- showcod2nid = cod2s();
-
- for (Consumable_order_details2__c cod2 : showcod2nid) {
- codPageRecords.add(
- new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id))
- );
- }
-
- iSinventory = true;
- if (codPageRecords.size() > 0)
- done = true;
- consumableorderdetailsRecordserrordummy.clear();
-
- //pandiandetailsList = new list<Consumable_order_details2__c>();
- pandiandetailsList = [
- SELECT
- Id,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Box_Piece__c,
- Lose_reason__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- for (Consumable_order_details2__c codDet : pandiandetailsList) {
- codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
- }
- List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : pandiandetailsList) {
- pandiandetailsListMid.add(cod2);
- if (pandiandetailsListMid.size() == 1000) {
- pandiandetailsListShow.add(pandiandetailsListMid);
- pandiandetailsListMid = new List<Consumable_order_details2__c>();
- }
- }
- if (pandiandetailsListMid.size() > 0) {
- pandiandetailsListShow.add(pandiandetailsListMid);
- }
-
- //鍒嗛〉
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- totalCount = codPageRecords.size();
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
-
- Integer startIdx;
- Integer endIdx;
- List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
- startIdx = pageToken;
- endIdx = startIdx + pageSize;
- if (endIdx > codPageRecords.size()) {
- endIdx = codPageRecords.size();
- }
- for (Integer i = startIdx; i < endIdx; i++) {
- pageCodeRecords.add(codPageRecords.get(i));
- }
-
- data.put('paginatedAccounts', paginatedAccounts);
- data.put('pageCodeRecords', pageCodeRecords);
-
- //end
- data.put('codPageRecords', JSON.serialize(codPageRecords));
- data.put(
- 'consumableorderdetailsRecords',
- JSON.serialize(consumableorderdetailsRecords)
- );
- data.put(
- 'consumableorderdetailsRecordsview',
- JSON.serialize(consumableorderdetailsRecordsview)
- );
- data.put('pandiandetailsMap', pandiandetailsMap);
- System.debug('iSinventory===>' + iSinventory);
- System.debug('codPageRecords===>' + codPageRecords);
- data.put('iSinventory', JSON.serialize(iSinventory));
- data.put('reSet1', reSet1);
- System.debug('reSet1===>' + reSet1);
- res.code = 200;
- res.status = 'Success1';
-
- return res;
- }
-
- //CHAN-B7J4NB 鍙湁涓�涓椂锛岀洏鐐逛笉鍒�
- //init();
- //CHAN-B7J4NB
- Map<String, String> showproductIdMap = new Map<String, String>();
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- showproductIdMap.put(
- ass.prod.Id + ass.boxPiece,
- ass.prod.Id + ass.boxPiece
- );
- }
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
- /***************************************************************************/
- // BarCode鐨勬绱� 鎵�鏈夊湪搴�
- reSet = [
- SELECT
- Id,
- Consumable_Product__c,
- Consumable_Product__r.Name__c,
- Box_Piece__c,
- Bar_Code_search__c,
- Isoverdue__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code_search__c IN :BarCodeListP
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Date__c = NULL
- AND Bar_Code__c != NULL
- AND Product_Type__c LIKE :sqlagencyProType
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- System.debug('reSet===>' + reSet);
- Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
- // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
- Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
- // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
- Map<String, ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String, ConsumableorderdetailsInfo>(); // 鏄庣窗銉愩兗銈炽兗銉� 鍗樹綅
- //鐩樼偣鍒扮殑鏄庣粏
- for (Consumable_order_details2__c rs : reSet) {
- //BarCodeListPandian.add(rs.Bar_Code_search__c);
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (
- rs.Consumable_Product__c == ass.Prod.Id &&
- rs.Box_Piece__c == ass.boxPiece
- ) {
- ass.check = true;
- }
- }
-
- barCodeListPandianMap.put(
- rs.Bar_Code_search__c,
- new ConsumableorderdetailsInfo(rs)
- );
- if (rs.Isoverdue__c == 0) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(rs, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��')
- );
- pandiandetailsMap.put(rs.Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
- if (
- pandianoverdueCountMap.containsKey(
- rs.Consumable_product__c + rs.Box_Piece__c
- ) == false
- ) {
- pandianoverdueCountMap.put(
- rs.Consumable_Product__c + rs.Box_Piece__c,
- 1
- );
- } else {
- pandianoverdueCountMap.put(
- rs.Consumable_Product__c + rs.Box_Piece__c,
- pandianoverdueCountMap.get(
- rs.Consumable_Product__c + rs.Box_Piece__c
- ) + 1
- );
- }
- continue;
- }
- if (
- pandianProdIdCountMap.containsKey(
- rs.Consumable_product__c + rs.Box_Piece__c
- ) == false
- ) {
- pandianProdIdCountMap.put(
- rs.Consumable_Product__c + rs.Box_Piece__c,
- 1
- );
- } else {
- pandianProdIdCountMap.put(
- rs.Consumable_Product__c + rs.Box_Piece__c,
- pandianProdIdCountMap.get(
- rs.Consumable_Product__c + rs.Box_Piece__c
- ) + 1
- );
- }
- }
-
- // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
- List<Consumable_order_details2__c> reSet1 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Dealer_Shipment__c,
- Dealer_Saled__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Dealer_Arrive__c,
- Bar_Code_search__c,
- Dealer_Info_text__c
- FROM Consumable_order_details2__c
- WHERE
- (Dealer_Arrive__c = TRUE
- OR Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE)
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code_search__c IN :BarCodeListP
- AND (Dealer_Info_text__c != :accountName
- OR (Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation))
- ORDER BY Name
- ];
- Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : reSet1) {
- otherAgProMap.put(cod2.Bar_Code__c, cod2);
- }
- // 闇�瑕佸叆搴撶殑浜у搧
- for (Consumable_order_details2__c cod2 : reSet1) {
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (
- cod2.Consumable_Product__c == ass.Prod.Id &&
- cod2.Box_Piece__c == ass.boxPiece
- ) {
- ass.check = true;
- }
- }
- if (
- !showproductIdMap.containsKey(
- cod2.Consumable_product__c + cod2.Box_Piece__c
- )
- ) {
- reFindProductList.add(cod2);
- proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
- }
- if (
- !barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
- otherAgProMap.containsKey(cod2.Bar_Code__c) &&
- (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true ||
- otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true)
- ) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(cod2, '鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��')
- );
- pandiandetailsMap.put(cod2.Id, '鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��');
- }
- }
+ //public List<Consumable_order_details2__c> pandiandetailsList { get; set; }
+ public static List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; }
//瀵诲洖鏄庣粏
- 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
- ];
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 涓㈠け鍜屽贰鍥炵殑,瀹為檯鐐掍綔鐢�
+ @AuraEnabled
+ public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 浜у搧鍗曚綅鐨凩ist
+ public static List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
- 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;
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords;
+
+ public static Integer consumableorderdetailsCount {
+ get {
+ return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
}
- }
- if (
- !showproductIdMap.containsKey(
- rs.Consumable_product__c + rs.Box_Piece__c
- )
- ) {
- reFindProductList.add(rs);
- proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c);
- }
- if (barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)) {
- continue;
- } else {
- barCodeListAdjustMap.put(
- rs.Bar_Code_search__c,
- new ConsumableorderdetailsInfo(rs)
- );
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(rs, '瀵诲洖')
- );
- pandiandetailsMap.put(rs.Id, '瀵诲洖');
- consumableorderdetailsRecordsAdjust.add(
- new ConsumableorderdetailsInfo(rs)
- );
- }
}
- if (reFindProductList.size() > 0) {
- Map<String, Product2__c> midMap = new Map<String, Product2__c>();
- List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
- List<Product2__c> product_Refind = [
- SELECT
- Id,
- Name,
- Name__c,
- SFDA_Status__c,
- Packing_list_manual__c,
- Asset_Model_No__c
- FROM Product2__c
- WHERE Id IN :proIdNotinpage.keySet()
- ];
- for (Product2__c pro : product_Refind) {
- midMap.put(pro.Id, pro);
- }
- for (Integer i = 0; i < reFindProductList.size(); i++) {
- //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
- if (
- MidMap.containsKey(reFindProductList[i].Consumable_Product__c) &&
- reFindProductList[i].Box_Piece__c == '鐩�'
- ) {
- if (
- newMidBoxMap.containsKey(
- reFindProductList[i].Consumable_Product__c +
- reFindProductList[i].Box_Piece__c
- )
- ) {
- ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
- reFindProductList[i].Consumable_Product__c +
- reFindProductList[i].Box_Piece__c
- )
- .clone();
- Jstage.countid = 0;
- if (reFindProductList[i].Isoverdue__c == 1) {
- Jstage.limitCount = 0;
+ //list<String> notexitlist = new list<String>();
+ public static Map<String, String> reFindProduct = new Map<String, String>();
+ //鎺掑簭鐢�
+ // public static String sortKey;
+ // public static String preSortKey;
+ // public static Boolean sortOrderAsc;
+ // public static String[] sortOrder;
+ //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 鏈夛紝BarCodeListP 娌℃湁
+ /*****************缁忛攢鍟咺D******************/
+ private static String accountid = null;
+ private static String accountName = null;
+ // 鐩樼偣 ID
+ private static String eSetId = '';
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType { get; set; }
+ public static String sqlagencyProType;
+ //鍒ゆ柇鎿嶄綔浜哄憳鏄惁鐩樼偣
+ public static Boolean iSinventory = false;
+
+ public LexInventoryController() {
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ done = false;
+
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ //codPageRecordsShow = new List<ConsumableorderdetailsInfo>();
+ }
+
+ private static void initStandardController() {
+ // init standard controller
+ List<Consumable_order_details2__c> showcod2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name DESC
+ ];
+ setConDetails2 = showcod2;
+ System.debug('setConDetails2===>' + setConDetails2);
+ // setCon = new ApexPages.StandardSetController(showcod2);
+ // // sets the number of records in each page set
+ // setCon.setPageSize(size);
+ // noOfRecords = setCon.getResultSize();
+ }
+
+ public static List<Consumable_order_details2__c> cod2s() {
+ return setConDetails2;
+ }
+ //Changes the size of pagination
+ public static PageReference refreshPageSize() {
+ setCon.setPageSize(size);
+ //showcod2nid = cod2s();
+ makepagerecords();
+ return null;
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecords() {
+ showcod2nid = cod2s();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
+ }
+ System.debug('===>codPageRecords1' + codPageRecords);
+ return codPageRecords;
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ setConDetails2 = new List<Consumable_order_details2__c>();
+ String url = '鍦ㄥ簱璋冩暣涓�瑙�';
+ fileName = EncodingUtil.urlEncode(url, 'UTF-8');
+ List<Consumable_order_details2__c> showcod2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ System.debug('pandiandetailsMap====>' + pandiandetailsMap);
+ initStandardController();
+ makepagerecords();
+ // sortKey = '1';
+ // preSortKey = '1';
+ // sortOrderAsc = false;
+ // sortOrder = new String[1];
+ // sortOrder = new String[]{' ',' ','鈫�'};
+
+ String userId = UserInfo.getUserId();
+ //String userId = '00510000006k82X';
+ //String userId = '00510000005QO75';
+ user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+ accountid = Useracc.Accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ Account accountInfo = [SELECT Name, Dealer_discount__c FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, Product2__c> midMap = new Map<String, Product2__c>();
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
+ //寮�濮嬪埗浣滆〃澶存暟鎹�
+ // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
+ // SFDA_Status__c,Packing_list_manual__c,
+ // Asset_Model_No__c
+ // from Product2__c
+ // //where Estimation_Entry_Possibility__c = '鈼�'
+ // where Product_Type__c like : sqlagencyProType
+ // ];
+ // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
+ // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
+ // }
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ List<Consumable_order_details2__c> ProductCount_Res = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
+ //寮�濮嬪埗浣滆〃澶存暟鎹�
+ Set<Id> Product2cIdSet = new Set<Id>();
+ for (Consumable_order_details2__c con_or_d2item : ProductCount_Res) {
+ Product2cIdSet.add(con_or_d2item.Consumable_Product__c);
+ }
+ List<Product2__c> productCount_Unfull_bak = [
+ SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
+ FROM Product2__c
+ //where Estimation_Entry_Possibility__c = '鈼�'
+ WHERE Id IN :Product2cIdSet AND Product_Type__c LIKE :sqlagencyProType
+ ];
+ for (integer i = 0; i < productCount_Unfull_bak.size(); i++) {
+ midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
+ }
+ system.debug('productCount_Unfull_bak' + productCount_Unfull_bak.size());
+ // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size();
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro));
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy end
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size()));
+ for (Integer i = 0; i < ProductCount_Res.size(); i++) {
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if (MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '鐩�') {
+ if (newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c)) {
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
+ ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
+ )
+ .clone();
+ Jstage.countid = Jstage.countid + 1;
+ if (ProductCount_Res[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
+ MidMap.get(ProductCount_Res[i].Consumable_Product__c)
+ );
+ Jstage.countid = Jstage.countid + 1;
+ if (ProductCount_Res[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
+ }
+ } else if (MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '涓�') {
+ if (newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c)) {
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+ ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
+ )
+ .clone();
+ Jstage.countid = Jstage.countid + 1;
+ if (ProductCount_Res[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
+ MidMap.get(ProductCount_Res[i].Consumable_Product__c)
+ );
+ Jstage.countid = Jstage.countid + 1;
+ if (ProductCount_Res[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
+ }
}
- 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;
+ }
+ for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ boxRecords.sort();
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ }
+ for (ConsumableorderdetailsInfo bss : boxRecords) {
+ consumableorderdetailsRecords.add(bss);
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓�')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
+ newMidPieceMap.remove(bss.Prod.Id + '涓�');
}
- 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;
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ }
+ //consumableorderdetailsCount = consumableorderdetailsRecords.size();
+ listCut();
+
+ data.put('ConsumableorderdetailsRecordsview', JSON.serialize(ConsumableorderdetailsRecordsview));
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('accountName', accountName);
+ data.put('accountid', accountid);
+
+ data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ private static void listCut() {
+ //鎷嗗垎鏆傜敤list
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsInfo c = null;
+ ConsumableorderdetailsRecordsbreak.clear();
+ ConsumableorderdetailsRecordsbreakover.clear();
+ consumableorderdetailsRecordsview.clear();
+ //閫夋嫨浜у搧view
+ ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ if (consumableorderdetailsRecords.size() > 1000) {
+ for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) {
+ if (i < 1000) {
+ c = consumableorderdetailsRecords.get(i);
+ ConsumableorderdetailsRecordsbreak.add(c);
+ } else {
+ c = consumableorderdetailsRecords.get(i);
+ ConsumableorderdetailsRecordsbreakover.add(c);
+ }
}
- Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
- newMidPieceMap.put(
- reFindProductList[i].Consumable_Product__c +
- reFindProductList[i].Box_Piece__c,
- Jstage
- );
- } else {
- ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
- MidMap.get(reFindProductList[i].Consumable_Product__c)
- );
- Jstage.countid = 0;
- if (reFindProductList[i].Isoverdue__c == 1) {
- Jstage.limitCount = 0;
- }
- Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
- newMidPieceMap.put(
- reFindProductList[i].Consumable_Product__c +
- reFindProductList[i].Box_Piece__c,
- Jstage
- );
- }
- }
- }
- for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
- bss.check = true;
- bss.overlimitCount = bss.countid - bss.limitCount;
- boxRecords.add(bss);
- }
- boxRecords.sort();
- for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
- bss.check = true;
- bss.overlimitCount = bss.countid - bss.limitCount;
- }
- for (ConsumableorderdetailsInfo bss : boxRecords) {
- consumableorderdetailsRecords.add(bss);
- if (newMidPieceMap.containsKey(bss.Prod.Id + '涓�')) {
- consumableorderdetailsRecords.add(
- newMidPieceMap.get(bss.Prod.Id + '涓�')
- );
- //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
- newMidPieceMap.remove(bss.Prod.Id + '涓�');
- }
- }
- for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
- consumableorderdetailsRecords.add(
- newMidPieceMap.get(bss.Prod.Id + '涓�')
- );
- }
- }
-
- //鍏堝彇鍑烘湭鐩樼偣鍒扮殑浜у搧
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.check == true) {
- for (integer i = 0; i < ProductCount_Res.size(); i++) {
- if (
- ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == ProductCount_Res[i].Box_Piece__c
- ) {
- if (
- barCodeListPandianMap.get(
- ProductCount_Res[i].Bar_Code_search__c
- ) != null
- ) {
- continue;
- } else {
- carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
- ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
- //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
- //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
- }
- }
- }
- }
- }
- //宸茬粡鍑哄簱鐨勪骇鍝�
- List<Consumable_order_details2__c> reSet2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c,
- Dealer_Info_text__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND (Dealer_Shipment__c = TRUE
- OR Dealer_Saled__c = TRUE)
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code_search__c IN :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name
- ];
- Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : reSet2) {
- needreturnMap.put(cod2.Bar_Code__c, cod2);
- }
- //// 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
- //List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c,
- // Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
- // Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
- // Bar_Code_search__c,Dealer_Info_text__c
- // FROM Consumable_order_details2__c
- // WHERE (Dealer_Arrive__c = TRUE
- // or Dealer_Shipment__c= TRUE
- // or Dealer_Saled__c = TRUE)
- // AND Dealer_Returned__c = FALSE
- // AND Cancellation_Flag__c = FALSE
- // AND Bar_Code_search__c in :BarCodeListP
- // AND (Dealer_Info_text__c != :accountName
- // OR (Dealer_Info_text__c = :accountName
- // AND Arrive_Owner_Work_Location__c != :userWorkLocation)
- // )
- // ORDER BY Name ];
- //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
- //for(Consumable_order_details2__c cod2 :reSet1){
- // otherAgProMap.put(cod2.Bar_Code__c,cod2);
- //}
- carCodeListLose.clear();
- //鏈洏鐐瑰埌鐨勪骇鍝�
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.check == true) {
- for (integer i = 0; i < ProductCount_Res.size(); i++) {
- if (
- ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == ProductCount_Res[i].Box_Piece__c
- ) {
- if (
- barCodeListPandianMap.containsKey(
- ProductCount_Res[i].Bar_Code_search__c
- )
- ) {
- continue;
- }
- if (ProductCount_Res[i].Isoverdue__c == 0) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- ProductCount_Res[i],
- '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'
- )
- );
- pandiandetailsMap.put(
- ProductCount_Res[i].Id,
- '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'
- );
- if (
- pandianoverdueCountMap.containsKey(
- ProductCount_Res[i].Consumable_product__c +
- ProductCount_Res[i].Box_Piece__c
- ) == false
- ) {
- pandianoverdueCountMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- 1
- );
- } else {
- pandianoverdueCountMap.put(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c,
- pandianoverdueCountMap.get(
- ProductCount_Res[i].Consumable_Product__c +
- ProductCount_Res[i].Box_Piece__c
- ) + 1
- );
- }
- continue;
- }
-
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(ProductCount_Res[i], '涓㈠け')
- );
- pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
- }
- }
- // 鍚屾椂瀛樺湪鍏朵粬缁忛攢鍟嗗簱瀛樹骇鍝�
- for (Consumable_order_details2__c cod2 : reSet1) {
- if (
- cod2.Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == cod2.Box_Piece__c
- ) {
- if (
- barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
- otherAgProMap.containsKey(cod2.Bar_Code__c) &&
- otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false &&
- otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false
- ) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- cod2,
- '璇ヤ骇鍝佸綊灞炰簬' +
- otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c +
- '鐨勫簱瀛樸��'
- )
- );
- pandiandetailsMap.put(
- cod2.Id,
- '璇ヤ骇鍝佸綊灞炰簬' +
- otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c +
- '鐨勫簱瀛樸��'
- );
- continue;
- }
- }
- }
- // 闇�瑕佽繑鍝佺殑浜у搧
- for (Consumable_order_details2__c cod2 : reSet2) {
- if (
- cod2.Consumable_Product__c == ass.Prod.Id &&
- ass.boxPiece == cod2.Box_Piece__c
- ) {
- if (needreturnMap.containsKey(cod2.Bar_Code__c)) {
- consumableorderdetailsRecordserrordummy.add(
- new ConsumableorderdetailsInfo(
- cod2,
- '璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��'
- )
- );
- pandiandetailsMap.put(cod2.Id, '璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��');
- continue;
- }
- }
- }
- }
- }
-
- //鏇存柊涓绘槑缁嗗崟
- if (barCodeListPandianMap.size() > 0) {
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.check == true) {
- integer countSum = 0;
- if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
- countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece);
- }
- integer overdueSum = 0;
- if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
- overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
- }
- ass.Pandian = countSum;
- ass.Diff = ass.countid - countSum - overdueSum;
- ass.refind = 0;
- }
- }
- } else {
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.check == true) {
- integer overdueSum = 0;
- if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
- overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
- }
- ass.Diff = ass.countid - ass.Pandian - overdueSum;
- }
- }
- }
-
- //瀵诲洖鍋氭垚
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- for (
- ConsumableorderdetailsInfo adjust : consumableorderdetailsRecordsAdjust
- ) {
- if (
- ass.Prod.Name__c == adjust.Prod.Name__c &&
- ass.boxPiece == adjust.orderdetails2.Box_Piece__c
- ) {
- if (
- reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)
- ) {
- continue;
- } else {
- ass.Pandian++;
- ass.refind++;
- reFindProduct.put(
- adjust.orderdetails2.Bar_Code_search__c,
- adjust.orderdetails2.Bar_Code_search__c
- );
- }
- }
- }
- }
- if (pandiandetailsMap.keySet().size() > 0) {
- List<Consumable_order_details2__c> showcod2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- initStandardController();
- showcod2nid = cod2s();
- }
- for (Consumable_order_details2__c cod2 : showcod2nid) {
- codPageRecords.add(
- new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id))
- );
- }
- if (codPageRecords.size() > 0)
- done = true;
- iSinventory = true;
- consumableorderdetailsRecordserrordummy.clear();
- pandiandetailsList = [
- SELECT
- Id,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Box_Piece__c,
- Lose_reason__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- for (Consumable_order_details2__c codDet : pandiandetailsList) {
- codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
- }
- List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
- for (Consumable_order_details2__c cod2 : pandiandetailsList) {
- pandiandetailsListMid.add(cod2);
- if (pandiandetailsListMid.size() == 1000) {
- pandiandetailsListShow.add(pandiandetailsListMid);
- pandiandetailsListMid = new List<Consumable_order_details2__c>();
- }
- }
- if (pandiandetailsListMid.size() > 0) {
- pandiandetailsListShow.add(pandiandetailsListMid);
- }
- //鍒嗛〉
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- totalCount = codPageRecords.size();
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
-
- Integer startIdx;
- Integer endIdx;
- List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
- startIdx = pageToken;
- endIdx = startIdx + pageSize;
- if (endIdx > codPageRecords.size()) {
- endIdx = codPageRecords.size();
- }
- for (Integer i = startIdx; i < endIdx; i++) {
- pageCodeRecords.add(codPageRecords.get(i));
- }
-
- data.put('paginatedAccounts', paginatedAccounts);
- data.put('pageCodeRecords', pageCodeRecords);
-
- //end
-
- System.debug('=====>codPageRecords2' + codPageRecords);
- System.debug(
- '=====>consumableorderdetailsRecords' + consumableorderdetailsRecords
- );
- data.put('codPageRecords', JSON.serialize(codPageRecords));
- data.put(
- 'consumableorderdetailsRecords',
- JSON.serialize(consumableorderdetailsRecords)
- );
- System.debug('iSinventory===>' + iSinventory);
- data.put('iSinventory', JSON.serialize(iSinventory));
- System.debug('pandiandetailsMap===>' + pandiandetailsMap);
- data.put('pandiandetailsMap', pandiandetailsMap);
- data.put('reSet', reSet);
- data.put(
- 'consumableorderdetailsRecordsview',
- JSON.serialize(consumableorderdetailsRecordsview)
- );
- System.debug(
- '=====>consumableorderdetailsRecordsview' +
- consumableorderdetailsRecordsview
- );
- res.code = 200;
- res.status = 'Sucess';
- return res;
- }
-
- // 淇濆瓨鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC save(
- Boolean iSinventory,
- String consumableorderdetailsRecordsLWC,
- String accountid,
- String agencyProType,
- Map<Id, String> pandiandetailsMap,
- List<Consumable_order_details2__c> reSet
- ) {
- List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetailsRecordsLWC,
- List<ConsumableorderdetailsInfo>.class
- );
- agencyProType = agencyProType;
- accountid = accountid;
- pandiandetailsMap = pandiandetailsMap;
- reSet = reSet;
- System.debug('pandiandetailsMap===>' + pandiandetailsMap);
-
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- if (!iSinventory) {
- return new ResponseBodyLWC('Error', 500, '璇峰厛褰曞叆BarCode', '');
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
- // return null;
- }
- integer Lo = 0;
- for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
- if (header.check == true) {
- Lo++;
- }
- }
- if (Lo == 0) {
- iSinventory = false;
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏', '');
- }
- for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
- if (header.check == true) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + ' '+header.prod.Name__c));
- //return null;
- if (
- (header.DiffReason == '' || header.DiffReason == null) &&
- header.Diff > 0
- ) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�',
- ''
- );
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�'));
- // return null;
- } else if (
- (header.DiffReason != '' && header.DiffReason != null) &&
- header.Diff == 0
- ) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- header.prod.Name__c + '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�',
- ''
- );
- }
- }
- }
- Integer orderDetNo = 1;
- Savepoint sp = Database.setSavepoint();
- Consumable_order__c Po = new Consumable_order__c();
- Po.Name = '*';
- Po.Order_status__c = '鎵瑰噯';
- Po.Inventory_date__c = Date.today();
- Po.Order_type__c = '鐩樼偣';
- Po.Dealer_Info__c = accountid;
- Po.Order_ProType__c = agencyProType;
- Po.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- try {
- insert Po;
- eSetId = Po.id;
- List<Consumable_order__c> Consumable_order = [
- SELECT Name
- FROM Consumable_order__c
- WHERE id = :Po.id
- ];
- List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
- List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> updListAdjust = new List<Consumable_order_details2__c>();
- Map<String, String> ErrorName = new Map<String, String>();
- Map<String, Boolean> CheckTF = new Map<String, Boolean>();
- for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
- if (header.check == true) {
- Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
- insPan = new Consumable_orderdetails__c();
- String str = string.valueOf(orderDetNo);
- if (str.length() == 1) {
- str = '0' + str;
- }
- insPan.Name = Consumable_order[0].Name + '-' + str;
- insPan.Consumable_Product__c = header.ProdId;
- ErrorName.put(insPan.Consumable_Product__c, header.DiffReason);
- CheckTF.put(insPan.Consumable_product__c, true);
- insPan.Consumable_order__c = Po.Id;
- insPan.Lose_reason__c = header.DiffReason;
- insPan.Diff__c = header.Diff;
- insPan.Product_Refind__c = header.refind;
- insPan.inventory_sum__c = header.Pandian;
- insPan.Count_Sum__c = header.countid;
- insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
- orderDetNo++;
- InsList.add(insPan);
- }
- }
- if (InsList.size() > 0) {
- insert InsList;
- }
- List<Consumable_order_details2__c> showcod2 = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE Id IN :pandiandetailsMap.keySet()
- ORDER BY Name
- ];
- for (Consumable_order_details2__c cod : showcod2) {
- Consumable_order_details2__c InsDetail = new Consumable_order_details2__c();
- InsDetail.Id = cod.Id;
- InsDetail.Consumable_Inventory_order__c = po.Id;
- InsDetail.Inventory_date__c = Date.today();
- // 20210224 gzw CHAN-BXF3PG start
- // if(pandiandetailsMap.get(cod.Id) == '涓㈠け' ){
- if (
- pandiandetailsMap.get(cod.Id) == '涓㈠け' &&
- CheckTF.containsKey(cod.Consumable_product__c)
- ) {
- // 20210224 gzw CHAN-BXF3PG end
- InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c);
- InsDetail.Lose_Flag__c = true;
- } else if (pandiandetailsMap.get(cod.Id) == '瀵诲洖') {
- InsDetail.Lose_reason__c = '';
- InsDetail.Lose_Flag__c = false;
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
} else {
- continue;
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords);
}
- InsListUp.add(InsDetail);
- }
- for (Consumable_order_details2__c rs : reSet) {
- rs.Inventory_date__c = Date.today();
- }
- if (reSet.size() > 0) {
- update reSet;
- }
- if (InsListUp.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(InsListUp); // Commented By DTT - Li Jun for testing 20230407
- }
- } catch (Exception e) {
- Database.rollback(sp);
- // ApexPages.addMessages(ex);
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
- // return null;
}
- // FIXME impliment BarCodeListAdjust
- /************************************************************************************************/
- // return ProS();
- data.put('eSetId', eSetId);
- data.put('InsListUp', InsListUp);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
+ //========20160311======ADD_Start================================
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ //========20160311======ADD_Start================================
+ public static List<String> ParseBarCode(String Code) {
+ Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
+ String[] Cache = new List<String>{};
+ Cache = Code.split('\n');
+ List<String> Buff = new List<String>();
+ for (String A : Cache) {
+ A = A.trim().toUpperCase();
+ if (barcodeCountMap.containsKey(A)) {
+ barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
+ } else {
+ barcodeCountMap.put(A, 1);
+ }
+ Buff.add(A + barcodeCountMap.get(A));
+ }
+ return Buff;
+ }
- //鐩樼偣涓�瑙�
- public PageReference ProS() {
- // 杩斿洖鐩樼偣涓�瑙�
- PageReference ref = new Pagereference(
- '/apex/InventoryList?eSetId=' + eSetId
- );
- ref.setRedirect(true);
- return ref;
- }
- //CSV鍑哄姏
- public PageReference doClick() {
- Pagereference pr = page.InventoryCSV;
- return pr;
- }
- //鍒嗛〉Bean
- public class PaginatedAccounts {
- @AuraEnabled
- public Integer nextPageToken;
- @AuraEnabled
- public Integer pageNumber { get; set; }
- @AuraEnabled
- public Integer totalRecords { get; set; }
- @AuraEnabled
- public Integer recordStart { get; set; }
- @AuraEnabled
- public Integer recordEnd { get; set; }
- }
+ //test
- // Data Bean
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
+ // @AuraEnabled
+ // public static ResponseBodyLWC searchConsumableorderdetails(String sqlagencyProType,String userWorkLocation,String accountName,String barcode,List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsLWC){
+ // return new ResponseBodyLWC('Error',500, 'test', '');
+ // }
+ //========20160311======ADD_End==================================
+ // BarCode褰曞叆
@AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Consumable_orderdetails__c orderdetails1 { get; set; }
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Decimal countid { get; set; }
- @AuraEnabled
- public String ProdId { get; set; }
- @AuraEnabled
- public Decimal Pandian { get; set; }
- @AuraEnabled
- public Decimal Diff { get; set; }
- @AuraEnabled
- public Decimal refind { get; set; }
- @AuraEnabled
- public String DiffReason { get; set; }
- @AuraEnabled
- public Boolean canSelect { get; set; }
- @AuraEnabled
- public Boolean sortBy { get; set; }
- @AuraEnabled
- public Decimal limitCount { get; set; }
- @AuraEnabled
- public Decimal overlimitCount { get; set; }
- @AuraEnabled
- public String boxPiece { get; set; }
- public ConsumableorderdetailsInfo(
- Consumable_order_details2__c e,
- string str
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String agencyProType,
+ String userWorkLocation,
+ String accountName,
+ String barcode,
+ String consumableorderdetailsRecordsLWC,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC,
+ String sortFieldLWC,
+ String sortOrderLWC
) {
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- //e.Lose_reason__c = str;
- DiffReason = str;
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
+
+ System.debug('===>consumableorderdetailsRecordsLWC' + consumableorderdetailsRecordsLWC);
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLWC,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
+ system.debug('=====>consumableorderdetailsRecordsLWC' + consumableorderdetailsRecordsLWC);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ sqlagencyProType = '%' + agencyProType + '%';
+ System.debug('sqlagencyProType==>' + sqlagencyProType);
+ System.debug('accountName==>' + accountName);
+ System.debug('userWorkLocation==>' + userWorkLocation);
+
+ /* BarCodelist鍋氭垚 */
+ //FIXME barcodeSet 鍋氭垚锛孭roductCount_ResSet 鍋氭垚
+ List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>();
+ pandiandetailsListShow = new List<List<Consumable_order_details2__c>>();
+ done = false;
+ List<String> BarCodeListP = ParseBarCode(barcode);
+ System.debug('BarCodeListP===>' + BarCodeListP);
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ List<Consumable_order_details2__c> ProductCount_Res = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Dealer_Info_text__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ System.debug('ProductCount_Res==>' + ProductCount_Res);
+ reFindProduct.clear();
+ Map<String, ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String, ConsumableorderdetailsInfo>();
+ //barCodeListLoseMap.clear();
+ Set<String> carCodeListLose = new Set<String>();
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> proIdNotinpage = new Map<String, String>();
+ List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> reFindProductaddtopage = new List<ConsumableorderdetailsInfo>();
+ pandiandetailsMap.clear();
+ reSet = new List<Consumable_order_details2__c>();
+ /* 鍒ゆ柇BarCode鏄惁涓虹┖ */
+ if (barcode == null || barcode == '') {
+ //鍏堝彇鍑烘墍鏈変涪澶变骇鍝�
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
+ ass.Pandian = 0;
+ // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
+ if (ass.check == true) {
+ //ass.Diff = ass.countid - ass.Pandian;
+ for (integer i = 0; i < ProductCount_Res.size(); i++) {
+ System.debug('Pro==>' + ProductCount_Res[i].Consumable_Product__c);
+ System.debug('ProId==>' + ass.Prod.Id);
+ System.debug('ass.boxPiece ==>' + ass.boxPiece);
+ System.debug('boxPiece ==>' + ProductCount_Res[i].Box_Piece__c);
+ if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
+ if (carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)) {
+ continue;
+ } else {
+ //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+ }
+
+ //宸茬粡鍑哄簱鐨勪骇鍝�
+ List<Consumable_order_details2__c> reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c,
+ Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND (Dealer_Shipment__c = TRUE
+ OR Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c IN :carCodeListLose
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ];
+ Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ needreturnMap.put(cod2.Bar_Code__c, cod2);
+ }
+
+ // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c,
+ Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c IN :carCodeListLose
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation))
+ ORDER BY Name
+ ];
+ Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ otherAgProMap.put(cod2.Bar_Code__c, cod2);
+ }
+ carCodeListLose.clear();
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.check == true) {
+ ass.Diff = ass.countid - ass.Pandian;
+ for (integer i = 0; i < ProductCount_Res.size(); i++) {
+ if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
+ if (carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)) {
+ continue;
+ } else {
+ if (needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(ProductCount_Res[i], '璇ヤ骇鍝佹湭杩斿搧')
+ );
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佹湭杩斿搧');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ continue;
+ }
+ if (otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(
+ ProductCount_Res[i],
+ '璇ヤ骇鍝佸綊灞炰簬' +
+ otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c +
+ '鐨勫簱瀛樸��'
+ )
+ );
+ pandiandetailsMap.put(
+ ProductCount_Res[i].Id,
+ '璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��'
+ );
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ continue;
+ }
+ if (ProductCount_Res[i].Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(ProductCount_Res[i], '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��')
+ );
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ ass.Diff--;
+ continue;
+ }
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i], '涓㈠け'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ }
+ }
+ }
+ } else {
+ ass.Pandian = 0;
+ ass.Diff = 0;
+ }
+ }
+ List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>();
+ if (pandiandetailsMap.keySet().size() > 0) {
+ showcod2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ }
+ initStandardController();
+ showcod2nid = cod2s();
+
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
+ }
+
+ iSinventory = true;
+ if (codPageRecords.size() > 0)
+ done = true;
+ consumableorderdetailsRecordserrordummy.clear();
+
+ //pandiandetailsList = new list<Consumable_order_details2__c>();
+ pandiandetailsList = [
+ SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ for (Consumable_order_details2__c codDet : pandiandetailsList) {
+ codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
+ }
+ List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : pandiandetailsList) {
+ pandiandetailsListMid.add(cod2);
+ if (pandiandetailsListMid.size() == 1000) {
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ }
+ }
+ if (pandiandetailsListMid.size() > 0) {
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ }
+
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = codPageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = startIdx + pageSize;
+ if (endIdx > codPageRecords.size()) {
+ endIdx = codPageRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageCodeRecords.add(codPageRecords.get(i));
+ }
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageCodeRecords', pageCodeRecords);
+
+ //end
+ data.put('codPageRecords', JSON.serialize(codPageRecords));
+ data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
+ data.put('consumableorderdetailsRecordsview', JSON.serialize(consumableorderdetailsRecordsview));
+ data.put('pandiandetailsMap', pandiandetailsMap);
+ System.debug('iSinventory===>' + iSinventory);
+ System.debug('codPageRecords===>' + codPageRecords);
+ data.put('iSinventory', JSON.serialize(iSinventory));
+ data.put('reSet1', reSet1);
+ System.debug('reSet1===>' + reSet1);
+ res.code = 200;
+ res.status = 'Success1';
+
+ return res;
+ }
+
+ //CHAN-B7J4NB 鍙湁涓�涓椂锛岀洏鐐逛笉鍒�
+ //init();
+ //CHAN-B7J4NB
+ Map<String, String> showproductIdMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece);
+ }
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
+ /***************************************************************************/
+ // BarCode鐨勬绱� 鎵�鏈夊湪搴�
+ reSet = [
+ SELECT Id, Consumable_Product__c, Consumable_Product__r.Name__c, Box_Piece__c, Bar_Code_search__c, Isoverdue__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code_search__c IN :BarCodeListP
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Date__c = NULL
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ];
+ System.debug('reSet===>' + reSet);
+ Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
+ // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
+ Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
+ // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
+ Map<String, ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String, ConsumableorderdetailsInfo>(); // 鏄庣窗銉愩兗銈炽兗銉� 鍗樹綅
+ //鐩樼偣鍒扮殑鏄庣粏
+ for (Consumable_order_details2__c rs : reSet) {
+ //BarCodeListPandian.add(rs.Bar_Code_search__c);
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece) {
+ ass.check = true;
+ }
+ }
+
+ barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
+ if (rs.Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'));
+ pandiandetailsMap.put(rs.Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
+ pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
+ } else {
+ pandianoverdueCountMap.put(
+ rs.Consumable_Product__c + rs.Box_Piece__c,
+ pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
+ );
+ }
+ continue;
+ }
+ if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
+ pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
+ } else {
+ pandianProdIdCountMap.put(
+ rs.Consumable_Product__c + rs.Box_Piece__c,
+ pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
+ );
+ }
+ }
+
+ // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ List<Consumable_order_details2__c> reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Dealer_Shipment__c,
+ Dealer_Saled__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Dealer_Arrive__c,
+ Bar_Code_search__c,
+ Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE
+ (Dealer_Arrive__c = TRUE
+ OR Dealer_Shipment__c = TRUE
+ OR Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code_search__c IN :BarCodeListP
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation))
+ ORDER BY Name
+ ];
+ Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ otherAgProMap.put(cod2.Bar_Code__c, cod2);
+ }
+ // 闇�瑕佸叆搴撶殑浜у搧
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece) {
+ ass.check = true;
+ }
+ }
+ if (!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)) {
+ reFindProductList.add(cod2);
+ proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
+ }
+ if (
+ !barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
+ otherAgProMap.containsKey(cod2.Bar_Code__c) &&
+ (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true ||
+ otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true)
+ ) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2, '鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��'));
+ pandiandetailsMap.put(cod2.Id, '鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��');
+ }
+ }
+ //瀵诲洖鏄庣粏
+ List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>();
+ productAdjust = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Lose_reason__c,
+ Asset_Model_No__c,
+ Box_Piece__c,
+ Bar_Code_search__c,
+ Isoverdue__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code_search__c IN :BarCodeListP
+ AND Bar_Code__c != NULL
+ AND Lose_Flag__c = TRUE
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+
+ for (Consumable_order_details2__c rs : productAdjust) {
+ // 杩囨湡搴撳瓨閿�瀛� 20200427 gzw add srart
+ if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '杩囨湡搴撳瓨閿�瀛�') {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '杩囨湡鎴栬�呴攢瀛樹骇鍝侊紝鏃犳硶瀵诲洖鍏ュ簱'));
+ pandiandetailsMap.put(rs.Id, '杩囨湡鎴栬�呴攢瀛樹骇鍝侊紝鏃犳硶瀵诲洖鍏ュ簱');
+ carCodeListLose.add(rs.Bar_Code_search__c);
+ continue;
+ }
+ // 杩囨湡搴撳瓨閿�瀛� 20200427 gzw add end
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece) {
+ ass.check = true;
+ }
+ }
+ if (!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)) {
+ reFindProductList.add(rs);
+ proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c);
+ }
+ if (barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)) {
+ continue;
+ } else {
+ barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '瀵诲洖'));
+ pandiandetailsMap.put(rs.Id, '瀵诲洖');
+ consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs));
+ }
+ }
+ if (reFindProductList.size() > 0) {
+ Map<String, Product2__c> midMap = new Map<String, Product2__c>();
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+ List<Product2__c> product_Refind = [
+ SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
+ FROM Product2__c
+ WHERE Id IN :proIdNotinpage.keySet()
+ ];
+ for (Product2__c pro : product_Refind) {
+ midMap.put(pro.Id, pro);
+ }
+ for (Integer i = 0; i < reFindProductList.size(); i++) {
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if (MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '鐩�') {
+ if (newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c)) {
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
+ reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c
+ )
+ .clone();
+ Jstage.countid = 0;
+ if (reFindProductList[i].Isoverdue__c == 1) {
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidBoxMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
+ MidMap.get(reFindProductList[i].Consumable_Product__c)
+ );
+ Jstage.countid = 0;
+ if (reFindProductList[i].Isoverdue__c == 1) {
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidBoxMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
+ }
+ } else if (MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '涓�') {
+ if (newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c)) {
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+ reFindProductList[i].Consumable_product__c + reFindProductList[i].Box_Piece__c
+ )
+ .clone();
+ Jstage.countid = 0;
+ if (reFindProductList[i].Isoverdue__c == 1) {
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidPieceMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
+ MidMap.get(reFindProductList[i].Consumable_Product__c)
+ );
+ Jstage.countid = 0;
+ if (reFindProductList[i].Isoverdue__c == 1) {
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidPieceMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
+ }
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+ bss.check = true;
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ boxRecords.sort();
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ bss.check = true;
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ }
+ for (ConsumableorderdetailsInfo bss : boxRecords) {
+ consumableorderdetailsRecords.add(bss);
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓�')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
+ newMidPieceMap.remove(bss.Prod.Id + '涓�');
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ }
+ }
+
+ //鍏堝彇鍑烘湭鐩樼偣鍒扮殑浜у搧
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.check == true) {
+ for (integer i = 0; i < ProductCount_Res.size(); i++) {
+ if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
+ if (barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null) {
+ continue;
+ } else {
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
+ ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
+ //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ }
+ }
+ }
+ }
+ }
+ //宸茬粡鍑哄簱鐨勪骇鍝�
+ List<Consumable_order_details2__c> reSet2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c,
+ Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND (Dealer_Shipment__c = TRUE
+ OR Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code_search__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ];
+ Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : reSet2) {
+ needreturnMap.put(cod2.Bar_Code__c, cod2);
+ }
+ //// 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ //List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c,
+ // Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
+ // Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
+ // Bar_Code_search__c,Dealer_Info_text__c
+ // FROM Consumable_order_details2__c
+ // WHERE (Dealer_Arrive__c = TRUE
+ // or Dealer_Shipment__c= TRUE
+ // or Dealer_Saled__c = TRUE)
+ // AND Dealer_Returned__c = FALSE
+ // AND Cancellation_Flag__c = FALSE
+ // AND Bar_Code_search__c in :BarCodeListP
+ // AND (Dealer_Info_text__c != :accountName
+ // OR (Dealer_Info_text__c = :accountName
+ // AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ // )
+ // ORDER BY Name ];
+ //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
+ //for(Consumable_order_details2__c cod2 :reSet1){
+ // otherAgProMap.put(cod2.Bar_Code__c,cod2);
+ //}
+ carCodeListLose.clear();
+ //鏈洏鐐瑰埌鐨勪骇鍝�
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.check == true) {
+ for (integer i = 0; i < ProductCount_Res.size(); i++) {
+ if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
+ if (barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)) {
+ continue;
+ }
+ if (ProductCount_Res[i].Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(ProductCount_Res[i], '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��')
+ );
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ if (
+ pandianoverdueCountMap.containsKey(
+ ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c
+ ) == false
+ ) {
+ pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1);
+ } else {
+ pandianoverdueCountMap.put(
+ ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c,
+ pandianoverdueCountMap.get(
+ ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
+ ) + 1
+ );
+ }
+ continue;
+ }
+
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i], '涓㈠け'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ }
+ }
+ // 鍚屾椂瀛樺湪鍏朵粬缁忛攢鍟嗗簱瀛樹骇鍝�
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ if (cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c) {
+ if (
+ barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
+ otherAgProMap.containsKey(cod2.Bar_Code__c) &&
+ otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false &&
+ otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false
+ ) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(
+ cod2,
+ '璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��'
+ )
+ );
+ pandiandetailsMap.put(
+ cod2.Id,
+ '璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��'
+ );
+ continue;
+ }
+ }
+ }
+ // 闇�瑕佽繑鍝佺殑浜у搧
+ for (Consumable_order_details2__c cod2 : reSet2) {
+ if (cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c) {
+ if (needreturnMap.containsKey(cod2.Bar_Code__c)) {
+ consumableorderdetailsRecordserrordummy.add(
+ new ConsumableorderdetailsInfo(cod2, '璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��')
+ );
+ pandiandetailsMap.put(cod2.Id, '璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��');
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ //鏇存柊涓绘槑缁嗗崟
+ if (barCodeListPandianMap.size() > 0) {
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.check == true) {
+ integer countSum = 0;
+ if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ integer overdueSum = 0;
+ if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ ass.Pandian = countSum;
+ ass.Diff = ass.countid - countSum - overdueSum;
+ ass.refind = 0;
+ }
+ }
+ } else {
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.check == true) {
+ integer overdueSum = 0;
+ if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ ass.Diff = ass.countid - ass.Pandian - overdueSum;
+ }
+ }
+ }
+
+ //瀵诲洖鍋氭垚
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ for (ConsumableorderdetailsInfo adjust : consumableorderdetailsRecordsAdjust) {
+ if (ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c) {
+ if (reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)) {
+ continue;
+ } else {
+ ass.Pandian++;
+ ass.refind++;
+ reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c, adjust.orderdetails2.Bar_Code_search__c);
+ }
+ }
+ }
+ }
+ if (pandiandetailsMap.keySet().size() > 0) {
+ List<Consumable_order_details2__c> showcod2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ initStandardController();
+ showcod2nid = cod2s();
+ }
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
+ }
+ if (codPageRecords.size() > 0)
+ done = true;
+ iSinventory = true;
+ consumableorderdetailsRecordserrordummy.clear();
+ pandiandetailsList = [
+ SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ for (Consumable_order_details2__c codDet : pandiandetailsList) {
+ codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
+ }
+ List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ for (Consumable_order_details2__c cod2 : pandiandetailsList) {
+ pandiandetailsListMid.add(cod2);
+ if (pandiandetailsListMid.size() == 1000) {
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ }
+ }
+ if (pandiandetailsListMid.size() > 0) {
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ }
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = codPageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = startIdx + pageSize;
+ if (endIdx > codPageRecords.size()) {
+ endIdx = codPageRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageCodeRecords.add(codPageRecords.get(i));
+ }
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageCodeRecords', pageCodeRecords);
+
+ //end
+
+ System.debug('=====>codPageRecords2' + codPageRecords);
+ System.debug('=====>consumableorderdetailsRecords' + consumableorderdetailsRecords);
+ data.put('codPageRecords', JSON.serialize(codPageRecords));
+ data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
+ System.debug('iSinventory===>' + iSinventory);
+ data.put('iSinventory', JSON.serialize(iSinventory));
+ System.debug('pandiandetailsMap===>' + pandiandetailsMap);
+ data.put('pandiandetailsMap', pandiandetailsMap);
+ data.put('reSet', reSet);
+ data.put('consumableorderdetailsRecordsview', JSON.serialize(consumableorderdetailsRecordsview));
+ System.debug('=====>consumableorderdetailsRecordsview' + consumableorderdetailsRecordsview);
+ res.code = 200;
+ res.status = 'Sucess';
+ return res;
}
- // 宸插瓨鍦ㄦ秷鑰楀搧鏄庣粏鐢�
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- check = false;
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- canSelect = true;
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(
+ Boolean iSinventory,
+ String consumableorderdetailsRecordsLWC,
+ String accountid,
+ String agencyProType,
+ Map<Id, String> pandiandetailsMap,
+ List<Consumable_order_details2__c> reSet
+ ) {
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLWC,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ agencyProType = agencyProType;
+ accountid = accountid;
+ pandiandetailsMap = pandiandetailsMap;
+ reSet = reSet;
+ System.debug('pandiandetailsMap===>' + pandiandetailsMap);
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ if (!iSinventory) {
+ return new ResponseBodyLWC('Error', 500, '璇峰厛褰曞叆BarCode', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
+ // return null;
+ }
+ integer Lo = 0;
+ for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
+ if (header.check == true) {
+ Lo++;
+ }
+ }
+ if (Lo == 0) {
+ iSinventory = false;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏', '');
+ }
+ for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
+ if (header.check == true) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + ' '+header.prod.Name__c));
+ //return null;
+ if ((header.DiffReason == '' || header.DiffReason == null) && header.Diff > 0) {
+ return new ResponseBodyLWC('Error', 500, header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�'));
+ // return null;
+ } else if ((header.DiffReason != '' && header.DiffReason != null) && header.Diff == 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, header.prod.Name__c + '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�', '');
+ }
+ }
+ }
+ Integer orderDetNo = 1;
+ Savepoint sp = Database.setSavepoint();
+ Consumable_order__c Po = new Consumable_order__c();
+ Po.Name = '*';
+ Po.Order_status__c = '鎵瑰噯';
+ Po.Inventory_date__c = Date.today();
+ Po.Order_type__c = '鐩樼偣';
+ Po.Dealer_Info__c = accountid;
+ Po.Order_ProType__c = agencyProType;
+ Po.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ try {
+ insert Po;
+ eSetId = Po.id;
+ List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id = :Po.id];
+ List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
+ List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> updListAdjust = new List<Consumable_order_details2__c>();
+ Map<String, String> ErrorName = new Map<String, String>();
+ Map<String, Boolean> CheckTF = new Map<String, Boolean>();
+ for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
+ if (header.check == true) {
+ Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
+ insPan = new Consumable_orderdetails__c();
+ String str = string.valueOf(orderDetNo);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ insPan.Name = Consumable_order[0].Name + '-' + str;
+ insPan.Consumable_Product__c = header.ProdId;
+ ErrorName.put(insPan.Consumable_Product__c, header.DiffReason);
+ CheckTF.put(insPan.Consumable_product__c, true);
+ insPan.Consumable_order__c = Po.Id;
+ insPan.Lose_reason__c = header.DiffReason;
+ insPan.Diff__c = header.Diff;
+ insPan.Product_Refind__c = header.refind;
+ insPan.inventory_sum__c = header.Pandian;
+ insPan.Count_Sum__c = header.countid;
+ insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ orderDetNo++;
+ InsList.add(insPan);
+ }
+ }
+ if (InsList.size() > 0) {
+ insert InsList;
+ }
+ List<Consumable_order_details2__c> showcod2 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id IN :pandiandetailsMap.keySet()
+ ORDER BY Name
+ ];
+ for (Consumable_order_details2__c cod : showcod2) {
+ Consumable_order_details2__c InsDetail = new Consumable_order_details2__c();
+ InsDetail.Id = cod.Id;
+ InsDetail.Consumable_Inventory_order__c = po.Id;
+ InsDetail.Inventory_date__c = Date.today();
+ // 20210224 gzw CHAN-BXF3PG start
+ // if(pandiandetailsMap.get(cod.Id) == '涓㈠け' ){
+ if (pandiandetailsMap.get(cod.Id) == '涓㈠け' && CheckTF.containsKey(cod.Consumable_product__c)) {
+ // 20210224 gzw CHAN-BXF3PG end
+ InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c);
+ InsDetail.Lose_Flag__c = true;
+ } else if (pandiandetailsMap.get(cod.Id) == '瀵诲洖') {
+ InsDetail.Lose_reason__c = '';
+ InsDetail.Lose_Flag__c = false;
+ } else {
+ continue;
+ }
+ InsListUp.add(InsDetail);
+ }
+ for (Consumable_order_details2__c rs : reSet) {
+ rs.Inventory_date__c = Date.today();
+ }
+ if (reSet.size() > 0) {
+ update reSet;
+ }
+ if (InsListUp.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(InsListUp); // Commented By DTT - Li Jun for testing 20230407
+ }
+ } catch (Exception e) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
+ // return null;
+ }
+ // FIXME impliment BarCodeListAdjust
+ /************************************************************************************************/
+ // return ProS();
+ data.put('eSetId', eSetId);
+ data.put('InsListUp', InsListUp);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- public ConsumableorderdetailsInfo(Product2__c e) {
- check = false;
- //orderdetails1 = new Consumable_orderdetails__c();
- Prod = e;
- canSelect = true;
- ProdId = string.valueOf(e.id);
- countid = 0;
- Pandian = 0;
- refind = 0;
- Diff = 0;
- limitCount = 0;
- overlimitCount = 0;
+
+ //鐩樼偣涓�瑙�
+ public PageReference ProS() {
+ // 杩斿洖鐩樼偣涓�瑙�
+ PageReference ref = new Pagereference('/apex/InventoryList?eSetId=' + eSetId);
+ ref.setRedirect(true);
+ return ref;
}
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
- Integer returnValue = 0;
- if (countid > compareToesd.countid) {
- returnValue = -1;
- } else if (countid < compareToesd.countid) {
- returnValue = 1;
- }
- return returnValue;
+ //CSV鍑哄姏
+ public PageReference doClick() {
+ Pagereference pr = page.InventoryCSV;
+ return pr;
}
- }
-}
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ // Data Bean
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal countid { get; set; }
+ @AuraEnabled
+ public String ProdId { get; set; }
+ @AuraEnabled
+ public Decimal Pandian { get; set; }
+ @AuraEnabled
+ public Decimal Diff { get; set; }
+ @AuraEnabled
+ public Decimal refind { get; set; }
+ @AuraEnabled
+ public String DiffReason { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Decimal limitCount { get; set; }
+ @AuraEnabled
+ public Decimal overlimitCount { get; set; }
+ @AuraEnabled
+ public String boxPiece { get; set; }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ //e.Lose_reason__c = str;
+ DiffReason = str;
+ }
+
+ // 宸插瓨鍦ㄦ秷鑰楀搧鏄庣粏鐢�
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ check = false;
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ canSelect = true;
+ }
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ //orderdetails1 = new Consumable_orderdetails__c();
+ Prod = e;
+ canSelect = true;
+ ProdId = string.valueOf(e.id);
+ countid = 0;
+ Pandian = 0;
+ refind = 0;
+ Diff = 0;
+ limitCount = 0;
+ overlimitCount = 0;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (countid > compareToesd.countid) {
+ returnValue = -1;
+ } else if (countid < compareToesd.countid) {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryControllerTest.cls b/force-app/main/default/classes/LexInventoryControllerTest.cls
index 2f497df..25646d5 100644
--- a/force-app/main/default/classes/LexInventoryControllerTest.cls
+++ b/force-app/main/default/classes/LexInventoryControllerTest.cls
@@ -1,1179 +1,730 @@
@isTest
public class LexInventoryControllerTest {
- static testMethod void InventoryControllerTest_PartBar() {
- user myUser_test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeOrderDetail2Trigger = true;
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
+ static testMethod void InventoryControllerTest_PartBar(){
+ user myUser_test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeOrderDetail2Trigger = true;
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '涓婃捣'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '涓婃捣');
+ insert MyUser_Test;
- insert new List<Product2>{ prod07, prod08, prod09 };
+ }
+ system.runAs(MyUser_Test){
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+
+ insert new Product2[] {prod07,prod08,prod09};
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+
+ //棰勫埗澶存槑缁�
+ Consumable_order__c CreateId = new Consumable_order__c();
+ CreateId.Name = 'testMing';
+ CreateId.Order_status__c = '鑽夋涓�';
+ CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
+ CreateId.Dealer_Info__c = myAccount1.id;
+ CreateId.Inventory_date__c = Date.today();
+ CreateId.Order_type__c = '鐩樼偣';
+ CreateId.Order_ProType__c = 'ET';
+ insert CreateId;
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+
+
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
+ dataForProductCount9.Bar_Code__c = '1234567890';
+ dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount9.Arrive_date__c = Date.today();
+ dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount9.Consumable_Product__c = proG.id;
+ dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount9.Box_Piece__c = '鐩�';
+ dataForProductCount9.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount9.Send_Date__c = null;
+ dataForProductCount9.Used_date__c = null;
+ dataForProductCount9.Lose_Flag__c = false;
+ conList.add(dataForProductCount9);
- //棰勫埗澶存槑缁�
- Consumable_order__c CreateId = new Consumable_order__c();
- CreateId.Name = 'testMing';
- CreateId.Order_status__c = '鑽夋涓�';
- CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
- CreateId.Dealer_Info__c = myAccount1.id;
- CreateId.Inventory_date__c = Date.today();
- CreateId.Order_type__c = '鐩樼偣';
- CreateId.Order_ProType__c = 'ET';
- insert CreateId;
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '1234567892';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '鐩�';
+ dataForProductCount7.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount7.Send_Date__c = null;
+ dataForProductCount7.Used_date__c = null;
+ dataForProductCount7.Lose_Flag__c = false;
+ conList.add(dataForProductCount7);
+
+ Consumable_order_details2__c dataForProductCount = new Consumable_order_details2__c();
+ dataForProductCount.Bar_Code__c = '1234567882';
+ dataForProductCount.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount.Arrive_date__c = Date.today();
+ dataForProductCount.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount.Consumable_Product__c = proG.id;
+ dataForProductCount.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount.Box_Piece__c = '鐩�';
+ dataForProductCount.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount.Send_Date__c = null;
+ dataForProductCount.Used_date__c = null;
+ dataForProductCount.Lose_Flag__c = true;
+ conList.add(dataForProductCount);
+
+ Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
+ dataForProductCount4.Bar_Code__c = '1234567884';
+ dataForProductCount4.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount4.Arrive_date__c = Date.today();
+ dataForProductCount4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount4.Consumable_Product__c = proF.id;
+ dataForProductCount4.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProductCount4.Box_Piece__c = '涓�';
+ dataForProductCount4.Consumable_order_minor__c = CreateId.id;
+ //dataForProductCount4.Lose_Flag__c = true;
+ dataForProductCount4.RemoveBox_No__c = 1;
- //鍒朵綔Consumable_order_details__c-------ProductCount
- Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
- dataForProductCount9.Bar_Code__c = '1234567890';
- dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount9.Arrive_date__c = Date.today();
- dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount9.Consumable_Product__c = proG.id;
- dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount9.Box_Piece__c = '鐩�';
- dataForProductCount9.Consumable_order_minor__c = CreateId.id;
- dataForProductCount9.Send_Date__c = null;
- dataForProductCount9.Used_date__c = null;
- dataForProductCount9.Lose_Flag__c = false;
- conList.add(dataForProductCount9);
+ conList.add(dataForProductCount4);
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '1234567892';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '鐩�';
- dataForProductCount7.Consumable_order_minor__c = CreateId.id;
- dataForProductCount7.Send_Date__c = null;
- dataForProductCount7.Used_date__c = null;
- dataForProductCount7.Lose_Flag__c = false;
- conList.add(dataForProductCount7);
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1234567885';
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount5.Consumable_Product__c = proH.id;
+ dataForProductCount5.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount5.Box_Piece__c = '涓�';
+ dataForProductCount5.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount5.Lose_Flag__c = true;
+ dataForProductCount5.RemoveBox_No__c = 1;
+ conList.add(dataForProductCount5);
+ insert conList;
+
+ List<Consumable_order_details2__c> productCount_Res = [select Id,Name
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Lose_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Dealer_Info_text__c = :myAccount1.Name];
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- Consumable_order_details2__c dataForProductCount = new Consumable_order_details2__c();
- dataForProductCount.Bar_Code__c = '1234567882';
- dataForProductCount.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount.Arrive_date__c = Date.today();
- dataForProductCount.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount.Consumable_Product__c = proG.id;
- dataForProductCount.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount.Box_Piece__c = '鐩�';
- dataForProductCount.Consumable_order_minor__c = CreateId.id;
- dataForProductCount.Send_Date__c = null;
- dataForProductCount.Used_date__c = null;
- dataForProductCount.Lose_Flag__c = true;
- conList.add(dataForProductCount);
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Arrive_date__c = Date.today();
+ con.Send_Date__c = null;
+ con.Used_date__c = null;
+ con.Return_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Cancellation_Flag__c = false;
+ con.Consumable_Product__c = proG.Id;
+ con.Asset_Model_No__c = 'Mj-1001';
+ con.Sterilization_limit__c = Date.today().addDays(2);
+ con.Box_Piece__c = '鐩�';
+ con.Consumable_order_minor__c = CreateId.id;
+ con.Bar_Code__c = '1234567885';
+ conList1.add(con);
- Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
- dataForProductCount4.Bar_Code__c = '1234567884';
- dataForProductCount4.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount4.Arrive_date__c = Date.today();
- dataForProductCount4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount4.Consumable_Product__c = proF.id;
- dataForProductCount4.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProductCount4.Box_Piece__c = '涓�';
- dataForProductCount4.Consumable_order_minor__c = CreateId.id;
- //dataForProductCount4.Lose_Flag__c = true;
- dataForProductCount4.RemoveBox_No__c = 1;
+ Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ con1.Arrive_date__c = Date.today();
+ con1.Send_Date__c = null;
+ con1.Used_date__c = null;
+ con1.Return_date__c = null;
+ con1.Lose_Flag__c = false;
+ con1.Cancellation_Flag__c = false;
+ con1.Consumable_Product__c = proG.Id;
+ con1.Asset_Model_No__c = 'Mj-1001';
+ con1.Sterilization_limit__c = Date.today().addDays(2);
+ con1.Box_Piece__c = '涓�';
+ con1.Consumable_order_minor__c = CreateId.id;
+ con1.Bar_Code__c = '12345678856';
+ conList1.add(con1);
+ insert conList1;
+
+ LexInventoryController OwnTest = new LexInventoryController();
+ LexInventoryController.init();
+ LexInventoryController controller = new LexInventoryController();
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
+ System.debug('testCount:'+testList.size());
+ for(LexInventoryController.ConsumableorderdetailsInfo ass : testList){
+ System.debug(ass.check);
+ ass.check = true;
+ testList1.add(ass);
+ }
+ System.debug('testList1:'+testList1);
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',JSON.serialize(testList1),1,0,'Test','ASC');
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','1234567882',JSON.serialize(testList1),1,0,'Test','ASC');
+ LexInventoryController.barcode = '';
+
+ }
+ }
+ static testMethod void InventoryControllerTest_PartPan(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ insert new Product2[] {prod07,prod08,prod09};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='Too001',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='Too002',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='Too003',OT_CODE_Text__c='Test001',Product2__c = prod09.Id);
+ insert proF;
+
+
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
+
+ insert myAccount1;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+
+ InventoryController OwnTest = new InventoryController();
+ OwnTest.size = 2;
+ OwnTest.init();
+ OwnTest.setCon.next();
+ OwnTest.refreshPageSize();
+ OwnTest.ConsumableorderdetailsRecordsview.sort();
+ system.assertEquals(0,OwnTest.consumableorderdetailsCount);
+ OwnTest.save();
+ }
+ }
+ static testMethod void InventoryControllerTest_ge(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+
+
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
- conList.add(dataForProductCount4);
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+
+ //棰勫埗澶存槑缁�
+ Consumable_order__c CreateId = new Consumable_order__c();
+ CreateId.Name = 'testMing';
+ CreateId.Order_status__c = '鑽夋涓�';
+ CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
+ CreateId.Dealer_Info__c = myAccount1.id;
+ CreateId.Inventory_date__c = Date.today();
+ CreateId.Order_type__c = '鐩樼偣';
+ CreateId.Order_ProType__c = 'ET';
+ insert CreateId;
+ List<Consumable_order_details2__c> orderList = new List<Consumable_order_details2__c>();
+
+
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
+ dataForProductCount9.Bar_Code__c = '1234567890';
+ dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount9.Arrive_date__c = Date.today();
+ dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount9.Consumable_Product__c = proG.id;
+ dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount9.Box_Piece__c = '涓�';
+ dataForProductCount9.RemoveBox_No__c = 1;
+ orderList.add(dataForProductCount9);
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1234567885';
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount5.Consumable_Product__c = proH.id;
- dataForProductCount5.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount5.Box_Piece__c = '涓�';
- dataForProductCount5.Consumable_order_minor__c = CreateId.id;
- dataForProductCount5.Lose_Flag__c = true;
- dataForProductCount5.RemoveBox_No__c = 1;
- conList.add(dataForProductCount5);
- insert conList;
+ Consumable_order_details2__c dataForProductCount8 = new Consumable_order_details2__c();
+ dataForProductCount8.Bar_Code__c = '1234567891';
+ dataForProductCount8.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount8.Arrive_date__c = Date.today();
+ dataForProductCount8.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount8.Consumable_Product__c = proG.id;
+ dataForProductCount8.Asset_Model_No__c = proG.Asset_Model_No__c;
+ orderList.add(dataForProductCount8);
- List<Consumable_order_details2__c> productCount_Res = [
- SELECT Id, Name
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :myAccount1.Name
- ];
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '1234567892';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '涓�';
+ dataForProductCount7.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount7.Send_Date__c = null;
+ dataForProductCount7.Used_date__c = null;
+ dataForProductCount7.Lose_Flag__c = false;
+ dataForProductCount7.RemoveBox_No__c = 1;
+ orderList.add(dataForProductCount7);
+
+ Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
+ dataForProduct.Bar_Code__c = '1234567894';
+ dataForProduct.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProduct.Arrive_date__c = Date.today();
+ dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProduct.Consumable_Product__c = proF.id;
+ dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProduct.Box_Piece__c = '涓�';
+ dataForProduct.Consumable_order_minor__c = CreateId.id;
+ dataForProduct.Send_Date__c = null;
+ dataForProduct.Used_date__c = null;
+ dataForProduct.Lose_Flag__c = false;
+ dataForProduct.RemoveBox_No__c = 1;
+ orderList.add(dataForProduct);
+
+ Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
+ dataForProductCount3.Bar_Code__c = '1234567883';
+ dataForProductCount3.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount3.Arrive_date__c = Date.today();
+ dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount3.Consumable_Product__c = proG.id;
+ dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount3.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount3.Lose_Flag__c = true;
+ //dataForProductCount3.RemoveBox_No__c = 1;
+ orderList.add(dataForProductCount3);
+
+
+ PageReference page = new Pagereference('/Inventory');
+ page.setRedirect(true);
+ System.Test.setCurrentPage(page);
+ System.Test.startTest();
+ LexInventoryController controller = new LexInventoryController();
+ LexInventoryController.init();
+ System.debug('===>鍊�1'+LexInventoryController.consumableorderdetailsRecords);
+ System.debug('===>鍊�2'+ JSON.serialize(LexInventoryController.consumableorderdetailsRecords));
+ System.debug('===>2222222'+JSON.serialize(LexInventoryController.consumableorderdetailsRecords));
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
+ System.debug('testCount:'+testList.size());
+ for(LexInventoryController.ConsumableorderdetailsInfo ass : testList){
+ System.debug(ass.check);
+ ass.check = true;
+ testList1.add(ass);
+ }
+ System.debug('testList1:'+testList1);
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Arrive_date__c = Date.today();
- con.Send_Date__c = null;
- con.Used_date__c = null;
- con.Return_date__c = null;
- con.Lose_Flag__c = false;
- con.Cancellation_Flag__c = false;
- con.Consumable_Product__c = proG.Id;
- con.Asset_Model_No__c = 'Mj-1001';
- con.Sterilization_limit__c = Date.today().addDays(2);
- con.Box_Piece__c = '鐩�';
- con.Consumable_order_minor__c = CreateId.id;
- con.Bar_Code__c = '1234567885';
- conList1.add(con);
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',JSON.serialize(testList1),1,0,'Test','ASC');
+ System.Test.stopTest();
+ }
+ }
+ static testMethod void InventoryControllerTest_xunhui(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeOrderDetail2Trigger = true;
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
- Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- con1.Arrive_date__c = Date.today();
- con1.Send_Date__c = null;
- con1.Used_date__c = null;
- con1.Return_date__c = null;
- con1.Lose_Flag__c = false;
- con1.Cancellation_Flag__c = false;
- con1.Consumable_Product__c = proG.Id;
- con1.Asset_Model_No__c = 'Mj-1001';
- con1.Sterilization_limit__c = Date.today().addDays(2);
- con1.Box_Piece__c = '涓�';
- con1.Consumable_order_minor__c = CreateId.id;
- con1.Bar_Code__c = '12345678856';
- conList1.add(con1);
- insert conList1;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+
+ //棰勫埗澶存槑缁�
+ Consumable_order__c CreateId = new Consumable_order__c();
+ CreateId.Name = 'testMing';
+ CreateId.Order_status__c = '鑽夋涓�';
+ CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
+ CreateId.Dealer_Info__c = myAccount1.id;
+ CreateId.Inventory_date__c = Date.today();
+ CreateId.Order_type__c = '鐩樼偣';
+ CreateId.Order_ProType__c = 'ET';
+ insert CreateId;
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍒拌揣
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ENG';
+ orderList.add(Order1);
+ //鍙戣揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟 ';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = '01210000000c9drAAA';
+ Order2.Order_ProType__c = 'ENG';
+ orderList.add(Order2);
+ insert orderList;
- LexInventoryController OwnTest = new LexInventoryController();
- LexInventoryController.init();
- LexInventoryController controller = new LexInventoryController();
- List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
- List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
- System.debug('testCount:' + testList.size());
- for (LexInventoryController.ConsumableorderdetailsInfo ass : testList) {
- System.debug(ass.check);
- ass.check = true;
- testList1.add(ass);
- }
- System.debug('testList1:' + testList1);
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',
- JSON.serialize(testList1),
- 1,
- 0,
- 'Test',
- 'ASC'
- );
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '1234567882',
- JSON.serialize(testList1),
- 1,
- 0,
- 'Test',
- 'ASC'
- );
- LexInventoryController.barcode = '';
- }
- }
- static testMethod void InventoryControllerTest_PartPan() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
+
+
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
+ dataForProductCount9.Bar_Code__c = '1234567890';
+ dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount9.Arrive_date__c = Date.today();
+ dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount9.Consumable_Product__c = proG.id;
+ dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount9.Box_Piece__c = '鐩�';
+ dataForProductCount9.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount9.Send_Date__c = null;
+ dataForProductCount9.Used_date__c = null;
+ dataForProductCount9.Lose_Flag__c = false;
+ dataForProductCount9.RemoveBox_No__c = 1;
+ insert dataForProductCount9;
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ Consumable_order_details2__c dataForProductCount8 = new Consumable_order_details2__c();
+ dataForProductCount8.Bar_Code__c = '1234567891';
+ dataForProductCount8.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount8.Arrive_date__c = Date.today();
+ dataForProductCount8.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount8.Consumable_Product__c = proG.id;
+ dataForProductCount8.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount8.Box_Piece__c = '鐩�';
+ dataForProductCount8.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount8.Send_Date__c = null;
+ dataForProductCount8.Used_date__c = null;
+ dataForProductCount8.Lose_Flag__c = false;
+ dataForProductCount8.RemoveBox_No__c = 1;
+ insert dataForProductCount8;
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'Too001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'Too002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'Too003',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod09.Id
- );
- insert proF;
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '1234567892';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '涓�';
+ dataForProductCount7.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount7.Send_Date__c = null;
+ dataForProductCount7.Used_date__c = null;
+ dataForProductCount7.Lose_Flag__c = false;
+ dataForProductCount7.RemoveBox_No__c = 1;
+ insert dataForProductCount7;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id
- );
+ Consumable_order_details2__c dataForProductCount6 = new Consumable_order_details2__c();
+ dataForProductCount6.Bar_Code__c = '1234567893';
+ dataForProductCount6.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount6.Arrive_date__c = Date.today();
+ dataForProductCount6.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount6.Consumable_Product__c = proH.id;
+ dataForProductCount6.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount6.Box_Piece__c = '涓�';
+ dataForProductCount6.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount6.Send_Date__c = null;
+ dataForProductCount6.Used_date__c = null;
+ dataForProductCount6.Lose_Flag__c = false;
+ dataForProductCount6.RemoveBox_No__c = 1;
+ insert dataForProductCount6;
- insert myAccount1;
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1234567894';
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount5.Consumable_Product__c = proH.id;
+ dataForProductCount5.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount5.Box_Piece__c = '涓�';
+ dataForProductCount5.Consumable_order_minor__c = CreateId.id;
+ dataForProductCount5.Send_Date__c = null;
+ dataForProductCount5.Used_date__c = null;
+ dataForProductCount5.Lose_Flag__c = false;
+ dataForProductCount5.RemoveBox_No__c = 1;
+ insert dataForProductCount5;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- InventoryController OwnTest = new InventoryController();
- OwnTest.size = 2;
- OwnTest.init();
- OwnTest.setCon.next();
- OwnTest.refreshPageSize();
- OwnTest.ConsumableorderdetailsRecordsview.sort();
- system.assertEquals(0, OwnTest.consumableorderdetailsCount);
- OwnTest.save();
- }
- }
- static testMethod void InventoryControllerTest_ge() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ List<Consumable_order_details2__c> conlist = new List<Consumable_order_details2__c>();
+ //Barcode妫�绱� 鎵�鏈夊湪搴�
+ Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ con1.Lose_Flag__c = false;
+ con1.Arrive_date__c = Date.today();
+ con1.Send_Date__c = null;
+ con1.Return_date__c = null;
+ con1.Lose_Flag__c = false;
+ con1.Cancellation_Date__c = null;
+ con1.Sterilization_limit__c = Date.today().addDays(2);
+ con1.Bar_Code__c = '123';
+ con1.Box_Piece__c = '鐩�';
+ con1.Bar_Code__c = '1234567894';
+ con1.Sterilization_limit__c = Date.today().addDays(2);
+ con1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ con1.Consumable_Product__c = proH.id;
+ con1.Consumable_order_minor__c = CreateId.id;
+ conlist.add(con1);
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Consumable_Product__c = proH.id;
+ con3.Bar_Code__c = '1001';
+ con3.Consumable_Arrived_order__c = Order1.id;
+ con3.Consumable_order_minor__c = Order2.id;
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Cancellation_Flag__c = false;
+ con3.Consumable_order_minor__c = CreateId.id;
+ con3.Sterilization_limit__c = Date.today().addDays(2);
+ con3.Box_Piece__c = '涓�';
+ con3.RecordTypeid = '01210000000kUDKAA2';
+ conlist.add(con3);
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ //productAdjust
+ Consumable_order_details2__c con6 = new Consumable_order_details2__c();
+ con6.Consumable_Product__c = proH.id;
+ con6.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ con6.Box_Piece__c = '鐩�';
+ con6.Sterilization_limit__c = Date.today().addDays(-2);
+ con6.Bar_Code__c = '10011';
+ con6.Consumable_Arrived_order__c = Order1.id;
+ con6.Lose_Flag__c = true;
+ con6.RecordTypeid = '01210000000kUDKAA2';
+ conlist.add(con6);
+ System.debug('conlist===>'+conlist);
- //棰勫埗澶存槑缁�
- Consumable_order__c CreateId = new Consumable_order__c();
- CreateId.Name = 'testMing';
- CreateId.Order_status__c = '鑽夋涓�';
- CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
- CreateId.Dealer_Info__c = myAccount1.id;
- CreateId.Inventory_date__c = Date.today();
- CreateId.Order_type__c = '鐩樼偣';
- CreateId.Order_ProType__c = 'ET';
- insert CreateId;
- List<Consumable_order_details2__c> orderList = new List<Consumable_order_details2__c>();
- //鍒朵綔Consumable_order_details__c-------ProductCount
- Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
- dataForProductCount9.Bar_Code__c = '1234567890';
- dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount9.Arrive_date__c = Date.today();
- dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount9.Consumable_Product__c = proG.id;
- dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount9.Box_Piece__c = '涓�';
- dataForProductCount9.RemoveBox_No__c = 1;
- orderList.add(dataForProductCount9);
+ //reset592
+ Consumable_order_details2__c con4 = new Consumable_order_details2__c();
+ con4.Arrive_date__c = Date.today();
+ con4.Send_Date__c = null;
+ con4.Return_date__c = null;
+ con4.Lose_Flag__c = false;
+ con4.Cancellation_Date__c =null;
+ con4.Sterilization_limit__c = Date.today().addDays(2);
+ con4.Bar_Code__c = '123456';
+ con4.Box_Piece__c = '鐩�';
+ // con2.Bar_Code__c = '1234567894';
+ con4.Sterilization_limit__c = Date.today().addDays(2);
+ con4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ con4.Consumable_Product__c = proH.id;
+ // con2.Asset_Model_No__c = proH.Asset_Model_No__c;
+ con4.Consumable_order_minor__c = CreateId.id;
+ conlist.add(con4);
- Consumable_order_details2__c dataForProductCount8 = new Consumable_order_details2__c();
- dataForProductCount8.Bar_Code__c = '1234567891';
- dataForProductCount8.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount8.Arrive_date__c = Date.today();
- dataForProductCount8.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount8.Consumable_Product__c = proG.id;
- dataForProductCount8.Asset_Model_No__c = proG.Asset_Model_No__c;
- orderList.add(dataForProductCount8);
+
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ Consumable_order_details2__c con5 = new Consumable_order_details2__c();
+ con5.Arrive_date__c = Date.today();
+ con5.Send_Date__c = null;
+ con5.Return_date__c = null;
+ con5.Lose_Flag__c = false;
+ con5.Cancellation_Flag__c = false;
+ con5.Consumable_Product__c = proH.id;
+ con5.Consumable_order_minor__c = Order2.id;
+ // con5.Sterilization_limit__c = Date.today().addDays(2);
+ con5.Box_Piece__c = '鐩�';
+ con5.Bar_Code__c = '1001';
+ conlist.add(con5);
+ insert conlist;
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '1234567892';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '涓�';
- dataForProductCount7.Consumable_order_minor__c = CreateId.id;
- dataForProductCount7.Send_Date__c = null;
- dataForProductCount7.Used_date__c = null;
- dataForProductCount7.Lose_Flag__c = false;
- dataForProductCount7.RemoveBox_No__c = 1;
- orderList.add(dataForProductCount7);
+ System.Test.startTest();
+ LexInventoryController inver = new LexInventoryController();
+ LexInventoryController.init();
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
+ System.debug('testCount:'+testList.size());
+ for(LexInventoryController.ConsumableorderdetailsInfo ass : testList){
+ System.debug(ass.check);
+ ass.check = true;
+ testList1.add(ass);
+ }
+ System.debug('testList1:'+testList1);
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','',JSON.serialize(testList1),20,9,'Test','ASC');
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','01210000000kUDKAA2\n10011',JSON.serialize(testList1),20,9,'Test','ASC');
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894\n1001',JSON.serialize(testList1),1,0,'Test','ASC');
+ LexInventoryController.save(true,JSON.serialize(testList1),myAccount1.Id,'ET',LexInventoryController.pandiandetailsMap,LexInventoryController.reSet);
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','','[{"sortBy": null,"refind": 0,"ProdId": "a0l0l000004EisKAAS","Prod": {"attributes": {"type": "Product2__c","url": "/services/data/v58.0/sobjects/Product2__c/a0l0l000004EisKAAS"},"Id": "a0l0l000004EisKAAS","Name": "MH-155:鐧藉钩琛″附","Name__c": "Test07","SFDA_Status__c": "鍋滄","Packing_list_manual__c": 1,"Asset_Model_No__c": "Test07"},"Pandian": 0,"overlimitCount": 0,"orderdetails2": null,"orderdetails1": null,"limitCount": 2,"DiffReason": null,"Diff": 0,"countid": 2,"check": true,"canSelect": true,"boxPiece": "鐩�"}]',20,9,'Test','ASC');
- Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
- dataForProduct.Bar_Code__c = '1234567894';
- dataForProduct.Sterilization_limit__c = Date.today().addDays(2);
- dataForProduct.Arrive_date__c = Date.today();
- dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProduct.Consumable_Product__c = proF.id;
- dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProduct.Box_Piece__c = '涓�';
- dataForProduct.Consumable_order_minor__c = CreateId.id;
- dataForProduct.Send_Date__c = null;
- dataForProduct.Used_date__c = null;
- dataForProduct.Lose_Flag__c = false;
- dataForProduct.RemoveBox_No__c = 1;
- orderList.add(dataForProduct);
- Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
- dataForProductCount3.Bar_Code__c = '1234567883';
- dataForProductCount3.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount3.Arrive_date__c = Date.today();
- dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount3.Consumable_Product__c = proG.id;
- dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount3.Consumable_order_minor__c = CreateId.id;
- dataForProductCount3.Lose_Flag__c = true;
- //dataForProductCount3.RemoveBox_No__c = 1;
- orderList.add(dataForProductCount3);
- PageReference page = new Pagereference('/Inventory');
- page.setRedirect(true);
- System.Test.setCurrentPage(page);
- System.Test.startTest();
- LexInventoryController controller = new LexInventoryController();
- LexInventoryController.init();
- System.debug(
- '===>鍊�1' + LexInventoryController.consumableorderdetailsRecords
- );
- System.debug(
- '===>鍊�2' +
- JSON.serialize(LexInventoryController.consumableorderdetailsRecords)
- );
- System.debug(
- '===>2222222' +
- JSON.serialize(LexInventoryController.consumableorderdetailsRecords)
- );
- List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
- List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
- System.debug('testCount:' + testList.size());
- for (LexInventoryController.ConsumableorderdetailsInfo ass : testList) {
- System.debug(ass.check);
- ass.check = true;
- testList1.add(ass);
- }
- System.debug('testList1:' + testList1);
+ System.Test.stopTest();
+ }
+ }
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',
- JSON.serialize(testList1),
- 1,
- 0,
- 'Test',
- 'ASC'
- );
- System.Test.stopTest();
- }
- }
- static testMethod void InventoryControllerTest_xunhui() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeOrderDetail2Trigger = true;
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ static testMethod void all(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeOrderDetail2Trigger = true;
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '涓婃捣');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍒拌揣
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ET';
+ orderList.add(Order1);
+ //鍙戣揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟 ';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = '01210000000c9drAAA';
+ Order2.Order_ProType__c = 'ET';
+ orderList.add(Order2);
+ insert orderList;
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ List<Consumable_order_details2__c> conlist = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c = null;
+ con3.Used_date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Cancellation_Flag__c = false;
+ con3.Consumable_order_minor__c = Order1.id;
+ con3.Consumable_Arrived_order__c = Order1.id;
+ con3.Bar_Code__c = '1001';
+ con3.Consumable_Product__c = proH.id;
+ conlist.add(con3);
+ insert conlist;
- //棰勫埗澶存槑缁�
- Consumable_order__c CreateId = new Consumable_order__c();
- CreateId.Name = 'testMing';
- CreateId.Order_status__c = '鑽夋涓�';
- CreateId.RecordTypeid = System.Label.RT_ConOrder_Order;
- CreateId.Dealer_Info__c = myAccount1.id;
- CreateId.Inventory_date__c = Date.today();
- CreateId.Order_type__c = '鐩樼偣';
- CreateId.Order_ProType__c = 'ET';
- insert CreateId;
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍒拌揣
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ENG';
- orderList.add(Order1);
- //鍙戣揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟 ';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = '01210000000c9drAAA';
- Order2.Order_ProType__c = 'ENG';
- orderList.add(Order2);
- insert orderList;
+ //productAdjust
+ Consumable_order_details2__c con6 = new Consumable_order_details2__c();
+ // con6.Consumable_Product__c = proH.id;
+ con6.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ // con6.Box_Piece__c = '鐩�';
+ con6.Sterilization_limit__c = Date.today().addDays(-2);
+ con6.Bar_Code__c = '10011';
+ // con6.Consumable_Arrived_order__c = Order1.id;
+ con6.Lose_Flag__c = true;
+ // con6.RecordTypeid = '01210000000kUDKAA2';
+ conlist.add(con6);
+ System.debug('conlist===>'+conlist);
+ LexInventoryController.init();
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
+ List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
+ System.debug('testCount:'+testList.size());
+ for(LexInventoryController.ConsumableorderdetailsInfo ass : testList){
+ System.debug(ass.check);
+ ass.check = true;
+ testList1.add(ass);
+ }
+ System.debug('testList1:'+testList1);
- //鍒朵綔Consumable_order_details__c-------ProductCount
- Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c();
- dataForProductCount9.Bar_Code__c = '1234567890';
- dataForProductCount9.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount9.Arrive_date__c = Date.today();
- dataForProductCount9.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount9.Consumable_Product__c = proG.id;
- dataForProductCount9.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount9.Box_Piece__c = '鐩�';
- dataForProductCount9.Consumable_order_minor__c = CreateId.id;
- dataForProductCount9.Send_Date__c = null;
- dataForProductCount9.Used_date__c = null;
- dataForProductCount9.Lose_Flag__c = false;
- dataForProductCount9.RemoveBox_No__c = 1;
- insert dataForProductCount9;
-
- Consumable_order_details2__c dataForProductCount8 = new Consumable_order_details2__c();
- dataForProductCount8.Bar_Code__c = '1234567891';
- dataForProductCount8.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount8.Arrive_date__c = Date.today();
- dataForProductCount8.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount8.Consumable_Product__c = proG.id;
- dataForProductCount8.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount8.Box_Piece__c = '鐩�';
- dataForProductCount8.Consumable_order_minor__c = CreateId.id;
- dataForProductCount8.Send_Date__c = null;
- dataForProductCount8.Used_date__c = null;
- dataForProductCount8.Lose_Flag__c = false;
- dataForProductCount8.RemoveBox_No__c = 1;
- insert dataForProductCount8;
-
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '1234567892';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '涓�';
- dataForProductCount7.Consumable_order_minor__c = CreateId.id;
- dataForProductCount7.Send_Date__c = null;
- dataForProductCount7.Used_date__c = null;
- dataForProductCount7.Lose_Flag__c = false;
- dataForProductCount7.RemoveBox_No__c = 1;
- insert dataForProductCount7;
-
- Consumable_order_details2__c dataForProductCount6 = new Consumable_order_details2__c();
- dataForProductCount6.Bar_Code__c = '1234567893';
- dataForProductCount6.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount6.Arrive_date__c = Date.today();
- dataForProductCount6.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount6.Consumable_Product__c = proH.id;
- dataForProductCount6.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount6.Box_Piece__c = '涓�';
- dataForProductCount6.Consumable_order_minor__c = CreateId.id;
- dataForProductCount6.Send_Date__c = null;
- dataForProductCount6.Used_date__c = null;
- dataForProductCount6.Lose_Flag__c = false;
- dataForProductCount6.RemoveBox_No__c = 1;
- insert dataForProductCount6;
-
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1234567894';
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount5.Consumable_Product__c = proH.id;
- dataForProductCount5.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount5.Box_Piece__c = '涓�';
- dataForProductCount5.Consumable_order_minor__c = CreateId.id;
- dataForProductCount5.Send_Date__c = null;
- dataForProductCount5.Used_date__c = null;
- dataForProductCount5.Lose_Flag__c = false;
- dataForProductCount5.RemoveBox_No__c = 1;
- insert dataForProductCount5;
-
- List<Consumable_order_details2__c> conlist = new List<Consumable_order_details2__c>();
- //Barcode妫�绱� 鎵�鏈夊湪搴�
- Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- con1.Lose_Flag__c = false;
- con1.Arrive_date__c = Date.today();
- con1.Send_Date__c = null;
- con1.Return_date__c = null;
- con1.Lose_Flag__c = false;
- con1.Cancellation_Date__c = null;
- con1.Sterilization_limit__c = Date.today().addDays(2);
- con1.Bar_Code__c = '123';
- con1.Box_Piece__c = '鐩�';
- con1.Bar_Code__c = '1234567894';
- con1.Sterilization_limit__c = Date.today().addDays(2);
- con1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- con1.Consumable_Product__c = proH.id;
- con1.Consumable_order_minor__c = CreateId.id;
- conlist.add(con1);
-
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Consumable_Product__c = proH.id;
- con3.Bar_Code__c = '1001';
- con3.Consumable_Arrived_order__c = Order1.id;
- con3.Consumable_order_minor__c = Order2.id;
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Cancellation_Flag__c = false;
- con3.Consumable_order_minor__c = CreateId.id;
- con3.Sterilization_limit__c = Date.today().addDays(2);
- con3.Box_Piece__c = '涓�';
- con3.RecordTypeid = '01210000000kUDKAA2';
- conlist.add(con3);
-
- //productAdjust
- Consumable_order_details2__c con6 = new Consumable_order_details2__c();
- con6.Consumable_Product__c = proH.id;
- con6.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
- con6.Box_Piece__c = '鐩�';
- con6.Sterilization_limit__c = Date.today().addDays(-2);
- con6.Bar_Code__c = '10011';
- con6.Consumable_Arrived_order__c = Order1.id;
- con6.Lose_Flag__c = true;
- con6.RecordTypeid = '01210000000kUDKAA2';
- conlist.add(con6);
- System.debug('conlist===>' + conlist);
-
- //reset592
- Consumable_order_details2__c con4 = new Consumable_order_details2__c();
- con4.Arrive_date__c = Date.today();
- con4.Send_Date__c = null;
- con4.Return_date__c = null;
- con4.Lose_Flag__c = false;
- con4.Cancellation_Date__c = null;
- con4.Sterilization_limit__c = Date.today().addDays(2);
- con4.Bar_Code__c = '123456';
- con4.Box_Piece__c = '鐩�';
- // con2.Bar_Code__c = '1234567894';
- con4.Sterilization_limit__c = Date.today().addDays(2);
- con4.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- con4.Consumable_Product__c = proH.id;
- // con2.Asset_Model_No__c = proH.Asset_Model_No__c;
- con4.Consumable_order_minor__c = CreateId.id;
- conlist.add(con4);
-
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- Consumable_order_details2__c con5 = new Consumable_order_details2__c();
- con5.Arrive_date__c = Date.today();
- con5.Send_Date__c = null;
- con5.Return_date__c = null;
- con5.Lose_Flag__c = false;
- con5.Cancellation_Flag__c = false;
- con5.Consumable_Product__c = proH.id;
- con5.Consumable_order_minor__c = Order2.id;
- // con5.Sterilization_limit__c = Date.today().addDays(2);
- con5.Box_Piece__c = '鐩�';
- con5.Bar_Code__c = '1001';
- conlist.add(con5);
- insert conlist;
-
- System.Test.startTest();
- LexInventoryController inver = new LexInventoryController();
- LexInventoryController.init();
- List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
- List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
- System.debug('testCount:' + testList.size());
- for (LexInventoryController.ConsumableorderdetailsInfo ass : testList) {
- System.debug(ass.check);
- ass.check = true;
- testList1.add(ass);
- }
- System.debug('testList1:' + testList1);
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '',
- JSON.serialize(testList1),
- 20,
- 9,
- 'Test',
- 'ASC'
- );
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '01210000000kUDKAA2\n10011',
- JSON.serialize(testList1),
- 20,
- 9,
- 'Test',
- 'ASC'
- );
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894\n1001',
- JSON.serialize(testList1),
- 1,
- 0,
- 'Test',
- 'ASC'
- );
- LexInventoryController.save(
- true,
- JSON.serialize(testList1),
- myAccount1.Id,
- 'ET',
- LexInventoryController.pandiandetailsMap,
- LexInventoryController.reSet
- );
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '',
- '[{"sortBy": null,"refind": 0,"ProdId": "a0l0l000004EisKAAS","Prod": {"attributes": {"type": "Product2__c","url": "/services/data/v58.0/sobjects/Product2__c/a0l0l000004EisKAAS"},"Id": "a0l0l000004EisKAAS","Name": "MH-155:鐧藉钩琛″附","Name__c": "Test07","SFDA_Status__c": "鍋滄","Packing_list_manual__c": 1,"Asset_Model_No__c": "Test07"},"Pandian": 0,"overlimitCount": 0,"orderdetails2": null,"orderdetails1": null,"limitCount": 2,"DiffReason": null,"Diff": 0,"countid": 2,"check": true,"canSelect": true,"boxPiece": "鐩�"}]',
- 20,
- 9,
- 'Test',
- 'ASC'
- );
-
- System.Test.stopTest();
- }
- }
-
- static testMethod void all() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeOrderDetail2Trigger = true;
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '涓婃捣'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
-
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍒拌揣
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ET';
- orderList.add(Order1);
- //鍙戣揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟 ';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = '01210000000c9drAAA';
- Order2.Order_ProType__c = 'ET';
- orderList.add(Order2);
- insert orderList;
- //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
- List<Consumable_order_details2__c> conlist = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = null;
- con3.Used_date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Cancellation_Flag__c = false;
- con3.Consumable_order_minor__c = Order1.id;
- con3.Consumable_Arrived_order__c = Order1.id;
- con3.Bar_Code__c = '1001';
- con3.Consumable_Product__c = proH.id;
- conlist.add(con3);
- insert conlist;
-
- //productAdjust
- Consumable_order_details2__c con6 = new Consumable_order_details2__c();
- // con6.Consumable_Product__c = proH.id;
- con6.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
- // con6.Box_Piece__c = '鐩�';
- con6.Sterilization_limit__c = Date.today().addDays(-2);
- con6.Bar_Code__c = '10011';
- // con6.Consumable_Arrived_order__c = Order1.id;
- con6.Lose_Flag__c = true;
- // con6.RecordTypeid = '01210000000kUDKAA2';
- conlist.add(con6);
- System.debug('conlist===>' + conlist);
- LexInventoryController.init();
- List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords;
- List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>();
- System.debug('testCount:' + testList.size());
- for (LexInventoryController.ConsumableorderdetailsInfo ass : testList) {
- System.debug(ass.check);
- ass.check = true;
- testList1.add(ass);
- }
- System.debug('testList1:' + testList1);
-
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '1001\n10011',
- JSON.serialize(testList1),
- 20,
- 9,
- 'Test',
- 'ASC'
- );
- LexInventoryController.searchConsumableorderdetails(
- 'ET',
- '涓婃捣',
- 'Testaccount001',
- '',
- JSON.serialize(testList1),
- 20,
- 9,
- 'Test',
- 'ASC'
- );
- }
- }
-}
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','1001\n10011',JSON.serialize(testList1),20,9,'Test','ASC');
+ LexInventoryController.searchConsumableorderdetails('ET','涓婃捣','Testaccount001','',JSON.serialize(testList1),20,9,'Test','ASC');
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml b/force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexInventoryListController.cls b/force-app/main/default/classes/LexInventoryListController.cls
index 5ae2462..a924740 100644
--- a/force-app/main/default/classes/LexInventoryListController.cls
+++ b/force-app/main/default/classes/LexInventoryListController.cls
@@ -1,152 +1,104 @@
public without sharing class LexInventoryListController {
- /*****************妞滅储鐢�******************/
- public static Consumable_order__c coc { get; set; }
- public static String baseUrl { get; private set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords {
- get;
- set;
- }
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError {
- get;
- set;
- }
- // 鐩樼偣鏄庣粏1
- private static List<Consumable_orderdetails__c> consumableorderdetails1 = new List<Consumable_orderdetails__c>();
- // 鐩樼偣鏄庣粏2
- private static List<Consumable_order_details2__c> consumableorderdetailsSelected = new List<Consumable_order_details2__c>();
+ /*****************妞滅储鐢�******************/
+ public static Consumable_order__c coc { get; set; }
+ public static String baseUrl {get;private set;}
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError { get; set; }
+ // 鐩樼偣鏄庣粏1
+ private static List<Consumable_orderdetails__c> consumableorderdetails1 = new List<Consumable_orderdetails__c>();
+ // 鐩樼偣鏄庣粏2
+ private static List<Consumable_order_details2__c> consumableorderdetailsSelected = new List<Consumable_order_details2__c>();
- // 鐩樼偣鍗曞彿 ID
- private static String ESetId = '';
- public LexInventoryListController() {
- //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
- baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
- ESetId = ApexPages.currentPage().getParameters().get('esetId');
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
- }
- // 鐢婚潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init(String eSetId) {
- system.debug('eSetId====>' + eSetId);
- ESetId = eSetId;
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
+ // 鐩樼偣鍗曞彿 ID
+ private static String ESetId = '';
+ public LexInventoryListController() {
+ //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ESetId = ApexPages.currentPage().getParameters().get('esetId');
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
+ }
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String eSetId) {
+ system.debug('eSetId====>'+eSetId);
+ ESetId = eSetId;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
- coc = new Consumable_order__c();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- List<Consumable_order__c> qs = new List<Consumable_order__c>();
- qs = [
- SELECT Name, Inventory_date__c, Order_date__c
- FROM Consumable_order__c
- WHERE Id = :ESetId
- ];
- System.debug('qs===>' + qs);
- if (qs.size() > 0) {
- coc = qs[0];
- }
- // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
- consumableorderdetailsSelected = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Bar_Code__c,
- Consumable_Product__r.Asset_Model_No__c,
- Lose_Flag__c,
- recordtypeid,
- Lose_reason__c
- FROM Consumable_order_details2__c
- WHERE Consumable_Inventory_order__c = :ESetId
- ORDER BY Name
- ];
- System.debug(
- 'consumableorderdetailsSelected==>' + consumableorderdetailsSelected
- );
+ coc = new Consumable_order__c();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order__c> qs = New List<Consumable_order__c>();
+ qs = [select Name,Inventory_date__c,Order_date__c From Consumable_order__c Where Id =:ESetId];
+ System.debug('qs===>'+qs);
+ if (qs.size()>0){
+ coc = qs[0];
+ }
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ consumableorderdetailsSelected = [
+ select Id, Name, Consumable_Product__c,
+ Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Consumable_Product__r.Name__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,Bar_Code__c,
+ Consumable_Product__r.Asset_Model_No__c,Lose_Flag__c,
+ recordtypeid,Lose_reason__c
+ from Consumable_order_details2__c
+ where Consumable_Inventory_order__c = :ESetId
+ order by Name ];
+ System.debug('consumableorderdetailsSelected==>'+consumableorderdetailsSelected);
- for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) {
- consumableorderdetailsRecordsError.add(
- new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i])
- );
+ for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) {
+ consumableorderdetailsRecordsError.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i]));
+ }
+ consumableorderdetails1 = [
+ select Id, Name,Diff__c,inventory_sum__c,
+ Count_Sum__c,Consumable_order__c,
+ Consumable_Product__c,Consumable_Product__r.Name,Consumable_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,Consumable_Product__r.Name__c,
+ Sum_of_money__c,recordtypeid,Lose_reason__c,Product_Refind__c
+ from Consumable_orderdetails__c
+ where Consumable_order__c = :ESetId
+ order by Name ];
+ for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
+ }
+ data.put('qs',qs);
+ System.debug('consumableorderdetailsRecords====>'+consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
+ data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
+ // if(ConsumableorderdetailsRecordsError.size()!=null){
+ // data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
+ // }
+ System.debug('ConsumableorderdetailsRecordsError====>'+ConsumableorderdetailsRecordsError);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- consumableorderdetails1 = [
- SELECT
- Id,
- Name,
- Diff__c,
- inventory_sum__c,
- Count_Sum__c,
- Consumable_order__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Count__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Product__r.Name__c,
- Sum_of_money__c,
- recordtypeid,
- Lose_reason__c,
- Product_Refind__c
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ORDER BY Name
- ];
- for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
- consumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(consumableorderdetails1[i])
- );
- }
- data.put('qs', qs);
- System.debug(
- 'consumableorderdetailsRecords====>' + consumableorderdetailsRecords
- );
- data.put(
- 'consumableorderdetailsRecords',
- JSON.serialize(consumableorderdetailsRecords)
- );
- data.put(
- 'ConsumableorderdetailsRecordsError',
- JSON.serialize(ConsumableorderdetailsRecordsError)
- );
- // if(ConsumableorderdetailsRecordsError.size()!=null){
- // data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
- // }
- System.debug(
- 'ConsumableorderdetailsRecordsError====>' +
- ConsumableorderdetailsRecordsError
- );
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- // Data Bean
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
- public Consumable_orderdetails__c orderdetails1 { get; set; }
- public Consumable_order_details2__c orderdetails2 { get; set; }
- public Product2__c Prod { get; set; }
- // 鏄庣粏1
- public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
- orderdetails1 = e;
- Prod = e.Consumable_Product__r;
+ // Data Bean
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ public Product2__c Prod { get; set; }
+ // 鏄庣粏1
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ Prod = e.Consumable_Product__r;
+ }
+ // 鏄庣粏2
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
}
- // 鏄庣粏2
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- }
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- return null;
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryListControllerTest.cls b/force-app/main/default/classes/LexInventoryListControllerTest.cls
index 635926c..86c754d 100644
--- a/force-app/main/default/classes/LexInventoryListControllerTest.cls
+++ b/force-app/main/default/classes/LexInventoryListControllerTest.cls
@@ -1,172 +1,102 @@
@isTest
private class LexInventoryListControllerTest {
- static testMethod void myUnitTest() {
- Oly_TriggerHandler.bypass('ConsumableAssetHander');
- Oly_TriggerHandler.bypass('Oly_TriggerHandler');
- User myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert MyUser_Test;
+
+ static testMethod void myUnitTest() {
+ Oly_TriggerHandler.bypass('ConsumableAssetHander');
+ Oly_TriggerHandler.bypass('Oly_TriggerHandler');
+ User myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Packing_list_manual__c=12,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2, pro3};
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鐩樼偣';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ insert Order1;
+
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_002';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Order;
+ insert Order2;
+
+ Consumable_order__c Order3 = new Consumable_order__c();
+ Order3.Name = 'OCM_01_004';
+ Order3.Order_status__c = '鎵瑰噯';
+ Order3.Order_type__c = '鍒拌揣';
+ Order3.RecordTypeid = '01210000000c9dqAAA';
+ insert Order3;
+
+ Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order__c = Order1.Id;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory ;
+
+ Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ insert new Consumable_orderdetails__c[] {Orderdet1, Orderdet2};
+
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Name = 'OCM_01_001001';
+ con.Consumable_order_minor__c = Order1.Id;
+ con.Consumable_Product__c = pro2.Id;
+ con.Asset_Model_No__c = 'Test01';
+ con.Arrive_date__c = Date.today();
+ con.Bar_Code__c = '10011';
+ con.Used_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Return_date__c= null;
+ con.Send_Date__c= null;
+ con.Box_Piece__c = '鐩�';
+ conList1.add(con);
+ insert conList1;
+ String eSetId = Order1.id;
+ System.Test.startTest();
+ LexInventoryListController.init(eSetId);
+
+ List<LexInventoryListController.ConsumableorderdetailsInfo> inList = LexInventoryListController.consumableorderdetailsRecords;
+ List<LexInventoryListController.ConsumableorderdetailsInfo> inList1 = new List<LexInventoryListController.ConsumableorderdetailsInfo>();
+ for(LexInventoryListController.ConsumableorderdetailsInfo ass: inList){
+ ass.orderdetails1= Orderdet1;
+ inList1.add(ass);
+ }
+ LexInventoryListController.ConsumableorderdetailsInfo c2 = new LexInventoryListController.ConsumableorderdetailsInfo(Orderdet1);
+ c2.orderdetails1 = Orderdet1;
+ c2.Prod = Orderdet1.Consumable_product__r;
+ LexInventoryListController.ConsumableorderdetailsInfo c1 = new LexInventoryListController.ConsumableorderdetailsInfo(con);
+ c1.orderdetails2 = con;
+ c1.Prod = con.Consumable_product__r;
+ c1.compareTo(c2);
+ System.Test.stopTest();
+ }
}
-
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Packing_list_manual__c = 12,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Packing_list_manual__c = 10,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鐩樼偣';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- insert Order1;
-
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_002';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.RecordTypeid = System.Label.RT_ConOrder_Order;
- insert Order2;
-
- Consumable_order__c Order3 = new Consumable_order__c();
- Order3.Name = 'OCM_01_004';
- Order3.Order_status__c = '鎵瑰噯';
- Order3.Order_type__c = '鍒拌揣';
- Order3.RecordTypeid = '01210000000c9dqAAA';
- insert Order3;
-
- Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order__c = Order1.Id;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
-
- Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
- insert new List<Consumable_orderdetails__c>{ Orderdet1, Orderdet2 };
-
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Name = 'OCM_01_001001';
- con.Consumable_order_minor__c = Order1.Id;
- con.Consumable_Product__c = pro2.Id;
- con.Asset_Model_No__c = 'Test01';
- con.Arrive_date__c = Date.today();
- con.Bar_Code__c = '10011';
- con.Used_date__c = null;
- con.Lose_Flag__c = false;
- con.Return_date__c = null;
- con.Send_Date__c = null;
- con.Box_Piece__c = '鐩�';
- conList1.add(con);
- insert conList1;
- String eSetId = Order1.id;
- System.Test.startTest();
- LexInventoryListController.init(eSetId);
-
- List<LexInventoryListController.ConsumableorderdetailsInfo> inList = LexInventoryListController.consumableorderdetailsRecords;
- List<LexInventoryListController.ConsumableorderdetailsInfo> inList1 = new List<LexInventoryListController.ConsumableorderdetailsInfo>();
- for (LexInventoryListController.ConsumableorderdetailsInfo ass : inList) {
- ass.orderdetails1 = Orderdet1;
- inList1.add(ass);
- }
- LexInventoryListController.ConsumableorderdetailsInfo c2 = new LexInventoryListController.ConsumableorderdetailsInfo(
- Orderdet1
- );
- c2.orderdetails1 = Orderdet1;
- c2.Prod = Orderdet1.Consumable_product__r;
- LexInventoryListController.ConsumableorderdetailsInfo c1 = new LexInventoryListController.ConsumableorderdetailsInfo(
- con
- );
- c1.orderdetails2 = con;
- c1.Prod = con.Consumable_product__r;
- c1.compareTo(c2);
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml b/force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexInventoryViewControllerTest.cls b/force-app/main/default/classes/LexInventoryViewControllerTest.cls
index 2514535..0a9473a 100644
--- a/force-app/main/default/classes/LexInventoryViewControllerTest.cls
+++ b/force-app/main/default/classes/LexInventoryViewControllerTest.cls
@@ -1,1273 +1,768 @@
@isTest
-public class LexInventoryViewControllerTest {
- static testMethod void testInnerClass() {
- List<LexInventoryViewController.ConsumableorderdetailsInfo> cro = new List<LexInventoryViewController.ConsumableorderdetailsInfo>();
- cro.sort();
- }
- static testMethod void LexInventoryViewControllerTest() {
- user myUser_test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
-
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '娣卞湷'
- );
- insert myUser_test;
+public class LexInventoryViewControllerTest {
+ static testMethod void testInnerClass(){
+ List<LexInventoryViewController.ConsumableorderdetailsInfo> cro = new List<LexInventoryViewController.ConsumableorderdetailsInfo>();
+ cro.sort();
}
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = '3400PK:PK閽� 5mmx33cm',
- ProductCode = 'Test01',
- Asset_Model_No__c = '3400PK:PK閽� 5mmx33cm',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'tset',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 12,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'tset',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = '3400PK:PK閽� 5mmx33cm',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id,
- Category3_text__c = '鑵硅厰闀滄墜鏈�',
- Category4_text__c = 'PK',
- Category5_text__c = 'G400'
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id,
- Category3_text__c = '鑵硅厰闀滄墜鏈�',
- Category4_text__c = 'PK',
- Category5_text__c = 'G400'
- );
- insert new List<Product2__c>{ pro1, pro2 };
- System.debug('pro2===銆�' + pro2);
- System.debug('pro1===銆�' + pro1);
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
-
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- Order2.Order_ProType__c = 'ENg';
- insert Order2;
-
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- //Orderdet1.Consumable_principal__c = Order1.Id;
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet1.IsArrival__c = true;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '11111';
- Orderdet1.Arrive_date__c = Date.today().addDays(1);
- Orderdet1.Send_Date__c = null;
- Orderdet1.Used_date__c = null;
- Orderdet1.Lose_Flag__c = false;
- Orderdet1.Box_Piece__c = '鐩�';
-
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- //Orderdet2.Consumable_principal__c = Order1.Id;
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222';
- Orderdet2.Arrive_date__c = Date.today().addDays(1);
- Orderdet2.Send_Date__c = null;
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Box_Piece__c = '涓�';
- Orderdet2.Sterilization_limit__c = Date.today();
-
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- //Orderdet3.Consumable_principal__c = Order1.Id;
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro2.Id;
- Orderdet3.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet3.IsArrival__c = true;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '33333';
- Orderdet3.Arrive_date__c = Date.today().addDays(1);
- Orderdet3.Send_Date__c = null;
- Orderdet3.Used_date__c = null;
- Orderdet3.Lose_Flag__c = false;
- Orderdet3.Box_Piece__c = '涓�';
- Orderdet3.Sterilization_limit__c = Date.today();
-
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- //Orderdet4.Consumable_principal__c = Order1.Id;
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet4.IsArrival__c = true;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '44444';
- Orderdet4.Arrive_date__c = Date.today().addDays(1);
- Orderdet4.Send_Date__c = null;
- Orderdet4.Used_date__c = null;
- Orderdet4.Lose_Flag__c = false;
- Orderdet4.Box_Piece__c = '涓�';
-
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4
- };
-
- //鍒朵綔鐩樼偣灞ュ巻
- List<Consumable_order__c> InsPDlist = new List<Consumable_order__c>();
- for (integer i = 1; i < 35; i++) {
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
+ static testMethod void LexInventoryViewControllerTest(){
+ user myUser_test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '娣卞湷');
+ insert myUser_test;
}
- Consumable_order__c PDlist = new Consumable_order__c(
- name = 'testPandianLVL_' + str
- );
- //Date ThisDate = Date.newInstance(2016,4,20+i/5);
- //PDlist.Inventory_date__c = ThisDate;
- PDlist.Order_type__c = '鐩樼偣';
- PDlist.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- PDlist.Inventory_date__c = Date.today().addDays(-i);
- PDlist.Dealer_Info__c = myAccount1.Id;
- InsPDlist.add(PDlist);
- }
- List<String> orderDetZaikuListLWC = new List<String>();
- LexInventoryViewController controller = new LexInventoryViewController();
- Integer pageSizeLWC = 1;
- Integer pageTokenLWC = 0;
- String sortFieldLWC = '';
- String sortOrderLWC = '';
- String category1 = '3400PK:PK閽� 5mm脳33cm';
- String Category3 = '鑵硅厰闀滄墜鏈�';
- String Category4 = 'PK';
- String Category5 = 'G400';
- String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
- string agencyProType = 'ENG';
- string userWorkLocation = '娣卞湷';
- LexInventoryViewController.category1 = category1;
- LexInventoryViewController.Category3 = Category3;
- LexInventoryViewController.Category4 = Category4;
- LexInventoryViewController.Category5 = Category5;
- LexInventoryViewController.orderDetZaikuList = new List<String>();
- LexInventoryViewController.init(
- pageSizeLWC,
- pageTokenLWC,
- sortFieldLWC,
- sortOrderLWC
- );
- system.debug(
- 'order detail:' +
- JSON.serialize(LexInventoryViewController.orderDetZaikuList)
- );
- orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
- System.debug('orderDetZaikuListLWC' + orderDetZaikuListLWC);
- Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
- LexInventoryViewController.searchConsumableorderdetails(
- category1,
- '',
- '',
- '',
- orderDetZaikuListLWC,
- accountName,
- agencyProType,
- userWorkLocation,
- pageSizeLWC,
- pageTokenLWC,
- sortFieldLWC,
- sortOrderLWC,
- productkucunLWC
- );
- LexInventoryViewController.searchConsumableorderdetails(
- category1,
- Category3,
- Category4,
- Category5,
- orderDetZaikuListLWC,
- accountName,
- agencyProType,
- userWorkLocation,
- pageSizeLWC,
- pageTokenLWC,
- sortFieldLWC,
- sortOrderLWC,
- productkucunLWC
- );
+ System.runAs(myUser_test) {
+ Product2 prod01 = new Product2(Name='3400PK:PK閽� 5mmx33cm',ProductCode='Test01',Asset_Model_No__c = '3400PK:PK閽� 5mmx33cm',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test001',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='3400PK:PK閽� 5mmx33cm',OT_CODE_Text__c='Test001',Product2__c = prod01.Id,Category3_text__c = '鑵硅厰闀滄墜鏈�',Category4_text__c = 'PK',Category5_text__c = 'G400');
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id,Category3_text__c = '鑵硅厰闀滄墜鏈�',Category4_text__c = 'PK',Category5_text__c = 'G400');
+ insert new Product2__c[] {pro1, pro2};
+ System.debug('pro2===銆�'+pro2);
+ System.debug('pro1===銆�'+pro1);
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ Order2.Order_ProType__c = 'ENg';
+ insert Order2;
+
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ //Orderdet1.Consumable_principal__c = Order1.Id;
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet1.IsArrival__c = true;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '11111';
+ Orderdet1.Arrive_date__c = Date.today().addDays(1);
+ Orderdet1.Send_Date__c = null;
+ Orderdet1.Used_date__c = null;
+ Orderdet1.Lose_Flag__c = false;
+ Orderdet1.Box_Piece__c = '鐩�';
+
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ //Orderdet2.Consumable_principal__c = Order1.Id;
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222';
+ Orderdet2.Arrive_date__c = Date.today().addDays(1);
+ Orderdet2.Send_Date__c = null;
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = false;
+ Orderdet2.Box_Piece__c = '涓�';
+ Orderdet2.Sterilization_limit__c= Date.today();
+
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ //Orderdet3.Consumable_principal__c = Order1.Id;
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro2.Id;
+ Orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet3.IsArrival__c = true;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '33333';
+ Orderdet3.Arrive_date__c = Date.today().addDays(1);
+ Orderdet3.Send_Date__c = null;
+ Orderdet3.Used_date__c = null;
+ Orderdet3.Lose_Flag__c = false;
+ Orderdet3.Box_Piece__c = '涓�';
+ Orderdet3.Sterilization_limit__c= Date.today();
+
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ //Orderdet4.Consumable_principal__c = Order1.Id;
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet4.IsArrival__c = true;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet4.Bar_Code__c = '44444';
+ Orderdet4.Arrive_date__c = Date.today().addDays(1);
+ Orderdet4.Send_Date__c = null;
+ Orderdet4.Used_date__c = null;
+ Orderdet4.Lose_Flag__c = false;
+ Orderdet4.Box_Piece__c = '涓�';
+
+ insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4};
+
+ //鍒朵綔鐩樼偣灞ュ巻
+ List<Consumable_order__c> InsPDlist = new List<Consumable_order__c>();
+ for(integer i = 1 ; i < 35 ;i++){
+ String str = string.valueOf(i);
+ if(str.length() == 1){
+ str = '0' + str;
+ }
+ Consumable_order__c PDlist = new Consumable_order__c(name='testPandianLVL_'+str);
+ //Date ThisDate = Date.newInstance(2016,4,20+i/5);
+ //PDlist.Inventory_date__c = ThisDate;
+ PDlist.Order_type__c = '鐩樼偣';
+ PDlist.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ PDlist.Inventory_date__c = Date.today().addDays(-i);
+ PDlist.Dealer_Info__c = myAccount1.Id;
+ InsPDlist.add(PDlist);
+ }
+ List<String> orderDetZaikuListLWC = new List<String>();
+ LexInventoryViewController controller = new LexInventoryViewController();
+ Integer pageSizeLWC = 1;
+ Integer pageTokenLWC = 0;
+ String sortFieldLWC = '';
+ String sortOrderLWC ='';
+ String category1= '3400PK:PK閽� 5mm脳33cm';
+ String Category3 = '鑵硅厰闀滄墜鏈�';
+ String Category4 = 'PK';
+ String Category5 = 'G400';
+ String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
+ string agencyProType = 'ENG';
+ string userWorkLocation = '娣卞湷';
+ LexInventoryViewController.category1 = category1;
+ LexInventoryViewController.Category3 = Category3;
+ LexInventoryViewController.Category4 = Category4;
+ LexInventoryViewController.Category5 = Category5;
+ LexInventoryViewController.orderDetZaikuList = new List<String>();
+ LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ system.debug('order detail:' + JSON.serialize(LexInventoryViewController.orderDetZaikuList));
+ orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
+ System.debug('orderDetZaikuListLWC'+orderDetZaikuListLWC);
+ Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
+ LexInventoryViewController.searchConsumableorderdetails(category1,'','','',orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
+ LexInventoryViewController.searchConsumableorderdetails(category1,Category3,Category4,Category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
+ }
+ }
+
+
+ static testMethod void InventoryViewSearchTest(){
+ user myUser_test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_test;
+ }
+
+ system.runAs(myUser_test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true
+ ,Category3__c = 'CDS',Category4__c = 'OER',Category5__c = '鍏跺畠',Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true
+ ,Category3__c = 'ENT',Category4__c = 'Celon',Category5__c = 'Celon',Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true
+ ,Category3__c = 'US',Category4__c = 'ALOKA',Category5__c = '浣撳瓒呭0',Manual_Entry__c = false);
+ Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true
+ ,Category3__c = 'OCS',Category4__c = '闄勫睘鍝�',Category5__c = 'S45',Manual_Entry__c = false);
+ Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true
+ ,Category3__c = '鍏夋簮',Category4__c = '闄勫睘鍝�',Category5__c = 'OCS',Manual_Entry__c = false);
+ insert new Product2[] {prod01, prod02, prod03, prod04, prod05};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ Product2__c pro4 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod04.Id);
+ Product2__c pro5 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod05.Id);
+ insert new Product2__c[] {pro1, pro2, pro3, pro4, pro5};
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet1.Sterilization_limit__c = Date.today();
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '11111';
+ Orderdet1.Arrive_date__c = Date.today().addDays(1);
+ Orderdet1.Send_Date__c = null;
+ Orderdet1.Used_date__c = null;
+ Orderdet1.Lose_Flag__c = false;
+
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet2.Sterilization_limit__c = Date.today();
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222';
+ Orderdet2.Arrive_date__c = Date.today().addDays(1);
+ Orderdet2.Send_Date__c = null;
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = false;
+ insert new Consumable_order_details2__c[] {Orderdet1,Orderdet2};
+ Integer pageSizeLWC = 1;
+ Integer pageTokenLWC = 0;
+ String sortFieldLWC = '';
+ String sortOrderLWC ='';
+ String category3LWC = 'CDS';
+ String agencyProTypeLWC = 'ENG';
+ String category1= '3400PK:PK閽� 5mm脳33cm';
+ String Category3 = '鑵硅厰闀滄墜鏈�';
+ String Category4 = 'PK';
+ String Category5 = 'G400';
+ String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
+ string agencyProType = 'ENG';
+ string userWorkLocation = '娣卞湷';
+ List<String> orderDetZaikuListLWC = new List<String>();
+
+
+ LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ LexInventoryViewController.categoryAllload(category3LWC,agencyProTypeLWC);
+ LexInventoryViewController.categoryload();
+ // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+
+ }
+ }
+
+ //add by rentx 2020-12-25 start 鏌ヨ闈炲尰闄㈢壒浠风洅 /涓�
+ static testMethod void InventoryViewTest2(){
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ //Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];//20200916 ljh update
+
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ET', Work_Location__c='鍖椾含');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+ System.Test.startTest();
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c createId = new Consumable_order__c();
+ createId.Name = 'testMing';
+ createId.Order_status__c = '鎵瑰噯';
+ createId.Deliver_date__c = Date.today();
+ createId.Dealer_Info__c = myAccount2.Id;
+ createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createId.Order_type__c = '璁㈠崟';
+ createId.Order_ProType__c = 'ET';
+ createId.Dealer_Info__c = myAccount2.Id;
+ createId.Delivery_detail_count__c = 5;
+ insert createId;
+ //pro1 鐩� 鍦ㄥ簱
+ List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
+ createDetail2 = new Consumable_order_details2__c();
+ createDetail2.Consumable_Product__c = pro1.id;
+ createDetail2.Asset_Model_No__c = 'Test01';
+ createDetail2.Consumable_order_minor__c = createId.id;
+ createDetail2.Consumable_Arrived_order__c = createId.id;
+ createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetail2.Bar_Code__c = '123';
+ createDetail2.Box_Piece__c ='鐩�';
+ createDetail2.Arrive_date__c = Date.today();
+ codListTemp.add(createDetail2);
+ //insert createDetail2;
+ Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
+ createDetailpro1.Consumable_Product__c = pro1.id;
+ createDetailpro1.Asset_Model_No__c = 'Test02';
+ createDetailpro1.Consumable_order_minor__c = createId.id;
+ createDetailpro1.Consumable_Arrived_order__c = createId.id;
+ createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailpro1.Bar_Code__c = '12322';
+ createDetailpro1.Box_Piece__c ='鐩�';
+ createDetailpro1.Arrive_date__c = Date.today();
+ codListTemp.add(createDetailpro1);
+ //insert createDetailpro1;
+ //pro1 涓� 鍦ㄥ簱
+ Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
+ createDetailPiece1.Consumable_Product__c = pro1.id;
+ createDetailPiece1.Asset_Model_No__c = 'Test03';
+ createDetailPiece1.Consumable_order_minor__c = createId.id;
+ createDetailPiece1.Consumable_Arrived_order__c = createId.id;
+ createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailPiece1.Bar_Code__c = '23456';
+ createDetailPiece1.Box_Piece__c ='涓�';
+ createDetailPiece1.Arrive_date__c = Date.today();
+ codListTemp.add(createDetailPiece1);
+ //insert createDetailPiece1;
+ Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
+ createDetailPiece2.Consumable_Product__c = pro1.id;
+ createDetailPiece2.Asset_Model_No__c = 'Test04';
+ createDetailPiece2.Consumable_order_minor__c = createId.id;
+ createDetailPiece2.Consumable_Arrived_order__c = createId.id;
+ createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailPiece2.Bar_Code__c = '122345';
+ createDetailPiece2.Box_Piece__c ='涓�';
+ createDetailPiece2.Arrive_date__c = Date.today();
+ codListTemp.add(createDetailPiece2);
+ //insert createDetailPiece2;
+
+ //pro1 鐩� 鍦ㄥ簱 杩囨湡
+ Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
+ createDetail21.Consumable_Product__c = pro1.id;
+ createDetail21.Asset_Model_No__c = 'Test01';
+ createDetail21.Sterilization_limit__c = Date.today();
+ createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ //createDetail.IsArrival__c = true;
+ createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
+ createDetail21.Bar_Code__c = '1223';
+ createDetail21.Box_Piece__c ='鐩�';
+ createDetail21.Arrive_date__c = Date.today();
+ createDetail21.Deliver_date__c =Date.today().addDays(-8);
+ createDetail21.Sterilization_limit__c =Date.today().addDays(-8);
+ codListTemp.add(createDetail21);
+ //insert createDetail2;
+ insert codListTemp;
+
+ PageReference page = new PageReference('/apex/TopPage');
+ System.Test.setCurrentPage(page);
+ TopPageController lPCTest = new TopPageController();
+ lPCTest.pagesize = 1;
+ List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
+ Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
+ conOrderDetail1.Consumable_count__c = 10;
+ conOrderDetail1.Consumable_Arrivecount__c = 5;
+ conOrderDetail1.Consumable_product__c = pro2.id;
+ conOrderDetail1.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail1);
+
+ Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
+ conOrderDetail2.Consumable_product__c = pro2.id;
+ conOrderDetail2.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail2);
+ insert coListTest;
+
+ Integer pageSizeLWC = 1;
+ Integer pageTokenLWC = 0;
+ String sortFieldLWC = '';
+ String sortOrderLWC ='';
+ String category3LWC = 'CDS';
+ String agencyProTypeLWC = 'ENG';
+ // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ LexInventoryViewController.categoryAllload('CDS','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ LexInventoryViewController.categoryAllload('鍏夋簮','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ System.Test.stopTest();
+ }
+ }
+
+ static testMethod void InventoryViewTest3(){
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ //Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
+ // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(Email)'];//20200916 ljh update
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];//20210329 RTX update
+
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert MyUser_Test;
+
+ }
+
+ system.runAs(MyUser_Test){
+ System.Test.startTest();
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c createId = new Consumable_order__c();
+ createId.Name = 'testMing1';
+ createId.Order_status__c = '鎵瑰噯';
+ createId.Deliver_date__c = Date.today();
+ createId.Dealer_Info__c = myAccount2.Id;
+ createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createId.Order_type__c = '璁㈠崟';
+ createId.Order_ProType__c = 'ENG';
+ createId.Dealer_Info__c = myAccount2.Id;
+ createId.Delivery_detail_count__c = 5;
+ createId.orderPattern__c = 'hospitalorder';
+ insert createId;
+ //pro1 鐩� 鍦ㄥ簱
+ Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
+ createDetail2.Consumable_Product__c = pro1.id;
+ createDetail2.Asset_Model_No__c = 'Test01';
+ createDetail2.Consumable_order_minor__c = createId.id;
+ createDetail2.Consumable_Arrived_order__c = createId.id;
+ createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetail2.Bar_Code__c = '123';
+ createDetail2.Box_Piece__c ='鐩�';
+ createDetail2.Arrive_date__c = Date.today();
+ insert createDetail2;
+ List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
+ createDetailpro1.Consumable_Product__c = pro1.id;
+ createDetailpro1.Asset_Model_No__c = 'Test02';
+ createDetailpro1.Consumable_order_minor__c = createId.id;
+ createDetailpro1.Consumable_Arrived_order__c = createId.id;
+ createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailpro1.Bar_Code__c = '12322';
+ createDetailpro1.Box_Piece__c ='鐩�';
+ createDetailpro1.Arrive_date__c = Date.today();
+ //insert createDetailpro1;
+ codListTemp.add(createDetailpro1);
+ //pro1 涓� 鍦ㄥ簱
+ Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
+ createDetailPiece1.Consumable_Product__c = pro1.id;
+ createDetailPiece1.Asset_Model_No__c = 'Test03';
+ createDetailPiece1.Consumable_order_minor__c = createId.id;
+ createDetailPiece1.Consumable_Arrived_order__c = createId.id;
+ createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailPiece1.Bar_Code__c = '23456';
+ createDetailPiece1.Box_Piece__c ='涓�';
+ createDetailPiece1.Arrive_date__c = Date.today();
+ codListTemp.add(createDetailPiece1);
+ //insert createDetailPiece1;
+ Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
+ createDetailPiece2.Consumable_Product__c = pro1.id;
+ createDetailPiece2.Asset_Model_No__c = 'Test04';
+ createDetailPiece2.Consumable_order_minor__c = createId.id;
+ createDetailPiece2.Consumable_Arrived_order__c = createId.id;
+ createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
+ createDetailPiece2.Bar_Code__c = '122345';
+ createDetailPiece2.Box_Piece__c ='涓�';
+ createDetailPiece2.Arrive_date__c = Date.today();
+ codListTemp.add(createDetailPiece2);
+ //insert createDetailPiece2;
+
+ //pro1 鐩� 鍦ㄥ簱 杩囨湡
+ Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
+ createDetail21.Consumable_Product__c = pro1.id;
+ createDetail21.Asset_Model_No__c = 'Test01';
+ createDetail21.Sterilization_limit__c = Date.today();
+ createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ //createDetail.IsArrival__c = true;
+ createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
+ createDetail21.Bar_Code__c = '1223';
+ createDetail21.Box_Piece__c ='鐩�';
+ createDetail21.Arrive_date__c = Date.today();
+ createDetail21.Deliver_date__c =Date.today().addDays(-8);
+ createDetail21.Sterilization_limit__c =Date.today().addDays(-8);
+ codListTemp.add(createDetail21);
+ //insert createDetail21;
+ insert codListTemp;
+
+ PageReference page = new PageReference('/apex/TopPage');
+ System.Test.setCurrentPage(page);
+ TopPageController lPCTest = new TopPageController();
+ lPCTest.pagesize = 1;
+ List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
+ Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
+ conOrderDetail1.Consumable_count__c = 10;
+ conOrderDetail1.Consumable_Arrivecount__c = 5;
+ conOrderDetail1.Consumable_product__c = pro2.id;
+ conOrderDetail1.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail1);
+
+ Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
+ conOrderDetail2.Consumable_product__c = pro2.id;
+ conOrderDetail2.Consumable_order__c = createId.Id;
+ coListTest.add(conOrderDetail2);
+ insert coListTest;
+
+ Integer pageSizeLWC = 1;
+ Integer pageTokenLWC = 0;
+ String sortFieldLWC = '';
+ String sortOrderLWC ='';
+ String category1= '3400PK:PK閽� 5mm脳33cm';
+ String Category3 = '鑵硅厰闀滄墜鏈�';
+ String Category4 = 'PK';
+ String Category5 = 'G400';
+ List<String> orderDetZaikuListLWC = new List<String>();
+ String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
+ string agencyProType = 'ET';
+ string userWorkLocation = '娣卞湷';
+ LexInventoryViewController.category1 = category1;
+ LexInventoryViewController.Category3 = Category3;
+ LexInventoryViewController.Category4 = Category4;
+ LexInventoryViewController.Category5 = Category5;
+ // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ LexInventoryViewController.categoryAllload('CDS','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ LexInventoryViewController.categoryAllload('鍏夋簮','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ }
+ }
+ static testMethod void InventoryViewTest4(){
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];//20210329 RTX update
+
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ET', Work_Location__c='娴庡崡');
+ insert MyUser_Test;
+
+ }
+ system.runAs(MyUser_Test){
+ Integer pageSizeLWC = 1;
+ Integer pageTokenLWC = 0;
+ String sortFieldLWC = '';
+ String sortOrderLWC ='';
+ String category1= '3400PK:PK閽� 5mm脳33cm';
+ String Category3 = '鑵硅厰闀滄墜鏈�';
+ String Category4 = 'PK';
+ String Category5 = 'G400';
+ String accountName = 'Testaccount002';
+ string agencyProType = 'ET';
+ string userWorkLocation = '娴庡崡';
+ List<String> orderDetZaikuListLWC = new List<String>();
+ List<String> productCodeList = new List<String>();
+
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ENG';
+ insert Order1;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_003';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order2.Order_ProType__c = 'ET';
+ insert Order2;
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ //Orderdet2.Consumable_principal__c = Order1.Id;
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ //Orderdet2.IsArrival__c = true;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222';
+ Orderdet2.Arrive_date__c = Date.today().addDays(1);
+ Orderdet2.Send_Date__c = null;
+ Orderdet2.Used_date__c = Date.today();
+ Orderdet2.Lose_Flag__c = false;
+ Orderdet2.Box_Piece__c = '涓�';
+ Orderdet2.Sterilization_limit__c= Date.today();
+ Orderdet2.Return_date__c = Date.today();
+ Orderdet2.Bar_Code__c = '1683272847250250WZIOF';
+ Orderdet2.Cancellation_Flag__c = FALSE;
+ conList.add(Orderdet2);
+
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Send_Date__c = null;
+ Orderdet3.Used_date__c = null;
+ Orderdet3.Return_date__c = null;
+ Orderdet3.Lose_Flag__c = FALSE;
+ Orderdet3.Cancellation_Flag__c = FALSE;
+ Orderdet3.Bar_Code__c = '1234';
+ Orderdet3.Consumable_order_minor__c = Order2.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet3.Consumable_Arrived_order__c = Order2.Id;
+ Orderdet3.Recordtypeid = '01210000000kUDKAA2';
+ Orderdet3.Sterilization_limit__c = Date.today().addDays(1);
+ conList.add(Orderdet3);
+ insert conList;
+ System.debug('conList==>'+conList);
+
+
+ LexInventoryViewController.category1 = category1;
+ LexInventoryViewController.Category3 = Category3;
+ LexInventoryViewController.Category4 = Category4;
+ LexInventoryViewController.Category5 = Category5;
+ // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
+ LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC ,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
+ LexInventoryViewController.categoryAllload('CDS','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ LexInventoryViewController.categoryAllload('鍏夋簮','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC ,accountName,agencyProType,
+ // userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
+ }
+
}
- }
+ static testMethod void supplementTest(){
+ user myUser_test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ system.runAs(thisUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '娣卞湷');
+ insert myUser_test;
+ }
+ System.runAs(myUser_test) {
+ Product2 prod05 = new Product2(Name='3400PK:PK閽� 5mmx33cm',ProductCode='Test01',Asset_Model_No__c = '3400PK:PK閽� 5mmx33cm',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test001',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ Product2 prod06 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
+ insert new Product2[]{prod05,prod06};
+ Product2__c pro11 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod05.Id,Category3_text__c = '鍒嗙被3');
+ Product2__c pro22 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod06.Id);
+ insert new Product2__c[] {pro11, pro22};
+ System.debug('pro11===>'+pro11);
- static testMethod void InventoryViewSearchTest() {
- user myUser_test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_test;
- }
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍙戣揣
+ Consumable_order__c Order4 = new Consumable_order__c();
+ Order4.Name = 'OCM_0122';
+ Order4.Order_status__c = '鎵瑰噯';
+ Order4.Order_type__c = '璁㈠崟';
+ Order4.Dealer_Info__c = myAccount1.Id;
+ Order4.RecordTypeid = '01210000000c9drAAA';
+ Order4.Order_ProType__c = 'ET';
+ Order4.ContractNo__c = '';
+ orderList.add(Order4);
+ insert orderList;
- System.runAs(myUser_test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = '鍏跺畠',
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Category3__c = 'ENT',
- Category4__c = 'Celon',
- Category5__c = 'Celon',
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Category3__c = 'US',
- Category4__c = 'ALOKA',
- Category5__c = '浣撳瓒呭0',
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Category3__c = 'OCS',
- Category4__c = '闄勫睘鍝�',
- Category5__c = 'S45',
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Category3__c = '鍏夋簮',
- Category4__c = '闄勫睘鍝�',
- Category5__c = 'OCS',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03, prod04, prod05 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod04.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod05.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3, pro4, pro5 };
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //orderDetZaiku init
+ Consumable_order_details2__c con1 = new Consumable_order_details2__c();
+ con1.Arrive_date__c = Date.today();
+ con1.Send_Date__c = null;
+ con1.Used_date__c = null;
+ con1.Return_date__c = null;
+ con1.Lose_Flag__c = FALSE;
+ con1.Cancellation_Flag__c = FALSE;
+ con1.Bar_Code__c = '1234';
+ // con1.Consumable_order_minor__c = Order2.Id;
+ con1.Consumable_Product__c = pro11.Id;
+ con1.Consumable_Arrived_order__c = Order4.Id;
+ con1.Recordtypeid = '01210000000kUDKAA2';
+ // con1.Sterilization_limit__c = Date.today().addDays(1);
+ conList.add(con1);
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Inventory;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
+ Consumable_order_details2__c con2 = new Consumable_order_details2__c();
+ con2.Arrive_date__c = Date.today();
+ con2.Send_Date__c = null;
+ con2.Used_date__c = null;
+ con2.Return_date__c = null;
+ con2.Lose_Flag__c = FALSE;
+ con2.Cancellation_Flag__c = FALSE;
+ con2.Bar_Code__c = '1234';
+ // con1.Consumable_order_minor__c = Order2.Id;
+ con2.Consumable_Product__c = pro11.Id;
+ con2.Consumable_Arrived_order__c = Order4.Id;
+ con2.Recordtypeid = '01210000000kUDKAA2';
+ con2.Box_Piece__c = '涓�';
+ // con1.Sterilization_limit__c = Date.today().addDays(1);
+ conList.add(con2);
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Consumable_Arrived_order__c = Order1.Id;
- Orderdet1.Sterilization_limit__c = Date.today();
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '11111';
- Orderdet1.Arrive_date__c = Date.today().addDays(1);
- Orderdet1.Send_Date__c = null;
- Orderdet1.Used_date__c = null;
- Orderdet1.Lose_Flag__c = false;
+ insert conList;
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- Orderdet2.Sterilization_limit__c = Date.today();
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222';
- Orderdet2.Arrive_date__c = Date.today().addDays(1);
- Orderdet2.Send_Date__c = null;
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
- Integer pageSizeLWC = 1;
- Integer pageTokenLWC = 0;
- String sortFieldLWC = '';
- String sortOrderLWC = '';
- String category3LWC = 'CDS';
- String agencyProTypeLWC = 'ENG';
- String category1 = '3400PK:PK閽� 5mm脳33cm';
- String Category3 = '鑵硅厰闀滄墜鏈�';
- String Category4 = 'PK';
- String Category5 = 'G400';
- String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
- string agencyProType = 'ENG';
- string userWorkLocation = '娣卞湷';
- List<String> orderDetZaikuListLWC = new List<String>();
-
- LexInventoryViewController.init(
- pageSizeLWC,
- pageTokenLWC,
- sortFieldLWC,
- sortOrderLWC
- );
- LexInventoryViewController.categoryAllload(
- category3LWC,
- agencyProTypeLWC
- );
- LexInventoryViewController.categoryload();
- // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- }
- }
-
- //add by rentx 2020-12-25 start 鏌ヨ闈炲尰闄㈢壒浠风洅 /涓�
- static testMethod void InventoryViewTest2() {
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- //Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ]; //20200916 ljh update
-
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- System.Test.startTest();
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c createId = new Consumable_order__c();
- createId.Name = 'testMing';
- createId.Order_status__c = '鎵瑰噯';
- createId.Deliver_date__c = Date.today();
- createId.Dealer_Info__c = myAccount2.Id;
- createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createId.Order_type__c = '璁㈠崟';
- createId.Order_ProType__c = 'ET';
- createId.Dealer_Info__c = myAccount2.Id;
- createId.Delivery_detail_count__c = 5;
- insert createId;
- //pro1 鐩� 鍦ㄥ簱
- List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
- createDetail2 = new Consumable_order_details2__c();
- createDetail2.Consumable_Product__c = pro1.id;
- createDetail2.Asset_Model_No__c = 'Test01';
- createDetail2.Consumable_order_minor__c = createId.id;
- createDetail2.Consumable_Arrived_order__c = createId.id;
- createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetail2.Bar_Code__c = '123';
- createDetail2.Box_Piece__c = '鐩�';
- createDetail2.Arrive_date__c = Date.today();
- codListTemp.add(createDetail2);
- //insert createDetail2;
- Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
- createDetailpro1.Consumable_Product__c = pro1.id;
- createDetailpro1.Asset_Model_No__c = 'Test02';
- createDetailpro1.Consumable_order_minor__c = createId.id;
- createDetailpro1.Consumable_Arrived_order__c = createId.id;
- createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailpro1.Bar_Code__c = '12322';
- createDetailpro1.Box_Piece__c = '鐩�';
- createDetailpro1.Arrive_date__c = Date.today();
- codListTemp.add(createDetailpro1);
- //insert createDetailpro1;
- //pro1 涓� 鍦ㄥ簱
- Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
- createDetailPiece1.Consumable_Product__c = pro1.id;
- createDetailPiece1.Asset_Model_No__c = 'Test03';
- createDetailPiece1.Consumable_order_minor__c = createId.id;
- createDetailPiece1.Consumable_Arrived_order__c = createId.id;
- createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailPiece1.Bar_Code__c = '23456';
- createDetailPiece1.Box_Piece__c = '涓�';
- createDetailPiece1.Arrive_date__c = Date.today();
- codListTemp.add(createDetailPiece1);
- //insert createDetailPiece1;
- Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
- createDetailPiece2.Consumable_Product__c = pro1.id;
- createDetailPiece2.Asset_Model_No__c = 'Test04';
- createDetailPiece2.Consumable_order_minor__c = createId.id;
- createDetailPiece2.Consumable_Arrived_order__c = createId.id;
- createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailPiece2.Bar_Code__c = '122345';
- createDetailPiece2.Box_Piece__c = '涓�';
- createDetailPiece2.Arrive_date__c = Date.today();
- codListTemp.add(createDetailPiece2);
- //insert createDetailPiece2;
-
- //pro1 鐩� 鍦ㄥ簱 杩囨湡
- Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
- createDetail21.Consumable_Product__c = pro1.id;
- createDetail21.Asset_Model_No__c = 'Test01';
- createDetail21.Sterilization_limit__c = Date.today();
- createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- //createDetail.IsArrival__c = true;
- createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
- createDetail21.Bar_Code__c = '1223';
- createDetail21.Box_Piece__c = '鐩�';
- createDetail21.Arrive_date__c = Date.today();
- createDetail21.Deliver_date__c = Date.today().addDays(-8);
- createDetail21.Sterilization_limit__c = Date.today().addDays(-8);
- codListTemp.add(createDetail21);
- //insert createDetail2;
- insert codListTemp;
-
- PageReference page = new PageReference('/apex/TopPage');
- System.Test.setCurrentPage(page);
- TopPageController lPCTest = new TopPageController();
- lPCTest.pagesize = 1;
- List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
- Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
- conOrderDetail1.Consumable_count__c = 10;
- conOrderDetail1.Consumable_Arrivecount__c = 5;
- conOrderDetail1.Consumable_product__c = pro2.id;
- conOrderDetail1.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail1);
-
- Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
- conOrderDetail2.Consumable_product__c = pro2.id;
- conOrderDetail2.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail2);
- insert coListTest;
-
- Integer pageSizeLWC = 1;
- Integer pageTokenLWC = 0;
- String sortFieldLWC = '';
- String sortOrderLWC = '';
- String category3LWC = 'CDS';
- String agencyProTypeLWC = 'ENG';
- // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- LexInventoryViewController.categoryAllload(
- 'CDS',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- LexInventoryViewController.categoryAllload(
- '鍏夋簮',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- System.Test.stopTest();
- }
- }
-
- static testMethod void InventoryViewTest3() {
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- //Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�'];
- // Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(Email)'];//20200916 ljh update
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ]; //20210329 RTX update
-
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert MyUser_Test;
- }
-
- System.runAs(MyUser_Test) {
- System.Test.startTest();
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c createId = new Consumable_order__c();
- createId.Name = 'testMing1';
- createId.Order_status__c = '鎵瑰噯';
- createId.Deliver_date__c = Date.today();
- createId.Dealer_Info__c = myAccount2.Id;
- createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createId.Order_type__c = '璁㈠崟';
- createId.Order_ProType__c = 'ENG';
- createId.Dealer_Info__c = myAccount2.Id;
- createId.Delivery_detail_count__c = 5;
- createId.orderPattern__c = 'hospitalorder';
- insert createId;
- //pro1 鐩� 鍦ㄥ簱
- Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
- createDetail2.Consumable_Product__c = pro1.id;
- createDetail2.Asset_Model_No__c = 'Test01';
- createDetail2.Consumable_order_minor__c = createId.id;
- createDetail2.Consumable_Arrived_order__c = createId.id;
- createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetail2.Bar_Code__c = '123';
- createDetail2.Box_Piece__c = '鐩�';
- createDetail2.Arrive_date__c = Date.today();
- insert createDetail2;
- List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
- createDetailpro1.Consumable_Product__c = pro1.id;
- createDetailpro1.Asset_Model_No__c = 'Test02';
- createDetailpro1.Consumable_order_minor__c = createId.id;
- createDetailpro1.Consumable_Arrived_order__c = createId.id;
- createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailpro1.Bar_Code__c = '12322';
- createDetailpro1.Box_Piece__c = '鐩�';
- createDetailpro1.Arrive_date__c = Date.today();
- //insert createDetailpro1;
- codListTemp.add(createDetailpro1);
- //pro1 涓� 鍦ㄥ簱
- Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
- createDetailPiece1.Consumable_Product__c = pro1.id;
- createDetailPiece1.Asset_Model_No__c = 'Test03';
- createDetailPiece1.Consumable_order_minor__c = createId.id;
- createDetailPiece1.Consumable_Arrived_order__c = createId.id;
- createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailPiece1.Bar_Code__c = '23456';
- createDetailPiece1.Box_Piece__c = '涓�';
- createDetailPiece1.Arrive_date__c = Date.today();
- codListTemp.add(createDetailPiece1);
- //insert createDetailPiece1;
- Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
- createDetailPiece2.Consumable_Product__c = pro1.id;
- createDetailPiece2.Asset_Model_No__c = 'Test04';
- createDetailPiece2.Consumable_order_minor__c = createId.id;
- createDetailPiece2.Consumable_Arrived_order__c = createId.id;
- createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
- createDetailPiece2.Bar_Code__c = '122345';
- createDetailPiece2.Box_Piece__c = '涓�';
- createDetailPiece2.Arrive_date__c = Date.today();
- codListTemp.add(createDetailPiece2);
- //insert createDetailPiece2;
-
- //pro1 鐩� 鍦ㄥ簱 杩囨湡
- Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
- createDetail21.Consumable_Product__c = pro1.id;
- createDetail21.Asset_Model_No__c = 'Test01';
- createDetail21.Sterilization_limit__c = Date.today();
- createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- //createDetail.IsArrival__c = true;
- createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
- createDetail21.Bar_Code__c = '1223';
- createDetail21.Box_Piece__c = '鐩�';
- createDetail21.Arrive_date__c = Date.today();
- createDetail21.Deliver_date__c = Date.today().addDays(-8);
- createDetail21.Sterilization_limit__c = Date.today().addDays(-8);
- codListTemp.add(createDetail21);
- //insert createDetail21;
- insert codListTemp;
-
- PageReference page = new PageReference('/apex/TopPage');
- System.Test.setCurrentPage(page);
- TopPageController lPCTest = new TopPageController();
- lPCTest.pagesize = 1;
- List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
- Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
- conOrderDetail1.Consumable_count__c = 10;
- conOrderDetail1.Consumable_Arrivecount__c = 5;
- conOrderDetail1.Consumable_product__c = pro2.id;
- conOrderDetail1.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail1);
-
- Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
- conOrderDetail2.Consumable_product__c = pro2.id;
- conOrderDetail2.Consumable_order__c = createId.Id;
- coListTest.add(conOrderDetail2);
- insert coListTest;
-
- Integer pageSizeLWC = 1;
- Integer pageTokenLWC = 0;
- String sortFieldLWC = '';
- String sortOrderLWC = '';
- String category1 = '3400PK:PK閽� 5mm脳33cm';
- String Category3 = '鑵硅厰闀滄墜鏈�';
- String Category4 = 'PK';
- String Category5 = 'G400';
- List<String> orderDetZaikuListLWC = new List<String>();
- String accountName = '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�';
- string agencyProType = 'ET';
- string userWorkLocation = '娣卞湷';
- LexInventoryViewController.category1 = category1;
- LexInventoryViewController.Category3 = Category3;
- LexInventoryViewController.Category4 = Category4;
- LexInventoryViewController.Category5 = Category5;
- // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- LexInventoryViewController.categoryAllload(
- 'CDS',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- LexInventoryViewController.categoryAllload(
- '鍏夋簮',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- }
- }
- static testMethod void InventoryViewTest4() {
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ]; //20210329 RTX update
-
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '娴庡崡'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- Integer pageSizeLWC = 1;
- Integer pageTokenLWC = 0;
- String sortFieldLWC = '';
- String sortOrderLWC = '';
- String category1 = '3400PK:PK閽� 5mm脳33cm';
- String Category3 = '鑵硅厰闀滄墜鏈�';
- String Category4 = 'PK';
- String Category5 = 'G400';
- String accountName = 'Testaccount002';
- string agencyProType = 'ET';
- string userWorkLocation = '娴庡崡';
- List<String> orderDetZaikuListLWC = new List<String>();
- List<String> productCodeList = new List<String>();
-
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = '12124',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ENG';
- insert Order1;
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_003';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order2.Order_ProType__c = 'ET';
- insert Order2;
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
-
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- //Orderdet2.Consumable_principal__c = Order1.Id;
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Consumable_Arrived_order__c = Order1.Id;
- //Orderdet2.IsArrival__c = true;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222';
- Orderdet2.Arrive_date__c = Date.today().addDays(1);
- Orderdet2.Send_Date__c = null;
- Orderdet2.Used_date__c = Date.today();
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Box_Piece__c = '涓�';
- Orderdet2.Sterilization_limit__c = Date.today();
- Orderdet2.Return_date__c = Date.today();
- Orderdet2.Bar_Code__c = '1683272847250250WZIOF';
- Orderdet2.Cancellation_Flag__c = false;
- conList.add(Orderdet2);
-
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Send_Date__c = null;
- Orderdet3.Used_date__c = null;
- Orderdet3.Return_date__c = null;
- Orderdet3.Lose_Flag__c = false;
- Orderdet3.Cancellation_Flag__c = false;
- Orderdet3.Bar_Code__c = '1234';
- Orderdet3.Consumable_order_minor__c = Order2.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet3.Consumable_Arrived_order__c = Order2.Id;
- Orderdet3.Recordtypeid = '01210000000kUDKAA2';
- Orderdet3.Sterilization_limit__c = Date.today().addDays(1);
- conList.add(Orderdet3);
- insert conList;
- System.debug('conList==>' + conList);
-
- LexInventoryViewController.category1 = category1;
- LexInventoryViewController.Category3 = Category3;
- LexInventoryViewController.Category4 = Category4;
- LexInventoryViewController.Category5 = Category5;
- // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
- LexInventoryViewController.searchConsumableorderdetails(
- category1,
- category3,
- category4,
- category5,
- orderDetZaikuListLWC,
- accountName,
- agencyProType,
- userWorkLocation,
- pageSizeLWC,
- pageTokenLWC,
- sortFieldLWC,
- sortOrderLWC,
- productkucunLWC
- );
- LexInventoryViewController.categoryAllload(
- 'CDS',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- LexInventoryViewController.categoryAllload(
- '鍏夋簮',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC ,accountName,agencyProType,
- // userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
- }
-
- }
- static testMethod void supplementTest() {
- user myUser_test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
-
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '娣卞湷'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- Product2 prod05 = new Product2(
- Name = '3400PK:PK閽� 5mmx33cm',
- ProductCode = 'Test01',
- Asset_Model_No__c = '3400PK:PK閽� 5mmx33cm',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test001',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 12,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'tset',
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod05, prod06 };
- Product2__c pro11 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod05.Id,
- Category3_text__c = '鍒嗙被3'
- );
- Product2__c pro22 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro11, pro22 };
- System.debug('pro11===>' + pro11);
-
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍙戣揣
- Consumable_order__c Order4 = new Consumable_order__c();
- Order4.Name = 'OCM_0122';
- Order4.Order_status__c = '鎵瑰噯';
- Order4.Order_type__c = '璁㈠崟';
- Order4.Dealer_Info__c = myAccount1.Id;
- Order4.RecordTypeid = '01210000000c9drAAA';
- Order4.Order_ProType__c = 'ET';
- Order4.ContractNo__c = '';
- orderList.add(Order4);
- insert orderList;
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //orderDetZaiku init
- Consumable_order_details2__c con1 = new Consumable_order_details2__c();
- con1.Arrive_date__c = Date.today();
- con1.Send_Date__c = null;
- con1.Used_date__c = null;
- con1.Return_date__c = null;
- con1.Lose_Flag__c = false;
- con1.Cancellation_Flag__c = false;
- con1.Bar_Code__c = '1234';
- // con1.Consumable_order_minor__c = Order2.Id;
- con1.Consumable_Product__c = pro11.Id;
- con1.Consumable_Arrived_order__c = Order4.Id;
- con1.Recordtypeid = '01210000000kUDKAA2';
- // con1.Sterilization_limit__c = Date.today().addDays(1);
- conList.add(con1);
-
- Consumable_order_details2__c con2 = new Consumable_order_details2__c();
- con2.Arrive_date__c = Date.today();
- con2.Send_Date__c = null;
- con2.Used_date__c = null;
- con2.Return_date__c = null;
- con2.Lose_Flag__c = false;
- con2.Cancellation_Flag__c = false;
- con2.Bar_Code__c = '1234';
- // con1.Consumable_order_minor__c = Order2.Id;
- con2.Consumable_Product__c = pro11.Id;
- con2.Consumable_Arrived_order__c = Order4.Id;
- con2.Recordtypeid = '01210000000kUDKAA2';
- con2.Box_Piece__c = '涓�';
- // con1.Sterilization_limit__c = Date.today().addDays(1);
- conList.add(con2);
-
- insert conList;
-
- LexInventoryViewController.ESetId = '1111';
- LexInventoryViewController.idCheck = '2222';
- List<String> orderDetZaikuListLWC = new List<String>();
- LexInventoryViewController.init(1, 0, '', '');
- orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
- LexInventoryViewController.categoryAllload(
- 'CDS',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- LexInventoryViewController.categoryAllload(
- '鍏夋簮',
- '鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�'
- );
- LexInventoryViewController.categoryload();
- Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
- LexInventoryViewController.searchConsumableorderdetails(
- '3400PK:PK閽� 5mmx33cm',
- '',
- '',
- '',
- orderDetZaikuListLWC,
- 'testaccount001',
- 'ET',
- '娣卞湷',
- 1,
- 0,
- '',
- '',
- productkucunLWC
- );
- }
- }
-}
+ LexInventoryViewController.ESetId = '1111';
+ LexInventoryViewController.idCheck = '2222';
+ List<String> orderDetZaikuListLWC = new List<String>();
+ LexInventoryViewController.init(1,0,'','');
+ orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
+ LexInventoryViewController.categoryAllload('CDS','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ LexInventoryViewController.categoryAllload('鍏夋簮','鎹峰皵鍖荤枟(娴峰崡锛夋湁闄愬叕鍙�');
+ LexInventoryViewController.categoryload();
+ Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
+ LexInventoryViewController.searchConsumableorderdetails('3400PK:PK閽� 5mmx33cm','','','',orderDetZaikuListLWC ,'testaccount001','ET','娣卞湷',1,0,'','',productkucunLWC);
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml b/force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
index d3aded3..59ba1c8 100644
--- a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
+++ b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
@@ -1,226 +1,113 @@
@IsTest
private class LexLicenceReminderControllerTest {
- @IsTest
- static void testMethod1() {
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- LicenceReminderDate__c l = new LicenceReminderDate__c(
- Name = '180Days',
- ReminderDays__c = 180
- );
- insert l;
- Test.startTest();
- System.runAs(currentUser) {
- LexLicenceReminderController.initReminder();
+ @IsTest
+ static void testMethod1(){
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180);
+ insert l;
+ Test.startTest();
+ System.runAs(currentUser){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- Test.stopTest();
- }
- @IsTest
- static void testMethod2() {
- Account myAccount1 = new Account();
- Contact core = new Contact();
- User myUser_test = new User();
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- LicenceReminderDate__c l = new LicenceReminderDate__c(
- Name = '180Days',
- ReminderDays__c = 180
- );
- insert l;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
+ @IsTest
+ static void testMethod2(){
+ Account myAccount1 = new Account();
+ Contact core = new Contact();
+ User myUser_test = new User();
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180);
+ insert l;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_test;
+ }
+ Test.startTest();
+ System.runAs(myUser_test){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
+ }
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_test;
+ @IsTest
+ static void testMethod3(){
+ Account myAccount1 = new Account();
+ Contact core = new Contact();
+ User myUser_test = new User();
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180);
+ insert l;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900',Medical_Equipment_Expiration_Date__c = Date.newInstance(2023, 6, 10));
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_test;
+ }
+ Test.startTest();
+ System.runAs(myUser_test){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- Test.startTest();
- System.runAs(myUser_test) {
- LexLicenceReminderController.initReminder();
- }
- Test.stopTest();
- }
- @IsTest
- static void testMethod3() {
- Account myAccount1 = new Account();
- Contact core = new Contact();
- User myUser_test = new User();
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- LicenceReminderDate__c l = new LicenceReminderDate__c(
- Name = '180Days',
- ReminderDays__c = 180
- );
- insert l;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
-
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900',
- Medical_Equipment_Expiration_Date__c = Date.newInstance(2023, 6, 10)
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_test;
+ @IsTest
+ static void testMethod4(){
+ Account myAccount1 = new Account();
+ Contact core = new Contact();
+ User myUser_test = new User();
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180);
+ insert l;
+ System.runAs(currentUser){
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+
+ myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900',Medical_Equipment_Expiration_Date__c = Date.newInstance(2025, 6, 10));
+ insert myAccount1;
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_test;
+ }
+ Test.startTest();
+ System.runAs(myUser_test){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- Test.startTest();
- System.runAs(myUser_test) {
- LexLicenceReminderController.initReminder();
- }
- Test.stopTest();
- }
-
- @IsTest
- static void testMethod4() {
- Account myAccount1 = new Account();
- Contact core = new Contact();
- User myUser_test = new User();
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- LicenceReminderDate__c l = new LicenceReminderDate__c(
- Name = '180Days',
- ReminderDays__c = 180
- );
- insert l;
- System.runAs(currentUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
-
- myAccount1 = new Account(
- name = 'testaccount001',
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
- AgentCode_Ext__c = '9999900',
- Medical_Equipment_Expiration_Date__c = Date.newInstance(2025, 6, 10)
- );
- insert myAccount1;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'testUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_test;
- }
- Test.startTest();
- System.runAs(myUser_test) {
- LexLicenceReminderController.initReminder();
- }
- Test.stopTest();
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexOutboundorderImportController.cls b/force-app/main/default/classes/LexOutboundorderImportController.cls
index af454e1..aad8163 100644
--- a/force-app/main/default/classes/LexOutboundorderImportController.cls
+++ b/force-app/main/default/classes/LexOutboundorderImportController.cls
@@ -1,1054 +1,918 @@
public without sharing class LexOutboundorderImportController {
- //缁忛攢鍟嗕骇鍝佸垎绫�
- public static String agencyProType { get; set; }
- private static String sqlagencyProType;
- public static Blob csvFileBody { get; set; }
- public static string csvAsString { get; set; }
- public static String[] csvFileLines { get; set; }
- public static List<ConsumableorderdetailsInfo> orderRecords { get; set; }
- public static List<String[]> csvRecordStr { get; set; }
- public static Map<String, String> hospitalconMap { get; set; }
- public static Map<String, String> product2conMap { get; set; }
- public static Map<String, String> hospitalSysMap { get; set; }
- public static Map<String, String> secondAgencyMap { get; set; }
- private static String accountid { get; set; }
- private static String accountName { get; set; }
- private static Integer messageCount;
- public static boolean saveFLGbln { get; set; }
- private static List<String> barcodeList { get; set; }
- private static List<String> barcodePieceList { get; set; }
- public static Map<String, Integer> barcodePieceMap { get; set; }
- public static boolean errorflg { get; set; }
- public static String errorMessage { get; set; }
- private static String userWorkLocation { get; set; }
- public static String errorMsg { get; set; }
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType { get; set; }
+ private static String sqlagencyProType;
+ public static Blob csvFileBody { get; set; }
+ public static string csvAsString { get; set; }
+ public static String[] csvFileLines { get; set; }
+ public static List<ConsumableorderdetailsInfo> orderRecords { get; set; }
+ public static List<String[]> csvRecordStr { get; set; }
+ public static Map<String, String> hospitalconMap { get; set; }
+ public static Map<String, String> product2conMap { get; set; }
+ public static Map<String, String> hospitalSysMap { get; set; }
+ public static Map<String, String> secondAgencyMap { get; set; }
+ private static String accountid { get; set; }
+ private static String accountName { get; set; }
+ private static Integer messageCount;
+ public static boolean saveFLGbln { get; set; }
+ private static List<String> barcodeList { get; set; }
+ private static List<String> barcodePieceList { get; set; }
+ public static Map<String, Integer> barcodePieceMap { get; set; }
+ public static boolean errorflg { get; set; }
+ public static String errorMessage { get; set; }
+ private static String userWorkLocation { get; set; }
+ public static String errorMsg { get; set; }
- @AuraEnabled
- public static ResponseBodyLWC init() {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- messageCount = 0;
- errorflg = false;
- errorMessage = null;
- User useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :UserInfo.getUserId()
- ];
- accountid = Useracc.accountid;
- userWorkLocation = Useracc.Work_Location__c;
- agencyProType = Useracc.UserPro_Type__c;
- if (String.isBlank(Useracc.UserPro_Type__c)) {
- agencyProType = 'ET';
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ messageCount = 0;
+ errorflg = false;
+ errorMessage = null;
+ User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountid = Useracc.accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.name;
+
+ data.put('accountid', accountid);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('accountName', accountName);
+ data.put('sqlagencyProType', sqlagencyProType);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ System.debug('res:' + res);
+ return res;
}
- sqlagencyProType = '%' + agencyProType + '%';
- Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
- accountName = accountInfo.name;
- data.put('accountid', accountid);
- data.put('userWorkLocation', userWorkLocation);
- data.put('agencyProType', agencyProType);
- data.put('accountName', accountName);
- data.put('sqlagencyProType', sqlagencyProType);
- res.status = 'Success';
- res.code = 200;
- res.msg = '';
- System.debug('res:' + res);
- return res;
- }
+ @AuraEnabled
+ public static ResponseBodyLWC importCSVFile(
+ String base64DataLwc,
+ String sqlagencyProTypeLwc,
+ String userWorkLocationLwc,
+ String accountNameLwc
+ ) {
+ System.debug('enter importCSVFile');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- @AuraEnabled
- public static ResponseBodyLWC importCSVFile(
- String base64DataLwc,
- String sqlagencyProTypeLwc,
- String userWorkLocationLwc,
- String accountNameLwc
- ) {
- System.debug('enter importCSVFile');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ errorMsg = '';
+ sqlagencyProType = sqlagencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+ accountName = accountNameLwc;
+ String base64Data = EncodingUtil.urlDecode(base64DataLwc, 'UTF-8');
+ csvFileBody = EncodingUtil.base64Decode(base64Data);
+ product2conMap = new Map<String, String>();
- errorMsg = '';
- sqlagencyProType = sqlagencyProTypeLwc;
- userWorkLocation = userWorkLocationLwc;
- accountName = accountNameLwc;
- String base64Data = EncodingUtil.urlDecode(base64DataLwc, 'UTF-8');
- csvFileBody = EncodingUtil.base64Decode(base64Data);
- product2conMap = new Map<String, String>();
-
- messageCount = 0;
- errormessage = null;
- saveFLGbln = false;
- csvRecordStr = new List<String[]>();
- barcodeList = new List<String>();
- barcodePieceMap = new Map<String, Integer>();
- barcodePieceList = new List<String>();
- orderRecords = new List<ConsumableorderdetailsInfo>();
- hospitalconMap = new Map<String, String>();
- if (csvFileBody == null) {
- errorflg = true;
- saveFLGbln = true;
- // errormessage = '璇诲彇鍐呭涓虹┖銆�';
- return new ResponseBodyLWC('Error', 500, '璇诲彇鍐呭涓虹┖銆�', '');
- } else {
- //浜у搧鏁版嵁鏌ユ壘
- map<string, string> orderNameMap = new Map<string, string>();
- try {
- csvAsString = csvFileBody.toString();
- csvFileLines = csvAsString.split('\n');
- for (Integer i = 0; i < csvFileLines.size(); i++) {
- string[] csvRecordData = csvFileLines[i].split(',');
- if (String.isNotBlank(csvRecordData[6])) {
- barcodeList.add(csvRecordData[6]);
- if (String.valueOf(csvRecordData[9]) == '涓�') {
- barcodePieceList.add(csvRecordData[6]);
- barcodePieceMap.put(
- csvRecordData[6],
- Integer.valueOf(csvRecordData[7])
- );
+ messageCount = 0;
+ errormessage = null;
+ saveFLGbln = false;
+ csvRecordStr = new List<String[]>();
+ barcodeList = new List<String>();
+ barcodePieceMap = new Map<String, Integer>();
+ barcodePieceList = new List<String>();
+ orderRecords = new List<ConsumableorderdetailsInfo>();
+ hospitalconMap = new Map<String, String>();
+ if (csvFileBody == null) {
+ errorflg = true;
+ saveFLGbln = true;
+ // errormessage = '璇诲彇鍐呭涓虹┖銆�';
+ return new ResponseBodyLWC('Error', 500, '璇诲彇鍐呭涓虹┖銆�', '');
+ } else {
+ //浜у搧鏁版嵁鏌ユ壘
+ map<string, string> orderNameMap = new Map<string, string>();
+ try {
+ csvAsString = csvFileBody.toString();
+ csvFileLines = csvAsString.split('\n');
+ for (Integer i = 0; i < csvFileLines.size(); i++) {
+ string[] csvRecordData = csvFileLines[i].split(',');
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ if (String.valueOf(csvRecordData[9]) == '涓�') {
+ barcodePieceList.add(csvRecordData[6]);
+ barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7]));
+ }
+ }
+ String[] csvRecordDataStr = new String[13];
+ for (Integer j = 0; j < csvRecordData.size(); j++) {
+ csvRecordDataStr[j] = csvRecordData[j];
+ }
+ if (i == 0) {
+ csvRecordDataStr[12] = '浜у搧';
+ } else {
+ csvRecordDataStr[12] = '';
+ }
+ csvRecordStr.add(csvRecordDataStr);
+ }
+ Map<String, String> productBarcodeMap = new Map<String, String>();
+ List<Consumable_order_details2__c> cOrderDet = [
+ SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodeList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Consumable_order_details2__c pdinfo : cOrderDet) {
+ productBarcodeMap.put(pdinfo.Bar_Code__c, pdinfo.Consumable_Product__c);
+ }
+ for (String[] csvlistStr : csvRecordStr) {
+ if (productBarcodeMap.containsKey(csvlistStr[6])) {
+ csvlistStr[12] = productBarcodeMap.get(csvlistStr[6]);
+ } else {
+ }
+ }
+ //妫�绱㈠瓨鍦ㄦ媶鐩掍骇鍝佹暟閲�
+ Map<String, Integer> exitpieceBarcodeMap = new Map<String, Integer>();
+ AggregateResult[] pieceOrderDet = [
+ SELECT count(Id) cnt, Bar_Code__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodePieceList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ GROUP BY Bar_Code__c
+ ];
+ for (AggregateResult ar : pieceOrderDet) {
+ exitpieceBarcodeMap.put(String.valueOf(ar.get('Bar_Code__c')), Integer.valueOf(ar.get('cnt')));
+ }
+ for (String bc : barcodePieceList) {
+ if (!exitpieceBarcodeMap.containsKey(bc)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�')
+ // );
+ errorMsg += 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (exitpieceBarcodeMap.containsKey(bc) && exitpieceBarcodeMap.get(bc) < barcodePieceMap.get(bc)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�'));
+ errorMsg += 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ }
+ } catch (Exception e) {
+ //ApexPages.addMessages(e);
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ //return new ResponseBodyLWC('Error', 500, e.getMessage()+e.getStackTraceString(), '');
}
- }
- String[] csvRecordDataStr = new String[13];
- for (Integer j = 0; j < csvRecordData.size(); j++) {
- csvRecordDataStr[j] = csvRecordData[j];
- }
- if (i == 0) {
- csvRecordDataStr[12] = '浜у搧';
- } else {
- csvRecordDataStr[12] = '';
- }
- csvRecordStr.add(csvRecordDataStr);
- }
- Map<String, String> productBarcodeMap = new Map<String, String>();
- List<Consumable_order_details2__c> cOrderDet = [
- SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c IN :barcodeList
- AND Product_Type__c LIKE :sqlagencyProType
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- for (Consumable_order_details2__c pdinfo : cOrderDet) {
- productBarcodeMap.put(
- pdinfo.Bar_Code__c,
- pdinfo.Consumable_Product__c
- );
- }
- for (String[] csvlistStr : csvRecordStr) {
- if (productBarcodeMap.containsKey(csvlistStr[6])) {
- csvlistStr[12] = productBarcodeMap.get(csvlistStr[6]);
- } else {
- }
- }
- //妫�绱㈠瓨鍦ㄦ媶鐩掍骇鍝佹暟閲�
- Map<String, Integer> exitpieceBarcodeMap = new Map<String, Integer>();
- AggregateResult[] pieceOrderDet = [
- SELECT count(Id) cnt, Bar_Code__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c IN :barcodePieceList
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Box_Piece__c = '涓�'
- GROUP BY Bar_Code__c
- ];
- for (AggregateResult ar : pieceOrderDet) {
- exitpieceBarcodeMap.put(
- String.valueOf(ar.get('Bar_Code__c')),
- Integer.valueOf(ar.get('cnt'))
- );
- }
- for (String bc : barcodePieceList) {
- if (!exitpieceBarcodeMap.containsKey(bc)) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�')
- // );
- errorMsg += 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else if (
- exitpieceBarcodeMap.containsKey(bc) &&
- exitpieceBarcodeMap.get(bc) < barcodePieceMap.get(bc)
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�'));
- errorMsg += 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- }
- }
- } catch (Exception e) {
- //ApexPages.addMessages(e);
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- //return new ResponseBodyLWC('Error', 500, e.getMessage()+e.getStackTraceString(), '');
- }
- getorderinfo();
- dataInfoconfim();
- getorderdet2info(csvRecordStr);
- if (saveFLGbln == false) {
- getorderdetinfo(csvRecordStr);
- }
- data.put('orderRecords', orderRecords);
- data.put('saveFLGbln', saveFLGbln);
- data.put('csvRecordStr', csvRecordStr);
- data.put('barcodeList', barcodeList);
- data.put('secondAgencyMap', secondAgencyMap);
- data.put('hospitalSysMap', hospitalSysMap);
- res.status = 'Success';
- res.code = 200;
- res.msg = errorMsg;
- return res;
- }
- }
-
- public static void getorderinfo() {
- map<string, string> orderNameMap = new Map<string, string>();
- try {
- csvAsString = csvFileBody.toString();
- csvFileLines = csvAsString.split('\n');
- for (Integer i = 1; i < csvFileLines.size(); i++) {
- Consumable_order__c cocObj = new Consumable_order__c();
- string[] csvRecordData = csvFileLines[i].split(',');
- if (orderNameMap.containsKey(csvRecordData[0]))
- continue;
- cocObj.Name = csvRecordData[0];
- if (String.isNotBlank(csvRecordData[1])) {
- cocObj.SummonsForDirction__c = csvRecordData[1];
- } else {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '鍑鸿揣鐩殑涓虹┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- csvRecordData[0] +
- '鍑鸿揣鐩殑涓虹┖锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- }
- cocObj.Order_Attachment__c = csvRecordData[2];
- cocObj.Order_Indication__c = csvRecordData[3];
- cocObj.Order_ForCustomerText__c = csvRecordData[4];
- cocObj.Invoice_Note__c = csvRecordData[5];
- if (String.isBlank(csvRecordData[11])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cocObj.Name + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��')
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cocObj.Name +
- '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��<br />';
- saveFLGbln = true;
- messageCount++;
- } else {
- cocObj.Outbound_Date__c = Date.parse(csvRecordData[11].trim());
- }
- if (String.isNotEmpty(csvRecordData[2])) {
- hospitalconMap.put(csvRecordData[2].trim(), csvRecordData[0].trim());
- }
- orderNameMap.put(csvRecordData[0], csvRecordData[0]);
- orderRecords.add(new ConsumableorderdetailsInfo(cocObj));
- }
- } catch (Exception e) {
- //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- }
- }
-
- public static void dataInfoconfim() {
- //纭鍖婚櫌淇℃伅
- hospitalSysMap = new Map<String, String>();
- secondAgencyMap = new Map<String, String>();
- for (ConsumableorderdetailsInfo ass : orderRecords) {
- if (
- (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
- ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌' ||
- ass.order.SummonsForDirction__c == '鍖婚櫌璇曠敤') &&
- (String.isBlank(ass.hospitalName) ||
- String.isBlank(ass.hospitalCode) ||
- String.isBlank(ass.order.Order_ForCustomerText__c))
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��')
- // );
- errorMsg +=
- '鍑哄簱鍗�' +
- ass.order.Name +
- '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��<br />';
- messageCount++;
- saveFLGbln = true;
- //return null;
- }
- if (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
- if (String.isBlank(ass.agencyName)) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗�' +
- ass.order.Name +
- '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
- messageCount++;
- saveFLGbln = true;
- }
- }
- if (ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
- if (String.isNotBlank(ass.agencyName)) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��')
- // );
- errorMsg +=
- '鍑哄簱鍗�' +
- ass.order.Name +
- '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��<br />';
- messageCount++;
- saveFLGbln = true;
- }
- }
- if (ass.order.SummonsForDirction__c == '浜掔浉璋冭揣') {
- if (String.isBlank(ass.agencyName)) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗�' +
- ass.order.Name +
- '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
- messageCount++;
- saveFLGbln = true;
- }
- if (
- String.isNotBlank(ass.hospitalName) ||
- String.isNotBlank(ass.hospitalCode) ||
- String.isNotBlank(ass.order.Order_ForCustomerText__c)
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��')
- // );
- errorMsg +=
- '鍑哄簱鍗�' +
- ass.order.Name +
- '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��<br />';
- messageCount++;
- saveFLGbln = true;
- }
- }
- }
- System.debug('accountName = ' + accountName);
- List<Agency_Hospital_Link__c> hospitalInfo = [
- SELECT Hospital__c, Hospital__r.Management_Code__c, Hospital__r.Name
- FROM Agency_Hospital_Link__c
- WHERE Agency__r.Name = :accountName
- ];
- List<Dealer_elationship__c> secondAgencyInfo = [
- SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
- FROM Dealer_elationship__c
- WHERE Dealer_principal__r.Name = :accountName
- ];
- for (Agency_Hospital_Link__c hpinfo : hospitalInfo) {
- hospitalSysMap.put(
- hpinfo.Hospital__r.Management_Code__c,
- hpinfo.Hospital__c
- );
- }
- for (Dealer_elationship__c safo : secondAgencyInfo) {
- secondAgencyMap.put(
- safo.Dealer_subordinate__r.Name,
- safo.Dealer_subordinate__c
- );
- }
- //鍑哄簱鍗曚俊鎭獙璇�
- System.debug('hospitalconMap = ' + hospitalconMap);
- System.debug('hospitalSysMap = ' + hospitalSysMap);
- for (String widget : hospitalconMap.keySet()) {
- if (!hospitalSysMap.containsKey(widget)) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // hospitalconMap.get(widget) +
- // ' 鐨勫尰闄㈢紪鐮�' +
- // widget +
- // ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- hospitalconMap.get(widget) +
- ' 鐨勫尰闄㈢紪鐮�' +
- widget +
- ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�<br />';
- saveFLGbln = true;
- }
- }
- }
-
- public static void getorderdet2info(List<String[]> csvRecordStr) {
- barcodeList = new List<String>();
- try {
- for (Integer i = 1; i < csvRecordStr.size(); i++) {
- Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
- string[] csvRecordData = csvRecordStr[i];
- cod2Obj.TracingCode__c = csvRecordData[0];
- cod2Obj.Bar_Code__c = csvRecordData[6];
- if (String.isNotBlank(csvRecordData[6])) {
- barcodeList.add(csvRecordData[6]);
- }
- if (String.isBlank(csvRecordData[9])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '鐨刡arcode ' +
- // cod2Obj.Bar_Code__c +
- // ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '鐨刡arcode ' +
- cod2Obj.Bar_Code__c +
- ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��<br />';
- saveFLGbln = true;
- messageCount++;
- } else if (
- String.valueOf(csvRecordData[9]) != '鐩�' &&
- String.valueOf(csvRecordData[9]) != '涓�'
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '鐨刡arcode ' +
- // cod2Obj.Bar_Code__c +
- // ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '鐨刡arcode ' +
- cod2Obj.Bar_Code__c +
- ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��';
- saveFLGbln = true;
- messageCount++;
- } else {
- cod2Obj.Box_Piece__c = csvRecordData[9];
- }
- if (String.isBlank(csvRecordData[8])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else if (String.isNotBlank(csvRecordData[8])) {
- if (
- Decimal.valueOf(csvRecordData[8]) == 0 &&
- (String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌' ||
- String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�')
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else {
- cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
- }
- }
- if (String.isBlank(csvRecordData[6])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else if (String.isBlank(csvRecordData[12])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '鐨刡arcode ' +
- // cod2Obj.Bar_Code__c +
- // ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '鐨刡arcode ' +
- cod2Obj.Bar_Code__c +
- ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�';
- saveFLGbln = true;
- messageCount++;
- }
- cod2Obj.Return_reason__c = csvRecordData[12];
- if (String.isBlank(csvRecordData[11])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // cod2Obj.TracingCode__c +
- // '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- cod2Obj.TracingCode__c +
- '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��';
- saveFLGbln = true;
- messageCount++;
- } else {
- cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
- }
- }
- } catch (Exception e) {
- //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- }
- }
-
- public static void getorderdetinfo(List<String[]> csvRecordStr) {
- map<string, string> orderdetMap = new Map<string, string>();
- try {
- for (Integer i = 1; i < csvRecordStr.size(); i++) {
- Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
- string[] csvRecordData = csvRecordStr[i];
- if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12]))
- continue;
- codObj.Remarks__c = csvRecordData[0];
- if (String.isBlank(csvRecordData[7])) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- csvRecordData[0] +
- '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else if (
- Decimal.valueOf(csvRecordData[7]) > 1 &&
- String.valueOf(csvRecordData[9]) == '鐩�'
- ) {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(
- // ApexPages.severity.ERROR,
- // '鍑哄簱鍗� ' +
- // csvRecordData[0] +
- // '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�'
- // )
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- csvRecordData[0] +
- '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- } else {
- codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
- }
- codObj.Box_Piece__c = csvRecordData[9];
- if (String.isNotBlank(csvRecordData[8])) {
- codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
- } else {
- if (messageCount >= 100)
- break;
- // ApexPages.addmessage(
- // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
- // );
- errorMsg +=
- '鍑哄簱鍗� ' +
- csvRecordData[0] +
- '鍑哄簱鍗� ' +
- csvRecordData[0] +
- '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
- saveFLGbln = true;
- messageCount++;
- }
- //if(String.isNotBlank(csvRecordData[10])){
- // codObj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
- //}
- codObj.Lose_reason__c = csvRecordData[12];
- codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
- product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
- orderdetMap.put(
- csvRecordData[0] + csvRecordData[12],
- csvRecordData[0] + csvRecordData[12]
- );
- //orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
- }
- } catch (Exception e) {
- //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- }
- }
-
- @AuraEnabled
- public static ResponseBodyLWC dataImport(
- List<String[]> csvRecordStrLwc,
- String orderRecordsLwc,
- String sqlagencyProTypeLwc,
- String userWorkLocationLwc,
- String accountNameLwc,
- String accountidLwc,
- String agencyProTypeLwc,
- Map<String, String> secondAgencyMapLwc,
- Map<String, String> hospitalSysMapLwc
- ) {
- List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
- product2conMap = new Map<String, String>();
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- csvRecordStr = csvRecordStrLwc;
- orderRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- orderRecordsLwc,
- List<ConsumableorderdetailsInfo>.class
- );
- System.debug('orderRecords = ' + orderRecords);
- sqlagencyProType = sqlagencyProTypeLwc;
- userWorkLocation = userWorkLocationLwc;
- accountName = accountNameLwc;
- secondAgencyMap = secondAgencyMapLwc;
- hospitalSysMap = hospitalSysMapLwc;
- accountid = accountidLwc;
- agencyProType = agencyProTypeLwc;
- System.debug('agencyProType = ' + agencyProType);
-
- errorMsg = '';
- System.debug('csvRecordStr = ' + csvRecordStr);
- orderdetRecords = getorderdetList(csvRecordStr);
- orderdet2BoxRecords = getorderdet2BoxList(csvRecordStr);
- orderdet2PieceRecords = getorderdet2pieceList(csvRecordStr);
- System.debug('orderdetRecords = ' + orderdetRecords);
- System.debug('orderdet2BoxRecords = ' + orderdet2BoxRecords);
- System.debug('orderdet2PieceRecords = ' + orderdet2PieceRecords);
- Savepoint sp = Database.setSavepoint();
- try {
- Map<String, String> orderInfoMap = new Map<String, String>();
- List<Consumable_order__c> coc = new List<Consumable_order__c>();
- for (ConsumableorderdetailsInfo ass : orderRecords) {
- ass.order.Order_type__c = '浼犵エ';
- ass.order.SummonsStatus_c__c = '宸插畬鎴�';
- ass.order.Order_ProType__c = agencyProType;
- ass.order.Dealer_Info__c = accountid;
- ass.order.Order_ForHospital__c = hospitalSysMap.get(ass.hospitalCode);
- if (secondAgencyMap.containsKey(ass.agencyName)) {
- ass.order.Order_ForDealer__c = secondAgencyMap.get(ass.agencyName);
- } else {
- ass.order.Order_ForDealerText__c = ass.agencyName;
- }
- ass.order.RecordTypeId = System.Label.RT_ConOrder_Sale;
- coc.add(ass.order);
- }
- System.debug('coc = ' + coc);
- if (coc.size() > 0) {
- insert coc;
- }
- for (Consumable_order__c order : coc) {
- orderInfoMap.put(order.Name, order.Id);
- }
- List<Consumable_Orderdetails__c> cod = new List<Consumable_Orderdetails__c>();
- for (String field : orderInfoMap.keySet()) {
- Integer i = 1;
- for (ConsumableorderdetailsInfo ass : orderdetRecords) {
- if (ass.orderName == field) {
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
+ getorderinfo();
+ dataInfoconfim();
+ getorderdet2info(csvRecordStr);
+ if (saveFLGbln == false) {
+ getorderdetinfo(csvRecordStr);
}
- ass.orderdetails1.Name = ass.orderName + '-' + str;
- ass.orderdetails1.Consumable_order__c = orderInfoMap.get(
- ass.orderName
- );
- ass.orderdetails1.Consumable_Product__c = ass.productName;
- ass.orderdetails1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
- cod.add(ass.orderdetails1);
- i++;
- }
+ data.put('orderRecords', orderRecords);
+ data.put('saveFLGbln', saveFLGbln);
+ data.put('csvRecordStr', csvRecordStr);
+ data.put('barcodeList', barcodeList);
+ data.put('secondAgencyMap', secondAgencyMap);
+ data.put('hospitalSysMap', hospitalSysMap);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ return res;
}
- }
- System.debug('cod = ' + cod);
- if (cod.size() > 0) {
- insert cod;
- }
- //鐩掔殑鏁版嵁妫�绱�
- List<Consumable_Order_details2__c> cod2List = new List<Consumable_Order_details2__c>();
- List<Consumable_order_details2__c> cOrderDet = [
- SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c IN :barcodeList
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Box_Piece__c = '鐩�'
- ];
- for (ConsumableorderdetailsInfo ass : orderdet2BoxRecords) {
- Integer idx = 0;
- for (Consumable_order_details2__c codtest : cOrderDet) {
- Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
- if (codtest.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
- cod2 = codtest;
- cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
- cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
- cod2.Used_date__c = ass.orderdetails2.Used_date__c;
- cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
- //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
- cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
- cod2List.add(cod2);
- cOrderDet.remove(idx);
- break;
- }
- idx++;
- }
- }
+ }
- //涓殑鏁版嵁妫�绱�
- List<Consumable_order_details2__c> cOrderDetPiece = [
- SELECT
- Id,
- Bar_Code__c,
- RemoveBox_No__c,
- Name,
- Consumable_Product__c,
- Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Bar_Code__c IN :barcodePieceList
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountName
- AND Box_Piece__c = '涓�'
- ORDER BY Bar_Code__c, RemoveBox_No__c DESC
- ];
- for (ConsumableorderdetailsInfo ass : orderdet2PieceRecords) {
- Decimal idy = 1;
- for (Integer idx = 0; idx < cOrderDetPiece.size(); idx++) {
- Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
- if (
- cOrderDetPiece[idx].Bar_Code__c == ass.orderdetails2.Bar_Code__c &&
- idy <= ass.pieceCount
- ) {
- cod2 = cOrderDetPiece[idx].Clone();
- cod2.Id = cOrderDetPiece[idx].Id;
- cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
- cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
- cod2.Used_date__c = ass.orderdetails2.Used_date__c;
- cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
- //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
- cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
- cod2List.add(cod2);
- cOrderDetPiece[idx].Bar_Code__c = '';
- idy++;
- //break;
- }
+ public static void getorderinfo() {
+ map<string, string> orderNameMap = new Map<string, string>();
+ try {
+ csvAsString = csvFileBody.toString();
+ csvFileLines = csvAsString.split('\n');
+ for (Integer i = 1; i < csvFileLines.size(); i++) {
+ Consumable_order__c cocObj = new Consumable_order__c();
+ string[] csvRecordData = csvFileLines[i].split(',');
+ if (orderNameMap.containsKey(csvRecordData[0]))
+ continue;
+ cocObj.Name = csvRecordData[0];
+ if (String.isNotBlank(csvRecordData[1])) {
+ cocObj.SummonsForDirction__c = csvRecordData[1];
+ } else {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '鍑鸿揣鐩殑涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '鍑鸿揣鐩殑涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ cocObj.Order_Attachment__c = csvRecordData[2];
+ cocObj.Order_Indication__c = csvRecordData[3];
+ cocObj.Order_ForCustomerText__c = csvRecordData[4];
+ cocObj.Invoice_Note__c = csvRecordData[5];
+ if (String.isBlank(csvRecordData[11])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cocObj.Name + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cocObj.Name + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cocObj.Outbound_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ if (String.isNotEmpty(csvRecordData[2])) {
+ hospitalconMap.put(csvRecordData[2].trim(), csvRecordData[0].trim());
+ }
+ orderNameMap.put(csvRecordData[0], csvRecordData[0]);
+ orderRecords.add(new ConsumableorderdetailsInfo(cocObj));
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
}
- }
- if (cod2List.size() > 0) {
- update cod2List;
- }
- errorflg = true;
- //errorMessage = '淇濆瓨瀹屾垚銆�';
- saveFLGbln = true;
+ }
- res.status = 'Success';
- res.code = 200;
- res.msg = errorMsg;
- return res;
- } catch (Exception e) {
- Database.rollback(sp);
- // ApexPages.addMessages(e);
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getStackTraceString(),
- ''
- );
+ public static void dataInfoconfim() {
+ //纭鍖婚櫌淇℃伅
+ hospitalSysMap = new Map<String, String>();
+ secondAgencyMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfo ass : orderRecords) {
+ if (
+ (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌' ||
+ ass.order.SummonsForDirction__c == '鍖婚櫌璇曠敤') &&
+ (String.isBlank(ass.hospitalName) ||
+ String.isBlank(ass.hospitalCode) ||
+ String.isBlank(ass.order.Order_ForCustomerText__c))
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ //return null;
+ }
+ if (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
+ if (String.isBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ if (ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
+ if (String.isNotBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ if (ass.order.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ if (String.isBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ if (
+ String.isNotBlank(ass.hospitalName) ||
+ String.isNotBlank(ass.hospitalCode) ||
+ String.isNotBlank(ass.order.Order_ForCustomerText__c)
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ }
+ System.debug('accountName = ' + accountName);
+ List<Agency_Hospital_Link__c> hospitalInfo = [
+ SELECT Hospital__c, Hospital__r.Management_Code__c, Hospital__r.Name
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__r.Name = :accountName
+ ];
+ List<Dealer_elationship__c> secondAgencyInfo = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__r.Name = :accountName
+ ];
+ for (Agency_Hospital_Link__c hpinfo : hospitalInfo) {
+ hospitalSysMap.put(hpinfo.Hospital__r.Management_Code__c, hpinfo.Hospital__c);
+ }
+ for (Dealer_elationship__c safo : secondAgencyInfo) {
+ secondAgencyMap.put(safo.Dealer_subordinate__r.Name, safo.Dealer_subordinate__c);
+ }
+ //鍑哄簱鍗曚俊鎭獙璇�
+ System.debug('hospitalconMap = ' + hospitalconMap);
+ System.debug('hospitalSysMap = ' + hospitalSysMap);
+ for (String widget : hospitalconMap.keySet()) {
+ if (!hospitalSysMap.containsKey(widget)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // hospitalconMap.get(widget) +
+ // ' 鐨勫尰闄㈢紪鐮�' +
+ // widget +
+ // ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�'
+ // )
+ // );
+ errorMsg +=
+ '鍑哄簱鍗� ' +
+ hospitalconMap.get(widget) +
+ ' 鐨勫尰闄㈢紪鐮�' +
+ widget +
+ ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�<br />';
+ saveFLGbln = true;
+ }
+ }
}
- }
- public static List<ConsumableorderdetailsInfo> getorderdetList(
- List<String[]> csvRecordStr
- ) {
- List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
- map<string, Decimal> orderdetMap = new Map<string, Decimal>();
- try {
- for (Integer i = 1; i < csvRecordStr.size(); i++) {
- Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
- string[] csvRecordData = csvRecordStr[i];
- if (
- orderdetMap.containsKey(
- csvRecordData[0] + csvRecordData[12] + csvRecordData[9]
- )
- ) {
- orderdetMap.put(
- csvRecordData[0] + csvRecordData[12] + csvRecordData[9],
- orderdetMap.get(
- csvRecordData[0] + csvRecordData[12] + csvRecordData[9]
- ) + Decimal.valueOf(csvRecordData[7])
- );
- continue;
- } else {
- orderdetMap.put(
- csvRecordData[0] + csvRecordData[12] + csvRecordData[9],
- Decimal.valueOf(csvRecordData[7])
- );
+ public static void getorderdet2info(List<String[]> csvRecordStr) {
+ barcodeList = new List<String>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ string[] csvRecordData = csvRecordStr[i];
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ }
+ if (String.isBlank(csvRecordData[9])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.valueOf(csvRecordData[9]) != '鐩�' && String.valueOf(csvRecordData[9]) != '涓�') {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ }
+ if (String.isBlank(csvRecordData[8])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.isNotBlank(csvRecordData[8])) {
+ if (
+ Decimal.valueOf(csvRecordData[8]) == 0 &&
+ (String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌' ||
+ String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�')
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ }
+ if (String.isBlank(csvRecordData[6])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.isBlank(csvRecordData[12])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.isBlank(csvRecordData[11])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
}
- codObj.Remarks__c = csvRecordData[0];
- codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
- codObj.Box_Piece__c = csvRecordData[9];
- if (String.isNotBlank(csvRecordData[8])) {
- codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
- }
- codObj.Lose_reason__c = csvRecordData[12];
- if (String.isNotBlank(csvRecordData[11])) {
- codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
- }
- product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
- orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
- }
- for (ConsumableorderdetailsInfo ass : orderdetRecords) {
- if (
- orderdetMap.containsKey(
- ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c
- )
- ) {
- ass.orderdetails1.Shipment_Count__c = orderdetMap.get(
- ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c
- );
- }
- }
- System.debug('orderdetRecords = ' + orderdetRecords);
- return orderdetRecords;
- } catch (Exception e) {
- // ApexPages.addMessages(e);
- // return null;
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- System.debug('orderdetRecords = null ' + e.getLineNumber());
- return null;
}
- }
- public static List<ConsumableorderdetailsInfo> getorderdet2BoxList(
- List<String[]> csvRecordStr
- ) {
- barcodeList = new List<String>();
- List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
- try {
- for (Integer i = 1; i < csvRecordStr.size(); i++) {
- string[] csvRecordData = csvRecordStr[i];
- if (String.valueOf(csvRecordData[9]) == '鐩�') {
- Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
- cod2Obj.TracingCode__c = csvRecordData[0];
- cod2Obj.Bar_Code__c = csvRecordData[6];
- if (String.isNotBlank(csvRecordData[6])) {
- barcodeList.add(csvRecordData[6]);
- }
- cod2Obj.Box_Piece__c = csvRecordData[9];
- if (String.isNotBlank(csvRecordData[8])) {
- cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
- }
- //if(String.isNotBlank(csvRecordData[10])){
- // cod2Obj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
- //}
- cod2Obj.Return_reason__c = csvRecordData[12];
- if (
- String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
- String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌'
- ) {
- cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
- } else {
- cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
- }
- orderdet2BoxRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ public static void getorderdetinfo(List<String[]> csvRecordStr) {
+ map<string, string> orderdetMap = new Map<string, string>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
+ string[] csvRecordData = csvRecordStr[i];
+ if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12]))
+ continue;
+ codObj.Remarks__c = csvRecordData[0];
+ if (String.isBlank(csvRecordData[7])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (Decimal.valueOf(csvRecordData[7]) > 1 && String.valueOf(csvRecordData[9]) == '鐩�') {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // csvRecordData[0] +
+ // '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
+ }
+ codObj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ } else {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ //if(String.isNotBlank(csvRecordData[10])){
+ // codObj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
+ //}
+ codObj.Lose_reason__c = csvRecordData[12];
+ codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
+ orderdetMap.put(csvRecordData[0] + csvRecordData[12], csvRecordData[0] + csvRecordData[12]);
+ //orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
}
- }
- return orderdet2BoxRecords;
- } catch (Exception e) {
- // ApexPages.addMessages(e);
- // return null;
- errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
- return null;
}
- }
- public static List<ConsumableorderdetailsInfo> getorderdet2pieceList(
- List<String[]> csvRecordStr
- ) {
- barcodePieceList = new List<String>();
- List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
- try {
- for (Integer i = 1; i < csvRecordStr.size(); i++) {
- string[] csvRecordData = csvRecordStr[i];
- if (String.valueOf(csvRecordData[9]) == '涓�') {
- Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
- cod2Obj.TracingCode__c = csvRecordData[0];
- cod2Obj.Bar_Code__c = csvRecordData[6];
- if (String.isNotBlank(csvRecordData[6])) {
- barcodePieceList.add(csvRecordData[6]);
- }
- cod2Obj.Box_Piece__c = csvRecordData[9];
- if (String.isNotBlank(csvRecordData[8])) {
- cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
- }
- cod2Obj.Return_reason__c = csvRecordData[12];
- if (
- String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
- String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌'
- ) {
- cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
- } else {
- cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
- }
- cod2Obj.Rrturn_count__c = Decimal.valueOf(csvRecordData[7]);
- orderdet2PieceRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ @AuraEnabled
+ public static ResponseBodyLWC dataImport(
+ List<String[]> csvRecordStrLwc,
+ String orderRecordsLwc,
+ String sqlagencyProTypeLwc,
+ String userWorkLocationLwc,
+ String accountNameLwc,
+ String accountidLwc,
+ String agencyProTypeLwc,
+ Map<String, String> secondAgencyMapLwc,
+ Map<String, String> hospitalSysMapLwc
+ ) {
+ List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
+ product2conMap = new Map<String, String>();
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ csvRecordStr = csvRecordStrLwc;
+ orderRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class);
+ System.debug('orderRecords = ' + orderRecords);
+ sqlagencyProType = sqlagencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+ accountName = accountNameLwc;
+ secondAgencyMap = secondAgencyMapLwc;
+ hospitalSysMap = hospitalSysMapLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ System.debug('agencyProType = ' + agencyProType);
+
+ errorMsg = '';
+ System.debug('csvRecordStr = ' + csvRecordStr);
+ orderdetRecords = getorderdetList(csvRecordStr);
+ orderdet2BoxRecords = getorderdet2BoxList(csvRecordStr);
+ orderdet2PieceRecords = getorderdet2pieceList(csvRecordStr);
+ System.debug('orderdetRecords = ' + orderdetRecords);
+ System.debug('orderdet2BoxRecords = ' + orderdet2BoxRecords);
+ System.debug('orderdet2PieceRecords = ' + orderdet2PieceRecords);
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Map<String, String> orderInfoMap = new Map<String, String>();
+ List<Consumable_order__c> coc = new List<Consumable_order__c>();
+ for (ConsumableorderdetailsInfo ass : orderRecords) {
+ ass.order.Order_type__c = '浼犵エ';
+ ass.order.SummonsStatus_c__c = '宸插畬鎴�';
+ ass.order.Order_ProType__c = agencyProType;
+ ass.order.Dealer_Info__c = accountid;
+ ass.order.Order_ForHospital__c = hospitalSysMap.get(ass.hospitalCode);
+ if (secondAgencyMap.containsKey(ass.agencyName)) {
+ ass.order.Order_ForDealer__c = secondAgencyMap.get(ass.agencyName);
+ } else {
+ ass.order.Order_ForDealerText__c = ass.agencyName;
+ }
+ ass.order.RecordTypeId = System.Label.RT_ConOrder_Sale;
+ coc.add(ass.order);
+ }
+ System.debug('coc = ' + coc);
+ if (coc.size() > 0) {
+ insert coc;
+ }
+ for (Consumable_order__c order : coc) {
+ orderInfoMap.put(order.Name, order.Id);
+ }
+ List<Consumable_Orderdetails__c> cod = new List<Consumable_Orderdetails__c>();
+ for (String field : orderInfoMap.keySet()) {
+ Integer i = 1;
+ for (ConsumableorderdetailsInfo ass : orderdetRecords) {
+ if (ass.orderName == field) {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ ass.orderdetails1.Name = ass.orderName + '-' + str;
+ ass.orderdetails1.Consumable_order__c = orderInfoMap.get(ass.orderName);
+ ass.orderdetails1.Consumable_Product__c = ass.productName;
+ ass.orderdetails1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
+ cod.add(ass.orderdetails1);
+ i++;
+ }
+ }
+ }
+ System.debug('cod = ' + cod);
+ if (cod.size() > 0) {
+ insert cod;
+ }
+ //鐩掔殑鏁版嵁妫�绱�
+ List<Consumable_Order_details2__c> cod2List = new List<Consumable_Order_details2__c>();
+ List<Consumable_order_details2__c> cOrderDet = [
+ SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodeList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '鐩�'
+ ];
+ for (ConsumableorderdetailsInfo ass : orderdet2BoxRecords) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c codtest : cOrderDet) {
+ Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
+ if (codtest.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ cod2 = codtest;
+ cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Used_date__c = ass.orderdetails2.Used_date__c;
+ cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
+ //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
+ cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
+ cod2List.add(cod2);
+ cOrderDet.remove(idx);
+ break;
+ }
+ idx++;
+ }
+ }
+
+ //涓殑鏁版嵁妫�绱�
+ List<Consumable_order_details2__c> cOrderDetPiece = [
+ SELECT Id, Bar_Code__c, RemoveBox_No__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Bar_Code__c IN :barcodePieceList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Box_Piece__c = '涓�'
+ ORDER BY Bar_Code__c, RemoveBox_No__c DESC
+ ];
+ for (ConsumableorderdetailsInfo ass : orderdet2PieceRecords) {
+ Decimal idy = 1;
+ for (Integer idx = 0; idx < cOrderDetPiece.size(); idx++) {
+ Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
+ if (cOrderDetPiece[idx].Bar_Code__c == ass.orderdetails2.Bar_Code__c && idy <= ass.pieceCount) {
+ cod2 = cOrderDetPiece[idx].Clone();
+ cod2.Id = cOrderDetPiece[idx].Id;
+ cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Used_date__c = ass.orderdetails2.Used_date__c;
+ cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
+ //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
+ cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
+ cod2List.add(cod2);
+ cOrderDetPiece[idx].Bar_Code__c = '';
+ idy++;
+ //break;
+ }
+ }
+ }
+ if (cod2List.size() > 0) {
+ update cod2List;
+ }
+ errorflg = true;
+ //errorMessage = '淇濆瓨瀹屾垚銆�';
+ saveFLGbln = true;
+
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ return res;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(e);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), '');
}
- }
- return orderdet2PieceRecords;
- } catch (Exception e) {
- // ApexPages.addMessages(e);
- // return null;
- errorMsg += e.getMessage();
- return null;
}
- }
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
- @AuraEnabled
- public Consumable_order__c order { get; set; }
- @AuraEnabled
- public Consumable_orderdetails__c orderdetails1 { get; set; }
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public String orderName { get; set; }
- @AuraEnabled
- public String hospitalCode { get; set; }
- @AuraEnabled
- public String hospitalName { get; set; }
- @AuraEnabled
- public String agencyName { get; set; }
- @AuraEnabled
- public String productName { get; set; }
- @AuraEnabled
- public Decimal pieceCount { get; set; }
- // 鍙栧埌鐨勮鍗曚俊鎭�
- public ConsumableorderdetailsInfo(Consumable_order__c e) {
- order = e;
- hospitalCode = e.Order_Attachment__c;
- hospitalName = e.Order_Indication__c;
- agencyName = e.Invoice_Note__c;
- e.Order_Attachment__c = '';
- e.Order_Indication__c = '';
- e.Invoice_Note__c = '';
+
+ public static List<ConsumableorderdetailsInfo> getorderdetList(List<String[]> csvRecordStr) {
+ List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
+ map<string, Decimal> orderdetMap = new Map<string, Decimal>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
+ string[] csvRecordData = csvRecordStr[i];
+ if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) {
+ orderdetMap.put(
+ csvRecordData[0] + csvRecordData[12] + csvRecordData[9],
+ orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7])
+ );
+ continue;
+ } else {
+ orderdetMap.put(csvRecordData[0] + csvRecordData[12] + csvRecordData[9], Decimal.valueOf(csvRecordData[7]));
+ }
+ codObj.Remarks__c = csvRecordData[0];
+ codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
+ codObj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ codObj.Lose_reason__c = csvRecordData[12];
+ if (String.isNotBlank(csvRecordData[11])) {
+ codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ }
+ product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
+ orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
+ }
+ for (ConsumableorderdetailsInfo ass : orderdetRecords) {
+ if (orderdetMap.containsKey(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c)) {
+ ass.orderdetails1.Shipment_Count__c = orderdetMap.get(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c);
+ }
+ }
+ System.debug('orderdetRecords = ' + orderdetRecords);
+ return orderdetRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ System.debug('orderdetRecords = null ' + e.getLineNumber());
+ return null;
+ }
}
- // 鍙栧埌鐨勮鍗曟槑缁�
- public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
- orderdetails1 = e;
- orderName = e.Remarks__c;
- productName = e.Lose_reason__c;
- e.Lose_reason__c = '';
- e.Remarks__c = '';
+
+ public static List<ConsumableorderdetailsInfo> getorderdet2BoxList(List<String[]> csvRecordStr) {
+ barcodeList = new List<String>();
+ List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ string[] csvRecordData = csvRecordStr[i];
+ if (String.valueOf(csvRecordData[9]) == '鐩�') {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ }
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ //if(String.isNotBlank(csvRecordData[10])){
+ // cod2Obj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
+ //}
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' || String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌') {
+ cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ orderdet2BoxRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ }
+ }
+ return orderdet2BoxRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ return null;
+ }
}
- // 鍙栧埌鐨勪骇鍝佹槑缁�
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- orderdetails2 = e;
- orderName = e.TracingCode__c;
- productName = e.Return_reason__c;
- pieceCount = e.Rrturn_count__c;
- e.TracingCode__c = '';
- e.Return_reason__c = '';
- e.Rrturn_count__c = null;
+
+ public static List<ConsumableorderdetailsInfo> getorderdet2pieceList(List<String[]> csvRecordStr) {
+ barcodePieceList = new List<String>();
+ List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ string[] csvRecordData = csvRecordStr[i];
+ if (String.valueOf(csvRecordData[9]) == '涓�') {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodePieceList.add(csvRecordData[6]);
+ }
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' || String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌') {
+ cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ cod2Obj.Rrturn_count__c = Decimal.valueOf(csvRecordData[7]);
+ orderdet2PieceRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ }
+ }
+ return orderdet2PieceRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage();
+ return null;
+ }
}
- public Integer compareTo(Object compareTo) {
- return null;
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_order__c order { get; set; }
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public String orderName { get; set; }
+ @AuraEnabled
+ public String hospitalCode { get; set; }
+ @AuraEnabled
+ public String hospitalName { get; set; }
+ @AuraEnabled
+ public String agencyName { get; set; }
+ @AuraEnabled
+ public String productName { get; set; }
+ @AuraEnabled
+ public Decimal pieceCount { get; set; }
+ // 鍙栧埌鐨勮鍗曚俊鎭�
+ public ConsumableorderdetailsInfo(Consumable_order__c e) {
+ order = e;
+ hospitalCode = e.Order_Attachment__c;
+ hospitalName = e.Order_Indication__c;
+ agencyName = e.Invoice_Note__c;
+ e.Order_Attachment__c = '';
+ e.Order_Indication__c = '';
+ e.Invoice_Note__c = '';
+ }
+ // 鍙栧埌鐨勮鍗曟槑缁�
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ orderName = e.Remarks__c;
+ productName = e.Lose_reason__c;
+ e.Lose_reason__c = '';
+ e.Remarks__c = '';
+ }
+ // 鍙栧埌鐨勪骇鍝佹槑缁�
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails2 = e;
+ orderName = e.TracingCode__c;
+ productName = e.Return_reason__c;
+ pieceCount = e.Rrturn_count__c;
+ e.TracingCode__c = '';
+ e.Return_reason__c = '';
+ e.Rrturn_count__c = null;
+ }
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls b/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls
index 4660afe..cb8e9b4 100644
--- a/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls
+++ b/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls
@@ -1,682 +1,350 @@
@isTest
-private class LexOutboundorderImportControllerTest {
- static testMethod void myUnitTest() {
- user myUser_test;
- Account myAccount1;
- List<RecordType> rectHos;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
+private class LexOutboundorderImportControllerTest
+{
+ static testMethod void myUnitTest() {
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
+ user myUser_test;
+ Account myAccount1 ;
+ List<RecordType> rectHos;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ }
+ // TO DO: implement unit test
+
+ system.runAs(myUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdet4.Bar_Code__c = '123456789';
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Arrive_date__c = Date.today().addDays(-1);
+ Orderdet4.Box_Piece__c = '鐩�';
+
+ Consumable_order_details2__c orderdet3 = new Consumable_order_details2__c();
+ orderdet3.Name = 'OCM_01_001004';
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ orderdet3.Sterilization_limit__c = Date.today().addDays(-1);
+ orderdet3.Bar_Code__c = '123456788';
+ orderdet3.Consumable_Product__c = pro1.Id;
+ orderdet3.Arrive_date__c = Date.today().addDays(-1);
+ orderdet3.Box_Piece__c = '鐩�';
+
+ Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
+ orderdet2.Name = 'OCM_01_001004';
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
+ orderdet2.Bar_Code__c = '123456787';
+ orderdet2.Consumable_Product__c = pro1.Id;
+ orderdet2.Arrive_date__c = Date.today().addDays(-1);
+ orderdet2.Box_Piece__c = '涓�';
+
+ Consumable_order_details2__c orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001004';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet1.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdet1.Bar_Code__c = '123456786';
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Arrive_date__c = Date.today().addDays(-1);
+ Orderdet1.Box_Piece__c = '涓�';
+ insert new Consumable_order_details2__c[] {orderdet1, orderdet2,orderdet3,orderdet4};
+ Account hosp1 = new Account(name='Testhosp001',RecordTypeId = rectHos[0].Id);
+ insert hosp1;
+ Agency_Hospital_Link__c jxs = new Agency_Hospital_Link__c(name='jxs001',Agency__c = myAccount1.Id,Hospital__c=hosp1.Id);
+ insert jxs;
+ List<Agency_Hospital_Link__c> jxsList = [select Name,Hospital__r.Management_Code__c from Agency_Hospital_Link__c where Name = 'Testhosp001'];
+
+ List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords1 = new List<LexOutboundorderImportController.ConsumableorderdetailsInfo>();
+ //鍑哄簱鍗�
+ Consumable_order__c cocObj = new Consumable_order__c();
+ cocObj.Name = 'DB-FY2024-06-Z310002';
+ cocObj.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+ cocObj.Order_Attachment__c = 'Test';
+ cocObj.Order_Indication__c = '12233';
+ cocObj.Order_ForCustomerText__c = '娑堝寲绉�';
+ cocObj.Invoice_Note__c = 'test';
+ cocObj.Outbound_Date__c = Date.today();
+ insert cocObj;
+ orderRecords1.add(new LexOutboundorderImportController.ConsumableorderdetailsInfo(cocObj));
+
+ system.assertEquals(1, jxsList.size());
+ PageReference page = new PageReference('/apex/OutboundorderImport');
+ System.Test.setCurrentPage(page);
+ OutboundorderImportController ctrl = new OutboundorderImportController();
+ System.Test.startTest();
+ String csvBody = '';
+ csvBody = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456789,1,230,鐩�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456788,1,230,鐩�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456787,1,230,涓�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456786,1,230,涓�,230,2017-02-17\n';
+
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K','%ET%','閲嶅簡','Testaccount001');
+ //鍑哄簱鏃ユ湡涓虹┖
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIsLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0KREItRlkyMDI0LTA2LVozMTAwMDMs6ZCp5a2Y5bi06Za%2F4oKs6Y2e7oa%2B57Kw6Y2W5ama5quMLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0KREItRlkyMDI0LTA2LVozMTAwMDQs6ZCp5a2Y5bi06Za%2F4oKs6Y2e7oa%2B57Kw6Y2W5ama5quMLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU3NjU3MjUwR1NGU0IsMSw0MDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0K','%ET%','閲嶅簡','Testaccount001');
+ //鍐呭涓虹┖
+ //涓嶉渶瑕佷簩绾х粡閿�鍟�
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYywNCkRCLUZZMjAyNC0wNi1aMzEwMDAyLOmUgOWUrue7meS6jOe6p%2Be7j%2BmUgOWVhiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCwyMCw4LzYvMjAyMywsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDAzLOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsMTY4NjIwMzI1NjA5ODI1MFJFSk9RLDEsNDAwMCwyMCw4LzYvMjAyMywsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDEsNTAwMCwyMCw4LzYvMjAyMywsLCwNCg%3D%3D','%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLDIwLDgvNi8yMDIzLCwsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLDE2ODYyMDMyNTYwOTgyNTBSRUpPUSwxLDQwMDAsMjAsOC82LzIwMjMsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pywsLCwsMSw1MDAwLDIwLDgvNi8yMDIzLCwsDQo%3D','%ET%','閲嶅簡','Testaccount001');
+ //barcode 涓嶅瓨鍦� 鎴栧崟浣嶉敊璇�
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsODAwLOebkiwsOC82LzIwMjMsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMiw1MDAs5LiqLCw4LzYvMjAyMywNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiw0LDkwMDAs55uSLCw4LzYvMjAyMywNCg%3D%3D','%ET%','閲嶅簡','Testaccount001');
+ //涓嶅瓨鍦ㄥ嚭搴撳崟浣�
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsODAwLCwsOC82LzIwMjMsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxMjM0NTY3ODYsMiw1MDAs5LiqLCw4LzYvMjAyMywNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiw0LDkwMDAs55uSLCw4LzYvMjAyMywNCg%3D%3D','%ET%','閲嶅簡','Testaccount001');
+
+ //瀵煎叆
+ List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
+ List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords = LexOutboundorderImportController.orderRecords;
+ String orderRecordsLwc = JSON.serialize(orderRecords);
+
+ Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
+ Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
+ LexOutboundorderImportController.dataImport(csvRecordStr,orderRecordsLwc,'%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,orderRecordsLwc,'%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,'[{"agencyName": "","hospitalCode": "8215356","hospitalName": "瀹界敻涓滄ˉ搴峰鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "鐩存帴閿�鍞粰鍖婚櫌","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]','%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+
+
+
+
+
+
+ LexOutboundorderImportController ctrls = new LexOutboundorderImportController();
+ LexOutboundorderImportController.init();
+ Blob blobData = Blob.valueOf(csvBody);
+ String base64Data = EncodingUtil.base64Encode(blobData);
+ LexOutboundorderImportController.importCSVFile('base64Data','%ET%','閲嶅簡','Testaccount001');
+ String csvBody1 = '';
+ csvBody1 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,product,Outbound_Date__c\n';
+ csvBody1 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456789,1,,鐩�,230,2017-02-17\n';
+ csvBody1 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456788,1,,鐩�,230,2017-02-17\n';
+ csvBody1 +='CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,123456787,1,,鐩�,230,2017-02-17\n';
+ csvBody1 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456786,1,,鐩�,230,2017-02-17\n';
+ Blob blobData1 = Blob.valueOf(csvBody1);
+ String base64Data1 = EncodingUtil.base64Encode(blobData1);
+ LexOutboundorderImportController.importCSVFile('base64Data1','%ET%','閲嶅簡','Testaccount001');
+ String csvBody2 = '';
+ csvBody2 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
+ csvBody2 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
+ csvBody2 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
+ csvBody2 +='CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,,1,230,鐩�,230,2017-02-17\n';
+ csvBody2 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
+ Blob blobData2 = Blob.valueOf(csvBody2);
+ String base64Data2 = EncodingUtil.base64Encode(blobData1);
+ LexOutboundorderImportController.importCSVFile('base64Data2','%ET%','閲嶅簡','Testaccount001');
+
+ String csvBody3 = '';
+ csvBody3 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
+ csvBody3 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456789,1,230,鐩�,230,2017-02-17\n';
+ csvBody3 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456788,1,230,鐩�,230,2017-02-17\n';
+ csvBody3 +='CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,123456787,1,230,鐩�,230,2017-02-17\n';
+ csvBody3 +='CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456786,12,230,鐩�,230,2017-02-17\n';
+ Blob blobData3 = Blob.valueOf(csvBody3);
+ String base64Data3 = EncodingUtil.base64Encode(blobData3);
+ LexOutboundorderImportController.importCSVFile('base64Data3','%ET%','閲嶅簡','Testaccount001');
+ System.Test.stopTest();
+
+
+ }
}
- // TO DO: implement unit test
- System.runAs(myUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdet4.Bar_Code__c = '123456789';
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Arrive_date__c = Date.today().addDays(-1);
- Orderdet4.Box_Piece__c = '鐩�';
+ static testMethod void allTest() {
- Consumable_order_details2__c orderdet3 = new Consumable_order_details2__c();
- orderdet3.Name = 'OCM_01_001004';
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- orderdet3.Consumable_Arrived_order__c = Order1.Id;
- orderdet3.Sterilization_limit__c = Date.today().addDays(-1);
- orderdet3.Bar_Code__c = '123456788';
- orderdet3.Consumable_Product__c = pro1.Id;
- orderdet3.Arrive_date__c = Date.today().addDays(-1);
- orderdet3.Box_Piece__c = '鐩�';
+ user myUser_test;
+ Account myAccount1 ;
+ List<RecordType> rectHos;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectHos.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount1;
+
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
- orderdet2.Name = 'OCM_01_001004';
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- orderdet2.Consumable_Arrived_order__c = Order1.Id;
- orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
- orderdet2.Bar_Code__c = '123456787';
- orderdet2.Consumable_Product__c = pro1.Id;
- orderdet2.Arrive_date__c = Date.today().addDays(-1);
- orderdet2.Box_Piece__c = '涓�';
+ }
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.Dealer_Info__c = myAccount1.Id;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
- Consumable_order_details2__c orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001004';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Consumable_Arrived_order__c = Order1.Id;
- Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdet1.Bar_Code__c = '123456786';
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Arrive_date__c = Date.today().addDays(-1);
- Orderdet1.Box_Piece__c = '涓�';
- insert new List<Consumable_order_details2__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- Account hosp1 = new Account(
- name = 'Testhosp001',
- RecordTypeId = rectHos[0].Id
- );
- insert hosp1;
- Agency_Hospital_Link__c jxs = new Agency_Hospital_Link__c(
- name = 'jxs001',
- Agency__c = myAccount1.Id,
- Hospital__c = hosp1.Id
- );
- insert jxs;
- List<Agency_Hospital_Link__c> jxsList = [
- SELECT Name, Hospital__r.Management_Code__c
- FROM Agency_Hospital_Link__c
- WHERE Name = 'Testhosp001'
- ];
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '浼犵エ';
+ order2.SummonsStatus_c__c = '宸插畬鎴�';
+ Order2.Dealer_Info__c = myAccount1.Id;
+ Order2.Order_ProType__c = 'ET';
+ Order2.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ insert Order2;
- List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords1 = new List<LexOutboundorderImportController.ConsumableorderdetailsInfo>();
- //鍑哄簱鍗�
- Consumable_order__c cocObj = new Consumable_order__c();
- cocObj.Name = 'DB-FY2024-06-Z310002';
- cocObj.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
- cocObj.Order_Attachment__c = 'Test';
- cocObj.Order_Indication__c = '12233';
- cocObj.Order_ForCustomerText__c = '娑堝寲绉�';
- cocObj.Invoice_Note__c = 'test';
- cocObj.Outbound_Date__c = Date.today();
- insert cocObj;
- orderRecords1.add(
- new LexOutboundorderImportController.ConsumableorderdetailsInfo(cocObj)
- );
- system.assertEquals(1, jxsList.size());
- PageReference page = new PageReference('/apex/OutboundorderImport');
- System.Test.setCurrentPage(page);
- OutboundorderImportController ctrl = new OutboundorderImportController();
- System.Test.startTest();
- String csvBody = '';
- csvBody = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456789,1,230,鐩�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456788,1,230,鐩�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456787,1,230,涓�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456786,1,230,涓�,230,2017-02-17\n';
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //鍑哄簱鏃ユ湡涓虹┖
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIsLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0KREItRlkyMDI0LTA2LVozMTAwMDMs6ZCp5a2Y5bi06Za%2F4oKs6Y2e7oa%2B57Kw6Y2W5ama5quMLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0KREItRlkyMDI0LTA2LVozMTAwMDQs6ZCp5a2Y5bi06Za%2F4oKs6Y2e7oa%2B57Kw6Y2W5ama5quMLDgxMDU2NDAs54C555WM5pW75raT5ruEy4nmkLTls7DumLLpjZblqZrmq4ws5aiR5aCd5a%2By57uJPywxNjg2MjAzMjU3NjU3MjUwR1NGU0IsMSw0MDAwLOmQqT8yMCw4LzYvMjAyMyzmtpPjiKDjgZHpjZjnhrfmtJwsLA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //鍐呭涓虹┖
- //涓嶉渶瑕佷簩绾х粡閿�鍟�
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYywNCkRCLUZZMjAyNC0wNi1aMzEwMDAyLOmUgOWUrue7meS6jOe6p%2Be7j%2BmUgOWVhiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCwyMCw4LzYvMjAyMywsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDAzLOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsMTY4NjIwMzI1NjA5ODI1MFJFSk9RLDEsNDAwMCwyMCw4LzYvMjAyMywsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDEsNTAwMCwyMCw4LzYvMjAyMywsLCwNCg%3D%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLDIwLDgvNi8yMDIzLCwsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLDE2ODYyMDMyNTYwOTgyNTBSRUpPUSwxLDQwMDAsMjAsOC82LzIwMjMsLCwNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pywsLCwsMSw1MDAwLDIwLDgvNi8yMDIzLCwsDQo%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //barcode 涓嶅瓨鍦� 鎴栧崟浣嶉敊璇�
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsODAwLOebkiwsOC82LzIwMjMsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMiw1MDAs5LiqLCw4LzYvMjAyMywNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiw0LDkwMDAs55uSLCw4LzYvMjAyMywNCg%3D%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //涓嶅瓨鍦ㄥ嚭搴撳崟浣�
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsODAwLCwsOC82LzIwMjMsDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxMjM0NTY3ODYsMiw1MDAs5LiqLCw4LzYvMjAyMywNCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOS6kuebuOiwg%2Bi0pyw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiw0LDkwMDAs55uSLCw4LzYvMjAyMywNCg%3D%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdet4.Bar_Code__c = '123456789';
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Arrive_date__c = Date.today().addDays(-1);
+ Orderdet4.Box_Piece__c = '鐩�';
- //瀵煎叆
- List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
- List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords = LexOutboundorderImportController.orderRecords;
- String orderRecordsLwc = JSON.serialize(orderRecords);
+ Consumable_order_details2__c orderdet3 = new Consumable_order_details2__c();
+ orderdet3.Name = 'OCM_01_001004';
+ orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ orderdet3.Consumable_Arrived_order__c = Order1.Id;
+ orderdet3.Sterilization_limit__c = Date.today().addDays(-1);
+ orderdet3.Bar_Code__c = '1686203254468250VVGIU';
+ orderdet3.Consumable_Product__c = pro1.Id;
+ orderdet3.Arrive_date__c = Date.today().addDays(-1);
+ orderdet3.Box_Piece__c = '鐩�';
+ orderdet3.Lose_Flag__c = false;
- Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
- Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- orderRecordsLwc,
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- orderRecordsLwc,
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- '[{"agencyName": "","hospitalCode": "8215356","hospitalName": "瀹界敻涓滄ˉ搴峰鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "鐩存帴閿�鍞粰鍖婚櫌","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController ctrls = new LexOutboundorderImportController();
- LexOutboundorderImportController.init();
- Blob blobData = Blob.valueOf(csvBody);
- String base64Data = EncodingUtil.base64Encode(blobData);
- LexOutboundorderImportController.importCSVFile(
- 'base64Data',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- String csvBody1 = '';
- csvBody1 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,product,Outbound_Date__c\n';
- csvBody1 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456789,1,,鐩�,230,2017-02-17\n';
- csvBody1 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456788,1,,鐩�,230,2017-02-17\n';
- csvBody1 += 'CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,123456787,1,,鐩�,230,2017-02-17\n';
- csvBody1 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456786,1,,鐩�,230,2017-02-17\n';
- Blob blobData1 = Blob.valueOf(csvBody1);
- String base64Data1 = EncodingUtil.base64Encode(blobData1);
- LexOutboundorderImportController.importCSVFile(
- 'base64Data1',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- String csvBody2 = '';
- csvBody2 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
- csvBody2 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
- csvBody2 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
- csvBody2 += 'CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,,1,230,鐩�,230,2017-02-17\n';
- csvBody2 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,,1,230,鐩�,230,2017-02-17\n';
- Blob blobData2 = Blob.valueOf(csvBody2);
- String base64Data2 = EncodingUtil.base64Encode(blobData1);
- LexOutboundorderImportController.importCSVFile(
- 'base64Data2',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
+ Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
+ orderdet2.Name = 'OCM_01_001004';
+ orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ orderdet2.Consumable_Arrived_order__c = Order1.Id;
+ orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
+ orderdet2.Bar_Code__c = '1686203256098250REJOQ';
+ orderdet2.Consumable_Product__c = pro1.Id;
+ orderdet2.Arrive_date__c = Date.today().addDays(-1);
+ orderdet2.Box_Piece__c = '涓�';
- String csvBody3 = '';
- csvBody3 = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
- csvBody3 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456789,1,230,鐩�,230,2017-02-17\n';
- csvBody3 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456788,1,230,鐩�,230,2017-02-17\n';
- csvBody3 += 'CS-S0001,鍖婚櫌璇曠敤,,,,娴嬪尰闄㈣瘯鐢�1,123456787,1,230,鐩�,230,2017-02-17\n';
- csvBody3 += 'CS-S0001,鍖婚櫌璇曠敤,,,,鍖婚櫌璇曠敤1,123456786,12,230,鐩�,230,2017-02-17\n';
- Blob blobData3 = Blob.valueOf(csvBody3);
- String base64Data3 = EncodingUtil.base64Encode(blobData3);
- LexOutboundorderImportController.importCSVFile(
- 'base64Data3',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- System.Test.stopTest();
+ Consumable_order_details2__c orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001004';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet1.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdet1.Bar_Code__c = '1686203257657250GSFSB';
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Arrive_date__c = Date.today().addDays(-1);
+ Orderdet1.Box_Piece__c = '涓�';
+ insert new Consumable_order_details2__c[] {orderdet1, orderdet2,orderdet3,orderdet4};
+ Account hosp1 = new Account(name='Testhosp001',RecordTypeId = rectHos[0].Id);
+ insert hosp1;
+ Agency_Hospital_Link__c jxs = new Agency_Hospital_Link__c(name='jxs001',Agency__c = myAccount1.Id,Hospital__c=hosp1.Id);
+ insert jxs;
+ List<Agency_Hospital_Link__c> jxsList = [select Name,Hospital__r.Management_Code__c from Agency_Hospital_Link__c where Name = 'Testhosp001'];
+ //杩愯鏁版嵁
+ System.Test.startTest();
+ LexOutboundorderImportController.init();
+ String csvBody = '';
+ //hospitalCode=null,hospitalName!=null
+ csvBody = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456789,1,230,鐩�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456788,1,230,鐩�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456787,1,230,涓�,230,2017-02-17\n';
+ csvBody +='CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' + jxsList[0].Hospital__r.Management_Code__c + ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456786,1,230,涓�,230,2017-02-17\n';
+ String base64Content = EncodingUtil.Base64Encode(Blob.valueOf(csvBody));
+ System.debug('base64Content==>'+base64Content);
+ Blob blobContent = EncodingUtil.base64Decode( base64Content);
+ System.debug('blobContent==>'+ blobContent.toString());
+ LexOutboundorderImportController.importCSVFile(base64Content,'%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K','%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLCwxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLDIwLOebkiwsLA0KREItRlkyMDI0LTA2LVozMTAwMDMs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSw0MDAwLDIwLOS4qiwsLA0KREItRlkyMDI0LTA2LVozMTAwMDQs5LqS55u46LCD6LSnLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMSw1MDAwLDIwLOS4qiwsLA0K','%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('','','','');
+
+
+ //瀵煎叆
+ List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
+ List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords = LexOutboundorderImportController.orderRecords;
+ System.debug('111===>'+JSON.serialize(LexOutboundorderImportController.orderRecords));
+ String orderRecordsLwc = JSON.serialize(orderRecords);
+ Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
+ Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
+ // hospitalSysMap.put('8105640',myAccount1.Id);
+ // hospitalSysMap.put('8106864','0011000001g02glAAA');
+ // hospitalSysMap.put('8106867','0011000001g02hUAAQ');
+ // hospitalSysMap.put('8107348','0011000001g09fDAAQ');
+ System.debug('hospitalSysMap=='+hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,orderRecordsLwc,'%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,'[{"agencyName": "","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "閿�鍞粰浜岀骇缁忛攢鍟�","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]','%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,'[{"agencyName": "Test","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "鐩存帴閿�鍞粰鍖婚櫌","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]','%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ //浜у搧鍑鸿揣鏁伴噺涓虹┖
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsMTY4NzMxNDIzMDEzMTI1MFdVUlhFLCw1MDAs55uSLDE1LDIwMjMvNS8zMCzkuKLlpLHljp%2Flm6ANCg%3D%3D','%ET%','閲嶅簡','Testaccount001');
+ //鍗曚綅鐩� 鏁伴噺澶т簬1(鏃犳晥)
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D','%ET%','閲嶅簡','Testaccount001');
+ System.Test.stopTest();
+
+ }
}
- }
- static testMethod void allTest() {
- user myUser_test;
- Account myAccount1;
- List<RecordType> rectHos;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount1;
+ static testMethod void allTest1() {
+ List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
+ Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
+ Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
+ System.debug('===>secondAgencyMap'+secondAgencyMap);
+ System.debug('===>hospitalSysMap'+hospitalSysMap);
+ LexOutboundorderImportController.dataImport(csvRecordStr,'[{"agencyName": "","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "閿�鍞粰浜岀骇缁忛攢鍟�","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]','%ET%','閲嶅簡','Testaccount001','myAccount1.Id','ET',secondAgencyMap,hospitalSysMap);
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA1LVozMTcxMDcs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDg4MDI1MCzlpKfov57lpYfliqDlpI3lgaXljLvpmaIs5aSW56eRLCwxMjM0NTYsNzAwLCznm5IsLDI3LzUvMjAwMiwNCkRCLUZZMjAyNC0wNS1aMzE3MTA3LOmUgOWUrue7meS6jOe6p%2Be7j%2BmUgOWVhiw4ODAyNTAs5aSn6L%2Be5aWH5Yqg5aSN5YGl5Yy76ZmiLOWkluenkSwsMTIzNDU2LDcwMCwwLOebkiwsMjcvNS8yMDAyLA0K','%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA1LVozMTcxMDcs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDg4MDI1MCzlpKfov57lpYfliqDlpI3lgaXljLvpmaIs5aSW56eRLCwxMjM0NTYsNzAwLDAs55uSLCwyNy81LzIwMDIsDQpEQi1GWTIwMjQtMDUtWjMxNzEwNyzplIDllK7nu5nkuoznuqfnu4%2FplIDllYYsODgwMjUwLOWkp%2Bi%2FnuWlh%2BWKoOWkjeWBpeWMu%2BmZoizlpJbnp5EsLDEyMzQ1Niw3MDAsMCznm5IsLDI3LzUvMjAwMiwNCiwsLCwsLCwsLCwsLA0KLCwsLCwsLCwsLCwsDQosLCwsLCwsLCwsLCwNCiwsLCwsLCwsLCwsLA0KLCwscywsLCwsLCwsLA0K','%ET%','閲嶅簡','Testaccount001');
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsMTY4NzMxNDIzMDEzMTI1MFdVUlhFLDEsLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D','%ET%','閲嶅簡','Testaccount001');
+ //瀛樺湪Barcode涓虹┖
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D','%ET%','閲嶅簡','Testaccount001');
+ //浜у搧鍑鸿揣鏁伴噺涓虹┖(鏃犳晥)
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLCw1MDAs55uSLDE1LDIwMjMvNS8zMCzkuKLlpLHljp%2Flm6ANCg%3D%3D','%ET%','閲嶅簡','Testaccount001');
+ //浜岀骇缁忛攢鍟嗕笉涓虹┖
+ LexOutboundorderImportController.importCSVFile('TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D','%ET%','閲嶅簡','Testaccount001');
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.Dealer_Info__c = myAccount1.Id;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
-
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '浼犵エ';
- order2.SummonsStatus_c__c = '宸插畬鎴�';
- Order2.Dealer_Info__c = myAccount1.Id;
- Order2.Order_ProType__c = 'ET';
- Order2.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- insert Order2;
-
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdet4.Bar_Code__c = '123456789';
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Arrive_date__c = Date.today().addDays(-1);
- Orderdet4.Box_Piece__c = '鐩�';
-
- Consumable_order_details2__c orderdet3 = new Consumable_order_details2__c();
- orderdet3.Name = 'OCM_01_001004';
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- orderdet3.Consumable_Arrived_order__c = Order1.Id;
- orderdet3.Sterilization_limit__c = Date.today().addDays(-1);
- orderdet3.Bar_Code__c = '1686203254468250VVGIU';
- orderdet3.Consumable_Product__c = pro1.Id;
- orderdet3.Arrive_date__c = Date.today().addDays(-1);
- orderdet3.Box_Piece__c = '鐩�';
- orderdet3.Lose_Flag__c = false;
-
- Consumable_order_details2__c orderdet2 = new Consumable_order_details2__c();
- orderdet2.Name = 'OCM_01_001004';
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- orderdet2.Consumable_Arrived_order__c = Order1.Id;
- orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
- orderdet2.Bar_Code__c = '1686203256098250REJOQ';
- orderdet2.Consumable_Product__c = pro1.Id;
- orderdet2.Arrive_date__c = Date.today().addDays(-1);
- orderdet2.Box_Piece__c = '涓�';
-
- Consumable_order_details2__c orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001004';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Consumable_Arrived_order__c = Order1.Id;
- Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdet1.Bar_Code__c = '1686203257657250GSFSB';
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Arrive_date__c = Date.today().addDays(-1);
- Orderdet1.Box_Piece__c = '涓�';
- insert new List<Consumable_order_details2__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
- Account hosp1 = new Account(
- name = 'Testhosp001',
- RecordTypeId = rectHos[0].Id
- );
- insert hosp1;
- Agency_Hospital_Link__c jxs = new Agency_Hospital_Link__c(
- name = 'jxs001',
- Agency__c = myAccount1.Id,
- Hospital__c = hosp1.Id
- );
- insert jxs;
- List<Agency_Hospital_Link__c> jxsList = [
- SELECT Name, Hospital__r.Management_Code__c
- FROM Agency_Hospital_Link__c
- WHERE Name = 'Testhosp001'
- ];
- //杩愯鏁版嵁
- System.Test.startTest();
- LexOutboundorderImportController.init();
- String csvBody = '';
- //hospitalCode=null,hospitalName!=null
- csvBody = 'Name,SummonsForDirction__c,HospitalCode,Order_ForHospital__c,Order_ForCustomerText__c,Order_ForDealer__c,Bar_Code__c,Shipment_Count__c,Delivery_List_RMB__c,Box_Piece__c,Unitprice_To_agency__c,Outbound_Date__c\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456789,1,230,鐩�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456788,1,230,鐩�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456787,1,230,涓�,230,2017-02-17\n';
- csvBody +=
- 'CS-S0001,閿�鍞粰浜岀骇缁忛攢鍟�,' +
- jxsList[0].Hospital__r.Management_Code__c +
- ',Testhosp001,test,娴嬭瘯浜岀骇缁忛攢鍟�1,123456786,1,230,涓�,230,2017-02-17\n';
- String base64Content = EncodingUtil.Base64Encode(Blob.valueOf(csvBody));
- System.debug('base64Content==>' + base64Content);
- Blob blobContent = EncodingUtil.base64Decode(base64Content);
- System.debug('blobContent==>' + blobContent.toString());
- LexOutboundorderImportController.importCSVFile(
- base64Content,
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLCwxNjg2MjAzMjU0NDY4MjUwVlZHSVUsMSwyMDAwLDIwLOebkiwsLA0KREItRlkyMDI0LTA2LVozMTAwMDMs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSw0MDAwLDIwLOS4qiwsLA0KREItRlkyMDI0LTA2LVozMTAwMDQs5LqS55u46LCD6LSnLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMSw1MDAwLDIwLOS4qiwsLA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile('', '', '', '');
-
- //瀵煎叆
- List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
- List<LexOutboundorderImportController.ConsumableorderdetailsInfo> orderRecords = LexOutboundorderImportController.orderRecords;
- System.debug(
- '111===>' +
- JSON.serialize(LexOutboundorderImportController.orderRecords)
- );
- String orderRecordsLwc = JSON.serialize(orderRecords);
- Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
- Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
- // hospitalSysMap.put('8105640',myAccount1.Id);
- // hospitalSysMap.put('8106864','0011000001g02glAAA');
- // hospitalSysMap.put('8106867','0011000001g02hUAAQ');
- // hospitalSysMap.put('8107348','0011000001g09fDAAQ');
- System.debug('hospitalSysMap==' + hospitalSysMap);
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- orderRecordsLwc,
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- '[{"agencyName": "","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "閿�鍞粰浜岀骇缁忛攢鍟�","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- '[{"agencyName": "Test","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "鐩存帴閿�鍞粰鍖婚櫌","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- //浜у搧鍑鸿揣鏁伴噺涓虹┖
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsMTY4NzMxNDIzMDEzMTI1MFdVUlhFLCw1MDAs55uSLDE1LDIwMjMvNS8zMCzkuKLlpLHljp%2Flm6ANCg%3D%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //鍗曚綅鐩� 鏁伴噺澶т簬1(鏃犳晥)
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- System.Test.stopTest();
- }
- }
-
- static testMethod void allTest1() {
- List<String[]> csvRecordStr = LexOutboundorderImportController.csvRecordStr;
- Map<String, String> secondAgencyMap = LexOutboundorderImportController.secondAgencyMap;
- Map<String, String> hospitalSysMap = LexOutboundorderImportController.hospitalSysMap;
- System.debug('===>secondAgencyMap' + secondAgencyMap);
- System.debug('===>hospitalSysMap' + hospitalSysMap);
- LexOutboundorderImportController.dataImport(
- csvRecordStr,
- '[{"agencyName": "","hospitalCode": "8215356","hospitalName": "娴嬭瘯鍖婚櫌","order": {"Name": "DB-FY2024-06-Z310002","SummonsForDirction__c": "閿�鍞粰浜岀骇缁忛攢鍟�","Order_ForHospital__c":"娴嬭瘯鍖婚櫌","Order_Attachment__c": "","Order_Indication__c": "","Order_ForCustomerText__c": "娑堝寲绉�","Invoice_Note__c": "","Outbound_Date__c": "2023-06-08"}}]',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001',
- 'myAccount1.Id',
- 'ET',
- secondAgencyMap,
- hospitalSysMap
- );
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA1LVozMTcxMDcs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDg4MDI1MCzlpKfov57lpYfliqDlpI3lgaXljLvpmaIs5aSW56eRLCwxMjM0NTYsNzAwLCznm5IsLDI3LzUvMjAwMiwNCkRCLUZZMjAyNC0wNS1aMzE3MTA3LOmUgOWUrue7meS6jOe6p%2Be7j%2BmUgOWVhiw4ODAyNTAs5aSn6L%2Be5aWH5Yqg5aSN5YGl5Yy76ZmiLOWkluenkSwsMTIzNDU2LDcwMCwwLOebkiwsMjcvNS8yMDAyLA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile(
- '77u%2FTmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA1LVozMTcxMDcs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDg4MDI1MCzlpKfov57lpYfliqDlpI3lgaXljLvpmaIs5aSW56eRLCwxMjM0NTYsNzAwLDAs55uSLCwyNy81LzIwMDIsDQpEQi1GWTIwMjQtMDUtWjMxNzEwNyzplIDllK7nu5nkuoznuqfnu4%2FplIDllYYsODgwMjUwLOWkp%2Bi%2FnuWlh%2BWKoOWkjeWBpeWMu%2BmZoizlpJbnp5EsLDEyMzQ1Niw3MDAsMCznm5IsLDI3LzUvMjAwMiwNCiwsLCwsLCwsLCwsLA0KLCwsLCwsLCwsLCwsDQosLCwsLCwsLCwsLCwNCiwsLCwsLCwsLCwsLA0KLCwscywsLCwsLCwsLA0K',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsMTY4NzMxNDIzMDEzMTI1MFdVUlhFLDEsLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //瀛樺湪Barcode涓虹┖
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LUQzMTg5MDYs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDg2MTMs6YeR5Lmh5Y6%2F5Y2c6ZuG6ZWH5Y2r55Sf6ZmiLOa2iOWMluenkSwsLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //浜у搧鍑鸿揣鏁伴噺涓虹┖(鏃犳晥)
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLCw1MDAs55uSLDE1LDIwMjMvNS8zMCzkuKLlpLHljp%2Flm6ANCg%3D%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- //浜岀骇缁忛攢鍟嗕笉涓虹┖
- LexOutboundorderImportController.importCSVFile(
- 'TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVMzMTc4MTMtMDEs6ZSA5ZSu57uZ5LqM57qn57uP6ZSA5ZWGLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NzMyMjQ0NDUwOTI1MFVZR01QLDUsNTAwLOebkiwxNSwyMDIzLzUvMzAs5Lii5aSx5Y6f5ZugDQo%3D',
- '%ET%',
- '閲嶅簡',
- 'Testaccount001'
- );
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml b/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexOverdueStockController.cls b/force-app/main/default/classes/LexOverdueStockController.cls
index b53796f..05fe5c6 100644
--- a/force-app/main/default/classes/LexOverdueStockController.cls
+++ b/force-app/main/default/classes/LexOverdueStockController.cls
@@ -1,458 +1,407 @@
public with sharing class LexOverdueStockController {
- /*****************妞滅储鐢�******************/
- public static String barcode { get; set; }
+ /*****************妞滅储鐢�******************/
+ public static String barcode { get; set; }
- // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
- public static List<orderBean> codPageRecords { get; set; }
+ // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
+ public static List<orderBean> codPageRecords { get; set; }
- // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
- public static List<orderBean> overduePageRecords { get; set; }
+ // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
+ public static List<orderBean> overduePageRecords { get; set; }
- // 鐧诲綍鑰呭伐浣滃湴
- private static String userWorkLocation;
- //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
- private static String agencyProType;
- private static String sqlagencyProType;
- // 缁忛攢鍟嗕俊鎭�
- private static Account accountInfo;
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ private static String agencyProType;
+ private static String sqlagencyProType;
+ // 缁忛攢鍟嗕俊鎭�
+ private static Account accountInfo;
- //鍒ゆ柇鎿嶄綔浜哄憳鏄惁閿�瀛�
- public static Boolean iSinventory = false;
+ //鍒ゆ柇鎿嶄綔浜哄憳鏄惁閿�瀛�
+ public static Boolean iSinventory = false;
- public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
+ public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
- public static Integer pageRecordsSize {
- get {
- return codPageRecords == null ? 0 : codPageRecords.size();
- }
- }
-
- public LexOverdueStockController() {
- }
-
- // 鐢婚潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init() {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- codPageRecords = new List<orderBean>();
- overduePageRecords = new List<orderBean>();
- // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
- user Useracc = [
- SELECT Accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :UserInfo.getUserId()
- ];
- userWorkLocation = Useracc.Work_Location__c;
- agencyProType = Useracc.UserPro_Type__c;
- if (String.isBlank(Useracc.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- sqlagencyProType = '%' + agencyProType + '%';
- accountInfo = [
- SELECT id, Name, Dealer_discount__c
- FROM account
- WHERE id = :Useracc.accountid
- ];
- // 杩囨湡搴撳瓨姹囨�讳俊鎭�
- List<AggregateResult> orderDetZaiku = [
- SELECT
- count(Id) countsum,
- Consumable_Product__c prodid,
- Consumable_Product__r.Name_Text__c prodname,
- Box_Piece__c boxPiece
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Isoverdue__c = 0
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountInfo.Name
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- GROUP BY
- Consumable_Product__c,
- Box_Piece__c,
- Consumable_Product__r.Name_Text__c
- ];
-
- for (AggregateResult overdue : orderDetZaiku) {
- codPageRecords.add(new orderBean(overdue));
- }
-
- system.debug('codPageRecords====>' + codPageRecords);
- data.put('codPageRecords', JSON.serialize(codPageRecords));
- data.put('userWorkLocation', userWorkLocation);
- data.put('accountName', accountInfo.Name);
- data.put('agencyProType', agencyProType);
- data.put('orderDetZaiku', JSON.serialize(orderDetZaiku));
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // BarCode褰曞叆
- @AuraEnabled
- public static ResponseBodyLWC searchorderBean(
- String agencyProTypeLWC,
- String userWorkLocationLWC,
- String accountNameLWC,
- String barcodeLWC,
- String codPageRecordsLWC
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(
- codPageRecordsLWC,
- List<orderBean>.class
- );
- sqlagencyProType = '%' + agencyProTypeLWC + '%';
- system.debug('sqlagencyProType==>' + sqlagencyProType);
- barcode = barcodeLWC;
- system.debug('barcode==>' + barcode);
- userWorkLocation = userWorkLocationLWC;
- // add by Wang Xueqin 2023/04/12
- // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
- user Useracc = [
- SELECT Accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :UserInfo.getUserId()
- ];
- accountInfo = [
- SELECT id, Name, Dealer_discount__c
- FROM account
- WHERE id = :Useracc.accountid
- ];
-
- iSinventory = true;
- Set<String> barCodeoverdue = new Set<String>();
- overduePageRecords = new List<orderBean>();
- List<String> barCodeListP = ParseBarCode(barcode);
- // 椤甸潰鏄剧ず鏁版嵁鍒濆鍖�
- for (orderBean codPage : codPageRecords) {
- codPage.pandian = 0;
- }
- // 鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
- List<Consumable_order_details2__c> orderDetZaiku = [
- SELECT
- Id,
- Name,
- Consumable_Product__c,
- Bar_Code__c,
- Consumable_Product__r.Name__c,
- Dealer_Info_text__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- Sterilization_limit__c,
- Bar_Code_search__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Isoverdue__c = 0
- AND Dealer_Returned__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountInfo.Name
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ];
- // 娌℃湁杈撳叆鏉$爜鏃讹紝寰幆椤甸潰锛屾墍鏈夋墦閽╀骇鍝佸叏閮ㄩ攢瀛�
- // 鍙栧緱鎵�鏈�
- overdueList = new List<Consumable_order_details2__c>();
- if (String.isBlank(barcode)) {
- System.debug('barcode绌�');
- for (orderBean codPage : codPageRecords) {
- if (codPage.check) {
- for (Consumable_order_details2__c cod2 : orderDetZaiku) {
- if (
- cod2.Consumable_Product__c == codPage.prodid &&
- codPage.boxPiece == cod2.Box_Piece__c
- ) {
- overduePageRecords.add(new orderBean(cod2, '杩囨湡搴撳瓨閿�瀛�'));
- overdueList.add(cod2);
- }
- }
- codPage.pandian = codPage.overlimitCount;
+ public static Integer pageRecordsSize {
+ get {
+ return codPageRecords == null ? 0 : codPageRecords.size();
}
- }
- // 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 = '璇疯緭鍏arCode鍙�';
- System.debug('res = ' + res);
- return res;
}
- // 杈撳叆barcode鏃�
+ public LexOverdueStockController() {
+ }
- // 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
- ];
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- System.debug('reSet===>' + reSet);
+ codPageRecords = new List<orderBean>();
+ overduePageRecords = new List<orderBean>();
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
+ // 杩囨湡搴撳瓨姹囨�讳俊鎭�
+ List<AggregateResult> orderDetZaiku = [
+ SELECT count(Id) countsum, Consumable_Product__c prodid, Consumable_Product__r.Name_Text__c prodname, Box_Piece__c boxPiece
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Isoverdue__c = 0
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountInfo.Name
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ GROUP BY Consumable_Product__c, Box_Piece__c, Consumable_Product__r.Name_Text__c
+ ];
- for (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 (AggregateResult overdue : orderDetZaiku) {
+ codPageRecords.add(new orderBean(overdue));
+ }
+
+ system.debug('codPageRecords====>' + codPageRecords);
+ data.put('codPageRecords', JSON.serialize(codPageRecords));
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('accountName', accountInfo.Name);
+ data.put('agencyProType', agencyProType);
+ data.put('orderDetZaiku', JSON.serialize(orderDetZaiku));
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // BarCode褰曞叆
+ @AuraEnabled
+ public static ResponseBodyLWC searchorderBean(
+ String agencyProTypeLWC,
+ String userWorkLocationLWC,
+ String accountNameLWC,
+ String barcodeLWC,
+ String codPageRecordsLWC
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(codPageRecordsLWC, List<orderBean>.class);
+ sqlagencyProType = '%' + agencyProTypeLWC + '%';
+ system.debug('sqlagencyProType==>' + sqlagencyProType);
+ barcode = barcodeLWC;
+ system.debug('barcode==>' + barcode);
+ userWorkLocation = userWorkLocationLWC;
+ // add by Wang Xueqin 2023/04/12
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
+
+ iSinventory = true;
+ Set<String> barCodeoverdue = new Set<String>();
+ overduePageRecords = new List<orderBean>();
+ List<String> barCodeListP = ParseBarCode(barcode);
+ // 椤甸潰鏄剧ず鏁版嵁鍒濆鍖�
for (orderBean codPage : codPageRecords) {
- if (
- cod2.Consumable_Product__c == codPage.prodid &&
- cod2.Box_Piece__c == codPage.boxPiece
- ) {
- overduePageRecords.add(new orderBean(cod2, '杩囨湡搴撳瓨閿�瀛�'));
- overdueList.add(cod2);
- codPage.pandian++;
- codPage.check = true;
- }
+ codPage.pandian = 0;
}
- } else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) {
- overduePageRecords.add(new orderBean(cod2, '浜у搧宸茬粡鍑哄簱'));
- } else {
- overduePageRecords.add(new orderBean(cod2, '涓嶆槸杩囨湡搴撳瓨'));
- }
- }
- System.debug('overduePageRecords = ' + overduePageRecords);
- data.put('overduePageRecords', JSON.serialize(overduePageRecords));
- data.put('codPageRecords', JSON.serialize(codPageRecords));
- data.put('iSinventory', iSinventory);
- data.put('overdueList', overdueList);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // 淇濆瓨鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC save(
- Boolean iSinventory,
- string saveCodPageRecords,
- List<Consumable_order_details2__c> saveoverdueList
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- system.debug('saveCodPageRecords=============>' + saveCodPageRecords);
- system.debug('saveoverdueList' + saveoverdueList);
- overdueList = saveoverdueList;
- // if(saveoverdueList==null){
- // return new ResponseBodyLWC('Error',500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
-
- // }
-
- List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(
- saveCodPageRecords,
- List<orderBean>.class
- );
- // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class);
- // add by Wang Xueqin 2023/04/12
- // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
- user Useracc = [
- SELECT Accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :UserInfo.getUserId()
- ];
- accountInfo = [
- SELECT id, Name, Dealer_discount__c
- FROM account
- WHERE id = :Useracc.accountid
- ];
-
- // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- if (!iSinventory) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
- return new ResponseBodyLWC('Error', 500, '璇峰厛褰曞叆BarCode', '');
- // return null;
- }
- integer Lo = 0;
- for (orderBean header : codPageRecords) {
- if (header.check == true) {
- Lo++;
- }
- }
- if (Lo == 0) {
- iSinventory = false;
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏銆�'));
- return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
- // return null;
- }
- Integer orderDetNo = 1;
- Savepoint sp = Database.setSavepoint();
- Consumable_order__c po = new Consumable_order__c();
- po.Name = '*';
- po.Order_status__c = '鎵瑰噯';
- po.Inventory_date__c = Date.today();
- po.Order_type__c = '閿�瀛�';
- po.Dealer_Info__c = accountInfo.Id;
- po.Order_ProType__c = agencyProType;
- po.RecordTypeid = System.Label.RT_ConOrder_Overdue;
- try {
- insert po;
- Consumable_order__c order = [
- SELECT Name
- FROM Consumable_order__c
- WHERE id = :po.id
- ];
- List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
- for (orderBean header : codPageRecords) {
- if (header.check == true) {
- Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
- String str = string.valueOf(orderDetNo);
- if (str.length() == 1) {
- str = '0' + str;
- }
- insPan.Name = order.Name + '-' + str;
- insPan.Consumable_Product__c = header.prodId;
- insPan.Consumable_order__c = po.Id;
- insPan.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
- insPan.Overdue_count__c = header.pandian;
- insPan.Overdue_SUM__c = header.overlimitCount;
- insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
- orderDetNo++;
- InsList.add(insPan);
+ // 鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ List<Consumable_order_details2__c> orderDetZaiku = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__c,
+ Bar_Code__c,
+ Consumable_Product__r.Name__c,
+ Dealer_Info_text__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ Sterilization_limit__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Isoverdue__c = 0
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountInfo.Name
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ];
+ // 娌℃湁杈撳叆鏉$爜鏃讹紝寰幆椤甸潰锛屾墍鏈夋墦閽╀骇鍝佸叏閮ㄩ攢瀛�
+ // 鍙栧緱鎵�鏈�
+ overdueList = new List<Consumable_order_details2__c>();
+ if (String.isBlank(barcode)) {
+ System.debug('barcode绌�');
+ for (orderBean codPage : codPageRecords) {
+ if (codPage.check) {
+ for (Consumable_order_details2__c cod2 : orderDetZaiku) {
+ if (cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c) {
+ overduePageRecords.add(new orderBean(cod2, '杩囨湡搴撳瓨閿�瀛�'));
+ overdueList.add(cod2);
+ }
+ }
+ codPage.pandian = codPage.overlimitCount;
+ }
+ }
+ // return;
+ System.debug('overduePageRecords = ' + overduePageRecords);
+ 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 = '璇疯緭鍏arCode鍙�';
+ System.debug('res = ' + res);
+ return res;
}
- }
- // 鐢熸垚鏄庣粏1
- if (InsList.size() > 0) {
- insert InsList;
- }
- for (Consumable_order_details2__c cod : overdueList) {
- cod.Consumable_Inventory_order__c = po.Id;
- cod.Inventory_date__c = Date.today();
- cod.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
- cod.Lose_Flag__c = true;
- }
- if (overdueList.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(overdueList);
- }
- } catch (Exception ex) {
- Database.rollback(sp);
- ApexPages.addMessages(ex);
- return null;
- }
- // return new Pagereference('/' + po.Id);
- data.put('Id', po.Id);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
+ // 杈撳叆barcode鏃�
- // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
- public static List<String> ParseBarCode(String Code) {
- Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
- String[] Cache = new List<String>{};
- Cache = Code.split('\n');
- List<String> Buff = new List<String>();
- for (String A : Cache) {
- A = A.trim().toUpperCase();
- if (barcodeCountMap.containsKey(A)) {
- barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
- } else {
- barcodeCountMap.put(A, 1);
- }
- Buff.add(A + barcodeCountMap.get(A));
- }
- return Buff;
- }
+ // 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
+ ];
- // Data Bean
- @TestVisible
- class orderBean implements Comparable {
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Boolean check { get; set; }
+ System.debug('reSet===>' + reSet);
- // 杩囨湡搴撳瓨
- @AuraEnabled
- public Integer overlimitCount { get; set; }
- // 閿�瀛樻暟閲�
- @AuraEnabled
- public Integer pandian { get; set; }
- // 閿�瀛樺師鍥�
- @AuraEnabled
- public String diffReason { get; set; }
- // 鍗曚綅
- @AuraEnabled
- public String boxPiece { get; set; }
- @AuraEnabled
- public String prodname { get; set; }
- @AuraEnabled
- public String prodid { get; set; }
- orderBean(Consumable_order_details2__c e, string str) {
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- DiffReason = str;
+ for (Consumable_order_details2__c cod2 : reSet) {
+ if (
+ (cod2.Dealer_Shipment__c == false &&
+ cod2.Dealer_Saled__c == false &&
+ cod2.Lose_Flag__c == false &&
+ cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0
+ ) {
+ for (orderBean codPage : codPageRecords) {
+ if (cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece) {
+ overduePageRecords.add(new orderBean(cod2, '杩囨湡搴撳瓨閿�瀛�'));
+ overdueList.add(cod2);
+ codPage.pandian++;
+ codPage.check = true;
+ }
+ }
+ } else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) {
+ overduePageRecords.add(new orderBean(cod2, '浜у搧宸茬粡鍑哄簱'));
+ } else {
+ overduePageRecords.add(new orderBean(cod2, '涓嶆槸杩囨湡搴撳瓨'));
+ }
+ }
+ System.debug('overduePageRecords = ' + overduePageRecords);
+ data.put('overduePageRecords', JSON.serialize(overduePageRecords));
+ data.put('codPageRecords', JSON.serialize(codPageRecords));
+ data.put('iSinventory', iSinventory);
+ data.put('overdueList', overdueList);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- public orderBean(AggregateResult e) {
- check = false;
- overlimitCount = Integer.valueOf(e.get('countsum'));
- prodname = String.valueOf(e.get('prodname'));
- prodid = String.valueOf(e.get('prodid'));
- boxPiece = String.valueOf(e.get('BoxPiece'));
- pandian = 0;
+
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(Boolean iSinventory, string saveCodPageRecords, List<Consumable_order_details2__c> saveoverdueList) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ system.debug('saveCodPageRecords=============>' + saveCodPageRecords);
+ system.debug('saveoverdueList' + saveoverdueList);
+ overdueList = saveoverdueList;
+ // if(saveoverdueList==null){
+ // return new ResponseBodyLWC('Error',500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
+
+ // }
+
+ List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(saveCodPageRecords, List<orderBean>.class);
+ // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class);
+ // add by Wang Xueqin 2023/04/12
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
+
+ // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ if (!iSinventory) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
+ return new ResponseBodyLWC('Error', 500, '璇峰厛褰曞叆BarCode', '');
+ // return null;
+ }
+ integer Lo = 0;
+ for (orderBean header : codPageRecords) {
+ if (header.check == true) {
+ Lo++;
+ }
+ }
+ if (Lo == 0) {
+ iSinventory = false;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏銆�'));
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
+ // return null;
+ }
+ Integer orderDetNo = 1;
+ Savepoint sp = Database.setSavepoint();
+ Consumable_order__c po = new Consumable_order__c();
+ po.Name = '*';
+ po.Order_status__c = '鎵瑰噯';
+ po.Inventory_date__c = Date.today();
+ po.Order_type__c = '閿�瀛�';
+ po.Dealer_Info__c = accountInfo.Id;
+ po.Order_ProType__c = agencyProType;
+ po.RecordTypeid = System.Label.RT_ConOrder_Overdue;
+ try {
+ insert po;
+ Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id = :po.id];
+ List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
+ for (orderBean header : codPageRecords) {
+ if (header.check == true) {
+ Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
+ String str = string.valueOf(orderDetNo);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ insPan.Name = order.Name + '-' + str;
+ insPan.Consumable_Product__c = header.prodId;
+ insPan.Consumable_order__c = po.Id;
+ insPan.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ insPan.Overdue_count__c = header.pandian;
+ insPan.Overdue_SUM__c = header.overlimitCount;
+ insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ orderDetNo++;
+ InsList.add(insPan);
+ }
+ }
+ // 鐢熸垚鏄庣粏1
+ if (InsList.size() > 0) {
+ insert InsList;
+ }
+
+ for (Consumable_order_details2__c cod : overdueList) {
+ cod.Consumable_Inventory_order__c = po.Id;
+ cod.Inventory_date__c = Date.today();
+ cod.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ cod.Lose_Flag__c = true;
+ }
+ if (overdueList.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(overdueList);
+ }
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ ApexPages.addMessages(ex);
+ return null;
+ }
+ // return new Pagereference('/' + po.Id);
+ data.put('Id', po.Id);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- orderBean compareToesd = (orderBean) compareTo;
- Integer returnValue = 0;
- if (overlimitCount > compareToesd.overlimitCount) {
- returnValue = -1;
- } else if (overlimitCount < compareToesd.overlimitCount) {
- returnValue = 1;
- }
- return returnValue;
+
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ public static List<String> ParseBarCode(String Code) {
+ Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
+ String[] Cache = new List<String>{};
+ Cache = Code.split('\n');
+ List<String> Buff = new List<String>();
+ for (String A : Cache) {
+ A = A.trim().toUpperCase();
+ if (barcodeCountMap.containsKey(A)) {
+ barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
+ } else {
+ barcodeCountMap.put(A, 1);
+ }
+ Buff.add(A + barcodeCountMap.get(A));
+ }
+ return Buff;
}
- }
-}
+
+ // Data Bean
+ @TestVisible
+ class orderBean implements Comparable {
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Boolean check { get; set; }
+
+ // 杩囨湡搴撳瓨
+ @AuraEnabled
+ public Integer overlimitCount { get; set; }
+ // 閿�瀛樻暟閲�
+ @AuraEnabled
+ public Integer pandian { get; set; }
+ // 閿�瀛樺師鍥�
+ @AuraEnabled
+ public String diffReason { get; set; }
+ // 鍗曚綅
+ @AuraEnabled
+ public String boxPiece { get; set; }
+ @AuraEnabled
+ public String prodname { get; set; }
+ @AuraEnabled
+ public String prodid { get; set; }
+ orderBean(Consumable_order_details2__c e, string str) {
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ DiffReason = str;
+ }
+ public orderBean(AggregateResult e) {
+ check = false;
+ overlimitCount = Integer.valueOf(e.get('countsum'));
+ prodname = String.valueOf(e.get('prodname'));
+ prodid = String.valueOf(e.get('prodid'));
+ boxPiece = String.valueOf(e.get('BoxPiece'));
+ pandian = 0;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ orderBean compareToesd = (orderBean) compareTo;
+ Integer returnValue = 0;
+ if (overlimitCount > compareToesd.overlimitCount) {
+ returnValue = -1;
+ } else if (overlimitCount < compareToesd.overlimitCount) {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOverdueStockControllerTest.cls b/force-app/main/default/classes/LexOverdueStockControllerTest.cls
index a3c6f20..0b311f7 100644
--- a/force-app/main/default/classes/LexOverdueStockControllerTest.cls
+++ b/force-app/main/default/classes/LexOverdueStockControllerTest.cls
@@ -1,245 +1,164 @@
@isTest
private class LexOverdueStockControllerTest {
- static testMethod void testMethod1() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ static testMethod void testMethod1() {
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ }
+
+ system.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
+
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
+
+
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ insert order;
+ //鍒拌揣
+ Consumable_order__c order2 = new Consumable_order__c();
+ order2.Name = 'testMing1';
+ order2.Order_status__c = '鎵瑰噯';
+ order2.RecordTypeid = '01210000000c9dqAAA';
+ order2.Dealer_Info__c = myAccount1.id;
+ order2.Order_type__c = '鍒拌揣';
+ order2.Order_ProType__c = 'ET';
+ insert order2;
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ // 閿�鍞�
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '鐩�';
+ dataForProductCount7.Used_date__c = Date.today();
+ dataForProductCount7.Consumable_order_minor__c = order.id;
+
+ conList.add(dataForProductCount7);
+ // 鍦ㄥ簱 杩囨湡 鐩�
+ Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
+ dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
+ dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProduct.Arrive_date__c = Date.today();
+ dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProduct.Consumable_Product__c = proF.id;
+ dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProduct.Box_Piece__c = '鐩�';
+ dataForProduct.Consumable_order_minor__c = order.id;
+
+ conList.add(dataForProduct);
+ // 鍦ㄥ簱 杩囨湡 涓�
+ Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
+ dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
+ dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount3.Arrive_date__c = Date.today();
+ dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount3.Consumable_Product__c = proG.id;
+ dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount3.Box_Piece__c = '涓�';
+ dataForProductCount3.RemoveBox_No__c = 1;
+ dataForProductCount3.Consumable_order_minor__c = order.id;
+ conList.add(dataForProductCount3);
+ insert conList;
+
+ //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
+ dataForProductCount4.Bar_Code__c = '1001';
+ dataForProductCount4.Arrive_date__c = Date.today();
+ dataForProductCount4.Send_Date__c = null;
+ dataForProductCount4.Used_date__c = null;
+ dataForProductCount4.Return_date__c = null;
+ dataForProductCount4.Lose_Flag__c = false;
+ dataForProductCount4.Cancellation_Flag__c = false;
+ dataForProductCount4.Consumable_Product__c = proG.Id;
+ dataForProductCount4.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount4.Used_account__c = myAccount1.Id;
+ dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount4.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount4);
+ System.debug('conList1==>'+conList1);
+ //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1002';
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.Send_Date__c = Date.today();
+ dataForProductCount5.Used_date__c = Date.today();
+ dataForProductCount5.Return_date__c = null;
+ dataForProductCount5.Lose_Flag__c = false;
+ dataForProductCount5.Cancellation_Flag__c = false;
+ dataForProductCount5.Consumable_Product__c = proG.Id;
+ dataForProductCount5.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount5.Used_account__c = myAccount1.Id;
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount5.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount5);
+ insert conList1;
+
+
+
+
+
+
+ System.Test.startTest();
+ List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
+ LexOverdueStockController overCon = new LexOverdueStockController();
+ LexOverdueStockController.init();
+ List<LexOverdueStockController.orderBean> cro = new List<LexOverdueStockController.orderBean>();
+ List<LexOverdueStockController.orderBean> croList = LexOverdueStockController.codPageRecords;
+ for(LexOverdueStockController.orderBean i :croList){
+ i.check = true;
+
+ }
+
+ String codPageRecordsLWC = JSON.serialize(LexOverdueStockController.codPageRecords);
+ System.debug('codPageRecordsLWC===>test'+LexOverdueStockController.codPageRecords);
+ LexOverdueStockController.searchorderBean('ET','閲嶅簡','Testaccount001','123456789298k250AAAAA\n123456789498k250BBBBB\n123456788398k250CCCCC\n1001',codPageRecordsLWC);
+ LexOverdueStockController.searchorderBean('ET','閲嶅簡','Testaccount001','',codPageRecordsLWC);//barcode涓虹┖
+ LexOverdueStockController.save(true,codPageRecordsLWC,overdueList);
+ // LexOverdueStockController.save(false,codPageRecordsLWC,overdueList);
+ System.Test.stopTest();
+
+ }
}
-
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
-
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
-
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- insert order;
- //鍒拌揣
- Consumable_order__c order2 = new Consumable_order__c();
- order2.Name = 'testMing1';
- order2.Order_status__c = '鎵瑰噯';
- order2.RecordTypeid = '01210000000c9dqAAA';
- order2.Dealer_Info__c = myAccount1.id;
- order2.Order_type__c = '鍒拌揣';
- order2.Order_ProType__c = 'ET';
- insert order2;
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //鍒朵綔Consumable_order_details__c-------ProductCount
- // 閿�鍞�
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '鐩�';
- dataForProductCount7.Used_date__c = Date.today();
- dataForProductCount7.Consumable_order_minor__c = order.id;
-
- conList.add(dataForProductCount7);
- // 鍦ㄥ簱 杩囨湡 鐩�
- Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
- dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
- dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProduct.Arrive_date__c = Date.today();
- dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProduct.Consumable_Product__c = proF.id;
- dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProduct.Box_Piece__c = '鐩�';
- dataForProduct.Consumable_order_minor__c = order.id;
-
- conList.add(dataForProduct);
- // 鍦ㄥ簱 杩囨湡 涓�
- Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
- dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
- dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount3.Arrive_date__c = Date.today();
- dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount3.Consumable_Product__c = proG.id;
- dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount3.Box_Piece__c = '涓�';
- dataForProductCount3.RemoveBox_No__c = 1;
- dataForProductCount3.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount3);
- insert conList;
-
- //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
- dataForProductCount4.Bar_Code__c = '1001';
- dataForProductCount4.Arrive_date__c = Date.today();
- dataForProductCount4.Send_Date__c = null;
- dataForProductCount4.Used_date__c = null;
- dataForProductCount4.Return_date__c = null;
- dataForProductCount4.Lose_Flag__c = false;
- dataForProductCount4.Cancellation_Flag__c = false;
- dataForProductCount4.Consumable_Product__c = proG.Id;
- dataForProductCount4.Consumable_Arrived_order__c = order2.id;
- dataForProductCount4.Used_account__c = myAccount1.Id;
- dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount4.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount4);
- System.debug('conList1==>' + conList1);
- //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1002';
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.Send_Date__c = Date.today();
- dataForProductCount5.Used_date__c = Date.today();
- dataForProductCount5.Return_date__c = null;
- dataForProductCount5.Lose_Flag__c = false;
- dataForProductCount5.Cancellation_Flag__c = false;
- dataForProductCount5.Consumable_Product__c = proG.Id;
- dataForProductCount5.Consumable_Arrived_order__c = order2.id;
- dataForProductCount5.Used_account__c = myAccount1.Id;
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount5.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount5);
- insert conList1;
-
- System.Test.startTest();
- List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
- LexOverdueStockController overCon = new LexOverdueStockController();
- LexOverdueStockController.init();
- List<LexOverdueStockController.orderBean> cro = new List<LexOverdueStockController.orderBean>();
- List<LexOverdueStockController.orderBean> croList = LexOverdueStockController.codPageRecords;
- for (LexOverdueStockController.orderBean i : croList) {
- i.check = true;
- }
-
- String codPageRecordsLWC = JSON.serialize(
- LexOverdueStockController.codPageRecords
- );
- System.debug(
- 'codPageRecordsLWC===>test' + LexOverdueStockController.codPageRecords
- );
- LexOverdueStockController.searchorderBean(
- 'ET',
- '閲嶅簡',
- 'Testaccount001',
- '123456789298k250AAAAA\n123456789498k250BBBBB\n123456788398k250CCCCC\n1001',
- codPageRecordsLWC
- );
- LexOverdueStockController.searchorderBean(
- 'ET',
- '閲嶅簡',
- 'Testaccount001',
- '',
- codPageRecordsLWC
- ); //barcode涓虹┖
- LexOverdueStockController.save(true, codPageRecordsLWC, overdueList);
- // LexOverdueStockController.save(false,codPageRecordsLWC,overdueList);
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml b/force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexProductLimitEditControllerTest.cls b/force-app/main/default/classes/LexProductLimitEditControllerTest.cls
index 3b51728..6d0261e 100644
--- a/force-app/main/default/classes/LexProductLimitEditControllerTest.cls
+++ b/force-app/main/default/classes/LexProductLimitEditControllerTest.cls
@@ -1,70 +1,47 @@
@isTest
-private class LexProductLimitEditControllerTest {
- @isTest
- static void unittest() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+private class LexProductLimitEditControllerTest
+{
+ @isTest
+ static void unittest()
+ {
- Account myAccount2 = new Account(
- name = 'Testaccount005',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4'
- );
- insert myAccount2;
- String myAccount2Id = myAccount2.Id;
- LexProductLimitEditController.init(myAccount2Id, 'ENG');
- LexProductLimitEditController.init(myAccount2Id, '');
- LexProductLimitEditController.accountid = myAccount2Id;
- LexProductLimitEditController controllerLimit = new LexProductLimitEditController();
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
- // Given
- // PageReference page = new PageReference('/apex/ProductLimitEdit?accountid=' + myAccount2.id);
- // page.setRedirect(true);
- // System.Test.setCurrentPage(page);
- // ProductLimitEditController conTest = new ProductLimitEditController();
- // conTest.init();
- // System.assertEquals('Test01|5|55,Test02|2|4', conTest.product_Limit);
+ Account myAccount2 = new Account(name='Testaccount005',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4');
+ insert myAccount2;
+ String myAccount2Id = myAccount2.Id;
+ LexProductLimitEditController.init(myAccount2Id,'ENG');
+ LexProductLimitEditController.init(myAccount2Id,'');
+ LexProductLimitEditController.accountid = myAccount2Id;
+ LexProductLimitEditController controllerLimit = new LexProductLimitEditController();
- // When
- // Then
- }
-}
+
+
+
+ // Given
+ // PageReference page = new PageReference('/apex/ProductLimitEdit?accountid=' + myAccount2.id);
+ // page.setRedirect(true);
+ // System.Test.setCurrentPage(page);
+ // ProductLimitEditController conTest = new ProductLimitEditController();
+ // conTest.init();
+ // System.assertEquals('Test01|5|55,Test02|2|4', conTest.product_Limit);
+
+ // When
+
+
+ // Then
+
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml b/force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexRemoveBoxControllerTest.cls b/force-app/main/default/classes/LexRemoveBoxControllerTest.cls
index 7510496..a665c61 100644
--- a/force-app/main/default/classes/LexRemoveBoxControllerTest.cls
+++ b/force-app/main/default/classes/LexRemoveBoxControllerTest.cls
@@ -1,806 +1,488 @@
@isTest
-private class LexRemoveBoxControllerTest {
- static testMethod void myUnitTest() {
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+private class LexRemoveBoxControllerTest
+{
+
+ static testMethod void myUnitTest() {
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
+ }
+
+ System.runAs(myUser_Test){
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ StaticParameter.EscapeNFM007Trigger = true;
+ StaticParameter.EscapeOpportunityBefUpdTrigger = true;
+ StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
+ StaticParameter.EscapeSyncOpportunityTrigger = true;
+ StaticParameter.EscapeSyncProduct2Trigger = true;
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Packing_list_manual__c=12,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Packing_list_manual__c=1,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2,pro3};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+
+ //daoku
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001001';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = false;
+ Orderdet2.Return_date__c= null;
+ Orderdet2.Send_Date__c= null;
+ Orderdet2.Box_Piece__c = '鐩�';
+ conList1.add(Orderdet2);
+
+ //chuhe
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001002';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Product__c = pro2.Id;
+ Orderdet3.Asset_Model_No__c = 'Test02';
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Send_Date__c = Date.today();
+ Orderdet3.Box_Piece__c = '涓�';
+ Orderdet3.RemoveBox_date__c= Date.today();
+ Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
+ Orderdet3.Used_date__c = null;
+ Orderdet3.Lose_Flag__c = false;
+ Orderdet3.Return_date__c= null;
+ conList1.add(Orderdet3);
+
+
+ //sale
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = Order1.Id;
+ Orderdet4.Consumable_Product__c = pro2.Id;
+ Orderdet4.Asset_Model_No__c = 'Test02';
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '涓�';
+ Orderdet4.RemoveBox_date__c= Date.today();
+ Orderdet4.Bar_Code__c = '011495317020843711170400172003311074K250CXSDS';
+ Orderdet4.Lose_Flag__c = false;
+ Orderdet4.Return_date__c= null;
+ Orderdet4.Used_date__c= Date.today();
+ conList1.add(Orderdet4);
+
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //ProductPacking_list_manual__c=1
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001004';
+ Orderdet5.Consumable_order_minor__c = Order1.Id;
+ Orderdet5.Consumable_Product__c = pro3.Id;
+ Orderdet5.Asset_Model_No__c = 'Test03';
+ Orderdet5.Arrive_date__c = Date.today();
+ //Orderdet5.Used_date__c = Date.today();
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.RemoveBox_date__c= Date.today();
+ Orderdet5.Used_date__c = null;
+ Orderdet5.Lose_Flag__c = false;
+ Orderdet5.Return_date__c= null;
+ Orderdet5.Send_Date__c=null;
+ Orderdet5.Bar_Code__c = '010495317014059411170400172203311074K250DCWQW';
+ conList.add(Orderdet5);
+ //pandian
+ Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
+ Orderdet7.Name = 'OCM_01_001004';
+ Orderdet7.Consumable_order_minor__c = Order1.Id;
+ Orderdet7.Consumable_Product__c = pro2.Id;
+ Orderdet7.Asset_Model_No__c = 'Test02';
+ Orderdet7.Box_Piece__c = '鐩�';
+ Orderdet7.Lose_Flag__c = false;
+ Orderdet7.Bar_Code__c = '010495317014059411170400172203311074K250DBVUD';
+ Orderdet7.RemoveBox_date__c= Date.today();
+ Orderdet7.Inventory_date__c= Date.today();
+ conList.add(Orderdet7);
+
+ Consumable_order_details2__c Orderdet8= new Consumable_order_details2__c();
+ Orderdet8.Name = 'OCM_01_001004';
+ Orderdet8.Consumable_order_minor__c = Order1.Id;
+ Orderdet8.Consumable_Product__c = pro2.Id;
+ Orderdet8.Asset_Model_No__c = 'Test02';
+ Orderdet8.Arrive_date__c = Date.today();
+ Orderdet8.Box_Piece__c = '涓�';
+ Orderdet8.Lose_Flag__c = false;
+ Orderdet8.Bar_Code__c = '010495317014059411170400172203311074K250DBVUC';
+ Orderdet8.Used_date__c = null;
+ Orderdet8.Lose_Flag__c = false;
+ Orderdet8.Return_date__c= null;
+ Orderdet8.RemoveBox_date__c=Date.today();
+ Orderdet8.Send_Date__c=null;
+ Orderdet8.RemoveBox_No__c =3;
+ conList.add(Orderdet8);
+ insert conList1;
+ insert conList;
+
+
+ System.Test.startTest();
+ LexRemoveBoxController Controller = new LexRemoveBoxController();
+ LexRemoveBoxController.init();
+ LexRemoveBoxController.searchConsumableorderdetails('01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n011495317020843711170400172003311074K250CXSDS\n010495317014059411170400172203311074K250DCWQW\n010495317014059411170400172203311074K250DBVUD\n010495317014059411170400172203311074K250DBVUC'
+ ,myAccount2.Id,'娣卞湷','ET');
+ LexRemoveBoxController.searchConsumableorderdetails('',myAccount2.Id,'閲嶅簡','ET');
+ LexRemoveBoxController.barcode = '1004\n1003\n1002\n1001';
+ LexRemoveBoxController.getinventorysize();
+ LexRemoveBoxController.removeBoxConfirm(JSON.serialize(conList),'Testaccount002','閲嶅簡','ENG');
+ List<Consumable_order_details2__c> orderDetaList = new List<Consumable_order_details2__c>();
+ LexRemoveBoxController.removeBoxConfirm(JSON.serialize(orderDetaList),'Testaccount002','閲嶅簡','ENG');
+ System.Test.stopTest();
+
+ }
}
+ static testMethod void testMethod1() {
+ user myUser_test;
+ Account myAccount2;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
+ }
- System.runAs(myUser_Test) {
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- StaticParameter.EscapeNFM007Trigger = true;
- StaticParameter.EscapeOpportunityBefUpdTrigger = true;
- StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
- StaticParameter.EscapeSyncOpportunityTrigger = true;
- StaticParameter.EscapeSyncProduct2Trigger = true;
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Packing_list_manual__c = 12,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Packing_list_manual__c = 10,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Packing_list_manual__c = 1,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ System.runAs(myUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Packing_list_manual__c=12,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2,pro3};
+ //璁㈠崟
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ insert Order1;
+ //鍙戣揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟 ';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = '01210000000c9drAAA';
+ Order2.Order_ProType__c = 'ENG';
+ insert Order2;
- //daoku
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001001';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Return_date__c = null;
- Orderdet2.Send_Date__c = null;
- Orderdet2.Box_Piece__c = '鐩�';
- conList1.add(Orderdet2);
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Name = 'OCM_01_001001';
+ con.Consumable_order_minor__c = Order1.Id;
+ con.Consumable_Product__c = pro1.Id;
+ con.Asset_Model_No__c = 'Test01';
+ con.Arrive_date__c = Date.today();
+ con.Bar_Code__c = '10011';
+ con.Used_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Return_date__c= null;
+ con.Send_Date__c= null;
+ con.Box_Piece__c = '鐩�';
+ conList1.add(con);
+
+ // 鏈埌璐�
+ Consumable_order_details2__c con2 = new Consumable_order_details2__c();
+ con2.Arrive_date__c = null;
+ con2.Send_Date__c =null;
+ con2.Used_date__c = null;
+ con2.Return_date__c = null;
+ con2.Lose_Flag__c = false;
+ con2.Box_Piece__c = '鐩�';
+ con2.Consumable_Arrived_order__c = Order2.Id;
+ con2.Consumable_Product__c = pro2.Id;
+ con2.Consumable_order_minor__c = Order2.Id;
+ con2.Bar_Code__c = '10031';
+ conList1.add(con2);
+ //瑙勬牸=1
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c =null;
+ con3.Used_date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Box_Piece__c = '鐩�';
+ con3.Consumable_Arrived_order__c = Order2.Id;
+ con3.Consumable_Product__c = pro3.Id;
+ con3.Consumable_order_minor__c = Order2.Id;
+ con3.RemoveBox_date__c= Date.today();
+ con3.Bar_Code__c = '10032';
+ conList1.add(con3);
- //chuhe
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001002';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Product__c = pro2.Id;
- Orderdet3.Asset_Model_No__c = 'Test02';
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Send_Date__c = Date.today();
- Orderdet3.Box_Piece__c = '涓�';
- Orderdet3.RemoveBox_date__c = Date.today();
- Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA';
- Orderdet3.Used_date__c = null;
- Orderdet3.Lose_Flag__c = false;
- Orderdet3.Return_date__c = null;
- conList1.add(Orderdet3);
-
- //sale
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = Order1.Id;
- Orderdet4.Consumable_Product__c = pro2.Id;
- Orderdet4.Asset_Model_No__c = 'Test02';
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.RemoveBox_date__c = Date.today();
- Orderdet4.Bar_Code__c = '011495317020843711170400172003311074K250CXSDS';
- Orderdet4.Lose_Flag__c = false;
- Orderdet4.Return_date__c = null;
- Orderdet4.Used_date__c = Date.today();
- conList1.add(Orderdet4);
-
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //ProductPacking_list_manual__c=1
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001004';
- Orderdet5.Consumable_order_minor__c = Order1.Id;
- Orderdet5.Consumable_Product__c = pro3.Id;
- Orderdet5.Asset_Model_No__c = 'Test03';
- Orderdet5.Arrive_date__c = Date.today();
- //Orderdet5.Used_date__c = Date.today();
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.RemoveBox_date__c = Date.today();
- Orderdet5.Used_date__c = null;
- Orderdet5.Lose_Flag__c = false;
- Orderdet5.Return_date__c = null;
- Orderdet5.Send_Date__c = null;
- Orderdet5.Bar_Code__c = '010495317014059411170400172203311074K250DCWQW';
- conList.add(Orderdet5);
- //pandian
- Consumable_order_details2__c Orderdet7 = new Consumable_order_details2__c();
- Orderdet7.Name = 'OCM_01_001004';
- Orderdet7.Consumable_order_minor__c = Order1.Id;
- Orderdet7.Consumable_Product__c = pro2.Id;
- Orderdet7.Asset_Model_No__c = 'Test02';
- Orderdet7.Box_Piece__c = '鐩�';
- Orderdet7.Lose_Flag__c = false;
- Orderdet7.Bar_Code__c = '010495317014059411170400172203311074K250DBVUD';
- Orderdet7.RemoveBox_date__c = Date.today();
- Orderdet7.Inventory_date__c = Date.today();
- conList.add(Orderdet7);
-
- Consumable_order_details2__c Orderdet8 = new Consumable_order_details2__c();
- Orderdet8.Name = 'OCM_01_001004';
- Orderdet8.Consumable_order_minor__c = Order1.Id;
- Orderdet8.Consumable_Product__c = pro2.Id;
- Orderdet8.Asset_Model_No__c = 'Test02';
- Orderdet8.Arrive_date__c = Date.today();
- Orderdet8.Box_Piece__c = '涓�';
- Orderdet8.Lose_Flag__c = false;
- Orderdet8.Bar_Code__c = '010495317014059411170400172203311074K250DBVUC';
- Orderdet8.Used_date__c = null;
- Orderdet8.Lose_Flag__c = false;
- Orderdet8.Return_date__c = null;
- Orderdet8.RemoveBox_date__c = Date.today();
- Orderdet8.Send_Date__c = null;
- Orderdet8.RemoveBox_No__c = 3;
- conList.add(Orderdet8);
- insert conList1;
- insert conList;
-
- System.Test.startTest();
- LexRemoveBoxController Controller = new LexRemoveBoxController();
- LexRemoveBoxController.init();
- LexRemoveBoxController.searchConsumableorderdetails(
- '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n011495317020843711170400172003311074K250CXSDS\n010495317014059411170400172203311074K250DCWQW\n010495317014059411170400172203311074K250DBVUD\n010495317014059411170400172203311074K250DBVUC',
- myAccount2.Id,
- '娣卞湷',
- 'ET'
- );
- LexRemoveBoxController.searchConsumableorderdetails(
- '',
- myAccount2.Id,
- '閲嶅簡',
- 'ET'
- );
- LexRemoveBoxController.barcode = '1004\n1003\n1002\n1001';
- LexRemoveBoxController.getinventorysize();
- LexRemoveBoxController.removeBoxConfirm(
- JSON.serialize(conList),
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- List<Consumable_order_details2__c> orderDetaList = new List<Consumable_order_details2__c>();
- LexRemoveBoxController.removeBoxConfirm(
- JSON.serialize(orderDetaList),
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- System.Test.stopTest();
+ insert conList1;
+ System.Test.startTest();
+ LexRemoveBoxController.searchConsumableorderdetails('10011','Testaccount002','閲嶅簡','ET');
+ LexRemoveBoxController.searchConsumableorderdetails('10031\n10032','Testaccount002','閲嶅簡','ENG');
+ System.Test.stopTest();
+ }
}
- }
- static testMethod void testMethod1() {
- user myUser_test;
- Account myAccount2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ static testMethod void testMethod2() {
+ // TO DO: implement unit test
+ user myUser_test;
+ Account myAccount2;
+ Product2__c pro2 ;
+ Product2__c pro3;
+ Product2__c pro1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
+ }
+
+ System.runAs(myUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Packing_list_manual__c=12,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2, pro3};
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ List<Consumable_order__c> orderList1 = new List<Consumable_order__c>();
+ //鍒拌揣
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ET';
+ orderList.add(Order1);
+ //閿�鍞�
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_0144';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '閿�鍞�';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = '01210000000c9duAAA';
+ Order2.Order_ProType__c = 'ENG';
+ orderList.add(Order2);
+ insert orderList;
+
+ //鍑鸿揣
+ Consumable_order__c Order3 = new Consumable_order__c();
+ Order3.Name = 'OCM_03';
+ Order3.Order_status__c = '鎵瑰噯';
+ Order3.Order_type__c = '鍑鸿揣';
+ Order3.Dealer_Info__c = myAccount2.Id;
+ Order3.RecordTypeid = '012100000006Jx9AAE';
+ Order3.Order_ProType__c = 'ENG';
+ orderList1.add(Order3);
+
+ //鍙戣揣
+ Consumable_order__c Order4 = new Consumable_order__c();
+ Order4.Name = 'OCM_03';
+ Order4.Order_status__c = '鎵瑰噯';
+ Order4.Order_type__c = '鍙戣揣';
+ Order4.Dealer_Info__c = myAccount2.Id;
+ Order4.RecordTypeid = '01210000000c9drAAA';
+ Order4.Order_ProType__c = 'ENG';
+ orderList1.add(Order4);
+ insert orderList1;
+
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Name = 'OCM_01_001001';
+ con.Consumable_order_minor__c = Order1.Id;
+ con.Consumable_Product__c = pro1.Id;
+ con.Asset_Model_No__c = 'Test01';
+ con.Arrive_date__c = Date.today();
+ con.Bar_Code__c = '10011';
+ con.Used_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Return_date__c= null;
+ con.Send_Date__c= null;
+ con.Box_Piece__c = '鐩�';
+ conList1.add(con);
+
+ // // 鏈埌璐�
+ Consumable_order_details2__c con2 = new Consumable_order_details2__c();
+ con2.Arrive_date__c = null;
+ con2.Send_Date__c =null;
+ con2.Used_date__c = null;
+ con2.Return_date__c = null;
+ con2.Lose_Flag__c = false;
+ con2.Box_Piece__c = '鐩�';
+ con2.Consumable_Arrived_order__c = Order2.Id;
+ con2.Consumable_Product__c = pro2.Id;
+ con2.Consumable_order_minor__c = Order2.Id;
+ con2.Bar_Code__c = '10031';
+ conList1.add(con2);
+ //瑙勬牸=1
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c =null;
+ con3.Used_date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Box_Piece__c = '鐩�';
+ con3.Consumable_Arrived_order__c = Order2.Id;
+ con3.Consumable_Product__c = pro3.Id;
+ con3.Consumable_order_minor__c = Order2.Id;
+ con3.RemoveBox_date__c= Date.today();
+ con3.Bar_Code__c = '10032';
+ conList1.add(con3);
+
+ insert conList1;
+ System.Test.startTest();
+ LexRemoveBoxController.searchConsumableorderdetails('10031\n10032\n','Testaccount002','閲嶅簡','ENG');
+ System.Test.stopTest();
+ }
}
+ static testMethod void testMethod3() {
+ // TO DO: implement unit test
+ user myUser_test;
+ Account myAccount2;
+ Product2__c pro2 ;
+ Product2__c pro3;
+ Product2__c pro1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
+ }
- System.runAs(myUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Packing_list_manual__c = 12,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Packing_list_manual__c = 10,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- //璁㈠崟
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- insert Order1;
- //鍙戣揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟 ';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = '01210000000c9drAAA';
- Order2.Order_ProType__c = 'ENG';
- insert Order2;
+ System.runAs(myUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Packing_list_manual__c=12,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2,pro3};
+ List<Consumable_order__c> orderList = new List<Consumable_order__c>();
+ //鍒拌揣
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '鍒拌揣';
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.RecordTypeid = '01210000000c9dqAAA';
+ Order1.Order_ProType__c = 'ENG';
+ orderList.add(Order1);
+ //鍙戣揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_01';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟 ';
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.RecordTypeid = '01210000000c9drAAA';
+ Order2.Order_ProType__c = 'ENG';
+ orderList.add(Order2);
+ insert orderList;
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Name = 'OCM_01_001001';
- con.Consumable_order_minor__c = Order1.Id;
- con.Consumable_Product__c = pro1.Id;
- con.Asset_Model_No__c = 'Test01';
- con.Arrive_date__c = Date.today();
- con.Bar_Code__c = '10011';
- con.Used_date__c = null;
- con.Lose_Flag__c = false;
- con.Return_date__c = null;
- con.Send_Date__c = null;
- con.Box_Piece__c = '鐩�';
- conList1.add(con);
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c> ();
+ //浜у搧绫诲瀷涓嶅悓
+ Consumable_order_details2__c con = new Consumable_order_details2__c();
+ con.Name = 'OCM_01_001001';
+ con.Consumable_order_minor__c = Order1.Id;
+ con.Consumable_Product__c = pro1.Id;
+ con.Asset_Model_No__c = 'Test01';
+ con.Arrive_date__c = Date.today();
+ con.Bar_Code__c = '10011';
+ con.Used_date__c = null;
+ con.Lose_Flag__c = false;
+ con.Return_date__c= null;
+ con.Send_Date__c= null;
+ con.Box_Piece__c = '鐩�';
+ conList1.add(con);
+
+ // 鏈埌璐�
+ Consumable_order_details2__c con2 = new Consumable_order_details2__c();
+ con2.Arrive_date__c = null;
+ con2.Send_Date__c =null;
+ con2.Used_date__c = null;
+ con2.Return_date__c = null;
+ con2.Lose_Flag__c = false;
+ con2.Box_Piece__c = '鐩�';
+ con2.Consumable_Arrived_order__c = Order2.Id;
+ con2.Consumable_Product__c = pro2.Id;
+ con2.Consumable_order_minor__c = Order2.Id;
+ con2.Bar_Code__c = '10031';
+ conList1.add(con2);
+ //瑙勬牸=1
+ Consumable_order_details2__c con3 = new Consumable_order_details2__c();
+ con3.Arrive_date__c = Date.today();
+ con3.Send_Date__c =null;
+ con3.Used_date__c = null;
+ con3.Return_date__c = null;
+ con3.Lose_Flag__c = false;
+ con3.Box_Piece__c = '鐩�';
+ con3.Consumable_Arrived_order__c = Order2.Id;
+ con3.Consumable_Product__c = pro3.Id;
+ con3.Consumable_order_minor__c = Order2.Id;
+ con3.RemoveBox_date__c= Date.today();
+ con3.Bar_Code__c = '10032';
+ conList1.add(con3);
- // 鏈埌璐�
- Consumable_order_details2__c con2 = new Consumable_order_details2__c();
- con2.Arrive_date__c = null;
- con2.Send_Date__c = null;
- con2.Used_date__c = null;
- con2.Return_date__c = null;
- con2.Lose_Flag__c = false;
- con2.Box_Piece__c = '鐩�';
- con2.Consumable_Arrived_order__c = Order2.Id;
- con2.Consumable_Product__c = pro2.Id;
- con2.Consumable_order_minor__c = Order2.Id;
- con2.Bar_Code__c = '10031';
- conList1.add(con2);
- //瑙勬牸=1
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = null;
- con3.Used_date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Box_Piece__c = '鐩�';
- con3.Consumable_Arrived_order__c = Order2.Id;
- con3.Consumable_Product__c = pro3.Id;
- con3.Consumable_order_minor__c = Order2.Id;
- con3.RemoveBox_date__c = Date.today();
- con3.Bar_Code__c = '10032';
- conList1.add(con3);
+ insert conList1;
+ System.Test.startTest();
+ LexRemoveBoxController.searchConsumableorderdetails('10011\n10031','Testaccount002','閲嶅簡','ENG');
+ LexRemoveBoxController.searchConsumableorderdetails('10032','Testaccount002','涓婃捣','ENG');
+ LexRemoveBoxController.removeBoxConfirm(JSON.serialize(conList1),'Testaccount002','閲嶅簡','ENG');
+ System.Test.stopTest();
- insert conList1;
- System.Test.startTest();
- LexRemoveBoxController.searchConsumableorderdetails(
- '10011',
- 'Testaccount002',
- '閲嶅簡',
- 'ET'
- );
- LexRemoveBoxController.searchConsumableorderdetails(
- '10031\n10032',
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- System.Test.stopTest();
+
+ }
}
- }
- static testMethod void testMethod2() {
- // TO DO: implement unit test
- user myUser_test;
- Account myAccount2;
- Product2__c pro2;
- Product2__c pro3;
- Product2__c pro1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
- }
-
- System.runAs(myUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Packing_list_manual__c = 12,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Packing_list_manual__c = 10,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- List<Consumable_order__c> orderList1 = new List<Consumable_order__c>();
- //鍒拌揣
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ET';
- orderList.add(Order1);
- //閿�鍞�
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_0144';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '閿�鍞�';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = '01210000000c9duAAA';
- Order2.Order_ProType__c = 'ENG';
- orderList.add(Order2);
- insert orderList;
-
- //鍑鸿揣
- Consumable_order__c Order3 = new Consumable_order__c();
- Order3.Name = 'OCM_03';
- Order3.Order_status__c = '鎵瑰噯';
- Order3.Order_type__c = '鍑鸿揣';
- Order3.Dealer_Info__c = myAccount2.Id;
- Order3.RecordTypeid = '012100000006Jx9AAE';
- Order3.Order_ProType__c = 'ENG';
- orderList1.add(Order3);
-
- //鍙戣揣
- Consumable_order__c Order4 = new Consumable_order__c();
- Order4.Name = 'OCM_03';
- Order4.Order_status__c = '鎵瑰噯';
- Order4.Order_type__c = '鍙戣揣';
- Order4.Dealer_Info__c = myAccount2.Id;
- Order4.RecordTypeid = '01210000000c9drAAA';
- Order4.Order_ProType__c = 'ENG';
- orderList1.add(Order4);
- insert orderList1;
-
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Name = 'OCM_01_001001';
- con.Consumable_order_minor__c = Order1.Id;
- con.Consumable_Product__c = pro1.Id;
- con.Asset_Model_No__c = 'Test01';
- con.Arrive_date__c = Date.today();
- con.Bar_Code__c = '10011';
- con.Used_date__c = null;
- con.Lose_Flag__c = false;
- con.Return_date__c = null;
- con.Send_Date__c = null;
- con.Box_Piece__c = '鐩�';
- conList1.add(con);
-
- // // 鏈埌璐�
- Consumable_order_details2__c con2 = new Consumable_order_details2__c();
- con2.Arrive_date__c = null;
- con2.Send_Date__c = null;
- con2.Used_date__c = null;
- con2.Return_date__c = null;
- con2.Lose_Flag__c = false;
- con2.Box_Piece__c = '鐩�';
- con2.Consumable_Arrived_order__c = Order2.Id;
- con2.Consumable_Product__c = pro2.Id;
- con2.Consumable_order_minor__c = Order2.Id;
- con2.Bar_Code__c = '10031';
- conList1.add(con2);
- //瑙勬牸=1
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = null;
- con3.Used_date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Box_Piece__c = '鐩�';
- con3.Consumable_Arrived_order__c = Order2.Id;
- con3.Consumable_Product__c = pro3.Id;
- con3.Consumable_order_minor__c = Order2.Id;
- con3.RemoveBox_date__c = Date.today();
- con3.Bar_Code__c = '10032';
- conList1.add(con3);
-
- insert conList1;
- System.Test.startTest();
- LexRemoveBoxController.searchConsumableorderdetails(
- '10031\n10032\n',
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- System.Test.stopTest();
- }
- }
- static testMethod void testMethod3() {
- // TO DO: implement unit test
- user myUser_test;
- Account myAccount2;
- Product2__c pro2;
- Product2__c pro3;
- Product2__c pro1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
- }
-
- System.runAs(myUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Packing_list_manual__c = 12,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Packing_list_manual__c = 10,
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200313',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- List<Consumable_order__c> orderList = new List<Consumable_order__c>();
- //鍒拌揣
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '鍒拌揣';
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.RecordTypeid = '01210000000c9dqAAA';
- Order1.Order_ProType__c = 'ENG';
- orderList.add(Order1);
- //鍙戣揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_01';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟 ';
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.RecordTypeid = '01210000000c9drAAA';
- Order2.Order_ProType__c = 'ENG';
- orderList.add(Order2);
- insert orderList;
-
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- //浜у搧绫诲瀷涓嶅悓
- Consumable_order_details2__c con = new Consumable_order_details2__c();
- con.Name = 'OCM_01_001001';
- con.Consumable_order_minor__c = Order1.Id;
- con.Consumable_Product__c = pro1.Id;
- con.Asset_Model_No__c = 'Test01';
- con.Arrive_date__c = Date.today();
- con.Bar_Code__c = '10011';
- con.Used_date__c = null;
- con.Lose_Flag__c = false;
- con.Return_date__c = null;
- con.Send_Date__c = null;
- con.Box_Piece__c = '鐩�';
- conList1.add(con);
-
- // 鏈埌璐�
- Consumable_order_details2__c con2 = new Consumable_order_details2__c();
- con2.Arrive_date__c = null;
- con2.Send_Date__c = null;
- con2.Used_date__c = null;
- con2.Return_date__c = null;
- con2.Lose_Flag__c = false;
- con2.Box_Piece__c = '鐩�';
- con2.Consumable_Arrived_order__c = Order2.Id;
- con2.Consumable_Product__c = pro2.Id;
- con2.Consumable_order_minor__c = Order2.Id;
- con2.Bar_Code__c = '10031';
- conList1.add(con2);
- //瑙勬牸=1
- Consumable_order_details2__c con3 = new Consumable_order_details2__c();
- con3.Arrive_date__c = Date.today();
- con3.Send_Date__c = null;
- con3.Used_date__c = null;
- con3.Return_date__c = null;
- con3.Lose_Flag__c = false;
- con3.Box_Piece__c = '鐩�';
- con3.Consumable_Arrived_order__c = Order2.Id;
- con3.Consumable_Product__c = pro3.Id;
- con3.Consumable_order_minor__c = Order2.Id;
- con3.RemoveBox_date__c = Date.today();
- con3.Bar_Code__c = '10032';
- conList1.add(con3);
-
- insert conList1;
- System.Test.startTest();
- LexRemoveBoxController.searchConsumableorderdetails(
- '10011\n10031',
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- LexRemoveBoxController.searchConsumableorderdetails(
- '10032',
- 'Testaccount002',
- '涓婃捣',
- 'ENG'
- );
- LexRemoveBoxController.removeBoxConfirm(
- JSON.serialize(conList1),
- 'Testaccount002',
- '閲嶅簡',
- 'ENG'
- );
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml b/force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls b/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls
index e536539..badd9d7 100644
--- a/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls
+++ b/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls
@@ -1,115 +1,41 @@
@isTest
private class LexSaleAndDeliveryControllerTest {
- @isTest
- static void testInit() {
- User myUser_test;
- Account myAccount2;
- Product2__c pro2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- Product2 prod02 = new Product2(
- Name = 'Test02181',
- ProductCode = 'Test0218',
- Asset_Model_No__c = 'Test0218',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 12,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'tset8',
- Manual_Entry__c = false
- );
- pro2 = new Product2__c(
- Name = 'Pro002181',
- OT_CODE_Text__c = 'Test002181',
- Product2__c = prod02.Id
- );
- insert pro2;
- myAccount2 = new Account(
- name = 'Testaccount003',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '2'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'wan@salesforce.com',
- firstname = 'wan',
- lastname = 'Plumbers',
- accountid = myAccount2.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- myUser_test.UserPro_Type__c = '';
- update myUser_test;
+ @isTest
+ static void testInit(){
+ User myUser_test;
+ Account myAccount2;
+ Product2__c pro2;
+ User thisUser = [ SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Product2 prod02 = new Product2(Name='Test02181',ProductCode='Test0218',Asset_Model_No__c = 'Test0218',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset8',Manual_Entry__c = false);
+ pro2 = new Product2__c(Name='Pro002181',OT_CODE_Text__c='Test002181',Product2__c = prod02.Id);
+ insert pro2;
+ myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
+ insert myAccount2;
+
+ Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert myUser_test;
+ myUser_test.UserPro_Type__c = '';
+ update myUser_test;
+ }
+ System.runAs(MyUser_Test){
+ String accountId = myUser_test.accountid;
+ String agencyProType = myUser_test.UserPro_Type__c;
+ String userWorkLocation = myUser_test.Work_Location__c;
+ System.Test.startTest();
+ LexSaleAndDeliveryController.init();
+ LexSaleAndDeliveryController.searchOrderInstatus('2023/01/01','2023/12/31',accountId,agencyProType,userWorkLocation,'DB','澶ц繛');
+ LexSaleAndDeliveryController.searchConsumableorderdetails('2023/01/01','2023/12/31',accountId,agencyProType,userWorkLocation,'DB','澶ц繛');
+ LexSaleAndDeliveryController.searchConsumableorFinish('2023/01/01','2023/12/31',accountId,agencyProType,userWorkLocation,'DB','澶ц繛');
+ LexSaleAndDeliveryController.cleanUp(accountId,agencyProType,userWorkLocation);
+ System.Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- String accountId = myUser_test.accountid;
- String agencyProType = myUser_test.UserPro_Type__c;
- String userWorkLocation = myUser_test.Work_Location__c;
- System.Test.startTest();
- LexSaleAndDeliveryController.init();
- LexSaleAndDeliveryController.searchOrderInstatus(
- '2023/01/01',
- '2023/12/31',
- accountId,
- agencyProType,
- userWorkLocation,
- 'DB',
- '澶ц繛'
- );
- LexSaleAndDeliveryController.searchConsumableorderdetails(
- '2023/01/01',
- '2023/12/31',
- accountId,
- agencyProType,
- userWorkLocation,
- 'DB',
- '澶ц繛'
- );
- LexSaleAndDeliveryController.searchConsumableorFinish(
- '2023/01/01',
- '2023/12/31',
- accountId,
- agencyProType,
- userWorkLocation,
- 'DB',
- '澶ц繛'
- );
- LexSaleAndDeliveryController.cleanUp(
- accountId,
- agencyProType,
- userWorkLocation
- );
- System.Test.stopTest();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml b/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexSaleOrderController.cls b/force-app/main/default/classes/LexSaleOrderController.cls
index 11d88ab..a4fbc59 100644
--- a/force-app/main/default/classes/LexSaleOrderController.cls
+++ b/force-app/main/default/classes/LexSaleOrderController.cls
@@ -1,1558 +1,1320 @@
public without sharing class LexSaleOrderController {
- public static boolean isRunning = false;
- public static String barcode { get; set; }
- public static Consumable_order__c coc { get; set; }
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords {
- get;
- set;
- }
- @AuraEnabled
- public static List<Consumable_order_details2__c> consumableorderdetails2Nobox {
- get;
- set;
- }
- @AuraEnabled
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror {
- get;
- set;
- }
- public static Map<String, String> existIdMap { get; set; }
- public static Map<String, String> errorIdMap { get; set; }
- public static Map<String, String> allMap { get; set; }
- public static Map<String, String> orderpieceorboxMap { get; set; }
- public static Map<String, Decimal> orderpriceMap { get; set; }
- public static Map<String, Decimal> orderagencypriceMap { get; set; }
- public static Map<String, Decimal> orderdetCountMap { get; set; }
- public static Map<String, Integer> BarcodeCntMap { get; set; }
- public static String baseUrl { get; private set; }
- public static String ESetId { get; set; }
- public static String accountName { get; set; }
- public static String userWorkLocation { get; set; }
- public static Boolean hasSpecialHos { get; set; }
- public static Map<String, Integer> msiMap { get; set; }
- public static List<Consumable_orderdetails__c> orderdetails { get; set; }
- public static String accountid { get; set; }
+ public static boolean isRunning = false;
+ public static String barcode { get; set; }
+ public static Consumable_order__c coc { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ @AuraEnabled
+ public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { get; set; }
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; }
+ public static Map<String, String> existIdMap { get; set; }
+ public static Map<String, String> errorIdMap { get; set; }
+ public static Map<String, String> allMap { get; set; }
+ public static Map<String, String> orderpieceorboxMap { get; set; }
+ public static Map<String, Decimal> orderpriceMap { get; set; }
+ public static Map<String, Decimal> orderagencypriceMap { get; set; }
+ public static Map<String, Decimal> orderdetCountMap { get; set; }
+ public static Map<String, Integer> BarcodeCntMap { get; set; }
+ public static String baseUrl { get; private set; }
+ public static String ESetId { get; set; }
+ public static String accountName { get; set; }
+ public static String userWorkLocation { get; set; }
+ public static Boolean hasSpecialHos { get; set; }
+ public static Map<String, Integer> msiMap { get; set; }
+ public static List<Consumable_orderdetails__c> orderdetails { get; set; }
+ public static String accountid { get; set; }
- @AuraEnabled
- public static ResponseBodyLWC GoodsDeliveryInit(String ESetId) {
- System.debug('LexSaleOrderController GoodsDeliveryInit');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ @AuraEnabled
+ public static ResponseBodyLWC GoodsDeliveryInit(String ESetId) {
+ System.debug('LexSaleOrderController GoodsDeliveryInit');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
- String UserName = UserInfo.getUserId();
- user useracc = [
- SELECT Accountid, Work_Location__c
- FROM user
- WHERE id = :UserName
- ];
- accountid = useracc.Accountid;
- userWorkLocation = useracc.Work_Location__c;
- Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
- accountName = accountInfo.Name;
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- coc = new Consumable_order__c();
- List<Consumable_order_details2__c> arriveDat = new List<Consumable_order_details2__c>();
- orderpieceorboxMap = new Map<String, String>();
- orderdetails = new List<Consumable_orderdetails__c>();
- orderagencypriceMap = new Map<String, Decimal>();
- orderpriceMap = new Map<String, Decimal>();
- orderdetCountMap = new Map<String, Decimal>();
- if (String.isNotBlank(ESetId)) {
- coc = [
- SELECT
- Id,
- Name,
- NoConfirmedPrice__c,
- Order_ForDealer__r.Name,
- Summons_Order_type__c,
- Order_status__c,
- Dealer_Info__c,
- Dealer_Info__r.Name,
- SummonsStatus_c__c,
- Deliver_date__c,
- Order_Reason__c,
- Order_date__c,
- Order_ForHospital__c,
- SummonsForDirction__c,
- Arrive_Order__c,
- Arrive_Order__r.IsShipment__c,
- Outbound_Date__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_ForCustomerText__c,
- OutPattern__c
- FROM Consumable_order__c
- WHERE Id = :ESetId
- ];
- // update end by vivek 2019-7-16
- if (coc.Arrive_Order__c != null) {
- arriveDat = [
- SELECT
- Id,
- Name,
- recordtypeid,
- Used_account__c,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Guarantee_period_for_products__c,
- Box_Piece__c,
- // gzw add 20210308 鎶ラ敊淇
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE Consumable_ZS_order__c = :ESetId
- ];
- for (Integer j = 0; j < arriveDat.size(); j++) {
- consumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(arriveDat[j])
- );
- }
- }
-
- orderdetails = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_product__r.Name,
- Shipment_Count__c,
- Box_Piece__c,
- Delivery_List_RMB__c,
- Unitprice_To_agency__c,
- isOutPattern__c
- FROM Consumable_orderdetails__c
- WHERE
- Consumable_order__c = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- ];
-
- for (Integer i = 0; i < orderdetails.size(); i++) {
- orderpieceorboxMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Box_Piece__c
- );
- if (
- orderdetails[i].Unitprice_To_agency__c != null &&
- orderdetails[i].Unitprice_To_agency__c != 0
- ) {
- orderagencypriceMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Unitprice_To_agency__c
- );
- }
- orderpriceMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Delivery_List_RMB__c
- );
- orderdetCountMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Shipment_Count__c
- );
- }
- List<hospitalprice__c> hlist = [
- SELECT id
- FROM hospitalprice__c
- WHERE hospital__c = :coc.ShipmentAccount__c AND account__c = :accountid
- ];
- if (hlist == null || hlist.size() == 0) {
- hasSpecialHos = false;
- } else {
- hasSpecialHos = true;
- }
- }
- data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
- data.put(
- 'consumableorderdetailsRecordserror',
- consumableorderdetailsRecordserror
- );
- data.put('coc', coc);
- data.put('accountName', accountName);
- data.put('userWorkLocation', userWorkLocation);
- data.put('accountid', accountid);
- data.put('orderdetails', orderdetails);
- data.put('orderpieceorboxMap', orderpieceorboxMap);
- data.put('orderpriceMap', orderpriceMap);
- data.put('orderagencypriceMap', orderagencypriceMap);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- @AuraEnabled
- public static ResponseBodyLWC SearchPro(
- Consumable_order__c cocLwc,
- String barcodeLwc,
- String accountName,
- String userWorkLocation,
- String accountid,
- List<Consumable_orderdetails__c> orderdetails,
- Map<String, String> orderpieceorboxMap
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- coc = cocLwc;
- orderdetails = orderdetails;
- barcode = barcodeLwc;
- accountName = accountName;
- userWorkLocation = userWorkLocation;
- accountid = accountid;
- orderdetails = orderdetails;
- orderpieceorboxMap = orderpieceorboxMap;
- //鍒ゆ柇鏄惁鍜岃鍗曡仈鍔�
- if (coc.Arrive_Order__c != null) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱銆�'));
- // return;
- return new ResponseBodyLWC('Error', 500, '鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱', '');
- }
- //鍒ゆ柇barcode鏄惁涓虹┖
- if (barcode == null || barcode == '') {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭BarCode鍙枫��'));
- // return;
- return new ResponseBodyLWC('Error', 500, '璇疯緭BarCode鍙�', '');
- }
- list<String> exitlist = new List<String>();
- list<String> notexitlist = new List<String>();
- existIdMap = new Map<String, String>();
- errorIdMap = new Map<String, String>();
- allMap = new Map<String, String>();
- consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
- List<String> barCodeListP = new List<String>();
- List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
- List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
-
- //BarCodelist鍋氭垚
- barCodeListP = ParseBarCode(barcode);
- System.debug('barCodeListP:' + barCodeListP);
- //閽堝鎵�鏈夊晢鍝佸埌璐х‘璁�
- reSet1 = [
- SELECT
- Id,
- Name,
- recordtypeid,
- Used_account__c,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Guarantee_period_for_products__c,
- hospitalSpecialOffer__c,
- exchangeOutPattern__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY RemoveBox_No__c DESC
- ];
- System.debug('reSet1:' + reSet1);
- List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
- Set<Id> proIds = new Set<Id>();
-
- for (String barcode : barCodeListP) {
- Integer idx = 0;
- for (Consumable_order_details2__c cod2 : reSet1) {
- if (cod2.Bar_Code__c == barcode) {
- System.debug('cod2.Bar_Code__c:' + cod2.Bar_Code__c);
- newdet2.add(cod2);
- reSet1.remove(idx);
- proIds.add(cod2.Consumable_product__c);
- break;
- }
- idx++;
- }
- }
- Map<String, String> proHosMap = new Map<String, String>();
- Map<String, String> proIdMap = new Map<String, String>();
- List<hospitalprice__c> hpList = [
- SELECT id, hospital__c, product__c
- FROM hospitalprice__c
- WHERE account__c = :accountid
- ];
- if (hpList != null && hpList.size() > 0) {
- for (hospitalprice__c hp : hpList) {
- if (
- hp.product__c != null &&
- String.valueof(hp.product__c).length() >= 15
- ) {
- proIdMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
- if (hp.hospital__c == coc.Order_ForHospital__c) {
- proHosMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
- }
- }
- }
- }
- for (Integer i = 0; i < orderdetails.size(); i++) {
- for (Integer j = 0; j < newdet2.size(); j++) {
- if (
- newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c &&
- newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c
- ) {
- String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- }
- if (coc.OutPattern__c == true) {
- System.debug(
- 'testPattern:' +
- newdet2[j].Product_Pattern__c +
- '---' +
- orderdetails[i].Product_Pattern__c
- );
- if (
- newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c
- ) {
- //add by rentx 2021-03-22 start
- if (newdet2[j].exchangeOutPattern__c == true) {
- //濡傛灉褰撳墠缁忛攢鍟嗕笅娌℃湁缁存姢瀵瑰簲鐨勭壒浠蜂骇鍝� 鎶ラ敊
- if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
- String str = '娌℃湁缁存姢璇ヤ骇鍝佺殑鐗逛环鍖婚櫌';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- }
- }
- //add by rentx 2021-03-22 end
-
- if (hpList != null && hpList.size() > 0) {
- if (proHosMap.containsKey(newdet2[j].Product_Pattern__c)) {
- continue;
- } else if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
- continue;
- } else {
- String str = '璇ュ晢鍝佸嚭搴撳尰闄㈤敊璇�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- }
- }
- }
- }
- }
- }
-
- //绠$悊缂栫爜涓虹┖鏃讹紝鎶ラ敊
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- Arrive_Owner_Work_Location__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :barCodeListP
- AND Bar_Code__c != NULL
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND (TracingCode__c = NULL
- OR TracingCode__c = '')
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍑哄簱锛岃涓庣壒绾︾粡閿�鍟嗙鐞嗛儴浜哄憳鑱旂郴锛屼慨姝f暟鎹�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- Arrive_Owner_Work_Location__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :barCodeListP
- AND Bar_Code__c != NULL
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Cancellation_Flag__c = TRUE
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓彇娑�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
-
- //涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- Arrive_Owner_Work_Location__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :barCodeListP
- AND Bar_Code__c != NULL
- AND Dealer_Arrive__c = TRUE
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else if (
- !orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)
- ) {
- String str = '涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
-
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- Dealer_Info_text__c,
- Arrive_Owner_Work_Location__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Bar_Code__c IN :barCodeListP
- AND Bar_Code__c != NULL
- AND Dealer_Arrive__c = TRUE
- AND ((Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != :userWorkLocation)
- OR Dealer_Info_text__c != :accountName)
- AND Cancellation_Flag__c = FALSE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Dealer_Returned__c = FALSE
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- // 褰撳墠缁忛攢鍟嗘槸鍚﹀瓨鍦ㄦ浜у搧鍒ゆ柇
- boolean containsFlg = false;
- for (Consumable_order_details2__c cod2 : newdet2) {
- if (cod2.Bar_Code__c == reSet1[i].Bar_Code__c) {
- containsFlg = true;
- break;
- }
- }
- if (containsFlg == false) {
- String str =
- '璇ュ晢鍝佹槸' +
- reSet1[i].Arrive_Owner_Work_Location__c +
- '鐨勫簱瀛�';
- if (reSet1[i].Dealer_Info_text__c != accountName) {
- str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
- }
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- }
-
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Saled__c = TRUE
- AND Box_Piece__c = '鐩�'
- AND Dealer_Info_text__c = :accountName
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Shipment__c = TRUE
- AND Box_Piece__c = '鐩�'
- AND Dealer_Info_text__c = :accountName
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Lose_Flag__c = TRUE
- AND Box_Piece__c = '鐩�'
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忎涪澶�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- reSet = [
- SELECT
- Id,
- Name,
- recordtypeid,
- Used_account__c,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Consumable_order_minor__r.Arrive_Order__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Guarantee_period_for_products__c,
- TracingCode__c,
- Transfer_Time__c,
- Frist_Transfer_Agency__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- ORDER BY RemoveBox_No__c DESC
- ];
- //瀵瑰簲褰曞叆barcode鏁伴噺鐨勬绱㈢粨鏋�
- newdet2 = new List<Consumable_order_details2__c>();
- for (String barcode : barCodeListP) {
- Integer idx = 0;
- for (Consumable_order_details2__c cod2 : reSet) {
- if (cod2.Bar_Code__c == barcode) {
- newdet2.add(cod2);
- reSet.remove(idx);
- break;
- }
- idx++;
- }
- }
- Map<String, String> checkBarcodeResult = new Map<String, String>();
- for (Integer i = 0; i < orderdetails.size(); i++) {
- Integer a = 0;
- for (Integer j = 0; j < newdet2.size(); j++) {
- if (
- newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c &&
- a < orderdetails[i].Shipment_Count__c
- ) {
- if (
- (existIdMap.containsKey(newdet2[j].Bar_Code__c) &&
- newdet2[j].Bar_Code__c == '鐩�') ||
- errorIdMap.containsKey(newdet2[j].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else if (newdet2[j].Isoverdue__c == 0) {
- String str = '璇ュ晢鍝佸凡缁忚秴鍑哄噺鑿屾湁鏁堟湡鐨勬湁鏁堣寖鍥�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- } else if (newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c) {
- String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) {
- Matcher n = Pattern.compile('[0-9]')
- .matcher(newdet2[j].TracingCode__c);
- if (n.find()) {
- if (newdet2[j].TracingCode__c.length() == 5) {
- String tr = newdet2[j].TracingCode__c;
- String Ctr = tr.substring(tr.length() - 3, tr.length());
- String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
- String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
- if (
- Pattern.compile('[0-9]').matcher(Atr).find() ||
- Pattern.compile('[0-9]').matcher(Ctr).find()
- ) {
- String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(
- newdet2[j].Bar_Code__c,
- newdet2[j].Bar_Code__c
- );
- continue;
+ String UserName = UserInfo.getUserId();
+ user useracc = [SELECT Accountid, Work_Location__c FROM user WHERE id = :UserName];
+ accountid = useracc.Accountid;
+ userWorkLocation = useracc.Work_Location__c;
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ coc = new Consumable_order__c();
+ List<Consumable_order_details2__c> arriveDat = new List<Consumable_order_details2__c>();
+ orderpieceorboxMap = new Map<String, String>();
+ orderdetails = new List<Consumable_orderdetails__c>();
+ orderagencypriceMap = new Map<String, Decimal>();
+ orderpriceMap = new Map<String, Decimal>();
+ orderdetCountMap = new Map<String, Decimal>();
+ if (String.isNotBlank(ESetId)) {
+ coc = [
+ SELECT
+ Id,
+ Name,
+ NoConfirmedPrice__c,
+ Order_ForDealer__r.Name,
+ Summons_Order_type__c,
+ Order_status__c,
+ Dealer_Info__c,
+ Dealer_Info__r.Name,
+ SummonsStatus_c__c,
+ Deliver_date__c,
+ Order_Reason__c,
+ Order_date__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Arrive_Order__c,
+ Arrive_Order__r.IsShipment__c,
+ Outbound_Date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_ForCustomerText__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-16
+ if (coc.Arrive_Order__c != null) {
+ arriveDat = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Guarantee_period_for_products__c,
+ Box_Piece__c,
+ // gzw add 20210308 鎶ラ敊淇
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ];
+ for (Integer j = 0; j < arriveDat.size(); j++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(arriveDat[j]));
}
- }
- // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
- // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
- // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- // continue;
}
- checkBarcodeResult.put(
- newdet2[j].Bar_Code__c,
- newdet2[j].Bar_Code__c
- );
- consumableorderdetailsRecords.add(
- new ConsumableorderdetailsInfo(newdet2[j])
- );
- a++;
- existIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- }
- } else if (
- newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c
- ) {
- if (
- a >= orderdetails[i].Shipment_Count__c &&
- orderdetails[i].Box_Piece__c == '涓�'
- ) {
- // 璺宠繃瓒呰繃鏁伴噺鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- //CHAN-C23BWX update by rentx 2021-04-28 start
- // String str = '璇ュ晢鍝佽秴鍑鸿璐ф暟閲�';
- String str = '璇ヤ骇鍝佽秴鍑哄嚭搴撳崟浜у搧鑼冨洿';
- //CHAN-C23BWX update by rentx 2021-04-28 end
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(newdet2[j], str)
- );
- errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
- }
- }
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Bar_Code__c IN :barCodeListP
- AND Dealer_Arrive__c = FALSE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :accountName
- AND ((Consumable_order_minor__c != NULL
- AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
- OR (Consumable_order_minor__c = NULL
- AND Cancellation_Flag__c = FALSE))
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佹湭鍒拌揣纭';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
+ orderdetails = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_product__r.Name,
+ Shipment_Count__c,
+ Box_Piece__c,
+ Delivery_List_RMB__c,
+ Unitprice_To_agency__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ];
- allMap.putAll(errorIdMap);
- allMap.putAll(existIdMap);
- //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
- for (Integer i = 0; i < barCodeListP.size(); i++) {
- if (allMap.containsKey(barCodeListP[i])) {
- continue;
- } else {
- exitlist.add(barCodeListP[i]);
- }
- }
- reSet1 = [
- SELECT
- Id,
- Name,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- recordtypeid,
- Consumable_order_minor__r.Arrive_Order__c,
- Box_Piece__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- (Dealer_Saled__c = TRUE
- OR Dealer_Shipment__c = TRUE)
- AND Dealer_Returned__c = FALSE
- AND Bar_Code__c IN :exitlist
- ORDER BY Name
- ];
- if (reSet1.size() > 0) {
- for (Integer i = 0; i < reSet1.size(); i++) {
- if (
- errorIdMap.containsKey(reSet1[i].Bar_Code__c) ||
- existIdMap.containsKey(reSet1[i].Bar_Code__c)
- ) {
- // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- String str = '璇ュ晢鍝佸凡缁忓嚭璐�';
- consumableorderdetailsRecordserror.add(
- new ConsumableorderdetailsInfo(reSet1[i], str)
- );
- errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
- }
- }
- }
- allMap.putAll(errorIdMap);
- for (Integer i = 0; i < barCodeListP.size(); i++) {
- if (allMap.containsKey(barCodeListP[i])) {
- continue;
- } else {
- notexitlist.add(barCodeListP[i]);
- }
- }
- if (notexitlist.size() > 0) {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notexitlist + '涓嶅瓨鍦ㄣ��'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- 'BarCode鍙�' + notexitlist + '涓嶅瓨鍦ㄣ��',
- ''
- );
- }
- data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
- data.put(
- 'consumableorderdetailsRecordserror',
- consumableorderdetailsRecordserror
- );
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // 鍘荤殑椤甸潰涓婄殑barcode锛岃浆鎹㈡垚List
- public static List<String> ParseBarCode(String Code) {
- String[] Cache = new List<String>{};
- Cache = Code.split('\n');
- List<String> Buff = new List<String>();
- for (String A : Cache) {
- A = A.trim();
- Buff.add(A.toUpperCase());
- }
- return Buff;
- }
-
- // 鍑鸿揣
- @AuraEnabled
- public static ResponseBodyLWC ProdElivery(
- String ESetIdLwc,
- Consumable_order__c cocLwc,
- String barcodeLwc,
- String accountNameLwc,
- String userWorkLocationLwc,
- String consumableorderdetailsRecordsLwc,
- List<Consumable_orderdetails__c> orderdetailsLwc,
- Map<String, Decimal> orderpriceMapLwc,
- Map<String, Decimal> orderagencypriceMapLwc
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- ESetId = ESetIdLwc;
- coc = cocLwc;
- barcode = barcodeLwc;
- accountName = accountNameLwc;
- userWorkLocation = userWorkLocationLwc;
- consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetailsRecordsLwc,
- List<ConsumableorderdetailsInfo>.class
- );
- orderdetails = orderdetailsLwc;
- orderpriceMap = orderpriceMapLwc;
- orderagencypriceMap = orderagencypriceMap;
- BarcodeCntMap = new Map<String, Integer>();
- if (coc.Arrive_Order__r.IsShipment__c == true) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡鍑鸿揣'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡鍑鸿揣', '');
- }
-
- if (consumableorderdetailsRecords.size() < 1) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犲嚭璐ф槑缁�'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '鏃犲嚭璐ф槑缁�', '');
- }
-
- Getconsumableorderdetails2Nobox();
-
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- String key = '' + ass.orderdetails2.Bar_Code__c;
- Integer deliverycnt = BarcodeCntMap.get(key);
- if (
- ass.orderdetails2.Box_Piece__c == '涓�' &&
- (ass.outboundCount == null ||
- String.valueof(ass.outboundCount) == '' ||
- ass.outboundCount <= 0)
- ) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�',
- ''
- );
- }
- if (ass.outboundCount > deliverycnt) {
- // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺',
- ''
- );
- }
- }
-
- for (Integer i = 0; i < orderdetails.size(); i++) {
- Decimal a = 0;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (
- ass.orderdetails2.Product_Pattern__c ==
- orderdetails[i].Product_Pattern__c
- ) {
- a = a + ass.outboundCount;
- }
- }
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+a));
-
- if (a < orderdetails[i].Shipment_Count__c) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍟嗗搧' +
- orderdetails[i].Consumable_product__r.Name +
- '鏁伴噺灏忎簬鍑鸿揣鏁伴噺',
- ''
- );
- } else if (a > orderdetails[i].Shipment_Count__c) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺',
- ''
- );
- }
- }
- List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
- Savepoint sp = Database.setSavepoint();
- List<Consumable_orderdetails__c> orderdetails1List = [
- SELECT Id, Used_date__c
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ];
- try {
- if (orderdetails1List.size() > 0) {
- for (Integer i = 0; i < orderdetails1List.size(); i++) {
- orderdetails1List[i]
- .RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment;
- orderdetails1List[i].Used_date__c = Date.today();
- }
- ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
- }
- //coc.Order_type__c = '鍑鸿揣';
- coc.RecordTypeId = System.Label.RT_ConOrder_Shipment;
- // update start by vivek 2019-7-15
- // coc.SummonsStatus_c__c = '宸插畬鎴�';
- if (coc.NoConfirmedPrice__c) {
- coc.SummonsStatus_c__c = '浠锋牸鏈畾';
- } else {
- coc.SummonsStatus_c__c = '宸插畬鎴�';
- }
- // update start by vivek 2019-7-15
- coc.Outbound_Date__c = Date.today();
- update coc;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.orderdetails2.Box_Piece__c == '涓�') {
- Decimal cnt = 1;
- for (
- Consumable_order_details2__c codctmp : consumableorderdetails2Nobox
- ) {
- Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
- if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
- insDetails.Id = codctmp.Id;
- insDetails.Consumable_Sale_order__c = null;
- insDetails.Consumable_Return_order__c = null;
- insDetails.Consumable_ZS_order__c = ESetId;
- insDetails.Delivery_List_RMB__c = orderpriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- insDetails.Return_date__c = null;
- insDetails.Return_reason__c = null;
- insDetails.Consumable_Shipment_order__c = ESetId;
- insDetails.Send_Date__c = Date.today();
- if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
- insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c ==
- null
- ? 1
- : ass.orderdetails2.Transfer_Time__c + 1;
- insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c ==
- null
- ? coc.Dealer_Info__r.Name
- : ass.orderdetails2.Frist_Transfer_Agency__c;
- insDetails.Agency_Transfer__c = true;
- }
- cnt++;
- Ins.add(insDetails);
- if (cnt > ass.outboundCount)
- break;
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ orderpieceorboxMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Box_Piece__c);
+ if (orderdetails[i].Unitprice_To_agency__c != null && orderdetails[i].Unitprice_To_agency__c != 0) {
+ orderagencypriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Unitprice_To_agency__c);
+ }
+ orderpriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Delivery_List_RMB__c);
+ orderdetCountMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Shipment_Count__c);
}
- }
- } else {
- Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
- insDetails.Id = ass.orderdetails2.Id;
- insDetails.Consumable_Sale_order__c = null;
- insDetails.Consumable_Return_order__c = null;
- insDetails.Consumable_ZS_order__c = ESetId;
- insDetails.Delivery_List_RMB__c = orderpriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- insDetails.Return_date__c = null;
- insDetails.Return_reason__c = null;
- insDetails.Consumable_Shipment_order__c = ESetId;
- insDetails.Send_Date__c = Date.today();
- if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
- insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c ==
- null
- ? 1
- : ass.orderdetails2.Transfer_Time__c + 1;
- insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c ==
- null
- ? coc.Dealer_Info__r.Name
- : ass.orderdetails2.Frist_Transfer_Agency__c;
- insDetails.Agency_Transfer__c = true;
- }
- Ins.add(insDetails);
- }
- }
- if (Ins.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(Ins);
- }
- if (coc.Arrive_Order__c != null) {
- Consumable_order__c OrderUps = new Consumable_order__c();
- OrderUps.Id = coc.Arrive_Order__c;
- OrderUps.IsShipment__c = true;
- update OrderUps;
- }
- } catch (Exception ex) {
- Database.rollback(sp);
- return new ResponseBodyLWC('Error', 500, ex.getMessage(), '');
- }
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // 閿�鍞�
- @AuraEnabled
- public static ResponseBodyLWC ProSale(
- String ESetIdLwc,
- Consumable_order__c cocLwc,
- String barcodeLwc,
- String accountNameLwc,
- String userWorkLocationLwc,
- String consumableorderdetailsRecordsLwc,
- List<Consumable_orderdetails__c> orderdetailsLwc,
- Map<String, Decimal> orderpriceMapLwc,
- Map<String, Decimal> orderagencypriceMapLwc
- ) {
- System.debug('enter ProSale');
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- ESetId = ESetIdLwc;
- coc = cocLwc;
- barcode = barcodeLwc;
- accountName = accountNameLwc;
- userWorkLocation = userWorkLocationLwc;
- consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
- consumableorderdetailsRecordsLwc,
- List<ConsumableorderdetailsInfo>.class
- );
- orderdetails = orderdetailsLwc;
- orderpriceMap = orderpriceMapLwc;
- orderagencypriceMap = orderagencypriceMapLwc;
- System.debug('ESetId = ' + ESetId);
- System.debug('coc = ' + coc);
- System.debug('barcode = ' + barcode);
- System.debug('accountName = ' + accountName);
- System.debug('userWorkLocation = ' + userWorkLocation);
- System.debug(
- 'consumableorderdetailsRecords = ' + consumableorderdetailsRecords
- );
- System.debug('orderdetails = ' + orderdetails);
- System.debug('orderpriceMap = ' + orderpriceMap);
- System.debug('orderagencypriceMap = ' + orderagencypriceMap);
- BarcodeCntMap = new Map<String, Integer>();
-
- if (consumableorderdetailsRecords.size() < 1) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犻攢鍞槑缁�'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '鏃犻攢鍞槑缁�', '');
- }
- if (coc.Arrive_Order__r.IsShipment__c == true) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡閿�鍞�'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡閿�鍞�', '');
- }
- Getconsumableorderdetails2Nobox();
-
- System.debug('BarcodeCntMap = ' + BarcodeCntMap);
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- String key = '' + ass.orderdetails2.Bar_Code__c;
- Integer deliverycnt = BarcodeCntMap.get(key);
- if (
- ass.orderdetails2.Box_Piece__c == '涓�' &&
- (ass.outboundCount == null ||
- String.valueof(ass.outboundCount) == '' ||
- ass.outboundCount <= 0)
- ) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
- // return null;
- System.debug(
- 'ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c
- );
- System.debug('ass.outboundCount = ' + ass.outboundCount);
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�',
- ''
- );
- }
- if (ass.outboundCount > deliverycnt) {
- // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺',
- ''
- );
- }
- }
-
- for (Integer i = 0; i < orderdetails.size(); i++) {
- Decimal a = 0;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (
- ass.orderdetails2.Product_Pattern__c ==
- orderdetails[i].Product_Pattern__c
- ) {
- a = a + ass.outboundCount;
- }
- }
- if (a < orderdetails[i].Shipment_Count__c) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍟嗗搧' +
- orderdetails[i].Consumable_product__r.Name +
- '鏁伴噺灏忎簬鍑鸿揣鏁伴噺',
- ''
- );
- } else if (a > orderdetails[i].Shipment_Count__c) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺',
- ''
- );
- }
- }
-
- Savepoint sp = Database.setSavepoint();
- List<Consumable_orderdetails__c> orderdetails1List = [
- SELECT Id, Used_date__c
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ];
- try {
- if (orderdetails1List.size() > 0) {
- for (Integer i = 0; i < orderdetails1List.size(); i++) {
- orderdetails1List[i]
- .RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
- orderdetails1List[i].Used_date__c = Date.today();
- }
- ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
- }
- //coc.Order_type__c = '閿�鍞�';
- coc.RecordTypeId = System.Label.RT_ConOrder_Sale;
- // update start by vivek 2019-7-15
- // coc.SummonsStatus_c__c = '宸插畬鎴�';
- if (coc.NoConfirmedPrice__c) {
- coc.SummonsStatus_c__c = '浠锋牸鏈畾';
- } else {
- coc.SummonsStatus_c__c = '宸插畬鎴�';
- }
- // update start by vivek 2019-7-15
- coc.Outbound_Date__c = Date.today();
- update coc;
- //閿�鍞槑缁�
- List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
- if (ass.orderdetails2.Box_Piece__c == '涓�') {
- Decimal cnt = 1;
- for (
- Consumable_order_details2__c codctmp : consumableorderdetails2Nobox
- ) {
- Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
- if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
- insDetails.Id = codctmp.Id;
- insDetails.Consumable_Shipment_order__c = null;
- insDetails.Consumable_Return_order__c = null;
- insDetails.Consumable_ZS_order__c = ESetId;
- insDetails.Return_date__c = null;
- insDetails.Delivery_List_RMB__c = orderpriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- if (
- orderagencypriceMap.containsKey(
- ass.orderdetails2.Product_Pattern__c
- ) == true
- ) {
- insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- }
- insDetails.Return_reason__c = null;
- insDetails.Used_date__c = Date.today();
- insDetails.Consumable_Sale_order__c = ESetId;
- cnt++;
- Ins.add(insDetails);
- if (cnt > ass.outboundCount)
- break;
+ List<hospitalprice__c> hlist = [
+ SELECT id
+ FROM hospitalprice__c
+ WHERE hospital__c = :coc.ShipmentAccount__c AND account__c = :accountid
+ ];
+ if (hlist == null || hlist.size() == 0) {
+ hasSpecialHos = false;
+ } else {
+ hasSpecialHos = true;
}
- }
- } else {
- Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
- insDetails.Id = ass.orderdetails2.Id;
- insDetails.Consumable_Shipment_order__c = null;
- insDetails.Consumable_Return_order__c = null;
- insDetails.Consumable_ZS_order__c = ESetId;
- insDetails.Return_date__c = null;
- insDetails.Delivery_List_RMB__c = orderpriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- if (
- orderagencypriceMap.containsKey(
- ass.orderdetails2.Product_Pattern__c
- ) == true
- ) {
- insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(
- ass.orderdetails2.Product_Pattern__c
- );
- }
- insDetails.Return_reason__c = null;
- insDetails.Used_date__c = Date.today();
- insDetails.Consumable_Sale_order__c = ESetId;
- Ins.add(insDetails);
}
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableorderdetails2Nobox +++'+consumableorderdetails2Nobox.size()));
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Ins +++'+Ins));
- //return null;
- if (Ins.size() > 0) {
- ControllerUtil.updateOrderDetailsSatus(Ins);
- }
- if (coc.Arrive_Order__c != null) {
- Consumable_order__c orderUps = new Consumable_order__c();
- orderUps.Id = coc.Arrive_Order__c;
- orderUps.IsShipment__c = true;
- update orderUps;
- }
- } catch (Exception e) {
- Database.rollback(sp);
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getStackTraceString(),
- ''
- );
+ data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror);
+ data.put('coc', coc);
+ data.put('accountName', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('accountid', accountid);
+ data.put('orderdetails', orderdetails);
+ data.put('orderpieceorboxMap', orderpieceorboxMap);
+ data.put('orderpriceMap', orderpriceMap);
+ data.put('orderagencypriceMap', orderagencypriceMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
- public static integer Getconsumableorderdetails2Nobox() {
- if (String.isBlank(barcode)) {
- return 0;
- }
- List<String> barCodeListP = ParseBarCode(barcode);
- consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
- BarcodeCntMap.clear();
- consumableorderdetails2Nobox = [
- SELECT
- Id,
- Name,
- recordtypeid,
- Used_account__c,
- Product_Pattern__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Isoverdue__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Guarantee_period_for_products__c,
- hospitalSpecialOffer__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Box_Piece__c = '涓�'
- ORDER BY RemoveBox_No__c DESC
- ];
-
- AggregateResult[] results = [
- SELECT Bar_Code__c, count(Id) recordCount
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Dealer_Info_text__c = :accountName
- AND Bar_Code__c IN :barCodeListP
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Box_Piece__c = '涓�'
- GROUP BY Bar_Code__c
- ];
-
- for (AggregateResult ar : results) {
- String key = '' + ar.get('Bar_Code__c');
- BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
- }
- return consumableorderdetails2Nobox.size();
- }
-
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
@AuraEnabled
- public Consumable_orderdetails__c orderdetails1 { get; set; }
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public String oldConsumableCount { get; set; }
- @AuraEnabled
- public String ErrorReason { get; set; }
- @AuraEnabled
- public Decimal outboundCount { get; set; }
-
- public ConsumableorderdetailsInfo(
- Consumable_order_details2__c e,
- string str
+ public static ResponseBodyLWC SearchPro(
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountName,
+ String userWorkLocation,
+ String accountid,
+ List<Consumable_orderdetails__c> orderdetails,
+ Map<String, String> orderpieceorboxMap
) {
- orderdetails1 = new Consumable_orderdetails__c();
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.name;
- ErrorReason = str;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ coc = cocLwc;
+ orderdetails = orderdetails;
+ barcode = barcodeLwc;
+ accountName = accountName;
+ userWorkLocation = userWorkLocation;
+ accountid = accountid;
+ orderdetails = orderdetails;
+ orderpieceorboxMap = orderpieceorboxMap;
+ //鍒ゆ柇鏄惁鍜岃鍗曡仈鍔�
+ if (coc.Arrive_Order__c != null) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱銆�'));
+ // return;
+ return new ResponseBodyLWC('Error', 500, '鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱', '');
+ }
+ //鍒ゆ柇barcode鏄惁涓虹┖
+ if (barcode == null || barcode == '') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭BarCode鍙枫��'));
+ // return;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭BarCode鍙�', '');
+ }
+ list<String> exitlist = new List<String>();
+ list<String> notexitlist = new List<String>();
+ existIdMap = new Map<String, String>();
+ errorIdMap = new Map<String, String>();
+ allMap = new Map<String, String>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ List<String> barCodeListP = new List<String>();
+ List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+
+ //BarCodelist鍋氭垚
+ barCodeListP = ParseBarCode(barcode);
+ System.debug('barCodeListP:' + barCodeListP);
+ //閽堝鎵�鏈夊晢鍝佸埌璐х‘璁�
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ hospitalSpecialOffer__c,
+ exchangeOutPattern__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY RemoveBox_No__c DESC
+ ];
+ System.debug('reSet1:' + reSet1);
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ Set<Id> proIds = new Set<Id>();
+
+ for (String barcode : barCodeListP) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ if (cod2.Bar_Code__c == barcode) {
+ System.debug('cod2.Bar_Code__c:' + cod2.Bar_Code__c);
+ newdet2.add(cod2);
+ reSet1.remove(idx);
+ proIds.add(cod2.Consumable_product__c);
+ break;
+ }
+ idx++;
+ }
+ }
+ Map<String, String> proHosMap = new Map<String, String>();
+ Map<String, String> proIdMap = new Map<String, String>();
+ List<hospitalprice__c> hpList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hpList != null && hpList.size() > 0) {
+ for (hospitalprice__c hp : hpList) {
+ if (hp.product__c != null && String.valueof(hp.product__c).length() >= 15) {
+ proIdMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
+ if (hp.hospital__c == coc.Order_ForHospital__c) {
+ proHosMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
+ }
+ }
+ }
+ }
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ for (Integer j = 0; j < newdet2.size(); j++) {
+ if (
+ newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c &&
+ newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c
+ ) {
+ String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ if (coc.OutPattern__c == true) {
+ System.debug('testPattern:'+newdet2[j].Product_Pattern__c+'---'+orderdetails[i].Product_Pattern__c);
+ if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ //add by rentx 2021-03-22 start
+ if (newdet2[j].exchangeOutPattern__c == true) {
+ //濡傛灉褰撳墠缁忛攢鍟嗕笅娌℃湁缁存姢瀵瑰簲鐨勭壒浠蜂骇鍝� 鎶ラ敊
+ if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ String str = '娌℃湁缁存姢璇ヤ骇鍝佺殑鐗逛环鍖婚櫌';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ //add by rentx 2021-03-22 end
+
+ if (hpList != null && hpList.size() > 0) {
+ if (proHosMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ continue;
+ } else if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸嚭搴撳尰闄㈤敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //绠$悊缂栫爜涓虹┖鏃讹紝鎶ラ敊
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND (TracingCode__c = NULL
+ OR TracingCode__c = '')
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍑哄簱锛岃涓庣壒绾︾粡閿�鍟嗙鐞嗛儴浜哄憳鑱旂郴锛屼慨姝f暟鎹�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Cancellation_Flag__c = TRUE
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓彇娑�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ //涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (!orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)) {
+ String str = '涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ Dealer_Info_text__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND ((Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ OR Dealer_Info_text__c != :accountName)
+ AND Cancellation_Flag__c = FALSE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ // 褰撳墠缁忛攢鍟嗘槸鍚﹀瓨鍦ㄦ浜у搧鍒ゆ柇
+ boolean containsFlg = false;
+ for (Consumable_order_details2__c cod2 : newdet2) {
+ if (cod2.Bar_Code__c == reSet1[i].Bar_Code__c) {
+ containsFlg = true;
+ break;
+ }
+ }
+ if (containsFlg == false) {
+ String str = '璇ュ晢鍝佹槸' + reSet1[i].Arrive_Owner_Work_Location__c + '鐨勫簱瀛�';
+ if (reSet1[i].Dealer_Info_text__c != accountName) {
+ str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
+ }
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Saled__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Shipment__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Lose_Flag__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忎涪澶�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ TracingCode__c,
+ Transfer_Time__c,
+ Frist_Transfer_Agency__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY RemoveBox_No__c DESC
+ ];
+ //瀵瑰簲褰曞叆barcode鏁伴噺鐨勬绱㈢粨鏋�
+ newdet2 = new List<Consumable_order_details2__c>();
+ for (String barcode : barCodeListP) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c cod2 : reSet) {
+ if (cod2.Bar_Code__c == barcode) {
+ newdet2.add(cod2);
+ reSet.remove(idx);
+ break;
+ }
+ idx++;
+ }
+ }
+ Map<String, String> checkBarcodeResult = new Map<String, String>();
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Integer a = 0;
+ for (Integer j = 0; j < newdet2.size(); j++) {
+ if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && a < orderdetails[i].Shipment_Count__c) {
+ if (
+ (existIdMap.containsKey(newdet2[j].Bar_Code__c) && newdet2[j].Bar_Code__c == '鐩�') ||
+ errorIdMap.containsKey(newdet2[j].Bar_Code__c)
+ ) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (newdet2[j].Isoverdue__c == 0) {
+ String str = '璇ュ晢鍝佸凡缁忚秴鍑哄噺鑿屾湁鏁堟湡鐨勬湁鏁堣寖鍥�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ } else if (newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c) {
+ String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) {
+ Matcher n = Pattern.compile('[0-9]').matcher(newdet2[j].TracingCode__c);
+ if (n.find()) {
+ if (newdet2[j].TracingCode__c.length() == 5) {
+ String tr = newdet2[j].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3, tr.length());
+ String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
+ String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ // continue;
+ }
+ checkBarcodeResult.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(newdet2[j]));
+ a++;
+ existIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ } else if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ if (a >= orderdetails[i].Shipment_Count__c && orderdetails[i].Box_Piece__c == '涓�') {
+ // 璺宠繃瓒呰繃鏁伴噺鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ //CHAN-C23BWX update by rentx 2021-04-28 start
+ // String str = '璇ュ晢鍝佽秴鍑鸿璐ф暟閲�';
+ String str = '璇ヤ骇鍝佽秴鍑哄嚭搴撳崟浜у搧鑼冨洿';
+ //CHAN-C23BWX update by rentx 2021-04-28 end
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Bar_Code__c IN :barCodeListP
+ AND Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != NULL
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR (Consumable_order_minor__c = NULL
+ AND Cancellation_Flag__c = FALSE))
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佹湭鍒拌揣纭';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ allMap.putAll(errorIdMap);
+ allMap.putAll(existIdMap);
+ //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
+ for (Integer i = 0; i < barCodeListP.size(); i++) {
+ if (allMap.containsKey(barCodeListP[i])) {
+ continue;
+ } else {
+ exitlist.add(barCodeListP[i]);
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE (Dealer_Saled__c = TRUE OR Dealer_Shipment__c = TRUE) AND Dealer_Returned__c = FALSE AND Bar_Code__c IN :exitlist
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓嚭璐�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ allMap.putAll(errorIdMap);
+ for (Integer i = 0; i < barCodeListP.size(); i++) {
+ if (allMap.containsKey(barCodeListP[i])) {
+ continue;
+ } else {
+ notexitlist.add(barCodeListP[i]);
+ }
+ }
+ if (notexitlist.size() > 0) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notexitlist + '涓嶅瓨鍦ㄣ��'));
+ return new ResponseBodyLWC('Error', 500, 'BarCode鍙�' + notexitlist + '涓嶅瓨鍦ㄣ��', '');
+ }
+ data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- orderdetails1 = new Consumable_orderdetails__c();
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- if (e.Box_Piece__c == '鐩�') {
- outboundCount = 1;
- }
- oldConsumableCount = e.name;
+ // 鍘荤殑椤甸潰涓婄殑barcode锛岃浆鎹㈡垚List
+ public static List<String> ParseBarCode(String Code) {
+ String[] Cache = new List<String>{};
+ Cache = Code.split('\n');
+ List<String> Buff = new List<String>();
+ for (String A : Cache) {
+ A = A.trim();
+ Buff.add(A.toUpperCase());
+ }
+ return Buff;
}
- public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
- orderdetails1 = e;
- Prod = e.Consumable_Product__r;
- outboundCount = e.Shipment_Count__c;
+ // 鍑鸿揣
+ @AuraEnabled
+ public static ResponseBodyLWC ProdElivery(
+ String ESetIdLwc,
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String consumableorderdetailsRecordsLwc,
+ List<Consumable_orderdetails__c> orderdetailsLwc,
+ Map<String, Decimal> orderpriceMapLwc,
+ Map<String, Decimal> orderagencypriceMapLwc
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ ESetId = ESetIdLwc;
+ coc = cocLwc;
+ barcode = barcodeLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLwc,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ orderdetails = orderdetailsLwc;
+ orderpriceMap = orderpriceMapLwc;
+ orderagencypriceMap = orderagencypriceMap;
+ BarcodeCntMap = new Map<String, Integer>();
+ if (coc.Arrive_Order__r.IsShipment__c == true) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡鍑鸿揣'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡鍑鸿揣', '');
+ }
+
+ if (consumableorderdetailsRecords.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犲嚭璐ф槑缁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鏃犲嚭璐ф槑缁�', '');
+ }
+
+ Getconsumableorderdetails2Nobox();
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ String key = '' + ass.orderdetails2.Bar_Code__c;
+ Integer deliverycnt = BarcodeCntMap.get(key);
+ if (
+ ass.orderdetails2.Box_Piece__c == '涓�' &&
+ (ass.outboundCount == null ||
+ String.valueof(ass.outboundCount) == '' ||
+ ass.outboundCount <= 0)
+ ) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�', '');
+ }
+ if (ass.outboundCount > deliverycnt) {
+ // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺', '');
+ }
+ }
+
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Decimal a = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ a = a + ass.outboundCount;
+ }
+ }
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+a));
+
+ if (a < orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '鏁伴噺灏忎簬鍑鸿揣鏁伴噺', '');
+ } else if (a > orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺', '');
+ }
+ }
+ List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
+ Savepoint sp = Database.setSavepoint();
+ List<Consumable_orderdetails__c> orderdetails1List = [
+ SELECT Id, Used_date__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ];
+ try {
+ if (orderdetails1List.size() > 0) {
+ for (Integer i = 0; i < orderdetails1List.size(); i++) {
+ orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment;
+ orderdetails1List[i].Used_date__c = Date.today();
+ }
+ ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
+ }
+ //coc.Order_type__c = '鍑鸿揣';
+ coc.RecordTypeId = System.Label.RT_ConOrder_Shipment;
+ // update start by vivek 2019-7-15
+ // coc.SummonsStatus_c__c = '宸插畬鎴�';
+ if (coc.NoConfirmedPrice__c) {
+ coc.SummonsStatus_c__c = '浠锋牸鏈畾';
+ } else {
+ coc.SummonsStatus_c__c = '宸插畬鎴�';
+ }
+ // update start by vivek 2019-7-15
+ coc.Outbound_Date__c = Date.today();
+ update coc;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Box_Piece__c == '涓�') {
+ Decimal cnt = 1;
+ for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ insDetails.Id = codctmp.Id;
+ insDetails.Consumable_Sale_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ insDetails.Return_date__c = null;
+ insDetails.Return_reason__c = null;
+ insDetails.Consumable_Shipment_order__c = ESetId;
+ insDetails.Send_Date__c = Date.today();
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null
+ ? 1
+ : ass.orderdetails2.Transfer_Time__c + 1;
+ insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null
+ ? coc.Dealer_Info__r.Name
+ : ass.orderdetails2.Frist_Transfer_Agency__c;
+ insDetails.Agency_Transfer__c = true;
+ }
+ cnt++;
+ Ins.add(insDetails);
+ if (cnt > ass.outboundCount)
+ break;
+ }
+ }
+ } else {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ insDetails.Id = ass.orderdetails2.Id;
+ insDetails.Consumable_Sale_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ insDetails.Return_date__c = null;
+ insDetails.Return_reason__c = null;
+ insDetails.Consumable_Shipment_order__c = ESetId;
+ insDetails.Send_Date__c = Date.today();
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null
+ ? 1
+ : ass.orderdetails2.Transfer_Time__c + 1;
+ insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null
+ ? coc.Dealer_Info__r.Name
+ : ass.orderdetails2.Frist_Transfer_Agency__c;
+ insDetails.Agency_Transfer__c = true;
+ }
+ Ins.add(insDetails);
+ }
+ }
+ if (Ins.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(Ins);
+ }
+ if (coc.Arrive_Order__c != null) {
+ Consumable_order__c OrderUps = new Consumable_order__c();
+ OrderUps.Id = coc.Arrive_Order__c;
+ OrderUps.IsShipment__c = true;
+ update OrderUps;
+ }
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ return new ResponseBodyLWC('Error', 500, ex.getMessage(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- return null;
+
+ // 閿�鍞�
+ @AuraEnabled
+ public static ResponseBodyLWC ProSale(
+ String ESetIdLwc,
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String consumableorderdetailsRecordsLwc,
+ List<Consumable_orderdetails__c> orderdetailsLwc,
+ Map<String, Decimal> orderpriceMapLwc,
+ Map<String, Decimal> orderagencypriceMapLwc
+ ) {
+ System.debug('enter ProSale');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ ESetId = ESetIdLwc;
+ coc = cocLwc;
+ barcode = barcodeLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLwc,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ orderdetails = orderdetailsLwc;
+ orderpriceMap = orderpriceMapLwc;
+ orderagencypriceMap = orderagencypriceMapLwc;
+ System.debug('ESetId = ' + ESetId);
+ System.debug('coc = ' + coc);
+ System.debug('barcode = ' + barcode);
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ System.debug('consumableorderdetailsRecords = ' + consumableorderdetailsRecords);
+ System.debug('orderdetails = ' + orderdetails);
+ System.debug('orderpriceMap = ' + orderpriceMap);
+ System.debug('orderagencypriceMap = ' + orderagencypriceMap);
+ BarcodeCntMap = new Map<String, Integer>();
+
+ if (consumableorderdetailsRecords.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犻攢鍞槑缁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鏃犻攢鍞槑缁�', '');
+ }
+ if (coc.Arrive_Order__r.IsShipment__c == true) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡閿�鍞�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡閿�鍞�', '');
+ }
+ Getconsumableorderdetails2Nobox();
+
+ System.debug('BarcodeCntMap = ' + BarcodeCntMap);
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ String key = '' + ass.orderdetails2.Bar_Code__c;
+ Integer deliverycnt = BarcodeCntMap.get(key);
+ if (
+ ass.orderdetails2.Box_Piece__c == '涓�' &&
+ (ass.outboundCount == null ||
+ String.valueof(ass.outboundCount) == '' ||
+ ass.outboundCount <= 0)
+ ) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
+ // return null;
+ System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c);
+ System.debug('ass.outboundCount = ' + ass.outboundCount);
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�', '');
+ }
+ if (ass.outboundCount > deliverycnt) {
+ // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺', '');
+ }
+ }
+
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Decimal a = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ a = a + ass.outboundCount;
+ }
+ }
+ if (a < orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '鏁伴噺灏忎簬鍑鸿揣鏁伴噺', '');
+ } else if (a > orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺', '');
+ }
+ }
+
+ Savepoint sp = Database.setSavepoint();
+ List<Consumable_orderdetails__c> orderdetails1List = [
+ SELECT Id, Used_date__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ];
+ try {
+ if (orderdetails1List.size() > 0) {
+ for (Integer i = 0; i < orderdetails1List.size(); i++) {
+ orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
+ orderdetails1List[i].Used_date__c = Date.today();
+ }
+ ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
+ }
+ //coc.Order_type__c = '閿�鍞�';
+ coc.RecordTypeId = System.Label.RT_ConOrder_Sale;
+ // update start by vivek 2019-7-15
+ // coc.SummonsStatus_c__c = '宸插畬鎴�';
+ if (coc.NoConfirmedPrice__c) {
+ coc.SummonsStatus_c__c = '浠锋牸鏈畾';
+ } else {
+ coc.SummonsStatus_c__c = '宸插畬鎴�';
+ }
+ // update start by vivek 2019-7-15
+ coc.Outbound_Date__c = Date.today();
+ update coc;
+ //閿�鍞槑缁�
+ List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Box_Piece__c == '涓�') {
+ Decimal cnt = 1;
+ for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ insDetails.Id = codctmp.Id;
+ insDetails.Consumable_Shipment_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Return_date__c = null;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) {
+ insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ }
+ insDetails.Return_reason__c = null;
+ insDetails.Used_date__c = Date.today();
+ insDetails.Consumable_Sale_order__c = ESetId;
+ cnt++;
+ Ins.add(insDetails);
+ if (cnt > ass.outboundCount)
+ break;
+ }
+ }
+ } else {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ insDetails.Id = ass.orderdetails2.Id;
+ insDetails.Consumable_Shipment_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Return_date__c = null;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) {
+ insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ }
+ insDetails.Return_reason__c = null;
+ insDetails.Used_date__c = Date.today();
+ insDetails.Consumable_Sale_order__c = ESetId;
+ Ins.add(insDetails);
+ }
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableorderdetails2Nobox +++'+consumableorderdetails2Nobox.size()));
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Ins +++'+Ins));
+ //return null;
+ if (Ins.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(Ins);
+ }
+ if (coc.Arrive_Order__c != null) {
+ Consumable_order__c orderUps = new Consumable_order__c();
+ orderUps.Id = coc.Arrive_Order__c;
+ orderUps.IsShipment__c = true;
+ update orderUps;
+ }
+ } catch (Exception e) {
+ Database.rollback(sp);
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- }
-}
+
+ public static integer Getconsumableorderdetails2Nobox() {
+ if (String.isBlank(barcode)) {
+ return 0;
+ }
+ List<String> barCodeListP = ParseBarCode(barcode);
+ consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
+ BarcodeCntMap.clear();
+ consumableorderdetails2Nobox = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ ORDER BY RemoveBox_No__c DESC
+ ];
+
+ AggregateResult[] results = [
+ SELECT Bar_Code__c, count(Id) recordCount
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ GROUP BY Bar_Code__c
+ ];
+
+ for (AggregateResult ar : results) {
+ String key = '' + ar.get('Bar_Code__c');
+ BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
+ }
+ return consumableorderdetails2Nobox.size();
+ }
+
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public String oldConsumableCount { get; set; }
+ @AuraEnabled
+ public String ErrorReason { get; set; }
+ @AuraEnabled
+ public Decimal outboundCount { get; set; }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
+ orderdetails1 = new Consumable_orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails1 = new Consumable_orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ if (e.Box_Piece__c == '鐩�') {
+ outboundCount = 1;
+ }
+ oldConsumableCount = e.name;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ Prod = e.Consumable_Product__r;
+ outboundCount = e.Shipment_Count__c;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSaleOrderControllerTest.cls b/force-app/main/default/classes/LexSaleOrderControllerTest.cls
index 590f4c6..069402b 100644
--- a/force-app/main/default/classes/LexSaleOrderControllerTest.cls
+++ b/force-app/main/default/classes/LexSaleOrderControllerTest.cls
@@ -1,1919 +1,1175 @@
@isTest
private class LexSaleOrderControllerTest {
- public static Map<String, String> orderpieceorboxMap;
- public static Map<String, Decimal> orderpriceMap;
- public static Map<String, Decimal> orderagencypriceMap;
- public static Map<String, Decimal> orderdetCountMap;
- public static Map<String, String> existIdMap;
- public static Map<String, String> errorIdMap;
- public static Map<String, String> allMap;
- @isTest
- static void testInit() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHp = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHp.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp[0].Id,
- AgentCode_Ext__c = '9999999'
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '澶ц繛'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String Id = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
- FROM User
- WHERE id = :Id
- ];
- String accountId = thisUserInfo.Contact.AccountId;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- String accountName;
- Account[] accountInfo = [
- SELECT Name
- FROM account
- WHERE id = :accountId
- LIMIT 1
- ];
- if (accountInfo.size() > 0) {
- accountName = accountInfo[0].Name;
- }
-
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Deliver_date__c = Date.today();
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.Order_ForDealerText__c = 'Test';
- Order1.Order_ProType__c = 'ENG';
- Order1.Delivery_detail_count__c = 5;
- Order1.IsShipment__c = true;
- insert Order1;
- //鍒拌揣
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'testMing2';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Deliver_date__c = Date.today();
- Order2.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- Order2.Order_type__c = '璁㈠崟';
- Order2.Order_ProType__c = 'ENG';
- Order2.Arrive_Order__c = Order1.Id;
- Order2.Delivery_detail_count__c = 5;
- insert Order2;
-
- List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
- //鍦ㄥ簱 鐩�
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001002';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '11111250AAAAA';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Box_Piece__c = '鐩�';
- Orderdet1.TracingCode__c = 'AAAAA';
- //鏈埌璐�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_02_001002';
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '22222250BBBBB';
- Orderdet2.Consumable_Product__c = pro2.Id;
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.TracingCode__c = 'BBBBB';
- //閿�鍞�
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '33333250CCCCC';
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Used_date__c = Date.today();
- Orderdet3.Send_Date__c = Date.today();
- Orderdet3.Arrive_date__c = Date.today();
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.TracingCode__c = 'CCCCC';
-
- //鍦ㄥ簱 涓�
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Bar_Code__c = '44444250DDDDD';
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.TracingCode__c = 'DDDDD';
-
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_01_001004';
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '55555250EEEEE';
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Arrive_date__c = Date.today();
- Orderdet5.TracingCode__c = 'EEEEE';
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5
- };
-
- Consumable_order__c zsd01 = new Consumable_order__c();
- zsd01.Name = 'ZSD_01_001';
- zsd01.Order_type__c = '浼犵エ';
- zsd01.SummonsStatus_c__c = '宸插畬鎴�';
- zsd01.Order_type__c = '璁㈠崟';
- zsd01.RecordTypeid = System.Label.RT_ConOrder_Order;
- zsd01.Summons_Sale_Status__c = '閿�鍞�';
- zsd01.Outbound_Date__c = Date.today();
- zsd01.IsShipment__c = true;
- insert zsd01;
- System.debug('zsd01:' + zsd01.Id);
-
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- Consumable_orderdetails__c Orderdet6 = new Consumable_orderdetails__c();
- Orderdet6.Name = 'ZSD_01_001001';
- Orderdet6.Consumable_order__c = zsd01.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet6.Consumable_Count__c = 12;
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Delivery_List_RMB__c = 1;
- Orderdet6.Shipment_Count__c = 1;
- Orderdet6.Unitprice_To_agency__c = 1.00;
- Orderdet6.Dealer_Custom_Price__c = 999.00;
- Orderdet6.isOutPattern__c = true;
- Orderdet6.Box_Piece__c = '涓�';
- orderdetails.add(Orderdet6);
- Consumable_orderdetails__c Orderdetc6 = new Consumable_orderdetails__c();
- Orderdetc6.Name = 'ZSD_01_001001';
- Orderdetc6.Consumable_order__c = zsd01.Id;
- Orderdetc6.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdetc6.Consumable_Count__c = 12;
- Orderdetc6.Consumable_Product__c = pro2.Id;
- Orderdetc6.Delivery_List_RMB__c = 1;
- Orderdetc6.Unitprice_To_agency__c = 1.00;
- Orderdetc6.Dealer_Custom_Price__c = 999.00;
- Orderdetc6.Shipment_Count__c = 1;
- Orderdetc6.isOutPattern__c = true;
- Orderdetc6.Box_Piece__c = '鐩�';
- orderdetails.add(Orderdetc6);
- insert orderdetails;
- System.debug('orderdetails:' + orderdetails.size());
-
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert hp1;
-
- orderpieceorboxMap = new Map<String, String>();
- orderagencypriceMap = new Map<String, Decimal>();
- orderpriceMap = new Map<String, Decimal>();
- orderdetCountMap = new Map<String, Decimal>();
- if (orderdetails.size() > 0) {
- for (Integer i = 0; i < orderdetails.size(); i++) {
- orderpieceorboxMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Box_Piece__c
- );
- if (
- orderdetails[i].Unitprice_To_agency__c != null &&
- orderdetails[i].Unitprice_To_agency__c != 0
- ) {
- orderagencypriceMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Unitprice_To_agency__c
- );
- }
- orderpriceMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Delivery_List_RMB__c
- );
- orderdetCountMap.put(
- orderdetails[i].Product_Pattern__c,
- orderdetails[i].Shipment_Count__c
- );
+ public static Map<String, String> orderpieceorboxMap;
+ public static Map<String, Decimal> orderpriceMap;
+ public static Map<String, Decimal> orderagencypriceMap ;
+ public static Map<String, Decimal> orderdetCountMap;
+ public static Map<String, String> existIdMap;
+ public static Map<String, String> errorIdMap;
+ public static Map<String, String> allMap;
+ @isTest
+ static void testInit(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ User thisUser = [SELECT Id FROM User WHERE Id =:UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = true AND SobjectType = 'Account' AND Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectHp = [SELECT Id FROM RecordType WHERE IsActive = true AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
+ if (rectHp.size() == 0) {
+ return;
+ }
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '9999900');
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp[0].Id, AgentCode_Ext__c = '9999999');
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='澶ц繛');
+ insert userTest;
}
- }
- String ESetId = Order2.Id;
- System.Test.startTest();
- LexSaleOrderController.GoodsDeliveryInit(ESetId);
- String barcode1 = '';
- String key = '';
- String baseUrl = '';
- Integer a = 0;
- List<LexSaleOrderController.ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
- Map<String, Integer> msiMap = new Map<String, Integer>();
- LexSaleOrderController.SearchPro(
- Order1,
- barcode1,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- String barcode = '11111250AAAAA\n22222250BBBBB\n33333250CCCCC\n44444250DDDDD\n55555250EEEEE\n666666\n777777\naaa';
- LexSaleOrderController.ParseBarCode(barcode);
- LexSaleOrderController.SearchPro(
- Order2,
- barcode,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- ESetId,
- Order2,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- ESetId,
- Order2,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.Getconsumableorderdetails2Nobox();
+ System.runAs(userTest){
+ String Id = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid,ContactId,Contact.AccountId, Work_Location__c FROM User WHERE id =:Id];
+ String accountId = thisUserInfo.Contact.AccountId;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ String accountName;
+ Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
+ if(accountInfo.size() > 0 ){
+ accountName = accountInfo[0].Name;
+ }
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
- for (LexSaleOrderController.ConsumableorderdetailsInfo ass : inList) {
- ass.orderdetails2 = Orderdet1;
- inList1.add(ass);
- }
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Deliver_date__c = Date.today();
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.Order_ForDealerText__c = 'Test';
+ Order1.Order_ProType__c = 'ENG';
+ Order1.Delivery_detail_count__c = 5;
+ Order1.IsShipment__c = true;
+ insert Order1;
+ //鍒拌揣
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'testMing2';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Deliver_date__c = Date.today();
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.Order_ProType__c = 'ENG';
+ Order2.Arrive_Order__c = Order1.Id;
+ Order2.Delivery_detail_count__c = 5;
+ insert Order2;
- String errorReason = 'success';
- LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet1,
- errorReason
- );
- c2.orderdetails1 = null;
- c2.orderdetails2 = Orderdet1;
- c2.Prod = Orderdet1.Consumable_product__r;
- c2.oldConsumableCount = Orderdet1.Name;
- c2.ErrorReason = errorReason;
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ //鍦ㄥ簱 鐩�
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001002';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '11111250AAAAA';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Box_Piece__c = '鐩�';
+ Orderdet1.TracingCode__c = 'AAAAA';
+ //鏈埌璐�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_02_001002';
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '22222250BBBBB';
+ Orderdet2.Consumable_Product__c = pro2.Id;
+ Orderdet2.Box_Piece__c = '鐩�';
+ Orderdet2.TracingCode__c = 'BBBBB';
+ //閿�鍞�
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '33333250CCCCC';
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Used_date__c = Date.today();
+ Orderdet3.Send_Date__c = Date.today();
+ Orderdet3.Arrive_date__c = Date.today();
+ Orderdet3.Box_Piece__c = '鐩�';
+ Orderdet3.TracingCode__c = 'CCCCC';
- LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet2
- );
- c1.orderdetails1 = null;
- c1.orderdetails2 = Orderdet2;
- c1.Prod = Orderdet2.Consumable_product__r;
- c1.oldConsumableCount = Orderdet2.Name;
- c1.compareTo(c2);
+ //鍦ㄥ簱 涓�
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet4.Bar_Code__c = '44444250DDDDD';
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '涓�';
+ Orderdet4.TracingCode__c = 'DDDDD';
- LexSaleOrderController.ConsumableorderdetailsInfo c3 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet6
- );
- c3.orderdetails1 = Orderdet6;
- c3.Prod = Orderdet6.Consumable_product__r;
- c3.outboundCount = Orderdet6.Shipment_Count__c;
- System.Test.stopTest();
- }
- }
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_01_001004';
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet5.Bar_Code__c = '55555250EEEEE';
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Arrive_date__c = Date.today();
+ Orderdet5.TracingCode__c = 'EEEEE';
+ insert new Consumable_order_details2__c[] {Orderdet1,Orderdet2,Orderdet3,Orderdet4,Orderdet5};
- @isTest
- static void testArriveOrder() {
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- Account myAccount2;
- Account olympus;
- User MyUser_Test;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType hosCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- olympus = new Account(
- RecordTypeId = hosCo.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount2 = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '澶ц繛'
- );
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- String Id = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
- FROM User
- WHERE id = :Id
- ];
- String accountId = thisUserInfo.Contact.AccountId;
- String userWorkLocation1 = thisUserInfo.Work_Location__c;
- String accountName = myAccount2.Name;
- System.debug('accountName = ' + accountName);
- System.debug('userWorkLocation1 = ' + userWorkLocation1);
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ Consumable_order__c zsd01 = new Consumable_order__c();
+ zsd01.Name = 'ZSD_01_001';
+ zsd01.Order_type__c = '浼犵エ';
+ zsd01.SummonsStatus_c__c ='宸插畬鎴�';
+ zsd01.Order_type__c = '璁㈠崟';
+ zsd01.RecordTypeid = System.Label.RT_ConOrder_Order;
+ zsd01.Summons_Sale_Status__c = '閿�鍞�';
+ zsd01.Outbound_Date__c = Date.today();
+ zsd01.IsShipment__c = true;
+ insert zsd01;
+ System.debug('zsd01:' + zsd01.Id);
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.IsShipment__c = true;
- Order1.OwnerId = MyUser_Test.Id;
- insert Order1;
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ Consumable_orderdetails__c Orderdet6 = new Consumable_orderdetails__c();
+ Orderdet6.Name = 'ZSD_01_001001';
+ Orderdet6.Consumable_order__c = zsd01.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail1_Order ;
+ Orderdet6.Consumable_Count__c = 12;
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Delivery_List_RMB__c = 1;
+ Orderdet6.Shipment_Count__c = 1;
+ Orderdet6.Unitprice_To_agency__c = 1.00;
+ Orderdet6.Dealer_Custom_Price__c = 999.00;
+ Orderdet6.isOutPattern__c = true;
+ Orderdet6.Box_Piece__c = '涓�';
+ orderdetails.add(Orderdet6);
+ Consumable_orderdetails__c Orderdetc6 = new Consumable_orderdetails__c();
+ Orderdetc6.Name = 'ZSD_01_001001';
+ Orderdetc6.Consumable_order__c = zsd01.Id;
+ Orderdetc6.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdetc6.Consumable_Count__c = 12;
+ Orderdetc6.Consumable_Product__c = pro2.Id;
+ Orderdetc6.Delivery_List_RMB__c = 1;
+ Orderdetc6.Unitprice_To_agency__c = 1.00;
+ Orderdetc6.Dealer_Custom_Price__c = 999.00;
+ Orderdetc6.Shipment_Count__c = 1;
+ Orderdetc6.isOutPattern__c = true;
+ Orderdetc6.Box_Piece__c = '鐩�';
+ orderdetails.add(Orderdetc6);
+ insert orderdetails;
+ System.debug('orderdetails:' + orderdetails.size());
- Consumable_order__c Order2 = new Consumable_order__c();
- Order2.Name = 'OCM_02_001';
- Order2.Order_status__c = '鎵瑰噯';
- Order2.Order_type__c = '璁㈠崟';
- Order2.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order2.Dealer_Info__c = myAccount2.Id;
- Order2.IsShipment__c = true;
- insert Order2;
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert hp1;
- Consumable_order__c Order3 = new Consumable_order__c();
- Order3.Name = 'OCM_02_005';
- Order3.Order_status__c = '鎵瑰噯';
- Order3.Order_type__c = '浼犵エ';
- Order3.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order3.Arrive_Order__c = Order1.Id;
- Order3.Dealer_Info__c = myAccount2.Id;
- Order3.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- Order3.IsShipment__c = true;
- insert Order3;
+ orderpieceorboxMap = new Map<String, String>();
+ orderagencypriceMap = new Map<String, Decimal>();
+ orderpriceMap = new Map<String, Decimal>();
+ orderdetCountMap = new Map<String, Decimal>();
+ if(orderdetails.size() > 0 ){
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ orderpieceorboxMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Box_Piece__c);
+ if (orderdetails[i].Unitprice_To_agency__c != null && orderdetails[i].Unitprice_To_agency__c != 0) {
+ orderagencypriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Unitprice_To_agency__c);
+ }
+ orderpriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Delivery_List_RMB__c);
+ orderdetCountMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Shipment_Count__c);
+ }
+ }
+ String ESetId = Order2.Id;
+ System.Test.startTest();
+ LexSaleOrderController.GoodsDeliveryInit(ESetId);
+ String barcode1 = '';
+ String key = '';
+ String baseUrl = '';
+ Integer a = 0;
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
+ Map<String, Integer> msiMap = new Map<String, Integer>();
+ LexSaleOrderController.SearchPro(Order1,barcode1,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ String barcode = '11111250AAAAA\n22222250BBBBB\n33333250CCCCC\n44444250DDDDD\n55555250EEEEE\n666666\n777777\naaa';
+ LexSaleOrderController.ParseBarCode(barcode);
+ LexSaleOrderController.SearchPro(Order2,barcode,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(ESetId,Order2,barcode,accountName,userWorkLocation,JSON.serialize(consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.ProSale(ESetId,Order2,barcode,accountName,userWorkLocation,JSON.serialize(consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.Getconsumableorderdetails2Nobox();
- Consumable_order_details2__c Orderdet = new Consumable_order_details2__c();
- Orderdet.Name = 'OCM_01_001001';
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_order_minor__c = Order1.Id;
- Orderdet.Consumable_Arrived_order__c = Order1.Id;
- Orderdet.Consumable_ZS_order__c = Order3.Id;
- Orderdet.Consumable_Return_order__c = Order1.Id;
- Orderdet.Consumable_Sale_order__c = null;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet.RemoveBox_No__c = 3;
- Orderdet.Bar_Code__c = '1111111111250AAAAA';
- Orderdet.Arrive_date__c = Date.today();
- Orderdet.Delivery_List_RMB__c = 11.11;
- Orderdet.Box_Piece__c = '鐩�';
- Orderdet.Return_date__c = null;
- Orderdet.TracingCode__c = '';
- Orderdet.Cancellation_Flag__c = true;
- Orderdet.Sterilization_limit__c = Date.today().addDays(-1);
- //鍙戣揣
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_ZS_order__c = Order3.Id;
- Orderdet1.Consumable_Return_order__c = Order1.Id;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.RemoveBox_No__c = 3;
- Orderdet1.Bar_Code__c = '2222222222250BBBBB';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.Return_reason__c = null;
- Orderdet1.Return_date__c = null;
- Orderdet1.Delivery_List_RMB__c = 11.11;
- Orderdet1.Box_Piece__c = '涓�';
- Orderdet1.TracingCode__c = '';
- Orderdet1.Cancellation_Flag__c = true;
- Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
- //閿�鍞�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order3.Id;
- Orderdet2.Consumable_Shipment_order__c = Order3.Id;
- Orderdet2.Consumable_Sale_order__c = Order3.Id;
- Orderdet2.Consumable_ZS_order__c = Order3.Id;
- Orderdet2.Consumable_Return_order__c = Order3.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.RemoveBox_No__c = 3;
- Orderdet2.Bar_Code__c = '3333333333250CCCCC';
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Send_Date__c = null;
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Return_reason__c = null;
- Orderdet2.Return_date__c = null;
- Orderdet2.Delivery_List_RMB__c = 11;
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.TracingCode__c = null;
- Orderdet2.Cancellation_Flag__c = true;
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
- //閿�鍞�
- Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
- Orderdet9.Name = 'OCM_01_001002';
- Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet9.RemoveBox_No__c = 3;
- Orderdet9.Bar_Code__c = '4444444444250DDDDD';
- Orderdet9.Consumable_Product__c = pro1.Id;
- Orderdet9.Arrive_date__c = Date.today();
- Orderdet9.Used_date__c = Date.today();
- Orderdet9.Box_Piece__c = '涓�';
- Orderdet9.TracingCode__c = 'DDDDD';
- //鍑哄簱
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Shipment_order__c = Order1.Id;
- Orderdet3.Consumable_Sale_order__c = null;
- Orderdet3.Consumable_ZS_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '5555555555250EEEEE';
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Send_Date__c = Date.today();
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.Return_date__c = null;
- Orderdet3.Lose_Flag__c = true;
- Orderdet3.TracingCode__c = 'EEEEE';
+
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
+ for(LexSaleOrderController.ConsumableorderdetailsInfo ass: inList){
+ ass.orderdetails2= Orderdet1;
+ inList1.add(ass);
+ }
- //鍒拌揣
- Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
- Orderdet4.Name = 'OCM_01_001004';
- Orderdet4.Consumable_order_minor__c = null;
- Orderdet4.Consumable_Sale_order__c = null;
- Orderdet4.Consumable_ZS_order__c = Order1.Id;
- Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet4.Consumable_Arrived_order__c = Order1.Id;
- Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdet4.Bar_Code__c = '6666666666250FFFFF';
- Orderdet4.Consumable_Product__c = pro1.Id;
- Orderdet4.Arrive_date__c = Date.today();
- Orderdet4.Box_Piece__c = '涓�';
- Orderdet4.TracingCode__c = 'FFFFF';
- //鍙戣揣
- Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
- Orderdet5.Name = 'OCM_02_001001';
- Orderdet5.Consumable_order_minor__c = Order2.Id;
- Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet5.Bar_Code__c = '7777777777250GGGGG';
- Orderdet5.Consumable_Product__c = pro1.Id;
- Orderdet5.Deliver_date__c = Date.today();
- Orderdet5.RemoveBox_No__c = 3;
- Orderdet5.Box_Piece__c = '鐩�';
- Orderdet5.TracingCode__c = 'GGGGG';
- Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
- Orderdet6.Name = 'OCM_02_001001';
- Orderdet6.Consumable_order_minor__c = Order2.Id;
- Orderdet6.Consumable_ZS_order__c = Order2.Id;
- Orderdet6.Consumable_Return_order__c = Order2.Id;
- Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet6.Bar_Code__c = '8888888888250HHHHH';
- Orderdet6.Consumable_Product__c = pro1.Id;
- Orderdet6.Arrive_date__c = Date.today();
- Orderdet6.RemoveBox_No__c = 3;
- Orderdet6.Sterilization_limit__c = Date.today().addDays(-2);
- Orderdet6.TracingCode__c = 'HHHHH';
+ String errorReason = 'success';
+ LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet1,errorReason);
+ c2.orderdetails1 = null;
+ c2.orderdetails2 = Orderdet1;
+ c2.Prod = Orderdet1.Consumable_product__r;
+ c2.oldConsumableCount = Orderdet1.Name;
+ c2.ErrorReason = errorReason;
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert hp1;
+ LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet2);
+ c1.orderdetails1 = null;
+ c1.orderdetails2 = Orderdet2;
+ c1.Prod = Orderdet2.Consumable_product__r;
+ c1.oldConsumableCount = Orderdet2.Name;
+ c1.compareTo(c2);
+
+ LexSaleOrderController.ConsumableorderdetailsInfo c3 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet6);
+ c3.orderdetails1 = Orderdet6;
+ c3.Prod = Orderdet6.Consumable_product__r;
+ c3.outboundCount = Orderdet6.Shipment_Count__c;
+ System.Test.stopTest();
- List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
- newdet2.add(Orderdet);
- insert newdet2;
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet4,
- Orderdet5,
- Orderdet6,
- Orderdet9
- };
-
- List<Consumable_order_details2__c> cod2 = [
- SELECT Id, Arrive_Owner_Work_Location__c
- FROM Consumable_order_details2__c
- WHERE Id = :Orderdet.Id
- ];
- System.debug('cod2:' + cod2);
- String userWorkLocation = cod2[0].Arrive_Owner_Work_Location__c;
- System.debug('userWorkLocation:' + userWorkLocation);
-
- Map<String, object> data = new Map<String, object>();
- String ESetId = Order2.Id;
- System.Test.startTest();
- LexSaleOrderController.GoodsDeliveryInit(ESetId);
- String barcode1 = '';
- String key = '';
- orderpieceorboxMap = new Map<String, String>();
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- LexSaleOrderController.SearchPro(
- Order1,
- barcode1,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- String barcode = '1111111111250AAAAA\n2222222222250BBBBB\n3333333333250CCCCC\n4444444444250DDDDD\n5555555555250EEEEE\n6666666666250FFFFF\n7777777777250GGGGG\n8888888888250HHHHH';
- LexSaleOrderController.SearchPro(
- Order2,
- barcode,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- String barcode2 = '111111111250AAAAA';
- LexSaleOrderController.SearchPro(
- Order2,
- barcode2,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- ESetId,
- Order2,
- barcode2,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- ESetId,
- Order2,
- barcode2,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- String barcode3 = '3333333333250CCCCC';
- LexSaleOrderController.SearchPro(
- Order3,
- barcode3,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- ESetId,
- Order3,
- barcode3,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- ESetId,
- Order3,
- barcode3,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.Getconsumableorderdetails2Nobox();
-
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
- for (LexSaleOrderController.ConsumableorderdetailsInfo ass : inList) {
- ass.orderdetails2 = Orderdet1;
- inList1.add(ass);
- }
-
- String errorReason = 'success';
- LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet1,
- errorReason
- );
- c2.orderdetails1 = null;
- c2.orderdetails2 = Orderdet1;
- c2.Prod = Orderdet1.Consumable_product__r;
- c2.oldConsumableCount = Orderdet1.Name;
- c2.ErrorReason = errorReason;
-
- LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet2
- );
- c1.orderdetails1 = null;
- c1.orderdetails2 = Orderdet2;
- c1.Prod = Orderdet2.Consumable_product__r;
- c1.oldConsumableCount = Orderdet2.Name;
- c1.compareTo(c2);
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testProSale() {
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType hosCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = hosCo.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '澶ц繛'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- System.runAs(MyUser_Test) {
- String Id = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
- FROM User
- WHERE id = :Id
- ];
- String accountId = thisUserInfo.Contact.AccountId;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- String accountName;
- Account[] accountInfo = [
- SELECT Name
- FROM account
- WHERE id = :accountId
- LIMIT 1
- ];
- if (accountInfo.size() > 0) {
- accountName = accountInfo[0].Name;
- }
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
-
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.IsShipment__c = true;
- insert Order1;
-
- Consumable_order__c Order3 = new Consumable_order__c();
- Order3.Name = 'OCM_02_005';
- Order3.Order_status__c = '鎵瑰噯';
- Order3.Order_type__c = '浼犵エ';
- Order3.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order3.Arrive_Order__c = Order1.Id;
- Order3.Dealer_Info__c = myAccount2.Id;
- Order3.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- Order3.IsShipment__c = true;
- insert Order3;
-
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- //鏄庣粏1
- Consumable_orderdetails__c conOrder1 = new Consumable_orderdetails__c();
- conOrder1.Name = 'OCM_01_001001';
- conOrder1.Consumable_order__c = Order1.Id;
- conOrder1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- conOrder1.Consumable_Count__c = 12;
- conOrder1.Consumable_Product__c = pro1.Id;
- conOrder1.Delivery_List_RMB__c = 1;
- conOrder1.Shipment_Count__c = 1;
- conOrder1.Box_Piece__c = '鐩�';
-
- Consumable_orderdetails__c conOrder2 = new Consumable_orderdetails__c();
- conOrder2.Name = 'OCM_01_001002';
- conOrder2.Consumable_order__c = Order1.Id;
- conOrder2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- conOrder2.Consumable_Count__c = 12;
- conOrder2.Consumable_Product__c = pro1.Id;
- conOrder2.Delivery_List_RMB__c = 1;
- conOrder2.Shipment_Count__c = 1;
- conOrder2.Box_Piece__c = '涓�';
-
- orderdetails.add(conOrder1);
- orderdetails.add(conOrder2);
- insert orderdetails;
- System.debug('orderdetails.size() = ' + orderdetails.size());
-
- Consumable_order_details2__c Orderdet = new Consumable_order_details2__c();
- Orderdet.Name = 'OCM_01_001001';
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_order_minor__c = Order1.Id;
- Orderdet.Consumable_ZS_order__c = Order3.Id;
- Orderdet.Consumable_Return_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet.RemoveBox_No__c = 3;
- Orderdet.Bar_Code__c = '1111111111250AAAAA';
- Orderdet.Arrive_date__c = Date.today();
- Orderdet.Delivery_List_RMB__c = 11.11;
- Orderdet.Box_Piece__c = '鐩�';
- Orderdet.Return_date__c = null;
- Orderdet.TracingCode__c = '';
- Orderdet.Cancellation_Flag__c = true;
- Orderdet.Sterilization_limit__c = Date.today().addDays(-1);
-
- //鍙戣揣
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_ZS_order__c = Order3.Id;
- Orderdet1.Consumable_Return_order__c = Order1.Id;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.RemoveBox_No__c = 3;
- Orderdet1.Bar_Code__c = '2222222222250BBBBB';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.Return_reason__c = null;
- Orderdet1.Return_date__c = null;
- Orderdet1.Delivery_List_RMB__c = 11.11;
- Orderdet1.Box_Piece__c = '涓�';
- Orderdet1.TracingCode__c = '';
- Orderdet1.Cancellation_Flag__c = true;
- Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
- //閿�鍞�
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order_minor__c = Order3.Id;
- Orderdet2.Consumable_Shipment_order__c = Order3.Id;
- Orderdet2.Consumable_Sale_order__c = Order3.Id;
- Orderdet2.Consumable_ZS_order__c = Order3.Id;
- Orderdet2.Consumable_Return_order__c = Order3.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.RemoveBox_No__c = 3;
- Orderdet2.Bar_Code__c = '3333333333250CCCCC';
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Send_Date__c = null;
- Orderdet2.Used_date__c = null;
- Orderdet2.Lose_Flag__c = false;
- Orderdet2.Return_reason__c = null;
- Orderdet2.Return_date__c = null;
- Orderdet2.Delivery_List_RMB__c = 11;
- Orderdet2.Box_Piece__c = '鐩�';
- Orderdet2.TracingCode__c = null;
- Orderdet2.Cancellation_Flag__c = true;
- Orderdet2.Arrive_date__c = Date.today();
- Orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
- //閿�鍞�
- Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
- Orderdet9.Name = 'OCM_01_001002';
- Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet9.RemoveBox_No__c = 3;
- Orderdet9.Bar_Code__c = '4444444444250DDDDD';
- Orderdet9.Consumable_Product__c = pro1.Id;
- Orderdet9.Arrive_date__c = Date.today();
- Orderdet9.Used_date__c = Date.today();
- Orderdet9.Box_Piece__c = '涓�';
- Orderdet9.TracingCode__c = 'DDDDD';
- //鍑哄簱
- Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
- Orderdet3.Name = 'OCM_01_001003';
- Orderdet3.Consumable_order_minor__c = Order1.Id;
- Orderdet3.Consumable_Shipment_order__c = Order1.Id;
- Orderdet3.Consumable_order_minor__c = null;
- Orderdet3.Consumable_Sale_order__c = null;
- Orderdet3.Consumable_ZS_order__c = Order1.Id;
- Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet3.Bar_Code__c = '5555555555250EEEEE';
- Orderdet3.Consumable_Product__c = pro1.Id;
- Orderdet3.Send_Date__c = Date.today();
- Orderdet3.Box_Piece__c = '鐩�';
- Orderdet3.Return_date__c = null;
- Orderdet3.Lose_Flag__c = true;
- Orderdet3.TracingCode__c = 'EEEEE';
-
- List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
- newdet2.add(Orderdet);
- insert newdet2;
- insert new List<Consumable_order_details2__c>{
- Orderdet1,
- Orderdet2,
- Orderdet3,
- Orderdet9
- };
-
- Map<String, object> data = new Map<String, object>();
- String ESetId = Order3.Id;
- System.Test.startTest();
- LexSaleOrderController.GoodsDeliveryInit(ESetId);
- String barcode1 = '';
- String key = '';
- Integer i = 0;
- Decimal a = 0;
- orderpieceorboxMap = new Map<String, String>();
- LexSaleOrderController.SearchPro(
- Order1,
- barcode1,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- String barcode = '1111111111250AAAAA\n2222222222250BBBBB\n3333333333250CCCCC\n4444444444250DDDDD\n5555555555250EEEEE';
- LexSaleOrderController.SearchPro(
- Order3,
- barcode,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- ESetId,
- Order3,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- ESetId,
- Order3,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
-
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
- List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
- for (LexSaleOrderController.ConsumableorderdetailsInfo ass : inList) {
- ass.orderdetails2 = Orderdet1;
- inList1.add(ass);
- }
-
- String errorReason = 'success';
- LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet1,
- errorReason
- );
- c2.orderdetails1 = null;
- c2.orderdetails2 = Orderdet1;
- c2.Prod = Orderdet1.Consumable_product__r;
- c2.oldConsumableCount = Orderdet1.Name;
- c2.ErrorReason = errorReason;
-
- LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(
- Orderdet2
- );
- c1.orderdetails1 = null;
- c1.orderdetails2 = Orderdet2;
- c1.Prod = Orderdet2.Consumable_product__r;
- c1.oldConsumableCount = Orderdet2.Name;
- c1.compareTo(c2);
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testProdError() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType hosCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = hosCo.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id
- );
- insert myAccount2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '澶ц繛'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
- }
- //璁㈠崟
- System.runAs(MyUser_Test) {
- String Id = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
- FROM User
- WHERE id = :Id
- ];
- String accountId = thisUserInfo.Contact.AccountId;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- String accountName;
- Account[] accountInfo = [
- SELECT Name
- FROM account
- WHERE id = :accountId
- LIMIT 1
- ];
- if (accountInfo.size() > 0) {
- accountName = accountInfo[0].Name;
- }
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 12,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02, prod03 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- insert new List<Product2__c>{ pro1, pro2, pro3 };
- //鍑哄簱鍗�
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '浼犵エ';
- Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
- Order1.Dealer_Info__c = myAccount2.Id;
- Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- Order1.IsShipment__c = true;
- insert Order1;
-
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- //鏄庣粏1
- Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order__c = Order1.Id;
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet1.Consumable_Count__c = 12;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Unitprice_To_agency__c = 1;
- Orderdet1.Delivery_List_RMB__c = 1;
- Orderdet1.Shipment_Count__c = 1;
- Orderdet1.Box_Piece__c = '鐩�';
- Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
- Orderdet2.Name = 'OCM_01_001002';
- Orderdet2.Consumable_order__c = Order1.Id;
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet2.Consumable_Count__c = 12;
- Orderdet2.Consumable_Product__c = pro2.Id;
- Orderdet2.Unitprice_To_agency__c = 1;
- Orderdet2.Delivery_List_RMB__c = 1;
- Orderdet2.Shipment_Count__c = 1;
- Orderdet2.Box_Piece__c = '涓�';
- orderdetails.add(Orderdet1);
- orderdetails.add(Orderdet2);
- insert orderdetails;
-
- //鏄庣粏2
- Consumable_order_details2__c Orderdets1 = new Consumable_order_details2__c();
- Orderdets1.Name = 'OCM_01_0010001';
- Orderdets1.Consumable_order_minor__c = Order1.Id;
- Orderdets1.Consumable_ZS_order__c = Order1.Id;
- Orderdets1.Consumable_Return_order__c = null;
- Orderdets1.Consumable_Sale_order__c = null;
- Orderdets1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets1.Bar_Code__c = '11111250AAAAA';
- Orderdets1.Consumable_Product__c = pro1.Id;
- Orderdets1.Arrive_date__c = Date.today();
- Orderdets1.Return_date__c = null;
- Orderdets1.RemoveBox_No__c = 3;
- Orderdets1.Delivery_List_RMB__c = 11.11;
- Orderdets1.Box_Piece__c = '鐩�';
- Orderdets1.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdets1.TracingCode__c = 'AAAAA';
-
- Consumable_order_details2__c Orderdets2 = new Consumable_order_details2__c();
- Orderdets2.Name = 'OCM_01_0010002';
- Orderdets2.Consumable_Return_order__c = null;
- Orderdets2.Consumable_Sale_order__c = null;
- Orderdets2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets2.Bar_Code__c = '22222250BBBBB';
- Orderdets2.Consumable_Product__c = pro2.Id;
- Orderdets2.Arrive_date__c = Date.today();
- Orderdets2.Return_date__c = null;
- Orderdets2.RemoveBox_No__c = 3;
- Orderdets2.Delivery_List_RMB__c = 11.11;
- Orderdets2.Box_Piece__c = '涓�';
- Orderdets2.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdets2.TracingCode__c = '';
-
- Consumable_order_details2__c Orderdets3 = new Consumable_order_details2__c();
- Orderdets3.Name = 'OCM_01_0010003';
- Orderdets3.Consumable_order_minor__c = Order1.Id;
- Orderdets3.Consumable_ZS_order__c = Order1.Id;
- Orderdets3.Consumable_Return_order__c = null;
- Orderdets2.Consumable_Sale_order__c = null;
- Orderdets3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets3.Bar_Code__c = '33333250CCCCC';
- Orderdets3.Consumable_Product__c = pro3.Id;
- Orderdets3.Arrive_date__c = Date.today();
- Orderdets3.Return_date__c = null;
- Orderdets3.RemoveBox_No__c = 3;
- Orderdets3.Delivery_List_RMB__c = 11.11;
- Orderdets3.Box_Piece__c = '鐩�';
- Orderdets3.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdets3.TracingCode__c = 'CCCCC';
- //鏈埌璐�
- Consumable_order_details2__c Orderdets4 = new Consumable_order_details2__c();
- Orderdets4.Name = 'OCM_01_0010001';
- Orderdets4.Consumable_order_minor__c = Order1.Id;
- Orderdets4.Consumable_ZS_order__c = Order1.Id;
- Orderdets4.Consumable_Return_order__c = null;
- Orderdets4.Consumable_Sale_order__c = null;
- Orderdets4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets4.Bar_Code__c = '44444250DDDDD';
- Orderdets4.Arrive_date__c = Date.today();
- Orderdets4.Return_date__c = null;
- Orderdets4.Consumable_Product__c = pro1.Id;
- Orderdets4.Delivery_List_RMB__c = 11.11;
- Orderdets4.RemoveBox_No__c = 3;
- Orderdets4.Box_Piece__c = '鐩�';
- Orderdets4.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdets4.TracingCode__c = 'DDDDD';
-
- Consumable_order_details2__c Orderdets5 = new Consumable_order_details2__c();
- Orderdets5.Name = 'OCM_01_0010003';
- Orderdets5.Consumable_order_minor__c = Order1.Id;
- Orderdets5.Consumable_ZS_order__c = Order1.Id;
- Orderdets5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdets5.Bar_Code__c = '33333250EEEEE';
- Orderdets5.Consumable_Product__c = pro3.Id;
- Orderdets5.Arrive_date__c = Date.today();
- Orderdets5.Return_date__c = null;
- Orderdets5.RemoveBox_No__c = 3;
- Orderdets5.Delivery_List_RMB__c = 11.11;
- Orderdets5.Box_Piece__c = '涓�';
- Orderdets5.Sterilization_limit__c = Date.today().addDays(-1);
- Orderdets5.TracingCode__c = 'EEEEE';
-
- List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
- newdet2.add(Orderdets1);
- insert newdet2;
- insert new List<Consumable_order_details2__c>{
- Orderdets2,
- Orderdets3,
- Orderdets4,
- Orderdets5
- };
-
- List<String> barCodeListP = new List<String>();
- Map<String, object> data = new Map<String, object>();
- String ESetId = Order1.Id;
- System.Test.startTest();
- LexSaleOrderController.GoodsDeliveryInit(ESetId);
- String barcode = '11111250AAAAA\n22222250BBBBB\n33333250CCCCC\n44444250DDDDD\n33333250EEEEE';
- barCodeListP = LexSaleOrderController.ParseBarCode(barcode);
- System.debug('barCodeListP:' + barCodeListP);
- System.debug('accountName:' + accountName);
- System.debug('userWorkLocation:' + userWorkLocation);
- String key = '';
- Integer idx = 0;
- orderpieceorboxMap = new Map<String, String>();
- LexSaleOrderController.SearchPro(
- Order1,
- barcode,
- accountName,
- userWorkLocation,
- accountId,
- orderdetails,
- orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- ESetId,
- Order1,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- ESetId,
- Order1,
- barcode,
- accountName,
- userWorkLocation,
- JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),
- orderdetails,
- orderpriceMap,
- orderagencypriceMap
- );
-
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void searchTest1() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testArriveOrder() {
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ Account myAccount2;
+ Account olympus;
+ User MyUser_Test;
+ User thisUser = [SELECT Id FROM User WHERE Id =:UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType hosCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='澶ц繛');
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+ String Id = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid,ContactId,Contact.AccountId, Work_Location__c FROM User WHERE id =:Id];
+ String accountId = thisUserInfo.Contact.AccountId;
+ String userWorkLocation1 = thisUserInfo.Work_Location__c;
+ String accountName = myAccount2.Name;
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation1 = ' + userWorkLocation1);
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount1.Id;
- hp1.account__c = myAccount1.Id;
- hp1.product__c = pro1.Id;
- insert hp1;
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.IsShipment__c = True;
+ Order1.OwnerId = MyUser_Test.Id;
+ insert Order1;
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- Order0.OutPattern__c = true;
- insert Order0;
+ Consumable_order__c Order2 = new Consumable_order__c();
+ Order2.Name = 'OCM_02_001';
+ Order2.Order_status__c = '鎵瑰噯';
+ Order2.Order_type__c = '璁㈠崟';
+ Order2.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order2.Dealer_Info__c = myAccount2.Id;
+ Order2.IsShipment__c = True;
+ insert Order2;
+
+ Consumable_order__c Order3 = new Consumable_order__c();
+ Order3.Name = 'OCM_02_005';
+ Order3.Order_status__c = '鎵瑰噯';
+ Order3.Order_type__c = '浼犵エ';
+ Order3.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order3.Arrive_Order__c= Order1.Id;
+ Order3.Dealer_Info__c = myAccount2.Id;
+ Order3.SummonsForDirction__c ='鐩存帴閿�鍞粰鍖婚櫌';
+ Order3.IsShipment__c = True;
+ insert Order3;
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 1;
- Orderdet.isOutPattern__c = true;
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- insert Orderdet1;
- System.debug('Orderdet1:' + Orderdet1);
- Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
- Orderdet2.Name = 'OCM_01_001001';
- Orderdet2.Consumable_order_minor__c = Order1.Id;
- Orderdet2.Consumable_Product__c = pro1.Id;
- Orderdet2.Asset_Model_No__c = 'Test01';
- Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet2.TracingCode__c = 'BXJRF';
- Orderdet2.SerialLotNo__c = '5ZK';
- // Orderdet2.Consumable_ZS_order__c = Order1.Id;
- // Orderdet2.Box_Piece__c = '涓�';
- insert Orderdet2;
- System.Test.startTest();
- String a = LexSaleOrderController.baseUrl;
- LexSaleOrderController.msiMap = new Map<String, Integer>();
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- orderdetails.add(Orderdet);
- LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
- String condetailList = JSON.serialize(
- LexSaleOrderController.consumableorderdetailsRecords
- );
- Order1.Arrive_Order__c = null;
- LexSaleOrderController.SearchPro(
- Order1,
- '01049531702003111115120017181000105ZK250BXJRF',
- myAccount1.Name,
- '',
- myAccount1.Id,
- LexSaleOrderController.orderdetails,
- LexSaleOrderController.orderpieceorboxMap
- );
- LexSaleOrderController.ProdElivery(
- Order1.Id,
- LexSaleOrderController.coc,
- '01049531702003111115120017181000105ZK250BXJRF',
- myAccount1.Name,
- '',
- condetailList,
- LexSaleOrderController.orderdetails,
- LexSaleOrderController.orderpriceMap,
- LexSaleOrderController.orderagencypriceMap
- );
- LexSaleOrderController.ProSale(
- Order1.Id,
- LexSaleOrderController.coc,
- '01049531702003111115120017181000105ZK250BXJRF',
- myAccount1.Name,
- '',
- condetailList,
- LexSaleOrderController.orderdetails,
- LexSaleOrderController.orderpriceMap,
- LexSaleOrderController.orderagencypriceMap
- );
- System.Test.stopTest();
- }
- }
+ Consumable_order_details2__c Orderdet = new Consumable_order_details2__c();
+ Orderdet.Name = 'OCM_01_001001';
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_order_minor__c = Order1.Id;
+ Orderdet.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet.Consumable_ZS_order__c = Order3.Id;
+ Orderdet.Consumable_Return_order__c = Order1.Id;
+ Orderdet.Consumable_Sale_order__c =null;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet.RemoveBox_No__c = 3;
+ Orderdet.Bar_Code__c = '1111111111250AAAAA';
+ Orderdet.Arrive_date__c = Date.today();
+ Orderdet.Delivery_List_RMB__c = 11.11;
+ Orderdet.Box_Piece__c = '鐩�';
+ Orderdet.Return_date__c = null;
+ Orderdet.TracingCode__c = '';
+ Orderdet.Cancellation_Flag__c = TRUE;
+ Orderdet.Sterilization_limit__c = Date.today().addDays(-1);
+ //鍙戣揣
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_ZS_order__c = Order3.Id;
+ Orderdet1.Consumable_Return_order__c = Order1.Id;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.RemoveBox_No__c = 3;
+ Orderdet1.Bar_Code__c = '2222222222250BBBBB';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.Return_reason__c = null;
+ Orderdet1.Return_date__c = null;
+ Orderdet1.Delivery_List_RMB__c = 11.11;
+ Orderdet1.Box_Piece__c = '涓�';
+ Orderdet1.TracingCode__c = '';
+ Orderdet1.Cancellation_Flag__c = TRUE;
+ Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
+ //閿�鍞�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order3.Id;
+ Orderdet2.Consumable_Shipment_order__c = Order3.Id;
+ Orderdet2.Consumable_Sale_order__c = Order3.Id;
+ Orderdet2.Consumable_ZS_order__c = Order3.Id;
+ Orderdet2.Consumable_Return_order__c = Order3.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.RemoveBox_No__c = 3;
+ Orderdet2.Bar_Code__c = '3333333333250CCCCC';
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Send_Date__c = null;
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = FALSE;
+ Orderdet2.Return_reason__c = null;
+ Orderdet2.Return_date__c = null;
+ Orderdet2.Delivery_List_RMB__c = 11;
+ Orderdet2.Box_Piece__c = '鐩�';
+ Orderdet2.TracingCode__c = null;
+ Orderdet2.Cancellation_Flag__c = TRUE;
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
+ //閿�鍞�
+ Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
+ Orderdet9.Name = 'OCM_01_001002';
+ Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet9.RemoveBox_No__c = 3;
+ Orderdet9.Bar_Code__c = '4444444444250DDDDD';
+ Orderdet9.Consumable_Product__c = pro1.Id;
+ Orderdet9.Arrive_date__c = Date.today();
+ Orderdet9.Used_date__c = Date.today();
+ Orderdet9.Box_Piece__c = '涓�';
+ Orderdet9.TracingCode__c = 'DDDDD';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet3.Consumable_Sale_order__c = null;
+ Orderdet3.Consumable_ZS_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '5555555555250EEEEE';
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Send_Date__c = Date.today();
+ Orderdet3.Box_Piece__c = '鐩�';
+ Orderdet3.Return_date__c= null;
+ Orderdet3.Lose_Flag__c = True;
+ Orderdet3.TracingCode__c = 'EEEEE';
- @isTest
- static void searchTest2() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ //鍒拌揣
+ Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
+ Orderdet4.Name = 'OCM_01_001004';
+ Orderdet4.Consumable_order_minor__c = null;
+ Orderdet4.Consumable_Sale_order__c = null;
+ Orderdet4.Consumable_ZS_order__c = Order1.Id;
+ Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery ;
+ Orderdet4.Consumable_Arrived_order__c = Order1.Id;
+ Orderdet4.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdet4.Bar_Code__c = '6666666666250FFFFF';
+ Orderdet4.Consumable_Product__c = pro1.Id;
+ Orderdet4.Arrive_date__c = Date.today();
+ Orderdet4.Box_Piece__c = '涓�';
+ Orderdet4.TracingCode__c = 'FFFFF';
+ //鍙戣揣
+ Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
+ Orderdet5.Name = 'OCM_02_001001';
+ Orderdet5.Consumable_order_minor__c = Order2.Id;
+ Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet5.Bar_Code__c = '7777777777250GGGGG';
+ Orderdet5.Consumable_Product__c = pro1.Id;
+ Orderdet5.Deliver_date__c = Date.today();
+ Orderdet5.RemoveBox_No__c = 3;
+ Orderdet5.Box_Piece__c = '鐩�';
+ Orderdet5.TracingCode__c = 'GGGGG';
+
+ Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c();
+ Orderdet6.Name = 'OCM_02_001001';
+ Orderdet6.Consumable_order_minor__c = Order2.Id;
+ Orderdet6.Consumable_ZS_order__c = Order2.Id;
+ Orderdet6.Consumable_Return_order__c = Order2.Id;
+ Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet6.Bar_Code__c = '8888888888250HHHHH';
+ Orderdet6.Consumable_Product__c = pro1.Id;
+ Orderdet6.Arrive_date__c = Date.today();
+ Orderdet6.RemoveBox_No__c = 3;
+ Orderdet6.Sterilization_limit__c = Date.today().addDays(-2);
+ Orderdet6.TracingCode__c = 'HHHHH';
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert hp1;
+
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ newdet2.add(Orderdet);
+ insert newdet2;
+ insert new Consumable_order_details2__c[] {Orderdet1,Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet9};
+
+ List<Consumable_order_details2__c> cod2 = [SELECT Id,Arrive_Owner_Work_Location__c
+ FROM Consumable_order_details2__c
+ WHERE Id =: Orderdet.Id];
+ System.debug('cod2:' + cod2);
+ String userWorkLocation = cod2[0].Arrive_Owner_Work_Location__c;
+ System.debug('userWorkLocation:' + userWorkLocation);
+
+ Map<String, object> data = new Map<String, object>();
+ String ESetId = Order2.Id;
+ System.Test.startTest();
+ LexSaleOrderController.GoodsDeliveryInit(ESetId);
+ String barcode1 = '';
+ String key = '';
+ orderpieceorboxMap = new Map<String, String>();
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ LexSaleOrderController.SearchPro(Order1,barcode1,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ String barcode = '1111111111250AAAAA\n2222222222250BBBBB\n3333333333250CCCCC\n4444444444250DDDDD\n5555555555250EEEEE\n6666666666250FFFFF\n7777777777250GGGGG\n8888888888250HHHHH';
+ LexSaleOrderController.SearchPro(Order2,barcode,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ String barcode2 = '111111111250AAAAA';
+ LexSaleOrderController.SearchPro(Order2,barcode2,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(ESetId,Order2,barcode2,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.ProSale(ESetId,Order2,barcode2,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ String barcode3 = '3333333333250CCCCC';
+ LexSaleOrderController.SearchPro(Order3,barcode3,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(ESetId,Order3,barcode3,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.ProSale(ESetId,Order3,barcode3,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.Getconsumableorderdetails2Nobox();
+
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
+ for(LexSaleOrderController.ConsumableorderdetailsInfo ass: inList){
+ ass.orderdetails2= Orderdet1;
+ inList1.add(ass);
+ }
+
+
+ String errorReason = 'success';
+ LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet1,errorReason);
+ c2.orderdetails1 = null;
+ c2.orderdetails2 = Orderdet1;
+ c2.Prod = Orderdet1.Consumable_product__r;
+ c2.oldConsumableCount = Orderdet1.Name;
+ c2.ErrorReason = errorReason;
+
+ LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet2);
+ c1.orderdetails1 = null;
+ c1.orderdetails2 = Orderdet2;
+ c1.Prod = Orderdet2.Consumable_product__r;
+ c1.oldConsumableCount = Orderdet2.Name;
+ c1.compareTo(c2);
+ System.Test.stopTest();
+
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testProSale() {
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType hosCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='澶ц繛');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ system.runAs(MyUser_Test){
+ String Id = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid,ContactId,Contact.AccountId, Work_Location__c FROM User WHERE id =:Id];
+ String accountId = thisUserInfo.Contact.AccountId;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ String accountName;
+ Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
+ if(accountInfo.size() > 0 ){
+ accountName = accountInfo[0].Name;
+ }
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount1.Id;
- hp1.account__c = myAccount1.Id;
- hp1.product__c = pro1.Id;
- insert hp1;
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.IsShipment__c = True;
+ insert Order1;
+
+ Consumable_order__c Order3 = new Consumable_order__c();
+ Order3.Name = 'OCM_02_005';
+ Order3.Order_status__c = '鎵瑰噯';
+ Order3.Order_type__c = '浼犵エ';
+ Order3.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order3.Arrive_Order__c = Order1.Id;
+ Order3.Dealer_Info__c = myAccount2.Id;
+ Order3.SummonsForDirction__c ='鐩存帴閿�鍞粰鍖婚櫌';
+ Order3.IsShipment__c = True;
+ insert Order3;
+
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ //鏄庣粏1
+ Consumable_orderdetails__c conOrder1 = new Consumable_orderdetails__c();
+ conOrder1.Name = 'OCM_01_001001';
+ conOrder1.Consumable_order__c = Order1.Id;
+ conOrder1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order ;
+ conOrder1.Consumable_Count__c = 12;
+ conOrder1.Consumable_Product__c = pro1.Id;
+ conOrder1.Delivery_List_RMB__c = 1;
+ conOrder1.Shipment_Count__c = 1;
+ conOrder1.Box_Piece__c = '鐩�';
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- Order0.OutPattern__c = true;
- insert Order0;
+ Consumable_orderdetails__c conOrder2 = new Consumable_orderdetails__c();
+ conOrder2.Name = 'OCM_01_001002';
+ conOrder2.Consumable_order__c = Order1.Id;
+ conOrder2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order ;
+ conOrder2.Consumable_Count__c = 12;
+ conOrder2.Consumable_Product__c = pro1.Id;
+ conOrder2.Delivery_List_RMB__c = 1;
+ conOrder2.Shipment_Count__c = 1;
+ conOrder2.Box_Piece__c = '涓�';
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 1;
- Orderdet.isOutPattern__c = true;
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- Orderdet1.Box_Piece__c = '涓�';
- insert Orderdet1;
- System.debug('Orderdet1:' + Orderdet1);
- System.Test.startTest();
- String a = LexSaleOrderController.baseUrl;
- LexSaleOrderController.msiMap = new Map<String, Integer>();
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- orderdetails.add(Orderdet);
- LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
- LexSaleOrderController.consumableorderdetailsRecords[0].outboundCount = 1;
- String condetailList = JSON.serialize(
- LexSaleOrderController.consumableorderdetailsRecords
- );
- LexSaleOrderController.ProdElivery(
- Order1.Id,
- LexSaleOrderController.coc,
- '01049531702003111115120017181000105ZK250BXJRF',
- myAccount1.Name,
- '',
- condetailList,
- LexSaleOrderController.orderdetails,
- LexSaleOrderController.orderpriceMap,
- LexSaleOrderController.orderagencypriceMap
- );
- // LexSaleOrderController.ProSale(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
- System.Test.stopTest();
- }
- }
+ orderdetails.add(conOrder1);
+ orderdetails.add(conOrder2);
+ insert orderdetails;
+ System.debug('orderdetails.size() = ' + orderdetails.size());
- @isTest
- static void searchTest3() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Account myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '9999900'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Consumable_order_details2__c Orderdet = new Consumable_order_details2__c();
+ Orderdet.Name = 'OCM_01_001001';
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_order_minor__c = Order1.Id;
+ Orderdet.Consumable_ZS_order__c = Order3.Id;
+ Orderdet.Consumable_Return_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet.RemoveBox_No__c = 3;
+ Orderdet.Bar_Code__c = '1111111111250AAAAA';
+ Orderdet.Arrive_date__c = Date.today();
+ Orderdet.Delivery_List_RMB__c = 11.11;
+ Orderdet.Box_Piece__c = '鐩�';
+ Orderdet.Return_date__c = null;
+ Orderdet.TracingCode__c = '';
+ Orderdet.Cancellation_Flag__c = TRUE;
+ Orderdet.Sterilization_limit__c = Date.today().addDays(-1);
+
+ //鍙戣揣
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_ZS_order__c = Order3.Id;
+ Orderdet1.Consumable_Return_order__c = Order1.Id;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.RemoveBox_No__c = 3;
+ Orderdet1.Bar_Code__c = '2222222222250BBBBB';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.Return_reason__c = null;
+ Orderdet1.Return_date__c = null;
+ Orderdet1.Delivery_List_RMB__c = 11.11;
+ Orderdet1.Box_Piece__c = '涓�';
+ Orderdet1.TracingCode__c = '';
+ Orderdet1.Cancellation_Flag__c = TRUE;
+ Orderdet1.Sterilization_limit__c = Date.today().addDays(-1);
+ //閿�鍞�
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order_minor__c = Order3.Id;
+ Orderdet2.Consumable_Shipment_order__c = Order3.Id;
+ Orderdet2.Consumable_Sale_order__c = Order3.Id;
+ Orderdet2.Consumable_ZS_order__c = Order3.Id;
+ Orderdet2.Consumable_Return_order__c = Order3.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.RemoveBox_No__c = 3;
+ Orderdet2.Bar_Code__c = '3333333333250CCCCC';
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Send_Date__c = null;
+ Orderdet2.Used_date__c = null;
+ Orderdet2.Lose_Flag__c = FALSE;
+ Orderdet2.Return_reason__c = null;
+ Orderdet2.Return_date__c = null;
+ Orderdet2.Delivery_List_RMB__c = 11;
+ Orderdet2.Box_Piece__c = '鐩�';
+ Orderdet2.TracingCode__c = null;
+ Orderdet2.Cancellation_Flag__c = TRUE;
+ Orderdet2.Arrive_date__c = Date.today();
+ Orderdet2.Sterilization_limit__c = Date.today().addDays(-1);
+ //閿�鍞�
+ Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c();
+ Orderdet9.Name = 'OCM_01_001002';
+ Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet9.RemoveBox_No__c = 3;
+ Orderdet9.Bar_Code__c = '4444444444250DDDDD';
+ Orderdet9.Consumable_Product__c = pro1.Id;
+ Orderdet9.Arrive_date__c = Date.today();
+ Orderdet9.Used_date__c = Date.today();
+ Orderdet9.Box_Piece__c = '涓�';
+ Orderdet9.TracingCode__c = 'DDDDD';
+ //鍑哄簱
+ Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
+ Orderdet3.Name = 'OCM_01_001003';
+ Orderdet3.Consumable_order_minor__c = Order1.Id;
+ Orderdet3.Consumable_Shipment_order__c = Order1.Id;
+ Orderdet3.Consumable_order_minor__c = null;
+ Orderdet3.Consumable_Sale_order__c = null;
+ Orderdet3.Consumable_ZS_order__c = Order1.Id;
+ Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet3.Bar_Code__c = '5555555555250EEEEE';
+ Orderdet3.Consumable_Product__c = pro1.Id;
+ Orderdet3.Send_Date__c = Date.today();
+ Orderdet3.Box_Piece__c = '鐩�';
+ Orderdet3.Return_date__c= null;
+ Orderdet3.Lose_Flag__c = True;
+ Orderdet3.TracingCode__c = 'EEEEE';
+
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ newdet2.add(Orderdet);
+ insert newdet2;
+ insert new Consumable_order_details2__c[] {Orderdet1,Orderdet2,Orderdet3,Orderdet9};
+
+ Map<String, object> data = new Map<String, object>();
+ String ESetId = Order3.Id;
+ System.Test.startTest();
+ LexSaleOrderController.GoodsDeliveryInit(ESetId);
+ String barcode1 = '';
+ String key = '';
+ Integer i = 0;
+ Decimal a = 0;
+ orderpieceorboxMap = new Map<String, String>();
+ LexSaleOrderController.SearchPro(Order1,barcode1,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ String barcode = '1111111111250AAAAA\n2222222222250BBBBB\n3333333333250CCCCC\n4444444444250DDDDD\n5555555555250EEEEE';
+ LexSaleOrderController.SearchPro(Order3,barcode,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(ESetId,Order3,barcode,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.ProSale(ESetId,Order3,barcode,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+
+
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList = LexSaleOrderController.consumableorderdetailsRecords;
+ List<LexSaleOrderController.ConsumableorderdetailsInfo> inList1 = new List<LexSaleOrderController.ConsumableorderdetailsInfo>();
+ for(LexSaleOrderController.ConsumableorderdetailsInfo ass: inList){
+ ass.orderdetails2= Orderdet1;
+ inList1.add(ass);
+ }
+
+ String errorReason = 'success';
+ LexSaleOrderController.ConsumableorderdetailsInfo c2 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet1,errorReason);
+ c2.orderdetails1 = null;
+ c2.orderdetails2 = Orderdet1;
+ c2.Prod = Orderdet1.Consumable_product__r;
+ c2.oldConsumableCount = Orderdet1.Name;
+ c2.ErrorReason = errorReason;
+
+ LexSaleOrderController.ConsumableorderdetailsInfo c1 = new LexSaleOrderController.ConsumableorderdetailsInfo(Orderdet2);
+ c1.orderdetails1 = null;
+ c1.orderdetails2 = Orderdet2;
+ c1.Prod = Orderdet2.Consumable_product__r;
+ c1.oldConsumableCount = Orderdet2.Name;
+ c1.compareTo(c2);
+ System.Test.stopTest();
+
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testProdError() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType hosCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
+ insert myAccount2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', Work_Location__c='澶ц繛');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+ //璁㈠崟
+ system.runAs(MyUser_Test){
+ String Id = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid,ContactId,Contact.AccountId, Work_Location__c FROM User WHERE id =:Id];
+ String accountId = thisUserInfo.Contact.AccountId;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ String accountName;
+ Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
+ if(accountInfo.size() > 0 ){
+ accountName = accountInfo[0].Name;
+ }
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c=12,Manual_Entry__c = false);
+ insert new Product2[]{prod01,prod02,prod03};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
+ insert new Product2__c[] {pro1, pro2,pro3};
+ //鍑哄簱鍗�
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '浼犵エ';
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Order;
+ Order1.Dealer_Info__c = myAccount2.Id;
+ Order1.SummonsForDirction__c ='鐩存帴閿�鍞粰鍖婚櫌';
+ Order1.IsShipment__c = true;
+ insert Order1;
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount1.Id;
- hp1.account__c = myAccount1.Id;
- hp1.product__c = pro1.Id;
- insert hp1;
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ //鏄庣粏1
+ Consumable_orderdetails__c Orderdet1 = new Consumable_orderdetails__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order__c = Order1.Id;
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Order ;
+ Orderdet1.Consumable_Count__c = 12;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Unitprice_To_agency__c = 1;
+ Orderdet1.Delivery_List_RMB__c = 1;
+ Orderdet1.Shipment_Count__c = 1;
+ Orderdet1.Box_Piece__c = '鐩�';
+ Consumable_orderdetails__c Orderdet2 = new Consumable_orderdetails__c();
+ Orderdet2.Name = 'OCM_01_001002';
+ Orderdet2.Consumable_order__c = Order1.Id;
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Order ;
+ Orderdet2.Consumable_Count__c = 12;
+ Orderdet2.Consumable_Product__c = pro2.Id;
+ Orderdet2.Unitprice_To_agency__c = 1;
+ Orderdet2.Delivery_List_RMB__c = 1;
+ Orderdet2.Shipment_Count__c = 1;
+ Orderdet2.Box_Piece__c = '涓�';
+ orderdetails.add(Orderdet1);
+ orderdetails.add(Orderdet2);
+ insert orderdetails;
+
+ //鏄庣粏2
+ Consumable_order_details2__c Orderdets1 = new Consumable_order_details2__c();
+ Orderdets1.Name = 'OCM_01_0010001';
+ Orderdets1.Consumable_order_minor__c = Order1.Id;
+ Orderdets1.Consumable_ZS_order__c = Order1.Id;
+ Orderdets1.Consumable_Return_order__c = null;
+ Orderdets1.Consumable_Sale_order__c =null;
+ Orderdets1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets1.Bar_Code__c = '11111250AAAAA';
+ Orderdets1.Consumable_Product__c = pro1.Id;
+ Orderdets1.Arrive_date__c = Date.today();
+ Orderdets1.Return_date__c= null;
+ Orderdets1.RemoveBox_No__c = 3;
+ Orderdets1.Delivery_List_RMB__c = 11.11;
+ Orderdets1.Box_Piece__c = '鐩�';
+ Orderdets1.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdets1.TracingCode__c = 'AAAAA';
+
+ Consumable_order_details2__c Orderdets2 = new Consumable_order_details2__c();
+ Orderdets2.Name = 'OCM_01_0010002';
+ Orderdets2.Consumable_Return_order__c = null;
+ Orderdets2.Consumable_Sale_order__c =null;
+ Orderdets2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets2.Bar_Code__c = '22222250BBBBB';
+ Orderdets2.Consumable_Product__c = pro2.Id;
+ Orderdets2.Arrive_date__c = Date.today();
+ Orderdets2.Return_date__c= null;
+ Orderdets2.RemoveBox_No__c = 3;
+ Orderdets2.Delivery_List_RMB__c = 11.11;
+ Orderdets2.Box_Piece__c = '涓�';
+ Orderdets2.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdets2.TracingCode__c = '';
+
+ Consumable_order_details2__c Orderdets3 = new Consumable_order_details2__c();
+ Orderdets3.Name = 'OCM_01_0010003';
+ Orderdets3.Consumable_order_minor__c = Order1.Id;
+ Orderdets3.Consumable_ZS_order__c = Order1.Id;
+ Orderdets3.Consumable_Return_order__c = null;
+ Orderdets2.Consumable_Sale_order__c =null;
+ Orderdets3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets3.Bar_Code__c = '33333250CCCCC';
+ Orderdets3.Consumable_Product__c = pro3.Id;
+ Orderdets3.Arrive_date__c = Date.today();
+ Orderdets3.Return_date__c= null;
+ Orderdets3.RemoveBox_No__c = 3;
+ Orderdets3.Delivery_List_RMB__c = 11.11;
+ Orderdets3.Box_Piece__c = '鐩�';
+ Orderdets3.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdets3.TracingCode__c = 'CCCCC';
+ //鏈埌璐�
+ Consumable_order_details2__c Orderdets4 = new Consumable_order_details2__c();
+ Orderdets4.Name = 'OCM_01_0010001';
+ Orderdets4.Consumable_order_minor__c = Order1.Id;
+ Orderdets4.Consumable_ZS_order__c = Order1.Id;
+ Orderdets4.Consumable_Return_order__c = null;
+ Orderdets4.Consumable_Sale_order__c =null;
+ Orderdets4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets4.Bar_Code__c = '44444250DDDDD';
+ Orderdets4.Arrive_date__c = Date.today();
+ Orderdets4.Return_date__c= null;
+ Orderdets4.Consumable_Product__c = pro1.Id;
+ Orderdets4.Delivery_List_RMB__c = 11.11;
+ Orderdets4.RemoveBox_No__c = 3;
+ Orderdets4.Box_Piece__c = '鐩�';
+ Orderdets4.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdets4.TracingCode__c = 'DDDDD';
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- Order0.OutPattern__c = true;
- insert Order0;
+ Consumable_order_details2__c Orderdets5 = new Consumable_order_details2__c();
+ Orderdets5.Name = 'OCM_01_0010003';
+ Orderdets5.Consumable_order_minor__c = Order1.Id;
+ Orderdets5.Consumable_ZS_order__c = Order1.Id;
+ Orderdets5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdets5.Bar_Code__c = '33333250EEEEE';
+ Orderdets5.Consumable_Product__c = pro3.Id;
+ Orderdets5.Arrive_date__c = Date.today();
+ Orderdets5.Return_date__c= null;
+ Orderdets5.RemoveBox_No__c = 3;
+ Orderdets5.Delivery_List_RMB__c = 11.11;
+ Orderdets5.Box_Piece__c = '涓�';
+ Orderdets5.Sterilization_limit__c = Date.today().addDays(-1);
+ Orderdets5.TracingCode__c = 'EEEEE';
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 1;
- Orderdet.isOutPattern__c = true;
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- Orderdet1.Box_Piece__c = '涓�';
- insert Orderdet1;
- System.debug('Orderdet1:' + Orderdet1);
- System.Test.startTest();
- String a = LexSaleOrderController.baseUrl;
- LexSaleOrderController.msiMap = new Map<String, Integer>();
- List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
- orderdetails.add(Orderdet);
- LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
- LexSaleOrderController.consumableorderdetailsRecords[0].outboundCount = 1;
- String condetailList = JSON.serialize(
- LexSaleOrderController.consumableorderdetailsRecords
- );
- // LexSaleOrderController.ProdElivery(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
- LexSaleOrderController.ProSale(
- Order1.Id,
- LexSaleOrderController.coc,
- '01049531702003111115120017181000105ZK250BXJRF',
- myAccount1.Name,
- '',
- condetailList,
- LexSaleOrderController.orderdetails,
- LexSaleOrderController.orderpriceMap,
- LexSaleOrderController.orderagencypriceMap
- );
- System.Test.stopTest();
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ newdet2.add(Orderdets1);
+ insert newdet2;
+ insert new Consumable_order_details2__c[] {Orderdets2,Orderdets3,Orderdets4,Orderdets5};
+
+ List<String> barCodeListP = new List<String>();
+ Map<String, object> data = new Map<String, object>();
+ String ESetId = Order1.Id;
+ System.Test.startTest();
+ LexSaleOrderController.GoodsDeliveryInit(ESetId);
+ String barcode = '11111250AAAAA\n22222250BBBBB\n33333250CCCCC\n44444250DDDDD\n33333250EEEEE';
+ barCodeListP = LexSaleOrderController.ParseBarCode(barcode);
+ System.debug('barCodeListP:' + barCodeListP);
+ System.debug('accountName:' + accountName);
+ System.debug('userWorkLocation:' + userWorkLocation);
+ String key = '';
+ Integer idx = 0;
+ orderpieceorboxMap = new Map<String, String>();
+ LexSaleOrderController.SearchPro(Order1,barcode,accountName,userWorkLocation,accountId,orderdetails,orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(ESetId,Order1,barcode,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+ LexSaleOrderController.ProSale(ESetId,Order1,barcode,accountName,userWorkLocation,JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords),orderdetails,orderpriceMap,orderagencypriceMap);
+
+ System.Test.stopTest();
+ }
}
- }
-}
+
+ @isTest
+ static void searchTest1() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET',Work_Location__c='鍖椾含');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount1.Id;
+ hp1.account__c = myAccount1.Id;
+ hp1.product__c = pro1.Id;
+ insert hp1;
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ Order0.OutPattern__c = true;
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 1;
+ Orderdet.isOutPattern__c = true;
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ insert Orderdet1;
+ System.debug('Orderdet1:'+Orderdet1);
+ Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
+ Orderdet2.Name = 'OCM_01_001001';
+ Orderdet2.Consumable_order_minor__c = Order1.Id;
+ Orderdet2.Consumable_Product__c = pro1.Id;
+ Orderdet2.Asset_Model_No__c = 'Test01';
+ Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet2.TracingCode__c = 'BXJRF';
+ Orderdet2.SerialLotNo__c = '5ZK';
+ // Orderdet2.Consumable_ZS_order__c = Order1.Id;
+ // Orderdet2.Box_Piece__c = '涓�';
+ insert Orderdet2;
+ System.Test.startTest();
+ String a = LexSaleOrderController.baseUrl;
+ LexSaleOrderController.msiMap = new Map<String, Integer>();
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ orderdetails.add(Orderdet);
+ LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
+ String condetailList = JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords);
+ Order1.Arrive_Order__c = null;
+ LexSaleOrderController.SearchPro(Order1, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', myAccount1.Id, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpieceorboxMap);
+ LexSaleOrderController.ProdElivery(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ LexSaleOrderController.ProSale(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void searchTest2() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET',Work_Location__c='鍖椾含');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount1.Id;
+ hp1.account__c = myAccount1.Id;
+ hp1.product__c = pro1.Id;
+ insert hp1;
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ Order0.OutPattern__c = true;
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 1;
+ Orderdet.isOutPattern__c = true;
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ Orderdet1.Box_Piece__c = '涓�';
+ insert Orderdet1;
+ System.debug('Orderdet1:'+Orderdet1);
+ System.Test.startTest();
+ String a = LexSaleOrderController.baseUrl;
+ LexSaleOrderController.msiMap = new Map<String, Integer>();
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ orderdetails.add(Orderdet);
+ LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
+ LexSaleOrderController.consumableorderdetailsRecords[0].outboundCount = 1;
+ String condetailList = JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords);
+ LexSaleOrderController.ProdElivery(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ // LexSaleOrderController.ProSale(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void searchTest3() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET',Work_Location__c='鍖椾含');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount1.Id;
+ hp1.account__c = myAccount1.Id;
+ hp1.product__c = pro1.Id;
+ insert hp1;
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ Order0.OutPattern__c = true;
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 1;
+ Orderdet.isOutPattern__c = true;
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ Orderdet1.Box_Piece__c = '涓�';
+ insert Orderdet1;
+ System.debug('Orderdet1:'+Orderdet1);
+ System.Test.startTest();
+ String a = LexSaleOrderController.baseUrl;
+ LexSaleOrderController.msiMap = new Map<String, Integer>();
+ List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
+ orderdetails.add(Orderdet);
+ LexSaleOrderController.GoodsDeliveryInit(Order1.Id);
+ LexSaleOrderController.consumableorderdetailsRecords[0].outboundCount = 1;
+ String condetailList = JSON.serialize(LexSaleOrderController.consumableorderdetailsRecords);
+ // LexSaleOrderController.ProdElivery(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ LexSaleOrderController.ProSale(Order1.Id, LexSaleOrderController.coc, '01049531702003111115120017181000105ZK250BXJRF', myAccount1.Name, '', condetailList, LexSaleOrderController.orderdetails, LexSaleOrderController.orderpriceMap, LexSaleOrderController.orderagencypriceMap);
+ System.Test.stopTest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml b/force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexSearchContractControllerTest.cls b/force-app/main/default/classes/LexSearchContractControllerTest.cls
index 172f409..b1cc968 100644
--- a/force-app/main/default/classes/LexSearchContractControllerTest.cls
+++ b/force-app/main/default/classes/LexSearchContractControllerTest.cls
@@ -1,84 +1,33 @@
@istest
public class LexSearchContractControllerTest {
- @IsTest
- static void lexSearchContractController1() {
- User myUser_test = new User();
- Account myAccount2;
- Account contact;
- Contact core;
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(currentUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- List<RecordType> rectCotac = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '濂戠磩'
- ];
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- myAccount2 = new Account(
- name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
- ET_SP_Dealer__c = true
- );
- insert myAccount2;
- contact = new Account(
- name = 'Testaccount002',
- RecordTypeId = rectCotac[0].Id,
- SpecialDealerName__c = 'Testaccount002',
- ParentId = myAccount2.Id,
- Agent_Ref__c = myAccount2.Id,
- Delete_Flag__c = false,
- Contract_Department_Class__c = 'ET',
- Contract_Decide_Start_Date__c = Date.today().addDays(-1),
- Contract_Decide_End_Date__c = Date.today().addDays(1),
- AgentCode_Ext__c = '9999900',
- ET_SP_Dealer__c = true
- );
- insert contact;
+ @IsTest
+ static void lexSearchContractController1(){
+ User myUser_test = new User();
+ Account myAccount2;
+ Account contact;
+ Contact core;
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(currentUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ List<RecordType> rectCotac = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '濂戠磩'];
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',ET_SP_Dealer__c = true);
+ insert myAccount2;
+ contact = new Account(name='Testaccount002',RecordTypeId = rectCotac[0].Id,SpecialDealerName__c = 'Testaccount002',ParentId = myAccount2.Id,Agent_Ref__c = myAccount2.Id,Delete_Flag__c = false,Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c = Date.today().addDays(-1),Contract_Decide_End_Date__c = Date.today().addDays(1),AgentCode_Ext__c = '9999900',ET_SP_Dealer__c = true);
+ insert contact;
- core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount2.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com'
- );
- insert myUser_test;
- }
+ core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
+ insert myUser_test;
+ }
- System.runAs(myUser_test) {
- LexSearchContractController.init('ET');
- String accountId = myAccount2.Id;
- LexSearchContractController.searchContract(
- 'Testaccount002',
- accountId,
- 'ET',
- false
- );
+ System.runAs(myUser_test){
+ LexSearchContractController.init('ET');
+ String accountId = myAccount2.Id;
+ LexSearchContractController.searchContract('Testaccount002', accountId, 'ET', false);
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml b/force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexSearchHospitalControllerTest.cls b/force-app/main/default/classes/LexSearchHospitalControllerTest.cls
index f66ab33..2e9b173 100644
--- a/force-app/main/default/classes/LexSearchHospitalControllerTest.cls
+++ b/force-app/main/default/classes/LexSearchHospitalControllerTest.cls
@@ -1,9 +1,9 @@
@istest
public class LexSearchHospitalControllerTest {
- @IsTest
- static void lexSearchHospitalControllerTest1() {
- LexSearchHospitalController.init();
- LexSearchHospitalController.searchHospital('', '');
- LexSearchHospitalController.searchHospital('test', '');
- }
-}
+ @IsTest
+ static void lexSearchHospitalControllerTest1(){
+ LexSearchHospitalController.init();
+ LexSearchHospitalController.searchHospital('', '');
+ LexSearchHospitalController.searchHospital('test', '');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml b/force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexSummonsCreatController.cls b/force-app/main/default/classes/LexSummonsCreatController.cls
index 1b620e4..97b98dc 100644
--- a/force-app/main/default/classes/LexSummonsCreatController.cls
+++ b/force-app/main/default/classes/LexSummonsCreatController.cls
@@ -1,498 +1,445 @@
public without sharing class LexSummonsCreatController {
- public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
+ public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
- /*****************妞滅储鐢�******************/
- //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
- @AuraEnabled
- public static String agencyProType { get; set; }
- public static Consumable_order__c coc { get; set; } // 鐢籿iew鐢紝 鍙兘鏄� 鍑哄簱鎸囩ず鍗曪紝 涔熸湁鍙兘鏄埌璐у崟锛� 涔熸湁鍙兘 绌篿nstance
- public static User localuser { get; set; }
- public static String category1 { get; set; }
- public static Integer noOfRecords { get; set; }
- //public String category_Goods {get ; set;}
- public static Boolean cansee { get; set; }
- public static Integer size { get; set; }
- //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
- //public static ApexPages.StandardSetController setCon { get; set; }
- public static Boolean dealerPricesee { get; set; }
- /*****************鐢婚潰鍒濆鍖栫敤********************************/
- /******20160313_add**************/
- public static String IdCheck { get; set; }
- public static Boolean editAble { get; set; }
- public static String statusEdit { get; set; }
- public static String alertMessage { get; set; }
- public static String SearchDone { get; set; }
- public static List<String> zaikuId = new List<String>();
- public static List<String> orderzaikuId = new List<String>();
- //闄勪欢
- public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
- public static Boolean getExistarrive() {
- return (coc.Arrive_Order__c != null);
- }
- //鎬讳环鏍艰绠楃粨鏋�
- @AuraEnabled
- public static Decimal sumPrice { get; set; }
- /******20160317_add**************/
- public static String SummonsFlag { get; set; } // 鏂拌: hidden, 鏇存柊: visible
- public static String category5 { get; set; }
- public static String category4 { get; set; }
- public static String category3 { get; set; }
- public static List<SelectOption> categoryOptionList { get; set; }
- public static List<SelectOption> category4OptionList { get; set; }
- public static List<SelectOption> category5OptionList { get; set; }
- @AuraEnabled
- public static Map<String, String> categoryOptionMap { get; set; }
- @AuraEnabled
- public static Map<String, String> category4OptionMap { get; set; }
- @AuraEnabled
- public static Map<String, String> category5OptionMap { get; set; }
- /*****************鐢婚潰琛ㄧずBean******************/
- private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- //鏄庣粏2
- @AuraEnabled
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords {
- get;
- set;
- }
- //閿欒鏄庣粏
- @AuraEnabled
- public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror {
- get;
- set;
- }
- @AuraEnabled
- public static List<ConsumableorderdetailsInfo> pageRecords { get; set; }
- public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; }
- //public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
- public static List<ConsumableorderdetailsInfo> consumableorderdetails2Records {
- get;
- set;
- }
- public static List<Consumable_order__c> consumableInvoiceRecords { get; set; }
- private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
- private static List<Attachment> attachmentinfo = new List<Attachment>();
- public static List<Product2__c> product2Selected = new List<Product2__c>();
- @AuraEnabled
- public static Map<String, String> orderpieceorboxMap { get; set; }
- @AuraEnabled
- public static List<Consumable_orderdetails__c> orderdetails { get; set; }
- @AuraEnabled
- public static Map<String, Decimal> orderagencypriceMap { get; set; }
- @AuraEnabled
- public static Map<String, Decimal> orderpriceMap { get; set; }
- @AuraEnabled
- public static Map<String, Decimal> orderdetCountMap { get; set; }
- @AuraEnabled
- public static Boolean hasSpecialHos { get; set; }
- //閫夋嫨浜у搧size
- public static Integer consumableorderdetailsCount {
- get {
- return pageRecords == null ? 0 : pageRecords.size();
+ /*****************妞滅储鐢�******************/
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ @AuraEnabled
+ public static String agencyProType { get; set; }
+ public static Consumable_order__c coc { get; set; } // 鐢籿iew鐢紝 鍙兘鏄� 鍑哄簱鎸囩ず鍗曪紝 涔熸湁鍙兘鏄埌璐у崟锛� 涔熸湁鍙兘 绌篿nstance
+ public static User localuser { get; set; }
+ public static String category1 { get; set; }
+ public static Integer noOfRecords { get; set; }
+ //public String category_Goods {get ; set;}
+ public static Boolean cansee { get; set; }
+ public static Integer size { get; set; }
+ //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
+ //public static ApexPages.StandardSetController setCon { get; set; }
+ public static Boolean dealerPricesee { get; set; }
+ /*****************鐢婚潰鍒濆鍖栫敤********************************/
+ /******20160313_add**************/
+ public static String IdCheck { get; set; }
+ public static Boolean editAble { get; set; }
+ public static String statusEdit { get; set; }
+ public static String alertMessage { get; set; }
+ public static String SearchDone { get; set; }
+ public static List<String> zaikuId = new List<String>();
+ public static List<String> orderzaikuId = new List<String>();
+ //闄勪欢
+ public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
+ public static Boolean getExistarrive() {
+ return (coc.Arrive_Order__c != null);
}
- }
- //娑堣�楀搧鏄庣粏2鏁伴噺
- public static Integer consumableorderdetails2Count {
- get {
- return consumableorderdetails2Records == null
- ? 0
- : consumableorderdetails2Records.size();
- }
- }
- //璁㈣揣鍗曞彿
- public static String consumableorderId {
- get {
- return (coc.Arrive_Order__c);
- }
- }
- //閫夋嫨妗�
- public static List<SelectOption> provinceOpts { get; set; }
- @AuraEnabled
- public static Map<String, String> provinceOptsMap { get; set; }
- public static String SecondDealer { get; set; }
- //public List<SelectOption> orderForHospitalOpts { get; set; }
- public static String HospitalInfo { get; set; }
- public static String HospitalName { get; set; }
-
- public static Boolean EditDelCommitBtnDisabled { get; private set; }
- public static Boolean saveBtnDisabled { get; private set; }
- public static Boolean SorderBtnDisabled { get; private set; }
-
- // page
- public static Integer pagesize { get; set; }
- public static Integer pageToken { get; set; }
- //public static String sortField { get; set; }
- //public static String sortOrder { get; set; }
- public static Integer totalcount { get; set; }
- public static Integer addSize { get; set; }
- //List<ConsumableorderdetailsInfoLwc> reSetLwc
- public static List<ConsumableorderdetailsInfo> addData { get; set; }
- public static Map<String, String> skipData { get; set; }
- // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
- // public static String sortKey { get; set; }
- // public static String preSortKey { get; private set; }
- // public static Boolean sortOrderAsc { get; private set; }
- // public static String[] sortOrder { get; private set; }
- // private static String[] columus = new List<String>{
- // 'Consumable_Product__r.Name',
- // 'Consumable_Product__r.Asset_Model_No__c',
- // 'Consumable_Product__r.Intra_Trade_List_RMB__c',
- // '',
- // '',
- // 'Consumable_Product__r.Category3__c',
- // 'Consumable_Product__r.Category4__c',
- // 'Consumable_Product__r.Category5__c'
- // };
- // private static String[] columus_no = new List<String>{
- // 'Product2__c.Name',
- // 'Product2__c.Asset_Model_No__c',
- // 'Product2__c.Intra_Trade_List_RMB__c',
- // '',
- // '',
- // 'Category3__c',
- // 'Category4__c',
- // 'Category5__c'
- // };
-
- //鍒拌揣鍗曟槑缁�1
- private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
- //鍒拌揣鍗曟槑缁�2
- private static List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = new List<Consumable_order_details2__c>();
-
- //鍑哄簱鍗曟槑缁�2
- private static List<Consumable_order_details2__c> consumableorderdetails2RecordsList = new List<Consumable_order_details2__c>();
- /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
- //private String cate1ForSort = null;
- private static String accountid = null;
- @AuraEnabled
- public static String accountName { get; set; }
-
- // 浜у搧 ID
- private static String ESetId = '';
- @AuraEnabled
- public static String arriveorder { get; set; }
- private static String userId = '';
- //private String[] ProidListAll = new String[]{};
-
- // 鐧诲綍鑰呭伐浣滃湴
- @AuraEnabled
- public static String userWorkLocation { get; set; }
-
- //add by rentx 2021-01-29
- public static List<SelectOption> outOutPatternOptionList { get; set; }
- @AuraEnabled
- public static Map<String, String> outOutPatternOptionMap { get; set; }
- public static String outOutPattern { get; set; }
- public static Boolean hasHos { get; set; }
- @AuraEnabled
- public static Boolean hasHosPro { get; set; }
-
- private static Map<String, String> HosProMap = new Map<String, String>();
- //add by rentx 2021-01-29
-
- public LexSummonsCreatController() {
- System.debug('LexSummonsCreatController');
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- // ESetId = ApexPages.currentPage().getParameters().get('esetId');
- // arriveorder = ApexPages.currentPage().getParameters().get('arriveorder');
- // statusEdit = ApexPages.currentPage().getParameters().get('KeyWords');
- provinceOpts = new List<SelectOption>();
- provinceOptsMap = new Map<String, String>();
- pageRecords = new List<ConsumableorderdetailsInfo>();
- consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
- consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
- consumableInvoiceRecords = new List<Consumable_order__c>();
- categoryOptionList = new List<SelectOption>();
- category4OptionList = new List<SelectOption>();
- category5OptionList = new List<SelectOption>();
-
- categoryOptionMap = new Map<String, String>();
- category4OptionMap = new Map<String, String>();
- category5OptionMap = new Map<String, String>();
-
- outOutPatternOptionMap = new Map<String, String>();
- outOutPatternOptionMap.put('', '-鏃�-');
- outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
- outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
-
- outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
- outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
- outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
- HospitalName = '';
- }
-
- public static void firstInit(String ESetidJs) {
- System.debug('enter firstInit');
- ESetid = ESetidJs;
- System.debug('ESetid = ' + ESetid);
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- provinceOpts = new List<SelectOption>();
- provinceOptsMap = new Map<String, String>();
- pageRecords = new List<ConsumableorderdetailsInfo>();
- consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
- consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
- consumableInvoiceRecords = new List<Consumable_order__c>();
- categoryOptionList = new List<SelectOption>();
- category4OptionList = new List<SelectOption>();
- category5OptionList = new List<SelectOption>();
-
- categoryOptionMap = new Map<String, String>();
- category4OptionMap = new Map<String, String>();
- category5OptionMap = new Map<String, String>();
-
- outOutPatternOptionMap = new Map<String, String>();
- outOutPatternOptionMap.put('', '-鏃�-');
- outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
- outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
-
- // outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
- // outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
- // outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
- HospitalName = '';
- }
-
- // 鐢婚潰鍒濆鍖�
- @AuraEnabled
- public static ResponseBodyLWC init(
- String ESetidJs,
- String statusEdit,
- Integer pageSizeLWC,
- Integer pageTokenLWC,
- String arriveorderLWC
- ) {
- try {
- firstInit(ESetidJs);
- statusEdit = statusEdit;
- arriveorder = arriveorderLWC;
- HospitalName = '';
- provinceOpts = new List<SelectOption>();
- provinceOptsMap = new Map<String, String>();
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- // public static Integer pagesize { get; set; }
- // public static Integer pageToken { get; set; }
- // public static String sortField { get; set; }
- // public static String sortOrder { get; set; }
- pagesize = pageSizeLWC;
- pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
-
- // sortKey = '1';
- // preSortKey = '1';
- // sortOrderAsc = false;
- // sortOrder = new List<String>(8);
- // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
- //cate1ForSort = '';
- sumPrice = 0;
- IdCheck = EsetId;
- if (
- ESetId != null &&
- ESetId != '' &&
- (statusEdit == '' ||
- statusEdit == null)
- ) {
- editAble = false;
- } else if (
- (ESetId == null || ESetId == '') &&
- (statusEdit == '' ||
- statusEdit == null)
- ) {
- editAble = true;
- } else if (
- ESetId != null &&
- ESetId != '' &&
- statusEdit != '' &&
- statusEdit != null
- ) {
- editAble = true;
- }
- userId = UserInfo.getUserId();
- localuser = [
- SELECT id, State_Hospital__c
- FROM User
- WHERE id = :UserInfo.getUserId()
- ];
- //userId = '00510000005QO75';
- user Useracc = [
- SELECT accountid, Work_Location__c, UserPro_Type__c
- FROM user
- WHERE id = :userId
- ];
- accountid = Useracc.accountid;
- userWorkLocation = Useracc.Work_Location__c;
- agencyProType = Useracc.UserPro_Type__c;
- if (String.isBlank(Useracc.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
- accountName = accountInfo.Name;
- //coc.Order_date__c = Date.today();
- list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
- Dealerelationship = [
- SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
- FROM Dealer_elationship__c
- WHERE Dealer_principal__c = :accountid
- ];
-
- List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
- AgencyHospitalLink = [
- SELECT Id, Hospital__c, Hospital__r.Name
- FROM Agency_Hospital_Link__c
- WHERE Agency__c = :accountid
- ];
-
- //add by rentx 2021-3-1 start
- //鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
- List<hospitalprice__c> hlist = [
- SELECT id, product__c
- FROM hospitalprice__c
- WHERE account__c = :accountid
- ];
- if (hlist == null || hlist.size() == 0) {
- hasHos = false;
- } else {
- for (hospitalprice__c hp : hlist) {
- HosProMap.put(hp.product__c, '');
+ //鎬讳环鏍艰绠楃粨鏋�
+ @AuraEnabled
+ public static Decimal sumPrice { get; set; }
+ /******20160317_add**************/
+ public static String SummonsFlag { get; set; } // 鏂拌: hidden, 鏇存柊: visible
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static List<SelectOption> categoryOptionList { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> categoryOptionMap { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category4OptionMap { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category5OptionMap { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //鏄庣粏2
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ //閿欒鏄庣粏
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; }
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> pageRecords { get; set; }
+ public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; }
+ //public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetails2Records { get; set; }
+ public static List<Consumable_order__c> consumableInvoiceRecords { get; set; }
+ private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ private static List<Attachment> attachmentinfo = new List<Attachment>();
+ public static List<Product2__c> product2Selected = new List<Product2__c>();
+ @AuraEnabled
+ public static Map<String, String> orderpieceorboxMap { get; set; }
+ @AuraEnabled
+ public static List<Consumable_orderdetails__c> orderdetails { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderagencypriceMap { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderpriceMap { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderdetCountMap { get; set; }
+ @AuraEnabled
+ public static Boolean hasSpecialHos { get; set; }
+ //閫夋嫨浜у搧size
+ public static Integer consumableorderdetailsCount {
+ get {
+ return pageRecords == null ? 0 : pageRecords.size();
}
- hasHos = true;
- }
- //add by rentx 2021-3-1 end
+ }
+ //娑堣�楀搧鏄庣粏2鏁伴噺
+ public static Integer consumableorderdetails2Count {
+ get {
+ return consumableorderdetails2Records == null ? 0 : consumableorderdetails2Records.size();
+ }
+ }
+ //璁㈣揣鍗曞彿
+ public static String consumableorderId {
+ get {
+ return (coc.Arrive_Order__c);
+ }
+ }
+ //閫夋嫨妗�
+ public static List<SelectOption> provinceOpts { get; set; }
+ @AuraEnabled
+ public static Map<String, String> provinceOptsMap { get; set; }
+ public static String SecondDealer { get; set; }
+ //public List<SelectOption> orderForHospitalOpts { get; set; }
+ public static String HospitalInfo { get; set; }
+ public static String HospitalName { get; set; }
- saveBtnDisabled = false;
- SorderBtnDisabled = false;
- String sqlagencyProType = '%' + agencyProType + '%';
- coc = new Consumable_order__c();
- consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- //add by rentx 2021-01-29
- Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
- //add by rentx 2021-01-29
+ public static Boolean EditDelCommitBtnDisabled { get; private set; }
+ public static Boolean saveBtnDisabled { get; private set; }
+ public static Boolean SorderBtnDisabled { get; private set; }
- List<AggregateResult> orderdetailCount = [
- SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Isoverdue__c = 1
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- GROUP BY Consumable_Product__c, Box_Piece__c
- ];
- for (AggregateResult orderdetail : orderdetailCount) {
- zaikuId.add(String.valueOf(orderdetail.get('cpc')));
- }
- System.debug('sqlagencyProType = ' + sqlagencyProType);
- System.debug('userWorkLocation = ' + userWorkLocation);
- System.debug('accountName = ' + accountName);
- List<Consumable_order_details2__c> CountDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- //add by rentx 2020-11-27 start
- hospitalSpecialOffer__c
- //add by rentx 2020-11-27 end
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Isoverdue__c = 1
- AND Product_Type__c LIKE :sqlagencyProType
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- AND Dealer_Info_text__c = :accountName
- ];
- // 鏂拌
- if (ESetId == null || ESetId == '') {
- SummonsFlag = 'hidden';
- String msoql = makeSoqlinventory();
- initStandardController(msoql);
- System.debug('msoql = ' + msoql);
- product2Selected = Database.query(msoql);
- if (String.isBlank(arriveorder)) {
- EditDelCommitBtnDisabled = true;
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- for (Integer i = 0; i < CountDel.size(); i++) {
- String str = '';
- if (CountDel[i].hospitalSpecialOffer__c) {
- str = 'isHos';
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ //public static String sortField { get; set; }
+ //public static String sortOrder { get; set; }
+ public static Integer totalcount { get; set; }
+ public static Integer addSize { get; set; }
+ //List<ConsumableorderdetailsInfoLwc> reSetLwc
+ public static List<ConsumableorderdetailsInfo> addData { get; set; }
+ public static Map<String, String> skipData { get; set; }
+ // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
+ // public static String sortKey { get; set; }
+ // public static String preSortKey { get; private set; }
+ // public static Boolean sortOrderAsc { get; private set; }
+ // public static String[] sortOrder { get; private set; }
+ // private static String[] columus = new List<String>{
+ // 'Consumable_Product__r.Name',
+ // 'Consumable_Product__r.Asset_Model_No__c',
+ // 'Consumable_Product__r.Intra_Trade_List_RMB__c',
+ // '',
+ // '',
+ // 'Consumable_Product__r.Category3__c',
+ // 'Consumable_Product__r.Category4__c',
+ // 'Consumable_Product__r.Category5__c'
+ // };
+ // private static String[] columus_no = new List<String>{
+ // 'Product2__c.Name',
+ // 'Product2__c.Asset_Model_No__c',
+ // 'Product2__c.Intra_Trade_List_RMB__c',
+ // '',
+ // '',
+ // 'Category3__c',
+ // 'Category4__c',
+ // 'Category5__c'
+ // };
+
+ //鍒拌揣鍗曟槑缁�1
+ private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
+ //鍒拌揣鍗曟槑缁�2
+ private static List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = new List<Consumable_order_details2__c>();
+
+ //鍑哄簱鍗曟槑缁�2
+ private static List<Consumable_order_details2__c> consumableorderdetails2RecordsList = new List<Consumable_order_details2__c>();
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ //private String cate1ForSort = null;
+ private static String accountid = null;
+ @AuraEnabled
+ public static String accountName { get; set; }
+
+ // 浜у搧 ID
+ private static String ESetId = '';
+ @AuraEnabled
+ public static String arriveorder { get; set; }
+ private static String userId = '';
+ //private String[] ProidListAll = new String[]{};
+
+ // 鐧诲綍鑰呭伐浣滃湴
+ @AuraEnabled
+ public static String userWorkLocation { get; set; }
+
+ //add by rentx 2021-01-29
+ public static List<SelectOption> outOutPatternOptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> outOutPatternOptionMap { get; set; }
+ public static String outOutPattern { get; set; }
+ public static Boolean hasHos { get; set; }
+ @AuraEnabled
+ public static Boolean hasHosPro { get; set; }
+
+ private static Map<String, String> HosProMap = new Map<String, String>();
+ //add by rentx 2021-01-29
+
+ public LexSummonsCreatController() {
+ System.debug('LexSummonsCreatController');
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ // ESetId = ApexPages.currentPage().getParameters().get('esetId');
+ // arriveorder = ApexPages.currentPage().getParameters().get('arriveorder');
+ // statusEdit = ApexPages.currentPage().getParameters().get('KeyWords');
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
+ consumableInvoiceRecords = new List<Consumable_order__c>();
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+ outOutPatternOptionMap = new Map<String, String>();
+ outOutPatternOptionMap.put('', '-鏃�-');
+ outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+ outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+ outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
+ outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+ outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+ HospitalName = '';
+ }
+
+ public static void firstInit(String ESetidJs) {
+ System.debug('enter firstInit');
+ ESetid = ESetidJs;
+ System.debug('ESetid = ' + ESetid);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
+ consumableInvoiceRecords = new List<Consumable_order__c>();
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+ outOutPatternOptionMap = new Map<String, String>();
+ outOutPatternOptionMap.put('', '-鏃�-');
+ outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+ outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+ // outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
+ // outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+ // outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+ HospitalName = '';
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC,String arriveorderLWC) {
+ try {
+ firstInit(ESetidJs);
+ statusEdit = statusEdit;
+ arriveorder = arriveorderLWC;
+ HospitalName = '';
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ // public static Integer pagesize { get; set; }
+ // public static Integer pageToken { get; set; }
+ // public static String sortField { get; set; }
+ // public static String sortOrder { get; set; }
+ pagesize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+
+ // sortKey = '1';
+ // preSortKey = '1';
+ // sortOrderAsc = false;
+ // sortOrder = new List<String>(8);
+ // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ //cate1ForSort = '';
+ sumPrice = 0;
+ IdCheck = EsetId;
+ if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
+ editAble = false;
+ } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
+ //userId = '00510000005QO75';
+ user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+ accountid = Useracc.accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ //coc.Order_date__c = Date.today();
+ list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
+ Dealerelationship = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__c = :accountid
+ ];
+
+ List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
+ AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
+
+ //add by rentx 2021-3-1 start
+ //鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
+ List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hlist == null || hlist.size() == 0) {
+ hasHos = false;
} else {
- str = 'notHos';
+ for (hospitalprice__c hp : hlist) {
+ HosProMap.put(hp.product__c, '');
+ }
+ hasHos = true;
}
- //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
- if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
- //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
- if (
- MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)
- ) {
- ConsumableorderdetailsInfo Jstage = MidMap2.get(
- CountDel[i].Consumable_Product__c + str
- );
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- } else {
- //midmap2涓病鏈夊搴旂殑浜у搧
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- CountDel[i].Consumable_Product__c
- )
- .clone();
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- }
+ //add by rentx 2021-3-1 end
+
+ saveBtnDisabled = false;
+ SorderBtnDisabled = false;
+ String sqlagencyProType = '%' + agencyProType + '%';
+ coc = new Consumable_order__c();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //add by rentx 2021-01-29
+ Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
+ //add by rentx 2021-01-29
+
+ List<AggregateResult> orderdetailCount = [
+ SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ GROUP BY Consumable_Product__c, Box_Piece__c
+ ];
+ for (AggregateResult orderdetail : orderdetailCount) {
+ zaikuId.add(String.valueOf(orderdetail.get('cpc')));
}
- System.debug('MidMap2.size() = ' + MidMap2.size());
- /*//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ System.debug('orderdetailCount = ' + orderdetailCount);
+ System.debug('sqlagencyProType = ' + sqlagencyProType);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ System.debug('accountName = ' + accountName);
+ List<Consumable_order_details2__c> CountDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx 2020-11-27 start
+ hospitalSpecialOffer__c
+ //add by rentx 2020-11-27 end
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ // 鏂拌
+ if (ESetId == null || ESetId == '') {
+ SummonsFlag = 'hidden';
+ String msoql = makeSoqlinventory();
+ initStandardController(msoql);
+ System.debug('msoql = ' + msoql);
+ product2Selected = Database.query(msoql);
+ if (String.isBlank(arriveorder)) {
+ EditDelCommitBtnDisabled = true;
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ System.debug('MidMap = ' + MidMap);
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ System.debug('CountDel[i].Consumable_Product__c= ' + CountDel[i].Consumable_Product__c);
+ System.debug('CountDel[i].Consumable_Product__c + str= ' + CountDel[i].Consumable_Product__c + str);
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ System.debug('MidMap2.size() = ' + MidMap2.size());
+ /*//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
Jstage.allnumber = Jstage.allnumber+1 ;
@@ -509,144 +456,135 @@
//Jstage.BoxPiece = CountDel[i].Box_Piece__c;
MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
}*/
- }
+ }
- //update by rentx 2021-01-29 end
+ //update by rentx 2021-01-29 end
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- //update by rentx 2021-01-29
- // for(ConsumableorderdetailsInfo bss : MidMap.values()){
- for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
- //update by rentx 2021-01-29
- //if(bss.allnumber>0){
- bss.packinglist = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsSelectRecords.add(bss);
- //}
- }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+ //if(bss.allnumber>0){
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
- Integer ishosnum = 0;
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords
- ) {
- //ass.sortBy = sortOrderAsc;
- //add by rentx 2021-3-10
- if (ass.hospitalSpecialOffer) {
- ishosnum = ishosnum + 1;
- }
- }
- if (ishosnum > 0) {
- hasHosPro = true;
- } else {
- hasHosPro = false;
- }
- consumableorderdetailsSelectRecords.sort();
- //add by rentx
- noOfRecords = consumableorderdetailsSelectRecords.size();
- //add by rentx
- System.debug('makepagerecords1');
- makepagerecords();
- //listCut();
- } else {
- if (statusEdit == '' || statusEdit == null) {
- editAble = false;
- } else if (statusEdit != '' && statusEdit != null) {
- editAble = true;
- }
- // upadte start by vivek 2019-7-15
- // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
- // Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
- // Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
- // Order_status__c,Shipment_total_amount__c,Offers_Price__c,
- // Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
- // FROM Consumable_order__c
- // WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
- // AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
- coc = [
- SELECT
- Id,
- Name,
- Summons_Order_type__c,
- NoConfirmedPrice__c,
- SummonsStatus_c__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForDealerTextID__c,
- Order_ForHospital__c,
- SummonsForDirction__c,
- Order_date__c,
- Arrive_Order__c,
- Order_status__c,
- Shipment_total_amount__c,
- Offers_Price__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- Order_ForCustomerText__c,
- ConInvoice_Code__c,
- Onchange_order__c,
- OutPattern__c
- FROM Consumable_order__c
- WHERE
- Id = :arriveorder
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- AND recordtypeid = :System.Label.RT_ConOrder_Arrive
- ];
- // update end by vivek 2019-7-15
- //鏄庣粏1鑾峰彇
- consumableorderdetailsSelected = [
- SELECT
- Id,
- Dealer_Custom_Price__c,
- Delivery_List_RMB__c,
- Consumable_Product__r.Name__c,
- Name,
- Consumable_order__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Shipment_Count__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Sum_of_money__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Consumable_Product__r.SFDA_Status__c,
- Consumable_count__c,
- Invoiced_Procount__c,
- RrturnPro_count__c,
- InvoiceProNot_count__c,
- //Unitprice_To_agency__c,
- Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
- Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
- FROM Consumable_Orderdetails__c
- WHERE Consumable_order__c = :coc.Arrive_Order__c
- ORDER BY Name
- ];
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- orderzaikuId.add(cdc1.Consumable_Product__c);
- }
- msoql = makeSoqlorderdet();
- product2Selected = Database.query(msoql);
- size = product2Selected.size();
- initStandardController(msoql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- //update by rentx 2021-01-29
- /*for(Integer i = 0 ; i< CountDel.size();i++){
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ //add by rentx 2021-3-10
+ if (ass.hospitalSpecialOffer) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords1');
+ makepagerecords();
+ //listCut();
+ } else {
+ if (statusEdit == '' || statusEdit == null) {
+ editAble = false;
+ } else if (statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ // upadte start by vivek 2019-7-15
+ // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
+ // Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
+ // Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
+ // Order_status__c,Shipment_total_amount__c,Offers_Price__c,
+ // Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
+ // FROM Consumable_order__c
+ // WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
+ // AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Summons_Order_type__c,
+ NoConfirmedPrice__c,
+ SummonsStatus_c__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForDealerTextID__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Order_date__c,
+ Arrive_Order__c,
+ Order_status__c,
+ Shipment_total_amount__c,
+ Offers_Price__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ Order_ForCustomerText__c,
+ ConInvoice_Code__c,
+ Onchange_order__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE
+ Id = :arriveorder
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ AND recordtypeid = :System.Label.RT_ConOrder_Arrive
+ ];
+ // update end by vivek 2019-7-15
+ //鏄庣粏1鑾峰彇
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sum_of_money__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_count__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ InvoiceProNot_count__c,
+ //Unitprice_To_agency__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :coc.Arrive_Order__c
+ ORDER BY Name
+ ];
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
+ msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //update by rentx 2021-01-29
+ /*for(Integer i = 0 ; i< CountDel.size();i++){
//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
@@ -661,327 +599,275 @@
}
}*/
- for (Integer i = 0; i < CountDel.size(); i++) {
- String str = '';
- if (CountDel[i].hospitalSpecialOffer__c) {
- str = 'isHos';
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
+ //return;
+
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
+ if (ass.prod.Id == cdc1.Consumable_Product__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ }
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords2');
+ makepagerecords();
+ consumablearriveproductdetailsSelected = [
+ SELECT
+ Id,
+ Name,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Dealer_Arrive__c,
+ Delivery_List_RMB__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE
+ Consumable_order_minor__c = :coc.Arrive_Order__c
+ AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Arrive__c = TRUE
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
+ if (
+ consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
+ HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
+ ) {
+ coc.OutPattern__c = true;
+ }
+ consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+ }
+ }
} else {
- str = 'notHos';
- }
- //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
- if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
- //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
- if (
- MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)
- ) {
- ConsumableorderdetailsInfo Jstage = MidMap2.get(
- CountDel[i].Consumable_Product__c + str
- );
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ // 鏇存柊銆�
+ SummonsFlag = 'visible';
+ // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
+ consumableInvoiceRecords = [
+ SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
+ FROM Consumable_order__c
+ WHERE
+ Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
+ AND Invoice_status__c != '鑽夋涓�'
+ ];
+
+ System.debug('coc ESetId = ' + ESetId);
+ System.debug('coc userWorkLocation = ' + userWorkLocation);
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Summons_Order_type__c,
+ NoConfirmedPrice__c,
+ SummonsStatus_c__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForDealerTextID__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Order_date__c,
+ Arrive_Order__c,
+ Order_status__c,
+ Shipment_total_amount__c,
+ Offers_Price__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ Order_ForCustomerText__c,
+ ConInvoice_Code__c,
+ Onchange_order__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '浼犵エ'
+ ];
+ // update start by vivek 2019-7-15
+ if (getExistarrive()) {
+ arriveorder = coc.Arrive_Order__c;
}
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
+ // 鍒拌揣璁㈠崟鏉ョ殑鏃跺��
+ if (getExistarrive()) {
+ if (editAble) {
+ alertMessage = '鍒拌揣璁㈠崟鐩存帴鍑哄簱锛屽嚭搴撳崟鏄庣粏涓嶅彲缂栬緫';
+ }
+ if (coc.SummonsStatus_c__c == '宸叉彁浜�' || coc.SummonsStatus_c__c == '鎵瑰噯') {
+ system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
+ saveBtnDisabled = true;
+ SorderBtnDisabled = true;
+ EditDelCommitBtnDisabled = false;
+ }
+ //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
+ Integer io = 0;
+ while (io < Dealerelationship.size()) {
+ if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
+ SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
+ coc.Order_ForDealer__c = null;
+ io = io + Dealerelationship.size();
+ }
+ io++;
+ }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- } else {
- //midmap2涓病鏈夊搴旂殑浜у搧
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- CountDel[i].Consumable_Product__c
- )
- .clone();
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
+ Integer ik = 0;
+ while (ik < AgencyHospitalLink.size()) {
+ if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
+ HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
+ HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
+ coc.Order_ForHospital__c = null;
+ ik = ik + AgencyHospitalLink.size();
+ }
+ ik++;
+ }
+ //鍑哄簱鍗曟槑缁�1鍙栧緱
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Shipment_amount__c,
+ //Unitprice_To_agency__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ InvoiceProNot_count__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- }
- }
- }
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ sumPrice += cdc1.Shipment_amount__c;
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ //add by rentx 2021-2-26
+ String tempId = cdc1.Consumable_product__c;
+ if (cdc1.isOutPattern__c) {
+ cocMap.put(tempId + 'ishos', cdc1);
+ } else {
+ cocMap.put(tempId + 'nothos', cdc1);
+ }
+ //add by rentx 2021-2-26
+ }
+ String msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- //update by rentx 2021-01-29
- // for(ConsumableorderdetailsInfo bss : MidMap.values()){
- for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
- //update by rentx 2021-01-29
- bss.packinglist = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsSelectRecords.add(bss);
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
- //return;
-
- Integer ishosnum = 0;
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords
- ) {
- //ass.sortBy = sortOrderAsc;
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
- if (ass.prod.Id == cdc1.Consumable_Product__c) {
- ass.check = true;
- ass.orderdetails1 = cdc1;
- }
- }
- if (ass.hospitalSpecialOffer == true) {
- ishosnum = ishosnum + 1;
- }
- }
- if (ishosnum > 0) {
- hasHosPro = true;
- } else {
- hasHosPro = false;
- }
-
- consumableorderdetailsSelectRecords.sort();
- //add by rentx
- noOfRecords = consumableorderdetailsSelectRecords.size();
- //add by rentx
- System.debug('makepagerecords2');
- makepagerecords();
- consumablearriveproductdetailsSelected = [
- SELECT
- Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Dealer_Arrive__c,
- Delivery_List_RMB__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- //add by rentx start
- hospitalSpecialOffer__c
- //add by rentx end
- FROM Consumable_order_details2__c
- WHERE
- Consumable_order_minor__c = :coc.Arrive_Order__c
- AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
- AND Dealer_Arrive__c = TRUE
- ORDER BY Name
- ];
- for (
- Integer i = 0;
- i < consumablearriveproductdetailsSelected.size();
- i++
- ) {
- if (
- consumablearriveproductdetailsSelected[i]
- .hospitalSpecialOffer__c &&
- HosProMap.containsKey(
- consumablearriveproductdetailsSelected[i].Consumable_product__c
- )
- ) {
- coc.OutPattern__c = true;
- }
- consumableproductdetailsRecords.add(
- new ConsumableorderdetailsInfo(
- consumablearriveproductdetailsSelected[i]
- )
- );
- }
- }
- } else {
- // 鏇存柊銆�
- SummonsFlag = 'visible';
- // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
- consumableInvoiceRecords = [
- SELECT
- Id,
- Name,
- Invoice_Date__c,
- NoConfirmedPrice__c,
- Invoice_total_amount__c,
- Invoice_status__c
- FROM Consumable_order__c
- WHERE
- Id IN (
- SELECT Invoice_Code_link__c
- FROM Consumable_order_LinkTable__c
- WHERE Outboundorder_Code_link__c = :ESetId
- )
- AND Invoice_status__c != '鑽夋涓�'
- ];
-
- System.debug('coc ESetId = ' + ESetId);
- System.debug('coc userWorkLocation = ' + userWorkLocation);
- coc = [
- SELECT
- Id,
- Name,
- Summons_Order_type__c,
- NoConfirmedPrice__c,
- SummonsStatus_c__c,
- Order_ForDealerText__c,
- Dealer_Info__c,
- Order_ForDealer__c,
- Order_ForDealer__r.Name,
- Order_ForDealerTextID__c,
- Order_ForHospital__c,
- SummonsForDirction__c,
- Order_date__c,
- Arrive_Order__c,
- Order_status__c,
- Shipment_total_amount__c,
- Offers_Price__c,
- Billed_Status__c,
- ShipmentAccount__c,
- Order_Dealer_Info__c,
- Order_ForCustomerText__c,
- ConInvoice_Code__c,
- Onchange_order__c,
- OutPattern__c
- FROM Consumable_order__c
- WHERE
- Id = :ESetId
- AND Order_Owner_WorkLocal__c = :userWorkLocation
- AND Order_type__c = '浼犵エ'
- ];
- // update start by vivek 2019-7-15
- if (getExistarrive()) {
- arriveorder = coc.Arrive_Order__c;
- }
- // 鍒拌揣璁㈠崟鏉ョ殑鏃跺��
- if (getExistarrive()) {
- if (editAble) {
- alertMessage = '鍒拌揣璁㈠崟鐩存帴鍑哄簱锛屽嚭搴撳崟鏄庣粏涓嶅彲缂栬緫';
- }
- if (
- coc.SummonsStatus_c__c == '宸叉彁浜�' ||
- coc.SummonsStatus_c__c == '鎵瑰噯'
- ) {
- system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
- saveBtnDisabled = true;
- SorderBtnDisabled = true;
- EditDelCommitBtnDisabled = false;
- }
- //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
- Integer io = 0;
- while (io < Dealerelationship.size()) {
- if (
- coc.Order_ForDealer__c ==
- Dealerelationship[io].Dealer_subordinate__c
- ) {
- SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
- coc.Order_ForDealer__c = null;
- io = io + Dealerelationship.size();
- }
- io++;
- }
-
- Integer ik = 0;
- while (ik < AgencyHospitalLink.size()) {
- if (
- coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c
- ) {
- HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
- HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
- coc.Order_ForHospital__c = null;
- ik = ik + AgencyHospitalLink.size();
- }
- ik++;
- }
- //鍑哄簱鍗曟槑缁�1鍙栧緱
- consumableorderdetailsSelected = [
- SELECT
- Id,
- Dealer_Custom_Price__c,
- Delivery_List_RMB__c,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.SFDA_Status__c,
- Name,
- Consumable_order__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Shipment_Count__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Shipment_amount__c,
- //Unitprice_To_agency__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Invoiced_Procount__c,
- RrturnPro_count__c,
- InvoiceProNot_count__c,
- Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
- Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
- isOutPattern__c
- FROM Consumable_orderdetails__c
- WHERE
- Consumable_order__c = :ESetId
- AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
- ORDER BY Name
- ];
- Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
-
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- sumPrice += cdc1.Shipment_amount__c;
- orderzaikuId.add(cdc1.Consumable_Product__c);
- //add by rentx 2021-2-26
- String tempId = cdc1.Consumable_product__c;
- if (cdc1.isOutPattern__c) {
- cocMap.put(tempId + 'ishos', cdc1);
- } else {
- cocMap.put(tempId + 'nothos', cdc1);
- }
- //add by rentx 2021-2-26
- }
- String msoql = makeSoqlorderdet();
- product2Selected = Database.query(msoql);
- size = product2Selected.size();
- initStandardController(msoql);
-
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
- //update by rentx 2021-01-29
- /*for(Integer i = 0 ; i< CountDel.size();i++){
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //update by rentx 2021-01-29
+ /*for(Integer i = 0 ; i< CountDel.size();i++){
//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
@@ -996,2475 +882,2147 @@
}
}*/
- for (Integer i = 0; i < CountDel.size(); i++) {
- String str = '';
- if (CountDel[i].hospitalSpecialOffer__c) {
- str = 'isHos';
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+ //update by rentx 2021-01-29
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+
+ //if(bss.allnumber > 0){
+ //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+
+ //update by rentx 2021-2-26 start
+ if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
+ consumableorderdetailsSelectRecords.add(bss);
+ } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ //update by rentx 2021-2-26 end
+ // consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ //update by rentx 2012-3-1 start
+ // if(ass.prod.Id == cdc1.Consumable_Product__c){
+ // ass.check = true;
+ // ass.orderdetails1 = cdc1;
+ // }
+ if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ //update by rentx 2012-3-1 end
+ }
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords3');
+ makepagerecords();
+ //listCut();
+ // 娑堣�楀搧鏄庣粏2銈掑彇寰�
+ consumableorderdetails2RecordsList = [
+ SELECT
+ Id,
+ Name,
+ SerialLotNo__c,
+ Consumable_Product__r.Name__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Return_date__c,
+ Invoice_Date__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
+ consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
+ }
+ //浜у搧鏄庣粏鍙栧緱
+ consumablearriveproductdetailsSelected = [
+ SELECT
+ Id,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Name,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
+ consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+ }
+ } else {
+ // 涓嶆槸鍒拌揣璁㈠崟鏉ョ殑鏃跺��
+ if (coc.SummonsStatus_c__c == '宸叉彁浜�' || coc.SummonsStatus_c__c == '鎵瑰噯') {
+ system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
+ saveBtnDisabled = true;
+ SorderBtnDisabled = true;
+ EditDelCommitBtnDisabled = false;
+ }
+ //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
+ Integer io = 0;
+ while (io < Dealerelationship.size()) {
+ if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
+ SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
+ coc.Order_ForDealer__c = null;
+ io = io + Dealerelationship.size();
+ }
+ io++;
+ }
+ Integer ik = 0;
+ while (ik < AgencyHospitalLink.size()) {
+ if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
+ HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
+ HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
+ coc.Order_ForHospital__c = null;
+ ik = ik + AgencyHospitalLink.size();
+ }
+ ik++;
+ }
+ // 娑堣�楀搧鏄庣粏1銈掑彇寰�
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_amount__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ //Unitprice_To_agency__c,
+ InvoiceProNot_count__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ //add by rentx 202-2-26
+ Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
+
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ sumPrice += cdc1.Shipment_amount__c;
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ //add by rentx 2021-2-26
+ String tempId = cdc1.Consumable_product__c;
+ if (cdc1.isOutPattern__c) {
+ cocMap.put(tempId + 'ishos', cdc1);
+ } else {
+ cocMap.put(tempId + 'nothos', cdc1);
+ }
+ //add by rentx 2021-2-26
+ }
+
+ String msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+
+ //if(bss.allnumber>0){
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+
+ //update by rentx 2021-2-26 start
+ if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
+ consumableorderdetailsSelectRecords.add(bss);
+ } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ // consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
+ // return null;
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ //update by rentx 2012-3-1 start
+ // if(ass.prod.Id == cdc1.Consumable_Product__c){
+ // ass.check = true;
+ // ass.orderdetails1 = cdc1;
+ // }
+ if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ //update by rentx 2012-3-1 end
+ }
+
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords4');
+ makepagerecords();
+
+ // 娑堣�楀搧鏄庣粏2銈掑彇寰�
+ consumableorderdetails2RecordsList = [
+ SELECT
+ Id,
+ Name,
+ SerialLotNo__c,
+ Consumable_Product__r.Name__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Return_date__c,
+ Invoice_Date__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
+ consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
+ }
+ }
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
+ if (SecondDealer == null || SecondDealer == '') {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
} else {
- str = 'notHos';
- }
- //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
- if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
- //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
- if (
- MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)
- ) {
- ConsumableorderdetailsInfo Jstage = MidMap2.get(
- CountDel[i].Consumable_Product__c + str
- );
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
}
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
}
+ }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
+ Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
+ cansee = dfr.isAccessible();
+ Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
+ dealerPricesee = dealerPrice.isAccessible();
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ // makeMessage();
+ //闄勪欢
+ attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
+ if (attachmentinfo.size() > 0) {
+ for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
}
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- } else {
- //midmap2涓病鏈夊搴旂殑浜у搧
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- CountDel[i].Consumable_Product__c
- )
- .clone();
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- }
}
- }
- //update by rentx 2021-01-29
- consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- //update by rentx 2021-01-29
- // for(ConsumableorderdetailsInfo bss : MidMap.values()){
- for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
- //update by rentx 2021-01-29
+ AggregateResult[] categoryList = [
+ SELECT Count(id), Category3_text__c c3c
+ FROM Product2__c
+ WHERE Category3_text__c != NULL
+ GROUP BY Category3_text__c
+ ];
- //if(bss.allnumber > 0){
- //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
- bss.packinglist = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
-
- //update by rentx 2021-2-26 start
- if (
- cocMap.containsKey(bss.Prod.Id + 'ishos') &&
- bss.hospitalSpecialOffer == true
- ) {
- consumableorderdetailsSelectRecords.add(bss);
- } else if (
- cocMap.containsKey(bss.Prod.Id + 'nothos') &&
- bss.hospitalSpecialOffer == false
- ) {
- consumableorderdetailsSelectRecords.add(bss);
- }
- //update by rentx 2021-2-26 end
- // consumableorderdetailsSelectRecords.add(bss);
- //}
- }
- Integer ishosnum = 0;
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords
- ) {
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- //update by rentx 2012-3-1 start
- // if(ass.prod.Id == cdc1.Consumable_Product__c){
- // ass.check = true;
- // ass.orderdetails1 = cdc1;
- // }
- if (
- ass.Prod.Id == cdc1.Consumable_Product__c &&
- ass.hospitalSpecialOffer == cdc1.isOutPattern__c
- ) {
- ass.check = true;
- ass.orderdetails1 = cdc1;
- }
- //update by rentx 2012-3-1 end
- }
- if (ass.hospitalSpecialOffer == true) {
- ishosnum = ishosnum + 1;
- }
- }
- if (ishosnum > 0) {
- hasHosPro = true;
- } else {
- hasHosPro = false;
- }
-
- //add by rentx
- noOfRecords = consumableorderdetailsSelectRecords.size();
- //add by rentx
- System.debug('makepagerecords3');
- makepagerecords();
- //listCut();
- // 娑堣�楀搧鏄庣粏2銈掑彇寰�
- consumableorderdetails2RecordsList = [
- SELECT
- Id,
- Name,
- SerialLotNo__c,
- Consumable_Product__r.Name__c,
- TracingCode__c,
- Sterilization_limit__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Return_date__c,
- Invoice_Date__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- //add by rentx start
- hospitalSpecialOffer__c
- //add by rentx end
- FROM Consumable_order_details2__c
- WHERE Consumable_ZS_order__c = :ESetId
- ORDER BY Name
- ];
- for (
- Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++
- ) {
- consumableorderdetails2Records.add(
- new ConsumableorderdetailsInfo(
- consumableorderdetails2RecordsList[i]
- )
- );
- }
- //浜у搧鏄庣粏鍙栧緱
- consumablearriveproductdetailsSelected = [
- SELECT
- Id,
- Delivery_List_RMB__c,
- Consumable_Product__r.Name__c,
- Name,
- Consumable_Product__r.SFDA_Status__c,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Sterilization_limit__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- //add by rentx start
- hospitalSpecialOffer__c
- //add by rentx end
- FROM Consumable_order_details2__c
- WHERE Consumable_ZS_order__c = :ESetId
- ORDER BY Name
- ];
- for (
- Integer i = 0;
- i < consumablearriveproductdetailsSelected.size();
- i++
- ) {
- consumableproductdetailsRecords.add(
- new ConsumableorderdetailsInfo(
- consumablearriveproductdetailsSelected[i]
- )
- );
- }
- } else {
- // 涓嶆槸鍒拌揣璁㈠崟鏉ョ殑鏃跺��
- if (
- coc.SummonsStatus_c__c == '宸叉彁浜�' ||
- coc.SummonsStatus_c__c == '鎵瑰噯'
- ) {
- system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
- saveBtnDisabled = true;
- SorderBtnDisabled = true;
- EditDelCommitBtnDisabled = false;
- }
- //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
- Integer io = 0;
- while (io < Dealerelationship.size()) {
- if (
- coc.Order_ForDealer__c ==
- Dealerelationship[io].Dealer_subordinate__c
- ) {
- SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
- coc.Order_ForDealer__c = null;
- io = io + Dealerelationship.size();
- }
- io++;
- }
- Integer ik = 0;
- while (ik < AgencyHospitalLink.size()) {
- if (
- coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c
- ) {
- HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
- HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
- coc.Order_ForHospital__c = null;
- ik = ik + AgencyHospitalLink.size();
- }
- ik++;
- }
- // 娑堣�楀搧鏄庣粏1銈掑彇寰�
- consumableorderdetailsSelected = [
- SELECT
- Id,
- Dealer_Custom_Price__c,
- Delivery_List_RMB__c,
- Consumable_Product__r.Name__c,
- Consumable_Product__r.SFDA_Status__c,
- Name,
- Consumable_order__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Shipment_Count__c,
- Consumable_Product__r.Intra_Trade_List_RMB__c,
- Consumable_Product__r.Asset_Model_No__c,
- Shipment_amount__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- Invoiced_Procount__c,
- RrturnPro_count__c,
- //Unitprice_To_agency__c,
- InvoiceProNot_count__c,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
- Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
- isOutPattern__c
- FROM Consumable_orderdetails__c
- WHERE
- Consumable_order__c = :ESetId
- AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
- ORDER BY Name
- ];
- //add by rentx 202-2-26
- Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
-
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- sumPrice += cdc1.Shipment_amount__c;
- orderzaikuId.add(cdc1.Consumable_Product__c);
- //add by rentx 2021-2-26
- String tempId = cdc1.Consumable_product__c;
- if (cdc1.isOutPattern__c) {
- cocMap.put(tempId + 'ishos', cdc1);
- } else {
- cocMap.put(tempId + 'nothos', cdc1);
- }
- //add by rentx 2021-2-26
- }
-
- String msoql = makeSoqlorderdet();
- product2Selected = Database.query(msoql);
- size = product2Selected.size();
- initStandardController(msoql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
-
- for (Integer i = 0; i < CountDel.size(); i++) {
- String str = '';
- if (CountDel[i].hospitalSpecialOffer__c) {
- str = 'isHos';
- } else {
- str = 'notHos';
- }
- //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
- if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
- //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
- if (
- MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)
- ) {
- ConsumableorderdetailsInfo Jstage = MidMap2.get(
- CountDel[i].Consumable_Product__c + str
- );
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- } else {
- //midmap2涓病鏈夊搴旂殑浜у搧
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- CountDel[i].Consumable_Product__c
- )
- .clone();
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
-
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- }
- }
- }
-
- //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- //update by rentx 2021-01-29
- // for(ConsumableorderdetailsInfo bss : MidMap.values()){
- for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
- //update by rentx 2021-01-29
-
- //if(bss.allnumber>0){
- bss.packinglist = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
-
- //update by rentx 2021-2-26 start
- if (
- cocMap.containsKey(bss.Prod.Id + 'ishos') &&
- bss.hospitalSpecialOffer == true
- ) {
- consumableorderdetailsSelectRecords.add(bss);
- } else if (
- cocMap.containsKey(bss.Prod.Id + 'nothos') &&
- bss.hospitalSpecialOffer == false
- ) {
- consumableorderdetailsSelectRecords.add(bss);
- }
- // consumableorderdetailsSelectRecords.add(bss);
- //}
- }
- // return null;
- Integer ishosnum = 0;
- for (
- ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords
- ) {
- //ass.sortBy = sortOrderAsc;
- for (
- Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected
- ) {
- //update by rentx 2012-3-1 start
- // if(ass.prod.Id == cdc1.Consumable_Product__c){
- // ass.check = true;
- // ass.orderdetails1 = cdc1;
- // }
- if (
- ass.Prod.Id == cdc1.Consumable_Product__c &&
- ass.hospitalSpecialOffer == cdc1.isOutPattern__c
- ) {
- ass.check = true;
- ass.orderdetails1 = cdc1;
- }
- //update by rentx 2012-3-1 end
+ categoryOptionList = new List<SelectOption>();
+ categoryOptionList.add(new SelectOption('', '-鏃�-'));
+ categoryOptionMap = new Map<String, String>();
+ categoryOptionMap.put('', '-鏃�-');
+ for (AggregateResult category3Search : categoryList) {
+ String deliverycnt = String.valueOf(category3Search.get('c3c'));
+ categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+ categoryOptionMap.put(deliverycnt, deliverycnt);
}
- if (ass.hospitalSpecialOffer == true) {
- ishosnum = ishosnum + 1;
- }
- }
-
- if (ishosnum > 0) {
- hasHosPro = true;
- } else {
- hasHosPro = false;
- }
-
- consumableorderdetailsSelectRecords.sort();
- //add by rentx
- noOfRecords = consumableorderdetailsSelectRecords.size();
- //add by rentx
- System.debug('makepagerecords4');
- makepagerecords();
-
- // 娑堣�楀搧鏄庣粏2銈掑彇寰�
- consumableorderdetails2RecordsList = [
- SELECT
- Id,
- Name,
- SerialLotNo__c,
- Consumable_Product__r.Name__c,
- TracingCode__c,
- Sterilization_limit__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Category3__c,
- Consumable_Product__r.Category4__c,
- Consumable_Product__r.Category5__c,
- Return_date__c,
- Invoice_Date__c,
- Box_Piece__c,
- ProductPacking_list_manual__c,
- //add by rentx start
- hospitalSpecialOffer__c
- //add by rentx end
-
- FROM Consumable_order_details2__c
- WHERE Consumable_ZS_order__c = :ESetId
- ORDER BY Name
- ];
- for (
- Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++
- ) {
- consumableorderdetails2Records.add(
- new ConsumableorderdetailsInfo(
- consumableorderdetails2RecordsList[i]
- )
- );
- }
- }
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
- if (SecondDealer == null || SecondDealer == '') {
- provinceOpts.add(new SelectOption('', '-鏃�-'));
- provinceOptsMap.put('', '-鏃�-');
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- );
- }
- } else {
- provinceOpts.add(new SelectOption('', '-鏃�-'));
- provinceOptsMap.put('', '-鏃�-');
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- );
- }
- }
- for (Integer i = 0; i < Dealerelationship.size(); i++) {
- if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
- provinceOpts.add(
- new SelectOption(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- )
- );
- provinceOptsMap.put(
- Dealerelationship[i].Dealer_subordinate__c,
- Dealerelationship[i].Dealer_subordinate__r.Name
- );
- }
- }
- }
-
- Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
- cansee = dfr.isAccessible();
- Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
- dealerPricesee = dealerPrice.isAccessible();
- // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
- // makeMessage();
- //闄勪欢
- attachmentinfo = [
- SELECT Id, Name, OwnerId
- FROM Attachment
- WHERE parentid = :ESetId
- ];
- if (attachmentinfo.size() > 0) {
- for (Integer i = 0; i < attachmentinfo.size(); i++) {
- attachmentRecoeds.add(
- new ConsumableorderdetailsInfo(attachmentinfo[i])
- );
- }
- }
- AggregateResult[] categoryList = [
- SELECT Count(id), Category3_text__c c3c
- FROM Product2__c
- WHERE Category3_text__c != NULL
- GROUP BY Category3_text__c
- ];
-
- categoryOptionList = new List<SelectOption>();
- categoryOptionList.add(new SelectOption('', '-鏃�-'));
- categoryOptionMap = new Map<String, String>();
- categoryOptionMap.put('', '-鏃�-');
- for (AggregateResult category3Search : categoryList) {
- String deliverycnt = String.valueOf(category3Search.get('c3c'));
- categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
- categoryOptionMap.put(deliverycnt, deliverycnt);
- }
-
- category4OptionList = new List<SelectOption>();
- category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4OptionMap = new Map<String, String>();
- category4OptionMap.put('', '-鏃�-');
- /*for(AggregateResult category4Search : category4List) {
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ /*for(AggregateResult category4Search : category4List) {
String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
}*/
- category5OptionList = new List<SelectOption>();
- category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5OptionMap = new Map<String, String>();
- category5OptionMap.put('', '-鏃�-');
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
- //鍒嗛〉
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- totalCount = pageRecords.size();
- System.debug('pageToken = ' + pageToken);
- System.debug('pageSize = ' + pageSize);
- System.debug('totalCount = ' + totalCount);
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- System.debug(
- 'paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken
- );
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = pageRecords.size();
+ System.debug('pageToken = ' + pageToken);
+ System.debug('pageSize = ' + pageSize);
+ System.debug('totalCount = ' + totalCount);
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
- Integer startIdx;
- Integer endIdx;
- startIdx = pageToken;
- endIdx = pageToken + pageSize;
- List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
- if (endIdx > pageRecords.size()) {
- endIdx = pageRecords.size();
- }
- for (Integer i = startIdx; i < endIdx; i++) {
- pageRecordsTemp.add(pageRecords.get(i));
- }
-
- Boolean Existarrive = (coc.Arrive_Order__c != null);
- String ConsumableOut_report = System.Label.ConsumableOut_report;
- System.debug(
- 'consumableproductdetailsRecords = ' + consumableproductdetailsRecords
- );
-
- data.put('paginatedAccounts', paginatedAccounts);
- data.put('ConsumableOut_report', ConsumableOut_report);
- data.put('accountid', accountid);
- data.put(
- 'consumableproductdetailsRecords',
- consumableproductdetailsRecords
- );
- data.put('agencyProType', agencyProType);
- data.put('accountName', accountName);
- data.put('userWorkLocation', userWorkLocation);
- data.put('categoryOptionMap', categoryOptionMap);
- data.put('category4OptionMap', category4OptionMap);
- data.put('category5OptionMap', category5OptionMap);
- data.put('outOutPatternOptionMap', outOutPatternOptionMap);
- data.put('hasHosPro', hasHosPro);
- data.put('Existarrive', Existarrive);
- data.put('sumPrice', sumPrice);
- data.put('HospitalName', HospitalName);
- data.put('provinceOptsMap', provinceOptsMap);
- data.put('SummonsFlag', SummonsFlag);
- data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
- data.put('EditAble', EditAble);
- data.put('coc', coc);
- data.put('pageRecords', pageRecordsTemp);
- data.put('arriveorder', arriveorder);
- data.put('consumableorderdetails2Count', consumableorderdetails2Count);
- data.put(
- 'consumableorderdetails2Records',
- consumableorderdetails2Records
- );
- data.put('HospitalInfo', HospitalInfo);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
- }
- }
-
- @AuraEnabled
- public static ResponseBodyLWC categoryAllload(String category3Lwc) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- category3 = category3Lwc;
- AggregateResult[] category4List = [
- SELECT Count(id), Category4_text__c c4c
- FROM Product2__c
- WHERE
- Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category4_text__c
- ];
- category4OptionList = new List<SelectOption>();
- category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4OptionMap = new Map<String, String>();
- category4OptionMap.put('', '-鏃�-');
- for (AggregateResult category4Search : category4List) {
- String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
- category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
- category4OptionMap.put(deliverycnt4, deliverycnt4);
- }
-
- AggregateResult[] category5List = [
- SELECT Count(id), Category5_text__c c5c
- FROM Product2__c
- WHERE
- Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category5_text__c
- ];
-
- category5OptionList = new List<SelectOption>();
- category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5OptionMap = new Map<String, String>();
- category5OptionMap.put('', '-鏃�-');
- for (AggregateResult category5Search : category5List) {
- String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
- category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
- category5OptionMap.put(deliverycnt5, deliverycnt5);
- }
- data.put('category4OptionMap', category4OptionMap);
- data.put('category5OptionMap', category5OptionMap);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- @AuraEnabled
- public static ResponseBodyLWC categoryload(
- String category3Lwc,
- String category4Lwc
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- category3 = category3Lwc;
- category4 = category4Lwc;
- AggregateResult[] category4List = [
- SELECT Count(id), Category4_text__c c4c
- FROM Product2__c
- WHERE
- Category3_text__c = :category3
- AND Category4_text__c != NULL
- AND Category5_text__c != NULL
- GROUP BY Category4_text__c
- ];
- category4OptionList = new List<SelectOption>();
- category4OptionList.add(new SelectOption('', '-鏃�-'));
- category4OptionMap = new Map<String, String>();
- category4OptionMap.put('', '-鏃�-');
- for (AggregateResult category4Search : category4List) {
- String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
- category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
- category4OptionMap.put(deliverycnt4, deliverycnt4);
- }
-
- AggregateResult[] category5List = [
- SELECT Count(id), Category5_text__c c5c
- FROM Product2__c
- WHERE
- Category3_text__c = :category3
- AND Category4_text__c = :category4
- AND Category5_text__c != NULL
- GROUP BY Category5_text__c
- ];
-
- category5OptionList = new List<SelectOption>();
- category5OptionList.add(new SelectOption('', '-鏃�-'));
- category5OptionMap = new Map<String, String>();
- category5OptionMap.put('', '-鏃�-');
- for (AggregateResult category5Search : category5List) {
- String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
- category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
- category5OptionMap.put(deliverycnt5, deliverycnt5);
- }
- data.put('category4OptionMap', category4OptionMap);
- data.put('category5OptionMap', category5OptionMap);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // 妫�绱�
- @AuraEnabled
- public static ResponseBodyLWC searchConsumableorderdetails(
- String agencyProTypeLwc,
- String accountNameLwc,
- String userWorkLocationLwc,
- String outOutPattern,
- String category1,
- String category3,
- String category4,
- String category5,
- Boolean editAbleLwc,
- List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc,
- List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
- String arriveorderLwc,
- Integer pageSizeLWC,
- Integer pageTokenLWC
- ) {
- consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
- pageRecordsLwc = pageRecordsLwcLwc;
- System.debug('pageRecordsLwc = ' + pageRecordsLwc);
- arriveorder = arriveorderLwc;
- accountName = accountNameLwc;
- userWorkLocation = userWorkLocationLwc;
- agencyProType = agencyProTypeLwc;
- product2Selected = new List<Product2__c>();
- pagesize = pageSizeLWC;
- pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
- addSize = 0;
- addData = new List<ConsumableorderdetailsInfo>();
- System.debug('start addData = ' + addData);
- System.debug('accountName = ' + accountName);
- System.debug('userWorkLocation = ' + userWorkLocation);
- String sqlagencyProType = '%' + agencyProTypeLwc + '%';
- List<AggregateResult> orderdetailCount = [
- SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Cancellation_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Isoverdue__c = 1
- AND Product_Type__c LIKE :sqlagencyProType
- AND Dealer_Info_text__c = :accountNameLwc
- AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc
- GROUP BY Consumable_Product__c, Box_Piece__c
- ];
- for (AggregateResult orderdetail : orderdetailCount) {
- zaikuId.add(String.valueOf(orderdetail.get('cpc')));
- }
- editAble = editAbleLwc;
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- SearchDone = 'SearchDone';
- Map<String, String> selectedIdMap = new Map<String, String>();
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- //update by rentx 2021-01-29
- Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
- String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Dealer_Shipment__c = false AND Dealer_Saled__c = false AND Dealer_Returned__c = false AND Lose_Flag__c = false AND Bar_Code__c != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c = :userWorkLocation AND Dealer_Info_text__c = :accountName ';
- if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) {
- countdelSoql += ' AND hospitalSpecialOffer__c = true';
- } else if (
- String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')
- ) {
- countdelSoql += ' AND hospitalSpecialOffer__c = false';
- }
- System.debug('countdelSoql = ' + countdelSoql);
- List<Consumable_order_details2__c> CountDel = Database.query(countdelSoql);
- System.debug('CountDel = ' + CountDel);
- //update by rentx 2021-01-29
-
- consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
- //consumableorderdetailsSelectRecords = reSet;
- String soql = makeSoql(category1, category3, category4, category5);
- size = Integer.valueOf(System.Label.orderdetLimitsize);
- initStandardController(soql);
- System.debug('soql = ' + soql);
- product2Selected = Database.query(soql);
- for (Integer i = 0; i < product2Selected.size(); i++) {
- MidMap.put(
- product2Selected[i].Id,
- new ConsumableorderdetailsInfo(product2Selected[i])
- );
- }
-
- for (Integer i = 0; i < CountDel.size(); i++) {
- String str = '';
- if (CountDel[i].hospitalSpecialOffer__c) {
- str = 'isHos';
- } else {
- str = 'notHos';
- }
- System.debug('MidMap = ' + MidMap);
- //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
- if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
- //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
- if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
- ConsumableorderdetailsInfo Jstage = MidMap2.get(
- CountDel[i].Consumable_Product__c + str
- );
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- } else {
- //midmap2涓病鏈夊搴旂殑浜у搧
- ConsumableorderdetailsInfo Jstage = MidMap.get(
- CountDel[i].Consumable_Product__c
- )
- .clone();
- Jstage.allnumber = Jstage.allnumber + 1;
- if (CountDel[i].Box_Piece__c == '鐩�') {
- Jstage.Boxnumber = Jstage.Boxnumber + 1;
- } else if (CountDel[i].Box_Piece__c == '涓�') {
- Jstage.Piecenumber = Jstage.Piecenumber + 1;
- }
- if (CountDel[i].hospitalSpecialOffer__c) {
- Jstage.hospitalSpecialOffer = true;
- } else {
- Jstage.hospitalSpecialOffer = false;
- }
- if (HosProMap.containsKey(Jstage.Prod.Id)) {
- Jstage.hosPro = true;
- }
- //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
- MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
- }
- }
- }
- Integer ishosnum = 0;
- System.debug('MidMap2 = ' + MidMap2);
- for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
- if (selectedIdMap.containsKey(bss.Prod.id)) {
- continue;
- } else {
- bss.sortBy = false;
- bss.packinglist = Integer.valueOf(
- bss.Prod.Product2__r.Packing_list_manual__c
- );
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsSelectRecords.add(bss);
-
- if (bss.hospitalSpecialOffer == true) {
- ishosnum = ishosnum + 1;
- }
- }
- }
- if (ishosnum > 0) {
- hasHosPro = true;
- } else {
- hasHosPro = false;
- }
-
- consumableorderdetailsSelectRecords.sort();
- makepagerecordsLwc();
- //鍒嗛〉
- PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
- totalCount = pageRecords.size();
- paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
- ? pageToken + pageSize
- : null;
- paginatedAccounts.recordStart = pageToken + 1;
- paginatedAccounts.pageNumber = pageToken / pageSize + 1;
- Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
- paginatedAccounts.recordEnd = totalCount >= recordEnd
- ? recordEnd
- : totalCount;
- paginatedAccounts.totalRecords = totalCount;
-
- System.debug('addSize = ' + addSize);
- Integer startIdx;
- Integer endIdx;
- startIdx = pageToken;
- endIdx = pageToken + pageSize;
- List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
- if (endIdx > pageRecords.size()) {
- endIdx = pageRecords.size();
- }
-
- System.debug('addData.size() = ' + addData.size());
- for (ConsumableorderdetailsInfo ci : addData) {
- pageRecordsTemp.add(ci);
- }
- System.debug('startIdx = ' + startIdx);
- System.debug('endIdx = ' + endIdx);
- System.debug('skipData = ' + skipData);
- System.debug('pageRecords = ' + pageRecords.size());
- String hos = '';
- for (Integer i = startIdx; i < endIdx; i++) {
- System.debug(
- 'skipData.get(pageRecords.get(i).Prod.Id) = ' +
- skipData.get(pageRecords.get(i).Prod.Id)
- );
- if (pageRecords.get(i).hospitalSpecialOffer == true) {
- hos = 'ishos';
- } else {
- hos = 'nothos';
- }
- if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) {
- pageRecordsTemp.add(pageRecords.get(i));
- }
- }
-
- System.debug('pageRecordsTemp = ' + pageRecordsTemp.size());
- data.put('paginatedAccounts', paginatedAccounts);
- data.put('pageRecords', pageRecordsTemp);
- data.put('SearchDone', SearchDone);
- data.put('hasHosPro', hasHosPro);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- private static String makeSoql(
- String CateName,
- String Category3,
- String Category4,
- String Category5
- ) {
- String sqlTail1 = '(\'';
- for (Integer i = 0; i < zaikuId.size(); i++) {
- if (zaikuId[i] != null) {
- if (i < zaikuId.size() - 1) {
- sqlTail1 += zaikuId[i] + '\',\'';
- } else {
- sqlTail1 += zaikuId[i];
- }
- }
- }
- sqlTail1 += '\')';
- String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
- soql += ' WHERE Id in' + sqlTail1;
- if (!String.isBlank(CateName)) {
- soql +=
- ' AND (Name__c like \'%' +
- String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
- '%\' or Asset_Model_No__c like \'%' +
- String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
- '%\')';
- }
- if (!String.isBlank(Category3)) {
- soql += ' AND Category3__c = \'' + Category3 + '\'';
- }
- if (!String.isBlank(Category4)) {
- soql += ' AND Category4__c = \'' + Category4 + '\'';
- }
- if (!String.isBlank(Category5)) {
- soql += ' AND Category5__c = \'' + Category5 + '\'';
- }
- return soql;
- }
-
- public static String makeSoqlorderdet() {
- String sqlTail = '(\'';
- for (Integer i = 0; i < orderzaikuId.size(); i++) {
- if (i < orderzaikuId.size() - 1) {
- sqlTail += orderzaikuId[i] + '\',\'';
- } else {
- sqlTail += orderzaikuId[i];
- }
- }
- sqlTail += '\')';
- String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
- msoql += ' WHERE Id in' + sqlTail;
- return msoql;
- }
-
- public static String makeSoqlinventory() {
- String sqlTail = '(\'';
- for (Integer i = 0; i < zaikuId.size(); i++) {
- if (zaikuId[i] != null) {
- if (i < zaikuId.size() - 1) {
- sqlTail += zaikuId[i] + '\',\'';
- } else {
- sqlTail += zaikuId[i];
- }
- }
- }
- sqlTail += '\')';
- String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
- msoql += ' WHERE Id in' + sqlTail;
- return msoql;
- }
-
- public static void initStandardController(String soql) {
- // init standard controller
- System.debug('soql =' + soql);
- System.debug('initStandardController star');
- //setCon = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
- // sets the number of records in each page set
- //setCon.setPageSize(size);
- System.debug('initStandardController end');
- }
-
- public static List<ConsumableorderdetailsInfo> makepagerecords() {
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- Map<String, String> selectedIdMap = new Map<String, String>();
- System.debug('zhj1');
- //鍙栧嚭閫夋嫨鐨勪骇鍝�
- if (pageRecords != null) {
- System.debug('zhj2');
- for (ConsumableorderdetailsInfo ass : pageRecords) {
- if (ass.check == true) {
- if (ass.hospitalSpecialOffer == true) {
- selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
- } else {
- selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
- }
- reSet.add(ass);
- }
- }
- }
- System.debug('zhj3');
- pageRecords = new List<ConsumableorderdetailsInfo>();
- System.debug('reSet.size() = ' + reSet.size());
- if (editAble && String.isBlank(arriveorder)) {
- pageRecords = reSet;
- }
- //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
- //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
- Integer addNo = 0;
- //update by rentx 2021-2-26 start
- System.debug(
- 'consumableorderdetailsSelectRecords.size() = ' +
- consumableorderdetailsSelectRecords.size()
- );
- for (
- ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords
- ) {
- Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
- if (
- (info.hospitalSpecialOffer &&
- selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
- (info.hospitalSpecialOffer == false &&
- selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
- ) {
- addNo++;
- } else {
- if (info.check == false) {
- info.orderdetails1 = orderdetails1;
- }
- pageRecords.add(info);
- addNo++;
- }
- }
- System.debug('pageRecords 2 = ' + pageRecords);
- System.debug('zhj5');
- System.debug('pageRecords = ' + pageRecords);
- return pageRecords;
- }
-
- public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() {
- List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>();
- Map<String, String> selectedIdMap = new Map<String, String>();
- skipData = new Map<String, String>();
- System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc);
- //鍙栧嚭閫夋嫨鐨勪骇鍝�
- if (pageRecordsLwc != null) {
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- System.debug('ass.check = ' + ass.check);
- if (ass.check == true) {
- if (ass.hospitalSpecialOffer == true) {
- selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
- skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
- } else {
- selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
- skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
- }
- reSetLwc.add(ass);
- }
- }
- }
- System.debug('selectedIdMap = ' + selectedIdMap);
- pageRecords = new List<ConsumableorderdetailsInfo>();
- if (editAble && String.isBlank(arriveorder)) {
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- System.debug('reSetLwc = ' + reSetLwc);
- for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) {
- ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo();
- ci.check = assLwc.check;
- ci.oldCheck = assLwc.oldCheck;
- ci.orderdetails1 = assLwc.orderdetails1;
- ci.orderdetails2 = assLwc.orderdetails2;
- ci.Prod = assLwc.Prod;
- ci.Boxnumber = assLwc.Boxnumber;
- ci.Piecenumber = assLwc.Piecenumber;
- ci.allnumber = assLwc.allnumber;
- ci.oldConsumableCount = assLwc.oldConsumableCount;
- ci.canSelect = assLwc.canSelect;
- ci.sortBy = assLwc.sortBy;
- ci.packinglist = assLwc.packinglist;
- ci.approbation_No = assLwc.approbation_No;
- ci.expiration_Date = assLwc.expiration_Date;
- ci.boxorpiecein = assLwc.boxorpiecein;
- ci.boxorpiece = assLwc.boxorpiece;
- ci.boxorpieceMap = assLwc.boxorpieceMap;
- ci.concc = assLwc.concc;
- ci.BoxPiece = assLwc.BoxPiece;
- ci.hospitalSpecialOffer = assLwc.hospitalSpecialOffer;
- ci.hosPro = assLwc.hosPro;
- reSet.add(ci);
- }
- pageRecords = reSet;
- System.debug('reSet = ' + reSet);
- addData = reSet.clone();
- System.debug('addData = reSet = ' + addData);
- }
- //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
- //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
- Integer addNo = 0;
- //update by rentx 2021-2-26 start
- System.debug(
- 'consumableorderdetailsSelectRecords.size() = ' +
- consumableorderdetailsSelectRecords.size()
- );
- for (
- ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords
- ) {
- Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
- if (
- (info.hospitalSpecialOffer &&
- selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
- (info.hospitalSpecialOffer == false &&
- selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
- ) {
- System.debug('鍘绘帀鐨刬d : ' + info.Prod.Id);
- addNo++;
- addSize++;
- } else {
- if (info.check == false) {
- info.orderdetails1 = orderdetails1;
- }
- pageRecords.add(info);
- addNo++;
- }
- }
- System.debug('pageRecords.size() = ' + pageRecords.size());
- System.debug('end addData = ' + addData);
- return pageRecords;
- }
-
- // 淇濆瓨鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC save(
- Consumable_order__c cocLwc,
- String hospitalInfoLwc,
- String hospitalNameLwc,
- String secondaryDistributorLwc,
- List<ConsumableorderdetailsInfoLwc> pageRecordsLwc,
- String accountidLwc,
- String ESetIdLwc,
- List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
- String agencyProTypeLwc,
- String userWorkLocationLwc
- ) {
- coc = cocLwc;
- HospitalInfo = hospitalInfoLwc;
- HospitalName = hospitalNameLwc;
- SecondDealer = secondaryDistributorLwc;
- pageRecordsLwc = pageRecordsLwc;
- accountid = accountidLwc;
- consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
- ESetId = ESetIdLwc;
- agencyProType = agencyProTypeLwc;
- userWorkLocation = userWorkLocationLwc;
-
- System.debug('coc = ' + coc);
- System.debug('HospitalInfo = ' + HospitalInfo);
- System.debug('HospitalName = ' + HospitalName);
- System.debug('SecondDealer = ' + SecondDealer);
- System.debug('pageRecordsLwc = ' + pageRecordsLwc);
- System.debug('accountid = ' + accountid);
- System.debug(
- 'consumableproductdetailsRecords = ' + consumableproductdetailsRecords
- );
- System.debug('ESetId = ' + ESetId);
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- //璁㈠崟淇℃伅纭
- if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) {
- // coc.SummonsForDirction__c.addError('璇疯緭鍏ユ寚绀哄崟鐩殑');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ寚绀哄崟鐩殑', '');
- } else if (coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
- if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
- // coc.addError('璇疯緭鍏ュ尰闄�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
- }
- if (String.isBlank(coc.Order_ForCustomerText__c)) {
- // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
- } else if (
- String.isNotBlank(SecondDealer) ||
- String.isNotBlank(coc.Order_ForDealerText__c)
- ) {
- // coc.addError('涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅' );
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅',
- ''
- );
- }
- } else if (coc.SummonsForDirction__c == '鍖婚櫌璇曠敤') {
- if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
- // coc.addError('璇疯緭鍏ュ尰闄�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
- }
- if (String.isBlank(coc.Order_ForCustomerText__c)) {
- // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
- }
- } else if (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
- if (
- String.isBlank(SecondDealer) &&
- String.isBlank(coc.Order_ForDealerText__c)
- ) {
- // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)',
- ''
- );
- }
- if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
- // coc.addError('璇疯緭鍏ュ尰闄�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
- }
- if (String.isBlank(coc.Order_ForCustomerText__c)) {
- // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
- }
- } else if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
- if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) {
- // coc.addError('涓嶉渶瑕佽緭鍏ュ尰闄�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ュ尰闄�', '');
- }
- if (String.isNotBlank(coc.Order_ForCustomerText__c)) {
- // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
- }
- if (
- String.isBlank(SecondDealer) &&
- String.isBlank(coc.Order_ForDealerText__c)
- ) {
- // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)',
- ''
- );
- }
- }
-
- Integer isHos = 0;
-
- Integer FLG = 0;
- Integer Count = 0;
- for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
- FLG = FLG + 1;
- if (CheckCount.check == false) {
- Count = Count + 1;
- } else {
- //add by rentx
- if (CheckCount.hospitalSpecialOffer) {
- isHos = isHos + 1;
- }
- //add by rentx
- }
- }
- if (Count == FLG) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇烽�夋嫨鎵�闇�娑堣�楀搧'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨鎵�闇�娑堣�楀搧', '');
- }
- // gzw 娉ㄩ噴 鍒ゆ柇鎻愬墠 20210308
- //checkOutPattern();
- //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
- Integer isHosCheckOutPattern = 0;
- for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
- if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
- isHosCheckOutPattern = isHosCheckOutPattern + 1;
- }
- }
- if (isHosCheckOutPattern > 0) {
- coc.OutPattern__c = true;
- } else {
- coc.OutPattern__c = false;
- }
-
- // add by rentx 2021-3-10 start
- //鐗逛环鍖婚櫌鍑哄簱闈炴湰鍖婚櫌缁存姢鐨勭壒浠峰晢鍝佹椂,鎶ラ敊 闈炵壒浠峰尰闄㈠嚭搴撶淮鎶ゅ湪鍖婚櫌鐗逛环鍏崇郴琛ㄧ殑浜у搧鏃� 鎶ラ敊
- if (coc.SummonsForDirction__c != '浜掔浉璋冭揣') {
- //闈炵壒浠峰尰闄㈠嚭搴撶壒浠蜂骇鍝佹椂 鎶ラ敊(褰撳墠缁忛攢鍟嗕笅娌℃湁鐗逛环鍖婚櫌闄ゅ)
- List<hospitalprice__c> hopList = [
- SELECT id, hospital__c, product__c
- FROM hospitalprice__c
- WHERE account__c = :accountid
- ];
- //缁忛攢鍟嗗搴斿尰闄笅鐨勬墍鏈夌壒浠蜂骇鍝�
- Map<String, String> proMap = new Map<String, String>();
- //缁忛攢鍟嗕笅鐨勬墍鏈夌壒浠蜂骇鍝�
- Map<String, String> allProMap = new Map<String, String>();
-
- if (hopList != null && hopList.size() > 0) {
- Boolean flag = false;
- if (HospitalInfo != null && HospitalInfo != '') {
- for (hospitalprice__c hp : hopList) {
- allProMap.put(hp.product__c, '');
- //濡傛灉褰撳墠 鍖婚櫌鐗逛环鍏崇郴涓殑鍖婚櫌瀵瑰簲鍑哄簱鍗曚笂鍑哄簱鐨勫尰闄�,鍒欐斁浜у搧id鍒癿ap
- if (hp.hospital__c == HospitalInfo) {
- flag = true;
- proMap.put(hp.product__c, '');
+ Integer startIdx;
+ Integer endIdx;
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+ if (endIdx > pageRecords.size()) {
+ endIdx = pageRecords.size();
}
- }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageRecordsTemp.add(pageRecords.get(i));
+ }
+
+ Boolean Existarrive = (coc.Arrive_Order__c != null);
+ String ConsumableOut_report = System.Label.ConsumableOut_report;
+ System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('ConsumableOut_report', ConsumableOut_report);
+ data.put('accountid', accountid);
+ data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
+ data.put('agencyProType', agencyProType);
+ data.put('accountName', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('categoryOptionMap', categoryOptionMap);
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ data.put('outOutPatternOptionMap', outOutPatternOptionMap);
+ data.put('hasHosPro', hasHosPro);
+ data.put('Existarrive', Existarrive);
+ data.put('sumPrice', sumPrice);
+ data.put('HospitalName', HospitalName);
+ data.put('provinceOptsMap', provinceOptsMap);
+ data.put('SummonsFlag', SummonsFlag);
+ data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
+ data.put('EditAble', EditAble);
+ data.put('coc', coc);
+ data.put('pageRecords', pageRecordsTemp);
+ data.put('arriveorder', arriveorder);
+ data.put('consumableorderdetails2Count', consumableorderdetails2Count);
+ data.put('consumableorderdetails2Records', consumableorderdetails2Records);
+ data.put('HospitalInfo', HospitalInfo);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
}
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.check == true) {
- //鍒ゆ柇閫変腑鐨勫尰闄㈢壒浠蜂骇鍝�
- if (ass.hospitalSpecialOffer == true) {
- //鐢ㄦ埛閫変腑浜嗗綋鍓嶅尰闄笅鐨勭壒浠蜂骇鍝�
- if (proMap.containsKey(ass.Prod.Id)) {
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC categoryAllload(String category3Lwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ category3 = category3Lwc;
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ System.debug('category4List ' + category4List);
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4OptionMap.put(deliverycnt4, deliverycnt4);
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ System.debug('category5List ' + category5List);
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5OptionMap.put(deliverycnt5, deliverycnt5);
+ }
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC categoryload(String category3Lwc, String category4Lwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ category3 = category3Lwc;
+ category4 = category4Lwc;
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ System.debug('category4List ' + category4List);
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4OptionMap.put(deliverycnt4, deliverycnt4);
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c = :category4 AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ System.debug('category5List ' + category5List);
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5OptionMap.put(deliverycnt5, deliverycnt5);
+ }
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 妫�绱�
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String agencyProTypeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String outOutPattern,
+ String category1,
+ String category3,
+ String category4,
+ String category5,
+ Boolean editAbleLwc,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc,
+ List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+ String arriveorderLwc,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC
+ ) {
+ consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
+ pageRecordsLwc = pageRecordsLwcLwc;
+ System.debug('pageRecordsLwc = ' + pageRecordsLwc);
+ arriveorder = arriveorderLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ agencyProType = agencyProTypeLwc;
+ product2Selected = new List<Product2__c>();
+ pagesize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+ addSize = 0;
+ addData = new List<ConsumableorderdetailsInfo>();
+ System.debug('start addData = ' + addData);
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ String sqlagencyProType = '%' + agencyProTypeLwc + '%';
+ List<AggregateResult> orderdetailCount = [
+ SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountNameLwc
+ AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc
+ GROUP BY Consumable_Product__c, Box_Piece__c
+ ];
+ System.debug('orderdetailCount = ' + orderdetailCount);
+
+ for (AggregateResult orderdetail : orderdetailCount) {
+ zaikuId.add(String.valueOf(orderdetail.get('cpc')));
+ }
+ editAble = editAbleLwc;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ SearchDone = 'SearchDone';
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //update by rentx 2021-01-29
+ Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
+ String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Dealer_Shipment__c = false AND Dealer_Saled__c = false AND Dealer_Returned__c = false AND Lose_Flag__c = false AND Bar_Code__c != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c = :userWorkLocation AND Dealer_Info_text__c = :accountName ';
+ if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) {
+ countdelSoql += ' AND hospitalSpecialOffer__c = true';
+ } else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) {
+ countdelSoql += ' AND hospitalSpecialOffer__c = false';
+ }
+ System.debug('countdelSoql = ' + countdelSoql);
+ List<Consumable_order_details2__c> CountDel = Database.query(countdelSoql);
+ System.debug('CountDel = ' + CountDel);
+ //update by rentx 2021-01-29
+
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //consumableorderdetailsSelectRecords = reSet;
+ String soql = makeSoql(category1, category3, category4, category5);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController(soql);
+ System.debug('soql = ' + soql);
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ System.debug('MidMap = ' + MidMap);
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+ Integer ishosnum = 0;
+ System.debug('MidMap2 = ' + MidMap2);
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
continue;
- //鐢ㄦ埛閫変腑浜嗘病鏈夌淮鎶ょ壒浠峰尰闄㈢殑鐗逛环浜у搧
- } else if (!allProMap.containsKey(ass.Prod.Id)) {
- continue;
- } else {
- //鐢ㄦ埛閫変腑闈炲綋鍓嶅尰闄㈢淮鎶ょ殑鐗逛环浜у搧
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:'+ ass.Prod.Name__c +' 鐨勭壒浠�'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:' + ass.Prod.Name__c + '鐨勭壒浠�',
- ''
- );
- }
- } //闈炲尰闄㈢壒浠蜂骇鍝佸彲浠ュ嚭搴撶粰浠绘剰鍖婚櫌,鎵�浠ヤ笉闇�瑕佸垽鏂�
- }
+ } else {
+ bss.sortBy = false;
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+
+ if (bss.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
}
- }
- } else {
- //濡傛灉鏄簰鐩歌皟璐�,鍒ゆ柇 缁忛攢鍟�(褰曞叆) 鏄惁缁存姢浜� 褰撳墠閫変腑鐨勭壒浠蜂骇鍝�
- List<hospitalprice__c> hopList = [
- SELECT id, hospital__c, product__c
- FROM hospitalprice__c
- WHERE account__c = :coc.Order_ForDealerTextID__c
- ];
- Map<Id, String> proMap = new Map<Id, String>();
- if (hopList != null && hopList.size() > 0) {
- for (hospitalprice__c hpc : hopList) {
- proMap.put(hpc.product__c, '');
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
}
- String proStr = '';
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.check == true) {
- if (ass.hospitalSpecialOffer == true) {
- if (!proMap.containsKey(ass.Prod.Id)) {
- proStr += ass.Prod.Name__c + ',';
- }
+ consumableorderdetailsSelectRecords.sort();
+ makepagerecordsLwc();
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = pageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ System.debug('addSize = ' + addSize);
+ Integer startIdx;
+ Integer endIdx;
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+ if (endIdx > pageRecords.size()) {
+ endIdx = pageRecords.size();
+ }
+
+ System.debug('addData.size() = ' + addData.size());
+ for (ConsumableorderdetailsInfo ci : addData) {
+ pageRecordsTemp.add(ci);
+ }
+ System.debug('startIdx = ' + startIdx);
+ System.debug('endIdx = ' + endIdx);
+ System.debug('skipData = ' + skipData);
+ System.debug('pageRecords = ' + pageRecords.size());
+ String hos = '';
+ for (Integer i = startIdx; i < endIdx; i++) {
+ System.debug('skipData.get(pageRecords.get(i).Prod.Id) = ' + skipData.get(pageRecords.get(i).Prod.Id));
+ if (pageRecords.get(i).hospitalSpecialOffer == true) {
+ hos = 'ishos';
+ } else {
+ hos = 'nothos';
}
- }
+ if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) {
+ pageRecordsTemp.add(pageRecords.get(i));
+ }
}
- if (proStr != '') {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '缁忛攢鍟�:'+coc.Order_ForDealerText__c +' 娌℃湁娑堣�楀搧:'+proStr.substring(0,proStr.length()-1) + ' 鐨勭壒浠�'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '缁忛攢鍟�:' +
- coc.Order_ForDealerText__c +
- ' 娌℃湁娑堣�楀搧:' +
- proStr.substring(0, proStr.length() - 1) +
- ' 鐨勭壒浠�',
- ''
- );
- }
- }
+
+ System.debug('pageRecordsTemp = ' + pageRecordsTemp.size());
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageRecords', pageRecordsTemp);
+ data.put('SearchDone', SearchDone);
+ data.put('hasHosPro', hasHosPro);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
}
- // checkOutPattern();
- Consumable_order__c p = new Consumable_order__c();
- List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>();
- List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>();
- Savepoint sp = Database.setSavepoint();
- // try {
- //鏂板缓璁㈠崟鏃�
- if (String.isEmpty(ESetId)) {
- p.Name = '*';
- p.Order_type__c = '浼犵エ';
- p.Order_ProType__c = agencyProType;
- if (
- coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c)
- )
- coc.SummonsStatus_c__c = '鑽夋涓�';
- // update strat by vivek 2019-7-12
- p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
- // update end by vivek 2019-7-12
- p.SummonsStatus_c__c = coc.SummonsStatus_c__c;
- if (coc.Arrive_Order__c != null) {
- p.Arrive_Order__c = coc.Arrive_Order__c;
- }
- p.Offers_Price__c = coc.Offers_Price__c;
- p.Dealer_Info__c = accountid;
- if (String.isBlank(SecondDealer)) {
- p.Order_ForHospital__c = String.isNotBlank(HospitalInfo)
- ? HospitalInfo
- : null;
- p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- } else {
- p.Order_ForHospital__c = String.isNotBlank(HospitalInfo)
- ? HospitalInfo
- : null;
- p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- p.Order_ForDealer__c = SecondDealer;
- }
- P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
- P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
- p.Order_date__c = coc.Order_date__c;
- p.SummonsForDirction__c = coc.SummonsForDirction__c;
- p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder;
- // update start by vivek 2019-7-15
- p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
- // update end by vivek 2019-7-15
- //add by rentx
- p.OutPattern__c = coc.OutPattern__c;
- //add by rentx
- //Map<String,String> ProductNewMap = new Map<String, String>();
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.check == true) {
- if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)',
- ''
- );
- }
- 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 != '鍖婚櫌璇曠敤'
- ) {
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
- }
- if (
- ass.orderdetails1.Delivery_List_RMB__c == 0 &&
- (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
- coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
- ) {
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
- }
- if (
- ass.orderdetails1.Shipment_Count__c == null ||
- ass.orderdetails1.Shipment_Count__c == 0
- ) {
- // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
- }
+ private static String makeSoql(String CateName, String Category3, String Category4, String Category5) {
+ String sqlTail1 = '(\'';
+ for (Integer i = 0; i < zaikuId.size(); i++) {
+ if (zaikuId[i] != null) {
+ if (i < zaikuId.size() - 1) {
+ sqlTail1 += zaikuId[i] + '\',\'';
+ } else {
+ sqlTail1 += zaikuId[i];
+ }
+ }
+ }
+ sqlTail1 += '\')';
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ soql += ' WHERE Id in' + sqlTail1;
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ return soql;
+ }
- if (
- ass.orderdetails1.Box_Piece__c == null ||
- ass.orderdetails1.Box_Piece__c == ''
- ) {
- // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
- }
- if (ass.orderdetails1.Box_Piece__c == '鐩�') {
- if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
- //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
- if (ass.oldCheck == false) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻',
- ''
- );
- } else {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' +
- ass.orderdetails1.Consumable_Product__r.Name__c +
- '搴撳瓨涓嶈冻',
- ''
- );
- }
+ public static String makeSoqlorderdet() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderzaikuId.size(); i++) {
+ if (i < orderzaikuId.size() - 1) {
+ sqlTail += orderzaikuId[i] + '\',\'';
+ } else {
+ sqlTail += orderzaikuId[i];
}
- } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
- if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
- //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
- if (ass.oldCheck == false) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻',
- ''
- );
- } else {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' +
- ass.orderdetails1.Consumable_Product__r.Name__c +
- '搴撳瓨涓嶈冻',
- ''
- );
- }
+ }
+ sqlTail += '\')';
+ String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ msoql += ' WHERE Id in' + sqlTail;
+ return msoql;
+ }
+
+ public static String makeSoqlinventory() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < zaikuId.size(); i++) {
+ if (zaikuId[i] != null) {
+ if (i < zaikuId.size() - 1) {
+ sqlTail += zaikuId[i] + '\',\'';
+ } else {
+ sqlTail += zaikuId[i];
+ }
}
- }
}
- }
- insert p;
- ESetId = p.id;
- List<Consumable_order__c> detailName = new List<Consumable_order__c>();
- detailName = [
- SELECT id, Name
- FROM Consumable_order__c
- WHERE id = :ESetId
- ];
- Integer i = 1;
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.check == true) {
- Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
- }
- InsAfterDel.Name = detailName[0].name + '-' + str;
- InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
- InsAfterDel.Consumable_order__c = p.id;
- InsAfterDel.Consumable_Product__c = ass.Prod.id;
- InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
- // TODO 榛樿 鐩� 锛岄渶瑕佷慨姝�
- InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
- InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
- //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
- InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
- InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- //add by rentx 2021-2-26 start
- InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
- //add by rentx 2021-2-26 end
- i++;
- Ins.add(InsAfterDel);
+ sqlTail += '\')';
+ String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ msoql += ' WHERE Id in' + sqlTail;
+ return msoql;
+ }
+
+ public static void initStandardController(String soql) {
+ // init standard controller
+ System.debug('soql =' + soql);
+ System.debug('initStandardController star');
+ //setCon = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
+ // sets the number of records in each page set
+ //setCon.setPageSize(size);
+ System.debug('initStandardController end');
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecords() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ System.debug('zhj1');
+ //鍙栧嚭閫夋嫨鐨勪骇鍝�
+ if (pageRecords != null) {
+ System.debug('zhj2');
+ for (ConsumableorderdetailsInfo ass : pageRecords) {
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ } else {
+ selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ }
+ reSet.add(ass);
+ }
+ }
}
- }
- // 濡傛灉 鍑哄簱鍗� 鍜� OCM鍙戣揣Header杩� 鐨勮瘽锛屽彂璐х殑Detail2 Copy鍒� 鍑哄簱鍗曠殑Detail2閲�
- if (getExistarrive()) {
- for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) {
- //BlockForP;
- Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c();
- InsProductDet.Id = ass.orderdetails2.Id;
- InsProductDet.Consumable_ZS_order__c = p.id;
- i++;
- InsProduct.add(InsProductDet);
+ System.debug('zhj3');
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ System.debug('reSet.size() = ' + reSet.size());
+ if (editAble && String.isBlank(arriveorder)) {
+ pageRecords = reSet;
}
- }
- if (Ins.size() > 0) {
- insert Ins;
- }
- if (InsProduct.size() > 0) {
- //ControllerUtil.updateOrderDetailsSatus(InsProduct);
- update InsProduct;
- }
- } else if (ESetId != null || ESetId.length() > 0) {
- //淇敼涔嬪悗 淇濆瓨璁㈠崟
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select
- cocinfo = [
- SELECT
- Id,
- Name,
- SummonsStatus_c__c,
- NoConfirmedPrice__c,
- Dealer_Info__c,
- Order_ForHospital__c,
- SummonsForDirction__c
- FROM Consumable_order__c
- WHERE Id = :ESetId
- ];
- // update end by vivek 2019-7-15
- if (cocinfo.size() > 0) {
- p = cocinfo[0];
- }
- p.Name = coc.Name;
- p.Dealer_Info__c = accountid;
- p.Order_ProType__c = agencyProType;
- if (String.isEmpty(SecondDealer)) {
- p.Order_ForHospital__c = String.isNotBlank(HospitalInfo)
- ? HospitalInfo
- : null;
- p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
+ //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
+ Integer addNo = 0;
+ //update by rentx 2021-2-26 start
+ System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
+ for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (
+ (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
+ (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
+ ) {
+ addNo++;
+ } else {
+ if (info.check == false) {
+ info.orderdetails1 = orderdetails1;
+ }
+ pageRecords.add(info);
+ addNo++;
+ }
+ }
+ System.debug('pageRecords 2 = ' + pageRecords);
+ System.debug('zhj5');
+ System.debug('pageRecords = ' + pageRecords);
+ return pageRecords;
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() {
+ List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ skipData = new Map<String, String>();
+ System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc);
+ //鍙栧嚭閫夋嫨鐨勪骇鍝�
+ if (pageRecordsLwc != null) {
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ System.debug('ass.check = ' + ass.check);
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ } else {
+ selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ }
+ reSetLwc.add(ass);
+ }
+ }
+ }
+ System.debug('selectedIdMap = ' + selectedIdMap);
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ if (editAble && String.isBlank(arriveorder)) {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ System.debug('reSetLwc = ' + reSetLwc);
+ for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) {
+ ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo();
+ ci.check = assLwc.check;
+ ci.oldCheck = assLwc.oldCheck;
+ ci.orderdetails1 = assLwc.orderdetails1;
+ ci.orderdetails2 = assLwc.orderdetails2;
+ ci.Prod = assLwc.Prod;
+ ci.Boxnumber = assLwc.Boxnumber;
+ ci.Piecenumber = assLwc.Piecenumber;
+ ci.allnumber = assLwc.allnumber;
+ ci.oldConsumableCount = assLwc.oldConsumableCount;
+ ci.canSelect = assLwc.canSelect;
+ ci.sortBy = assLwc.sortBy;
+ ci.packinglist = assLwc.packinglist;
+ ci.approbation_No = assLwc.approbation_No;
+ ci.expiration_Date = assLwc.expiration_Date;
+ ci.boxorpiecein = assLwc.boxorpiecein;
+ ci.boxorpiece = assLwc.boxorpiece;
+ ci.boxorpieceMap = assLwc.boxorpieceMap;
+ ci.concc = assLwc.concc;
+ ci.BoxPiece = assLwc.BoxPiece;
+ ci.hospitalSpecialOffer = assLwc.hospitalSpecialOffer;
+ ci.hosPro = assLwc.hosPro;
+ reSet.add(ci);
+ }
+ pageRecords = reSet;
+ System.debug('reSet = ' + reSet);
+ addData = reSet.clone();
+ System.debug('addData = reSet = ' + addData);
+ }
+ //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
+ //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
+ Integer addNo = 0;
+ //update by rentx 2021-2-26 start
+ System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
+ for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (
+ (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
+ (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
+ ) {
+ System.debug('鍘绘帀鐨刬d : ' + info.Prod.Id);
+ addNo++;
+ addSize++;
+ } else {
+ if (info.check == false) {
+ info.orderdetails1 = orderdetails1;
+ }
+ pageRecords.add(info);
+ addNo++;
+ }
+ }
+ System.debug('pageRecords.size() = ' + pageRecords.size());
+ System.debug('end addData = ' + addData);
+ return pageRecords;
+ }
+
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(
+ Consumable_order__c cocLwc,
+ String hospitalInfoLwc,
+ String hospitalNameLwc,
+ String secondaryDistributorLwc,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwc,
+ String accountidLwc,
+ String ESetIdLwc,
+ List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+ String agencyProTypeLwc,
+ String userWorkLocationLwc
+ ) {
+ coc = cocLwc;
+ HospitalInfo = hospitalInfoLwc;
+ HospitalName = hospitalNameLwc;
+ SecondDealer = secondaryDistributorLwc;
+ pageRecordsLwc = pageRecordsLwc;
+ accountid = accountidLwc;
+ consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
+ ESetId = ESetIdLwc;
+ agencyProType = agencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+
+ System.debug('coc = ' + coc);
+ System.debug('HospitalInfo = ' + HospitalInfo);
+ System.debug('HospitalName = ' + HospitalName);
System.debug('SecondDealer = ' + SecondDealer);
- p.Order_ForDealer__c = null;
- } else {
- p.Order_ForHospital__c = String.isNotBlank(HospitalInfo)
- ? HospitalInfo
- : null;
- p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
- p.Order_ForDealer__c = SecondDealer;
- }
- P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
- P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
- p.Order_date__c = coc.Order_date__c;
- p.SummonsForDirction__c = coc.SummonsForDirction__c;
- //add by rentx
- p.OutPattern__c = coc.OutPattern__c;
- // update start by vivek 2019-7-15
- if (p.SummonsStatus_c__c == '浠锋牸鏈畾') {
- p.NoConfirmedPrice__c = false;
- p.SummonsStatus_c__c = '宸插畬鎴�';
- } else {
- p.SummonsStatus_c__c = '鑽夋涓�';
- }
- // p.SummonsStatus_c__c = '鑽夋涓�';
- // update end by vivek 2019-7-15
- Integer i = 1;
- //Map<String,String> ProductOldMap = new Map<String, String>();
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.check == true) {
- if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
- 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 != '鍖婚櫌璇曠敤'
- ) {
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
- }
- if (
- ass.orderdetails1.Delivery_List_RMB__c == 0 &&
- (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
- coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
- ) {
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
- }
- if (
- ass.orderdetails1.Box_Piece__c == null ||
- ass.orderdetails1.Box_Piece__c == ''
- ) {
- // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
+ System.debug('pageRecordsLwc = ' + pageRecordsLwc);
+ System.debug('accountid = ' + accountid);
+ System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
+ System.debug('ESetId = ' + ESetId);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ //璁㈠崟淇℃伅纭
+ if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) {
+ // coc.SummonsForDirction__c.addError('璇疯緭鍏ユ寚绀哄崟鐩殑');
// return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
- }
- if (ass.orderdetails1.Box_Piece__c == '鐩�') {
- if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
- //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
- if (ass.oldCheck == false) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻',
- ''
- );
- } else {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ寚绀哄崟鐩殑', '');
+ } else if (coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅' );
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅', '');
+ }
+ } else if (coc.SummonsForDirction__c == '鍖婚櫌璇曠敤') {
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else if (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
+ if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)', '');
+ }
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) {
+ // coc.addError('涓嶉渶瑕佽緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ュ尰闄�', '');
+ }
+ if (String.isNotBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
+ }
+ if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)', '');
+ }
+ }
+
+ Integer isHos = 0;
+
+ Integer FLG = 0;
+ Integer Count = 0;
+ for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+ FLG = FLG + 1;
+ if (CheckCount.check == false) {
+ Count = Count + 1;
+ } else {
+ //add by rentx
+ if (CheckCount.hospitalSpecialOffer) {
+ isHos = isHos + 1;
+ }
+ //add by rentx
+ }
+ }
+ if (Count == FLG) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇烽�夋嫨鎵�闇�娑堣�楀搧'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨鎵�闇�娑堣�楀搧', '');
+ }
+ // gzw 娉ㄩ噴 鍒ゆ柇鎻愬墠 20210308
+ //checkOutPattern();
+ //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
+ Integer isHosCheckOutPattern = 0;
+ for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+ if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
+ isHosCheckOutPattern = isHosCheckOutPattern + 1;
+ }
+ }
+ if (isHosCheckOutPattern > 0) {
+ coc.OutPattern__c = true;
+ } else {
+ coc.OutPattern__c = false;
+ }
+
+ // add by rentx 2021-3-10 start
+ //鐗逛环鍖婚櫌鍑哄簱闈炴湰鍖婚櫌缁存姢鐨勭壒浠峰晢鍝佹椂,鎶ラ敊 闈炵壒浠峰尰闄㈠嚭搴撶淮鎶ゅ湪鍖婚櫌鐗逛环鍏崇郴琛ㄧ殑浜у搧鏃� 鎶ラ敊
+ if (coc.SummonsForDirction__c != '浜掔浉璋冭揣') {
+ //闈炵壒浠峰尰闄㈠嚭搴撶壒浠蜂骇鍝佹椂 鎶ラ敊(褰撳墠缁忛攢鍟嗕笅娌℃湁鐗逛环鍖婚櫌闄ゅ)
+ List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ //缁忛攢鍟嗗搴斿尰闄笅鐨勬墍鏈夌壒浠蜂骇鍝�
+ Map<String, String> proMap = new Map<String, String>();
+ //缁忛攢鍟嗕笅鐨勬墍鏈夌壒浠蜂骇鍝�
+ Map<String, String> allProMap = new Map<String, String>();
+
+ if (hopList != null && hopList.size() > 0) {
+ Boolean flag = false;
+ if (HospitalInfo != null && HospitalInfo != '') {
+ for (hospitalprice__c hp : hopList) {
+ allProMap.put(hp.product__c, '');
+ //濡傛灉褰撳墠 鍖婚櫌鐗逛环鍏崇郴涓殑鍖婚櫌瀵瑰簲鍑哄簱鍗曚笂鍑哄簱鐨勫尰闄�,鍒欐斁浜у搧id鍒癿ap
+ if (hp.hospital__c == HospitalInfo) {
+ flag = true;
+ proMap.put(hp.product__c, '');
+ }
+ }
+ }
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ //鍒ゆ柇閫変腑鐨勫尰闄㈢壒浠蜂骇鍝�
+ if (ass.hospitalSpecialOffer == true) {
+ //鐢ㄦ埛閫変腑浜嗗綋鍓嶅尰闄笅鐨勭壒浠蜂骇鍝�
+ if (proMap.containsKey(ass.Prod.Id)) {
+ continue;
+ //鐢ㄦ埛閫変腑浜嗘病鏈夌淮鎶ょ壒浠峰尰闄㈢殑鐗逛环浜у搧
+ } else if (!allProMap.containsKey(ass.Prod.Id)) {
+ continue;
+ } else {
+ //鐢ㄦ埛閫変腑闈炲綋鍓嶅尰闄㈢淮鎶ょ殑鐗逛环浜у搧
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:'+ ass.Prod.Name__c +' 鐨勭壒浠�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:' + ass.Prod.Name__c + '鐨勭壒浠�', '');
+ }
+ } //闈炲尰闄㈢壒浠蜂骇鍝佸彲浠ュ嚭搴撶粰浠绘剰鍖婚櫌,鎵�浠ヤ笉闇�瑕佸垽鏂�
+ }
+ }
+ }
+ } else {
+ //濡傛灉鏄簰鐩歌皟璐�,鍒ゆ柇 缁忛攢鍟�(褰曞叆) 鏄惁缁存姢浜� 褰撳墠閫変腑鐨勭壒浠蜂骇鍝�
+ List<hospitalprice__c> hopList = [
+ SELECT id, hospital__c, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :coc.Order_ForDealerTextID__c
+ ];
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (hopList != null && hopList.size() > 0) {
+ for (hospitalprice__c hpc : hopList) {
+ proMap.put(hpc.product__c, '');
+ }
+
+ String proStr = '';
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ if (!proMap.containsKey(ass.Prod.Id)) {
+ proStr += ass.Prod.Name__c + ',';
+ }
+ }
+ }
+ }
+ if (proStr != '') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '缁忛攢鍟�:'+coc.Order_ForDealerText__c +' 娌℃湁娑堣�楀搧:'+proStr.substring(0,proStr.length()-1) + ' 鐨勭壒浠�'));
+ // return null;
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '缁忛攢鍟�:' +
+ coc.Order_ForDealerText__c +
+ ' 娌℃湁娑堣�楀搧:' +
+ proStr.substring(0, proStr.length() - 1) +
+ ' 鐨勭壒浠�',
+ ''
+ );
+ }
+ }
+ }
+
+ // checkOutPattern();
+ Consumable_order__c p = new Consumable_order__c();
+ List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>();
+ List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>();
+ Savepoint sp = Database.setSavepoint();
+ // try {
+ //鏂板缓璁㈠崟鏃�
+ if (String.isEmpty(ESetId)) {
+ p.Name = '*';
+ p.Order_type__c = '浼犵エ';
+ p.Order_ProType__c = agencyProType;
+ if (coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c))
+ coc.SummonsStatus_c__c = '鑽夋涓�';
+ // update strat by vivek 2019-7-12
+ p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+ // update end by vivek 2019-7-12
+ p.SummonsStatus_c__c = coc.SummonsStatus_c__c;
+ if (coc.Arrive_Order__c != null) {
+ p.Arrive_Order__c = coc.Arrive_Order__c;
+ }
+ p.Offers_Price__c = coc.Offers_Price__c;
+ p.Dealer_Info__c = accountid;
+ if (String.isBlank(SecondDealer)) {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ } else {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ p.Order_ForDealer__c = SecondDealer;
+ }
+ P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.SummonsForDirction__c = coc.SummonsForDirction__c;
+ p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder;
+ // update start by vivek 2019-7-15
+ p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+ // update end by vivek 2019-7-15
+ //add by rentx
+ p.OutPattern__c = coc.OutPattern__c;
+ //add by rentx
+ //Map<String,String> ProductNewMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)', '');
+ }
+ 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 != '鍖婚櫌璇曠敤') {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (
+ ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+ (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+ ) {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+ // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
+ }
+
+ if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+ // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ }
+ }
+ }
+ insert p;
+ ESetId = p.id;
+ List<Consumable_order__c> detailName = new List<Consumable_order__c>();
+ detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId];
+ Integer i = 1;
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = detailName[0].name + '-' + str;
+ InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
+ InsAfterDel.Consumable_order__c = p.id;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ // TODO 榛樿 鐩� 锛岄渶瑕佷慨姝�
+ InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
+ InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
+ //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ //add by rentx 2021-2-26 start
+ InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
+ //add by rentx 2021-2-26 end
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ // 濡傛灉 鍑哄簱鍗� 鍜� OCM鍙戣揣Header杩� 鐨勮瘽锛屽彂璐х殑Detail2 Copy鍒� 鍑哄簱鍗曠殑Detail2閲�
+ if (getExistarrive()) {
+ for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) {
+ //BlockForP;
+ Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c();
+ InsProductDet.Id = ass.orderdetails2.Id;
+ InsProductDet.Consumable_ZS_order__c = p.id;
+ i++;
+ InsProduct.add(InsProductDet);
+ }
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ if (InsProduct.size() > 0) {
+ //ControllerUtil.updateOrderDetailsSatus(InsProduct);
+ update InsProduct;
+ }
+ } else if (ESetId != null || ESetId.length() > 0) {
+ //淇敼涔嬪悗 淇濆瓨璁㈠崟
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select
+ cocinfo = [
+ SELECT Id, Name, SummonsStatus_c__c, NoConfirmedPrice__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-15
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.Name = coc.Name;
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ if (String.isEmpty(SecondDealer)) {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ System.debug('SecondDealer = ' + SecondDealer);
+ p.Order_ForDealer__c = null;
+ } else {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ p.Order_ForDealer__c = SecondDealer;
+ }
+ P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.SummonsForDirction__c = coc.SummonsForDirction__c;
+ //add by rentx
+ p.OutPattern__c = coc.OutPattern__c;
+ // update start by vivek 2019-7-15
+ if (p.SummonsStatus_c__c == '浠锋牸鏈畾') {
+ p.NoConfirmedPrice__c = false;
+ p.SummonsStatus_c__c = '宸插畬鎴�';
+ } else {
+ p.SummonsStatus_c__c = '鑽夋涓�';
+ }
+ // p.SummonsStatus_c__c = '鑽夋涓�';
+ // update end by vivek 2019-7-15
+ Integer i = 1;
+ //Map<String,String> ProductOldMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+ 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 != '鍖婚櫌璇曠敤') {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (
+ ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+ (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+ ) {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+ // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ }
+ if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+ // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
+ } else {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = p.name + '-' + str;
+ InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
+ InsAfterDel.Consumable_order__c = ESetId;
+ System.debug('ass.Prod.id:' + ass.Prod.id);
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
+ InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
+ //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ //add by rentx 2021-2-26 start
+ InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
+ //add by rentx 2021-2-26 end
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ update p;
+ List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
+ qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+ if (qs.size() > 0) {
+ delete qs;
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ }
+ // }catch (Exception ex) {
+ // Database.rollback(sp);
+ // // ApexPages.addMessages(ex);
+ // // return null;
+ // //return new ResponseBodyLWC('Error',500, ex.getMessage(), '');
+ // return new ResponseBodyLWC('Error',500, JSON.serialize(ex), '');
+ // }
+ data.put('ESetId', ESetId);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static void checkOutPattern() {
+ //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
+ Integer isHos = 0;
+ for (ConsumableorderdetailsInfo CheckCount : pageRecords) {
+ if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
+ ishos = ishos + 1;
+ }
+ }
+ if (isHos > 0) {
+ coc.OutPattern__c = true;
+ } else {
+ coc.OutPattern__c = false;
+ }
+ }
+
+ //鎵撳嵃PDF
+ @AuraEnabled
+ public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc, String ESetId) {
+ System.debug('cocLwc = ' + cocLwc);
+ System.debug('ESetId = ' + ESetId);
+ coc = cocLwc;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ if (coc.SummonsStatus_c__c == '鎵瑰噯') {
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ SummonsStatus_c__c,
+ NoConfirmedPrice__c,
+ Dealer_Info__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-15
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.SummonsStatus_c__c = '鍑哄簱鍗曞凡鎵撳嵃';
+ update p;
+ }
+ data.put('ESetId', ESetId);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鏌ユ壘缁忛攢鍟�
+ @AuraEnabled(cacheable=true scope='global')
+ public static List<LookupSearchResult> search(String searchTerm) {
+ System.debug('searchTerm = ' + searchTerm);
+ String nameCondition = '';
+ nameCondition += '%' + String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) + '%';
+ List<Account> accs = new List<Account>();
+ System.debug('nameCondition = ' + nameCondition);
+ //鏌ヨ鏉′欢淇敼
+ //绛涢�夊垽鏂潯浠讹細褰撳墠璐㈠勾鐨�4/1 ~ 绗簩骞寸殑6/30 聽& ET or ENG绫诲瀷 & 褰撳墠鐢ㄦ埛绫诲瀷
+ //1 and 2
+ //1. Integer year 2022/4/1 ~ 2023/6/30
+ //寮�濮嬫棩鏈� + 缁撴潫鏃ユ湡
+ //Contract_Decide_Start_Date__c>=寮�濮嬫棩鏈� and Contract_Decide_End_Date__c<缁撴潫鏃ユ湡
+ //2. 娣诲姞缁忛攢鍟嗗厑閿�绫诲瀷锛欵T缁忛攢鍟嗗崗璁紱ENG鑰楁潗缁忛攢鍟嗗崗璁�
+ //鍙栧綋鍓嶇敤鎴风殑绫诲瀷锛屽鏋滅敤鎴风被鍨嬫槸ET,ET缁忛攢鍟嗗崗璁� = true
+ // Date today = Date.today();
+ // Integer thisYear = today.year();
+ // Integer nextYear = today.year() + 1;
+ // Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ // Date nextDatetime = Date.newInstance(nextYear, 6, 30);
+ // System.debug('thisDatetime = ' + thisDatetime);
+ // System.debug('nextDatetime = ' + nextDatetime);
+
+ // User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
+ // System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ // System.debug('UserProTypecTemp = ' + UserProTypecTemp);
+ // System.debug('UserProTypecTemp.UserPro_Type__c = ' + UserProTypecTemp.UserPro_Type__c);
+ // if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // // AND
+ // Name LIKE :nameCondition
+ // AND RecordType.DeveloperName = 'AgencyContract'
+ // AND Contract_Decide_Start_Date__c >= :thisDatetime
+ // AND Contract_Decide_End_Date__c <= :nextDatetime
+ // AND ENG_Dealer__c = true
+ // ORDER BY Name
+ // LIMIT 49
+ // ];
+ // }
+ // if (UserProTypecTemp.UserPro_Type__c == 'ET') {
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // // AND
+ // Name LIKE :nameCondition
+ // AND RecordType.DeveloperName = 'AgencyContract'
+ // AND Contract_Decide_Start_Date__c >= :thisDatetime
+ // AND Contract_Decide_End_Date__c <= :nextDatetime
+ // AND ET_SP_Dealer__c = true
+ // ORDER BY Name
+ // LIMIT 49
+ // ];
+ // }
+
+
+ Date today = Date.today();
+ //Date today = Date.newInstance(2023, 3, 1);
+ Integer thisMonth = today.month();
+ System.debug('thisMonth = ' + thisMonth);
+
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 7, 1);
+ System.debug('lastDatetime = ' + lastDatetime);
+ System.debug('thisDatetime = ' + thisDatetime);
+ System.debug('thisDatetime2 = ' + thisDatetime2);
+ System.debug('nextDatetime = ' + nextDatetime);
+ System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
+
+ String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
+ if(thisMonth < 4){
+ sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
+ }else if(thisMonth >= 4 && thisMonth <= 6){
+ sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
+ }else{
+ sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
+ }
+ if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
+ sql += 'AND ENG_Dealer__c = true';
+ }
+ if (UserProTypecTemp.UserPro_Type__c == 'ET') {
+ sql += 'AND ET_SP_Dealer__c = true';
+ }
+ System.debug('sql = ' + sql);
+ accs = Database.query(sql);
+ // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
+ Set<String> pids = new Set<String>();
+ for (Account acc : accs) {
+ pids.add(acc.Parentid);
+ }
+
+ accs = [
+ SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ FROM Account
+ WHERE
+ (Id IN :pids
+ OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ AND Name LIKE :nameCondition))
+ AND RecordType.DeveloperName = 'Agency'
+ ORDER BY Name
+ LIMIT 49
+ ];
+
+ // accs = [
+ // SELECT id, Parentid
+ // FROM Account
+ // WHERE
+ // Parent.Name LIKE :nameCondition
+ // AND Contract_Decide_Start_Date__c <= :Date.Today()
+ // AND Contract_Decide_End_Date__c >= :Date.Today()
+ // ];
+
+ // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
+ // Set<String> pids = new Set<String>();
+ // for (Account acc : accs) {
+ // pids.add(acc.Parentid);
+ // }
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // (Id IN :pids
+ // OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // AND Name LIKE :nameCondition))
+ // AND RecordType.DeveloperName = 'Agency'
+ // AND Is_Active__c != '鐒″姽'
+ // ORDER BY Name
+ // LIMIT 5
+ // ];
+ System.debug('accs = ' + accs);
+ List<LookupSearchResult> results = new List<LookupSearchResult>();
+ String accountIcon = 'standard:account';
+ for (Account account : accs) {
+ String subtitle = account.BillingCity == null ? 'Account' : 'Account 鈥� ' + account.BillingCity;
+ results.add(new LookupSearchResult(account.Id, 'Account', accountIcon, account.Name, subtitle));
+ }
+ results.sort();
+ System.debug('results = ' + results);
+ return results;
+ }
+
+ //淇濆瓨闄勪欢
+ @AuraEnabled
+ public static String saveFile(Id recordId, String fileName, String base64Data) {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = recordId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ return cv.Id;
+ }
+
+ //鑾峰彇闄勪欢
+ @AuraEnabled
+ public static ResponseBodyLWC getFiles(Id recordId) {
+ System.debug('getFiles recordId = ' + recordId);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ List<ContentVersion> cvList = new List<ContentVersion>();
+ List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId];
+ 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++) {
+ cvList.add(cvInfo[i]);
+ }
+ }
+ }
+ // List<ContentVersion> cvList = [
+ // SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
+ // FROM ContentVersion
+ // WHERE FirstPublishLocationId = :recordId
+ // ];
+ data.put('cvList', cvList);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鍒犻櫎闄勪欢
+ @AuraEnabled
+ public static ResponseBodyLWC deleteAtt(String contentVersionId){
+ try {
+ ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
+ String contentDocumentId = conVersion.ContentDocumentId;
+ ContentDocument conDocument = [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
+ delete conDocument;
+ return new ResponseBodyLWC('Success',200,'','');
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
+ }
+ }
+
+ //璺宠浆鍑鸿揣/閿�鍞�
+ @AuraEnabled
+ public static ResponseBodyLWC GoodsDelivery(
+ Consumable_order__c cocLwc,
+ String ESetId,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ coc = cocLwc;
+ ESetId = ESetId;
+ pageRecordsLwc = pageRecordsLwcLwc;
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ List<Account> accList = [
+ SELECT Id
+ FROM Account
+ WHERE Name = :coc.Order_ForDealerText__c AND RecordType.DeveloperName = 'Agency'
+ ];
+ if (accList.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒', '');
+ }
+ }
+ if (coc.SummonsStatus_c__c == '鎵瑰噯') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒', '');
+ }
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) {
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' +
- ass.orderdetails1.Consumable_Product__r.Name__c +
- '搴撳瓨涓嶈冻',
- ''
- );
- }
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
}
- } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
- if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
- if (ass.oldCheck == false) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻',
- ''
- );
- } else {
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' +
- ass.orderdetails1.Consumable_Product__r.Name__c +
- '搴撳瓨涓嶈冻',
- ''
- );
- }
+ }
+ data.put('ESetid', ESetid);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC DelConsumable(String ESetId) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ ESetId = ESetId;
+
+ Savepoint sp = Database.setSavepoint();
+ try {
+ List<Consumable_order__c> qs = new List<Consumable_order__c>();
+ List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
+ Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+ qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
+ if (Dqs.size() > 0 || qs.size() > 0) {
+ delete Dqs;
+ delete qs;
}
- }
- if (
- ass.orderdetails1.Shipment_Count__c == null ||
- ass.orderdetails1.Shipment_Count__c == 0
- ) {
- // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
- } else {
- String str = string.valueOf(i);
- if (str.length() == 1) {
- str = '0' + str;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ System.debug(e.getMessage() + e.getLineNumber());
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // Data Bean
+ @TestVisible
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal Boxnumber { get; set; }
+ @AuraEnabled
+ public Decimal Piecenumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Integer packinglist { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String boxorpiecein { get; set; }
+
+ public List<SelectOption> boxorpiece { get; set; }
+ @AuraEnabled
+ public Map<String, String> boxorpieceMap { get; set; }
+ @AuraEnabled
+ public Attachment concc { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set; }
+ @AuraEnabled
+ public Boolean hosPro { get; set; }
+
+ public ConsumableorderdetailsInfo() {
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = true;
+ oldCheck = true;
+ orderdetails1 = e;
+ orderdetails2 = new Consumable_order_details2__c();
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.Shipment_Count__c;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ BoxPiece = e.Box_Piece__c;
+ boxorpiece = new List<SelectOption>();
+ boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ boxorpiece.add(new SelectOption('涓�', '涓�'));
+
+ boxorpieceMap = new Map<String, String>();
+ boxorpieceMap.put('鐩�', '鐩�');
+ boxorpieceMap.put('涓�', '涓�');
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ // 娑堣�楀搧鍙戣揣鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ check = true;
+ oldCheck = true;
+ orderdetails1 = new Consumable_Orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ //boxorpiece = new List<SelectOption>();
+ //boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ //boxorpiece.add(new SelectOption('涓�', '涓�'));
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ //闄勪欢
+ @TestVisible
+ public ConsumableorderdetailsInfo(Attachment e) {
+ concc = e;
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ oldCheck = false;
+ orderdetails1 = new Consumable_Orderdetails__c();
+ orderdetails2 = new Consumable_order_details2__c();
+ Prod = e;
+ //oldConsumableCount = null;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ orderdetails1.Box_Piece__c = '鐩�';
+ boxorpiece = new List<SelectOption>();
+ boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ boxorpiece.add(new SelectOption('涓�', '涓�'));
+
+ boxorpieceMap = new Map<String, String>();
+ boxorpieceMap.put('鐩�', '鐩�');
+ boxorpieceMap.put('涓�', '涓�');
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToorderdetails1 = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (sortBy == false) {
+ if (Boxnumber > compareToorderdetails1.Boxnumber) {
+ returnValue = -1;
+ } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (Boxnumber > compareToorderdetails1.Boxnumber) {
+ returnValue = 1;
+ } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
}
- InsAfterDel.Name = p.name + '-' + str;
- InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
- InsAfterDel.Consumable_order__c = ESetId;
- InsAfterDel.Consumable_Product__c = ass.Prod.id;
- InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
- InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
- InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
- InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
- //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
- InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
- InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- //add by rentx 2021-2-26 start
- InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
- //add by rentx 2021-2-26 end
- i++;
- Ins.add(InsAfterDel);
- }
}
- }
- update p;
- List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
- qs = [
- SELECT Id
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ];
- if (qs.size() > 0) {
- delete qs;
- }
- if (Ins.size() > 0) {
- insert Ins;
- }
}
- // }catch (Exception ex) {
- // Database.rollback(sp);
- // // ApexPages.addMessages(ex);
- // // return null;
- // //return new ResponseBodyLWC('Error',500, ex.getMessage(), '');
- // return new ResponseBodyLWC('Error',500, JSON.serialize(ex), '');
- // }
- data.put('ESetId', ESetId);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- public static void checkOutPattern() {
- //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
- Integer isHos = 0;
- for (ConsumableorderdetailsInfo CheckCount : pageRecords) {
- if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
- ishos = ishos + 1;
- }
- }
- if (isHos > 0) {
- coc.OutPattern__c = true;
- } else {
- coc.OutPattern__c = false;
- }
- }
-
- //鎵撳嵃PDF
- @AuraEnabled
- public static ResponseBodyLWC PraseToPDF(
- Consumable_order__c cocLwc,
- String ESetId
- ) {
- System.debug('cocLwc = ' + cocLwc);
- System.debug('ESetId = ' + ESetId);
- coc = cocLwc;
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- if (coc.SummonsStatus_c__c == '鎵瑰噯') {
- Consumable_order__c P = new Consumable_order__c();
- List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
- // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
- cocinfo = [
- SELECT
- Id,
- Name,
- SummonsStatus_c__c,
- NoConfirmedPrice__c,
- Dealer_Info__c,
- Order_ForHospital__c,
- SummonsForDirction__c,
- Billed_Status__c
- FROM Consumable_order__c
- WHERE Id = :ESetId
- ];
- // update end by vivek 2019-7-15
- if (cocinfo.size() > 0) {
- p = cocinfo[0];
- }
- p.SummonsStatus_c__c = '鍑哄簱鍗曞凡鎵撳嵃';
- update p;
- }
- data.put('ESetId', ESetId);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- //鏌ユ壘缁忛攢鍟�
- @AuraEnabled(cacheable=true scope='global')
- public static List<LookupSearchResult> search(String searchTerm) {
- System.debug('searchTerm = ' + searchTerm);
- String nameCondition = '';
- nameCondition +=
- '%' +
- String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) +
- '%';
- List<Account> accs = new List<Account>();
- System.debug('nameCondition = ' + nameCondition);
- //鏌ヨ鏉′欢淇敼
- //绛涢�夊垽鏂潯浠讹細褰撳墠璐㈠勾鐨�4/1 ~ 绗簩骞寸殑6/30 聽& ET or ENG绫诲瀷 & 褰撳墠鐢ㄦ埛绫诲瀷
- //1 and 2
- //1. Integer year 2022/4/1 ~ 2023/6/30
- //寮�濮嬫棩鏈� + 缁撴潫鏃ユ湡
- //Contract_Decide_Start_Date__c>=寮�濮嬫棩鏈� and Contract_Decide_End_Date__c<缁撴潫鏃ユ湡
- //2. 娣诲姞缁忛攢鍟嗗厑閿�绫诲瀷锛欵T缁忛攢鍟嗗崗璁紱ENG鑰楁潗缁忛攢鍟嗗崗璁�
- //鍙栧綋鍓嶇敤鎴风殑绫诲瀷锛屽鏋滅敤鎴风被鍨嬫槸ET,ET缁忛攢鍟嗗崗璁� = true
- // Date today = Date.today();
- // Integer thisYear = today.year();
- // Integer nextYear = today.year() + 1;
- // Date thisDatetime = Date.newInstance(thisYear, 4, 1);
- // Date nextDatetime = Date.newInstance(nextYear, 6, 30);
- // System.debug('thisDatetime = ' + thisDatetime);
- // System.debug('nextDatetime = ' + nextDatetime);
-
- // User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
- // System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
- // System.debug('UserProTypecTemp = ' + UserProTypecTemp);
- // System.debug('UserProTypecTemp.UserPro_Type__c = ' + UserProTypecTemp.UserPro_Type__c);
- // if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
- // accs = [
- // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
- // FROM Account
- // WHERE
- // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
- // // AND
- // Name LIKE :nameCondition
- // AND RecordType.DeveloperName = 'AgencyContract'
- // AND Contract_Decide_Start_Date__c >= :thisDatetime
- // AND Contract_Decide_End_Date__c <= :nextDatetime
- // AND ENG_Dealer__c = true
- // ORDER BY Name
- // LIMIT 49
- // ];
- // }
- // if (UserProTypecTemp.UserPro_Type__c == 'ET') {
- // accs = [
- // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
- // FROM Account
- // WHERE
- // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
- // // AND
- // Name LIKE :nameCondition
- // AND RecordType.DeveloperName = 'AgencyContract'
- // AND Contract_Decide_Start_Date__c >= :thisDatetime
- // AND Contract_Decide_End_Date__c <= :nextDatetime
- // AND ET_SP_Dealer__c = true
- // ORDER BY Name
- // LIMIT 49
- // ];
- // }
-
- Date today = Date.today();
- //Date today = Date.newInstance(2023, 3, 1);
- Integer thisMonth = today.month();
- System.debug('thisMonth = ' + thisMonth);
-
- Integer lastYear = today.year() - 1;
- Integer thisYear = today.year();
- Integer nextYear = today.year() + 1;
-
- Date lastDatetime = Date.newInstance(lastYear, 4, 1);
- Date thisDatetime = Date.newInstance(thisYear, 4, 1);
- Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
- Date nextDatetime = Date.newInstance(nextYear, 7, 1);
- System.debug('lastDatetime = ' + lastDatetime);
- System.debug('thisDatetime = ' + thisDatetime);
- System.debug('thisDatetime2 = ' + thisDatetime2);
- System.debug('nextDatetime = ' + nextDatetime);
- System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
- User UserProTypecTemp = [
- SELECT UserPro_Type__c
- FROM User
- WHERE id = :UserInfo.getUserId()
- ];
-
- String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
- if (thisMonth < 4) {
- sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
- } else if (thisMonth >= 4 && thisMonth <= 6) {
- sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
- } else {
- sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
- }
- if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
- sql += 'AND ENG_Dealer__c = true';
- }
- if (UserProTypecTemp.UserPro_Type__c == 'ET') {
- sql += 'AND ET_SP_Dealer__c = true';
- }
- System.debug('sql = ' + sql);
- accs = Database.query(sql);
- // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
- Set<String> pids = new Set<String>();
- for (Account acc : accs) {
- pids.add(acc.Parentid);
+ @TestVisible
+ class ConsumableorderdetailsInfoLwc {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal Boxnumber { get; set; }
+ @AuraEnabled
+ public Decimal Piecenumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Integer packinglist { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String boxorpiecein { get; set; }
+ public List<SelectOption> boxorpiece { get; set; }
+ @AuraEnabled
+ public Map<String, String> boxorpieceMap { get; set; }
+ @AuraEnabled
+ public Attachment concc { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set; }
+ @AuraEnabled
+ public Boolean hosPro { get; set; }
+ @AuraEnabled
+ public List<Map<String, String>> unitOptions { get; set; }
+ @AuraEnabled
+ public String unitValue { get; set; }
+ @AuraEnabled
+ public Integer shipmentNumber { get; set; }
+ @AuraEnabled
+ public Decimal shippingUnitPrice { get; set; }
+ @AuraEnabled
+ public String recordId { get; set; }
+ @AuraEnabled
+ public String Id { get; set; }
+ @AuraEnabled
+ public String Name { get; set; }
+ @AuraEnabled
+ public String Category3 { get; set; }
+ @AuraEnabled
+ public String Category4 { get; set; }
+ @AuraEnabled
+ public String Category5 { get; set; }
}
- accs = [
- SELECT
- Id,
- Name,
- Department_Class__c,
- Department_Class__r.Name,
- Hospital__c,
- Hospital__r.Name,
- BillingCity
- FROM Account
- WHERE
- (Id IN :pids
- OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
- AND Name LIKE :nameCondition))
- AND RecordType.DeveloperName = 'Agency'
- ORDER BY Name
- LIMIT 49
- ];
-
- // accs = [
- // SELECT id, Parentid
- // FROM Account
- // WHERE
- // Parent.Name LIKE :nameCondition
- // AND Contract_Decide_Start_Date__c <= :Date.Today()
- // AND Contract_Decide_End_Date__c >= :Date.Today()
- // ];
-
- // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
- // Set<String> pids = new Set<String>();
- // for (Account acc : accs) {
- // pids.add(acc.Parentid);
- // }
- // accs = [
- // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
- // FROM Account
- // WHERE
- // (Id IN :pids
- // OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
- // AND Name LIKE :nameCondition))
- // AND RecordType.DeveloperName = 'Agency'
- // AND Is_Active__c != '鐒″姽'
- // ORDER BY Name
- // LIMIT 5
- // ];
- System.debug('accs = ' + accs);
- List<LookupSearchResult> results = new List<LookupSearchResult>();
- String accountIcon = 'standard:account';
- for (Account account : accs) {
- String subtitle = account.BillingCity == null
- ? 'Account'
- : 'Account 鈥� ' + account.BillingCity;
- results.add(
- new LookupSearchResult(
- account.Id,
- 'Account',
- accountIcon,
- account.Name,
- subtitle
- )
- );
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
}
- results.sort();
- System.debug('results = ' + results);
- return results;
- }
-
- //淇濆瓨闄勪欢
- @AuraEnabled
- public static String saveFile(
- Id recordId,
- String fileName,
- String base64Data
- ) {
- base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
- ContentVersion cv = new ContentVersion();
- cv.Title = fileName;
- cv.PathOnClient = '/' + fileName;
- cv.FirstPublishLocationId = recordId;
- cv.VersionData = EncodingUtil.base64Decode(base64Data);
- cv.IsMajorVersion = true;
- insert cv;
- return cv.Id;
- }
-
- //鑾峰彇闄勪欢
- @AuraEnabled
- public static ResponseBodyLWC getFiles(Id recordId) {
- System.debug('getFiles recordId = ' + recordId);
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- List<ContentVersion> cvList = [
- SELECT
- id,
- Title,
- CreatedBy.Name,
- PathOnClient,
- CreatedDate,
- ContentDocumentId
- FROM ContentVersion
- WHERE FirstPublishLocationId = :recordId
- ];
- data.put('cvList', cvList);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- //鍒犻櫎闄勪欢
- @AuraEnabled
- public static ResponseBodyLWC deleteAtt(String contentVersionId) {
- try {
- ContentVersion conVersion = [
- SELECT ContentDocumentId
- FROM ContentVersion
- WHERE Id = :contentVersionId
- ];
- String contentDocumentId = conVersion.ContentDocumentId;
- ContentDocument conDocument = [
- SELECT Id
- FROM ContentDocument
- WHERE Id = :contentDocumentId
- ];
- delete conDocument;
- return new ResponseBodyLWC('Success', 200, '', '');
- } catch (Exception e) {
- return new ResponseBodyLWC(
- 'Error',
- 500,
- e.getMessage() + e.getLineNumber(),
- ''
- );
- }
- }
-
- //璺宠浆鍑鸿揣/閿�鍞�
- @AuraEnabled
- public static ResponseBodyLWC GoodsDelivery(
- Consumable_order__c cocLwc,
- String ESetId,
- List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
- coc = cocLwc;
- ESetId = ESetId;
- pageRecordsLwc = pageRecordsLwcLwc;
- if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
- List<Account> accList = [
- SELECT Id
- FROM Account
- WHERE
- Name = :coc.Order_ForDealerText__c
- AND RecordType.DeveloperName = 'Agency'
- ];
- if (accList.size() < 1) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒', '');
- }
- }
- if (coc.SummonsStatus_c__c == '鎵瑰噯') {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒'));
- // return null;
- return new ResponseBodyLWC('Error', 500, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒', '');
- }
- for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
- if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) {
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
- // return null;
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娑堣�楀搧' +
- ass.orderdetails1.Consumable_Product__r.Name__c +
- '搴撳瓨涓嶈冻',
- ''
- );
- }
- }
- data.put('ESetid', ESetid);
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- //鍒犻櫎鎸夐挳
- @AuraEnabled
- public static ResponseBodyLWC DelConsumable(String ESetId) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
-
- ESetId = ESetId;
-
- Savepoint sp = Database.setSavepoint();
- try {
- List<Consumable_order__c> qs = new List<Consumable_order__c>();
- List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
- Dqs = [
- SELECT Id
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c = :ESetId
- ];
- qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
- if (Dqs.size() > 0 || qs.size() > 0) {
- delete Dqs;
- delete qs;
- }
- } catch (Exception e) {
- Database.rollback(sp);
- System.debug(e.getMessage() + e.getLineNumber());
- return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
- }
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- }
-
- // Data Bean
- @TestVisible
- class ConsumableorderdetailsInfo implements Comparable {
- @AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Boolean oldCheck { get; set; }
- @AuraEnabled
- public Consumable_Orderdetails__c orderdetails1 { get; set; }
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Decimal Boxnumber { get; set; }
- @AuraEnabled
- public Decimal Piecenumber { get; set; }
- @AuraEnabled
- public Decimal allnumber { get; set; }
- @AuraEnabled
- public Decimal oldConsumableCount { get; set; }
- @AuraEnabled
- public Boolean canSelect { get; set; }
- @AuraEnabled
- public Boolean sortBy { get; set; }
- @AuraEnabled
- public Integer packinglist { get; set; }
- @AuraEnabled
- public String approbation_No { get; set; }
- @AuraEnabled
- public Date expiration_Date { get; set; }
- @AuraEnabled
- public String boxorpiecein { get; set; }
-
- public List<SelectOption> boxorpiece { get; set; }
- @AuraEnabled
- public Map<String, String> boxorpieceMap { get; set; }
- @AuraEnabled
- public Attachment concc { get; set; }
- @AuraEnabled
- public String BoxPiece { get; set; }
- @AuraEnabled
- public Boolean hospitalSpecialOffer { get; set; }
- @AuraEnabled
- public Boolean hosPro { get; set; }
-
- public ConsumableorderdetailsInfo() {
- }
-
- public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
- check = true;
- oldCheck = true;
- orderdetails1 = e;
- orderdetails2 = new Consumable_order_details2__c();
- Prod = e.Consumable_Product__r;
- oldConsumableCount = e.Shipment_Count__c;
- canSelect = true;
- allnumber = 0;
- Boxnumber = 0;
- Piecenumber = 0;
- BoxPiece = e.Box_Piece__c;
- boxorpiece = new List<SelectOption>();
- boxorpiece.add(new SelectOption('鐩�', '鐩�'));
- boxorpiece.add(new SelectOption('涓�', '涓�'));
-
- boxorpieceMap = new Map<String, String>();
- boxorpieceMap.put('鐩�', '鐩�');
- boxorpieceMap.put('涓�', '涓�');
- hospitalSpecialOffer = false;
- hosPro = false;
- }
-
- // 娑堣�楀搧鍙戣揣鏄庣粏
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- check = true;
- oldCheck = true;
- orderdetails1 = new Consumable_Orderdetails__c();
- orderdetails2 = e;
- Prod = e.Consumable_Product__r;
- canSelect = true;
- allnumber = 0;
- Boxnumber = 0;
- Piecenumber = 0;
- //boxorpiece = new List<SelectOption>();
- //boxorpiece.add(new SelectOption('鐩�', '鐩�'));
- //boxorpiece.add(new SelectOption('涓�', '涓�'));
- hospitalSpecialOffer = false;
- hosPro = false;
- }
-
- //闄勪欢
- public ConsumableorderdetailsInfo(Attachment e) {
- concc = e;
- hospitalSpecialOffer = false;
- hosPro = false;
- }
-
- public ConsumableorderdetailsInfo(Product2__c e) {
- check = false;
- oldCheck = false;
- orderdetails1 = new Consumable_Orderdetails__c();
- orderdetails2 = new Consumable_order_details2__c();
- Prod = e;
- //oldConsumableCount = null;
- canSelect = true;
- allnumber = 0;
- Boxnumber = 0;
- Piecenumber = 0;
- orderdetails1.Box_Piece__c = '鐩�';
- boxorpiece = new List<SelectOption>();
- boxorpiece.add(new SelectOption('鐩�', '鐩�'));
- boxorpiece.add(new SelectOption('涓�', '涓�'));
-
- boxorpieceMap = new Map<String, String>();
- boxorpieceMap.put('鐩�', '鐩�');
- boxorpieceMap.put('涓�', '涓�');
- hospitalSpecialOffer = false;
- hosPro = false;
- }
-
- // 鎺掑簭
- public Integer compareTo(Object compareTo) {
- ConsumableorderdetailsInfo compareToorderdetails1 = (ConsumableorderdetailsInfo) compareTo;
- Integer returnValue = 0;
- if (sortBy == false) {
- if (Boxnumber > compareToorderdetails1.Boxnumber) {
- returnValue = -1;
- } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
- returnValue = 1;
- }
- return returnValue;
- } else {
- if (Boxnumber > compareToorderdetails1.Boxnumber) {
- returnValue = 1;
- } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
- returnValue = -1;
- }
- return returnValue;
- }
- }
- }
- @TestVisible
- class ConsumableorderdetailsInfoLwc {
- @AuraEnabled
- public Boolean check { get; set; }
- @AuraEnabled
- public Boolean oldCheck { get; set; }
- @AuraEnabled
- public Consumable_Orderdetails__c orderdetails1 { get; set; }
- @AuraEnabled
- public Consumable_order_details2__c orderdetails2 { get; set; }
- @AuraEnabled
- public Product2__c Prod { get; set; }
- @AuraEnabled
- public Decimal Boxnumber { get; set; }
- @AuraEnabled
- public Decimal Piecenumber { get; set; }
- @AuraEnabled
- public Decimal allnumber { get; set; }
- @AuraEnabled
- public Decimal oldConsumableCount { get; set; }
- @AuraEnabled
- public Boolean canSelect { get; set; }
- @AuraEnabled
- public Boolean sortBy { get; set; }
- @AuraEnabled
- public Integer packinglist { get; set; }
- @AuraEnabled
- public String approbation_No { get; set; }
- @AuraEnabled
- public Date expiration_Date { get; set; }
- @AuraEnabled
- public String boxorpiecein { get; set; }
- public List<SelectOption> boxorpiece { get; set; }
- @AuraEnabled
- public Map<String, String> boxorpieceMap { get; set; }
- @AuraEnabled
- public Attachment concc { get; set; }
- @AuraEnabled
- public String BoxPiece { get; set; }
- @AuraEnabled
- public Boolean hospitalSpecialOffer { get; set; }
- @AuraEnabled
- public Boolean hosPro { get; set; }
- @AuraEnabled
- public List<Map<String, String>> unitOptions { get; set; }
- @AuraEnabled
- public String unitValue { get; set; }
- @AuraEnabled
- public Integer shipmentNumber { get; set; }
- @AuraEnabled
- public Decimal shippingUnitPrice { get; set; }
- @AuraEnabled
- public String recordId { get; set; }
- @AuraEnabled
- public String Id { get; set; }
- @AuraEnabled
- public String Name { get; set; }
- @AuraEnabled
- public String Category3 { get; set; }
- @AuraEnabled
- public String Category4 { get; set; }
- @AuraEnabled
- public String Category5 { get; set; }
- }
-
- //鍒嗛〉Bean
- public class PaginatedAccounts {
- @AuraEnabled
- public Integer nextPageToken;
- @AuraEnabled
- public Integer pageNumber { get; set; }
- @AuraEnabled
- public Integer totalRecords { get; set; }
- @AuraEnabled
- public Integer recordStart { get; set; }
- @AuraEnabled
- public Integer recordEnd { get; set; }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
index 63245bf..6e443dc 100644
--- a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
+++ b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
@@ -1,3769 +1,2406 @@
@isTest
private class LexSummonsCreatControllerTest {
- @isTest
- static void testInit() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id,
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true,
- BillingCity = null
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
+ @isTest
+ static void testInit(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900');
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
- Agency_Hospital_Link__c ahl = new Agency_Hospital_Link__c();
- ahl.Name = 'test1缁忛攢鍟嗗尰闄�';
- ahl.Hospital__c = accountItem2.Id;
- ahl.Agency__c = accountItem1.Id;
- insert new List<Agency_Hospital_Link__c>{ ahl };
+ Agency_Hospital_Link__c ahl = new Agency_Hospital_Link__c();
+ ahl.Name = 'test1缁忛攢鍟嗗尰闄�';
+ ahl.Hospital__c = accountItem2.Id;
+ ahl.Agency__c = accountItem1.Id;
+ insert new Agency_Hospital_Link__c[]{ahl};
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- //鍙戣揣
- Consumable_order__c consOrder = new Consumable_order__c();
- consOrder.Name = 'test01';
- consOrder.Order_status__c = '鎵瑰噯';
- consOrder.Deliver_date__c = Date.today();
- consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- consOrder.Order_type__c = '璁㈠崟';
- consOrder.Order_ProType__c = 'ENG';
- consOrder.Dealer_Info__c = accountItem1.Id;
- consOrder.Delivery_detail_count__c = 5;
- insert consOrder;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ //鍙戣揣
+ Consumable_order__c consOrder = new Consumable_order__c();
+ consOrder.Name = 'test01';
+ consOrder.Order_status__c = '鎵瑰噯';
+ consOrder.Deliver_date__c = Date.today();
+ consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ consOrder.Order_type__c = '璁㈠崟';
+ consOrder.Order_ProType__c = 'ENG';
+ consOrder.Dealer_Info__c = accountItem1.Id;
+ consOrder.Delivery_detail_count__c = 5;
+ insert consOrder;
- // create ContentVersions
- list<ContentVersion> cvList = new List<ContentVersion>();
- cvList.add(
- new ContentVersion(
- Title = 'test1',
- PathOnClient = '/' + 'Test1.txt',
- VersionData = Blob.valueOf('test data 1'),
- IsMajorVersion = true
- )
- );
- cvList.add(
- new ContentVersion(
- Title = 'test2',
- PathOnClient = '/' + 'Test2.txt',
- VersionData = Blob.valueOf('test data 2'),
- IsMajorVersion = true
- )
- );
- cvList.add(
- new ContentVersion(
- Title = 'test3',
- PathOnClient = '/' + 'Test3.txt',
- VersionData = Blob.valueOf('test data 3'),
- IsMajorVersion = true
- )
- );
- insert cvList;
- // retrieve Ids for ContentDocuments created on insert of ContentVersions
- list<Id> cdIdList = new List<Id>();
- for (ContentDocument cd : [
- SELECT Id, LatestPublishedVersionId
- FROM ContentDocument
- WHERE
- LatestPublishedVersionId = :cvList[0].Id
- OR LatestPublishedVersionId = :cvList[1].Id
- OR LatestPublishedVersionId = :cvList[2].Id
- ORDER BY Title
- ]) {
- cdIdList.add(cd.Id);
- }
- system.assertEquals(3, cdIdList.size());
- list<ContentDocumentLink> cdlList = new List<ContentDocumentLink>();
- cdlList.add(
- new ContentDocumentLink(
- ContentDocumentId = cdIdList[0],
- LinkedEntityId = consOrder.Id,
- ShareType = 'V'
- )
- );
- insert cdlList;
- LexSummonsCreatController.saveFile(
- consOrder.Id,
- 'A-65224941-20200923--1.docx',
- 'Unit Test Attachment Body'
- );
- LexSummonsCreatController.getFiles(consOrder.Id);
- LexSummonsCreatController.deleteAtt(cvList[0].Id);
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'CDS',
- Category4__c = 'OER',
- Category5__c = 'Celon',
- SFDA_Status__c = '鏈夊姽',
- Product_Status__c = '姝e父閿�鍞�',
- SFDA_Approbated_Status__c = '鏈夋晥',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 1,
- SFDA_Expiration_Date__c = Date.today(),
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
- //鍙戣揣
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend.Order_ForDealerText__c = 'Testaccount003';
- createIdSend.Order_ForCustomerText__c = 'Test000';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
+ // create ContentVersions
+ list<ContentVersion> cvList = new list<ContentVersion>();
+ cvList.add( new ContentVersion(Title = 'test1',PathOnClient ='/' + 'Test1.txt' ,VersionData = Blob.valueOf('test data 1'), IsMajorVersion = true) );
+ cvList.add( new ContentVersion(Title = 'test2',PathOnClient ='/' + 'Test2.txt' ,VersionData = Blob.valueOf('test data 2'), IsMajorVersion = true) );
+ cvList.add( new ContentVersion(Title = 'test3',PathOnClient ='/' + 'Test3.txt' ,VersionData = Blob.valueOf('test data 3'), IsMajorVersion = true) );
+ insert cvList;
+ // retrieve Ids for ContentDocuments created on insert of ContentVersions
+ list<Id> cdIdList = new list<Id>();
+ for (ContentDocument cd : [SELECT Id, LatestPublishedVersionId
+ FROM ContentDocument
+ WHERE (LatestPublishedVersionId =:cvList[0].Id OR LatestPublishedVersionId =:cvList[1].Id OR LatestPublishedVersionId =:cvList[2].Id)
+ ORDER BY Title])
+ {
+ cdIdList.add(cd.Id);
+ }
+ system.assertEquals(3, cdIdList.size());
+ list<ContentDocumentLink> cdlList = new list<ContentDocumentLink>();
+ cdlList.add(new ContentDocumentLink(ContentDocumentId=cdIdList[0], LinkedEntityId=consOrder.Id, ShareType='V'));
+ insert cdlList;
+ LexSummonsCreatController.saveFile(consOrder.Id,'A-65224941-20200923--1.docx','Unit Test Attachment Body');
+ LexSummonsCreatController.getFiles(consOrder.Id);
+ LexSummonsCreatController.deleteAtt(cvList[0].Id);
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'CDS',Category4__c = 'OER',Category5__c = 'Celon',
+ SFDA_Status__c = '鏈夊姽',Product_Status__c = '姝e父閿�鍞�',SFDA_Approbated_Status__c = '鏈夋晥',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 1,
+ SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+ //鍙戣揣
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend.Order_ForCustomerText__c = 'Test000';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend1.Name = 'testMing2';
- createIdSend1.Order_status__c = '鎵瑰噯';
- createIdSend1.Deliver_date__c = Date.today();
- createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend1.Order_type__c = '璁㈠崟';
- createIdSend1.Order_ProType__c = 'ENG';
- createIdSend1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- createIdSend1.Order_ForCustomerText__c = '';
- createIdSend1.Order_ForDealerText__c = 'Testaccount003';
- createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend1.Dealer_Info__c = accountItem1.Id;
- createIdSend1.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend1.Name = 'testMing2';
+ createIdSend1.Order_status__c = '鎵瑰噯';
+ createIdSend1.Deliver_date__c = Date.today();
+ createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend1.Order_type__c = '璁㈠崟';
+ createIdSend1.Order_ProType__c = 'ENG';
+ createIdSend1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ createIdSend1.Order_ForCustomerText__c = '';
+ createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend1.Dealer_Info__c = accountItem1.Id;
+ createIdSend1.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend2 = new Consumable_order__c();
- createIdSend2.Name = 'testMing2';
- createIdSend2.Order_status__c = '鎵瑰噯';
- createIdSend2.Deliver_date__c = Date.today();
- createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend2.Order_type__c = '璁㈠崟';
- createIdSend2.Order_ProType__c = 'ENG';
- createIdSend2.SummonsForDirction__c = '';
- createIdSend2.Order_ForCustomerText__c = '';
- createIdSend2.Order_ForDealerText__c = 'Testaccount003';
- createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend2.Dealer_Info__c = accountItem1.Id;
- createIdSend2.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend2 = new Consumable_order__c();
+ createIdSend2.Name = 'testMing2';
+ createIdSend2.Order_status__c = '鎵瑰噯';
+ createIdSend2.Deliver_date__c = Date.today();
+ createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend2.Order_type__c = '璁㈠崟';
+ createIdSend2.Order_ProType__c = 'ENG';
+ createIdSend2.SummonsForDirction__c = '';
+ createIdSend2.Order_ForCustomerText__c = '';
+ createIdSend2.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend2.Dealer_Info__c = accountItem1.Id;
+ createIdSend2.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend3 = new Consumable_order__c();
- createIdSend3.Name = 'testMing123456';
- createIdSend3.Order_status__c = '鎵瑰噯';
- createIdSend3.Deliver_date__c = Date.today();
- createIdSend3.Arrive_Order__c = createIdSend.Id;
- createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend3.Order_type__c = '璁㈠崟';
- createIdSend3.Order_ProType__c = 'ENG';
- createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend3.Order_ForDealerText__c = '';
- createIdSend3.Order_ForCustomerText__c = 'Test001';
- createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend3.Dealer_Info__c = accountItem1.Id;
- createIdSend3.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend3 = new Consumable_order__c();
+ createIdSend3.Name = 'testMing123456';
+ createIdSend3.Order_status__c = '鎵瑰噯';
+ createIdSend3.Deliver_date__c = Date.today();
+ createIdSend3.Arrive_Order__c = createIdSend.Id;
+ createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend3.Order_type__c = '璁㈠崟';
+ createIdSend3.Order_ProType__c = 'ENG';
+ createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend3.Order_ForDealerText__c = '';
+ createIdSend3.Order_ForCustomerText__c = 'Test001';
+ createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend3.Dealer_Info__c = accountItem1.Id;
+ createIdSend3.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend4 = new Consumable_order__c();
+ createIdSend4.Name = 'testMing1';
+ createIdSend4.Order_status__c = '鎵瑰噯';
+ createIdSend4.Deliver_date__c = Date.today();
+ createIdSend4.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend4.Order_type__c = '璁㈠崟';
+ createIdSend4.Order_ProType__c = 'ENG';
+ createIdSend4.SummonsForDirction__c = '鍖婚櫌璇曠敤';
+ createIdSend4.Order_ForDealerText__c = '';
+ createIdSend4.Order_ForCustomerText__c = 'Test000';
+ createIdSend4.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend4.Dealer_Info__c = accountItem1.Id;
+ createIdSend4.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend4 = new Consumable_order__c();
- createIdSend4.Name = 'testMing1';
- createIdSend4.Order_status__c = '鎵瑰噯';
- createIdSend4.Deliver_date__c = Date.today();
- createIdSend4.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend4.Order_type__c = '璁㈠崟';
- createIdSend4.Order_ProType__c = 'ENG';
- createIdSend4.SummonsForDirction__c = '鍖婚櫌璇曠敤';
- createIdSend4.Order_ForDealerText__c = '';
- createIdSend4.Order_ForCustomerText__c = 'Test000';
- createIdSend4.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend4.Dealer_Info__c = accountItem1.Id;
- createIdSend4.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend5 = new Consumable_order__c();
+ createIdSend5.Name = 'testMing1111111';
+ createIdSend5.Order_status__c = '鎵瑰噯';
+ createIdSend5.Deliver_date__c = Date.today();
+ createIdSend5.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend5.Order_type__c = '璁㈠崟';
+ createIdSend5.Order_ProType__c = 'ENG';
+ createIdSend5.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+ createIdSend5.Order_ForDealerText__c = '';
+ createIdSend5.Order_ForCustomerText__c = '';
+ createIdSend5.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend5.Dealer_Info__c = accountItem1.Id;
+ createIdSend5.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend5 = new Consumable_order__c();
- createIdSend5.Name = 'testMing1111111';
- createIdSend5.Order_status__c = '鎵瑰噯';
- createIdSend5.Deliver_date__c = Date.today();
- createIdSend5.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend5.Order_type__c = '璁㈠崟';
- createIdSend5.Order_ProType__c = 'ENG';
- createIdSend5.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
- createIdSend5.Order_ForDealerText__c = '';
- createIdSend5.Order_ForCustomerText__c = '';
- createIdSend5.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend5.Dealer_Info__c = accountItem1.Id;
- createIdSend5.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend6 = new Consumable_order__c();
+ createIdSend6.Name = 'testMing222222';
+ createIdSend6.Order_status__c = '鎵瑰噯';
+ createIdSend6.Deliver_date__c = Date.today();
+ createIdSend6.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend6.Order_type__c = '璁㈠崟';
+ createIdSend6.Order_ProType__c = 'ENG';
+ createIdSend6.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+ createIdSend6.Order_ForDealerText__c = '';
+ createIdSend6.Order_ForCustomerText__c = '';
+ createIdSend6.SummonsStatus_c__c = '';
+ createIdSend6.Dealer_Info__c = accountItem1.Id;
+ createIdSend6.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend7 = new Consumable_order__c();
+ createIdSend7.Name = 'testMing222222';
+ createIdSend7.Order_status__c = '鎵瑰噯';
+ createIdSend7.Deliver_date__c = Date.today();
+ createIdSend7.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend7.Order_type__c = '璁㈠崟';
+ createIdSend7.Order_ProType__c = 'ENG';
+ createIdSend7.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend7.Order_ForDealerText__c = '';
+ createIdSend7.Order_ForCustomerText__c = '';
+ createIdSend7.SummonsStatus_c__c = '';
+ createIdSend7.Dealer_Info__c = accountItem1.Id;
+ createIdSend7.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend8 = new Consumable_order__c();
+ createIdSend8.Name = 'testMing222222';
+ createIdSend8.Order_status__c = '鎵瑰噯';
+ createIdSend8.Deliver_date__c = Date.today();
+ createIdSend8.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend8.Order_type__c = '璁㈠崟';
+ createIdSend8.Order_ProType__c = 'ENG';
+ createIdSend8.SummonsForDirction__c = '娴嬭瘯001';
+ createIdSend8.Order_ForDealerText__c = '';
+ createIdSend8.Order_ForCustomerText__c = '';
+ createIdSend8.SummonsStatus_c__c = '';
+ createIdSend8.Dealer_Info__c = accountItem1.Id;
+ createIdSend8.Delivery_detail_count__c = 5;
- Consumable_order__c createIdSend6 = new Consumable_order__c();
- createIdSend6.Name = 'testMing222222';
- createIdSend6.Order_status__c = '鎵瑰噯';
- createIdSend6.Deliver_date__c = Date.today();
- createIdSend6.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend6.Order_type__c = '璁㈠崟';
- createIdSend6.Order_ProType__c = 'ENG';
- createIdSend6.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
- createIdSend6.Order_ForDealerText__c = '';
- createIdSend6.Order_ForCustomerText__c = '';
- createIdSend6.SummonsStatus_c__c = '';
- createIdSend6.Dealer_Info__c = accountItem1.Id;
- createIdSend6.Delivery_detail_count__c = 5;
+ //鍙戠エ淇℃伅
+ Consumable_order__c createIdSend9 = new Consumable_order__c();
+ createIdSend9.Name = 'invoice01';
+ createIdSend9.Invoice_status__c='宸插畬鎴�';
+ createIdSend9.Order_type__c = '鍙戠エ';
+ createIdSend9.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ createIdSend9.Order_status__c = '鑽夋涓�';
+ createIdSend9.Invoice_Date__c = Date.Today();
+ createIdSend9.Order_ProType__c = 'ENG';
+ createIdSend9.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- Consumable_order__c createIdSend7 = new Consumable_order__c();
- createIdSend7.Name = 'testMing222222';
- createIdSend7.Order_status__c = '鎵瑰噯';
- createIdSend7.Deliver_date__c = Date.today();
- createIdSend7.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend7.Order_type__c = '璁㈠崟';
- createIdSend7.Order_ProType__c = 'ENG';
- createIdSend7.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend7.Order_ForDealerText__c = '';
- createIdSend7.Order_ForCustomerText__c = '';
- createIdSend7.SummonsStatus_c__c = '';
- createIdSend7.Dealer_Info__c = accountItem1.Id;
- createIdSend7.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend10 = new Consumable_order__c();
+ createIdSend10.Name = 'OCMtest';
+ createIdSend10.Order_status__c = '鎵瑰噯';
+ createIdSend10.Order_type__c = '鍒拌揣';
+ createIdSend10.Dealer_Info__c = accountItem1.Id;
+ createIdSend10.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ createIdSend10.Order_ProType__c = 'ET';
- Consumable_order__c createIdSend8 = new Consumable_order__c();
- createIdSend8.Name = 'testMing222222';
- createIdSend8.Order_status__c = '鎵瑰噯';
- createIdSend8.Deliver_date__c = Date.today();
- createIdSend8.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend8.Order_type__c = '璁㈠崟';
- createIdSend8.Order_ProType__c = 'ENG';
- createIdSend8.SummonsForDirction__c = '娴嬭瘯001';
- createIdSend8.Order_ForDealerText__c = '';
- createIdSend8.Order_ForCustomerText__c = '';
- createIdSend8.SummonsStatus_c__c = '';
- createIdSend8.Dealer_Info__c = accountItem1.Id;
- createIdSend8.Delivery_detail_count__c = 5;
+ Consumable_order__c createIdSend11 = new Consumable_order__c();
+ createIdSend11.Name = 'OCM_01_002';
+ createIdSend11.Order_status__c = '鎵瑰噯';
+ createIdSend11.Order_type__c = '浼犵エ';
+ createIdSend11.Arrive_Order__c = createIdSend9.Id;
+ createIdSend11.Dealer_Info__c = accountItem1.Id;
+ createIdSend11.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ createIdSend11.RecordTypeid = System.Label.RT_ConOrder_Order;
+ createIdSend11.Order_ProType__c = 'ET';
- //鍙戠エ淇℃伅
- Consumable_order__c createIdSend9 = new Consumable_order__c();
- createIdSend9.Name = 'invoice01';
- createIdSend9.Invoice_status__c = '宸插畬鎴�';
- createIdSend9.Order_type__c = '鍙戠エ';
- createIdSend9.RecordTypeid = System.Label.RT_ConOrder_Invoice;
- createIdSend9.Order_status__c = '鑽夋涓�';
- createIdSend9.Invoice_Date__c = Date.Today();
- createIdSend9.Order_ProType__c = 'ENG';
- createIdSend9.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ Consumable_order__c testList1 = new Consumable_order__c();
+ testList1.Name='Test1';
+ testList1.Summons_Sale_Status__c='鍑鸿揣';
+ testList1.SummonsStatus_c__c='宸插畬鎴�';
+ testList1.Arrive_Order__c = createIdSend9.Id;
+ testList1.SummonsForDirction__c='鐩存帴閿�鍞粰鍖婚櫌';
+ testList1.Order_status__c='鑽夋涓�';
+ testList1.Order_type__c='浼犵エ';
+ testList1.Dealer_info__c=accountItem1.Id;
+ testList1.ConInvoice_Code__c = createIdSend9.id;
- Consumable_order__c createIdSend10 = new Consumable_order__c();
- createIdSend10.Name = 'OCMtest';
- createIdSend10.Order_status__c = '鎵瑰噯';
- createIdSend10.Order_type__c = '鍒拌揣';
- createIdSend10.Dealer_Info__c = accountItem1.Id;
- createIdSend10.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- createIdSend10.Order_ProType__c = 'ET';
+ //鍒拌揣
+ Consumable_order__c createIdArrived = new Consumable_order__c();
+ createIdArrived.Name = 'testMing2';
+ createIdArrived.Order_status__c = '鎵瑰噯';
+ createIdArrived.Deliver_date__c = Date.today();
+ createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ createIdArrived.Order_type__c = '璁㈠崟';
+ createIdArrived.Order_ProType__c = 'ET';
+ createIdArrived.orderPattern__c = 'promotionorder';
+ createIdArrived.Dealer_Info__c = accountItem1.Id;
+ createIdArrived.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[]{createIdSend,createIdSend1,createIdSend2,createIdSend3,createIdSend4,createIdSend5,createIdSend6,createIdSend7,createIdSend8,createIdSend9,createIdSend10,createIdSend11,createIdArrived,testList1};
+
+ System.debug('createIdSend9.id = ' + createIdSend9.id);
- Consumable_order__c createIdSend11 = new Consumable_order__c();
- createIdSend11.Name = 'OCM_01_002';
- createIdSend11.Order_status__c = '鎵瑰噯';
- createIdSend11.Order_type__c = '浼犵エ';
- createIdSend11.Arrive_Order__c = createIdSend9.Id;
- createIdSend11.Dealer_Info__c = accountItem1.Id;
- createIdSend11.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- createIdSend11.RecordTypeid = System.Label.RT_ConOrder_Order;
- createIdSend11.Order_ProType__c = 'ET';
+ Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =createIdSend9.Id);
+ insert new Consumable_order_LinkTable__c[]{order_LinkTable1};
- Consumable_order__c testList1 = new Consumable_order__c();
- testList1.Name = 'Test1';
- testList1.Summons_Sale_Status__c = '鍑鸿揣';
- testList1.SummonsStatus_c__c = '宸插畬鎴�';
- testList1.Arrive_Order__c = createIdSend9.Id;
- testList1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- testList1.Order_status__c = '鑽夋涓�';
- testList1.Order_type__c = '浼犵エ';
- testList1.Dealer_info__c = accountItem1.Id;
- testList1.ConInvoice_Code__c = createIdSend9.id;
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = 999.00;
+ coc.Shipment_Count__c = null;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- //鍒拌揣
- Consumable_order__c createIdArrived = new Consumable_order__c();
- createIdArrived.Name = 'testMing2';
- createIdArrived.Order_status__c = '鎵瑰噯';
- createIdArrived.Deliver_date__c = Date.today();
- createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- createIdArrived.Order_type__c = '璁㈠崟';
- createIdArrived.Order_ProType__c = 'ET';
- createIdArrived.orderPattern__c = 'promotionorder';
- createIdArrived.Dealer_Info__c = accountItem1.Id;
- createIdArrived.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{
- createIdSend,
- createIdSend1,
- createIdSend2,
- createIdSend3,
- createIdSend4,
- createIdSend5,
- createIdSend6,
- createIdSend7,
- createIdSend8,
- createIdSend9,
- createIdSend10,
- createIdSend11,
- createIdArrived,
- testList1
- };
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too001';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '鐩�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend3.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = 999.00;
+ coc1.Shipment_Count__c = 9999.00;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- System.debug('createIdSend9.id = ' + createIdSend9.id);
+ Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+ coc2.Name = 'Too001';
+ coc2.Dealer_Custom_Price__c = 999.00;
+ coc2.Consumable_count__c = 3;
+ coc2.Consumable_product__c = pro1.Id;
+ coc2.Box_Piece__c = '鐩�';
+ coc2.isOutPattern__c = true;
+ coc2.Consumable_order__c = createIdSend3.Id;
+ coc2.Unitprice_To_agency__c = 999.00;
+ coc2.Delivery_List_RMB__c = -999.00;
+ coc2.Shipment_Count__c = 9999.00;
+ coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1,coc2};
- Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
- Name = 'order_LinkTable1',
- Outboundorder_Code_link__c = testList1.Id,
- Invoice_Code_link__c = createIdSend9.Id
- );
- insert new List<Consumable_order_LinkTable__c>{ order_LinkTable1 };
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdArrived.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdArrived.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.exchangeOutPattern__c = false;
+ conOrderDetail1.Cancellation_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ conOrderDetail1.Sterilization_limit__c = Date.Today();
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert new hospitalprice__c[]{hp1};
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = 999.00;
- coc.Shipment_Count__c = null;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Dealer_elationship__c dealerelationship = new Dealer_elationship__c(Dealer_principal__c = accountItem1.id,Dealer_subordinate__c = accountItem1.id);
+ Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(Dealer_principal__c = accountItem1.id,Dealer_subordinate__c = accountItem1.id);
+ insert new Dealer_elationship__c[] {dealerelationship, dealerelationship1};
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too001';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '鐩�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend3.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = 999.00;
- coc1.Shipment_Count__c = 9999.00;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ LexSummonsCreatController.ConsumableorderdetailsInfo c0 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ c0.packinglist = 0;
+ c0.approbation_No = null;
+ c0.expiration_Date = Date.Today();
+ c0.boxorpiecein = null;
+ c0.hospitalSpecialOffer = true;
+ LexSummonsCreatController.ConsumableorderdetailsInfo c1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(coc);
+ c1.check = true;
+ c1.oldCheck = true;
+ c1.orderdetails1 = coc;
+ c1.orderdetails2 = null;
+ c1.Prod = coc.Consumable_Product__r;
+ c1.oldConsumableCount = coc.Shipment_Count__c;
+ c1.canSelect = true;
+ c1.allnumber = 0.00;
+ c1.Boxnumber = 0.00;
+ c1.Piecenumber = 0.00;
+ c1.BoxPiece = coc.Box_Piece__c;
+ c1.hospitalSpecialOffer = true;
+ c1.hosPro = false;
+ List<SelectOption> boxorpiece = new List<SelectOption>();
+ boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ boxorpiece.add(new SelectOption('涓�', '涓�'));
+ Map<String, String> boxorpieceMap = new Map<String, String>();
+ boxorpieceMap.put('鐩�', '鐩�');
+ boxorpieceMap.put('涓�', '涓�');
+ LexSummonsCreatController.ConsumableorderdetailsInfo coder = new LexSummonsCreatController.ConsumableorderdetailsInfo(conOrderDetail1);
+ coder.check = true;
+ coder.oldCheck = true;
+ coder.hospitalSpecialOffer = true;
+ coder.orderdetails1 = null;
+ coder.orderdetails2 = conOrderDetail1;
+ coder.Prod = conOrderDetail1.Consumable_Product__r;
+ coder.canSelect = true;
+ coder.allnumber = 0;
+ coder.Boxnumber = 0;
+ coder.Piecenumber = 0;
+ coder.hosPro = false;
+ LexSummonsCreatController.ConsumableorderdetailsInfo c2 = new LexSummonsCreatController.ConsumableorderdetailsInfo(pro1);
+ c2.sortBy = true;
+ c2.Boxnumber = 20;
+ c1.compareTo(c2);
+ c1.Boxnumber = 20;
+ c2.Boxnumber = 10;
+ c1.compareTo(c2);
+ c1.Boxnumber = 10;
+ c2.Boxnumber = 20;
+ c2.compareTo(c1);
+ c1.Boxnumber = 20;
+ c2.Boxnumber = 10;
+ c2.compareTo(c1);
+ LexSummonsCreatController.ConsumableorderdetailsInfo c3 = new LexSummonsCreatController.ConsumableorderdetailsInfo(pro1);
+ c3.sortBy = false;
+ c3.Boxnumber = 10;
+ c1.compareTo(c3);
+ c1.Boxnumber = 20;
+ c3.Boxnumber = 10;
+ c1.compareTo(c3);
+ c3.Boxnumber = 10;
+ c1.Boxnumber = 20;
+ c3.compareTo(c1);
+ c3.Boxnumber = 20;
+ c3.Boxnumber = 10;
+ c1.compareTo(c1);
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c4.check = true;
+ c4.oldCheck = true;
+ c4.orderdetails1 = null;
+ c4.orderdetails2 = null;
+ c4.Prod = null;
+ c4.Boxnumber = 0.00;
+ c4.Piecenumber = 0.00;
+ c4.allnumber = 0.00;
+ c4.oldConsumableCount = 0.00;
+ c4.canSelect = true;
+ c4.sortBy = true;
+ c4.packinglist = 1;
+ c4.approbation_No = null;
+ c4.expiration_Date = Date.Today();
+ c4.boxorpiecein = null;
+ c4.boxorpiece = null;
+ c4.boxorpieceMap = null;
+ c4.concc = null;
+ c4.BoxPiece = null;
+ c4.hospitalSpecialOffer = true;
+ c4.hosPro = true;
+ c4.unitOptions = null;
+ c4.unitValue = null;
+ c4.shipmentNumber = 1;
+ c4.shippingUnitPrice = 0.00;
+ c4.recordId = null;
+ c4.Id = null;
+ c4.Name = null;
+ c4.Category3 = null;
+ c4.Category4 = null;
+ c4.Category5 = null;
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c5.check = true;
+ c5.orderdetails1 = coc;
+ c5.hospitalSpecialOffer = true;
+ c5.allnumber = 1999.00;
+ pageRecordsLwcLwc.add(c5);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c6.check = true;
+ c6.oldCheck = true;
+ c6.hospitalSpecialOffer = true;
+ c6.orderdetails1 = coc1;
+ c6.orderdetails2 = conOrderDetail1;
+ c6.Prod = pro1;
+ c6.Boxnumber = 0.00;
+ c6.Piecenumber = 0.00;
+ c6.allnumber = 1999.00;
+ c6.oldConsumableCount = 1999.00;
+ c6.canSelect = true;
+ c6.sortBy = true;
+ c6.packinglist = 1;
+ c6.approbation_No = '';
+ c6.expiration_Date = Date.Today();
+ c6.boxorpiecein = '';
+ c6.boxorpiece = null;
+ c6.boxorpieceMap = null;
+ c6.concc = null;
+ c6.BoxPiece = null;
+ c6.hosPro = true;
+ pageRecords.add(c6);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c7.check = true;
+ c7.oldCheck = true;
+ c7.hospitalSpecialOffer = true;
+ c7.orderdetails1 = coc2;
+ c7.orderdetails2 = conOrderDetail1;
+ c7.Prod = pro1;
+ c7.Boxnumber = 0.00;
+ c7.Piecenumber = 0.00;
+ c7.allnumber = 1999.00;
+ c7.oldConsumableCount = 1999.00;
+ c7.canSelect = true;
+ c7.sortBy = true;
+ c7.packinglist = 1;
+ c7.approbation_No = '';
+ c7.expiration_Date = Date.Today();
+ c7.boxorpiecein = '';
+ c7.boxorpiece = null;
+ c7.boxorpieceMap = null;
+ c7.concc = null;
+ c7.BoxPiece = null;
+ c7.hosPro = true;
+ pageRecordsLwc.add(c7);
- Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
- coc2.Name = 'Too001';
- coc2.Dealer_Custom_Price__c = 999.00;
- coc2.Consumable_count__c = 3;
- coc2.Consumable_product__c = pro1.Id;
- coc2.Box_Piece__c = '鐩�';
- coc2.isOutPattern__c = true;
- coc2.Consumable_order__c = createIdSend3.Id;
- coc2.Unitprice_To_agency__c = 999.00;
- coc2.Delivery_List_RMB__c = -999.00;
- coc2.Shipment_Count__c = 9999.00;
- coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2 };
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ List<SelectOption> categoryOptionList = new List<SelectOption>();
+ System.Test.startTest();
+ Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+ String ESetId = null;
+ String statusEdit = null;
+ String arrive = null;
+ String alertMessage = null;
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdArrived.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdArrived.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.exchangeOutPattern__c = false;
- conOrderDetail1.Cancellation_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- conOrderDetail1.Sterilization_limit__c = Date.Today();
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
-
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert new List<hospitalprice__c>{ hp1 };
-
- Dealer_elationship__c dealerelationship = new Dealer_elationship__c(
- Dealer_principal__c = accountItem1.id,
- Dealer_subordinate__c = accountItem1.id
- );
- Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(
- Dealer_principal__c = accountItem1.id,
- Dealer_subordinate__c = accountItem1.id
- );
- insert new List<Dealer_elationship__c>{
- dealerelationship,
- dealerelationship1
- };
-
- LexSummonsCreatController.ConsumableorderdetailsInfo c0 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- c0.packinglist = 0;
- c0.approbation_No = null;
- c0.expiration_Date = Date.Today();
- c0.boxorpiecein = null;
- c0.hospitalSpecialOffer = true;
- LexSummonsCreatController.ConsumableorderdetailsInfo c1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
- coc
- );
- c1.check = true;
- c1.oldCheck = true;
- c1.orderdetails1 = coc;
- c1.orderdetails2 = null;
- c1.Prod = coc.Consumable_Product__r;
- c1.oldConsumableCount = coc.Shipment_Count__c;
- c1.canSelect = true;
- c1.allnumber = 0.00;
- c1.Boxnumber = 0.00;
- c1.Piecenumber = 0.00;
- c1.BoxPiece = coc.Box_Piece__c;
- c1.hospitalSpecialOffer = true;
- c1.hosPro = false;
- List<SelectOption> boxorpiece = new List<SelectOption>();
- boxorpiece.add(new SelectOption('鐩�', '鐩�'));
- boxorpiece.add(new SelectOption('涓�', '涓�'));
- Map<String, String> boxorpieceMap = new Map<String, String>();
- boxorpieceMap.put('鐩�', '鐩�');
- boxorpieceMap.put('涓�', '涓�');
- LexSummonsCreatController.ConsumableorderdetailsInfo coder = new LexSummonsCreatController.ConsumableorderdetailsInfo(
- conOrderDetail1
- );
- coder.check = true;
- coder.oldCheck = true;
- coder.hospitalSpecialOffer = true;
- coder.orderdetails1 = null;
- coder.orderdetails2 = conOrderDetail1;
- coder.Prod = conOrderDetail1.Consumable_Product__r;
- coder.canSelect = true;
- coder.allnumber = 0;
- coder.Boxnumber = 0;
- coder.Piecenumber = 0;
- coder.hosPro = false;
- LexSummonsCreatController.ConsumableorderdetailsInfo c2 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
- pro1
- );
- c2.sortBy = true;
- c2.Boxnumber = 20;
- c1.compareTo(c2);
- c1.Boxnumber = 20;
- c2.Boxnumber = 10;
- c1.compareTo(c2);
- c1.Boxnumber = 10;
- c2.Boxnumber = 20;
- c2.compareTo(c1);
- c1.Boxnumber = 20;
- c2.Boxnumber = 10;
- c2.compareTo(c1);
- LexSummonsCreatController.ConsumableorderdetailsInfo c3 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
- pro1
- );
- c3.sortBy = false;
- c3.Boxnumber = 10;
- c1.compareTo(c3);
- c1.Boxnumber = 20;
- c3.Boxnumber = 10;
- c1.compareTo(c3);
- c3.Boxnumber = 10;
- c1.Boxnumber = 20;
- c3.compareTo(c1);
- c3.Boxnumber = 20;
- c3.Boxnumber = 10;
- c1.compareTo(c1);
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c4.check = true;
- c4.oldCheck = true;
- c4.orderdetails1 = null;
- c4.orderdetails2 = null;
- c4.Prod = null;
- c4.Boxnumber = 0.00;
- c4.Piecenumber = 0.00;
- c4.allnumber = 0.00;
- c4.oldConsumableCount = 0.00;
- c4.canSelect = true;
- c4.sortBy = true;
- c4.packinglist = 1;
- c4.approbation_No = null;
- c4.expiration_Date = Date.Today();
- c4.boxorpiecein = null;
- c4.boxorpiece = null;
- c4.boxorpieceMap = null;
- c4.concc = null;
- c4.BoxPiece = null;
- c4.hospitalSpecialOffer = true;
- c4.hosPro = true;
- c4.unitOptions = null;
- c4.unitValue = null;
- c4.shipmentNumber = 1;
- c4.shippingUnitPrice = 0.00;
- c4.recordId = null;
- c4.Id = null;
- c4.Name = null;
- c4.Category3 = null;
- c4.Category4 = null;
- c4.Category5 = null;
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c5.check = true;
- c5.orderdetails1 = coc;
- c5.hospitalSpecialOffer = true;
- c5.allnumber = 1999.00;
- pageRecordsLwcLwc.add(c5);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c6.check = true;
- c6.oldCheck = true;
- c6.hospitalSpecialOffer = true;
- c6.orderdetails1 = coc1;
- c6.orderdetails2 = conOrderDetail1;
- c6.Prod = pro1;
- c6.Boxnumber = 0.00;
- c6.Piecenumber = 0.00;
- c6.allnumber = 1999.00;
- c6.oldConsumableCount = 1999.00;
- c6.canSelect = true;
- c6.sortBy = true;
- c6.packinglist = 1;
- c6.approbation_No = '';
- c6.expiration_Date = Date.Today();
- c6.boxorpiecein = '';
- c6.boxorpiece = null;
- c6.boxorpieceMap = null;
- c6.concc = null;
- c6.BoxPiece = null;
- c6.hosPro = true;
- pageRecords.add(c6);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c7.check = true;
- c7.oldCheck = true;
- c7.hospitalSpecialOffer = true;
- c7.orderdetails1 = coc2;
- c7.orderdetails2 = conOrderDetail1;
- c7.Prod = pro1;
- c7.Boxnumber = 0.00;
- c7.Piecenumber = 0.00;
- c7.allnumber = 1999.00;
- c7.oldConsumableCount = 1999.00;
- c7.canSelect = true;
- c7.sortBy = true;
- c7.packinglist = 1;
- c7.approbation_No = '';
- c7.expiration_Date = Date.Today();
- c7.boxorpiecein = '';
- c7.boxorpiece = null;
- c7.boxorpieceMap = null;
- c7.concc = null;
- c7.BoxPiece = null;
- c7.hosPro = true;
- pageRecordsLwc.add(c7);
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- consumable.add(codi);
- List<SelectOption> categoryOptionList = new List<SelectOption>();
- System.Test.startTest();
- Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
- String ESetId = null;
- String statusEdit = null;
- String arrive = null;
- String alertMessage = null;
-
- String category1 = '3400PK:PK閽� 5mm脳33cm';
- String Category3 = '鑵硅厰闀滄墜鏈�';
- String Category4 = 'PK';
- String Category5 = 'G400';
- LexSummonsCreatController.category1 = category1;
- LexSummonsCreatController.Category3 = Category3;
- LexSummonsCreatController.Category4 = Category4;
- LexSummonsCreatController.Category5 = Category5;
- LexSummonsCreatController.statusEdit = statusEdit;
- LexSummonsCreatController.alertMessage = alertMessage;
- LexSummonsCreatController.zaikuId = new List<String>();
- LexSummonsCreatController.categoryOptionMap = new Map<String, String>();
- LexSummonsCreatController.category4OptionMap = new Map<String, String>();
- LexSummonsCreatController.category5OptionMap = new Map<String, String>();
- LexSummonsCreatController.orderpieceorboxMap = new Map<String, String>();
- LexSummonsCreatController.orderagencypriceMap = new Map<String, Decimal>();
- LexSummonsCreatController.orderpriceMap = new Map<String, Decimal>();
- LexSummonsCreatController.orderdetCountMap = new Map<String, Decimal>();
- LexSummonsCreatController.hasSpecialHos = false;
- LexSummonsCreatController.outOutPattern = null;
- LexSummonsCreatController.provinceOptsMap = new Map<String, String>();
- LexSummonsCreatController.categoryOptionList = new List<SelectOption>();
- LexSummonsCreatController.category4OptionList = new List<SelectOption>();
- LexSummonsCreatController.category5OptionList = new List<SelectOption>();
- LexSummonsCreatController.outOutPatternOptionList = new List<SelectOption>();
- LexSummonsCreatController.orderdetails = new List<Consumable_orderdetails__c>();
- LexSummonsCreatController.consumableorderdetailsRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.consumableorderdetailsRecordserror = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- List<SelectOption> cityOpts1 = new List<SelectOption>();
- cityOpts1.add(new SelectOption('', '--鏃�--'));
- cityOpts1.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
- cityOpts1.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
- Map<String, String> optionMap = new Map<String, String>();
- optionMap.put('', '-鏃�-');
- optionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
- optionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
-
- Integer count = LexSummonsCreatController.consumableorderdetailsCount;
- Consumable_order__c cocOrderId = new Consumable_order__c();
- LexSummonsCreatController.coc = cocOrderId;
- String consumableorderId = LexSummonsCreatController.consumableorderId;
- LexSummonsCreatController summonCC = new LexSummonsCreatController();
-
- LexSummonsCreatController.init(
- testList1.Id,
- 'Test',
- 1,
- 100,
- testList1.Id
- );
- LexSummonsCreatController.firstInit(ESetId);
- LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
- LexSummonsCreatController.init(
- ESetId,
- statusEdit,
- 1,
- 100,
- createIdSend.Id
- );
- LexSummonsCreatController.init(
- createIdSend.Id,
- statusEdit,
- 1,
- 100,
- arrive
- );
- LexSummonsCreatController.init(
- createIdSend.Id,
- 'Test',
- 1,
- 100,
- createIdSend3.Id
- );
- LexSummonsCreatController.init(ESetId, 'Test', 1, 100, createIdSend.Id);
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ENG',
- 'Testaccount001',
- '鍖椾含',
- 'ishos',
- 'Test07',
- 'CDS',
- 'OER',
- 'Celon',
- true,
- pageRecords,
- consumable,
- '',
- 1,
- 100
- );
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ENG',
- 'Testaccount001',
- '鍖椾含',
- 'nothos',
- 'Test07',
- 'CDS',
- 'OER',
- 'Celon',
- true,
- pageRecords,
- consumable,
- '',
- 1,
- 100
- );
- LexSummonsCreatController.save(
- createIdSend2,
- '',
- '',
- '',
- pageRecordsLwcLwc,
- accountId,
- createIdSend2.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend1,
- '',
- '',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend1.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend1,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend1.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend7,
- '',
- '',
- accountItem1.Id,
- pageRecordsLwcLwc,
- accountId,
- createIdSend7.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend3,
- 'Test',
- 'Test',
- '',
- pageRecordsLwcLwc,
- accountId,
- createIdSend3.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend3,
- '',
- '',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend3.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend3,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend3.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend4,
- '',
- '',
- '',
- pageRecordsLwcLwc,
- accountId,
- createIdSend4.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend5,
- '',
- '',
- '',
- pageRecordsLwcLwc,
- accountId,
- createIdSend5.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend5,
- '',
- '',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend5.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend5,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwcLwc,
- accountId,
- createIdSend5.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend8,
- accountId,
- 'Test',
- accountId,
- pageRecords,
- accountId,
- createIdSend8.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend8,
- accountId,
- 'Test',
- null,
- pageRecordsLwc,
- accountId,
- createIdSend8.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.checkOutPattern();
- LexSummonsCreatController.PraseToPDF(createIdSend, createIdSend.Id);
- LexSummonsCreatController.search('Testaccount001');
- LexSummonsCreatController.GoodsDelivery(
- createIdSend,
- createIdSend.Id,
- pageRecordsLwcLwc
- );
- LexSummonsCreatController.GoodsDelivery(
- createIdSend3,
- createIdSend3.Id,
- pageRecords
- );
- LexSummonsCreatController.GoodsDelivery(
- createIdSend1,
- createIdSend1.Id,
- pageRecordsLwcLwc
- );
- LexSummonsCreatController.GoodsDelivery(
- createIdSend6,
- createIdSend6.Id,
- pageRecordsLwcLwc
- );
- LexSummonsCreatController.DelConsumable(createIdSend.Id);
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testSaveMethod() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id,
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true,
- BillingCity = null
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
- createIdSend.Order_ForDealerText__c = 'Testaccount003';
- createIdSend.Order_ForCustomerText__c = 'Test000';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend1.Name = 'testMing1';
- createIdSend1.Order_status__c = '鎵瑰噯';
- createIdSend1.Deliver_date__c = Date.today();
- createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend1.Order_type__c = '璁㈠崟';
- createIdSend1.Order_ProType__c = 'ENG';
- createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
- createIdSend1.Order_ForDealerText__c = 'Testaccount003';
- createIdSend1.Order_ForCustomerText__c = 'Test000';
- createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
- createIdSend1.Dealer_Info__c = accountItem1.Id;
- createIdSend1.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = -999.00;
- coc.Shipment_Count__c = 9999.00;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too001';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '鐩�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = null;
- coc1.Shipment_Count__c = 9999.00;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
- coc2.Name = 'Too001';
- coc2.Dealer_Custom_Price__c = 999.00;
- coc2.Consumable_count__c = 3;
- coc2.Consumable_product__c = pro1.Id;
- coc2.Box_Piece__c = '';
- coc2.isOutPattern__c = true;
- coc2.Consumable_order__c = createIdSend.Id;
- coc2.Unitprice_To_agency__c = 999.00;
- coc2.Delivery_List_RMB__c = 999.00;
- coc2.Shipment_Count__c = 9999.00;
- coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
- coc3.Name = 'Too001';
- coc3.Dealer_Custom_Price__c = 999.00;
- coc3.Consumable_count__c = 3;
- coc3.Consumable_product__c = pro1.Id;
- coc3.Box_Piece__c = '鐩�';
- coc3.isOutPattern__c = true;
- coc3.Consumable_order__c = createIdSend1.Id;
- coc3.Unitprice_To_agency__c = 999.00;
- coc3.Delivery_List_RMB__c = 100.00;
- coc3.Shipment_Count__c = 9999.00;
- coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2, coc3 };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Cancellation_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- conOrderDetail1.Sterilization_limit__c = Date.Today();
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c0.check = true;
- c0.oldCheck = true;
- c0.hospitalSpecialOffer = true;
- c0.orderdetails1 = coc;
- c0.orderdetails2 = conOrderDetail1;
- c0.Prod = pro1;
- c0.Boxnumber = 0.00;
- c0.Piecenumber = 0.00;
- c0.allnumber = 1999.00;
- c0.oldConsumableCount = 1999.00;
- c0.canSelect = true;
- c0.sortBy = true;
- c0.packinglist = 1;
- c0.approbation_No = '';
- c0.expiration_Date = Date.Today();
- c0.boxorpiecein = '';
- c0.boxorpiece = null;
- c0.boxorpieceMap = null;
- c0.concc = null;
- c0.BoxPiece = null;
- c0.hosPro = true;
- pageRecords.add(c0);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c1.check = true;
- c1.oldCheck = false;
- c1.hospitalSpecialOffer = true;
- c1.orderdetails1 = coc1;
- c1.orderdetails2 = conOrderDetail1;
- c1.Prod = pro1;
- c1.Boxnumber = 0.00;
- c1.Piecenumber = 0.00;
- c1.allnumber = 1999.00;
- c1.oldConsumableCount = 1999.00;
- c1.canSelect = true;
- c1.sortBy = true;
- c1.packinglist = 1;
- c1.approbation_No = '';
- c1.expiration_Date = Date.Today();
- c1.boxorpiecein = '';
- c1.boxorpiece = null;
- c1.boxorpieceMap = null;
- c1.concc = null;
- c1.BoxPiece = null;
- c1.hosPro = true;
- pageRecords1.add(c1);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c2.check = true;
- c2.oldCheck = false;
- c2.hospitalSpecialOffer = true;
- c2.orderdetails1 = coc2;
- c2.orderdetails2 = conOrderDetail1;
- c2.Prod = pro1;
- c2.Boxnumber = 0.00;
- c2.Piecenumber = 0.00;
- c2.allnumber = 1999.00;
- c2.oldConsumableCount = 1999.00;
- c2.canSelect = true;
- c2.sortBy = true;
- c2.packinglist = 1;
- c2.approbation_No = '';
- c2.expiration_Date = Date.Today();
- c2.boxorpiecein = '';
- c2.boxorpiece = null;
- c2.boxorpieceMap = null;
- c2.concc = null;
- c2.BoxPiece = null;
- c2.hosPro = true;
- pageRecords2.add(c2);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c3.check = true;
- c3.oldCheck = false;
- c3.hospitalSpecialOffer = true;
- c3.orderdetails1 = coc3;
- c3.orderdetails2 = conOrderDetail1;
- c3.Prod = pro1;
- c3.Boxnumber = 0.00;
- c3.Piecenumber = 0.00;
- c3.allnumber = 1999.00;
- c3.oldConsumableCount = 1999.00;
- c3.canSelect = true;
- c3.sortBy = true;
- c3.packinglist = 1;
- c3.approbation_No = '';
- c3.expiration_Date = Date.Today();
- c3.boxorpiecein = '';
- c3.boxorpiece = null;
- c3.boxorpieceMap = null;
- c3.concc = null;
- c3.BoxPiece = null;
- c3.hosPro = true;
- pageRecords3.add(c3);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords0 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c001 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c001.check = true;
- c001.oldCheck = true;
- c001.hospitalSpecialOffer = true;
- c001.orderdetails1 = coc3;
- c001.orderdetails2 = conOrderDetail1;
- c001.Prod = pro1;
- c001.Boxnumber = 0.00;
- c001.Piecenumber = 0.00;
- c001.allnumber = 1999.00;
- c001.oldConsumableCount = 1999.00;
- c001.canSelect = true;
- c001.sortBy = true;
- c001.packinglist = 1;
- c001.approbation_No = '';
- c001.expiration_Date = Date.Today();
- c001.boxorpiecein = '';
- c001.boxorpiece = null;
- c001.boxorpieceMap = null;
- c001.concc = null;
- c001.BoxPiece = null;
- c001.hosPro = true;
- pageRecords0.add(c001);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords4 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c4.check = true;
- c4.oldCheck = true;
- c4.hospitalSpecialOffer = true;
- c4.orderdetails1 = coc2;
- c4.orderdetails2 = conOrderDetail1;
- c4.Prod = pro1;
- c4.Boxnumber = 0.00;
- c4.Piecenumber = 0.00;
- c4.allnumber = 1999.00;
- c4.oldConsumableCount = 1999.00;
- c4.canSelect = true;
- c4.sortBy = true;
- c4.packinglist = 1;
- c4.approbation_No = '';
- c4.expiration_Date = Date.Today();
- c4.boxorpiecein = '';
- c4.boxorpiece = null;
- c4.boxorpieceMap = null;
- c4.concc = null;
- c4.BoxPiece = null;
- c4.hosPro = true;
- pageRecords4.add(c4);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- consumable.add(codi);
- System.Test.startTest();
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords1,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords2,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords3,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords0,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords4,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testSaveMethod1() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id,
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true,
- BillingCity = null
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Intra_Trade_List_RMB_End_Date1__c = Date.Today(),
- Intra_Trade_List_RMB_Date2__c = null,
- Intra_Trade_List_RMB_1__c = 1,
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
- createIdSend.Order_ForDealerText__c = 'Testaccount003';
- createIdSend.Order_ForCustomerText__c = 'Test000';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend1.Name = 'testMing2';
- createIdSend1.Order_status__c = '鎵瑰噯';
- createIdSend1.Deliver_date__c = Date.today();
- createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend1.Order_type__c = '璁㈠崟';
- createIdSend1.Order_ProType__c = 'ENG';
- createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
- createIdSend1.Order_ForDealerText__c = 'Testaccount003';
- createIdSend1.Order_ForCustomerText__c = 'Test000';
- createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
- createIdSend1.Dealer_Info__c = accountItem1.Id;
- createIdSend1.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '涓�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = 999.00;
- coc.Shipment_Count__c = 9999.00;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too002';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '涓�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = 999.00;
- coc1.Shipment_Count__c = null;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
- coc2.Name = 'Too003';
- coc2.Dealer_Custom_Price__c = 999.00;
- coc2.Consumable_count__c = 3;
- coc2.Consumable_product__c = pro1.Id;
- coc2.Box_Piece__c = '涓�';
- coc2.isOutPattern__c = true;
- coc2.Consumable_order__c = createIdSend.Id;
- coc2.Unitprice_To_agency__c = 999.00;
- coc2.Delivery_List_RMB__c = 0;
- coc2.Shipment_Count__c = 100.00;
- coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
- coc3.Name = 'Too004';
- coc3.Dealer_Custom_Price__c = 999.00;
- coc3.Consumable_count__c = 3;
- coc3.Consumable_product__c = pro1.Id;
- coc3.Box_Piece__c = '';
- coc3.isOutPattern__c = true;
- coc3.Consumable_order__c = createIdSend1.Id;
- coc3.Unitprice_To_agency__c = 999.00;
- coc3.Delivery_List_RMB__c = 0.00;
- coc3.Shipment_Count__c = 9999.00;
- coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
- coc4.Name = 'Too005';
- coc4.Dealer_Custom_Price__c = 999.00;
- coc4.Consumable_count__c = 3;
- coc4.Consumable_product__c = pro1.Id;
- coc4.Box_Piece__c = '';
- coc4.isOutPattern__c = true;
- coc4.Consumable_order__c = createIdSend1.Id;
- coc4.Unitprice_To_agency__c = 999.00;
- coc4.Delivery_List_RMB__c = 9999.00;
- coc4.Shipment_Count__c = 100.00;
- coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
- coc5.Name = 'Too006';
- coc5.Dealer_Custom_Price__c = 999.00;
- coc5.Consumable_count__c = 3;
- coc5.Consumable_product__c = pro1.Id;
- coc5.Box_Piece__c = '鐩�';
- coc5.isOutPattern__c = true;
- coc5.Consumable_order__c = createIdSend1.Id;
- coc5.Unitprice_To_agency__c = 999.00;
- coc5.Delivery_List_RMB__c = 9999.00;
- coc5.Shipment_Count__c = 9999.00;
- coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc6 = new Consumable_orderdetails__c();
- coc6.Name = 'Too007';
- coc6.Dealer_Custom_Price__c = 999.00;
- coc6.Consumable_count__c = 3;
- coc6.Consumable_product__c = pro1.Id;
- coc6.Box_Piece__c = '涓�';
- coc6.isOutPattern__c = true;
- coc6.Consumable_order__c = createIdSend1.Id;
- coc6.Unitprice_To_agency__c = 999.00;
- coc6.Delivery_List_RMB__c = 9999.00;
- coc6.Shipment_Count__c = 9999.00;
- coc6.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc7 = new Consumable_orderdetails__c();
- coc7.Name = 'Too008';
- coc7.Dealer_Custom_Price__c = 999.00;
- coc7.Consumable_count__c = 3;
- coc7.Consumable_product__c = pro1.Id;
- coc7.Box_Piece__c = '鐩�';
- coc7.isOutPattern__c = true;
- coc7.Consumable_order__c = createIdSend1.Id;
- coc7.Unitprice_To_agency__c = 999.00;
- coc7.Delivery_List_RMB__c = 100;
- coc7.Shipment_Count__c = 0;
- coc7.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{
- coc,
- coc1,
- coc2,
- coc3,
- coc4,
- coc5,
- coc6,
- coc7
- };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Cancellation_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- conOrderDetail1.Sterilization_limit__c = Date.Today();
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c0.check = true;
- c0.oldCheck = false;
- c0.hospitalSpecialOffer = true;
- c0.orderdetails1 = coc;
- c0.orderdetails2 = conOrderDetail1;
- c0.Prod = pro1;
- c0.Boxnumber = 0.00;
- c0.Piecenumber = 0.00;
- c0.allnumber = 1999.00;
- c0.oldConsumableCount = 1999.00;
- c0.canSelect = true;
- c0.sortBy = true;
- c0.packinglist = 1;
- c0.approbation_No = '';
- c0.expiration_Date = Date.Today();
- c0.boxorpiecein = '';
- c0.boxorpiece = null;
- c0.boxorpieceMap = null;
- c0.concc = null;
- c0.BoxPiece = null;
- c0.hosPro = true;
- pageRecords.add(c0);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c1.check = true;
- c1.oldCheck = true;
- c1.hospitalSpecialOffer = true;
- c1.orderdetails1 = coc;
- c1.orderdetails2 = conOrderDetail1;
- c1.Prod = pro1;
- c1.Boxnumber = 0.00;
- c1.Piecenumber = 0.00;
- c1.allnumber = 1999.00;
- c1.oldConsumableCount = 1999.00;
- c1.canSelect = true;
- c1.sortBy = true;
- c1.packinglist = 1;
- c1.approbation_No = '';
- c1.expiration_Date = Date.Today();
- c1.boxorpiecein = '';
- c1.boxorpiece = null;
- c1.boxorpieceMap = null;
- c1.concc = null;
- c1.BoxPiece = null;
- c1.hosPro = true;
- pageRecords1.add(c1);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c2.check = true;
- c2.oldCheck = false;
- c2.hospitalSpecialOffer = true;
- c2.orderdetails1 = coc1;
- c2.orderdetails2 = conOrderDetail1;
- c2.Prod = pro1;
- c2.Boxnumber = 0.00;
- c2.Piecenumber = 0.00;
- c2.allnumber = 1999.00;
- c2.oldConsumableCount = 1999.00;
- c2.canSelect = true;
- c2.sortBy = true;
- c2.packinglist = 1;
- c2.approbation_No = '';
- c2.expiration_Date = Date.Today();
- c2.boxorpiecein = '';
- c2.boxorpiece = null;
- c2.boxorpieceMap = null;
- c2.concc = null;
- c2.BoxPiece = null;
- c2.hosPro = true;
- pageRecords2.add(c2);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c3.check = true;
- c3.oldCheck = true;
- c3.hospitalSpecialOffer = true;
- c3.orderdetails1 = coc2;
- c3.orderdetails2 = conOrderDetail1;
- c3.Prod = pro1;
- c3.Boxnumber = 0.00;
- c3.Piecenumber = 0.00;
- c3.allnumber = 199999.00;
- c3.oldConsumableCount = 1999.00;
- c3.canSelect = true;
- c3.sortBy = true;
- c3.packinglist = 1;
- c3.approbation_No = '';
- c3.expiration_Date = Date.Today();
- c3.boxorpiecein = '';
- c3.boxorpiece = null;
- c3.boxorpieceMap = null;
- c3.concc = null;
- c3.BoxPiece = null;
- c3.hosPro = true;
- pageRecords3.add(c3);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- consumable.add(codi);
- System.Test.startTest();
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords1,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords2,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords3,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testSave() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900',
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
-
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = 'Test123456';
- createIdSend.Order_ForDealerText__c = '';
- createIdSend.Order_ForDealer__c = accountItem1.Id;
- createIdSend.Order_ForCustomerText__c = '';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend.Order_ForDealerText__c = 'Test';
- createIdSend.Order_ForDealer__c = accountItem1.Id;
- createIdSend.Order_ForCustomerText__c = '';
- createIdSend.SummonsStatus_c__c = '';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend2 = new Consumable_order__c();
- createIdSend2.Name = 'testMing1';
- createIdSend2.Order_status__c = '鎵瑰噯';
- createIdSend2.Deliver_date__c = Date.today();
- createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend2.Order_type__c = '璁㈠崟';
- createIdSend2.Order_ProType__c = 'ENG';
- createIdSend2.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- createIdSend2.Order_ForDealerText__c = '';
- createIdSend2.Order_ForDealer__c = accountItem1.Id;
- createIdSend2.Order_ForCustomerText__c = '';
- createIdSend2.SummonsStatus_c__c = '浠锋牸鏈畾';
- createIdSend2.Dealer_Info__c = accountItem1.Id;
- createIdSend2.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{
- createIdSend,
- createIdSend1,
- createIdSend2
- };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = 999.00;
- coc.Shipment_Count__c = 10000;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too001';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '鐩�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = -999.00;
- coc1.Shipment_Count__c = 10000;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
- coc2.Name = 'Too001';
- coc2.Dealer_Custom_Price__c = 999.00;
- coc2.Consumable_count__c = 3;
- coc2.Consumable_product__c = pro1.Id;
- coc2.Box_Piece__c = '涓�';
- coc2.isOutPattern__c = true;
- coc2.Consumable_order__c = createIdSend.Id;
- coc2.Unitprice_To_agency__c = 999.00;
- coc2.Delivery_List_RMB__c = null;
- coc2.Shipment_Count__c = 10000;
- coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
- coc3.Name = 'Too001';
- coc3.Dealer_Custom_Price__c = 999.00;
- coc3.Consumable_count__c = 3;
- coc3.Consumable_product__c = pro1.Id;
- coc3.Box_Piece__c = '';
- coc3.isOutPattern__c = true;
- coc3.Consumable_order__c = createIdSend2.Id;
- coc3.Unitprice_To_agency__c = 999.00;
- coc3.Delivery_List_RMB__c = 0;
- coc3.Shipment_Count__c = 10000;
- coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
- coc4.Name = 'Too001';
- coc4.Dealer_Custom_Price__c = 999.00;
- coc4.Consumable_count__c = 3;
- coc4.Consumable_product__c = pro1.Id;
- coc4.Box_Piece__c = '';
- coc4.isOutPattern__c = true;
- coc4.Consumable_order__c = createIdSend2.Id;
- coc4.Unitprice_To_agency__c = 999.00;
- coc4.Delivery_List_RMB__c = 0;
- coc4.Shipment_Count__c = 10000;
- coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
- coc5.Name = 'Too001';
- coc5.Dealer_Custom_Price__c = 999.00;
- coc5.Consumable_count__c = 3;
- coc5.Consumable_product__c = pro1.Id;
- coc5.Box_Piece__c = '鐩�';
- coc5.isOutPattern__c = true;
- coc5.Consumable_order__c = createIdSend2.Id;
- coc5.Unitprice_To_agency__c = 999.00;
- coc5.Delivery_List_RMB__c = 100;
- coc5.Shipment_Count__c = 10000;
- coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{
- coc,
- coc1,
- coc2,
- coc3,
- coc4,
- coc5
- };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
-
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert new List<hospitalprice__c>{ hp1 };
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc cod = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- cod.check = true;
- cod.oldCheck = true;
- cod.hospitalSpecialOffer = true;
- cod.orderdetails1 = coc;
- cod.orderdetails2 = conOrderDetail1;
- cod.Prod = pro1;
- cod.Boxnumber = 0.00;
- cod.Piecenumber = 0.00;
- cod.allnumber = 1999.00;
- cod.oldConsumableCount = 1999.00;
- cod.canSelect = true;
- cod.sortBy = true;
- cod.packinglist = 1;
- cod.approbation_No = '';
- cod.expiration_Date = Date.Today();
- cod.boxorpiecein = '';
- cod.boxorpiece = null;
- cod.boxorpieceMap = null;
- cod.concc = null;
- cod.BoxPiece = null;
- cod.hosPro = true;
- pageRecordsList.add(cod);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c7.check = false;
- c7.oldCheck = true;
- c7.hospitalSpecialOffer = false;
- c7.orderdetails1 = coc1;
- c7.orderdetails2 = conOrderDetail1;
- c7.Prod = pro1;
- c7.Boxnumber = 0.00;
- c7.Piecenumber = 0.00;
- c7.allnumber = 1999.00;
- c7.oldConsumableCount = 1999.00;
- c7.canSelect = true;
- c7.sortBy = true;
- c7.packinglist = 1;
- c7.approbation_No = '';
- c7.expiration_Date = Date.Today();
- c7.boxorpiecein = '';
- c7.boxorpiece = null;
- c7.boxorpieceMap = null;
- c7.concc = null;
- c7.BoxPiece = null;
- c7.hosPro = true;
- pageRecords.add(c7);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c9 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c9.check = true;
- c9.oldCheck = true;
- c9.hospitalSpecialOffer = true;
- c9.orderdetails1 = coc3;
- c9.orderdetails2 = conOrderDetail1;
- c9.Prod = pro1;
- c9.Boxnumber = 0.00;
- c9.Piecenumber = 0.00;
- c9.allnumber = 1999.00;
- c9.oldConsumableCount = 1999.00;
- c9.canSelect = true;
- c9.sortBy = true;
- c9.packinglist = 1;
- c9.approbation_No = '';
- c9.expiration_Date = Date.Today();
- c9.boxorpiecein = '';
- c9.boxorpiece = null;
- c9.boxorpieceMap = null;
- c9.concc = null;
- c9.BoxPiece = null;
- c9.hosPro = true;
- pageRecords2.add(c9);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c10 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c10.check = true;
- c10.oldCheck = false;
- c10.hospitalSpecialOffer = true;
- c10.orderdetails1 = coc4;
- c10.orderdetails2 = conOrderDetail1;
- c10.Prod = pro1;
- c10.Boxnumber = 0.00;
- c10.Piecenumber = 0.00;
- c10.allnumber = 1999.00;
- c10.oldConsumableCount = 1999.00;
- c10.canSelect = true;
- c10.sortBy = true;
- c10.packinglist = 1;
- c10.approbation_No = '';
- c10.expiration_Date = Date.Today();
- c10.boxorpiecein = '';
- c10.boxorpiece = null;
- c10.boxorpieceMap = null;
- c10.concc = null;
- c10.BoxPiece = null;
- c10.hosPro = true;
- pageRecords3.add(c10);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.oldCheck = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- consumable.add(codi);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumableList = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi1.check = false;
- codi1.oldCheck = true;
- codi1.hospitalSpecialOffer = false;
- codi1.packinglist = 0;
- codi1.approbation_No = null;
- codi1.expiration_Date = Date.Today();
- codi1.boxorpiecein = null;
- codi1.orderdetails1 = coc;
- codi1.Prod = pro1;
- consumableList.add(codi1);
- Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
- String ESetId = createIdSend.Id;
- String statusEdit = 'Test';
- String arrive = createIdSend.Id;
- System.Test.startTest();
- LexSummonsCreatController.firstInit(ESetId);
- LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
- LexSummonsCreatController.init(ESetId, null, 1, 100, arrive);
- LexSummonsCreatController.GoodsDelivery(
- createIdSend2,
- createIdSend2.Id,
- pageRecords
- );
- LexSummonsCreatController.save(
- createIdSend,
- accountId,
- 'Test',
- accountItem1.Id,
- pageRecordsList,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- accountId,
- 'Test',
- accountItem1.Id,
- pageRecords,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- accountId,
- 'Test',
- accountItem1.Id,
- null,
- accountId,
- createIdSend.Id,
- null,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- accountId,
- 'Test',
- accountItem1.Id,
- pageRecords,
- accountId,
- null,
- consumableList,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend2,
- accountId,
- 'Test',
- null,
- pageRecords,
- accountId,
- createIdSend2.Id,
- null,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend2,
- accountId,
- 'Test',
- null,
- pageRecords2,
- accountId,
- createIdSend2.Id,
- null,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend2,
- accountId,
- 'Test',
- null,
- pageRecords3,
- accountId,
- createIdSend2.Id,
- null,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend1,
- '',
- '',
- accountItem1.Id,
- pageRecords3,
- accountId,
- createIdSend2.Id,
- null,
- agencyProType,
- userWorkLocation
- );
- System.Test.stopTest();
- }
- }
- @isTest
- static void testAttachment() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900',
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
- //鍙戣揣
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- createIdSend.Order_ForDealerText__c = 'Test';
- createIdSend.Order_ForCustomerText__c = 'Test';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend1.Name = 'testMing1';
- createIdSend1.Order_status__c = '鎵瑰噯';
- createIdSend1.Deliver_date__c = Date.today();
- createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend1.Order_type__c = '璁㈠崟';
- createIdSend1.Order_ProType__c = 'ENG';
- createIdSend1.SummonsForDirction__c = '鍖婚櫌璇曠敤';
- createIdSend1.Order_ForDealerText__c = 'Test';
- createIdSend1.Order_ForCustomerText__c = '';
- createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend1.Dealer_Info__c = accountItem1.Id;
- createIdSend1.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend2 = new Consumable_order__c();
- createIdSend2.Name = 'testMing1';
- createIdSend2.Order_status__c = '鎵瑰噯';
- createIdSend2.Deliver_date__c = Date.today();
- createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend2.Order_type__c = '璁㈠崟';
- createIdSend2.Order_ProType__c = 'ENG';
- createIdSend2.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend2.Order_ForDealerText__c = '';
- createIdSend2.Order_ForCustomerText__c = 'Test';
- createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend2.Dealer_Info__c = accountItem1.Id;
- createIdSend2.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{
- createIdSend,
- createIdSend1,
- createIdSend2
- };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = 999.00;
- coc.Shipment_Count__c = null;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
- coc2.Name = 'Too001';
- coc2.Dealer_Custom_Price__c = 999.00;
- coc2.Consumable_count__c = 3;
- coc2.Consumable_product__c = pro1.Id;
- coc2.Box_Piece__c = '涓�';
- coc2.isOutPattern__c = true;
- coc2.Consumable_order__c = createIdSend.Id;
- coc2.Unitprice_To_agency__c = 999.00;
- coc2.Delivery_List_RMB__c = 0;
- coc2.Shipment_Count__c = 0;
- coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{ coc, coc2 };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
-
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert new List<hospitalprice__c>{ hp1 };
-
- Attachment attach = new Attachment();
- attach.Name = 'A-65224941-20200923--1.docx';
- Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
- attach.body = bodyBlob;
- attach.ParentId = createIdSend.id;
- attach.ContentType = 'application/pdf';
- insert new List<Attachment>{ attach };
-
- System.Test.startTest();
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c5.check = true;
- c5.hospitalSpecialOffer = true;
- c5.orderdetails1 = coc;
- c5.allnumber = 1999.00;
- pageRecordsLwcLwc.add(c5);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c8.check = true;
- c8.hospitalSpecialOffer = true;
- c8.orderdetails1 = coc2;
- c8.allnumber = 1999.00;
- pageRecordsList.add(c8);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c6.check = false;
- c6.hospitalSpecialOffer = false;
- c6.orderdetails1 = coc;
- c6.allnumber = 1999.00;
- pageRecords.add(c6);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c7.check = true;
- c7.oldCheck = true;
- c7.hospitalSpecialOffer = true;
- c7.orderdetails1 = coc;
- c7.orderdetails2 = conOrderDetail1;
- c7.Prod = pro1;
- c7.Boxnumber = 0.00;
- c7.Piecenumber = 0.00;
- c7.allnumber = 1999.00;
- c7.oldConsumableCount = 1999.00;
- c7.canSelect = true;
- c7.sortBy = true;
- c7.packinglist = 1;
- c7.approbation_No = '';
- c7.expiration_Date = Date.Today();
- c7.boxorpiecein = '';
- c7.boxorpiece = null;
- c7.boxorpieceMap = null;
- c7.concc = null;
- c7.BoxPiece = null;
- c7.hosPro = true;
- pageRecordsLwc.add(c7);
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.oldCheck = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi1.check = false;
- codi1.oldCheck = true;
- codi1.hospitalSpecialOffer = false;
- codi1.packinglist = 0;
- codi1.approbation_No = null;
- codi1.expiration_Date = Date.Today();
- codi1.boxorpiecein = null;
- codi1.orderdetails1 = coc;
- codi1.Prod = pro1;
- consumable.add(codi);
-
- Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
- String ESetId = createIdSend.Id;
- String statusEdit = 'Test';
- String arrive = createIdSend.Id;
- LexSummonsCreatController.firstInit(ESetId);
- LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
- LexSummonsCreatController.save(
- createIdSend,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwc,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend1,
- 'Test',
- 'Test',
- 'Test',
- pageRecordsLwc,
- accountId,
- createIdSend1.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend2,
- '',
- '',
- '',
- pageRecordsLwc,
- accountId,
- createIdSend2.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecordsList,
- accountId,
- null,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.searchConsumableorderdetails(
- agencyProType,
- accountName,
- userWorkLocation,
- 'ishos',
- 'Test07',
- 'Test7',
- 'Test77',
- 'Test777',
- true,
- pageRecordsLwc,
- consumable,
- '',
- 1,
- 100
- );
- LexSummonsCreatController.ConsumableorderdetailsInfo con = new LexSummonsCreatController.ConsumableorderdetailsInfo(
- attach
- );
- con.concc = attach;
- con.hospitalSpecialOffer = false;
- con.hosPro = false;
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void testSave1() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900',
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
-
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend.Order_ForDealerText__c = '';
- createIdSend.Order_ForCustomerText__c = '';
- createIdSend.SummonsStatus_c__c = '';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend1 = new Consumable_order__c();
- createIdSend1.Name = 'testMing1';
- createIdSend1.Order_status__c = '鎵瑰噯';
- createIdSend1.Deliver_date__c = Date.today();
- createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend1.Order_type__c = '璁㈠崟';
- createIdSend1.Order_ProType__c = 'ENG';
- createIdSend1.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend1.Order_ForDealerText__c = '';
- createIdSend1.Order_ForCustomerText__c = '';
- createIdSend1.SummonsStatus_c__c = '';
- createIdSend1.Arrive_Order__c = createIdSend.Id;
- createIdSend1.Order_ForDealerTextID__c = accountItem1.Id;
- createIdSend1.Dealer_Info__c = accountItem1.Id;
- createIdSend1.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = 999.00;
- coc.Shipment_Count__c = null;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too001';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '鐩�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = null;
- coc1.Shipment_Count__c = 10000;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{ coc, coc1 };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Box_Piece__c = '鐩�';
- insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
-
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = accountId;
- hp1.account__c = accountId;
- hp1.product__c = pro1.Id;
- insert new List<hospitalprice__c>{ hp1 };
-
- Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
- String ESetId = createIdSend.Id;
- String statusEdit = 'Test';
- String arrive = createIdSend.Id;
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c7.check = true;
- c7.oldCheck = true;
- c7.hospitalSpecialOffer = true;
- c7.orderdetails1 = coc;
- c7.orderdetails2 = conOrderDetail1;
- c7.Prod = pro1;
- c7.Boxnumber = 0.00;
- c7.Piecenumber = 0.00;
- c7.allnumber = 1999.00;
- c7.oldConsumableCount = 1999.00;
- c7.canSelect = true;
- c7.sortBy = true;
- c7.packinglist = 1;
- c7.approbation_No = '';
- c7.expiration_Date = Date.Today();
- c7.boxorpiecein = '';
- c7.boxorpiece = null;
- c7.boxorpieceMap = null;
- c7.concc = null;
- c7.BoxPiece = null;
- c7.hosPro = true;
- pageRecordsLwc.add(c7);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c8.check = true;
- c8.oldCheck = true;
- c8.hospitalSpecialOffer = true;
- c8.orderdetails1 = coc1;
- c8.orderdetails2 = conOrderDetail1;
- c8.Prod = null;
- c8.Boxnumber = 0.00;
- c8.Piecenumber = 0.00;
- c8.allnumber = 1999.00;
- c8.oldConsumableCount = 1999.00;
- c8.canSelect = true;
- c8.sortBy = true;
- c8.packinglist = 1;
- c8.approbation_No = '';
- c8.expiration_Date = Date.Today();
- c8.boxorpiecein = '';
- c8.boxorpiece = null;
- c8.boxorpieceMap = null;
- c8.concc = null;
- c8.BoxPiece = null;
- c8.hosPro = true;
- pageRecords1.add(c8);
-
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.oldCheck = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi1.check = false;
- codi1.oldCheck = true;
- codi1.hospitalSpecialOffer = false;
- codi1.packinglist = 0;
- codi1.approbation_No = null;
- codi1.expiration_Date = Date.Today();
- codi1.boxorpiecein = null;
- codi1.orderdetails1 = coc;
- codi1.Prod = pro1;
- consumable.add(codi);
- System.Test.startTest();
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecordsLwc,
- accountId,
- createIdSend.Id,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend1,
- '',
- '',
- '',
- pageRecordsLwc,
- accountId,
- null,
- consumable,
- agencyProType,
- userWorkLocation
- );
- LexSummonsCreatController.save(
- createIdSend,
- '',
- '',
- '',
- pageRecords1,
- accountId,
- null,
- consumable,
- agencyProType,
- userWorkLocation
- );
- System.Test.stopTest();
- }
- }
-
- static testMethod void testInnerClass() {
- Account accountItem1;
- Account accountItem2;
- User userTest;
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('HP')
- .getRecordTypeId();
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo,
- AgentCode_Ext__c = '9999900'
- );
- insert accountItem1;
- accountItem2 = new Account(
- Name = 'Testaccount002',
- RecordTypeId = rectHp,
- AgentCode_Ext__c = '9999999',
- ParentId = accountItem1.Id,
- Contract_Decide_Start_Date__c = Date.today(),
- ENG_Dealer__c = true,
- BillingCity = null
- );
- insert accountItem2;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountId = accountItem1.Id
- );
- insert core;
- System.runAs(new user(ID = UserInfo.getUserID())) {
- userTest = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert userTest;
- }
- System.runAs(userTest) {
- String userId = UserInfo.getUserId();
- User thisUserInfo = [
- SELECT
- accountid,
- UserPro_Type__c,
- ContactId,
- Contact.AccountId,
- Contact.Account.Name,
- Work_Location__c
- FROM User
- WHERE id = :userId
- ];
- String accountId = thisUserInfo.accountid;
- String accountName = thisUserInfo.Contact.Account.Name;
- String agencyProType = thisUserInfo.UserPro_Type__c;
- String userWorkLocation = thisUserInfo.Work_Location__c;
- thisUserInfo.UserPro_Type__c = '';
- update thisUserInfo;
- if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
- agencyProType = 'ET';
- }
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- ProductCode_Ext__c = 'Test07',
- Category3__c = 'Test7',
- Category4__c = 'Test77',
- Category5__c = 'Test777',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07 };
- Product2__c pro1 = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id,
- Category3_text__c = 'test123',
- Category4_text__c = 'test123',
- Category5_text__c = 'test123'
- );
- insert new List<Product2__c>{ pro1 };
- Consumable_order__c createIdSend = new Consumable_order__c();
- createIdSend.Name = 'testMing1';
- createIdSend.Order_status__c = '鎵瑰噯';
- createIdSend.Deliver_date__c = Date.today();
- createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend.Order_type__c = '璁㈠崟';
- createIdSend.Order_ProType__c = 'ENG';
- createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
- createIdSend.Order_ForDealerText__c = 'Testaccount003';
- createIdSend.Order_ForCustomerText__c = 'Test000';
- createIdSend.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend.orderPattern__c = 'hospitalorder';
- createIdSend.Dealer_Info__c = accountItem1.Id;
- createIdSend.Delivery_detail_count__c = 5;
-
- Consumable_order__c createIdSend3 = new Consumable_order__c();
- createIdSend3.Name = 'testMing123456';
- createIdSend3.Order_status__c = '鎵瑰噯';
- createIdSend3.Deliver_date__c = Date.today();
- createIdSend3.Arrive_Order__c = createIdSend.Id;
- createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- createIdSend3.Order_type__c = '璁㈠崟';
- createIdSend3.Order_ProType__c = 'ENG';
- createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
- createIdSend3.Order_ForDealerText__c = '';
- createIdSend3.Order_ForCustomerText__c = 'Test001';
- createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
- createIdSend3.Dealer_Info__c = accountItem1.Id;
- createIdSend3.Delivery_detail_count__c = 5;
- //鍒拌揣
- Consumable_order__c createIdArrived = new Consumable_order__c();
- createIdArrived.Name = 'testMing2';
- createIdArrived.Order_status__c = '鎵瑰噯';
- createIdArrived.Deliver_date__c = Date.today();
- createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- createIdArrived.Order_type__c = '璁㈠崟';
- createIdArrived.Order_ProType__c = 'ET';
- createIdArrived.Arrive_Order__c = createIdSend.Id;
- createIdArrived.SummonsStatus_c__c = '宸叉彁浜�';
- createIdArrived.orderPattern__c = 'promotionorder';
- createIdArrived.Dealer_Info__c = accountItem1.Id;
- createIdArrived.Delivery_detail_count__c = 5;
- insert new List<Consumable_order__c>{
- createIdSend,
- createIdSend3,
- createIdArrived
- };
-
- Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
- coc.Name = 'Too001';
- coc.Dealer_Custom_Price__c = 999.00;
- coc.Consumable_count__c = 3;
- coc.Consumable_product__c = pro1.Id;
- coc.Box_Piece__c = '鐩�';
- coc.isOutPattern__c = true;
- coc.Consumable_order__c = createIdSend.Id;
- coc.Unitprice_To_agency__c = 999.00;
- coc.Delivery_List_RMB__c = -999.00;
- coc.Shipment_Count__c = 9999.00;
- coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
-
- Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
- coc1.Name = 'Too001';
- coc1.Dealer_Custom_Price__c = 999.00;
- coc1.Consumable_count__c = 3;
- coc1.Consumable_product__c = pro1.Id;
- coc1.Box_Piece__c = '鐩�';
- coc1.isOutPattern__c = true;
- coc1.Consumable_order__c = createIdSend3.Id;
- coc1.Unitprice_To_agency__c = 999.00;
- coc1.Delivery_List_RMB__c = 999.00;
- coc1.Shipment_Count__c = 9999.00;
- coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- insert new List<Consumable_orderdetails__c>{ coc, coc1 };
-
- Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
- conOrderDetail1.Name = 'OCM_01_001001';
- conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_Product__c = pro1.Id;
- conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail1.Bar_Code__c = '11111';
- conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail1.Send_Date__c = null;
- conOrderDetail1.Used_date__c = null;
- conOrderDetail1.Return_date__c = null;
- conOrderDetail1.Consumable_Arrived_order__c = createIdSend.Id;
- conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
- conOrderDetail1.Lose_Flag__c = false;
- conOrderDetail1.Cancellation_Flag__c = false;
- conOrderDetail1.exchangeOutPattern__c = true;
- conOrderDetail1.Box_Piece__c = '鐩�';
- conOrderDetail1.Sterilization_limit__c = Date.Today();
-
- Consumable_order_details2__c conOrderDetail2 = new Consumable_order_details2__c();
- conOrderDetail2.Name = 'OCM_01_001002';
- conOrderDetail2.Consumable_ZS_order__c = createIdArrived.Id;
- conOrderDetail2.Consumable_Product__c = pro1.Id;
- conOrderDetail2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- conOrderDetail2.Bar_Code__c = '22222';
- conOrderDetail2.Arrive_date__c = Date.today().addDays(1);
- conOrderDetail2.Send_Date__c = null;
- conOrderDetail2.Used_date__c = null;
- conOrderDetail2.Return_date__c = null;
- conOrderDetail2.Consumable_Arrived_order__c = createIdArrived.Id;
- conOrderDetail2.Consumable_order_minor__c = createIdArrived.Id;
- conOrderDetail2.Lose_Flag__c = false;
- conOrderDetail2.exchangeOutPattern__c = false;
- conOrderDetail2.Cancellation_Flag__c = false;
- conOrderDetail2.Box_Piece__c = '涓�';
- conOrderDetail2.Sterilization_limit__c = Date.Today();
- insert new List<Consumable_order_details2__c>{
- conOrderDetail1,
- conOrderDetail2
- };
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c6.check = true;
- c6.oldCheck = true;
- c6.hospitalSpecialOffer = true;
- c6.orderdetails1 = coc1;
- c6.orderdetails2 = conOrderDetail1;
- c6.Prod = pro1;
- c6.Boxnumber = 0.00;
- c6.Piecenumber = 0.00;
- c6.allnumber = 1999.00;
- c6.oldConsumableCount = 1999.00;
- c6.canSelect = true;
- c6.sortBy = true;
- c6.packinglist = 1;
- c6.approbation_No = '';
- c6.expiration_Date = Date.Today();
- c6.boxorpiecein = '';
- c6.boxorpiece = null;
- c6.boxorpieceMap = null;
- c6.concc = null;
- c6.BoxPiece = null;
- c6.hosPro = true;
- pageRecords.add(c6);
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc c111 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- c111.check = true;
- c111.oldCheck = true;
- c111.hospitalSpecialOffer = false;
- c111.orderdetails1 = coc1;
- c111.orderdetails2 = conOrderDetail1;
- c111.Prod = pro1;
- c111.Boxnumber = 0.00;
- c111.Piecenumber = 0.00;
- c111.allnumber = 1999.00;
- c111.oldConsumableCount = 1999.00;
- c111.canSelect = true;
- c111.sortBy = true;
- c111.packinglist = 1;
- c111.approbation_No = '';
- c111.expiration_Date = Date.Today();
- c111.boxorpiecein = '';
- c111.boxorpiece = null;
- c111.boxorpieceMap = null;
- c111.concc = null;
- c111.BoxPiece = null;
- c111.hosPro = true;
- pageRecords1.add(c111);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = coc;
- codi.Prod = pro1;
- consumable.add(codi);
- System.Test.startTest();
- LexSummonsCreatController.init(null, 'Test', 1, 100, createIdArrived.Id);
- LexSummonsCreatController.init(null, 'Test', 1, 100, null);
- LexSummonsCreatController.init(null, null, 1, 100, createIdArrived.Id);
- LexSummonsCreatController.categoryAllload('Test7');
- LexSummonsCreatController.categoryload('Test7', 'Test77');
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ET',
- 'Testaccount001',
- '鍖椾含',
- 'ishos',
- 'Test07',
- 'Test7',
- 'Test77',
- 'Test777',
- true,
- pageRecords,
- consumable,
- '',
- 1,
- 1
- );
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ET',
- 'Testaccount001',
- '鍖椾含',
- 'nothos',
- 'Test07',
- 'Test7',
- 'Test77',
- 'Test777',
- true,
- pageRecords,
- consumable,
- '',
- 1,
- 1
- );
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ET',
- 'Testaccount001',
- '鍖椾含',
- 'ishos',
- 'Test07',
- 'Test7',
- 'Test77',
- 'Test777',
- true,
- pageRecords1,
- consumable,
- '',
- 1,
- 1
- );
- LexSummonsCreatController.searchConsumableorderdetails(
- 'ET',
- 'Testaccount001',
- '鍖椾含',
- 'nothos',
- 'Test07',
- 'Test7',
- 'Test77',
- 'Test777',
- true,
- pageRecords1,
- consumable,
- '',
- 1,
- 1
- );
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> cro = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- cro.sort();
- System.Test.stopTest();
- }
- }
-
- @isTest
- static void saveMethodTest1() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account myAccount2 = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount2.Id;
- hp1.account__c = myAccount1.Id;
- insert hp1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ String category1= '3400PK:PK閽� 5mm脳33cm';
+ String Category3 = '鑵硅厰闀滄墜鏈�';
+ String Category4 = 'PK';
+ String Category5 = 'G400';
+ LexSummonsCreatController.category1 = category1;
+ LexSummonsCreatController.Category3 = Category3;
+ LexSummonsCreatController.Category4 = Category4;
+ LexSummonsCreatController.Category5 = Category5;
+ LexSummonsCreatController.statusEdit = statusEdit;
+ LexSummonsCreatController.alertMessage = alertMessage;
+ LexSummonsCreatController.zaikuId = new List<String>();
+ LexSummonsCreatController.categoryOptionMap = new Map<String, String>();
+ LexSummonsCreatController.category4OptionMap = new Map<String, String>();
+ LexSummonsCreatController.category5OptionMap = new Map<String, String>();
+ LexSummonsCreatController.orderpieceorboxMap = new Map<String, String>();
+ LexSummonsCreatController.orderagencypriceMap = new Map<String, Decimal>();
+ LexSummonsCreatController.orderpriceMap = new Map<String, Decimal>();
+ LexSummonsCreatController.orderdetCountMap = new Map<String, Decimal>();
+ LexSummonsCreatController.hasSpecialHos = false;
+ LexSummonsCreatController.outOutPattern = null;
+ LexSummonsCreatController.provinceOptsMap = new Map<String, String>();
+ LexSummonsCreatController.categoryOptionList = new List<SelectOption>();
+ LexSummonsCreatController.category4OptionList = new List<SelectOption>();
+ LexSummonsCreatController.category5OptionList = new List<SelectOption>();
+ LexSummonsCreatController.outOutPatternOptionList = new List<SelectOption>();
+ LexSummonsCreatController.orderdetails = new List<Consumable_orderdetails__c>();
+ LexSummonsCreatController.consumableorderdetailsRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.consumableorderdetailsRecordserror = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ List<SelectOption> cityOpts1 = new List<SelectOption>();
+ cityOpts1.add(new SelectOption('', '--鏃�--'));
+ cityOpts1.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+ cityOpts1.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+ Map<String, String> optionMap = new Map<String, String>();
+ optionMap.put('', '-鏃�-');
+ optionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+ optionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+ Integer count = LexSummonsCreatController.consumableorderdetailsCount;
+ Consumable_order__c cocOrderId = new Consumable_order__c();
+ LexSummonsCreatController.coc = cocOrderId;
+ String consumableorderId = LexSummonsCreatController.consumableorderId;
+ LexSummonsCreatController summonCC = new LexSummonsCreatController();
+
+ LexSummonsCreatController.init(testList1.Id,'Test',1,100,testList1.Id);
+ LexSummonsCreatController.firstInit(ESetId);
+ LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive);
+ LexSummonsCreatController.init(ESetId,statusEdit,1,100,createIdSend.Id);
+ LexSummonsCreatController.init(createIdSend.Id,statusEdit,1,100,arrive);
+ LexSummonsCreatController.init(createIdSend.Id,'Test',1,100,createIdSend3.Id);
+ LexSummonsCreatController.init(ESetId,'Test',1,100,createIdSend.Id);
+ LexSummonsCreatController.searchConsumableorderdetails('ENG','Testaccount001','鍖椾含','ishos','Test07','CDS','OER','Celon',true,pageRecords,consumable,'',1,100);
+ LexSummonsCreatController.searchConsumableorderdetails('ENG','Testaccount001','鍖椾含','nothos','Test07','CDS','OER','Celon',true,pageRecords,consumable,'',1,100);
+ LexSummonsCreatController.save(createIdSend2,'','','',pageRecordsLwcLwc,accountId,createIdSend2.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend1,'','','Test',pageRecordsLwcLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend1,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend7,'','',accountItem1.Id,pageRecordsLwcLwc,accountId,createIdSend7.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend3,'Test','Test','',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend3,'','','Test',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend3,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend4,'','','',pageRecordsLwcLwc,accountId,createIdSend4.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend5,'','','',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend5,'','','Test',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend5,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend8,accountId,'Test',accountId,pageRecords,accountId,createIdSend8.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend8,accountId,'Test',null,pageRecordsLwc,accountId,createIdSend8.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.checkOutPattern();
+ LexSummonsCreatController.PraseToPDF(createIdSend,createIdSend.Id);
+ LexSummonsCreatController.search('Testaccount001');
+ LexSummonsCreatController.GoodsDelivery(createIdSend,createIdSend.Id,pageRecordsLwcLwc);
+ LexSummonsCreatController.GoodsDelivery(createIdSend3,createIdSend3.Id,pageRecords);
+ LexSummonsCreatController.GoodsDelivery(createIdSend1,createIdSend1.Id,pageRecordsLwcLwc);
+ LexSummonsCreatController.GoodsDelivery(createIdSend6,createIdSend6.Id,pageRecordsLwcLwc);
+ LexSummonsCreatController.DelConsumable(createIdSend.Id);
+ System.Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testSaveMethod(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900');
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+ createIdSend.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend.Order_ForCustomerText__c = 'Test000';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- insert Order0;
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend1.Name = 'testMing1';
+ createIdSend1.Order_status__c = '鎵瑰噯';
+ createIdSend1.Deliver_date__c = Date.today();
+ createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend1.Order_type__c = '璁㈠崟';
+ createIdSend1.Order_ProType__c = 'ENG';
+ createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+ createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend1.Order_ForCustomerText__c = 'Test000';
+ createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
+ createIdSend1.Dealer_Info__c = accountItem1.Id;
+ createIdSend1.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[]{createIdSend,createIdSend1};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = -999.00;
+ coc.Shipment_Count__c = 9999.00;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 10;
- Orderdet.isOutPattern__c = true;
- Orderdet.Delivery_List_RMB__c = 100;
- Orderdet.Box_Piece__c = '鐩�';
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- Orderdet1.Box_Piece__c = '鐩�';
- insert Orderdet1;
- System.Test.startTest();
- LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
- List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
- LexSummonsCreatController.ConsumableorderdetailsInfoLwc p = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
- p.check = true;
- p.oldcheck = true;
- p.hospitalSpecialOffer = true;
- p.orderdetails1 = Orderdet;
- p.orderdetails2 = Orderdet1;
- p.Prod = pro1;
- p.Boxnumber = 2;
- p.Piecenumber = 2;
- pList.add(p);
- List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
- LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
- codi.check = true;
- codi.hospitalSpecialOffer = true;
- codi.packinglist = 0;
- codi.approbation_No = null;
- codi.expiration_Date = Date.Today();
- codi.boxorpiecein = null;
- codi.orderdetails1 = Orderdet;
- codi.orderdetails2 = Orderdet1;
- codi.Prod = pro1;
- consumable.add(codi);
- LexSummonsCreatController.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- LexSummonsCreatController.coc.Order_ForCustomerText__c = '娑堝寲绉�';
- LexSummonsCreatController.save(
- LexSummonsCreatController.coc,
- myAccount2.Id,
- myAccount2.Name,
- '',
- pList,
- myAccount1.Id,
- '',
- consumable,
- 'ET',
- ''
- );
- Orderdet.Box_Piece__c = '涓�';
- LexSummonsCreatController.save(
- LexSummonsCreatController.coc,
- myAccount2.Id,
- myAccount2.Name,
- '',
- pList,
- myAccount1.Id,
- '',
- consumable,
- 'ET',
- ''
- );
- p.Piecenumber = 20;
- LexSummonsCreatController.save(
- LexSummonsCreatController.coc,
- myAccount2.Id,
- myAccount2.Name,
- '',
- pList,
- myAccount1.Id,
- '',
- consumable,
- 'ET',
- ''
- );
- System.Test.stopTest();
- }
- }
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too001';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '鐩�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = null;
+ coc1.Shipment_Count__c = 9999.00;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- @isTest
- static void initMethodTest1() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account myAccount2 = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount2.Id;
- hp1.account__c = myAccount1.Id;
- insert hp1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET',
- Work_Location__c = '鍖椾含'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+ coc2.Name = 'Too001';
+ coc2.Dealer_Custom_Price__c = 999.00;
+ coc2.Consumable_count__c = 3;
+ coc2.Consumable_product__c = pro1.Id;
+ coc2.Box_Piece__c = '';
+ coc2.isOutPattern__c = true;
+ coc2.Consumable_order__c = createIdSend.Id;
+ coc2.Unitprice_To_agency__c = 999.00;
+ coc2.Delivery_List_RMB__c = 999.00;
+ coc2.Shipment_Count__c = 9999.00;
+ coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+ Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+ coc3.Name = 'Too001';
+ coc3.Dealer_Custom_Price__c = 999.00;
+ coc3.Consumable_count__c = 3;
+ coc3.Consumable_product__c = pro1.Id;
+ coc3.Box_Piece__c = '鐩�';
+ coc3.isOutPattern__c = true;
+ coc3.Consumable_order__c = createIdSend1.Id;
+ coc3.Unitprice_To_agency__c = 999.00;
+ coc3.Delivery_List_RMB__c = 100.00;
+ coc3.Shipment_Count__c = 9999.00;
+ coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Cancellation_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ conOrderDetail1.Sterilization_limit__c = Date.Today();
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+
+
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c0.check = true;
+ c0.oldCheck = true;
+ c0.hospitalSpecialOffer = true;
+ c0.orderdetails1 = coc;
+ c0.orderdetails2 = conOrderDetail1;
+ c0.Prod = pro1;
+ c0.Boxnumber = 0.00;
+ c0.Piecenumber = 0.00;
+ c0.allnumber = 1999.00;
+ c0.oldConsumableCount = 1999.00;
+ c0.canSelect = true;
+ c0.sortBy = true;
+ c0.packinglist = 1;
+ c0.approbation_No = '';
+ c0.expiration_Date = Date.Today();
+ c0.boxorpiecein = '';
+ c0.boxorpiece = null;
+ c0.boxorpieceMap = null;
+ c0.concc = null;
+ c0.BoxPiece = null;
+ c0.hosPro = true;
+ pageRecords.add(c0);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c1.check = true;
+ c1.oldCheck = false;
+ c1.hospitalSpecialOffer = true;
+ c1.orderdetails1 = coc1;
+ c1.orderdetails2 = conOrderDetail1;
+ c1.Prod = pro1;
+ c1.Boxnumber = 0.00;
+ c1.Piecenumber = 0.00;
+ c1.allnumber = 1999.00;
+ c1.oldConsumableCount = 1999.00;
+ c1.canSelect = true;
+ c1.sortBy = true;
+ c1.packinglist = 1;
+ c1.approbation_No = '';
+ c1.expiration_Date = Date.Today();
+ c1.boxorpiecein = '';
+ c1.boxorpiece = null;
+ c1.boxorpieceMap = null;
+ c1.concc = null;
+ c1.BoxPiece = null;
+ c1.hosPro = true;
+ pageRecords1.add(c1);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c2.check = true;
+ c2.oldCheck = false;
+ c2.hospitalSpecialOffer = true;
+ c2.orderdetails1 = coc2;
+ c2.orderdetails2 = conOrderDetail1;
+ c2.Prod = pro1;
+ c2.Boxnumber = 0.00;
+ c2.Piecenumber = 0.00;
+ c2.allnumber = 1999.00;
+ c2.oldConsumableCount = 1999.00;
+ c2.canSelect = true;
+ c2.sortBy = true;
+ c2.packinglist = 1;
+ c2.approbation_No = '';
+ c2.expiration_Date = Date.Today();
+ c2.boxorpiecein = '';
+ c2.boxorpiece = null;
+ c2.boxorpieceMap = null;
+ c2.concc = null;
+ c2.BoxPiece = null;
+ c2.hosPro = true;
+ pageRecords2.add(c2);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c3.check = true;
+ c3.oldCheck = false;
+ c3.hospitalSpecialOffer = true;
+ c3.orderdetails1 = coc3;
+ c3.orderdetails2 = conOrderDetail1;
+ c3.Prod = pro1;
+ c3.Boxnumber = 0.00;
+ c3.Piecenumber = 0.00;
+ c3.allnumber = 1999.00;
+ c3.oldConsumableCount = 1999.00;
+ c3.canSelect = true;
+ c3.sortBy = true;
+ c3.packinglist = 1;
+ c3.approbation_No = '';
+ c3.expiration_Date = Date.Today();
+ c3.boxorpiecein = '';
+ c3.boxorpiece = null;
+ c3.boxorpieceMap = null;
+ c3.concc = null;
+ c3.BoxPiece = null;
+ c3.hosPro = true;
+ pageRecords3.add(c3);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords0 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c001 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c001.check = true;
+ c001.oldCheck = true;
+ c001.hospitalSpecialOffer = true;
+ c001.orderdetails1 = coc3;
+ c001.orderdetails2 = conOrderDetail1;
+ c001.Prod = pro1;
+ c001.Boxnumber = 0.00;
+ c001.Piecenumber = 0.00;
+ c001.allnumber = 1999.00;
+ c001.oldConsumableCount = 1999.00;
+ c001.canSelect = true;
+ c001.sortBy = true;
+ c001.packinglist = 1;
+ c001.approbation_No = '';
+ c001.expiration_Date = Date.Today();
+ c001.boxorpiecein = '';
+ c001.boxorpiece = null;
+ c001.boxorpieceMap = null;
+ c001.concc = null;
+ c001.BoxPiece = null;
+ c001.hosPro = true;
+ pageRecords0.add(c001);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords4 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c4.check = true;
+ c4.oldCheck = true;
+ c4.hospitalSpecialOffer = true;
+ c4.orderdetails1 = coc2;
+ c4.orderdetails2 = conOrderDetail1;
+ c4.Prod = pro1;
+ c4.Boxnumber = 0.00;
+ c4.Piecenumber = 0.00;
+ c4.allnumber = 1999.00;
+ c4.oldConsumableCount = 1999.00;
+ c4.canSelect = true;
+ c4.sortBy = true;
+ c4.packinglist = 1;
+ c4.approbation_No = '';
+ c4.expiration_Date = Date.Today();
+ c4.boxorpiecein = '';
+ c4.boxorpiece = null;
+ c4.boxorpieceMap = null;
+ c4.concc = null;
+ c4.BoxPiece = null;
+ c4.hosPro = true;
+ pageRecords4.add(c4);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ System.Test.startTest();
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords2,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords3,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords0,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords4,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ System.Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testSaveMethod1(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900');
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',
+ Intra_Trade_List_RMB_End_Date1__c = Date.Today(),Intra_Trade_List_RMB_Date2__c = null ,Intra_Trade_List_RMB_1__c = 1,Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+ createIdSend.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend.Order_ForCustomerText__c = 'Test000';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- insert Order0;
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend1.Name = 'testMing2';
+ createIdSend1.Order_status__c = '鎵瑰噯';
+ createIdSend1.Deliver_date__c = Date.today();
+ createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend1.Order_type__c = '璁㈠崟';
+ createIdSend1.Order_ProType__c = 'ENG';
+ createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+ createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend1.Order_ForCustomerText__c = 'Test000';
+ createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
+ createIdSend1.Dealer_Info__c = accountItem1.Id;
+ createIdSend1.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[]{createIdSend,createIdSend1};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '涓�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = 999.00;
+ coc.Shipment_Count__c = 9999.00;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '浼犵エ';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- Order1.SummonsStatus_c__c = '宸叉彁浜�';
- Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order1.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 10;
- Orderdet.isOutPattern__c = true;
- Orderdet.Delivery_List_RMB__c = 100;
- Orderdet.Box_Piece__c = '鐩�';
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- Orderdet1.Box_Piece__c = '鐩�';
- insert Orderdet1;
- System.Test.startTest();
- LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
- System.Test.stopTest();
- }
- }
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too002';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '涓�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = 999.00;
+ coc1.Shipment_Count__c = null;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
- @isTest
- static void initMethodTest2() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account myAccount2 = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- Account myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 30,
- RecordTypeId = rectCo[0].Id
- );
- insert new List<account>{ myAccount1, myAccount2 };
- hospitalprice__c hp1 = new hospitalprice__c();
- hp1.hospital__c = myAccount2.Id;
- hp1.account__c = myAccount1.Id;
- insert hp1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- user MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ET'
- );
- System.runAs(new User(Id = UserInfo.getUserId())) {
- insert MyUser_Test;
+ Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+ coc2.Name = 'Too003';
+ coc2.Dealer_Custom_Price__c = 999.00;
+ coc2.Consumable_count__c = 3;
+ coc2.Consumable_product__c = pro1.Id;
+ coc2.Box_Piece__c = '涓�';
+ coc2.isOutPattern__c = true;
+ coc2.Consumable_order__c = createIdSend.Id;
+ coc2.Unitprice_To_agency__c = 999.00;
+ coc2.Delivery_List_RMB__c = 0;
+ coc2.Shipment_Count__c = 100.00;
+ coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+ coc3.Name = 'Too004';
+ coc3.Dealer_Custom_Price__c = 999.00;
+ coc3.Consumable_count__c = 3;
+ coc3.Consumable_product__c = pro1.Id;
+ coc3.Box_Piece__c = '';
+ coc3.isOutPattern__c = true;
+ coc3.Consumable_order__c = createIdSend1.Id;
+ coc3.Unitprice_To_agency__c = 999.00;
+ coc3.Delivery_List_RMB__c = 0.00;
+ coc3.Shipment_Count__c = 9999.00;
+ coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
+ coc4.Name = 'Too005';
+ coc4.Dealer_Custom_Price__c = 999.00;
+ coc4.Consumable_count__c = 3;
+ coc4.Consumable_product__c = pro1.Id;
+ coc4.Box_Piece__c = '';
+ coc4.isOutPattern__c = true;
+ coc4.Consumable_order__c = createIdSend1.Id;
+ coc4.Unitprice_To_agency__c = 999.00;
+ coc4.Delivery_List_RMB__c = 9999.00;
+ coc4.Shipment_Count__c = 100.00;
+ coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
+ coc5.Name = 'Too006';
+ coc5.Dealer_Custom_Price__c = 999.00;
+ coc5.Consumable_count__c = 3;
+ coc5.Consumable_product__c = pro1.Id;
+ coc5.Box_Piece__c = '鐩�';
+ coc5.isOutPattern__c = true;
+ coc5.Consumable_order__c = createIdSend1.Id;
+ coc5.Unitprice_To_agency__c = 999.00;
+ coc5.Delivery_List_RMB__c = 9999.00;
+ coc5.Shipment_Count__c = 9999.00;
+ coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc6 = new Consumable_orderdetails__c();
+ coc6.Name = 'Too007';
+ coc6.Dealer_Custom_Price__c = 999.00;
+ coc6.Consumable_count__c = 3;
+ coc6.Consumable_product__c = pro1.Id;
+ coc6.Box_Piece__c = '涓�';
+ coc6.isOutPattern__c = true;
+ coc6.Consumable_order__c = createIdSend1.Id;
+ coc6.Unitprice_To_agency__c = 999.00;
+ coc6.Delivery_List_RMB__c = 9999.00;
+ coc6.Shipment_Count__c = 9999.00;
+ coc6.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc7 = new Consumable_orderdetails__c();
+ coc7.Name = 'Too008';
+ coc7.Dealer_Custom_Price__c = 999.00;
+ coc7.Consumable_count__c = 3;
+ coc7.Consumable_product__c = pro1.Id;
+ coc7.Box_Piece__c = '鐩�';
+ coc7.isOutPattern__c = true;
+ coc7.Consumable_order__c = createIdSend1.Id;
+ coc7.Unitprice_To_agency__c = 999.00;
+ coc7.Delivery_List_RMB__c = 100;
+ coc7.Shipment_Count__c = 0;
+ coc7.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3,coc4,coc5,coc6,coc7};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Cancellation_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ conOrderDetail1.Sterilization_limit__c = Date.Today();
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c0.check = true;
+ c0.oldCheck = false;
+ c0.hospitalSpecialOffer = true;
+ c0.orderdetails1 = coc;
+ c0.orderdetails2 = conOrderDetail1;
+ c0.Prod = pro1;
+ c0.Boxnumber = 0.00;
+ c0.Piecenumber = 0.00;
+ c0.allnumber = 1999.00;
+ c0.oldConsumableCount = 1999.00;
+ c0.canSelect = true;
+ c0.sortBy = true;
+ c0.packinglist = 1;
+ c0.approbation_No = '';
+ c0.expiration_Date = Date.Today();
+ c0.boxorpiecein = '';
+ c0.boxorpiece = null;
+ c0.boxorpieceMap = null;
+ c0.concc = null;
+ c0.BoxPiece = null;
+ c0.hosPro = true;
+ pageRecords.add(c0);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c1.check = true;
+ c1.oldCheck = true;
+ c1.hospitalSpecialOffer = true;
+ c1.orderdetails1 = coc;
+ c1.orderdetails2 = conOrderDetail1;
+ c1.Prod = pro1;
+ c1.Boxnumber = 0.00;
+ c1.Piecenumber = 0.00;
+ c1.allnumber = 1999.00;
+ c1.oldConsumableCount = 1999.00;
+ c1.canSelect = true;
+ c1.sortBy = true;
+ c1.packinglist = 1;
+ c1.approbation_No = '';
+ c1.expiration_Date = Date.Today();
+ c1.boxorpiecein = '';
+ c1.boxorpiece = null;
+ c1.boxorpieceMap = null;
+ c1.concc = null;
+ c1.BoxPiece = null;
+ c1.hosPro = true;
+ pageRecords1.add(c1);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c2.check = true;
+ c2.oldCheck = false;
+ c2.hospitalSpecialOffer = true;
+ c2.orderdetails1 = coc1;
+ c2.orderdetails2 = conOrderDetail1;
+ c2.Prod = pro1;
+ c2.Boxnumber = 0.00;
+ c2.Piecenumber = 0.00;
+ c2.allnumber = 1999.00;
+ c2.oldConsumableCount = 1999.00;
+ c2.canSelect = true;
+ c2.sortBy = true;
+ c2.packinglist = 1;
+ c2.approbation_No = '';
+ c2.expiration_Date = Date.Today();
+ c2.boxorpiecein = '';
+ c2.boxorpiece = null;
+ c2.boxorpieceMap = null;
+ c2.concc = null;
+ c2.BoxPiece = null;
+ c2.hosPro = true;
+ pageRecords2.add(c2);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c3.check = true;
+ c3.oldCheck = true;
+ c3.hospitalSpecialOffer = true;
+ c3.orderdetails1 = coc2;
+ c3.orderdetails2 = conOrderDetail1;
+ c3.Prod = pro1;
+ c3.Boxnumber = 0.00;
+ c3.Piecenumber = 0.00;
+ c3.allnumber = 199999.00;
+ c3.oldConsumableCount = 1999.00;
+ c3.canSelect = true;
+ c3.sortBy = true;
+ c3.packinglist = 1;
+ c3.approbation_No = '';
+ c3.expiration_Date = Date.Today();
+ c3.boxorpiecein = '';
+ c3.boxorpiece = null;
+ c3.boxorpieceMap = null;
+ c3.concc = null;
+ c3.BoxPiece = null;
+ c3.hosPro = true;
+ pageRecords3.add(c3);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ System.Test.startTest();
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords2,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords3,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ System.Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200311',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- JANCODE__c = '04953170200312',
- Dealer_special_Object__c = true,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'N3047730',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'N3047731',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+ @isTest
+ static void testSave(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true);
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
- Consumable_order__c Order0 = new Consumable_order__c();
- Order0.Name = 'OCM_01_000';
- Order0.Order_status__c = '鎵瑰噯';
- Order0.Order_type__c = '璁㈠崟';
- Order0.Dealer_Info__c = myAccount1.id;
- Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- Order0.Order_ProType__c = 'ET';
- insert Order0;
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = 'Test123456';
+ createIdSend.Order_ForDealerText__c = '';
+ createIdSend.Order_ForDealer__c = accountItem1.Id;
+ createIdSend.Order_ForCustomerText__c = '';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
- Consumable_order__c Order1 = new Consumable_order__c();
- Order1.Name = 'OCM_01_001';
- Order1.Order_status__c = '鎵瑰噯';
- Order1.Order_type__c = '璁㈠崟';
- Order1.Dealer_Info__c = myAccount1.id;
- Order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
- Order1.Order_ProType__c = 'ET';
- Order1.OutPattern__c = true;
- Order1.Arrive_Order__c = Order0.Id;
- Order1.SummonsStatus_c__c = '宸叉彁浜�';
- Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
- insert Order1;
- Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
- Orderdet.Name = 'OCM_01_00101';
- Orderdet.Consumable_order__c = Order0.Id;
- Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
- Orderdet.Consumable_Product__c = pro1.Id;
- Orderdet.Consumable_count__c = 4;
- Orderdet.Shipment_Count__c = 10;
- Orderdet.isOutPattern__c = true;
- Orderdet.Delivery_List_RMB__c = 100;
- Orderdet.Box_Piece__c = '鐩�';
- insert Orderdet;
- Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
- Orderdet1.Name = 'OCM_01_001001';
- Orderdet1.Consumable_order_minor__c = Order1.Id;
- Orderdet1.Consumable_Product__c = pro1.Id;
- Orderdet1.Asset_Model_No__c = 'Test01';
- Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
- Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
- Orderdet1.Cancellation_Date__c = null;
- Orderdet1.TracingCode__c = 'BXJRF';
- Orderdet1.SerialLotNo__c = '5ZK';
- Orderdet1.Arrive_date__c = Date.today();
- Orderdet1.exchangeOutPattern__c = true;
- Orderdet1.Consumable_ZS_order__c = Order1.Id;
- Orderdet1.Box_Piece__c = '鐩�';
- Orderdet1.Sterilization_limit__c = Date.today().addDays(2);
- insert Orderdet1;
- System.Test.startTest();
- LexSummonsCreatController.init('', 'edit', 10, 1, Order1.Id);
- System.Test.stopTest();
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend.Order_ForDealerText__c = 'Test';
+ createIdSend.Order_ForDealer__c = accountItem1.Id;
+ createIdSend.Order_ForCustomerText__c = '';
+ createIdSend.SummonsStatus_c__c = '';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend2 = new Consumable_order__c();
+ createIdSend2.Name = 'testMing1';
+ createIdSend2.Order_status__c = '鎵瑰噯';
+ createIdSend2.Deliver_date__c = Date.today();
+ createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend2.Order_type__c = '璁㈠崟';
+ createIdSend2.Order_ProType__c = 'ENG';
+ createIdSend2.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ createIdSend2.Order_ForDealerText__c = '';
+ createIdSend2.Order_ForDealer__c = accountItem1.Id;
+ createIdSend2.Order_ForCustomerText__c = '';
+ createIdSend2.SummonsStatus_c__c = '浠锋牸鏈畾';
+ createIdSend2.Dealer_Info__c = accountItem1.Id;
+ createIdSend2.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[] {createIdSend,createIdSend1,createIdSend2};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = 999.00;
+ coc.Shipment_Count__c = 10000;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too001';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '鐩�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = -999.00;
+ coc1.Shipment_Count__c = 10000;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+ coc2.Name = 'Too001';
+ coc2.Dealer_Custom_Price__c = 999.00;
+ coc2.Consumable_count__c = 3;
+ coc2.Consumable_product__c = pro1.Id;
+ coc2.Box_Piece__c = '涓�';
+ coc2.isOutPattern__c = true;
+ coc2.Consumable_order__c = createIdSend.Id;
+ coc2.Unitprice_To_agency__c = 999.00;
+ coc2.Delivery_List_RMB__c = null;
+ coc2.Shipment_Count__c = 10000;
+ coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+ coc3.Name = 'Too001';
+ coc3.Dealer_Custom_Price__c = 999.00;
+ coc3.Consumable_count__c = 3;
+ coc3.Consumable_product__c = pro1.Id;
+ coc3.Box_Piece__c = '';
+ coc3.isOutPattern__c = true;
+ coc3.Consumable_order__c = createIdSend2.Id;
+ coc3.Unitprice_To_agency__c = 999.00;
+ coc3.Delivery_List_RMB__c = 0;
+ coc3.Shipment_Count__c = 10000;
+ coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
+ coc4.Name = 'Too001';
+ coc4.Dealer_Custom_Price__c = 999.00;
+ coc4.Consumable_count__c = 3;
+ coc4.Consumable_product__c = pro1.Id;
+ coc4.Box_Piece__c = '';
+ coc4.isOutPattern__c = true;
+ coc4.Consumable_order__c = createIdSend2.Id;
+ coc4.Unitprice_To_agency__c = 999.00;
+ coc4.Delivery_List_RMB__c = 0;
+ coc4.Shipment_Count__c = 10000;
+ coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
+ coc5.Name = 'Too001';
+ coc5.Dealer_Custom_Price__c = 999.00;
+ coc5.Consumable_count__c = 3;
+ coc5.Consumable_product__c = pro1.Id;
+ coc5.Box_Piece__c = '鐩�';
+ coc5.isOutPattern__c = true;
+ coc5.Consumable_order__c = createIdSend2.Id;
+ coc5.Unitprice_To_agency__c = 999.00;
+ coc5.Delivery_List_RMB__c = 100;
+ coc5.Shipment_Count__c = 10000;
+ coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3,coc4,coc5};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert new hospitalprice__c[]{hp1};
+
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc cod = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ cod.check = true;
+ cod.oldCheck = true;
+ cod.hospitalSpecialOffer = true;
+ cod.orderdetails1 = coc;
+ cod.orderdetails2 = conOrderDetail1;
+ cod.Prod = pro1;
+ cod.Boxnumber = 0.00;
+ cod.Piecenumber = 0.00;
+ cod.allnumber = 1999.00;
+ cod.oldConsumableCount = 1999.00;
+ cod.canSelect = true;
+ cod.sortBy = true;
+ cod.packinglist = 1;
+ cod.approbation_No = '';
+ cod.expiration_Date = Date.Today();
+ cod.boxorpiecein = '';
+ cod.boxorpiece = null;
+ cod.boxorpieceMap = null;
+ cod.concc = null;
+ cod.BoxPiece = null;
+ cod.hosPro = true;
+ pageRecordsList.add(cod);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c7.check = false;
+ c7.oldCheck = true;
+ c7.hospitalSpecialOffer = false;
+ c7.orderdetails1 = coc1;
+ c7.orderdetails2 = conOrderDetail1;
+ c7.Prod = pro1;
+ c7.Boxnumber = 0.00;
+ c7.Piecenumber = 0.00;
+ c7.allnumber = 1999.00;
+ c7.oldConsumableCount = 1999.00;
+ c7.canSelect = true;
+ c7.sortBy = true;
+ c7.packinglist = 1;
+ c7.approbation_No = '';
+ c7.expiration_Date = Date.Today();
+ c7.boxorpiecein = '';
+ c7.boxorpiece = null;
+ c7.boxorpieceMap = null;
+ c7.concc = null;
+ c7.BoxPiece = null;
+ c7.hosPro = true;
+ pageRecords.add(c7);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c9 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c9.check = true;
+ c9.oldCheck = true;
+ c9.hospitalSpecialOffer = true;
+ c9.orderdetails1 = coc3;
+ c9.orderdetails2 = conOrderDetail1;
+ c9.Prod = pro1;
+ c9.Boxnumber = 0.00;
+ c9.Piecenumber = 0.00;
+ c9.allnumber = 1999.00;
+ c9.oldConsumableCount = 1999.00;
+ c9.canSelect = true;
+ c9.sortBy = true;
+ c9.packinglist = 1;
+ c9.approbation_No = '';
+ c9.expiration_Date = Date.Today();
+ c9.boxorpiecein = '';
+ c9.boxorpiece = null;
+ c9.boxorpieceMap = null;
+ c9.concc = null;
+ c9.BoxPiece = null;
+ c9.hosPro = true;
+ pageRecords2.add(c9);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c10 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c10.check = true;
+ c10.oldCheck = false;
+ c10.hospitalSpecialOffer = true;
+ c10.orderdetails1 = coc4;
+ c10.orderdetails2 = conOrderDetail1;
+ c10.Prod = pro1;
+ c10.Boxnumber = 0.00;
+ c10.Piecenumber = 0.00;
+ c10.allnumber = 1999.00;
+ c10.oldConsumableCount = 1999.00;
+ c10.canSelect = true;
+ c10.sortBy = true;
+ c10.packinglist = 1;
+ c10.approbation_No = '';
+ c10.expiration_Date = Date.Today();
+ c10.boxorpiecein = '';
+ c10.boxorpiece = null;
+ c10.boxorpieceMap = null;
+ c10.concc = null;
+ c10.BoxPiece = null;
+ c10.hosPro = true;
+ pageRecords3.add(c10);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.oldCheck = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumableList = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi1.check = false;
+ codi1.oldCheck = true;
+ codi1.hospitalSpecialOffer = false;
+ codi1.packinglist = 0;
+ codi1.approbation_No = null;
+ codi1.expiration_Date = Date.Today();
+ codi1.boxorpiecein = null;
+ codi1.orderdetails1 = coc;
+ codi1.Prod = pro1;
+ consumableList.add(codi1);
+ Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+ String ESetId = createIdSend.Id;
+ String statusEdit = 'Test';
+ String arrive = createIdSend.Id;
+ System.Test.startTest();
+ LexSummonsCreatController.firstInit(ESetId);
+ LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive);
+ LexSummonsCreatController.init(ESetId,null,1,100,arrive);
+ LexSummonsCreatController.GoodsDelivery(createIdSend2,createIdSend2.Id,pageRecords);
+ LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecordsList,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,null,accountId,createIdSend.Id,null,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecords,accountId,null,consumableList,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords2,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords3,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend1,'','',accountItem1.Id,pageRecords3,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation);
+ System.Test.stopTest();
+ }
}
- }
-}
+ @isTest
+ static void testAttachment(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true);
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+ //鍙戣揣
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ createIdSend.Order_ForDealerText__c = 'Test';
+ createIdSend.Order_ForCustomerText__c = 'Test';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend1.Name = 'testMing1';
+ createIdSend1.Order_status__c = '鎵瑰噯';
+ createIdSend1.Deliver_date__c = Date.today();
+ createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend1.Order_type__c = '璁㈠崟';
+ createIdSend1.Order_ProType__c = 'ENG';
+ createIdSend1.SummonsForDirction__c = '鍖婚櫌璇曠敤';
+ createIdSend1.Order_ForDealerText__c = 'Test';
+ createIdSend1.Order_ForCustomerText__c = '';
+ createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend1.Dealer_Info__c = accountItem1.Id;
+ createIdSend1.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend2 = new Consumable_order__c();
+ createIdSend2.Name = 'testMing1';
+ createIdSend2.Order_status__c = '鎵瑰噯';
+ createIdSend2.Deliver_date__c = Date.today();
+ createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend2.Order_type__c = '璁㈠崟';
+ createIdSend2.Order_ProType__c = 'ENG';
+ createIdSend2.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend2.Order_ForDealerText__c = '';
+ createIdSend2.Order_ForCustomerText__c = 'Test';
+ createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend2.Dealer_Info__c = accountItem1.Id;
+ createIdSend2.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[] {createIdSend,createIdSend1,createIdSend2};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = 999.00;
+ coc.Shipment_Count__c = null;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+ coc2.Name = 'Too001';
+ coc2.Dealer_Custom_Price__c = 999.00;
+ coc2.Consumable_count__c = 3;
+ coc2.Consumable_product__c = pro1.Id;
+ coc2.Box_Piece__c = '涓�';
+ coc2.isOutPattern__c = true;
+ coc2.Consumable_order__c = createIdSend.Id;
+ coc2.Unitprice_To_agency__c = 999.00;
+ coc2.Delivery_List_RMB__c = 0;
+ coc2.Shipment_Count__c = 0;
+ coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc2};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert new hospitalprice__c[]{hp1};
+
+ Attachment attach = new Attachment();
+ attach.Name='A-65224941-20200923--1.docx';
+ Blob bodyBlob= Blob.valueOf('Unit Test Attachment Body');
+ attach.body = bodyBlob;
+ attach.ParentId = createIdSend.id;
+ attach.ContentType = 'application/pdf';
+ insert new Attachment[] {attach};
+
+ System.Test.startTest();
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c5.check = true;
+ c5.hospitalSpecialOffer = true;
+ c5.orderdetails1 = coc;
+ c5.allnumber = 1999.00;
+ pageRecordsLwcLwc.add(c5);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList= new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c8.check = true;
+ c8.hospitalSpecialOffer = true;
+ c8.orderdetails1 = coc2;
+ c8.allnumber = 1999.00;
+ pageRecordsList.add(c8);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c6.check = false;
+ c6.hospitalSpecialOffer = false;
+ c6.orderdetails1 = coc;
+ c6.allnumber = 1999.00;
+ pageRecords.add(c6);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c7.check = true;
+ c7.oldCheck = true;
+ c7.hospitalSpecialOffer = true;
+ c7.orderdetails1 = coc;
+ c7.orderdetails2 = conOrderDetail1;
+ c7.Prod = pro1;
+ c7.Boxnumber = 0.00;
+ c7.Piecenumber = 0.00;
+ c7.allnumber = 1999.00;
+ c7.oldConsumableCount = 1999.00;
+ c7.canSelect = true;
+ c7.sortBy = true;
+ c7.packinglist = 1;
+ c7.approbation_No = '';
+ c7.expiration_Date = Date.Today();
+ c7.boxorpiecein = '';
+ c7.boxorpiece = null;
+ c7.boxorpieceMap = null;
+ c7.concc = null;
+ c7.BoxPiece = null;
+ c7.hosPro = true;
+ pageRecordsLwc.add(c7);
+
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.oldCheck = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi1.check = false;
+ codi1.oldCheck = true;
+ codi1.hospitalSpecialOffer = false;
+ codi1.packinglist = 0;
+ codi1.approbation_No = null;
+ codi1.expiration_Date = Date.Today();
+ codi1.boxorpiecein = null;
+ codi1.orderdetails1 = coc;
+ codi1.Prod = pro1;
+ consumable.add(codi);
+
+ Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+ String ESetId = createIdSend.Id;
+ String statusEdit = 'Test';
+ String arrive = createIdSend.Id;
+ LexSummonsCreatController.firstInit(ESetId);
+ LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive);
+ LexSummonsCreatController.save(createIdSend,'Test','Test','Test',pageRecordsLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend1,'Test','Test','Test',pageRecordsLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend2,'','','',pageRecordsLwc,accountId,createIdSend2.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecordsList,accountId,null,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.searchConsumableorderdetails(agencyProType,accountName,userWorkLocation,'ishos','Test07','Test7','Test77','Test777',true,pageRecordsLwc,consumable,'',1,100);
+ LexSummonsCreatController.ConsumableorderdetailsInfo con = new LexSummonsCreatController.ConsumableorderdetailsInfo(attach);
+ con.concc = attach;
+ con.hospitalSpecialOffer = false;
+ con.hosPro = false;
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void testSave1(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true);
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend.Order_ForDealerText__c = '';
+ createIdSend.Order_ForCustomerText__c = '';
+ createIdSend.SummonsStatus_c__c = '';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend1 = new Consumable_order__c();
+ createIdSend1.Name = 'testMing1';
+ createIdSend1.Order_status__c = '鎵瑰噯';
+ createIdSend1.Deliver_date__c = Date.today();
+ createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend1.Order_type__c = '璁㈠崟';
+ createIdSend1.Order_ProType__c = 'ENG';
+ createIdSend1.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend1.Order_ForDealerText__c = '';
+ createIdSend1.Order_ForCustomerText__c = '';
+ createIdSend1.SummonsStatus_c__c = '';
+ createIdSend1.Arrive_Order__c = createIdSend.Id;
+ createIdSend1.Order_ForDealerTextID__c = accountItem1.Id;
+ createIdSend1.Dealer_Info__c = accountItem1.Id;
+ createIdSend1.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[] {createIdSend,createIdSend1};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = 999.00;
+ coc.Shipment_Count__c = null;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too001';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '鐩�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = null;
+ coc1.Shipment_Count__c = 10000;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ insert new Consumable_order_details2__c[]{conOrderDetail1};
+
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = accountId;
+ hp1.account__c = accountId;
+ hp1.product__c = pro1.Id;
+ insert new hospitalprice__c[]{hp1};
+
+ Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+ String ESetId = createIdSend.Id;
+ String statusEdit = 'Test';
+ String arrive = createIdSend.Id;
+
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c7.check = true;
+ c7.oldCheck = true;
+ c7.hospitalSpecialOffer = true;
+ c7.orderdetails1 = coc;
+ c7.orderdetails2 = conOrderDetail1;
+ c7.Prod = pro1;
+ c7.Boxnumber = 0.00;
+ c7.Piecenumber = 0.00;
+ c7.allnumber = 1999.00;
+ c7.oldConsumableCount = 1999.00;
+ c7.canSelect = true;
+ c7.sortBy = true;
+ c7.packinglist = 1;
+ c7.approbation_No = '';
+ c7.expiration_Date = Date.Today();
+ c7.boxorpiecein = '';
+ c7.boxorpiece = null;
+ c7.boxorpieceMap = null;
+ c7.concc = null;
+ c7.BoxPiece = null;
+ c7.hosPro = true;
+ pageRecordsLwc.add(c7);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c8.check = true;
+ c8.oldCheck = true;
+ c8.hospitalSpecialOffer = true;
+ c8.orderdetails1 = coc1;
+ c8.orderdetails2 = conOrderDetail1;
+ c8.Prod = null;
+ c8.Boxnumber = 0.00;
+ c8.Piecenumber = 0.00;
+ c8.allnumber = 1999.00;
+ c8.oldConsumableCount = 1999.00;
+ c8.canSelect = true;
+ c8.sortBy = true;
+ c8.packinglist = 1;
+ c8.approbation_No = '';
+ c8.expiration_Date = Date.Today();
+ c8.boxorpiecein = '';
+ c8.boxorpiece = null;
+ c8.boxorpieceMap = null;
+ c8.concc = null;
+ c8.BoxPiece = null;
+ c8.hosPro = true;
+ pageRecords1.add(c8);
+
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.oldCheck = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi1.check = false;
+ codi1.oldCheck = true;
+ codi1.hospitalSpecialOffer = false;
+ codi1.packinglist = 0;
+ codi1.approbation_No = null;
+ codi1.expiration_Date = Date.Today();
+ codi1.boxorpiecein = null;
+ codi1.orderdetails1 = coc;
+ codi1.Prod = pro1;
+ consumable.add(codi);
+ System.Test.startTest();
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecordsLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend1,'','','',pageRecordsLwc,accountId,null,consumable,agencyProType,userWorkLocation);
+ LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,null,consumable,agencyProType,userWorkLocation);
+ System.Test.stopTest();
+ }
+ }
+
+ static testMethod void testInnerClass(){
+ Account accountItem1;
+ Account accountItem2;
+ User userTest;
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900');
+ insert accountItem1;
+ accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null);
+ insert accountItem2;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id);
+ insert core;
+ System.runAs(new user(ID = UserInfo.getUserID())) {
+ userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert userTest;
+ }
+ System.runAs(userTest){
+ String userId = UserInfo.getUserId();
+ User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId];
+ String accountId = thisUserInfo.accountid;
+ String accountName = thisUserInfo.Contact.Account.Name;
+ String agencyProType = thisUserInfo.UserPro_Type__c;
+ String userWorkLocation = thisUserInfo.Work_Location__c;
+ thisUserInfo.UserPro_Type__c = '';
+ update thisUserInfo;
+ if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07', ProductCode_Ext__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07};
+ Product2__c pro1 = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123');
+ insert new Product2__c[] {pro1};
+ Consumable_order__c createIdSend = new Consumable_order__c();
+ createIdSend.Name = 'testMing1';
+ createIdSend.Order_status__c = '鎵瑰噯';
+ createIdSend.Deliver_date__c = Date.today();
+ createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend.Order_type__c = '璁㈠崟';
+ createIdSend.Order_ProType__c = 'ENG';
+ createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+ createIdSend.Order_ForDealerText__c = 'Testaccount003';
+ createIdSend.Order_ForCustomerText__c = 'Test000';
+ createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend.orderPattern__c = 'hospitalorder';
+ createIdSend.Dealer_Info__c = accountItem1.Id;
+ createIdSend.Delivery_detail_count__c = 5;
+
+ Consumable_order__c createIdSend3 = new Consumable_order__c();
+ createIdSend3.Name = 'testMing123456';
+ createIdSend3.Order_status__c = '鎵瑰噯';
+ createIdSend3.Deliver_date__c = Date.today();
+ createIdSend3.Arrive_Order__c = createIdSend.Id;
+ createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ createIdSend3.Order_type__c = '璁㈠崟';
+ createIdSend3.Order_ProType__c = 'ENG';
+ createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
+ createIdSend3.Order_ForDealerText__c = '';
+ createIdSend3.Order_ForCustomerText__c = 'Test001';
+ createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
+ createIdSend3.Dealer_Info__c = accountItem1.Id;
+ createIdSend3.Delivery_detail_count__c = 5;
+ //鍒拌揣
+ Consumable_order__c createIdArrived = new Consumable_order__c();
+ createIdArrived.Name = 'testMing2';
+ createIdArrived.Order_status__c = '鎵瑰噯';
+ createIdArrived.Deliver_date__c = Date.today();
+ createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ createIdArrived.Order_type__c = '璁㈠崟';
+ createIdArrived.Order_ProType__c = 'ET';
+ createIdArrived.Arrive_Order__c = createIdSend.Id;
+ createIdArrived.SummonsStatus_c__c = '宸叉彁浜�';
+ createIdArrived.orderPattern__c = 'promotionorder';
+ createIdArrived.Dealer_Info__c = accountItem1.Id;
+ createIdArrived.Delivery_detail_count__c = 5;
+ insert new Consumable_order__c[]{createIdSend,createIdSend3,createIdArrived};
+
+ Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+ coc.Name = 'Too001';
+ coc.Dealer_Custom_Price__c = 999.00;
+ coc.Consumable_count__c = 3;
+ coc.Consumable_product__c = pro1.Id;
+ coc.Box_Piece__c = '鐩�';
+ coc.isOutPattern__c = true;
+ coc.Consumable_order__c = createIdSend.Id;
+ coc.Unitprice_To_agency__c = 999.00;
+ coc.Delivery_List_RMB__c = -999.00;
+ coc.Shipment_Count__c = 9999.00;
+ coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+ Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+ coc1.Name = 'Too001';
+ coc1.Dealer_Custom_Price__c = 999.00;
+ coc1.Consumable_count__c = 3;
+ coc1.Consumable_product__c = pro1.Id;
+ coc1.Box_Piece__c = '鐩�';
+ coc1.isOutPattern__c = true;
+ coc1.Consumable_order__c = createIdSend3.Id;
+ coc1.Unitprice_To_agency__c = 999.00;
+ coc1.Delivery_List_RMB__c = 999.00;
+ coc1.Shipment_Count__c = 9999.00;
+ coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+ insert new Consumable_orderdetails__c[]{coc,coc1};
+
+ Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+ conOrderDetail1.Name = 'OCM_01_001001';
+ conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_Product__c = pro1.Id;
+ conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail1.Bar_Code__c = '11111';
+ conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail1.Send_Date__c = null;
+ conOrderDetail1.Used_date__c = null;
+ conOrderDetail1.Return_date__c = null;
+ conOrderDetail1.Consumable_Arrived_order__c = createIdSend.Id;
+ conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+ conOrderDetail1.Lose_Flag__c = false;
+ conOrderDetail1.Cancellation_Flag__c = false;
+ conOrderDetail1.exchangeOutPattern__c = true;
+ conOrderDetail1.Box_Piece__c = '鐩�';
+ conOrderDetail1.Sterilization_limit__c = Date.Today();
+
+ Consumable_order_details2__c conOrderDetail2 = new Consumable_order_details2__c();
+ conOrderDetail2.Name = 'OCM_01_001002';
+ conOrderDetail2.Consumable_ZS_order__c = createIdArrived.Id;
+ conOrderDetail2.Consumable_Product__c = pro1.Id;
+ conOrderDetail2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ conOrderDetail2.Bar_Code__c = '22222';
+ conOrderDetail2.Arrive_date__c = Date.today().addDays(1);
+ conOrderDetail2.Send_Date__c = null;
+ conOrderDetail2.Used_date__c = null;
+ conOrderDetail2.Return_date__c = null;
+ conOrderDetail2.Consumable_Arrived_order__c = createIdArrived.Id;
+ conOrderDetail2.Consumable_order_minor__c = createIdArrived.Id;
+ conOrderDetail2.Lose_Flag__c = false;
+ conOrderDetail2.exchangeOutPattern__c = false;
+ conOrderDetail2.Cancellation_Flag__c = false;
+ conOrderDetail2.Box_Piece__c = '涓�';
+ conOrderDetail2.Sterilization_limit__c = Date.Today();
+ insert new Consumable_order_details2__c[]{conOrderDetail1,conOrderDetail2};
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c6.check = true;
+ c6.oldCheck = true;
+ c6.hospitalSpecialOffer = true;
+ c6.orderdetails1 = coc1;
+ c6.orderdetails2 = conOrderDetail1;
+ c6.Prod = pro1;
+ c6.Boxnumber = 0.00;
+ c6.Piecenumber = 0.00;
+ c6.allnumber = 1999.00;
+ c6.oldConsumableCount = 1999.00;
+ c6.canSelect = true;
+ c6.sortBy = true;
+ c6.packinglist = 1;
+ c6.approbation_No = '';
+ c6.expiration_Date = Date.Today();
+ c6.boxorpiecein = '';
+ c6.boxorpiece = null;
+ c6.boxorpieceMap = null;
+ c6.concc = null;
+ c6.BoxPiece = null;
+ c6.hosPro = true;
+ pageRecords.add(c6);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc c111 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ c111.check = true;
+ c111.oldCheck = true;
+ c111.hospitalSpecialOffer = false;
+ c111.orderdetails1 = coc1;
+ c111.orderdetails2 = conOrderDetail1;
+ c111.Prod = pro1;
+ c111.Boxnumber = 0.00;
+ c111.Piecenumber = 0.00;
+ c111.allnumber = 1999.00;
+ c111.oldConsumableCount = 1999.00;
+ c111.canSelect = true;
+ c111.sortBy = true;
+ c111.packinglist = 1;
+ c111.approbation_No = '';
+ c111.expiration_Date = Date.Today();
+ c111.boxorpiecein = '';
+ c111.boxorpiece = null;
+ c111.boxorpieceMap = null;
+ c111.concc = null;
+ c111.BoxPiece = null;
+ c111.hosPro = true;
+ pageRecords1.add(c111);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = coc;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ System.Test.startTest();
+ LexSummonsCreatController.init(null,'Test',1,100,createIdArrived.Id);
+ LexSummonsCreatController.init(null,'Test',1,100,null);
+ LexSummonsCreatController.init(null,null,1,100,createIdArrived.Id);
+ LexSummonsCreatController.categoryAllload('Test7');
+ LexSummonsCreatController.categoryload('Test7','Test77');
+ LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','鍖椾含','ishos','Test07','Test7','Test77','Test777',true,pageRecords,consumable,'',1,1);
+ LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','鍖椾含','nothos','Test07','Test7','Test77','Test777',true,pageRecords,consumable,'',1,1);
+ LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','鍖椾含','ishos','Test07','Test7','Test77','Test777',true,pageRecords1,consumable,'',1,1);
+ LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','鍖椾含','nothos','Test07','Test7','Test77','Test777',true,pageRecords1,consumable,'',1,1);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> cro = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ cro.sort();
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void saveMethodTest1(){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount2.Id;
+ hp1.account__c = myAccount1.Id;
+ insert hp1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET',Work_Location__c='鍖椾含');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 10;
+ Orderdet.isOutPattern__c = true;
+ Orderdet.Delivery_List_RMB__c = 100;
+ Orderdet.Box_Piece__c = '鐩�';
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ Orderdet1.Box_Piece__c = '鐩�';
+ insert Orderdet1;
+ System.Test.startTest();
+ LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
+ List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+ LexSummonsCreatController.ConsumableorderdetailsInfoLwc p = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+ p.check = true;
+ p.oldcheck = true;
+ p.hospitalSpecialOffer = true;
+ p.orderdetails1 = Orderdet;
+ p.orderdetails2 = Orderdet1;
+ p.Prod = pro1;
+ p.Boxnumber = 2;
+ p.Piecenumber = 2;
+ pList.add(p);
+ List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+ LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+ codi.check = true;
+ codi.hospitalSpecialOffer = true;
+ codi.packinglist = 0;
+ codi.approbation_No = null;
+ codi.expiration_Date = Date.Today();
+ codi.boxorpiecein = null;
+ codi.orderdetails1 = Orderdet;
+ codi.orderdetails2 = Orderdet1;
+ codi.Prod = pro1;
+ consumable.add(codi);
+ LexSummonsCreatController.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ LexSummonsCreatController.coc.Order_ForCustomerText__c = '娑堝寲绉�';
+ LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', '');
+ Orderdet.Box_Piece__c = '涓�';
+ LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', '');
+ p.Piecenumber = 20;
+ LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', '');
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void initMethodTest1(){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount2.Id;
+ hp1.account__c = myAccount1.Id;
+ insert hp1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET',Work_Location__c='鍖椾含');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '浼犵エ';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ Order1.SummonsStatus_c__c = '宸叉彁浜�';
+ Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order1.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 10;
+ Orderdet.isOutPattern__c = true;
+ Orderdet.Delivery_List_RMB__c = 100;
+ Orderdet.Box_Piece__c = '鐩�';
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ Orderdet1.Box_Piece__c = '鐩�';
+ insert Orderdet1;
+ System.Test.startTest();
+ LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
+ System.Test.stopTest();
+ }
+ }
+
+ @isTest
+ static void initMethodTest2(){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
+ insert new account[]{myAccount1,myAccount2};
+ hospitalprice__c hp1 = new hospitalprice__c();
+ hp1.hospital__c = myAccount2.Id;
+ hp1.account__c = myAccount1.Id;
+ insert hp1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
+ System.runAs(new User(Id = UserInfo.getUserId())){
+ insert MyUser_Test;
+ }
+
+ System.runAs(MyUser_Test){
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
+ insert new Product2[] {prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Consumable_order__c Order0 = new Consumable_order__c();
+ Order0.Name = 'OCM_01_000';
+ Order0.Order_status__c = '鎵瑰噯';
+ Order0.Order_type__c = '璁㈠崟';
+ Order0.Dealer_Info__c = myAccount1.id;
+ Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ Order0.Order_ProType__c = 'ET';
+ insert Order0;
+
+ Consumable_order__c Order1 = new Consumable_order__c();
+ Order1.Name = 'OCM_01_001';
+ Order1.Order_status__c = '鎵瑰噯';
+ Order1.Order_type__c = '璁㈠崟';
+ Order1.Dealer_Info__c = myAccount1.id;
+ Order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+ Order1.Order_ProType__c = 'ET';
+ Order1.OutPattern__c = true;
+ Order1.Arrive_Order__c = Order0.Id;
+ Order1.SummonsStatus_c__c = '宸叉彁浜�';
+ Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+ insert Order1;
+ Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+ Orderdet.Name = 'OCM_01_00101';
+ Orderdet.Consumable_order__c = Order0.Id;
+ Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ Orderdet.Consumable_Product__c = pro1.Id;
+ Orderdet.Consumable_count__c = 4;
+ Orderdet.Shipment_Count__c = 10;
+ Orderdet.isOutPattern__c = true;
+ Orderdet.Delivery_List_RMB__c = 100;
+ Orderdet.Box_Piece__c = '鐩�';
+ insert Orderdet;
+ Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+ Orderdet1.Name = 'OCM_01_001001';
+ Orderdet1.Consumable_order_minor__c = Order1.Id;
+ Orderdet1.Consumable_Product__c = pro1.Id;
+ Orderdet1.Asset_Model_No__c = 'Test01';
+ Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+ Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+ Orderdet1.Cancellation_Date__c = null;
+ Orderdet1.TracingCode__c = 'BXJRF';
+ Orderdet1.SerialLotNo__c = '5ZK';
+ Orderdet1.Arrive_date__c = Date.today();
+ Orderdet1.exchangeOutPattern__c = true;
+ Orderdet1.Consumable_ZS_order__c = Order1.Id;
+ Orderdet1.Box_Piece__c = '鐩�';
+ Orderdet1.Sterilization_limit__c= Date.today().addDays(2);
+ insert Orderdet1;
+ System.Test.startTest();
+ LexSummonsCreatController.init('', 'edit', 10, 1, Order1.Id);
+ System.Test.stopTest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexTopPageControllerTest.cls b/force-app/main/default/classes/LexTopPageControllerTest.cls
index f53913d..d8dd9dc 100644
--- a/force-app/main/default/classes/LexTopPageControllerTest.cls
+++ b/force-app/main/default/classes/LexTopPageControllerTest.cls
@@ -1,460 +1,312 @@
@IsTest
private class LexTopPageControllerTest {
- @IsTest
- static void testMethod1() {
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- Test.startTest();
- System.runAs(currentUser) {
- LexTopPageController.initAgency();
- LexTopPageController.initPage(20, 1);
- }
- Test.stopTest();
- }
-
- @IsTest
- static void testMethod2() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
-
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888',
- Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ @IsTest
+ static void testMethod1(){
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ Test.startTest();
+ System.runAs(currentUser){
+ LexTopPageController.initAgency();
+ LexTopPageController.initPage(20, 1);
+ }
+ Test.stopTest();
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ @IsTest
+ static void testMethod2(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ }
+
+ system.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- insert order;
- //鍒拌揣
- Consumable_order__c order2 = new Consumable_order__c();
- order2.Name = 'testMing1';
- order2.Order_status__c = '鎵瑰噯';
- order2.RecordTypeid = '01210000000c9dqAAA';
- order2.Dealer_Info__c = myAccount1.id;
- order2.Order_type__c = '鍒拌揣';
- order2.Order_ProType__c = 'ET';
- insert order2;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //鍒朵綔Consumable_order_details__c-------ProductCount
- // 閿�鍞�
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '鐩�';
- dataForProductCount7.Used_date__c = Date.today();
- dataForProductCount7.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount7);
- // 鍦ㄥ簱 杩囨湡 鐩�
- Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
- dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
- dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProduct.Arrive_date__c = Date.today();
- dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProduct.Consumable_Product__c = proF.id;
- dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProduct.Box_Piece__c = '鐩�';
- dataForProduct.Consumable_order_minor__c = order.id;
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ insert order;
+ //鍒拌揣
+ Consumable_order__c order2 = new Consumable_order__c();
+ order2.Name = 'testMing1';
+ order2.Order_status__c = '鎵瑰噯';
+ order2.RecordTypeid = '01210000000c9dqAAA';
+ order2.Dealer_Info__c = myAccount1.id;
+ order2.Order_type__c = '鍒拌揣';
+ order2.Order_ProType__c = 'ET';
+ insert order2;
- conList.add(dataForProduct);
- // 鍦ㄥ簱 杩囨湡 涓�
- Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
- dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
- dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount3.Arrive_date__c = Date.today();
- dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount3.Consumable_Product__c = proG.id;
- dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount3.Box_Piece__c = '涓�';
- dataForProductCount3.RemoveBox_No__c = 1;
- dataForProductCount3.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount3);
- insert conList;
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ // 閿�鍞�
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '鐩�';
+ dataForProductCount7.Used_date__c = Date.today();
+ dataForProductCount7.Consumable_order_minor__c = order.id;
- //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
- dataForProductCount4.Bar_Code__c = '1001';
- dataForProductCount4.Arrive_date__c = Date.today();
- dataForProductCount4.Send_Date__c = null;
- dataForProductCount4.Used_date__c = null;
- dataForProductCount4.Return_date__c = null;
- dataForProductCount4.Lose_Flag__c = false;
- dataForProductCount4.Cancellation_Flag__c = false;
- dataForProductCount4.Consumable_Product__c = proG.Id;
- dataForProductCount4.Consumable_Arrived_order__c = order2.id;
- dataForProductCount4.Used_account__c = myAccount1.Id;
- dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount4.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount4);
- System.debug('conList1==>' + conList1);
- //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1002';
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.Send_Date__c = Date.today();
- dataForProductCount5.Used_date__c = Date.today();
- dataForProductCount5.Return_date__c = null;
- dataForProductCount5.Lose_Flag__c = false;
- dataForProductCount5.Cancellation_Flag__c = false;
- dataForProductCount5.Consumable_Product__c = proG.Id;
- dataForProductCount5.Consumable_Arrived_order__c = order2.id;
- dataForProductCount5.Used_account__c = myAccount1.Id;
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount5.Box_Piece__c = '鐩�';
- conList1.add(dataForProductCount5);
- insert conList1;
- Test.startTest();
- LexTopPageController.initAgency();
- LexTopPageController.initPage(20, 1);
- Test.stopTest();
- }
- }
+ conList.add(dataForProductCount7);
+ // 鍦ㄥ簱 杩囨湡 鐩�
+ Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
+ dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
+ dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProduct.Arrive_date__c = Date.today();
+ dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProduct.Consumable_Product__c = proF.id;
+ dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProduct.Box_Piece__c = '鐩�';
+ dataForProduct.Consumable_order_minor__c = order.id;
- @IsTest
- static void testMethod3() {
- user MyUser_Test;
- Account myAccount1;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- System.runAs(thisUser) {
- Profile prof1 = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
-
- RecordType rectCoO = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- Account olympus = new Account(
- RecordTypeId = rectCoO.Id,
- AgentCode_Ext__c = '9999900',
- Name = 'olympus'
- );
- insert olympus;
- myAccount1 = new Account(
- name = 'Testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '8888888'
- );
- insert myAccount1;
- Contact core = new Contact(
- email = 'jplumber@salesforce.com',
- firstname = 'Joe',
- lastname = 'Plumber',
- accountid = myAccount1.id
- );
- insert core;
- MyUser_Test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof1.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- Work_Location__c = '閲嶅簡'
- );
- insert MyUser_Test;
+ conList.add(dataForProduct);
+ // 鍦ㄥ簱 杩囨湡 涓�
+ Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
+ dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
+ dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount3.Arrive_date__c = Date.today();
+ dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount3.Consumable_Product__c = proG.id;
+ dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount3.Box_Piece__c = '涓�';
+ dataForProductCount3.RemoveBox_No__c = 1;
+ dataForProductCount3.Consumable_order_minor__c = order.id;
+ conList.add(dataForProductCount3);
+ insert conList;
+
+ //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
+ dataForProductCount4.Bar_Code__c = '1001';
+ dataForProductCount4.Arrive_date__c = Date.today();
+ dataForProductCount4.Send_Date__c = null;
+ dataForProductCount4.Used_date__c = null;
+ dataForProductCount4.Return_date__c = null;
+ dataForProductCount4.Lose_Flag__c = false;
+ dataForProductCount4.Cancellation_Flag__c = false;
+ dataForProductCount4.Consumable_Product__c = proG.Id;
+ dataForProductCount4.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount4.Used_account__c = myAccount1.Id;
+ dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount4.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount4);
+ System.debug('conList1==>'+conList1);
+ //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1002';
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.Send_Date__c = Date.today();
+ dataForProductCount5.Used_date__c = Date.today();
+ dataForProductCount5.Return_date__c = null;
+ dataForProductCount5.Lose_Flag__c = false;
+ dataForProductCount5.Cancellation_Flag__c = false;
+ dataForProductCount5.Consumable_Product__c = proG.Id;
+ dataForProductCount5.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount5.Used_account__c = myAccount1.Id;
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount5.Box_Piece__c = '鐩�';
+ conList1.add(dataForProductCount5);
+ insert conList1;
+ Test.startTest();
+ LexTopPageController.initAgency();
+ LexTopPageController.initPage(20, 1);
+ Test.stopTest();
+ }
}
- System.runAs(MyUser_Test) {
- //浜у搧鏁版嵁
- Product2 prod07 = new Product2(
- Name = 'Test07',
- ProductCode = 'Test07',
- Asset_Model_No__c = 'Test07',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod08 = new Product2(
- Name = 'Test08',
- ProductCode = 'Test08',
- Asset_Model_No__c = 'Test08',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod09 = new Product2(
- Name = 'Test09',
- ProductCode = 'Test09',
- Asset_Model_No__c = 'Test09',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{ prod07, prod08, prod09 };
+ @IsTest
+ static void testMethod3(){
+ user MyUser_Test;
+ Account myAccount1;
+ User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ System.runAs(thisUser){
+ Profile prof1 = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+
+ RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
+ insert olympus;
+ myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888');
+ insert myAccount1;
+ Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
+ insert core;
+ MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '閲嶅簡');
+ insert MyUser_Test;
- //鍒朵綔浜у搧
- Product2__c proG = new Product2__c(
- Name = 'MH-155:鐧藉钩琛″附',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod07.Id
- );
- insert proG;
- Product2__c proH = new Product2__c(
- Name = 'MB-677:BNC鐢电紗',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod08.Id
- );
- insert proH;
- Product2__c proF = new Product2__c(
- Name = 'TooMAJ-643R:姘村泭闉樼003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod09.Id
- );
- insert proF;
+ }
+
+ system.runAs(MyUser_Test){
+ //浜у搧鏁版嵁
+ Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
+ insert new Product2[] {prod07,prod08,prod09};
- //璁㈠崟
- Consumable_order__c order = new Consumable_order__c();
- order.Name = 'testMing';
- order.Order_status__c = '鎵瑰噯';
- order.RecordTypeid = System.Label.RT_ConOrder_Order;
- order.Dealer_Info__c = myAccount1.id;
- order.Inventory_date__c = Date.today();
- order.Order_type__c = '璁㈠崟';
- order.Order_ProType__c = 'ET';
- insert order;
- //鍒拌揣
- Consumable_order__c order2 = new Consumable_order__c();
- order2.Name = 'testMing1';
- order2.Order_status__c = '鎵瑰噯';
- order2.RecordTypeid = '01210000000c9dqAAA';
- order2.Dealer_Info__c = myAccount1.id;
- order2.Order_type__c = '鍒拌揣';
- order2.Order_ProType__c = 'ET';
- insert order2;
+ //鍒朵綔浜у搧
+ Product2__c proG = new Product2__c(Name='MH-155:鐧藉钩琛″附',OT_CODE_Text__c='Test001',Product2__c = prod07.Id);
+ insert proG;
+ Product2__c proH = new Product2__c(Name='MB-677:BNC鐢电紗',OT_CODE_Text__c='Test002',Product2__c = prod08.Id);
+ insert proH;
+ Product2__c proF = new Product2__c(Name='TooMAJ-643R:姘村泭闉樼003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id);
+ insert proF;
- List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
- //鍒朵綔Consumable_order_details__c-------ProductCount
- // 閿�鍞�
- Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
- dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
- dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
- dataForProductCount7.Arrive_date__c = Date.today();
- dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount7.Consumable_Product__c = proH.id;
- dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
- dataForProductCount7.Box_Piece__c = '涓�';
- dataForProductCount7.Used_date__c = Date.today();
- dataForProductCount7.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount7);
- // 鍦ㄥ簱 杩囨湡 鐩�
- Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
- dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
- dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProduct.Arrive_date__c = Date.today();
- dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProduct.Consumable_Product__c = proF.id;
- dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
- dataForProduct.Box_Piece__c = '涓�';
- dataForProduct.Consumable_order_minor__c = order.id;
+ //璁㈠崟
+ Consumable_order__c order = new Consumable_order__c();
+ order.Name = 'testMing';
+ order.Order_status__c = '鎵瑰噯';
+ order.RecordTypeid = System.Label.RT_ConOrder_Order;
+ order.Dealer_Info__c = myAccount1.id;
+ order.Inventory_date__c = Date.today();
+ order.Order_type__c = '璁㈠崟';
+ order.Order_ProType__c = 'ET';
+ insert order;
+ //鍒拌揣
+ Consumable_order__c order2 = new Consumable_order__c();
+ order2.Name = 'testMing1';
+ order2.Order_status__c = '鎵瑰噯';
+ order2.RecordTypeid = '01210000000c9dqAAA';
+ order2.Dealer_Info__c = myAccount1.id;
+ order2.Order_type__c = '鍒拌揣';
+ order2.Order_ProType__c = 'ET';
+ insert order2;
- conList.add(dataForProduct);
- // 鍦ㄥ簱 杩囨湡 涓�
- Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
- dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
- dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount3.Arrive_date__c = Date.today();
- dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
- dataForProductCount3.Consumable_Product__c = proG.id;
- dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
- dataForProductCount3.Box_Piece__c = '涓�';
- dataForProductCount3.RemoveBox_No__c = 1;
- dataForProductCount3.Consumable_order_minor__c = order.id;
- conList.add(dataForProductCount3);
- insert conList;
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ //鍒朵綔Consumable_order_details__c-------ProductCount
+ // 閿�鍞�
+ Consumable_order_details2__c dataForProductCount7 = new Consumable_order_details2__c();
+ dataForProductCount7.Bar_Code__c = '123456789298k250AAAAA';
+ dataForProductCount7.Sterilization_limit__c = Date.today().addDays(2);
+ dataForProductCount7.Arrive_date__c = Date.today();
+ dataForProductCount7.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount7.Consumable_Product__c = proH.id;
+ dataForProductCount7.Asset_Model_No__c = proH.Asset_Model_No__c;
+ dataForProductCount7.Box_Piece__c = '涓�';
+ dataForProductCount7.Used_date__c = Date.today();
+ dataForProductCount7.Consumable_order_minor__c = order.id;
- //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
- List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
- Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
- dataForProductCount4.Bar_Code__c = '1001';
- dataForProductCount4.Arrive_date__c = Date.today();
- dataForProductCount4.Send_Date__c = null;
- dataForProductCount4.Used_date__c = null;
- dataForProductCount4.Return_date__c = null;
- dataForProductCount4.Lose_Flag__c = false;
- dataForProductCount4.Cancellation_Flag__c = false;
- dataForProductCount4.Consumable_Product__c = proG.Id;
- dataForProductCount4.Consumable_Arrived_order__c = order2.id;
- dataForProductCount4.Used_account__c = myAccount1.Id;
- dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount4.Box_Piece__c = '涓�';
- conList1.add(dataForProductCount4);
- System.debug('conList1==>' + conList1);
- //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
- Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
- dataForProductCount5.Bar_Code__c = '1002';
- dataForProductCount5.Arrive_date__c = Date.today();
- dataForProductCount5.Send_Date__c = Date.today();
- dataForProductCount5.Used_date__c = Date.today();
- dataForProductCount5.Return_date__c = null;
- dataForProductCount5.Lose_Flag__c = false;
- dataForProductCount5.Cancellation_Flag__c = false;
- dataForProductCount5.Consumable_Product__c = proG.Id;
- dataForProductCount5.Consumable_Arrived_order__c = order2.id;
- dataForProductCount5.Used_account__c = myAccount1.Id;
- dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
- dataForProductCount5.Box_Piece__c = '涓�';
- conList1.add(dataForProductCount5);
- insert conList1;
- Test.startTest();
- LexTopPageController.initAgency();
- LexTopPageController.initPage(20, 1);
- LexTopPageController.ConsumableorderdetailsInfo c1 = new LexTopPageController.ConsumableorderdetailsInfo(
- proG
- );
- c1.allnumber = 10;
- LexTopPageController.ConsumableorderdetailsInfo c2 = new LexTopPageController.ConsumableorderdetailsInfo(
- proH
- );
- c2.allnumber = 20;
- c1.compareTo(c2);
- c1.allnumber = 20;
- c2.allnumber = 10;
- c1.compareTo(c2);
- Test.stopTest();
+ conList.add(dataForProductCount7);
+ // 鍦ㄥ簱 杩囨湡 鐩�
+ Consumable_order_details2__c dataForProduct = new Consumable_order_details2__c();
+ dataForProduct.Bar_Code__c = '123456789498k250BBBBB';
+ dataForProduct.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProduct.Arrive_date__c = Date.today();
+ dataForProduct.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProduct.Consumable_Product__c = proF.id;
+ dataForProduct.Asset_Model_No__c = proF.Asset_Model_No__c;
+ dataForProduct.Box_Piece__c = '涓�';
+ dataForProduct.Consumable_order_minor__c = order.id;
+
+ conList.add(dataForProduct);
+ // 鍦ㄥ簱 杩囨湡 涓�
+ Consumable_order_details2__c dataForProductCount3 = new Consumable_order_details2__c();
+ dataForProductCount3.Bar_Code__c = '123456788398k250CCCCC';
+ dataForProductCount3.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount3.Arrive_date__c = Date.today();
+ dataForProductCount3.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
+ dataForProductCount3.Consumable_Product__c = proG.id;
+ dataForProductCount3.Asset_Model_No__c = proG.Asset_Model_No__c;
+ dataForProductCount3.Box_Piece__c = '涓�';
+ dataForProductCount3.RemoveBox_No__c = 1;
+ dataForProductCount3.Consumable_order_minor__c = order.id;
+ conList.add(dataForProductCount3);
+ insert conList;
+
+ //杩囨湡搴撳瓨姹囨�讳俊鎭� add by Wang Xueqin
+ List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>();
+ Consumable_order_details2__c dataForProductCount4 = new Consumable_order_details2__c();
+ dataForProductCount4.Bar_Code__c = '1001';
+ dataForProductCount4.Arrive_date__c = Date.today();
+ dataForProductCount4.Send_Date__c = null;
+ dataForProductCount4.Used_date__c = null;
+ dataForProductCount4.Return_date__c = null;
+ dataForProductCount4.Lose_Flag__c = false;
+ dataForProductCount4.Cancellation_Flag__c = false;
+ dataForProductCount4.Consumable_Product__c = proG.Id;
+ dataForProductCount4.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount4.Used_account__c = myAccount1.Id;
+ dataForProductCount4.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount4.Box_Piece__c = '涓�';
+ conList1.add(dataForProductCount4);
+ System.debug('conList1==>'+conList1);
+ //鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ Consumable_order_details2__c dataForProductCount5 = new Consumable_order_details2__c();
+ dataForProductCount5.Bar_Code__c = '1002';
+ dataForProductCount5.Arrive_date__c = Date.today();
+ dataForProductCount5.Send_Date__c = Date.today();
+ dataForProductCount5.Used_date__c = Date.today();
+ dataForProductCount5.Return_date__c = null;
+ dataForProductCount5.Lose_Flag__c = false;
+ dataForProductCount5.Cancellation_Flag__c = false;
+ dataForProductCount5.Consumable_Product__c = proG.Id;
+ dataForProductCount5.Consumable_Arrived_order__c = order2.id;
+ dataForProductCount5.Used_account__c = myAccount1.Id;
+ dataForProductCount5.Sterilization_limit__c = Date.today().addDays(-2);
+ dataForProductCount5.Box_Piece__c = '涓�';
+ conList1.add(dataForProductCount5);
+ insert conList1;
+ Test.startTest();
+ LexTopPageController.initAgency();
+ LexTopPageController.initPage(20, 1);
+ LexTopPageController.ConsumableorderdetailsInfo c1 = new LexTopPageController.ConsumableorderdetailsInfo(proG);
+ c1.allnumber = 10;
+ LexTopPageController.ConsumableorderdetailsInfo c2 = new LexTopPageController.ConsumableorderdetailsInfo(proH);
+ c2.allnumber = 20;
+ c1.compareTo(c2);
+ c1.allnumber = 20;
+ c2.allnumber = 10;
+ c1.compareTo(c2);
+ Test.stopTest();
+ }
}
- }
-}
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml b/force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexUpAccountProLimit.cls b/force-app/main/default/classes/LexUpAccountProLimit.cls
index bf396dd..68dfba6 100644
--- a/force-app/main/default/classes/LexUpAccountProLimit.cls
+++ b/force-app/main/default/classes/LexUpAccountProLimit.cls
@@ -1,166 +1,150 @@
public without sharing class LexUpAccountProLimit {
- @AuraEnabled
- public static ResponseBodyLWC upAccount(
- String accountId,
- String productLimit,
- String userPro_Type
- ) {
- ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String, object> data = new Map<String, object>();
- res.entity = data;
+ @AuraEnabled
+ public static ResponseBodyLWC upAccount(String accountId,String productLimit,String userPro_Type){
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
- //--------AddStart-----XHL--------------20180929-------------
- Boolean EngFlag = false;
- Boolean ETFlag = false;
- String userPro_Typestr = null;
- if (String.isBlank(userPro_Type)) {
- userPro_Type = 'ET';
+ //--------AddStart-----XHL--------------20180929-------------
+ Boolean EngFlag = false;
+ Boolean ETFlag = false;
+ String userPro_Typestr = null;
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
+ }
+ if(userPro_Type == 'ENG'){
+ EngFlag = true;
+ }else{
+ ETFlag = true;
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
+ //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
+ userPro_Typestr = '%' + userPro_Type + '%';
+ //--------AddEnd-----XHL--------------20180929-------------
+ system.debug('userPro_Type' + userPro_Type);
+ String checkResoultstr = checkResoult(productLimit);
+ system.debug('checkResoultstr====>'+checkResoultstr);
+ system.debug('accountId'+accountId);
+ if(String.isNotBlank(checkResoultstr)){
+ return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', '');
+ // return checkResoultstr;
+ }
+ //String[] proidList =new String[]{};
+ String[] proList =new String[]{};
+ String[] pro_List =new String[]{};
+ List<Account> acc = [
+ SELECT
+ Id,
+ Name,
+ Product_Limit_Date__c
+ FROM
+ Account
+ WHERE
+ Id = : accountId
+ FOR UPDATE
+ ];
+ if(null == acc || acc.size() == 0) {
+ // return '娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹��';
+ return new ResponseBodyLWC('Error',500,'娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹��', '');
+ }
+ //proidList = acc[0].view_product__c.split(',');
+ //--------UpdateStart-----XHL--------------20180929-------------
+ String sql = '';
+
+ List<Product2__c> roduct2List = [SELECT Asset_Model_No__c,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 '
+ // + ' WHERE Pro2_Dealer_Object__c = true';
+ //if(EngFlag){
+ // sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ;
+ //}else if(ETFlag){
+ // sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag;
+ //}
+ //system.debug('sqlZZZZZZ' + sql);
+ //List<Product2__c> roduct2List = Database.query(sql);
+ //--------UpdateEnd-----XHL--------------20180929-------------
+ Map<String, String> productMap = new Map<String, String>();
+ proList = productLimit.split(',');
+ system.debug('productLimitDDDDD' + productLimit);
+ system.debug('proListFFFFF' + proList);
+ if(proList.size() > 0 && String.isNotEmpty(proList[0])){
+ for(Integer i = 0; i < proList.size(); i++){
+ pro_List.add(proList[i].subString(0,proList[i].indexOf( '|')));
+ }
+ }
+ if(roduct2List.size() > 0){
+ for(Product2__c pro2 :roduct2List){
+ productMap.put(pro2.Asset_Model_No__c, pro2.Asset_Model_No__c);
+ }
+ }
+ for(Integer i = 0; i < pro_List.size(); i++){
+ if(Test.isRunningTest()){
+ productMap.put('L13F101820AA','L13F101820AA');
+ productMap.put('Test01','Test01');
+ break;
+ }
+ if(!productMap.containsKey(pro_List[i])){
+ // return '缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪锛�';
+ return new ResponseBodyLWC('Error',500,'缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪锛�', '');
+ }
+ }
+ String productLimitDa = '';
+ for(String str : productLimit.split(',')){
+
+ if(str != null && str != ''){
+ productLimitDa += ',' + str;
+ }
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+ Account accinfo = new Account();
+ accinfo.Id = accountId;
+ if(EngFlag){
+ accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
+ }else if(ETFlag){
+ accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
+ }
+
+ UPDATE accinfo;
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ // return '';
+ }catch(DmlException de){
+ Database.rollback(sp);
+ throw de;
+ }
}
- if (userPro_Type == 'ENG') {
- EngFlag = true;
- } else {
- ETFlag = true;
- }
- //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
- //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
- userPro_Typestr = '%' + userPro_Type + '%';
- //--------AddEnd-----XHL--------------20180929-------------
- system.debug('userPro_Type' + userPro_Type);
- String checkResoultstr = checkResoult(productLimit);
- system.debug('checkResoultstr====>' + checkResoultstr);
- 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>{};
- List<Account> acc = [
- SELECT Id, Name, Product_Limit_Date__c
- FROM Account
- WHERE Id = :accountId
- FOR UPDATE
- ];
- if (null == acc || acc.size() == 0) {
- // return '娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹��';
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹��',
- ''
- );
- }
- //proidList = acc[0].view_product__c.split(',');
- //--------UpdateStart-----XHL--------------20180929-------------
- String sql = '';
+ public static String checkResoult (String productLimit){
+ String[] proLimit = productLimit.split(',');
+ String nowName = null, nowRightAsstModelNo = null;
+ List<String> asstModelNo = new List<String>();
+ Map<String,String> asstModelNoMap = new Map<String,String>();
+ List<String> asstModelNoCount = new List<String>();
+ for(Integer i = 0; i < proLimit.size(); i++){
+ nowName = proLimit[i];
+ if( nowName.indexOf( '|') >= 0) {
+ nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
+ }
+ asstModelNo.add(nowRightAsstModelNo);
+ }
- 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 '
- // + ' WHERE Pro2_Dealer_Object__c = true';
- //if(EngFlag){
- // sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ;
- //}else if(ETFlag){
- // sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag;
- //}
- //system.debug('sqlZZZZZZ' + sql);
- //List<Product2__c> roduct2List = Database.query(sql);
- //--------UpdateEnd-----XHL--------------20180929-------------
- Map<String, String> productMap = new Map<String, String>();
- proList = productLimit.split(',');
- system.debug('productLimitDDDDD' + productLimit);
- system.debug('proListFFFFF' + proList);
- if (proList.size() > 0 && String.isNotEmpty(proList[0])) {
- for (Integer i = 0; i < proList.size(); i++) {
- pro_List.add(proList[i].subString(0, proList[i].indexOf('|')));
- }
+ for(Integer i = 0; i < asstModelNo.size(); i++){
+ if(asstModelNoMap.containsKey(asstModelNo[i])){
+ asstModelNoCount.add(asstModelNo[i]);
+ }else{
+ asstModelNoMap.put(asstModelNo[i], asstModelNo[i]);
+ }
+ }
+ if(asstModelNoCount.size() > 0){
+ return '浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶嶃��';
+ // return new ResponseBodyLWC('Error',500,'浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶嶃��', '');
+ }else{
+ return '';
+ }
}
- 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 (Test.isRunningTest()) {
- productMap.put('L13F101820AA', 'L13F101820AA');
- productMap.put('Test01', 'Test01');
- break;
- }
- if (!productMap.containsKey(pro_List[i])) {
- // return '缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪锛�';
- return new ResponseBodyLWC(
- 'Error',
- 500,
- '缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪锛�',
- ''
- );
- }
- }
- String productLimitDa = '';
- for (String str : productLimit.split(',')) {
- if (str != null && str != '') {
- productLimitDa += ',' + str;
- }
- }
- Savepoint sp = Database.setSavepoint();
- try {
- Account accinfo = new Account();
- accinfo.Id = accountId;
- if (EngFlag) {
- accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa)
- ? productLimitDa
- : productLimitDa.subString(1);
- } else if (ETFlag) {
- accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa)
- ? productLimitDa
- : productLimitDa.subString(1);
- }
-
- update accinfo;
- res.status = 'Success';
- res.code = 200;
- System.debug('res = ' + res);
- return res;
- // return '';
- } catch (DmlException de) {
- Database.rollback(sp);
- throw de;
- }
- }
- public static String checkResoult(String productLimit) {
- String[] proLimit = productLimit.split(',');
- String nowName = null, nowRightAsstModelNo = null;
- List<String> asstModelNo = new List<String>();
- Map<String, String> asstModelNoMap = new Map<String, String>();
- List<String> asstModelNoCount = new List<String>();
- for (Integer i = 0; i < proLimit.size(); i++) {
- nowName = proLimit[i];
- if (nowName.indexOf('|') >= 0) {
- nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
- }
- asstModelNo.add(nowRightAsstModelNo);
- }
-
- for (Integer i = 0; i < asstModelNo.size(); i++) {
- if (asstModelNoMap.containsKey(asstModelNo[i])) {
- asstModelNoCount.add(asstModelNo[i]);
- } else {
- asstModelNoMap.put(asstModelNo[i], asstModelNo[i]);
- }
- }
- if (asstModelNoCount.size() > 0) {
- return '浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶嶃��';
- // return new ResponseBodyLWC('Error',500,'浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶嶃��', '');
- } else {
- return '';
- }
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls b/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls
index 4686c3c..5ba11bd 100644
--- a/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls
+++ b/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls
@@ -1,164 +1,69 @@
@isTest
-private class LexUpAccountProLimitControllerTest {
- @isTest
- static void proLimitTest() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
+private class LexUpAccountProLimitControllerTest
+{
+ @isTest
+ static void proLimitTest()
+ {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+
+ Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4');
+ insert myAccount2;
+ String productLimit = 'Test01|2|4,Test02|3|5';
+ String resultText = UpAccountProLimit.upAccount(myAccount2.Id,productLimit,'ET');
+ List<Account> accountre = [select Id,Product_Limit_Date__c from Account where Id = :myAccount2.Id ];
+ LexUpAccountProLimit.upAccount(myAccount2.Id,productLimit,'ENG');
+ LexUpAccountProLimit.upAccount(myAccount2.Id,productLimit,'');
+ LexUpAccountProLimit.upAccount('1000',productLimit,'ENG');
+ // System.assertEquals('Test01|2|4,Test02|3|5', accountre[0].Product_Limit_Date__c);
+ }
+ @isTest
+ static void proLimitTest1()
+ {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'];
+ Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '涓嶈',Dealer_special_Object__c = true);
+ Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '婧栧倷涓�',Dealer_special_Object__c = true);
+ insert new Product2[]{prod01,prod02};
+ Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
+ Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
+ insert new Product2__c[] {pro1, pro2};
+ System.debug('pro1===>'+pro1);
+ System.debug('pro2===>'+pro2);
- Account myAccount2 = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4'
- );
- insert myAccount2;
- String productLimit = 'Test01|2|4,Test02|3|5';
- String resultText = UpAccountProLimit.upAccount(
- myAccount2.Id,
- productLimit,
- 'ET'
- );
- List<Account> accountre = [
- SELECT Id, Product_Limit_Date__c
- FROM Account
- WHERE Id = :myAccount2.Id
- ];
- LexUpAccountProLimit.upAccount(myAccount2.Id, productLimit, 'ENG');
- LexUpAccountProLimit.upAccount(myAccount2.Id, productLimit, '');
- LexUpAccountProLimit.upAccount('1000', productLimit, 'ENG');
- // System.assertEquals('Test01|2|4,Test02|3|5', accountre[0].Product_Limit_Date__c);
- }
- @isTest
- static void proLimitTest1() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- Product2 prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '涓嶈',
- Dealer_special_Object__c = true
- );
- Product2 prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '婧栧倷涓�',
- Dealer_special_Object__c = true
- );
- insert new List<Product2>{ prod01, prod02 };
- Product2__c pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- Product2__c pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- insert new List<Product2__c>{ pro1, pro2 };
- System.debug('pro1===>' + pro1);
- System.debug('pro2===>' + pro2);
+ List<Product2__c> roduct2List1 = [SELECT Id,Asset_Model_No__c,Estimation_Entry_Possibility__c,Product_Type__c
+ FROM Product2__c WHERE id = :pro2.Id
+ ];
+ List<Product2__c> roduct2List2 = [SELECT Id,Asset_Model_No__c,Estimation_Entry_Possibility__c,Product_Type__c
+ FROM Product2__c WHERE id = :pro1.Id
+ ];
+ System.debug('roduct2List2===>'+roduct2List2);
- List<Product2__c> roduct2List1 = [
- SELECT
- Id,
- Asset_Model_No__c,
- Estimation_Entry_Possibility__c,
- Product_Type__c
- FROM Product2__c
- WHERE id = :pro2.Id
- ];
- List<Product2__c> roduct2List2 = [
- SELECT
- Id,
- Asset_Model_No__c,
- Estimation_Entry_Possibility__c,
- Product_Type__c
- FROM Product2__c
- WHERE id = :pro1.Id
- ];
- System.debug('roduct2List2===>' + roduct2List2);
-
- List<Product2__c> roduct2List = [
- SELECT Asset_Model_No__c, Estimation_Entry_Possibility__c
- FROM Product2__c
- WHERE
- Product_Type__c LIKE '%ENG%'
- AND Estimation_Entry_Possibility__c = '鈼�'
- ];
- System.debug('roduct2List' + roduct2List);
-
- Account myAccount2 = new Account(
- Name = 'Testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- Product_Limit_Date__c = 'Test01|2|4'
- );
- insert myAccount2;
- String productLimit = 'Test01|2|4,Test02|3|5';
- String productLimit1 = 'Test01|2|4';
- String resultText = UpAccountProLimit.upAccount(
- myAccount2.Id,
- productLimit,
- 'ENG'
- );
- List<Account> accountre = [
- SELECT Id, Product_Limit_Date__c
- FROM Account
- WHERE Id = :myAccount2.Id
- ];
- // LexUpAccountProLimit.upAccount(myAccount2.Id,productLimit,'');
- LexUpAccountProLimit.upAccount(myAccount2.Id, productLimit1, 'ET');
- // System.assertEquals('Test01|2|4,Test02|3|5', accountre[0].Product_Limit_Date__c);
- }
-}
+ List<Product2__c> roduct2List = [SELECT Asset_Model_No__c,Estimation_Entry_Possibility__c
+ FROM Product2__c
+ WHERE Product_Type__c like '%ENG%' and Estimation_Entry_Possibility__c = '鈼�'];
+ System.debug('roduct2List'+roduct2List);
+
+ Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4');
+ insert myAccount2;
+ String productLimit = 'Test01|2|4,Test02|3|5';
+ String productLimit1 = 'Test01|2|4';
+ String resultText = UpAccountProLimit.upAccount(myAccount2.Id,productLimit,'ENG');
+ List<Account> accountre = [select Id,Product_Limit_Date__c from Account where Id = :myAccount2.Id ];
+ // LexUpAccountProLimit.upAccount(myAccount2.Id,productLimit,'');
+ LexUpAccountProLimit.upAccount(myAccount2.Id,productLimit1,'ET');
+ // System.assertEquals('Test01|2|4,Test02|3|5', accountre[0].Product_Limit_Date__c);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml b/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LexUtilityTest.cls b/force-app/main/default/classes/LexUtilityTest.cls
index 33a257f..940b7aa 100644
--- a/force-app/main/default/classes/LexUtilityTest.cls
+++ b/force-app/main/default/classes/LexUtilityTest.cls
@@ -1,20 +1,17 @@
@IsTest
private class LexUtilityTest {
- @IsTest
- static void testMethod1() {
- User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
- insert n;
- LicenceReminderDate__c l = new LicenceReminderDate__c(
- Name = '180Days',
- ReminderDays__c = 180
- );
- insert l;
- Test.startTest();
- System.runAs(currentUser) {
- LexUtility.getIsNoteStay();
- LexUtility.getLicenceReminderDays();
+ @IsTest
+ static void testMethod1(){
+ User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ NoteStay__c n = new NoteStay__c(Name = 'NoteStay',IsStay__c = true);
+ insert n;
+ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180);
+ insert l;
+ Test.startTest();
+ System.runAs(currentUser){
+ LexUtility.getIsNoteStay();
+ LexUtility.getLicenceReminderDays();
+ }
+ Test.stopTest();
}
- Test.stopTest();
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexUtilityTest.cls-meta.xml b/force-app/main/default/classes/LexUtilityTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LexUtilityTest.cls-meta.xml
+++ b/force-app/main/default/classes/LexUtilityTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/LookupSearchResultTest.cls b/force-app/main/default/classes/LookupSearchResultTest.cls
index 3808289..829c3dd 100644
--- a/force-app/main/default/classes/LookupSearchResultTest.cls
+++ b/force-app/main/default/classes/LookupSearchResultTest.cls
@@ -1,63 +1,37 @@
@isTest
private class LookupSearchResultTest {
- @testSetup
- static void testInfo() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
+ @testSetup
+ static void testInfo(){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Account myAccount2 = new Account(name='Account001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
+ insert myAccount2;
+ }
+
+ @isTest
+ static void testLookupSearchResult(){
+ String id = '';
+ String title = '';
+ List<Account> account = [SELECT Id,Name FROM Account WHERE Name = 'Account001' limit 1];
+ for(Account acc : account){
+ id = acc.Id;
+ }
+ object compareTo = account;
+ LookupSearchResult resultA = new LookupSearchResult(id, 'Account', 'standard:account', 'Account', 'Account');
+ LookupSearchResult resultB = new LookupSearchResult('', '', '', title, '');
+ LookupSearchResult resultC = new LookupSearchResult(id, 'Account', 'standard:account', title, 'Account');
+ System.Test.startTest();
+ resultA.getId();
+ resultA.getSObjectType();
+ resultA.getIcon();
+ resultA.getTitle();
+ resultA.getSubtitle();
+ resultB.compareTo(resultB);
+ System.assertEquals(1, account.size(), 'expecting to find 1 Account');
+ List<LookupSearchResult> con = new List<LookupSearchResult>();
+ con.sort();
+ System.Test.stopTest();
}
- Account myAccount2 = new Account(
- name = 'Account001',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '2'
- );
- insert myAccount2;
- }
-
- @isTest
- static void testLookupSearchResult() {
- String id = '';
- String title = '';
- List<Account> account = [
- SELECT Id, Name
- FROM Account
- WHERE Name = 'Account001'
- LIMIT 1
- ];
- for (Account acc : account) {
- id = acc.Id;
- }
- object compareTo = account;
- LookupSearchResult resultA = new LookupSearchResult(
- id,
- 'Account',
- 'standard:account',
- 'Account',
- 'Account'
- );
- LookupSearchResult resultB = new LookupSearchResult('', '', '', title, '');
- LookupSearchResult resultC = new LookupSearchResult(
- id,
- 'Account',
- 'standard:account',
- title,
- 'Account'
- );
- System.Test.startTest();
- resultA.getId();
- resultA.getSObjectType();
- resultA.getIcon();
- resultA.getTitle();
- resultA.getSubtitle();
- resultB.compareTo(resultB);
- System.assertEquals(1, account.size(), 'expecting to find 1 Account');
- List<LookupSearchResult> con = new List<LookupSearchResult>();
- con.sort();
- System.Test.stopTest();
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml b/force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml
+++ b/force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/ResponseBodyLWCTest.cls b/force-app/main/default/classes/ResponseBodyLWCTest.cls
index 686be82..4fcf69a 100644
--- a/force-app/main/default/classes/ResponseBodyLWCTest.cls
+++ b/force-app/main/default/classes/ResponseBodyLWCTest.cls
@@ -1,18 +1,8 @@
@isTest
public class ResponseBodyLWCTest {
- static testMethod void test1() {
- ResponseBodyLWC l1 = new ResponseBodyLWC();
- ResponseBodyLWC l2 = new ResponseBodyLWC(
- 'status',
- 200,
- 'testmsg',
- new Map<String, String>()
- );
- ResponseBodyLWC l3 = new ResponseBodyLWC(
- 'status',
- 200,
- 'testmsg',
- new List<Object>()
- );
- }
-}
+ static testMethod void test1() {
+ ResponseBodyLWC l1 = new ResponseBodyLWC();
+ ResponseBodyLWC l2 = new ResponseBodyLWC('status',200,'testmsg',new Map<String,String>());
+ ResponseBodyLWC l3 = new ResponseBodyLWC('status',200,'testmsg',new List<Object>());
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml b/force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml
+++ b/force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
index b4bbcbf..3372052 100644
--- a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
+++ b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
@@ -1,107 +1,56 @@
@isTest
private class lexSearchAgencyHospitalControllerTest {
- @isTest
- static void testInit() {
- User myUser_test;
- Account myAccount2;
- Product2__c pro2;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
- ];
- Product2 prod02 = new Product2(
- Name = 'Test02181',
- ProductCode = 'Test0218',
- Asset_Model_No__c = 'Test0218',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- SFDA_Approbation_No__c = 'Test002',
- Packing_list_manual__c = 12,
- SFDA_Expiration_Date__c = Date.today(),
- Category5__c = 'tset8',
- Manual_Entry__c = false
- );
- pro2 = new Product2__c(
- Name = 'Pro002181',
- OT_CODE_Text__c = 'Test002181',
- Product2__c = prod02.Id
- );
- insert pro2;
- myAccount2 = new Account(
- name = 'Testaccount003',
- Dealer_discount__c = 20,
- RecordTypeId = rectCo[0].Id,
- AgentCode_Ext__c = '2'
- );
- insert myAccount2;
-
- Contact core = new Contact(
- email = 'wan@salesforce.com',
- firstname = 'wan',
- lastname = 'Plumbers',
- accountid = myAccount2.id
- );
- insert core;
- myUser_test = new User(
- ContactId = core.id,
- Alias = 'newUser',
- Email = 'newuser@testorg.com',
- EmailEncodingKey = 'UTF-8',
- LastName = 'TestUser',
- LanguageLocaleKey = 'zh_CN',
- LocaleSidKey = 'zh_CN',
- ProfileId = prof.Id,
- TimeZoneSidKey = 'Asia/Shanghai',
- UserName = 'testUser@testorg.com',
- UserPro_Type__c = 'ENG',
- Work_Location__c = '鍖椾含'
- );
- insert myUser_test;
- myUser_test.UserPro_Type__c = '';
- update myUser_test;
- }
- System.runAs(MyUser_Test) {
- System.Test.startTest();
- String accountId = myUser_test.accountid;
- String agencyProType = myUser_test.UserPro_Type__c;
- String searchName = '';
- List<Agency_Hospital_Link__c> ahlInfo = [
- SELECT Hospital__c, Hospital__r.Name
- FROM Agency_Hospital_Link__c
- WHERE Agency__c = :accountId AND Hosptial_Type__c != NULL
- LIMIT 1
- ];
- Set<Id> whoIds = new Set<Id>();
- for (Agency_Hospital_Link__c ahl : ahlInfo) {
- whoIds.add(ahl.Hospital__c);
- if (String.isBlank(searchName)) {
- searchName = ahl.Hospital__r.Name;
+ @isTest
+ static void testInit(){
+ User myUser_test;
+ Account myAccount2;
+ Product2__c pro2;
+ User thisUser = [ SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+ System.runAs(thisUser){
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+ Product2 prod02 = new Product2(Name='Test02181',ProductCode='Test0218',Asset_Model_No__c = 'Test0218',SFDA_Status__c = '鏈夊姽',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset8',Manual_Entry__c = false);
+ pro2 = new Product2__c(Name='Pro002181',OT_CODE_Text__c='Test002181',Product2__c = prod02.Id);
+ insert pro2;
+ myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
+ insert myAccount2;
+
+ Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
+ insert core;
+ myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='鍖椾含');
+ insert myUser_test;
+ myUser_test.UserPro_Type__c = '';
+ update myUser_test;
}
- }
- Map<ID, Account> accInfo = new Map<ID, Account>(
- [
- SELECT Id, Name, State_Master__c, State_Master__r.Name
- FROM Account
- WHERE Id IN :whoIds
- ]
- );
- Map<String, object> data = new Map<String, object>();
- data.put('accInfo', accInfo);
- String ctype = 'ET';
- lexSearchAgencyHospitalController.init(ctype);
- lexSearchAgencyHospitalController.serContact(searchName, ctype);
- System.Test.stopTest();
+ System.runAs(MyUser_Test){
+ System.Test.startTest();
+ String accountId = myUser_test.accountid;
+ String agencyProType = myUser_test.UserPro_Type__c;
+ String searchName = '';
+ List<Agency_Hospital_Link__c> ahlInfo = [SELECT Hospital__c,Hospital__r.Name
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c =:accountId
+ AND Hosptial_Type__c <> NULL
+ LIMIT 1];
+ Set<Id> whoIds = new Set<Id>();
+ for(Agency_Hospital_Link__c ahl : ahlInfo){
+ whoIds.add(ahl.Hospital__c);
+ if(String.isBlank(searchName)){
+ searchName = ahl.Hospital__r.Name;
+ }
+ }
+ Map<ID, Account> accInfo = new Map<ID, Account>([SELECT Id,Name,State_Master__c,State_Master__r.Name
+ FROM Account
+ WHERE Id IN:whoIds]);
+ Map<String, object> data = new Map<String, object>();
+ data.put('accInfo',accInfo);
+ String ctype = 'ET';
+ lexSearchAgencyHospitalController.init(ctype);
+ lexSearchAgencyHospitalController.serContact(searchName,ctype);
+ System.Test.stopTest();
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml
index a9fd6e9..754ecb1 100644
--- a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml
+++ b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml
index e46f582..6d762cb 100644
--- a/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml
+++ b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
<isVisibleByExternalUsers>true</isVisibleByExternalUsers>
<language>zh_CN</language>
diff --git a/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml b/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml
index 2ec551c..0874b6a 100644
--- a/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml
+++ b/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
<isVisibleByExternalUsers>true</isVisibleByExternalUsers>
<language>zh_CN</language>
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html
index ce635b7..590c111 100644
--- a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html
@@ -1,10 +1,8 @@
<template>
- <template if:false={isDisable}>
- <lightning-formatted-url
- value={accountUrl}
- label={accountName}
- target="_blank"
- ></lightning-formatted-url>
- </template>
- <template if:true={isDisable}> {accountName} </template>
-</template>
+ <template if:false={isDisable}>
+ <lightning-formatted-url value={accountUrl} label={accountName} target="_blank"></lightning-formatted-url>
+ </template>
+ <template if:true={isDisable}>
+ {accountName}
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js
index 93504a2..7b8bb35 100644
--- a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js
@@ -1,15 +1,15 @@
-import { LightningElement, api } from "lwc";
+import { LightningElement,api } from 'lwc';
export default class CustomAccountUrlComp extends LightningElement {
- @api accountName;
- @api accountUrl;
- @api isDisable;
+ @api accountName;
+ @api accountUrl;
+ @api isDisable;
- connectedCallback() {
- console.log("zhj");
- console.log("杩涘叆CustomAccountUrlComp");
- console.log("accountName = " + this.accountName);
- console.log("accountUrl = " + this.accountUrl);
- console.log("isDisable = " + this.isDisable);
- }
-}
+ connectedCallback(){
+ console.log('zhj')
+ console.log('杩涘叆CustomAccountUrlComp')
+ console.log('accountName = ' + this.accountName);
+ console.log('accountUrl = ' + this.accountUrl);
+ console.log('isDisable = ' + this.isDisable);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml
index a1a42a8..3fe0e73 100644
--- a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<isExposed>false</isExposed>
-</LightningComponentBundle>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html
index 3bd017b..b0e319f 100644
--- a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html
@@ -1,7 +1,3 @@
<template>
- <lightning-textarea
- name="input1"
- label="Enter some text"
- variant="label-hidden"
- ></lightning-textarea>
-</template>
+ <lightning-textarea name="input1" label="Enter some text" variant="label-hidden"></lightning-textarea>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js
index 7a8e135..f5a923c 100644
--- a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js
@@ -1,3 +1,3 @@
-import { LightningElement } from "lwc";
+import { LightningElement } from 'lwc';
-export default class CustomDeleteReasonComp extends LightningElement {}
+export default class CustomDeleteReasonComp extends LightningElement {}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml
index a1a42a8..3fe0e73 100644
--- a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<isExposed>false</isExposed>
-</LightningComponentBundle>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.html b/force-app/main/default/lwc/customMydrComp/customMydrComp.html
index 4ca1adf..f01ac90 100644
--- a/force-app/main/default/lwc/customMydrComp/customMydrComp.html
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.html
@@ -1,10 +1,4 @@
<template>
- <lightning-input
- type="checkbox"
- label="浠匨yDr"
- checked={isCheckedMyDr}
- onchange={dataChange}
- variant="label-hidden"
- data-field="MyDr"
- ></lightning-input>
-</template>
+ <lightning-input type="checkbox" label="浠匨yDr" checked={isCheckedMyDr} onchange={dataChange} variant="label-hidden"
+ data-field="MyDr"></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.js b/force-app/main/default/lwc/customMydrComp/customMydrComp.js
index 35ef793..cd1f38e 100644
--- a/force-app/main/default/lwc/customMydrComp/customMydrComp.js
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.js
@@ -1,16 +1,16 @@
-import { LightningElement, track, api } from "lwc";
+import { LightningElement,track,api } from 'lwc';
export default class CustomMydrComp extends LightningElement {
- @api recordId;
- @api isCheckedMyDr;
+ @api recordId;
+ @api isCheckedMyDr;
- connectedCallback() {
- console.log("this.recordId = " + this.recordId);
- console.log("this.isCheckedMyDr = " + this.isCheckedMyDr);
- }
+ connectedCallback(){
+ console.log('this.recordId = ' + this.recordId);
+ console.log('this.isCheckedMyDr = ' + this.isCheckedMyDr);
+ }
- dataChange(event) {
- this.isCheckedMyDr = event.target.checked;
- console.log("this.isCheckedMyDr = " + this.isCheckedMyDr);
- }
-}
+ dataChange(event){
+ this.isCheckedMyDr = event.target.checked;
+ console.log('this.isCheckedMyDr = ' + this.isCheckedMyDr);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml b/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml
index a1a42a8..3fe0e73 100644
--- a/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<isExposed>false</isExposed>
-</LightningComponentBundle>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutputGood/customOutputGood.html b/force-app/main/default/lwc/customOutputGood/customOutputGood.html
index 0277ba5..d2c8ea1 100644
--- a/force-app/main/default/lwc/customOutputGood/customOutputGood.html
+++ b/force-app/main/default/lwc/customOutputGood/customOutputGood.html
@@ -6,7 +6,7 @@
<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;">
+ <div style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;font-size:14px;color:#696969;">
<lightning-formatted-text value={outputValue}></lightning-formatted-text>
</div>
</template>
diff --git a/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html b/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
index 78a8aec..bff6b32 100644
--- a/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
+++ b/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
@@ -1,354 +1,413 @@
<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>
- <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: 74px">
- <div style="color: #696969; font-size: 16px">
- 璁㈠崟鍚嶇О
- </div>
- </td>
- <td style="width: 200px">
- <lightning-formatted-text
- style="font-size: 16px"
- value={coc.Name}
- ></lightning-formatted-text>
- </td>
- <td style="width: 30px"></td>
- <td style="width: 74px">
- <div style="color: #696969; font-size: 16px">
- 璁㈠崟鎬绘暟
- </div>
- </td>
- <td style="width: 100px">
- <lightning-formatted-number
- style="font-size: 16px"
- value={coc.Total_num__c}
- ></lightning-formatted-number>
- </td>
- <td style="width: 30px"></td>
- <td style="width: 90px">
- <div style="color: #696969; font-size: 16px">
- 宸插埌璐ф暟閲�
- </div>
- </td>
- <td style="width: 100px">
- <lightning-formatted-number
- style="font-size: 16px"
- value={coc.OrderNumber_arrived__c}
- ></lightning-formatted-number>
- </td>
- <td style="width: 30px"></td>
- <td style="width: 106px">
- <div style="color: #696969; font-size: 16px">
- 杩樻病鍙戣揣鏁伴噺
- </div>
- </td>
- <td style="width: 100px">
- <lightning-formatted-number
- style="font-size: 16px"
- 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
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div
style="
- border: 1px solid #d4d4d4;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div
- style="
- border-bottom: 1px solid #d4d4d4;
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
border-radius: 5px;
- margin-bottom: 7px;
- color: #ff6a00;
- font-size: 17px;
- "
- >
- <lightning-icon icon-name="utility:warning"></lightning-icon>
- <strong> 璀﹀憡</strong>
- </div>
- <template for:each={warningMsgs} for:item="msg">
- <p
- key={msg}
- style="color: #ff6a00; padding-left: 7px; font-size: 14px"
- >
- 銉� {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> 閿欒</strong>
- </div>
- <template for:each={errorMsgs} for:item="msg">
- <p
- key={msg}
- style="color: red; padding-left: 7px; font-size: 14px"
- >
- 銉� {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> -->
+ <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;">
+ <!-- 鎸夐挳 -->
+ <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: 74px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ "
+ >
+ 璁㈠崟鍚嶇О
+ </div>
+ </td>
+ <td style="width: 200px">
+ <lightning-formatted-text style="font-size: 16px;"
+ value={coc.Name}
+ ></lightning-formatted-text>
+ </td>
+ <td style="width: 30px"></td>
+ <td style="width: 74px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ "
+ >
+ 璁㈠崟鎬绘暟
+ </div>
+ </td>
+ <td style="width: 100px">
+ <lightning-formatted-number style="font-size: 16px;"
+ value={coc.Total_num__c}
+ ></lightning-formatted-number>
+ </td>
+ <td style="width: 30px"></td>
+ <td style="width: 90px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ "
+ >
+ 宸插埌璐ф暟閲�
+ </div>
+ </td>
+ <td style="width: 100px">
+ <lightning-formatted-number style="font-size: 16px;"
+ value={coc.OrderNumber_arrived__c}
+ ></lightning-formatted-number>
+ </td>
+ <td style="width: 30px"></td>
+ <td style="width: 106px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ "
+ >
+ 杩樻病鍙戣揣鏁伴噺
+ </div>
+ </td>
+ <td style="width: 100px">
+ <lightning-formatted-number style="font-size: 16px;"
+ 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> 璀﹀憡</strong>
+ </div>
+ <template for:each={warningMsgs} for:item="msg">
+ <p
+ key={msg}
+ style="
+ color: #ff6a00;
+ padding-left: 7px;
+ font-size: 14px;
+ "
+ >
+ 銉� {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> 閿欒</strong>
+ </div>
+ <template for:each={errorMsgs} for:item="msg">
+ <p
+ key={msg}
+ style="
+ color: red;
+ padding-left: 7px;
+ font-size: 14px;
+ "
+ >
+ 銉� {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">
@@ -362,37 +421,37 @@
<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"
- style="word-wrap: break-word; word-break: break-all"
- 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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js b/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
index 99cbcb8..348f5ee 100644
--- a/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
+++ b/force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
@@ -1,800 +1,910 @@
-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";
+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";
+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;
- }
- }
- //鏈鍒拌揣浜у搧姹囨�籧ols
- @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: 95
- });
- // 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: 85
- });
- cols.push({
- label: "瀹㈡埛鍚�",
- fieldName: "hospitalName",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 85
- });
- 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
- 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
- @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;
- }
- }
-
- 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;
- })
- .catch((error) => {
- console.error("Error loading custom styles");
+ //鏈鍒拌揣浜у搧姹囨�籧ols
+ @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: 95
});
+ // 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: 85
+ });
+ cols.push({
+ label: '瀹㈡埛鍚�',
+ fieldName: 'hospitalName',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 85
+ });
+ 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;
}
- }
-
- //鍒濆鍖�
- 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");
+ //鍏ュ簱鏄庣粏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
+ });
}
- })
- .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) {
- 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");
- }
- })
- .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;
- }
- }
+ return cols;
}
- }
-
- //杩斿搧鍘熷洜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
- }
- };
- 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");
+ //閿欒鏄庣粏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
}
- })
- .catch((error) => {
- this.showSpinner = false;
- console.log("error2:" + 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
- }
- };
- 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");
+ // 鑾峰彇鍙傛暟
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log('CurrentPageReference');
+ if (currentPageReference) {
+ this.arrType = currentPageReference.state?.ArrType;
+ this.eSetId = currentPageReference.state?.ESetId;
}
- })
- .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";
+ get showOrderDetail() {
+ if (this.eSetId != '' && this.eSetId != null) {
+ return true;
+ } else {
+ return false;
+ }
}
- if (message != "") {
- content =
- "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
- } else {
- content = "<h2><strong>" + title + "<strong/></h2>";
+
+ 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');
+ });
+ }
}
- 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);
- }
-}
+
+ //鍒濆鍖�
+ 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) {
+ 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');
+ }
+ })
+ .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;
+ }
+ }
+ }
+ }
+
+ //杩斿搧鍘熷洜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
+ }
+ };
+ 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');
+ });
+ }
+
+ // 鐧诲綍杩斿搧
+ 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);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
index 4d97524..d83b5ea 100644
--- a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
@@ -1,227 +1,241 @@
<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>
- <template if:true={showPage}>
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- "
- >
- <div style="padding: 10px">
- <!-- 鎸夐挳 -->
- <!-- <lightning-button style="margin: 5px;" label="鍏ュ簱" onclick={orderArrive}></lightning-button>
+ <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>
+ <template if:true={showPage}>
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ "
+ >
+ <div style="padding: 10px">
+ <!-- 鎸夐挳 -->
+ <!-- <lightning-button style="margin: 5px;" label="鍏ュ簱" onclick={orderArrive}></lightning-button>
<lightning-button style="margin: 5px;" label="杩斿搧" onclick={orderReturn}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- style="margin: 5px; margin-right: 150px"
- label="鍏ュ簱"
- onclick={orderArrive}
- >
- 鍏ュ簱
- </button>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- style="margin: 5px"
- label="杩斿搧"
- onclick={orderReturn}
- >
- 杩斿搧
- </button>
- <p style="height: 10px"></p>
- <!-- 妫�绱㈡潯浠� -->
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>妫�绱㈡潯浠�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>妫�绱㈡潯浠�</strong></p> -->
- </div>
- <div style="padding: 10px">
- <table>
- <tbody>
- <tr>
- <td style="width: 10px"></td>
- <td style="width: 120px">
- <div
- style="color: #696969; font-size: 16px; text-align: left"
- >
- 娑堣�楀搧璁㈠崟鍚嶇О
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ style="margin: 5px; margin-right: 150px"
+ label="鍏ュ簱"
+ onclick={orderArrive}
+ >
+ 鍏ュ簱
+ </button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ style="margin: 5px"
+ label="杩斿搧"
+ onclick={orderReturn}
+ >
+ 杩斿搧
+ </button>
+ <p style="height: 10px"></p>
+ <!-- 妫�绱㈡潯浠� -->
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>妫�绱㈡潯浠�</strong></p> -->
</div>
- </td>
- <td>
- <lightning-input
- class="inputFont"
- type="text"
- variant="label-hidden"
- label="娑堣�楀搧璁㈠崟鍚嶇О"
- value={category1}
- onchange={category1Change}
- ></lightning-input>
- </td>
- <td style="width: 30px"></td>
- <td style="width: 108px">
- <div
- style="color: #696969; font-size: 16px; text-align: left"
- >
- 鏈�鏂板彂璐ф棩鏈�
- </div>
- </td>
- <td>
- <lightning-input
- class="inputFont"
- type="date"
- variant="label-hidden"
- label="鏈�鏂板彂璐ф棩鏈�"
- value={cate2}
- onchange={cate2Change}
- ></lightning-input>
- </td>
- <td style="width: 30px"></td>
- <td>
- <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="鎼滅储" onclick={search}></lightning-button>
+ <div style="padding: 10px">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width: 10px"></td>
+ <td style="width: 120px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ text-align: left;
+ "
+ >
+ 娑堣�楀搧璁㈠崟鍚嶇О
+ </div>
+ </td>
+ <td>
+ <lightning-input
+ class="inputFont"
+ type="text"
+ variant="label-hidden"
+ label="娑堣�楀搧璁㈠崟鍚嶇О"
+ value={category1}
+ onchange={category1Change}
+ ></lightning-input>
+ </td>
+ <td style="width: 30px"></td>
+ <td style="width: 108px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ text-align: left;
+ "
+ >
+ 鏈�鏂板彂璐ф棩鏈�
+ </div>
+ </td>
+ <td>
+ <lightning-input
+ class="inputFont"
+ type="date"
+ variant="label-hidden"
+ label="鏈�鏂板彂璐ф棩鏈�"
+ value={cate2}
+ onchange={cate2Change}
+ ></lightning-input>
+ </td>
+ <td style="width: 30px"></td>
+ <td>
+ <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="鎼滅储" onclick={search}></lightning-button>
<lightning-button style="margin-left: 5px;margin-right: 5px;" label="娓呯┖" onclick={clear}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- style="height: 32px; margin-right: 30px"
- label="鎼滅储"
- onclick={search}
- >
- 鎼滅储
- </button>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
- style="height: 32px"
- label="娓呯┖"
- onclick={clear}
- >
- 娓呯┖
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ style="
+ height: 32px;
+ margin-right: 30px;
+ "
+ label="鎼滅储"
+ onclick={search}
+ >
+ 鎼滅储
+ </button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ style="height: 32px"
+ label="娓呯┖"
+ onclick={clear}
+ >
+ 娓呯┖
+ </button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 璁㈠崟鏄庣粏 -->
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璁㈠崟鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>璁㈠崟鏄庣粏</strong></p> -->
+ </div>
+ <div style="padding: 10px">
+ <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms} data={raesList}></lightning-datatable> -->
+ <c-lex-custom-lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="Id"
+ data={raesList}
+ columns={colms}
+ onclicklink={clickLick}
+ ></c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </div>
</div>
- <!-- 璁㈠崟鏄庣粏 -->
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
+ </template>
+ <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
+ <template if:true={showPop}>
+ <section
+ role="dialog"
+ tabindex="-1"
+ aria-labelledby="modal-heading-01"
+ aria-modal="true"
+ aria-describedby="modal-content-id-1"
+ class="slds-modal slds-fade-in-open slds-modal_small"
+ style="border: 1px solid #d4d4d4"
>
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>璁㈠崟鏄庣粏</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>璁㈠崟鏄庣粏</strong></p> -->
- </div>
- <div style="padding: 10px">
- <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms} data={raesList}></lightning-datatable> -->
- <c-lex-custom-lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="Id"
- data={raesList}
- columns={colms}
- onclicklink={clickLick}
- ></c-lex-custom-lightning-datatable>
- </div>
- </div>
- </div>
- </div>
- </template>
- <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
- <template if:true={showPop}>
- <section
- role="dialog"
- tabindex="-1"
- aria-labelledby="modal-heading-01"
- aria-modal="true"
- aria-describedby="modal-content-id-1"
- class="slds-modal slds-fade-in-open slds-modal_small"
- style="border: 1px solid #d4d4d4"
- >
- <div class="slds-modal__container">
- <header class="slds-modal__header" style="background-color: #f3f3f3">
- <button
- style=""
- class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
- title="Close"
- onclick={closePop}
- >
- <lightning-icon
- icon-name="utility:close"
- alternative-text="close"
- variant="inverse"
- size="small"
- ></lightning-icon>
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2
- id="modal-heading-01"
- class="slds-text-heading_medium slds-hyphenate"
- >
- {popTitle}
- </h2>
- </header>
- <div
- class="slds-modal__content slds-p-around_medium"
- id="modal-content-id-1"
- style="border: 1px solid #f3f3f3"
- >
- <lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="prodModel"
- columns={colms2}
- data={recordList}
- ></lightning-datatable>
- </div>
- <footer class="slds-modal__footer">
- <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
- style="margin-left: 10px"
- variant="neutral"
- label="鍏抽棴"
- onclick={closePop}
- >
- 鍏抽棴
- </button>
- </footer>
- </div>
- </section>
- <div class="slds-backdrop slds-backdrop_open"></div>
- </template>
-</template>
+ <div class="slds-modal__container">
+ <header
+ class="slds-modal__header"
+ style="background-color: #f3f3f3"
+ >
+ <button
+ style=""
+ class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close"
+ onclick={closePop}
+ >
+ <lightning-icon
+ icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small"
+ ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2
+ id="modal-heading-01"
+ class="slds-text-heading_medium slds-hyphenate"
+ >
+ {popTitle}
+ </h2>
+ </header>
+ <div
+ class="slds-modal__content slds-p-around_medium"
+ id="modal-content-id-1"
+ style="border: 1px solid #f3f3f3"
+ >
+ <lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="prodModel"
+ columns={colms2}
+ data={recordList}
+ ></lightning-datatable>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ style="margin-left: 10px"
+ variant="neutral"
+ label="鍏抽棴"
+ onclick={closePop}
+ >
+ 鍏抽棴
+ </button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
index 03c8a53..85ae806 100644
--- a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
@@ -1,523 +1,529 @@
-import { LightningElement, wire, api, track } from "lwc";
-import { CurrentPageReference } from "lightning/navigation";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import { NavigationMixin } from "lightning/navigation";
-import init from "@salesforce/apex/LexArriveGoodsMainController.init";
-import searchConsumableorderdetails from "@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails";
-import initTotalNum from "@salesforce/apex/LexConsumableGoodsInfo.initTotalNum";
-import initArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initArrDet";
-import initArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll";
-import initDeliveryDet from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet";
-import initDeliveryDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll";
-import initNotArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet";
-import initNotArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll";
-import initMoreThan7 from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7";
-import initMoreThan7All from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All";
+import { LightningElement, wire, api, track } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexArriveGoodsMainController.init';
+import searchConsumableorderdetails from '@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails';
+import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
+import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
+import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
+import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
+import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
+import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
+import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
+import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
+import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
//table css
-import { loadStyle } from "lightning/platformResourceLoader";
-import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexArriveGoodsMain extends NavigationMixin(
- LightningElement
+ LightningElement
) {
- //椤甸潰鍩虹鍙橀噺
- @track agencyProType;
- @track category1;
- @track cate2;
- // @track eSetId;
- @track accountId;
- @track title = [];
- @track raesList = [];
- @track recordList = [];
- @track userWorkLocation;
- @track totalNum;
- @track orderNumberArrived;
- @track deliveryDetailCount;
- @track orderNumberNotarrive;
- @track moreThanSevenDays;
- @track showSpinner = true;
- @track showPage = false;
- @track showPop = false;
- @track popTitle;
- stylesLoaded = false;
- //鏄惁涓�鐩存樉绀烘彁绀�
- @track isNoteStay = true;
+ //椤甸潰鍩虹鍙橀噺
+ @track agencyProType;
+ @track category1;
+ @track cate2;
+ // @track eSetId;
+ @track accountId;
+ @track title = [];
+ @track raesList = [];
+ @track recordList = [];
+ @track userWorkLocation;
+ @track totalNum;
+ @track orderNumberArrived;
+ @track deliveryDetailCount;
+ @track orderNumberNotarrive;
+ @track moreThanSevenDays;
+ @track showSpinner = true;
+ @track showPage = false;
+ @track showPop = false;
+ @track popTitle;
+ stylesLoaded = false;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
- @track colms = [
- // {label:'娑堣�楀搧璁㈠崟鍚嶇О',fieldName:'Name'},
- // {label:'璁㈠崟鎬绘暟',fieldName:'Total_num__c'},
- // {label:'宸插埌璐ф暟閲�',fieldName:'OrderNumber_arrived__c'},
- // {label:'寰呯郴缁熸搷浣滃叆搴撴暟閲�',fieldName:'Delivery_detail_count__c'},
- // {label:'杩樻病鍙戣揣鏁伴噺',fieldName:'OrderNumber_notarrive__c'},
- // {label:'鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',fieldName:'More_than_seven_days__c'},
- {
- label: "娑堣�楀搧璁㈠崟鍚嶇О",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "Name" },
- type: "Title",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- // initialWidth: 200,
- wrapText: true
- },
- {
- label: "SAP鍚堝悓鍙�",
- fieldName: "ContractNo__c",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 180
- },
- {
- label: "璁㈠崟鎬绘暟",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "Total_num__c" },
- type: "TotalNum",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 100,
- cellAttributes: { alignment: "right" }
- },
- {
- label: "宸插埌璐ф暟閲�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "OrderNumber_arrived__c" },
- type: "ArrDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 100,
- cellAttributes: { alignment: "right" }
- },
- {
- label: "寰呯郴缁熸搷浣滃叆搴撴暟閲�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "Delivery_detail_count__c" },
- type: "DeliveryDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 150,
- cellAttributes: { alignment: "right" }
- },
- {
- label: "杩樻病鍙戣揣鏁伴噺",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "OrderNumber_notarrive__c" },
- type: "NotArrDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 120,
- cellAttributes: { alignment: "right" }
- },
- {
- label: "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "More_than_seven_days__c" },
- type: "MoreThan7",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 150,
- cellAttributes: { alignment: "right" }
- },
- {
- label: "鏈�鏂板彂璐ф棩鏈�",
- fieldName: "Shipment_date__c",
- hideDefaultActions: true,
- initialWidth: 105
- },
- {
- label: "棣栨鍙戣揣鏃ユ湡",
- fieldName: "First_Delivery__c",
- hideDefaultActions: true,
- initialWidth: 105
- }
- ];
-
- @track colms2 = [
- { label: "浜у搧鍨嬪彿", fieldName: "prodModel", hideDefaultActions: true },
- {
- label: "鏁伴噺",
- fieldName: "recordCount",
- hideDefaultActions: true,
- initialWidth: 100
- }
- ];
-
- //鑾峰彇鍙傛暟
- // @wire(CurrentPageReference)
- // getStateParameters(currentPageReference) {
- // console.log('CurrentPageReference');
- // if (currentPageReference) {
- // this.eSetId = currentPageReference.state?.ESetid;
- // }
- // }
-
- renderedCallback() {
- if (!this.stylesLoaded) {
- Promise.all([loadStyle(this, WrappedHeaderTable)])
- .then(() => {
- console.log("Custom styles loaded");
- this.stylesLoaded = true;
- })
- .catch((error) => {
- console.error("Error loading custom styles");
- });
- }
- }
-
- //鍒濆鍖�
- connectedCallback() {
- init().then((result) => {
- this.isNoteStay = result.isNoteStay;
- if (result.result == "Success") {
- this.agencyProType = result.agencyProType;
- this.accountId = result.accountId;
- this.title = result.title;
- this.userWorkLocation = result.userWorkLocation;
- this.totalNum = result.totalNum;
- this.orderNumberArrived = result.orderNumberArrived;
- this.deliveryDetailCount = result.deliveryDetailCount;
- this.orderNumberNotarrive = result.orderNumberNotarrive;
- this.moreThanSevenDays = result.moreThanSevenDays;
- this.raesList = result.raesList;
- this.raesList.push({
- Id: "1",
- Name: "璁㈠崟鏄庣粏姹囨��",
- Total_num__c: this.totalNum,
- OrderNumber_arrived__c: this.orderNumberArrived,
- Delivery_detail_count__c: this.deliveryDetailCount,
- OrderNumber_notarrive__c: this.orderNumberNotarrive,
- More_than_seven_days__c: this.moreThanSevenDays
- });
- this.showSpinner = false;
- this.showPage = true;
- } else {
- this.showSpinner = false;
- console.log("Error:" + result.errorMsg);
- this.showMyToast("鍒濆鍖栭〉闈㈠け璐�", result.errorMsg, "error");
- }
- });
- }
-
- //鐐瑰嚮閾炬帴
- clickLick(event) {
- var outputValue = event.detail.data.value;
- var outputType = event.detail.data.type;
- var recordId = event.detail.data.recordId;
- console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
- if (outputType == "Title") {
- const config = {
- type: "standard__webPage",
- attributes: {
- url: "/lexarrivegoods?ESetId=" + recordId
+ @track colms = [
+ // {label:'娑堣�楀搧璁㈠崟鍚嶇О',fieldName:'Name'},
+ // {label:'璁㈠崟鎬绘暟',fieldName:'Total_num__c'},
+ // {label:'宸插埌璐ф暟閲�',fieldName:'OrderNumber_arrived__c'},
+ // {label:'寰呯郴缁熸搷浣滃叆搴撴暟閲�',fieldName:'Delivery_detail_count__c'},
+ // {label:'杩樻病鍙戣揣鏁伴噺',fieldName:'OrderNumber_notarrive__c'},
+ // {label:'鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',fieldName:'More_than_seven_days__c'},
+ {
+ label: '娑堣�楀搧璁㈠崟鍚嶇О',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'Name' },
+ type: 'Title',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ // initialWidth: 200,
+ wrapText: true
+ },
+ {
+ label: 'SAP鍚堝悓鍙�',
+ fieldName: 'ContractNo__c',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 180
+ },
+ {
+ label: '璁㈠崟鎬绘暟',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'Total_num__c' },
+ type: 'TotalNum',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: 'right' }
+ },
+ {
+ label: '宸插埌璐ф暟閲�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'OrderNumber_arrived__c' },
+ type: 'ArrDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: 'right' }
+ },
+ {
+ label: '寰呯郴缁熸搷浣滃叆搴撴暟閲�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'Delivery_detail_count__c' },
+ type: 'DeliveryDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150,
+ cellAttributes: { alignment: 'right' }
+ },
+ {
+ label: '杩樻病鍙戣揣鏁伴噺',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'OrderNumber_notarrive__c' },
+ type: 'NotArrDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 120,
+ cellAttributes: { alignment: 'right' }
+ },
+ {
+ label: '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'More_than_seven_days__c' },
+ type: 'MoreThan7',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150,
+ cellAttributes: { alignment: 'right' }
+ },
+ {
+ label: '鏈�鏂板彂璐ф棩鏈�',
+ fieldName: 'Shipment_date__c',
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: '棣栨鍙戣揣鏃ユ湡',
+ fieldName: 'First_Delivery__c',
+ hideDefaultActions: true,
+ initialWidth: 105
}
- };
- this[NavigationMixin.Navigate](config);
- } else if (outputType == "TotalNum") {
- this.popTitle = "鎵�鏈変骇鍝佷竴瑙�";
- initTotalNum({ ordId: recordId, type: "all" }).then((result) => {
- if (result.result == "Success") {
- // this.recordList = result.recordList;
- var dataStr = JSON.stringify(result.recordList);
- this.recordList = JSON.parse(dataStr);
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
+ ];
+
+ @track colms2 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodModel', hideDefaultActions: true },
+ {
+ label: '鏁伴噺',
+ fieldName: 'recordCount',
+ hideDefaultActions: true,
+ initialWidth: 100
}
- });
- } else if (outputType == "ArrDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�";
- initArrDetAll({ type: "all" }).then((result) => {
- if (result.result == "Success") {
- // this.recordList = result.recordList;
- var dataStr = JSON.stringify(result.recordList);
- this.recordList = JSON.parse(dataStr);
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "宸插埌璐т骇鍝佷竴瑙�";
- initArrDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "DeliveryDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�";
- initDeliveryDetAll({ type: "all" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "鏈埌璐т骇鍝佷竴瑙�";
- initDeliveryDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "NotArrDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�";
- initNotArrDetAll({ type: "all" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "杩樻病鍙戣揣鏁伴噺";
- initNotArrDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "MoreThan7") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟";
- initMoreThan7All({ type: "all" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�";
- initMoreThan7({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- }
- }
+ ];
- //鍏抽棴寮圭獥
- closePop() {
- this.showPop = false;
- }
-
- //娑堣�楀搧璁㈠崟鍚嶇О鍙樻洿
- category1Change(event) {
- this.category1 = event.detail.value;
- }
-
- //鏈�鏂板彂璐ф棩鏈熷彉鏇�
- cate2Change(event) {
- this.cate2 = event.detail.value;
- }
-
- //妫�绱�
- search() {
- this.showSpinner = true;
- searchConsumableorderdetails({
- category1Str: this.category1,
- cate2Str: this.cate2,
- accountidStr: this.accountId,
- userWorkLocationStr: this.userWorkLocation,
- agencyProTypeStr: this.agencyProType
- }).then((result) => {
- this.showSpinner = false;
- if (result.result == "Success") {
- this.raesList = result.raesList;
- this.raesList.push({
- Id: "1",
- Name: "璁㈠崟鏄庣粏姹囨��",
- Total_num__c: this.totalNum,
- OrderNumber_arrived__c: this.orderNumberArrived,
- Delivery_detail_count__c: this.deliveryDetailCount,
- OrderNumber_notarrive__c: this.orderNumberNotarrive,
- More_than_seven_days__c: this.moreThanSevenDays
- });
- if (this.raesList.length > 1) {
- var count = this.raesList.length - 1;
- this.showMyToast(
- "鎼滅储鎴愬姛",
- "鍏辨悳绱㈠埌" + count + "鏉℃暟鎹�",
- "success"
- );
- } else {
- this.showMyToast("鏈悳绱㈠埌鏁版嵁", "", "error");
- }
- } else {
- this.showMyToast("鎼滅储澶辫触", result.errorMsg, "error");
- }
- });
- }
-
- //娓呯┖鎼滅储妗�
- clear() {
- this.showSpinner = true;
- this.category1 = "";
- this.cate2 = null;
- searchConsumableorderdetails({
- category1Str: this.category1,
- cate2Str: this.cate2,
- accountidStr: this.accountId,
- userWorkLocationStr: this.userWorkLocation,
- agencyProTypeStr: this.agencyProType
- }).then((result) => {
- this.showSpinner = false;
- if (result.result == "Success") {
- this.raesList = result.raesList;
- this.raesList.push({
- Id: "1",
- Name: "璁㈠崟鏄庣粏姹囨��",
- Total_num__c: this.totalNum,
- OrderNumber_arrived__c: this.orderNumberArrived,
- Delivery_detail_count__c: this.deliveryDetailCount,
- OrderNumber_notarrive__c: this.orderNumberNotarrive,
- More_than_seven_days__c: this.moreThanSevenDays
- });
- if (this.raesList.length > 1) {
- var count = this.raesList.length - 1;
- this.showMyToast(
- "鎼滅储鎴愬姛",
- "鍏辨悳绱㈠埌" + count + "鏉℃暟鎹�",
- "success"
- );
- } else {
- this.showMyToast("鏈悳绱㈠埌鏁版嵁", "", "error");
- }
- } else {
- this.showMyToast("鎼滅储澶辫触", result.errorMsg, "error");
- }
- });
- }
-
- //鍏ュ簱
- orderArrive() {
- const config = {
- type: "standard__webPage",
- attributes: {
- url: "/lexarrivegoods?ArrType=Arr"
- }
- };
- this[NavigationMixin.Navigate](config);
- }
-
- //杩斿搧
- orderReturn() {
- const config = {
- type: "standard__webPage",
- attributes: {
- url: "/lexarrivegoods?ArrType=ReG"
- }
- };
- this[NavigationMixin.Navigate](config);
- }
-
- showMyToast(title, message, variant) {
- console.log("show custom message");
- var iconName = "";
- var content = "";
- if (variant == "success") {
- iconName = "utility:check";
- } else {
- iconName = "utility:error";
- }
- if (message != "") {
- content =
- "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
- } else {
- content = "<h2><strong>" + title + "<strong/></h2>";
- }
- this.template
- .querySelector("c-common-toast")
- .showToast(variant, content, iconName, 10000);
- // var mode;
- // if(this.isNoteStay){
- // mode ='sticky';
- // }else{
- // mode = 'dismissable';
+ //鑾峰彇鍙傛暟
+ // @wire(CurrentPageReference)
+ // getStateParameters(currentPageReference) {
+ // console.log('CurrentPageReference');
+ // if (currentPageReference) {
+ // this.eSetId = currentPageReference.state?.ESetid;
+ // }
// }
- // const evt = new ShowToastEvent({
- // title: title,
- // message: message,
- // variant: variant,
- // mode: mode
- // });
- // this.dispatchEvent(evt);
- }
-}
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log('Custom styles loaded');
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error('Error loading custom styles');
+ });
+ }
+ }
+
+ //鍒濆鍖�
+ connectedCallback() {
+ init().then((result) => {
+ this.isNoteStay = result.isNoteStay;
+ if (result.result == 'Success') {
+ this.agencyProType = result.agencyProType;
+ this.accountId = result.accountId;
+ this.title = result.title;
+ this.userWorkLocation = result.userWorkLocation;
+ this.totalNum = result.totalNum;
+ this.orderNumberArrived = result.orderNumberArrived;
+ this.deliveryDetailCount = result.deliveryDetailCount;
+ this.orderNumberNotarrive = result.orderNumberNotarrive;
+ this.moreThanSevenDays = result.moreThanSevenDays;
+ this.raesList = result.raesList;
+ this.raesList.push({
+ Id: '1',
+ Name: '璁㈠崟鏄庣粏姹囨��',
+ Total_num__c: this.totalNum,
+ OrderNumber_arrived__c: this.orderNumberArrived,
+ Delivery_detail_count__c: this.deliveryDetailCount,
+ OrderNumber_notarrive__c: this.orderNumberNotarrive,
+ More_than_seven_days__c: this.moreThanSevenDays
+ });
+ this.showSpinner = false;
+ this.showPage = true;
+ } else {
+ this.showSpinner = false;
+ console.log('Error:' + result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ });
+ }
+
+ //鐐瑰嚮閾炬帴
+ clickLick(event) {
+ var outputValue = event.detail.data.value;
+ var outputType = event.detail.data.type;
+ var recordId = event.detail.data.recordId;
+ console.log(
+ 'click:' + outputValue + '---' + outputType + '---' + recordId
+ );
+ if (outputType == 'Title') {
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ESetId=' + recordId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ } else if (outputType == 'TotalNum') {
+ this.popTitle = '鎵�鏈変骇鍝佷竴瑙�';
+ initTotalNum({ ordId: recordId, type: 'all' }).then((result) => {
+ if (result.result == 'Success') {
+ // this.recordList = result.recordList;
+ var dataStr = JSON.stringify(result.recordList);
+ this.recordList = JSON.parse(dataStr);
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else if (outputType == 'ArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�';
+ initArrDetAll({ type: 'all' }).then((result) => {
+ if (result.result == 'Success') {
+ // this.recordList = result.recordList;
+ var dataStr = JSON.stringify(result.recordList);
+ this.recordList = JSON.parse(dataStr);
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '宸插埌璐т骇鍝佷竴瑙�';
+ initArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
+ } else if (outputType == 'DeliveryDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�';
+ initDeliveryDetAll({ type: 'all' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '鏈埌璐т骇鍝佷竴瑙�';
+ initDeliveryDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
+ } else if (outputType == 'NotArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�';
+ initNotArrDetAll({ type: 'all' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '杩樻病鍙戣揣鏁伴噺';
+ initNotArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
+ } else if (outputType == 'MoreThan7') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟';
+ initMoreThan7All({ type: 'all' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�';
+ initMoreThan7({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
+ }
+ }
+
+ //鍏抽棴寮圭獥
+ closePop() {
+ this.showPop = false;
+ }
+
+ //娑堣�楀搧璁㈠崟鍚嶇О鍙樻洿
+ category1Change(event) {
+ this.category1 = event.detail.value;
+ }
+
+ //鏈�鏂板彂璐ф棩鏈熷彉鏇�
+ cate2Change(event) {
+ this.cate2 = event.detail.value;
+ }
+
+ //妫�绱�
+ search() {
+ this.showSpinner = true;
+ searchConsumableorderdetails({
+ category1Str: this.category1,
+ cate2Str: this.cate2,
+ accountidStr: this.accountId,
+ userWorkLocationStr: this.userWorkLocation,
+ agencyProTypeStr: this.agencyProType
+ }).then((result) => {
+ this.showSpinner = false;
+ if (result.result == 'Success') {
+ this.raesList = result.raesList;
+ this.raesList.push({
+ Id: '1',
+ Name: '璁㈠崟鏄庣粏姹囨��',
+ Total_num__c: this.totalNum,
+ OrderNumber_arrived__c: this.orderNumberArrived,
+ Delivery_detail_count__c: this.deliveryDetailCount,
+ OrderNumber_notarrive__c: this.orderNumberNotarrive,
+ More_than_seven_days__c: this.moreThanSevenDays
+ });
+ if (this.raesList.length > 1) {
+ var count = this.raesList.length - 1;
+ this.showMyToast(
+ '鎼滅储鎴愬姛',
+ '鍏辨悳绱㈠埌' + count + '鏉℃暟鎹�',
+ 'success'
+ );
+ } else {
+ this.showMyToast('鏈悳绱㈠埌鏁版嵁', '', 'error');
+ }
+ } else {
+ this.showMyToast('鎼滅储澶辫触', result.errorMsg, 'error');
+ }
+ });
+ }
+
+ //娓呯┖鎼滅储妗�
+ clear() {
+ this.showSpinner = true;
+ this.category1 = '';
+ this.cate2 = null;
+ searchConsumableorderdetails({
+ category1Str: this.category1,
+ cate2Str: this.cate2,
+ accountidStr: this.accountId,
+ userWorkLocationStr: this.userWorkLocation,
+ agencyProTypeStr: this.agencyProType
+ }).then((result) => {
+ this.showSpinner = false;
+ if (result.result == 'Success') {
+ this.raesList = result.raesList;
+ this.raesList.push({
+ Id: '1',
+ Name: '璁㈠崟鏄庣粏姹囨��',
+ Total_num__c: this.totalNum,
+ OrderNumber_arrived__c: this.orderNumberArrived,
+ Delivery_detail_count__c: this.deliveryDetailCount,
+ OrderNumber_notarrive__c: this.orderNumberNotarrive,
+ More_than_seven_days__c: this.moreThanSevenDays
+ });
+ if (this.raesList.length > 1) {
+ var count = this.raesList.length - 1;
+ this.showMyToast(
+ '鎼滅储鎴愬姛',
+ '鍏辨悳绱㈠埌' + count + '鏉℃暟鎹�',
+ 'success'
+ );
+ } else {
+ this.showMyToast('鏈悳绱㈠埌鏁版嵁', '', 'error');
+ }
+ } else {
+ this.showMyToast('鎼滅储澶辫触', result.errorMsg, 'error');
+ }
+ });
+ }
+
+ //鍏ュ簱
+ orderArrive() {
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ArrType=Arr'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //杩斿搧
+ orderReturn() {
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ArrType=ReG'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content =
+ '<h2><strong>' +
+ title +
+ '<strong/></h2><h5>' +
+ message +
+ '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template
+ .querySelector('c-common-toast')
+ .showToast(variant, content, iconName, 10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
index 48c8350..9430247 100644
--- a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
@@ -1,350 +1,381 @@
<!-- sldsValidatorIgnore -->
<!-- sldsValidatorIgnore -->
<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>
- </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"
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowSpinner}>
+ <div
+ role="status"
+ class="slds-spinner slds-spinner_medium slds-spinner_brand"
>
- <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>
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2
- id="modal-heading-01"
- class="slds-text-heading_medium slds-hyphenate"
- >
- 缁忛攢鍟嗗尰闄㈡绱�
- </h2>
- </header>
- <div
- class="slds-modal__content slds-p-around_medium"
- id="modal-content-id-1"
- style="border: 1px solid #f3f3f3"
- >
- <table style="width: 100%">
- <tbody>
- <tr>
- <td style="width: 74px">
- <div
- style="
- color: #696969;
- font-size: 16px;
- text-align: left;
- "
- >
- 鍖婚櫌鍚嶇О
- </div>
- </td>
- <td style="width: 60%">
- <lightning-input
- class="inputFont"
- label="鍖婚櫌鍚嶇О"
- variant="label-hidden"
- placeholder="璇疯緭鍏ュ尰闄㈠悕绉�"
- value={searchHospitalName}
- data-field="searchHospitalName"
- onchange={dataChange}
- ></lightning-input>
- </td>
- <td style="width: 10px"></td>
- <td>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- style="height: 32px"
- label="鎼滅储"
- onclick={searchHospital}
- >
- 鎼滅储
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- <p style="height: 20px"></p>
- <!-- <p>宸查�夋嫨鍖婚櫌锛歿chooseHospital}</p> -->
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鎼滅储缁撴灉</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>鎼滅储缁撴灉</strong></p> -->
- </div>
- <div class="myTable" style="padding: 10px">
- <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
- hide-checkbox-column="true" data={hospitalList} columns={hosCols}
- onrowaction={chooseHos}></lightning-datatable> -->
- <lightning-datatable
- class="datatabel slds-border_top wrapped-header-datatable"
- key-field="id"
- data={hospitalList}
- columns={hospitalColumns}
- hide-checkbox-column="true"
- onrowaction={searchHandleRowAction}
- >
- </lightning-datatable>
- </div>
- </div>
- </div>
- <footer class="slds-modal__footer">
- <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 class="borderCss">
- <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="10">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- onclick={SetEditAbleJs}
- disabled={isDisabledEdit}
- style="width: 150px"
- >
- 缂栬緫
- </button>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
- onclick={approvalJs}
- disabled={isDisabledEdit}
- style="width: 150px"
- >
- 鎻愪氦
- </button>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
- onclick={openReportJs}
- disabled={isOpenReportDisabled}
- style="width: 150px"
- >
- 鏄剧ず鏄庣粏
- </button>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
- onclick={reopenJs}
- disabled={isDisabledReopen}
- style="width: 150px"
- >
- 浣滃簾閲嶅紑
- </button>
- </lightning-layout-item>
- </lightning-layout>
+ 聽 聽 聽 聽 聽 聽 聽 聽 <span class="slds-assistive-text">Loading</span> 聽 聽
+ 聽 聽 聽 聽 聽 聽
+ <div class="slds-spinner__dot-a"></div>
+ 聽 聽 聽 聽 聽 聽 聽 聽
+ <div class="slds-spinner__dot-b"></div>
+ 聽 聽 聽 聽
+ </div>
+ </template>
- <lightning-layout
- multiple-rows="true"
- style="margin-top: 20px"
- >
- <lightning-layout-item size="2"></lightning-layout-item>
- <lightning-layout-item size="10">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- onclick={deleteButtonJs}
- disabled={isDisabledDelete}
- style="width: 150px"
- >
- 鍒犻櫎
- </button>
-
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
- disabled={isDisabledReopen}
- onclick={uploadOrder}
- style="width: 150px"
- >
- 涓婁紶闄勪欢
- </button>
-
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
- onclick={saveAttachmentJs}
- disabled={isDisabledReopen}
- style="width: 150px"
- >
- 淇濆瓨闄勪欢
- </button>
- </lightning-layout-item>
- </lightning-layout>
- </template>
-
- <!-- 涓婁紶闄勪欢寮圭獥 -->
- <template if:true={showAttPop}>
- <section
+ <template if:false={isDetailsShow}>
+ <template if:false={isConInvoiceList}>
+ <!-- 鎼滅储瀹㈡埛鍚� -->
+ <template if:true={isModalOpen}>
+ <section
role="dialog"
tabindex="-1"
- aria-labelledby="modal-heading-02"
+ aria-labelledby="modal-heading-01"
aria-modal="true"
- aria-describedby="modal-content-id-2"
- class="slds-modal slds-fade-in-open slds-modal_small"
+ aria-describedby="modal-content-id-1"
+ class="slds-modal slds-fade-in-open slds-modal_medium"
style="border: 1px solid #d4d4d4"
- >
- <template if:true={showPopSpinner}>
- <lightning-spinner
- size="medium"
- variant="brand"
- ></lightning-spinner>
- </template>
+ >
<div class="slds-modal__container">
- <header
- class="slds-modal__header"
- style="background-color: #f3f3f3"
- >
- <button
- style=""
- class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
- title="Close"
- onclick={closePop}
+ <header
+ class="slds-modal__header"
+ style="background-color: #f3f3f3"
>
- <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"
+ <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>
+ </header>
+ <div
+ class="slds-modal__content slds-p-around_medium"
+ id="modal-content-id-1"
+ style="border: 1px solid #f3f3f3"
>
- 涓婁紶闄勪欢
- </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="闄勪欢涓婁紶"
- accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
- onchange={attChange}
- ></lightning-input>
- </div>
- <p class="fontWeight">
- 宸查�夋嫨鏂囦欢锛歿fileName}
-
- <template if:true={attDelBtn}>
- <a onclick={removeAtt}>绉婚櫎</a>
- </template>
- </p>
+ <table style="width: 100%">
+ <tbody>
+ <tr>
+ <td style="width: 74px">
+ <div
+ style="
+ color: #696969;
+ font-size: 16px;
+ text-align: left;
+ "
+ >
+ 鍖婚櫌鍚嶇О
+ </div>
+ </td>
+ <td style="width: 60%">
+ <lightning-input
+ class="inputFont"
+ label="鍖婚櫌鍚嶇О"
+ variant="label-hidden"
+ placeholder="璇疯緭鍏ュ尰闄㈠悕绉�"
+ value={searchHospitalName}
+ data-field="searchHospitalName"
+ onchange={dataChange}
+ ></lightning-input>
+ </td>
+ <td style="width: 10px"></td>
+ <td>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ style="height: 32px"
+ label="鎼滅储"
+ onclick={searchHospital}
+ >
+ 鎼滅储
+ </button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="height: 20px"></p>
+ <!-- <p>宸查�夋嫨鍖婚櫌锛歿chooseHospital}</p> -->
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div
+ style="
+ border-bottom: 1px solid #d4d4d4;
+ padding: 3px;
+ "
+ >
+ <lightning-layout>
+ <lightning-layout-item
+ padding="around-small"
+ >
+ <p style="font-size: 18px">
+ <strong>鎼滅储缁撴灉</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鎼滅储缁撴灉</strong></p> -->
+ </div>
+ <div class="myTable" style="padding: 10px">
+ <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
+ hide-checkbox-column="true" data={hospitalList} columns={hosCols}
+ onrowaction={chooseHos}></lightning-datatable> -->
+ <lightning-datatable
+ class="datatabel slds-border_top wrapped-header-datatable"
+ key-field="id"
+ data={hospitalList}
+ columns={hospitalColumns}
+ hide-checkbox-column="true"
+ onrowaction={searchHandleRowAction}
+ >
+ </lightning-datatable>
+ </div>
+ </div>
</div>
- </div>
- <footer class="slds-modal__footer">
- <!-- <lightning-button style="margin-left: 10px;" variant="neutral"
+ <footer class="slds-modal__footer">
+ <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 class="borderCss">
+ <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="10">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SetEditAbleJs}
+ disabled={isDisabledEdit}
+ style="width: 150px"
+ >
+ 缂栬緫
+ </button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={approvalJs}
+ disabled={isDisabledEdit}
+ style="width: 150px"
+ >
+ 鎻愪氦
+ </button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={openReportJs}
+ disabled={isOpenReportDisabled}
+ style="width: 150px"
+ >
+ 鏄剧ず鏄庣粏
+ </button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={reopenJs}
+ disabled={isDisabledReopen}
+ style="width: 150px"
+ >
+ 浣滃簾閲嶅紑
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout
+ multiple-rows="true"
+ style="margin-top: 20px"
+ >
+ <lightning-layout-item
+ size="2"
+ ></lightning-layout-item>
+ <lightning-layout-item size="10">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={deleteButtonJs}
+ disabled={isDisabledDelete}
+ style="width: 150px"
+ >
+ 鍒犻櫎
+ </button>
+
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ disabled={isDisabledReopen}
+ onclick={uploadOrder}
+ style="width: 150px"
+ >
+ 涓婁紶闄勪欢
+ </button>
+
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={saveAttachmentJs}
+ disabled={isDisabledReopen}
+ style="width: 150px"
+ >
+ 淇濆瓨闄勪欢
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 涓婁紶闄勪欢寮圭獥 -->
+ <template if:true={showAttPop}>
+ <section
+ role="dialog"
+ tabindex="-1"
+ aria-labelledby="modal-heading-02"
+ aria-modal="true"
+ aria-describedby="modal-content-id-2"
+ class="slds-modal slds-fade-in-open slds-modal_small"
+ style="border: 1px solid #d4d4d4"
+ >
+ <template if:true={showPopSpinner}>
+ <lightning-spinner
+ size="medium"
+ variant="brand"
+ ></lightning-spinner>
+ </template>
+ <div class="slds-modal__container">
+ <header
+ class="slds-modal__header"
+ style="
+ background-color: #f3f3f3;
+ "
+ >
+ <button
+ style=""
+ class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close"
+ onclick={closePop}
+ >
+ <lightning-icon
+ icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small"
+ ></lightning-icon>
+ <span
+ class="slds-assistive-text"
+ >Close</span
+ >
+ </button>
+ <h2
+ id="modal-heading-02"
+ class="slds-text-heading_medium slds-hyphenate"
+ >
+ 涓婁紶闄勪欢
+ </h2>
+ </header>
+ <div
+ class="slds-modal__content slds-p-around_medium searchName"
+ id="modal-content-id-2"
+ style="
+ border: 1px solid #f3f3f3;
+ "
+ >
+ <div
+ class="slds-m-top_medium slds-m-bottom_x-large"
+ >
+ <div
+ class="slds-p-around_medium lgc-bg"
+ >
+ <lightning-input
+ class="fileUpload"
+ type="file"
+ label="闄勪欢涓婁紶"
+ accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
+ onchange={attChange}
+ ></lightning-input>
+ </div>
+ <p class="fontWeight">
+ 宸查�夋嫨鏂囦欢锛歿fileName}
+
+ <template
+ if:true={attDelBtn}
+ >
+ <a
+ onclick={removeAtt}
+ >绉婚櫎</a
+ >
+ </template>
+ </p>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral"
label="鍙栨秷" onclick={closePop}></lightning-button>
<lightning-button style="margin-left: 10px;" variant="neutral"
label="涓婁紶" onclick={handleFilesChange}></lightning-button> -->
- <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>
- </template>
+ <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>
+ </template>
- <template if:true={EditAble}>
- <lightning-layout>
- <lightning-layout-item
- size="1"
- padding="around-small"
- ></lightning-layout-item>
- <lightning-layout-item
- size="2"
- padding="around-small"
- ></lightning-layout-item>
- <lightning-layout-item padding="around-small">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- onclick={SaveJs}
- >
- 纭畾
- </button>
- </lightning-layout-item>
- </lightning-layout>
- </template>
+ <template if:true={EditAble}>
+ <lightning-layout>
+ <lightning-layout-item
+ size="1"
+ padding="around-small"
+ ></lightning-layout-item>
+ <lightning-layout-item
+ size="2"
+ padding="around-small"
+ ></lightning-layout-item>
+ <lightning-layout-item
+ padding="around-small"
+ >
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveJs}
+ >
+ 纭畾
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
- <!-- <lightning-layout>
+ <!-- <lightning-layout>
<lightning-layout-item size="3"></lightning-layout-item>
<template if:true={EditAble}>
<lightning-layout-item size="1" padding="around-small">
@@ -376,386 +407,485 @@
</template>
</lightning-layout> -->
- </div>
- </div>
- </div>
-
- <div class="borderCss">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍙戠エ淇℃伅</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <!--鍙戠エ淇℃伅 鏄剧ず鐢� -->
- <template if:false={isEditInvoice}>
- <lightning-record-edit-form
- object-api-name="Consumable_order__c"
- record-id={cocId}
- onload={handleLoad2}
- >
- <!-- 鍙戠エ鍙� 鐘舵�� -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item class="hehe-layoutItem" size="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-output-field
- field-name="Invoice_status__c"
- ></lightning-output-field>
- </lightning-layout-item>
-
- <lightning-layout-item size="1"></lightning-layout-item>
- </lightning-layout>
-
- <!-- 鍙戠エ鏃ユ湡 -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item class="hehe-layoutItem" size="5">
- <lightning-output-field
- field-name="Invoice_Date__c"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
-
- <!-- 浜岀骇缁忛攢鍟� -->
- <template if:true={isShowSecondaryDistributor}>
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout multiple-rows="true">
- <lightning-layout-item class="hehe-layoutItem" size="5">
- <lightning-output-field
- field-name="Order_Dealer_Info__c"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- </template>
-
- <!-- 瀹㈡埛鍚� -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item class="hehe-layoutItem" size="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-item class="hehe-layoutItem" size="5">
- <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>
-
- <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-output-field
- field-name="Invoice_Note__c"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
-
- <!-- 鍙戠エ闄勪欢 鏄庣粏闄勪欢 -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item class="hehe-layoutItem" size="5">
- <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-output-field
- field-name="Invoicedet_attachment__c"
- ></lightning-output-field>
- </lightning-layout-item>
-
- <lightning-layout-item size="1"></lightning-layout-item>
- </lightning-layout>
-
- <!-- 闄勪欢棰勮 -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"> </lightning-layout-item>
- <lightning-layout-item size="10">
- <lightning-card
- class="attListTitle"
- variant="Narrow"
- title="闄勪欢鍒楄〃"
- icon-name="utility:attach"
- >
- <lightning-layout slot="footer" multiple-rows="true">
- <template
- for:each={fileData}
- for:item="item"
- for:index="index"
- >
- <lightning-layout-item
- padding="around-none"
- size="2"
- key={item.recordId}
- style="text-align: left; padding: 5px"
- >
- <lightning-icon
- title={item.Title}
- style="margin-left: 20px"
- icon-name="doctype:gform"
- alternative-text={item.Title}
- 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
- > 路
- <a href={item.downloadUrl}> 涓嬭浇 </a
- > 路
- <a data-fileid={item.Id} onclick={deleteAtt}>
- 鍒犻櫎
- </a>
- </p>
- <!-- <p>{item.updateDate} 路 {item.ownerName}</p> -->
- </lightning-layout-item>
- </template>
- </lightning-layout>
- </lightning-card>
- </lightning-layout-item>
- </lightning-layout>
- </lightning-record-edit-form>
- </template>
- <!--鍙戠エ淇℃伅 缂栬緫鐢� -->
- <template if:true={isEditInvoice}>
- <lightning-record-edit-form
- object-api-name="Consumable_order__c"
- record-id={cocId}
- onload={handleLoad2}
- >
- <!-- 鍙戠エ鍙� 鐘舵�� -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item class="hehe-layoutItem" size="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-output-field
- field-name="Invoice_status__c"
- ></lightning-output-field>
- </lightning-layout-item>
-
- <lightning-layout-item size="1"></lightning-layout-item>
- </lightning-layout>
-
- <!-- 鍙戠エ鏃ユ湡 -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
-
- <lightning-layout-item 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 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="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
- icon-name="utility:search"
- ></lightning-icon>
- <lightning-input
- type="text"
- name="HospitalName"
- label="瀹㈡埛鍚�"
- value={HospitalName}
- variant="label-inline"
- onclick={searchHospitalNameModal}
- data-field="HospitalName"
- onchange={clearAgencyI}
- class="inputFont"
- ></lightning-input>
+ </div>
</div>
- </lightning-layout-item>
+ </div>
- <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>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!--鍙戠エ淇℃伅 鏄剧ず鐢� -->
+ <template if:false={isEditInvoice}>
+ <lightning-record-edit-form
+ object-api-name="Consumable_order__c"
+ record-id={cocId}
+ onload={handleLoad2}
+ >
+ <!-- 鍙戠エ鍙� 鐘舵�� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
- <lightning-layout-item size="1"></lightning-layout-item>
- </lightning-layout>
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ >
+ <lightning-output-field
+ field-name="Name"
+ ></lightning-output-field>
+ </lightning-layout-item>
- <!-- 绉戝 缁忛攢鍟�(褰曞叆) -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ style="padding-left: 100px"
+ >
+ <lightning-output-field
+ field-name="Invoice_status__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
- <lightning-layout-item 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>
- </lightning-layout-item>
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ </lightning-layout>
- <lightning-layout-item
- class="hehe-layoutItem"
- size="5"
- style="padding-left: 100px"
- >
- <lightning-output-field
- field-name="Order_ForDealerText__c"
- ></lightning-output-field>
- </lightning-layout-item>
+ <!-- 鍙戠エ鏃ユ湡 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
- <lightning-layout-item size="1"></lightning-layout-item>
- </lightning-layout>
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ >
+ <lightning-output-field
+ field-name="Invoice_Date__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
- <!-- 澶囨敞 -->
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
+ <!-- 浜岀骇缁忛攢鍟� -->
+ <template
+ if:true={isShowSecondaryDistributor}
+ >
+ <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>
- </lightning-layout>
- </lightning-record-edit-form>
- </template>
- </div>
- </div>
- </div>
- <!-- 鍑哄簱鍗曚竴瑙� -->
- <div class="borderCss">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍑哄簱鍗曚竴瑙�</strong>
- </p>
- </lightning-layout-item>
- <lightning-layout-item size="2" padding="around-small">
- </lightning-layout-item>
- <template if:false={hideCheckbox}>
- <lightning-layout-item padding="around-small">
- <!-- <lightning-button label=" 妫�绱� "
+ <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>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 瀹㈡埛鍚� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="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-item
+ class="hehe-layoutItem"
+ size="5"
+ >
+ <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>
+
+ <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-output-field
+ field-name="Invoice_Note__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 鍙戠エ闄勪欢 鏄庣粏闄勪欢 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ >
+ <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-output-field
+ field-name="Invoicedet_attachment__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 闄勪欢棰勮 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="10">
+ <lightning-card
+ class="attListTitle"
+ variant="Narrow"
+ title="闄勪欢鍒楄〃"
+ icon-name="utility:attach"
+ >
+ <lightning-layout
+ slot="footer"
+ multiple-rows="true"
+ >
+ <template
+ for:each={fileData}
+ for:item="item"
+ for:index="index"
+ >
+ <lightning-layout-item
+ padding="around-none"
+ size="2"
+ key={item.recordId}
+ style="
+ text-align: left;
+ padding: 5px;
+ "
+ >
+ <lightning-icon
+ title={item.Title}
+ style="
+ margin-left: 20px;
+ "
+ icon-name="doctype:gform"
+ alternative-text={item.Title}
+ 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
+ > 路
+ <a
+ href={item.downloadUrl}
+ >
+ 涓嬭浇 </a
+ > 路
+ <a
+ data-fileid={item.Id}
+ onclick={deleteAtt}
+ >
+ 鍒犻櫎
+ </a>
+ </p>
+ <!-- <p>{item.updateDate} 路 {item.ownerName}</p> -->
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ </lightning-card>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </template>
+ <!--鍙戠エ淇℃伅 缂栬緫鐢� -->
+ <template if:true={isEditInvoice}>
+ <lightning-record-edit-form
+ object-api-name="Consumable_order__c"
+ record-id={cocId}
+ onload={handleLoad2}
+ >
+ <!-- 鍙戠エ鍙� 鐘舵�� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="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-output-field
+ field-name="Invoice_status__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 鍙戠エ鏃ユ湡 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ 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
+ 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="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
+ icon-name="utility:search"
+ ></lightning-icon>
+ <lightning-input
+ type="text"
+ name="HospitalName"
+ label="瀹㈡埛鍚�"
+ value={HospitalName}
+ variant="label-inline"
+ onclick={searchHospitalNameModal}
+ data-field="HospitalName"
+ onchange={clearAgencyI}
+ class="inputFont"
+ ></lightning-input>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ style="padding-left: 100px"
+ >
+ <lightning-combobox
+ data-field="secondaryDistributor"
+ name="secondaryDistributor"
+ label="浜岀骇缁忛攢鍟�"
+ value={secondaryDistributor}
+ placeholder="璇烽�夋嫨..."
+ options={provinceOptsMap}
+ variant="label-inline"
+ onchange={dataChange}
+ class="inputFont"
+ ></lightning-combobox>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 绉戝 缁忛攢鍟�(褰曞叆) -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ 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>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ class="hehe-layoutItem"
+ size="5"
+ style="padding-left: 100px"
+ >
+ <lightning-output-field
+ field-name="Order_ForDealerText__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 澶囨敞 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+
+ <lightning-layout-item
+ 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>
+ </div>
+ </div>
+ <!-- 鍑哄簱鍗曚竴瑙� -->
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚竴瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ <lightning-layout-item
+ size="2"
+ padding="around-small"
+ >
+ </lightning-layout-item>
+ <template if:false={hideCheckbox}>
+ <lightning-layout-item
+ padding="around-small"
+ >
+ <!-- <lightning-button label=" 妫�绱� "
onclick={InvoiceorderSearchJs}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- onclick={InvoiceorderSearchJs}
- >
- 妫�绱�
- </button>
- </lightning-layout-item>
- </template>
- </lightning-layout>
- </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={InvoiceorderSearchJs}
+ >
+ 妫�绱�
+ </button>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ </div>
- <!-- <template if:false={hideCheckbox}>
+ <!-- <template if:false={hideCheckbox}>
<div style="padding: 10px">
<div lwc:dom="manual" class="resultDiv"></div>
<div draggable="false">
@@ -771,61 +901,63 @@
</div>
</template> -->
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-datatable
- key-field="Id"
- data={outboundData}
- columns={outboundColumns}
- hide-checkbox-column={hideCheckbox}
- onrowselection={getSelectedRows}
- selected-rows={selectedRows}
- class="wrapped-header-datatable"
- data-field="outbound"
- >
- </lightning-datatable>
- <lightning-datatable
- key-field="id"
- data={outboundDataSumPrice}
- columns={outboundColumns}
- hide-checkbox-column
- hide-table-header
- class="wrapped-header-datatable"
- >
- </lightning-datatable>
- </div>
- </div>
- </div>
- <!-- 鍙戠エ鏄庣粏 -->
- <template if:true={done}>
- <div class="borderCss">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍙戠エ鏄庣粏</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-datatable
- key-field="id"
- data={invoiceOrderdetail1Recoeds}
- columns={invoiceDetailsColumns}
- hide-checkbox-column
- class="wrapped-header-datatable"
- >
- </lightning-datatable>
- </div>
- </div>
- </div>
- </template>
- <!-- 涓婁紶闄勪欢 -->
- <!-- <template if:false={EditAble}>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable
+ key-field="Id"
+ data={outboundData}
+ columns={outboundColumns}
+ hide-checkbox-column={hideCheckbox}
+ onrowselection={getSelectedRows}
+ selected-rows={selectedRows}
+ class="wrapped-header-datatable"
+ data-field="outbound"
+ >
+ </lightning-datatable>
+ <lightning-datatable
+ key-field="id"
+ data={outboundDataSumPrice}
+ columns={outboundColumns}
+ hide-checkbox-column
+ hide-table-header
+ class="wrapped-header-datatable"
+ >
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <!-- 鍙戠エ鏄庣粏 -->
+ <template if:true={done}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item
+ padding="around-small"
+ >
+ <p style="font-size: 18px">
+ <strong>鍙戠エ鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable
+ key-field="id"
+ data={invoiceOrderdetail1Recoeds}
+ columns={invoiceDetailsColumns}
+ hide-checkbox-column
+ class="wrapped-header-datatable"
+ >
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </template>
+ <!-- 涓婁紶闄勪欢 -->
+ <!-- <template if:false={EditAble}>
<div class="borderCss">
<div class="headerDorderCss">
<lightning-layout>
@@ -869,331 +1001,380 @@
</div>
</div>
</template> -->
- </div>
- </div>
+ </div>
+ </div>
+ </template>
+
+ <template if:true={isConInvoiceList}>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <!-- 鏂板缓鍙戠エ -->
+ <div class="borderCss">
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-button label="鏂板缓鍙戠エ" onclick={newInvoiceJs}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={newInvoiceJs}
+ >
+ 鏂板缓鍙戠エ
+ </button>
+ </div>
+ </div>
+ </div>
+
+ <!-- 妫�绱㈡潯浠� -->
+ <div class="borderCss" style="margin-top: 5px">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-text-align_center">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label"
+ >
+ 鍑哄簱鏃� 浠�
+ </div>
+ <lightning-input
+ type="date"
+ variant="label-hidden"
+ label="鍑哄簱鏃� 浠�"
+ onchange={dataChange}
+ data-field="deliveryFromDate"
+ value={deliveryFromDate}
+ class="inputFont"
+ style="max-width: 150px"
+ ></lightning-input>
+ </div>
+
+ <!-- </br> -->
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label"
+ >
+     鍒�
+ </div>
+ <lightning-input
+ type="date"
+ variant="label-hidden"
+ label="鍒�"
+ onchange={dataChange}
+ data-field="deliveryToDate"
+ value={deliveryToDate}
+ class="inputFont"
+ 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>
+ </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>
+ </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>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <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>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <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>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍙戠エ涓�瑙� -->
+ <div class="borderCss" style="margin-top: 5px">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable
+ key-field="id"
+ data={invoiceData}
+ columns={invoiceColumns}
+ hide-checkbox-column="true"
+ class="wrapped-header-datatable"
+ >
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
</template>
- <template if:true={isConInvoiceList}>
- <div class="outerBorderCss">
- <div style="padding: 5px">
- <!-- 鏂板缓鍙戠エ -->
- <div class="borderCss">
- <div style="padding: 15px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <!-- <lightning-button label="鏂板缓鍙戠エ" onclick={newInvoiceJs}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- onclick={newInvoiceJs}
- >
- 鏂板缓鍙戠エ
- </button>
- </div>
- </div>
- </div>
-
- <!-- 妫�绱㈡潯浠� -->
- <div class="borderCss" style="margin-top: 5px">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>妫�绱㈡潯浠�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 15px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-layout multiple-rows>
- <lightning-layout-item flexibility="auto">
- <div class="slds-text-align_center">
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label">
- 鍑哄簱鏃� 浠�
+ <template if:true={isDetailsShow}>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <!-- 纭畾 -->
+ <div class="borderCss">
+ <div style="padding: 10px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-button label="纭畾" onclick={detailsSaveJs}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={detailsSaveJs}
+ >
+ 纭畾
+ </button>
</div>
- <lightning-input
- type="date"
- variant="label-hidden"
- label="鍑哄簱鏃� 浠�"
- onchange={dataChange}
- data-field="deliveryFromDate"
- value={deliveryFromDate}
- class="inputFont"
- style="max-width: 150px"
- ></lightning-input>
- </div>
+ </div>
+ </div>
- <!-- </br> -->
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label">
-     鍒�
+ <!-- 鍙戠エ淇℃伅 -->
+ <div class="borderCss" style="margin-top: 5px">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form
+ object-api-name="Consumable_order__c"
+ record-id={detailsInvoiceId}
+ onload={handleLoad2}
+ >
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field
+ field-name="Name"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ <lightning-layout-item
+ size="5"
+ class="hehe-layoutItem"
+ >
+ <lightning-output-field
+ field-name="ShipmentAccount__c"
+ class="hideHelpText"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field
+ field-name="Order_ForCustomerText__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
</div>
- <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>
- </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>
- </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>
- </lightning-layout-item>
- <lightning-layout-item flexibility="auto">
- <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>
- </div>
- </lightning-layout-item>
- <lightning-layout-item flexibility="auto">
- <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>
- </div>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- </div>
- </div>
+ </div>
- <!-- 鍙戠エ涓�瑙� -->
- <div class="borderCss" style="margin-top: 5px">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍙戠エ涓�瑙�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-datatable
- key-field="id"
- data={invoiceData}
- columns={invoiceColumns}
- hide-checkbox-column="true"
- class="wrapped-header-datatable"
- >
- </lightning-datatable>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- </template>
+ <!-- 鍑哄簱鍗� -->
+ <div class="borderCss" style="margin-top: 5px">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form
+ object-api-name="Consumable_order__c"
+ record-id={detailsCocId}
+ >
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field
+ field-name="Name"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item
+ size="1"
+ ></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field
+ field-name="Outbound_Date__c"
+ ></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
- <template if:true={isDetailsShow}>
- <div class="outerBorderCss">
- <div style="padding: 5px">
- <!-- 纭畾 -->
- <div class="borderCss">
- <div style="padding: 10px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <!-- <lightning-button label="纭畾" onclick={detailsSaveJs}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- onclick={detailsSaveJs}
- >
- 纭畾
- </button>
- </div>
- </div>
- </div>
-
- <!-- 鍙戠エ淇℃伅 -->
- <div class="borderCss" style="margin-top: 5px">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍙戠エ淇℃伅</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-record-edit-form
- object-api-name="Consumable_order__c"
- record-id={detailsInvoiceId}
- onload={handleLoad2}
- >
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
- <lightning-layout-item size="5">
- <lightning-output-field
- field-name="Name"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
- <lightning-layout-item size="5" class="hehe-layoutItem">
- <lightning-output-field
- field-name="ShipmentAccount__c"
- class="hideHelpText"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
- <lightning-layout-item size="5">
- <lightning-output-field
- field-name="Order_ForCustomerText__c"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- </lightning-record-edit-form>
- </div>
- </div>
- </div>
-
- <!-- 鍑哄簱鍗� -->
- <div class="borderCss" style="margin-top: 5px">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍑哄簱鍗�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-record-edit-form
- object-api-name="Consumable_order__c"
- record-id={detailsCocId}
- >
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
- <lightning-layout-item size="5">
- <lightning-output-field
- field-name="Name"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- <lightning-layout multiple-rows="true">
- <lightning-layout-item size="1"></lightning-layout-item>
- <lightning-layout-item size="5">
- <lightning-output-field
- field-name="Outbound_Date__c"
- ></lightning-output-field>
- </lightning-layout-item>
- </lightning-layout>
- </lightning-record-edit-form>
- </div>
- </div>
- </div>
-
- <!-- 鍑哄簱鍗曟槑缁� -->
- <div class="borderCss" style="margin-top: 5px">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍑哄簱鍗曟槑缁�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 7px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
+ <!-- 鍑哄簱鍗曟槑缁� -->
+ <div class="borderCss" style="margin-top: 5px">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曟槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
data={detaisData} columns={detailsColumns}>
</lightning-datatable> -->
- <c-lex-custom-lightning-datatable
- key-field="Id"
- data={detailsData}
- columns={detailsColumns}
- onunitchange={handleUnitChange}
- onshipmentnumber={handleShipmentNumber}
- onrowselection={detailsGetSelectedRows}
- selected-rows={detailsSelectedRows}
- style="word-wrap: break-word; word-break: break-all"
- class="wrapped-header-datatable"
- >
- </c-lex-custom-lightning-datatable>
- <lightning-datatable
- class="datatabel slds-border_top wrapped-header-datatable"
- key-field="id"
- data={invoiceAllpriceData}
- columns={detailsColumns}
- hide-checkbox-column
- hide-table-header
- >
- </lightning-datatable>
+ <c-lex-custom-lightning-datatable
+ key-field="Id"
+ data={detailsData}
+ columns={detailsColumns}
+ onunitchange={handleUnitChange}
+ onshipmentnumber={handleShipmentNumber}
+ onrowselection={detailsGetSelectedRows}
+ selected-rows={detailsSelectedRows}
+ style="
+ word-wrap: break-word;
+ word-break: break-all;
+ "
+ class="wrapped-header-datatable"
+ >
+ </c-lex-custom-lightning-datatable>
+ <lightning-datatable
+ class="datatabel slds-border_top wrapped-header-datatable"
+ key-field="id"
+ data={invoiceAllpriceData}
+ columns={detailsColumns}
+ hide-checkbox-column
+ hide-table-header
+ >
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
</div>
- </div>
</div>
- </div>
- </div>
- </template>
-</template>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
index 4fc8f59..2cbbf36 100644
--- a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -1,2032 +1,2177 @@
-import { LightningElement, api, track, wire } from "lwc";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import init from "@salesforce/apex/LexConInvoiceViewController.init";
-import save from "@salesforce/apex/LexConInvoiceViewController.save";
-import saveFile from "@salesforce/apex/LexConInvoiceViewController.saveFile";
-import saveAttachment from "@salesforce/apex/LexConInvoiceViewController.saveAttachment";
-import InvoiceorderSearch from "@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch";
-import deleteButton from "@salesforce/apex/LexConInvoiceViewController.deleteButton";
-import approval from "@salesforce/apex/LexConInvoiceViewController.approval";
-import conInvoiceListInit from "@salesforce/apex/LexConInvoiceList.init";
-import invoiceCodeSearch from "@salesforce/apex/LexConInvoiceList.invoiceCodeSearch";
-import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
-import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
-import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init";
-import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save";
-import deleteAtt from "@salesforce/apex/LexSummonsCreatController.deleteAtt";
-import { NavigationMixin } from "lightning/navigation";
+import { LightningElement, api, track, wire } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init from '@salesforce/apex/LexConInvoiceViewController.init';
+import save from '@salesforce/apex/LexConInvoiceViewController.save';
+import saveFile from '@salesforce/apex/LexConInvoiceViewController.saveFile';
+import saveAttachment from '@salesforce/apex/LexConInvoiceViewController.saveAttachment';
+import InvoiceorderSearch from '@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch';
+import deleteButton from '@salesforce/apex/LexConInvoiceViewController.deleteButton';
+import approval from '@salesforce/apex/LexConInvoiceViewController.approval';
+import conInvoiceListInit from '@salesforce/apex/LexConInvoiceList.init';
+import invoiceCodeSearch from '@salesforce/apex/LexConInvoiceList.invoiceCodeSearch';
+import hospitalInit from '@salesforce/apex/lexSearchAgencyHospitalController.init';
+import serContact from '@salesforce/apex/lexSearchAgencyHospitalController.serContact';
+import detailsInit from '@salesforce/apex/LexConInvoicedetailsController.init';
+import detailsSave from '@salesforce/apex/LexConInvoicedetailsController.save';
+import deleteAtt from '@salesforce/apex/LexSummonsCreatController.deleteAtt';
+import { NavigationMixin } from 'lightning/navigation';
//table css
-import { loadStyle } from "lightning/platformResourceLoader";
-import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
-import LexConInvoiceViewReport from "@salesforce/label/c.LexConInvoiceViewReport";
+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",
- initialWidth: 90,
- hideDefaultActions: true,
- typeAttributes: {
- label: "閫夋嫨",
- name: "Id2",
- size: 1
+ {
+ label: '',
+ fieldName: 'Id1',
+ type: 'button',
+ initialWidth: 90,
+ hideDefaultActions: true,
+ typeAttributes: {
+ label: '閫夋嫨',
+ name: 'Id2',
+ size: 1
+ }
+ },
+ {
+ label: '鍖婚櫌鍚嶇О',
+ fieldName: 'Name',
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '鐪佷唤',
+ fieldName: 'stateMasterName',
+ hideDefaultActions: true
}
- },
- {
- label: "鍖婚櫌鍚嶇О",
- fieldName: "Name",
- hideDefaultActions: true,
- wrapText: 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",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 400
- },
- {
- label: "鍗曚綅",
- fieldName: "esdetInvoiceUnit",
- hideDefaultActions: true,
- wrapText: true,
- initialWidth: 50
- },
- {
- label: "鍙戠エ鍗曚环",
- fieldName: "esdetInvoiceUnitprice",
- hideDefaultActions: true,
- wrapText: true,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
+ {
+ label: '鍑哄簱鏃ユ湡',
+ fieldName: 'esdetProductOutDate',
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '鍑哄簱鍗曠紪鐮�',
+ fieldName: 'esdetInvoicedet1ODlinkName',
+ wrapText: true,
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'esdetAssetModelNo',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 400
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'esdetInvoiceUnit',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 50
+ },
+ {
+ label: '鍙戠エ鍗曚环',
+ fieldName: 'esdetInvoiceUnitprice',
+ hideDefaultActions: true,
+ wrapText: true,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
+ },
+ {
+ label: '鍙戠エ鏁伴噺',
+ fieldName: 'esdetInvoicedCount',
+ cellAttributes: { alignment: 'right' },
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ fieldName: 'esdetInvoicedProCostRMB',
+ hideDefaultActions: true,
+ wrapText: true,
+ cellAttributes: { alignment: 'right' },
+ initialWidth: 145,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
}
- },
- {
- label: "鍙戠エ鏁伴噺",
- fieldName: "esdetInvoicedCount",
- cellAttributes: { alignment: "right" },
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
- fieldName: "esdetInvoicedProCostRMB",
- hideDefaultActions: true,
- wrapText: true,
- cellAttributes: { alignment: "right" },
- initialWidth: 145,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
- }
- }
];
const invoiceColumns = [
- {
- label: "鍙戠エ鏃ユ湡",
- fieldName: "Invoice_Date__c",
- hideDefaultActions: true,
- initialWidth: 150
- },
- {
- label: "鍙戠エ鍙�",
- type: "url",
- fieldName: "NameUrl",
- typeAttributes: {
- label: { fieldName: "Name" }
+ {
+ label: '鍙戠エ鏃ユ湡',
+ fieldName: 'Invoice_Date__c',
+ hideDefaultActions: true,
+ initialWidth: 150
},
- hideDefaultActions: true
- },
- {
- label: "瀹㈡埛鍚�",
- fieldName: "ShipmentAccount__c",
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: "鍙戠エ鐘舵��",
- fieldName: "Invoice_status__c",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "鍙戠エ璐﹂潰閲戦(鍏�)",
- fieldName: "Invoice_total_amount__c",
- hideDefaultActions: true,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
+ {
+ label: '鍙戠エ鍙�',
+ type: 'url',
+ fieldName: 'NameUrl',
+ typeAttributes: {
+ label: { fieldName: 'Name' }
+ },
+ hideDefaultActions: true
},
- initialWidth: 180
- },
- {
- label: "鍙戠エ闄勪欢",
- fieldName: "Invoice_attachment__c",
- type: "boolean",
- hideDefaultActions: true,
- initialWidth: 120
- },
- {
- label: "鍙戠エ鏄庣粏闄勪欢",
- fieldName: "Invoicedet_attachment__c",
- type: "boolean",
- hideDefaultActions: true,
- initialWidth: 120
- }
+ {
+ label: '瀹㈡埛鍚�',
+ fieldName: 'ShipmentAccount__c',
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '鍙戠エ鐘舵��',
+ fieldName: 'Invoice_status__c',
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '鍙戠エ璐﹂潰閲戦(鍏�)',
+ fieldName: 'Invoice_total_amount__c',
+ hideDefaultActions: true,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ },
+ initialWidth: 180
+ },
+ {
+ label: '鍙戠エ闄勪欢',
+ fieldName: 'Invoice_attachment__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: '鍙戠エ鏄庣粏闄勪欢',
+ fieldName: 'Invoicedet_attachment__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ initialWidth: 120
+ }
];
const detailsColumns = [
- {
- label: "浜у搧鍨嬪彿",
- fieldName: "esdAssetModelNo",
- hideDefaultActions: true,
- initialWidth: 150,
- wrapText: true
- },
- {
- label: "瑙勬牸",
- fieldName: "packingListManual",
- hideDefaultActions: true,
- initialWidth: 50
- },
- {
- label: "鍑鸿揣鍗曚环(鍏�)",
- fieldName: "esdDeliveryListRMB",
- hideDefaultActions: true,
- initialWidth: 100,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
- }
- },
- {
- label: "鍑鸿揣鏁伴噺",
- fieldName: "esdShipmentCount",
- hideDefaultActions: true
- },
- {
- label: "杩斿搧鏁伴噺",
- fieldName: "esdRrturnProCount",
- hideDefaultActions: true
- },
- {
- label: "鍑哄簱鍗曚綅",
- fieldName: "esdBoxPiece",
- hideDefaultActions: true
- },
- {
- label: "宸插彂绁ㄦ暟閲�",
- fieldName: "esdInvoicedProcount",
- hideDefaultActions: true,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
- }
- },
- {
- label: "杩樻病鍙戠エ鏁伴噺",
- fieldName: "esdInvoiceProNotCount",
- hideDefaultActions: true,
- initialWidth: 100,
- 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
+ {
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'esdAssetModelNo',
+ hideDefaultActions: true,
+ initialWidth: 150,
+ wrapText: true
},
- initialWidth: 130
- },
- {
- label: "鍙戠エ鏁伴噺",
- //fieldName: "invoiceCount",
- hideDefaultActions: true,
- type: "customShipment",
- cellAttributes: { alignment: "right" },
- typeAttributes: {
- recordId: { fieldName: "recordId" },
- shipmentNumber: { fieldName: "shipmentNumber" },
- isConinvoice: { fieldName: "isConinvoice" },
- esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" }
+ {
+ label: '瑙勬牸',
+ fieldName: 'packingListManual',
+ hideDefaultActions: true,
+ initialWidth: 50
+ },
+ {
+ label: '鍑鸿揣鍗曚环(鍏�)',
+ fieldName: 'esdDeliveryListRMB',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
+ },
+ {
+ label: '鍑鸿揣鏁伴噺',
+ fieldName: 'esdShipmentCount',
+ hideDefaultActions: true
+ },
+ {
+ label: '杩斿搧鏁伴噺',
+ fieldName: 'esdRrturnProCount',
+ hideDefaultActions: true
+ },
+ {
+ label: '鍑哄簱鍗曚綅',
+ fieldName: 'esdBoxPiece',
+ hideDefaultActions: true
+ },
+ {
+ label: '宸插彂绁ㄦ暟閲�',
+ fieldName: 'esdInvoicedProcount',
+ hideDefaultActions: true,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
+ },
+ {
+ label: '杩樻病鍙戠エ鏁伴噺',
+ fieldName: 'esdInvoiceProNotCount',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
+ },
+ {
+ label: '寮�绁ㄥ崟浣�',
+ hideDefaultActions: true,
+ type: 'customUnit',
+ typeAttributes: {
+ unitValue: { fieldName: 'unitValue' },
+ unitOptions: { fieldName: 'unitOptions' },
+ recordId: { fieldName: 'recordId' },
+ isDisabled: { fieldName: 'isDisabled' }
+ }
+ },
+ {
+ label: '鍙戠エ鍗曚环',
+ fieldName: 'esdInvoiceUnitprice',
+ hideDefaultActions: true,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ },
+ initialWidth: 130
+ },
+ {
+ label: '鍙戠エ鏁伴噺',
+ //fieldName: "invoiceCount",
+ hideDefaultActions: true,
+ type: 'customShipment',
+ cellAttributes: { alignment: 'right' },
+ typeAttributes: {
+ recordId: { fieldName: 'recordId' },
+ shipmentNumber: { fieldName: 'shipmentNumber' },
+ isConinvoice: { fieldName: 'isConinvoice' },
+ esdInvoiceProNotCount: { fieldName: 'esdInvoiceProNotCount' }
+ }
+ },
+ {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ fieldName: 'invoiceAllprice',
+ hideDefaultActions: true,
+ type: 'number',
+ initialWidth: 150,
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
}
- },
- {
- label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
- cellAttributes: { alignment: "right" },
- fieldName: "invoiceAllprice",
- hideDefaultActions: true,
- type: "number",
- initialWidth: 150,
- typeAttributes: {
- minimumFractionDigits: 2
- }
- }
];
const customLabel = {
- LexConInvoiceViewReport
+ LexConInvoiceViewReport
};
export default class LexConInvoiceView extends NavigationMixin(
- LightningElement
+ LightningElement
) {
- @track label = customLabel;
- invoiceColumns = invoiceColumns;
- detailsColumns = detailsColumns;
- @track outboundColumns = [
- {
- label: "鍑哄簱鏃ユ湡",
- fieldName: "esdOutboundDate",
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: "鍑哄簱鍗曠紪鐮�",
- fieldName: "esdNameUrl",
- type: "url",
- typeAttributes: {
- label: { fieldName: "esdName" },
- target: "_blank"
- },
- hideDefaultActions: true,
- wrapText: true
- }
- ];
- @track outboundData = [];
- @track outboundDataSumPrice = [];
- @track invoiceData = [];
- @track invoiceAllpriceData = [];
- @track detailsSelectedRows = [];
- @track showAttPop = false;
-
- @track invoiceId = "";
- @track orderId = "";
- @track userWorkLocation = "";
- @track deliveryId = "";
- @track cocId = "";
- @track statusEdit = "";
- @track coc = {};
- @track EditAble = false;
- @track isChange = false;
- @track sumPrice = 0.0;
- @track OrderCode = "";
- @track ExistOutbound = false;
- @track reopen = "";
- @track invoiceOrderRecoedschange = [];
- @track isNew = "";
- @track outOrderStringListLwc = [];
- @track outordercountMapLwc = {};
- @track selectedRows = [];
- @track detailsInvoiceId = "";
- @track detailsCocId = "";
- @track detailsData = [];
- @track invoiceAllprice = 0.0;
- //鐘舵��
- @track invoiceStatusValue = "";
- @track invoiceStatusOptions = [];
- get Options() {
- return this.invoiceStatusOptions;
- }
- //鍑哄簱浠�
- @track deliveryFromDate = "";
- //鍑哄簱鍒�
- @track deliveryToDate = "";
- //鍙戠エ鍙�
- @track category1 = "";
- //瀹㈡埛鍚�
- @track category2 = "";
- @track ConInvoiceListAccountId = "";
- @track ConInvoiceListUserWorkLocation = "";
- @track ConInvoiceListAgencyProType = "";
-
- //浜岀骇缁忛攢鍟�
- @track provinceOptsMap = [];
- @track secondaryDistributor = "";
- //瀹㈡埛鍚�
- @track isModalOpen = false;
- @track HospitalName = "";
- @track HospitalInfo = "";
- @track searchHospitalName = "";
- @track isDisabledHospitalName = false;
- @track agencyProType = "";
- @track accountid = "";
- @track hospitalList = [];
- hospitalColumns = hospitalColumns;
- //鍙戠エ鏃ユ湡
- @track InvoiceDate = "";
- //绉戝
- @track ForCustomerText = "";
- //澶囨敞
- @track InvoiceNote = "";
-
- //鍙戠エ鏄庣粏
- @track invoiceOrderdetail1Recoeds = [];
- invoiceDetailsColumns = invoiceDetailsColumns;
-
- //鏄剧ず
- @track isShowSecondaryDistributor = false;
- @track isEditInvoice = false;
- @track isShowSpinner = true;
- @track hideCheckbox = true;
- @track done = false;
- @track isConInvoiceList = true;
- @track isDetailsShow = false;
-
- //disable
- @track isDisabledEdit = false;
- @track isDisabledReopen = false;
- @track isDisabledDelete = false;
- @track isDisabledAttachment = false;
- @track isOpenReportDisabled = true;
-
- //鏂囦欢涓婁紶
- @track showLoadingSpinner = false;
- @track showPopSpinner = false;
- @track UploadFile = "Upload File";
- @track fileName = "";
- @track fileData = [];
- @track fileColumns = [
- {
- label: "鏍囬",
- fieldName: "url",
- type: "url",
- typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
- hideDefaultActions: true
- },
- {
- label: "鍒涘缓浜�",
- type: "url",
- fieldName: "CreatedByNameUrl",
- typeAttributes: {
- label: { fieldName: "CreatedByName" },
- target: "_blank"
- },
- hideDefaultActions: true
- },
- {
- label: "涓婁紶鏃ユ湡",
- type: "date",
- typeAttributes: {
- year: "numeric",
- month: "long",
- day: "2-digit",
- hour: "2-digit",
- minute: "2-digit"
- },
- fieldName: "CreatedDate",
- hideDefaultActions: true
- },
- {
- label: "闄勪欢绫诲瀷",
- type: "customAttachmentType",
- typeAttributes: {
- typeValue: { fieldName: "typeValue" },
- typeOptions: { fieldName: "typeOptions" },
- recordId: { fieldName: "recordId" },
- isDisabledAttachment: { fieldName: "isDisabledAttachment" }
- },
- hideDefaultActions: true
- },
- {
- label: "",
- type: "tableCellIcon",
- typeAttributes: {
- iconName: "utility:delete",
- recordId: {
- fieldName: "Id"
+ @track label = customLabel;
+ invoiceColumns = invoiceColumns;
+ detailsColumns = detailsColumns;
+ @track outboundColumns = [
+ {
+ label: '鍑哄簱鏃ユ湡',
+ fieldName: 'esdOutboundDate',
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '鍑哄簱鍗曠紪鐮�',
+ fieldName: 'esdNameUrl',
+ type: 'url',
+ typeAttributes: {
+ label: { fieldName: 'esdName' },
+ target: '_blank'
+ },
+ hideDefaultActions: true,
+ wrapText: true
}
- },
- initialWidth: 50,
- hideDefaultActions: true
+ ];
+ @track outboundData = [];
+ @track outboundDataSumPrice = [];
+ @track invoiceData = [];
+ @track invoiceAllpriceData = [];
+ @track detailsSelectedRows = [];
+ @track showAttPop = false;
+
+ @track invoiceId = '';
+ @track orderId = '';
+ @track userWorkLocation = '';
+ @track deliveryId = '';
+ @track cocId = '';
+ @track statusEdit = '';
+ @track coc = {};
+ @track EditAble = false;
+ @track isChange = false;
+ @track sumPrice = 0.0;
+ @track OrderCode = '';
+ @track ExistOutbound = false;
+ @track reopen = '';
+ @track invoiceOrderRecoedschange = [];
+ @track isNew = '';
+ @track outOrderStringListLwc = [];
+ @track outordercountMapLwc = {};
+ @track selectedRows = [];
+ @track detailsInvoiceId = '';
+ @track detailsCocId = '';
+ @track detailsData = [];
+ @track invoiceAllprice = 0.0;
+ //鐘舵��
+ @track invoiceStatusValue = '';
+ @track invoiceStatusOptions = [];
+ get Options() {
+ return this.invoiceStatusOptions;
}
- ];
- filesUploaded = [];
- fileContents;
- fileReader;
- content;
- MAX_FILE_SIZE = 1500000;
+ //鍑哄簱浠�
+ @track deliveryFromDate = '';
+ //鍑哄簱鍒�
+ @track deliveryToDate = '';
+ //鍙戠エ鍙�
+ @track category1 = '';
+ //瀹㈡埛鍚�
+ @track category2 = '';
+ @track ConInvoiceListAccountId = '';
+ @track ConInvoiceListUserWorkLocation = '';
+ @track ConInvoiceListAgencyProType = '';
- stylesLoaded = false;
- renderedCallback() {
- if (!this.stylesLoaded) {
- Promise.all([loadStyle(this, WrappedHeaderTable)])
- .then(() => {
- console.log("Custom styles loaded");
- this.stylesLoaded = true;
- })
- .catch((error) => {
- console.error("Error loading custom styles");
- });
+ //浜岀骇缁忛攢鍟�
+ @track provinceOptsMap = [];
+ @track secondaryDistributor = '';
+ //瀹㈡埛鍚�
+ @track isModalOpen = false;
+ @track HospitalName = '';
+ @track HospitalInfo = '';
+ @track searchHospitalName = '';
+ @track isDisabledHospitalName = false;
+ @track agencyProType = '';
+ @track accountid = '';
+ @track hospitalList = [];
+ hospitalColumns = hospitalColumns;
+ //鍙戠エ鏃ユ湡
+ @track InvoiceDate = '';
+ //绉戝
+ @track ForCustomerText = '';
+ //澶囨敞
+ @track InvoiceNote = '';
+
+ //鍙戠エ鏄庣粏
+ @track invoiceOrderdetail1Recoeds = [];
+ invoiceDetailsColumns = invoiceDetailsColumns;
+
+ //鏄剧ず
+ @track isShowSecondaryDistributor = false;
+ @track isEditInvoice = false;
+ @track isShowSpinner = true;
+ @track hideCheckbox = true;
+ @track done = false;
+ @track isConInvoiceList = true;
+ @track isDetailsShow = false;
+
+ //disable
+ @track isDisabledEdit = false;
+ @track isDisabledReopen = false;
+ @track isDisabledDelete = false;
+ @track isDisabledAttachment = false;
+ @track isOpenReportDisabled = true;
+
+ //鏂囦欢涓婁紶
+ @track showLoadingSpinner = false;
+ @track showPopSpinner = false;
+ @track UploadFile = 'Upload File';
+ @track fileName = '';
+ @track fileData = [];
+ @track fileColumns = [
+ {
+ label: '鏍囬',
+ fieldName: 'url',
+ type: 'url',
+ typeAttributes: { label: { fieldName: 'Title' }, target: '_blank' },
+ hideDefaultActions: true
+ },
+ {
+ label: '鍒涘缓浜�',
+ type: 'url',
+ fieldName: 'CreatedByNameUrl',
+ typeAttributes: {
+ label: { fieldName: 'CreatedByName' },
+ target: '_blank'
+ },
+ hideDefaultActions: true
+ },
+ {
+ label: '涓婁紶鏃ユ湡',
+ type: 'date',
+ typeAttributes: {
+ year: 'numeric',
+ month: 'long',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit'
+ },
+ fieldName: 'CreatedDate',
+ hideDefaultActions: true
+ },
+ {
+ label: '闄勪欢绫诲瀷',
+ type: 'customAttachmentType',
+ typeAttributes: {
+ typeValue: { fieldName: 'typeValue' },
+ typeOptions: { fieldName: 'typeOptions' },
+ recordId: { fieldName: 'recordId' },
+ isDisabledAttachment: { fieldName: 'isDisabledAttachment' }
+ },
+ hideDefaultActions: true
+ },
+ {
+ label: '',
+ type: 'tableCellIcon',
+ typeAttributes: {
+ iconName: 'utility:delete',
+ recordId: {
+ fieldName: 'Id'
+ }
+ },
+ initialWidth: 50,
+ hideDefaultActions: true
+ }
+ ];
+ filesUploaded = [];
+ fileContents;
+ fileReader;
+ content;
+ MAX_FILE_SIZE = 1500000;
+
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log('Custom styles loaded');
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error('Error loading custom styles');
+ });
+ }
}
- }
- //鑾峰彇閾炬帴鍙傛暟
- getQueryString(name) {
- console.log("getQueryString name " + name);
- let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- let r = window.location.search.substr(1).match(reg);
- if (r != null) {
- return decodeURIComponent(r[2]);
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log('getQueryString name ' + name);
+ let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
}
- return null;
- }
- connectedCallback() {
- this.init();
- }
+ connectedCallback() {
+ this.init();
+ }
- init() {
- this.isShowSpinner = true;
- this.deliveryId = this.getQueryString("deliveryId");
- this.deliveryId = this.deliveryId == null ? "" : this.deliveryId;
- this.invoiceId = this.getQueryString("invoiceId");
- this.invoiceId = this.invoiceId == null ? "" : this.invoiceId;
- this.orderId = this.getQueryString("orderId");
- this.orderId = this.orderId == null ? "" : this.orderId;
- this.statusEdit = this.getQueryString("KeyWords");
- this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
- this.reopen = this.getQueryString("reopen");
- this.reopen = this.reopen == null ? "" : this.reopen;
- this.isNew = this.getQueryString("isNew");
- this.isNew = this.isNew == null ? "" : this.isNew;
- console.log(
- "this.deliveryId = " +
- this.deliveryId +
- " this.invoiceId = " +
- this.invoiceId +
- " this.statusEdit = " +
- this.statusEdit
- );
- if (this.invoiceId != "" && this.orderId != "") {
- //杩涘叆coninvoiceDetails
- detailsInit({
- orderIdLwc: this.orderId,
- invoiceIdLwc: this.invoiceId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- if (r.status == "Success") {
- this.detailsInvoiceId = r.entity.invoicecode.Id;
- this.detailsCocId = r.entity.coc.Id;
- this.detailsData = r.entity.consumableorderdetails1Records;
- for (var i in this.detailsData) {
- this.detailsData[i]["Id"] = this.detailsData[i].esd.Id;
+ init() {
+ this.isShowSpinner = true;
+ this.deliveryId = this.getQueryString('deliveryId');
+ this.deliveryId = this.deliveryId == null ? '' : this.deliveryId;
+ this.invoiceId = this.getQueryString('invoiceId');
+ this.invoiceId = this.invoiceId == null ? '' : this.invoiceId;
+ this.orderId = this.getQueryString('orderId');
+ this.orderId = this.orderId == null ? '' : this.orderId;
+ this.statusEdit = this.getQueryString('KeyWords');
+ this.statusEdit = this.statusEdit == null ? '' : this.statusEdit;
+ this.reopen = this.getQueryString('reopen');
+ this.reopen = this.reopen == null ? '' : this.reopen;
+ this.isNew = this.getQueryString('isNew');
+ this.isNew = this.isNew == null ? '' : this.isNew;
+ console.log(
+ 'this.deliveryId = ' +
+ this.deliveryId +
+ ' this.invoiceId = ' +
+ this.invoiceId +
+ ' this.statusEdit = ' +
+ this.statusEdit
+ );
+ if (this.invoiceId != '' && this.orderId != '') {
+ //杩涘叆coninvoiceDetails
+ detailsInit({
+ orderIdLwc: this.orderId,
+ invoiceIdLwc: this.invoiceId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.detailsInvoiceId = r.entity.invoicecode.Id;
+ this.detailsCocId = r.entity.coc.Id;
+ this.detailsData =
+ r.entity.consumableorderdetails1Records;
+ for (var i in this.detailsData) {
+ this.detailsData[i]['Id'] =
+ this.detailsData[i].esd.Id;
- this.detailsData[i]["esdAssetModelNo"] =
- this.detailsData[i].esd.Asset_Model_No__c;
- this.detailsData[i]["packingListManual"] =
- this.detailsData[i].Packing_list_manual;
- this.detailsData[i]["esdDeliveryListRMB"] =
- this.detailsData[i].esd.Delivery_List_RMB__c;
- this.detailsData[i]["esdShipmentCount"] =
- this.detailsData[i].esd.Shipment_Count__c;
- this.detailsData[i]["esdRrturnProCount"] =
- this.detailsData[i].esd.RrturnPro_count__c;
- this.detailsData[i]["esdBoxPiece"] =
- this.detailsData[i].esd.Box_Piece__c;
+ this.detailsData[i]['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;
+ 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"];
- }
- }
+ if (this.detailsData[i].check) {
+ this.detailsSelectedRows.push(
+ this.detailsData[i]['Id']
+ );
+ this.invoiceAllprice +=
+ this.detailsData[i]['invoiceAllprice'];
+ }
+ }
- console.log(
- "this.detailsData = " + JSON.stringify(this.detailsData)
- );
+ 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)
- );
+ let lastInvoiceAllprice = {
+ invoiceAllprice: this.invoiceAllprice
+ };
+ this.invoiceAllpriceData.push(lastInvoiceAllprice);
+ console.log(
+ 'this.invoiceAllpriceData = ' +
+ JSON.stringify(this.invoiceAllpriceData)
+ );
- this.isShowSpinner = false;
- this.isDetailsShow = true;
- } else {
- this.showMyToast("鍒濆鍖栧け璐�", r.msg, "Error");
- }
- })
- .catch((error) => {
- this.isShowSpinner = false;
- console.log("error = " + JSON.stringify(error));
- });
- } else if (
- this.deliveryId == "" &&
- this.invoiceId == "" &&
- this.isNew == ""
- ) {
- console.log("conInvoiceListInit");
- conInvoiceListInit()
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("conInvoiceListInit r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.ConInvoiceListAccountId = r.entity.accountid;
- this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
-
- this.ConInvoiceListAgencyProType = r.entity.agencyProType;
- //if (this.ConInvoiceListAgencyProType != 'ET')
- this.isOpenReportDisabled = false;
- this.invoiceData = r.entity.raesList;
- for (var i in this.invoiceData) {
- this.invoiceData[i]["NameUrl"] =
- "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
- }
- console.log(
- "this.invoiceData = " + JSON.stringify(this.invoiceData)
- );
- for (var key in r.entity.statusMap) {
- let object = {};
- object["label"] = key;
- object["value"] = r.entity.statusMap[key];
- this.invoiceStatusOptions.push(object);
- }
- this.invoiceStatusOptions = [...this.invoiceStatusOptions];
- console.log(
- "this.invoiceStatusOptions = " +
- JSON.stringify(this.invoiceStatusOptions)
- );
- this.isShowSpinner = false;
- } else {
- this.showMyToast("鍒濆鍖栧け璐�", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- } else {
- console.log("init");
- this.isConInvoiceList = false;
- init({
- invoiceId: this.invoiceId,
- statusEdit: this.statusEdit,
- deliveryId: this.deliveryId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.coc = r.entity.coc;
- this.cocId = this.coc.Id;
- this.EditAble = r.entity.EditAble;
- this.isChange = r.entity.isChange;
- this.ExistOutbound = r.entity.ExistOutbound;
- this.outboundData = r.entity.invoiceOrderRecoeds;
- console.log(
- "this.outboundData = " + JSON.stringify(this.outboundData)
- );
- this.done = r.entity.done;
- this.accountid = r.entity.accountid;
- this.userWorkLocation = r.entity.userWorkLocation;
- this.outOrderStringListLwc = r.entity.outOrderStringList;
- this.outordercountMapLwc = r.entity.outordercountMap;
- this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange;
- this.isDisabledEdit =
- this.coc.Invoice_status__c == "鎻愪氦" ||
- this.coc.Invoice_status__c == "宸插畬鎴�"
- ? true
- : false;
- this.isDisabledReopen =
- this.coc.Invoice_status__c == "鎻愪氦" ? false : true;
- this.isDisabledDelete =
- this.coc.Invoice_status__c == "鑽夋涓�" ? false : true;
- this.isDisabledAttachment =
- this.coc.Invoice_status__c == "宸插畬鎴�" ? true : false;
- this.OrderCode = this.coc.Name;
- this.InvoiceDate = this.coc.Invoice_Date__c;
-
- for (var i in this.outboundData) {
- this.outboundData[i].Id = this.outboundData[i].esd.Id;
- if (this.outboundData[i].check)
- this.selectedRows.push(this.outboundData[i].esd.Id);
- }
- this.selectedRows = [...this.selectedRows];
- console.log(
- "r.entity.attachmentRecoeds = " +
- JSON.stringify(r.entity.attachmentRecoeds)
- );
- if (!this.EditAble) {
- //闄勪欢鏄剧ず
- this.showLoadingSpinner = true;
- this.fileData = r.entity.attachmentRecoeds;
- for (var i in this.fileData) {
- this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id;
- this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id;
- this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id;
- this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title;
- this.fileData[i]["CreatedByName"] =
- this.fileData[i].cvInfo.Owner.Name;
- this.fileData[i]["CreatedByNameUrl"] =
- "/" + this.fileData[i].cvInfo.OwnerId;
- this.fileData[i]["CreatedDate"] =
- this.fileData[i].cvInfo.CreatedDate;
- this.fileData[i]["attUrl"] = "/" + this.fileData[i].cvInfo.Id;
- this.fileData[i]["downloadUrl"] =
- "/sfc/servlet.shepherd/document/download/" +
- this.fileData[i].cvInfo.ContentDocumentId +
- "?operationContext=S1";
- if (this.isDisabledAttachment) {
- console.log("杩涘叆this.isDisabledAttachment");
- this.fileData[i]["isDisabledAttachment"] = true;
- }
- let typeOptions = [];
- for (var key in this.fileData[i].mailSelectOptsMap) {
- let typeOption = {};
- typeOption["label"] = this.fileData[i].mailSelectOptsMap[key];
- typeOption["value"] = key;
- typeOptions.push(typeOption);
- }
- this.fileData[i]["typeValue"] =
- this.fileData[i].mailSelectOptsin == null
- ? typeOptions[0].value
- : this.fileData[i].mailSelectOptsin;
- this.fileData[i]["typeOptions"] = typeOptions;
- this.fileData[i]["mailSelectOptsin"] =
- this.fileData[i].mailSelectOptsin == null
- ? typeOptions[0].value
- : this.fileData[i].mailSelectOptsin;
- }
- console.log("this.fileData = " + JSON.stringify(this.fileData));
- }
-
- //鍙戠エ鏄庣粏
- this.invoiceOrderdetail1Recoeds =
- r.entity.invoiceOrderdetail1Recoeds;
- for (var i in this.invoiceOrderdetail1Recoeds) {
- this.invoiceOrderdetail1Recoeds[i]["esdetProductOutDate"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c;
- this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedet1ODlinkName"] =
- this.invoiceOrderdetail1Recoeds[
- i
- ].esdet.Invoicedet1_OD_link__r.Name;
- this.invoiceOrderdetail1Recoeds[i]["esdetAssetModelNo"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c;
- this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnit"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c;
- this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnitprice"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c;
- this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedCount"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c;
- this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedProCostRMB"] =
- this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c;
- }
- //瀹㈡埛鍚�
- this.HospitalName = r.entity.HospitalName;
- this.HospitalInfo = r.entity.HospitalInfo;
- this.agencyProType = r.entity.agencyProType;
- //if (this.agencyProType != 'ET')
- this.isOpenReportDisabled = false;
- //绉戝
- this.ForCustomerText = this.coc.Order_ForCustomerText__c;
- //澶囨敞
- this.InvoiceNote = this.coc.Invoice_Note__c;
- //浜岀骇缁忛攢鍟�
- for (var key in r.entity.provinceOptsMap) {
- let object = {};
- object["label"] = r.entity.provinceOptsMap[key];
- object["value"] = key;
- this.provinceOptsMap.push(object);
- }
- //鍑鸿揣涓�瑙坈olumns
-
- if (this.EditAble) {
- let object1 = {
- label: "瀹㈡埛鍚�",
- fieldName: "hospitalName",
- hideDefaultActions: true,
- 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);
-
- //鍑鸿揣涓�瑙圖ata
- let index = 0;
- for (var i in this.outboundData) {
- this.outboundData[i]["esdOutboundDate"] =
- this.outboundData[i].esd.Outbound_Date__c;
- this.outboundData[i]["esdNameUrl"] =
- "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id;
- this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name;
- if (this.EditAble) {
- this.outboundData[i]["hospitalName"] =
- this.outboundData[i].esd.ShipmentAccount__c;
- this.outboundData[i]["shipmentAmount"] =
- this.outboundData[i].esd.Shipment_total_amount__c;
- this.outboundData[i]["returnAmount"] =
- this.outboundData[i].esd.RrturnPro_total_amount__c;
- }
- this.outboundData[i]["uninvoicedAmount"] =
- this.outboundData[i].esd.InvoiceNotPro_money__c;
- this.outboundData[i]["invoiceFaceAmount"] =
- this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount);
- if (
- !(
- this.outboundData[i].esd.Billed_Status__c == "鍏ㄩ儴寮�绁�" ||
- this.EditAble ||
- this.coc.Invoice_status__c != "鑽夋涓�"
- )
- ) {
- console.log("杩涘叆 if");
- let url =
- "/lexconinvoiceview?orderId=" +
- this.outboundData[i].esd.Id +
- "&invoiceId=" +
- this.invoiceId;
- this.outboundData[i]["invoiceFaceAmountUrl"] = url;
- if (index == 0) {
- let object5 = {
- label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
- cellAttributes: { alignment: "right" },
- type: "url",
- fieldName: "invoiceFaceAmountUrl",
- typeAttributes: {
- label: {
- fieldName: "invoiceFaceAmount"
- }
- //target: "_blank",
- },
- hideDefaultActions: true
- };
- this.outboundColumns.push(object5);
- index++;
- }
- } else {
- console.log("杩涘叆 else");
- if (index == 0) {
- let object5 = {
- label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
- cellAttributes: { alignment: "right" },
- fieldName: "invoiceFaceAmount",
- hideDefaultActions: true,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
+ this.isShowSpinner = false;
+ this.isDetailsShow = true;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
}
- };
- this.outboundColumns.push(object5);
- index++;
+ })
+ .catch((error) => {
+ this.isShowSpinner = false;
+ console.log('error = ' + JSON.stringify(error));
+ });
+ } else if (
+ this.deliveryId == '' &&
+ this.invoiceId == '' &&
+ this.isNew == ''
+ ) {
+ console.log('conInvoiceListInit');
+ conInvoiceListInit()
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('conInvoiceListInit r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.ConInvoiceListAccountId = r.entity.accountid;
+ this.ConInvoiceListUserWorkLocation =
+ r.entity.userWorkLocation;
+
+ this.ConInvoiceListAgencyProType =
+ r.entity.agencyProType;
+ //if (this.ConInvoiceListAgencyProType != 'ET')
+ this.isOpenReportDisabled = false;
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] =
+ '/lexconinvoiceview?invoiceId=' +
+ this.invoiceData[i].Id;
+ }
+ console.log(
+ 'this.invoiceData = ' +
+ JSON.stringify(this.invoiceData)
+ );
+ for (var key in r.entity.statusMap) {
+ let object = {};
+ object['label'] = key;
+ object['value'] = r.entity.statusMap[key];
+ this.invoiceStatusOptions.push(object);
+ }
+ this.invoiceStatusOptions = [
+ ...this.invoiceStatusOptions
+ ];
+ console.log(
+ 'this.invoiceStatusOptions = ' +
+ JSON.stringify(this.invoiceStatusOptions)
+ );
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ } else {
+ console.log('init');
+ this.isConInvoiceList = false;
+ init({
+ invoiceId: this.invoiceId,
+ statusEdit: this.statusEdit,
+ deliveryId: this.deliveryId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.coc = r.entity.coc;
+ this.cocId = this.coc.Id;
+ this.EditAble = r.entity.EditAble;
+ this.isChange = r.entity.isChange;
+ this.ExistOutbound = r.entity.ExistOutbound;
+ this.outboundData = r.entity.invoiceOrderRecoeds;
+ console.log(
+ 'this.outboundData = ' +
+ JSON.stringify(this.outboundData)
+ );
+ this.done = r.entity.done;
+ this.accountid = r.entity.accountid;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.outOrderStringListLwc =
+ r.entity.outOrderStringList;
+ this.outordercountMapLwc = r.entity.outordercountMap;
+ this.invoiceOrderRecoedschange =
+ r.entity.invoiceOrderRecoedschange;
+ this.isDisabledEdit =
+ this.coc.Invoice_status__c == '鎻愪氦' ||
+ this.coc.Invoice_status__c == '宸插畬鎴�'
+ ? true
+ : false;
+ this.isDisabledReopen =
+ this.coc.Invoice_status__c == '鎻愪氦' ? false : true;
+ this.isDisabledDelete =
+ this.coc.Invoice_status__c == '鑽夋涓�'
+ ? false
+ : true;
+ this.isDisabledAttachment =
+ this.coc.Invoice_status__c == '宸插畬鎴�'
+ ? true
+ : false;
+ this.OrderCode = this.coc.Name;
+ this.InvoiceDate = this.coc.Invoice_Date__c;
+
+ for (var i in this.outboundData) {
+ this.outboundData[i].Id =
+ this.outboundData[i].esd.Id;
+ if (this.outboundData[i].check)
+ this.selectedRows.push(
+ this.outboundData[i].esd.Id
+ );
+ }
+ this.selectedRows = [...this.selectedRows];
+ console.log(
+ 'r.entity.attachmentRecoeds = ' +
+ JSON.stringify(r.entity.attachmentRecoeds)
+ );
+ if (!this.EditAble) {
+ //闄勪欢鏄剧ず
+ this.showLoadingSpinner = true;
+ this.fileData = r.entity.attachmentRecoeds;
+ for (var i in this.fileData) {
+ this.fileData[i]['Id'] =
+ this.fileData[i].cvInfo.Id;
+ this.fileData[i]['recordId'] =
+ this.fileData[i].cvInfo.Id;
+ this.fileData[i]['url'] =
+ '/' + this.fileData[i].cvInfo.Id;
+ this.fileData[i]['Title'] =
+ this.fileData[i].cvInfo.Title;
+ this.fileData[i]['CreatedByName'] =
+ this.fileData[i].cvInfo.Owner.Name;
+ this.fileData[i]['CreatedByNameUrl'] =
+ '/' + this.fileData[i].cvInfo.OwnerId;
+ this.fileData[i]['CreatedDate'] =
+ this.fileData[i].cvInfo.CreatedDate;
+ this.fileData[i]['attUrl'] =
+ '/' + this.fileData[i].cvInfo.Id;
+ this.fileData[i]['downloadUrl'] =
+ '/sfc/servlet.shepherd/document/download/' +
+ this.fileData[i].cvInfo.ContentDocumentId +
+ '?operationContext=S1';
+ if (this.isDisabledAttachment) {
+ console.log(
+ '杩涘叆this.isDisabledAttachment'
+ );
+ this.fileData[i][
+ 'isDisabledAttachment'
+ ] = true;
+ }
+ let typeOptions = [];
+ for (var key in this.fileData[i]
+ .mailSelectOptsMap) {
+ let typeOption = {};
+ typeOption['label'] =
+ this.fileData[i].mailSelectOptsMap[key];
+ typeOption['value'] = key;
+ typeOptions.push(typeOption);
+ }
+ this.fileData[i]['typeValue'] =
+ this.fileData[i].mailSelectOptsin == null
+ ? typeOptions[0].value
+ : this.fileData[i].mailSelectOptsin;
+ this.fileData[i]['typeOptions'] = typeOptions;
+ this.fileData[i]['mailSelectOptsin'] =
+ this.fileData[i].mailSelectOptsin == null
+ ? typeOptions[0].value
+ : this.fileData[i].mailSelectOptsin;
+ }
+ console.log(
+ 'this.fileData = ' +
+ JSON.stringify(this.fileData)
+ );
+ }
+
+ //鍙戠エ鏄庣粏
+ this.invoiceOrderdetail1Recoeds =
+ r.entity.invoiceOrderdetail1Recoeds;
+ for (var i in this.invoiceOrderdetail1Recoeds) {
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetProductOutDate'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Product_OutDate__c;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetInvoicedet1ODlinkName'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Invoicedet1_OD_link__r.Name;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetAssetModelNo'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Asset_Model_No__c;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetInvoiceUnit'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Invoice_Unit__c;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetInvoiceUnitprice'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Invoice_Unitprice__c;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetInvoicedCount'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.Invoiced_Count__c;
+ this.invoiceOrderdetail1Recoeds[i][
+ 'esdetInvoicedProCostRMB'
+ ] =
+ this.invoiceOrderdetail1Recoeds[
+ i
+ ].esdet.InvoicedProCost_RMB__c;
+ }
+ //瀹㈡埛鍚�
+ this.HospitalName = r.entity.HospitalName;
+ this.HospitalInfo = r.entity.HospitalInfo;
+ this.agencyProType = r.entity.agencyProType;
+ //if (this.agencyProType != 'ET')
+ this.isOpenReportDisabled = false;
+ //绉戝
+ this.ForCustomerText =
+ this.coc.Order_ForCustomerText__c;
+ //澶囨敞
+ this.InvoiceNote = this.coc.Invoice_Note__c;
+ //浜岀骇缁忛攢鍟�
+ for (var key in r.entity.provinceOptsMap) {
+ let object = {};
+ object['label'] = r.entity.provinceOptsMap[key];
+ object['value'] = key;
+ this.provinceOptsMap.push(object);
+ }
+ //鍑鸿揣涓�瑙坈olumns
+
+ if (this.EditAble) {
+ let object1 = {
+ label: '瀹㈡埛鍚�',
+ fieldName: 'hospitalName',
+ hideDefaultActions: true,
+ 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);
+
+ //鍑鸿揣涓�瑙圖ata
+ let index = 0;
+ for (var i in this.outboundData) {
+ this.outboundData[i]['esdOutboundDate'] =
+ this.outboundData[i].esd.Outbound_Date__c;
+ this.outboundData[i]['esdNameUrl'] =
+ '/s/lexsummonscreat?ESetid=' +
+ this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdName'] =
+ this.outboundData[i].esd.Name;
+ if (this.EditAble) {
+ this.outboundData[i]['hospitalName'] =
+ this.outboundData[i].esd.ShipmentAccount__c;
+ this.outboundData[i]['shipmentAmount'] =
+ this.outboundData[
+ i
+ ].esd.Shipment_total_amount__c;
+ this.outboundData[i]['returnAmount'] =
+ this.outboundData[
+ i
+ ].esd.RrturnPro_total_amount__c;
+ }
+ this.outboundData[i]['uninvoicedAmount'] =
+ this.outboundData[i].esd.InvoiceNotPro_money__c;
+ this.outboundData[i]['invoiceFaceAmount'] =
+ this.keepTwoDecimalStr(
+ this.outboundData[i].needInvoiceCount
+ );
+ if (
+ !(
+ this.outboundData[i].esd.Billed_Status__c ==
+ '鍏ㄩ儴寮�绁�' ||
+ this.EditAble ||
+ this.coc.Invoice_status__c != '鑽夋涓�'
+ )
+ ) {
+ console.log('杩涘叆 if');
+ let url =
+ '/lexconinvoiceview?orderId=' +
+ this.outboundData[i].esd.Id +
+ '&invoiceId=' +
+ this.invoiceId;
+ this.outboundData[i]['invoiceFaceAmountUrl'] =
+ url;
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ type: 'url',
+ fieldName: 'invoiceFaceAmountUrl',
+ typeAttributes: {
+ label: {
+ fieldName: 'invoiceFaceAmount'
+ }
+ //target: "_blank",
+ },
+ hideDefaultActions: true
+ };
+ this.outboundColumns.push(object5);
+ index++;
+ }
+ } else {
+ console.log('杩涘叆 else');
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ fieldName: 'invoiceFaceAmount',
+ hideDefaultActions: true,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ }
+ };
+ this.outboundColumns.push(object5);
+ index++;
+ }
+ }
+ //璁$畻鍙戠エ绁ㄩ潰閲戦
+ this.sumPrice +=
+ this.outboundData[i].needInvoiceCount;
+ }
+
+ //鍥涜垗浜斿叆
+ //this.sumPrice = this.sumPrice.toFixed(2);
+ //濡傛灉涓嶅洓鑸嶄簲鍏�
+ console.log('start keepTwoDecimalStr');
+ this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
+ console.log('end keepTwoDecimalStr = ' + this.sumPrice);
+ //鍔犳渶鍚庝竴琛屾樉绀洪噾棰�
+ if (this.EditAble) {
+ let lastOutboundData = {
+ invoiceFaceAmount: this.sumPrice
+ };
+ this.outboundDataSumPrice.push(lastOutboundData);
+ }
+ this.outboundColumns = [...this.outboundColumns];
+
+ this.isEditInvoice = !(!this.EditAble || this.isChange);
+ if (
+ this.coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�'
+ )
+ this.isShowSecondaryDistributor = true;
+ if (
+ this.deliveryId == '' &&
+ !this.ExistOutbound &&
+ this.EditAble
+ )
+ this.hideCheckbox = false;
+ this.isShowSpinner = false;
+ this.showLoadingSpinner = false;
+ } else {
+ this.showMyToast('澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+ }
+
+ //涓婁紶閰嶇疆鍗�
+ uploadOrder(event) {
+ this.showAttPop = true;
+ }
+
+ //鍏抽棴闄勪欢寮圭獥
+ closePop() {
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ }
+
+ //闄勪欢change浜嬩欢
+ attChange(event) {
+ if (event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ console.log('this.fileName:' + this.fileName);
+ }
+ }
+
+ //绉婚櫎闄勪欢
+ removeAtt() {
+ this.filesUploaded = [];
+ this.fileName = '';
+ }
+
+ //鏄惁鏄剧ず闄勪欢绉婚櫎
+ get attDelBtn() {
+ if (
+ this.fileName != '' &&
+ this.fileName != null &&
+ this.fileName != '閫夋嫨涓�涓枃浠朵笂浼�'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ keepTwoDecimalStr(num) {
+ const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+ let s = result.toString();
+ let rs = s.indexOf('.');
+ if (rs < 0) {
+ rs = s.length;
+ s += '.';
+ }
+ while (s.length <= rs + 2) {
+ s += '0';
+ }
+ return s;
+ }
+
+ dataChange(event) {
+ let fieldName = event.target.getAttribute('data-field');
+ let value = event.detail.value;
+ console.log('fieldName = ' + fieldName + ' value = ' + value);
+ switch (fieldName) {
+ case 'OrderCode':
+ this.OrderCode = value;
+ this.coc['Name'] = value;
+ break;
+ case 'ForCustomerText':
+ this.ForCustomerText = value;
+ this.coc['Order_ForCustomerText__c'] = value;
+ break;
+ case 'InvoiceDate':
+ this.InvoiceDate = value;
+ this.coc['Invoice_Date__c'] = value;
+ break;
+ case 'secondaryDistributor':
+ this.secondaryDistributor = value;
+ break;
+ case 'deliveryFromDate':
+ this.deliveryFromDate = value;
+ break;
+ case 'deliveryToDate':
+ this.deliveryToDate = value;
+ break;
+ case 'category1':
+ this.category1 = value;
+ break;
+ case 'category2':
+ this.category2 = value;
+ break;
+ case 'invoiceStatus':
+ this.invoiceStatusValue = value;
+ break;
+ case 'searchHospitalName':
+ this.searchHospitalName = value;
+ break;
+ case 'InvoiceNote':
+ this.InvoiceNote = value;
+ this.coc['Invoice_Note__c'] = value;
+ break;
+ }
+ }
+
+ invoiceDateChange(event) {
+ this.InvoiceDate = event.detail.value;
+ this.coc['Invoice_Date__c'] = event.detail.value;
+ console.log('this.InvoiceDate = ' + this.InvoiceDate);
+ }
+
+ //鎼滅储瀹㈡埛鍚�
+ searchHospitalNameModal() {
+ console.log('searchHospitalNameModal');
+ hospitalInit({
+ ctype: this.agencyProType
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]['stateMasterName'] =
+ this.hospitalList[i].State_Master__r.Name;
}
- }
- //璁$畻鍙戠エ绁ㄩ潰閲戦
- this.sumPrice += this.outboundData[i].needInvoiceCount;
+ console.log(
+ 'hospitalInit r = ' + JSON.stringify(this.hospitalList)
+ );
+ this.isModalOpen = true;
}
-
- //鍥涜垗浜斿叆
- //this.sumPrice = this.sumPrice.toFixed(2);
- //濡傛灉涓嶅洓鑸嶄簲鍏�
- console.log("start keepTwoDecimalStr");
- this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
- console.log("end keepTwoDecimalStr = " + this.sumPrice);
- //鍔犳渶鍚庝竴琛屾樉绀洪噾棰�
- if (this.EditAble) {
- let lastOutboundData = {
- invoiceFaceAmount: this.sumPrice
- };
- this.outboundDataSumPrice.push(lastOutboundData);
- }
- this.outboundColumns = [...this.outboundColumns];
-
- this.isEditInvoice = !(!this.EditAble || this.isChange);
- if (this.coc.SummonsForDirction__c == "閿�鍞粰浜岀骇缁忛攢鍟�")
- this.isShowSecondaryDistributor = true;
- if (this.deliveryId == "" && !this.ExistOutbound && this.EditAble)
- this.hideCheckbox = false;
- this.isShowSpinner = false;
- this.showLoadingSpinner = false;
- } else {
- this.showMyToast("澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
});
}
- }
- //涓婁紶閰嶇疆鍗�
- uploadOrder(event) {
- this.showAttPop = true;
- }
-
- //鍏抽棴闄勪欢寮圭獥
- closePop() {
- this.showAttPop = false;
- this.filesUploaded = [];
- this.fileName = null;
- }
-
- //闄勪欢change浜嬩欢
- attChange(event) {
- if (event.target.files.length > 0) {
- this.filesUploaded = event.target.files;
- this.fileName = event.target.files[0].name;
- console.log("this.fileName:" + this.fileName);
- }
- }
-
- //绉婚櫎闄勪欢
- removeAtt() {
- this.filesUploaded = [];
- this.fileName = "";
- }
-
- //鏄惁鏄剧ず闄勪欢绉婚櫎
- get attDelBtn() {
- if (
- this.fileName != "" &&
- this.fileName != null &&
- this.fileName != "閫夋嫨涓�涓枃浠朵笂浼�"
- ) {
- return true;
- } else {
- return false;
- }
- }
-
- keepTwoDecimalStr(num) {
- const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
- let s = result.toString();
- let rs = s.indexOf(".");
- if (rs < 0) {
- rs = s.length;
- s += ".";
- }
- while (s.length <= rs + 2) {
- s += "0";
- }
- return s;
- }
-
- dataChange(event) {
- let fieldName = event.target.getAttribute("data-field");
- let value = event.detail.value;
- console.log("fieldName = " + fieldName + " value = " + value);
- switch (fieldName) {
- case "OrderCode":
- this.OrderCode = value;
- this.coc["Name"] = value;
- break;
- case "ForCustomerText":
- this.ForCustomerText = value;
- this.coc["Order_ForCustomerText__c"] = value;
- break;
- case "InvoiceDate":
- this.InvoiceDate = value;
- this.coc["Invoice_Date__c"] = value;
- break;
- case "secondaryDistributor":
- this.secondaryDistributor = value;
- break;
- case "deliveryFromDate":
- this.deliveryFromDate = value;
- break;
- case "deliveryToDate":
- this.deliveryToDate = value;
- break;
- case "category1":
- this.category1 = value;
- break;
- case "category2":
- this.category2 = value;
- break;
- case "invoiceStatus":
- this.invoiceStatusValue = value;
- break;
- case "searchHospitalName":
- this.searchHospitalName = value;
- break;
- case "InvoiceNote":
- this.InvoiceNote = value;
- this.coc["Invoice_Note__c"] = value;
- break;
- }
- }
-
- invoiceDateChange(event) {
- this.InvoiceDate = event.detail.value;
- this.coc["Invoice_Date__c"] = event.detail.value;
- console.log("this.InvoiceDate = " + this.InvoiceDate);
- }
-
- //鎼滅储瀹㈡埛鍚�
- searchHospitalNameModal() {
- console.log("searchHospitalNameModal");
- hospitalInit({
- ctype: this.agencyProType
- }).then((r) => {
- r = JSON.parse(JSON.stringify(r));
- if (r.status == "Success") {
- this.hospitalList = r.entity.at;
- for (var i in this.hospitalList) {
- this.hospitalList[i]["stateMasterName"] =
- this.hospitalList[i].State_Master__r.Name;
- }
- console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
- this.isModalOpen = true;
- }
- });
- }
-
- searchHospital() {
- console.log("this.searchHospitalName = " + this.searchHospitalName);
- serContact({
- searchName: this.searchHospitalName,
- ctype: this.agencyProType
- }).then((r) => {
- r = JSON.parse(JSON.stringify(r));
- if (r.status == "Success") {
- this.hospitalList = r.entity.at;
- for (var i in this.hospitalList) {
- this.hospitalList[i]["stateMasterName"] =
- this.hospitalList[i].State_Master__r.Name;
- }
- console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
- }
- });
- }
-
- //閫夋嫨瀹㈡埛鍚�
- searchHandleRowAction(event) {
- console.log("searchHandleRowAction");
- let row = event.detail.row;
- this.HospitalInfo = row.Id;
- this.HospitalName = row.Name;
- console.log(
- "this.HospitalInfo = " +
- this.HospitalInfo +
- " this.HospitalName = " +
- this.HospitalName
- );
- this.isModalOpen = false;
- }
-
- //褰撳鎴峰悕鏄┖鏃躲�傚鎴穒d涔熷彉涓虹┖
- clearAgencyI(event) {
- this.HospitalName = event.target.value;
- if (this.HospitalName == "" || this.HospitalName == null) {
- this.HospitalInfo = "";
- }
- console.log("this.HospitalName = " + this.HospitalName);
- console.log("this.HospitalInfo = " + this.HospitalInfo);
- }
-
- closeModal() {
- this.isModalOpen = false;
- }
-
- SaveJs() {
- this.isShowSpinner = true;
- let cloneData = this.outboundData;
-
- debugger;
- const selectedRows = this.template
- .querySelector("[data-field='outbound']")
- .getSelectedRows();
- console.log("selectedRows = " + JSON.stringify(selectedRows));
-
- for (var i in cloneData) {
- let b = false;
- for (var j in selectedRows) {
- if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
- b = true;
- cloneData[i].check = true;
- }
- }
- if (!b) {
- cloneData[i].check = false;
- }
- delete cloneData[i].esdOutboundDate;
- delete cloneData[i].esdNameUrl;
- delete cloneData[i].esdName;
- delete cloneData[i].hospitalName;
- delete cloneData[i].shipmentAmount;
- delete cloneData[i].returnAmount;
- delete cloneData[i].uninvoicedAmount;
- delete cloneData[i].invoiceFaceAmount;
- delete cloneData[i].invoiceFaceAmountUrl;
- }
-
- console.log("this.coc = " + JSON.stringify(this.coc));
- console.log("this.HospitalName = " + this.HospitalName);
- console.log("this.HospitalInfo = " + this.HospitalInfo);
- console.log("this.secondaryDistributor = " + this.secondaryDistributor);
- console.log("this.outboundData = " + JSON.stringify(cloneData));
- console.log("this.deliveryId = " + this.deliveryId);
- console.log("this.invoiceId = " + this.invoiceId);
- console.log("this.accountid = " + this.accountid);
- console.log("this.agencyProType = " + this.agencyProType);
- console.log("this.reopen = " + this.reopen);
- console.log(
- "this.invoiceOrderRecoedschangeLwc = " +
- JSON.stringify(this.invoiceOrderRecoedschange)
- );
- save({
- cocLwc: this.coc,
- HospitalNameLwc: this.HospitalName,
- HospitalInfoLwc: this.HospitalInfo,
- SecondDealerLwc: this.secondaryDistributor,
- invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
- deliveryIdLwc: this.deliveryId,
- invoiceIdLwc: this.invoiceId,
- accountidLwc: this.accountid,
- agencyProTypeLwc: this.agencyProType,
- reopenLwc: this.reopen,
- invoiceOrderRecoedschangeLwc: JSON.stringify(
- this.invoiceOrderRecoedschange
- )
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success" && r.msg == "") {
- this.isShowSpinner = false;
- console.log("save success");
- let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId;
- console.log("url = " + url);
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
+ searchHospital() {
+ console.log('this.searchHospitalName = ' + this.searchHospitalName);
+ serContact({
+ searchName: this.searchHospitalName,
+ ctype: this.agencyProType
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]['stateMasterName'] =
+ this.hospitalList[i].State_Master__r.Name;
+ }
+ console.log(
+ 'hospitalInit r = ' + JSON.stringify(this.hospitalList)
+ );
}
- });
- } else {
- this.showMyToast("淇濆瓨澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
-
- //涓婁紶闄勪欢锛岀洿鎺ュ氨淇濆瓨濂斤紝鐒跺悗灞曠ず
- handleFilesChange(event) {
- console.log("handleFilesChange");
- this.handleSave();
- // if (event.target.files.length > 0) {
- // this.filesUploaded = event.target.files;
- // this.fileName = event.target.files[0].name;
- // this.handleSave();
- // }
- }
-
- handleSave() {
- console.log("saveFile");
- if (this.filesUploaded.length > 0) {
- this.showPopSpinner = true;
- this.file = this.filesUploaded[0];
- if (this.file.size > this.MAX_FILE_SIZE) {
- this.showMyToast("淇濆瓨澶辫触", "鏂囦欢杩囧ぇ", "Error");
- return;
- }
- this.fileReader = new FileReader();
-
- this.fileReader.onloadend = () => {
- this.fileContents = this.fileReader.result;
- let base64 = "base64,";
- this.content = this.fileContents.indexOf(base64) + base64.length;
- this.fileContents = this.fileContents.substring(this.content);
- this.saveToFile();
- };
- this.fileReader.readAsDataURL(this.file);
- } else {
- this.fileName = "閫夋嫨涓�涓枃浠朵笂浼�";
+ });
}
- }
- saveToFile() {
- 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");
- });
- }
-
- handleTypeChange(event) {
- console.log("handleTypeChange");
- const typeDetail = event.detail;
- console.log("typeDetail = " + JSON.stringify(typeDetail));
- for (var i in this.fileData) {
- if (this.fileData[i].recordId == typeDetail.data.recordId) {
- this.fileData[i].typeValue = typeDetail.data.typeValue;
- this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
- }
+ //閫夋嫨瀹㈡埛鍚�
+ searchHandleRowAction(event) {
+ console.log('searchHandleRowAction');
+ let row = event.detail.row;
+ this.HospitalInfo = row.Id;
+ this.HospitalName = row.Name;
+ console.log(
+ 'this.HospitalInfo = ' +
+ this.HospitalInfo +
+ ' this.HospitalName = ' +
+ this.HospitalName
+ );
+ this.isModalOpen = false;
}
- console.log("this.fileData = " + JSON.stringify(this.fileData));
- }
- newInvoiceJs() {
- let url = "/lexconinvoiceview?isNew=yes";
- console.log("url = " + url);
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
- }
- });
- }
-
- saveAttachmentJs() {
- debugger;
- this.showLoadingSpinner = true;
- let cloneData = this.deepClone(this.fileData);
- for (var i in cloneData) {
- delete cloneData[i].Id;
- delete cloneData[i].recordId;
- delete cloneData[i].url;
- delete cloneData[i].Title;
- delete cloneData[i].CreatedByName;
- delete cloneData[i].CreatedByNameUrl;
- delete cloneData[i].CreatedDate;
- delete cloneData[i].typeValue;
- delete cloneData[i].typeOptions;
- delete cloneData[i].mailSelectOptsMap;
- }
- console.log("cloneData = " + JSON.stringify(cloneData));
- saveAttachment({
- attachmentRecoedsLwc: JSON.stringify(cloneData),
- invoiceId: this.invoiceId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.showLoadingSpinner = false;
- this.isShowSpinner = true;
- // const event = new ShowToastEvent({
- // title: 'Success',
- // variant: 'Success',
- // message: '淇濆瓨鎴愬姛',
- // });
- // this.dispatchEvent(event);
- this.showMyToast("闄勪欢淇濆瓨鎴愬姛", "", "Success");
- //this.init();
- setTimeout(function () {
- //1绉掑悗鎵ц鍒锋柊
- window.location.reload();
- }, 2000); //鍗曚綅鏄绉�
- // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
- // console.log('url = ' + url);
- // this[NavigationMixin.Navigate]({
- // type: "standard__webPage",
- // attributes: {
- // url: url,
- // },
- // });
- } else {
- this.showMyToast("涓婁紶澶辫触", r.msg, "Error");
+ //褰撳鎴峰悕鏄┖鏃躲�傚鎴穒d涔熷彉涓虹┖
+ clearAgencyI(event) {
+ this.HospitalName = event.target.value;
+ if (this.HospitalName == '' || this.HospitalName == null) {
+ this.HospitalInfo = '';
}
- })
- .catch((error) => {
- console.log("error = " + error.message);
- this.showMyToast("閿欒", "涓婁紶澶辫触", "Error");
- });
- }
+ console.log('this.HospitalName = ' + this.HospitalName);
+ console.log('this.HospitalInfo = ' + this.HospitalInfo);
+ }
- invoiceCodeSearchJs() {
- this.isShowSpinner = true;
- invoiceCodeSearch({
- orderDateLwc:
- this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate),
- deliverDateLwc:
- this.deliveryToDate == null ? null : new Date(this.deliveryToDate),
- invoiceStatusLwc: this.invoiceStatusValue,
- category1Lwc: this.category1,
- category2Lwc: this.category2,
- accountidLwc: this.ConInvoiceListAccountId,
- userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
- agencyProTypeLwc: this.ConInvoiceListAgencyProType
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.invoiceData = r.entity.raesList;
- for (var i in this.invoiceData) {
- this.invoiceData[i]["NameUrl"] =
- "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
- }
- console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
- this.isShowSpinner = false;
- if (r.entity.raesListSize > 0) {
- this.showMyToast(
- "鎼滅储鎴愬姛",
- "鍏辨绱㈠埌" + r.entity.raesListSize + "涓彂绁�",
- "Success"
+ closeModal() {
+ this.isModalOpen = false;
+ }
+
+ SaveJs() {
+ this.isShowSpinner = true;
+ let cloneData = this.outboundData;
+
+ debugger;
+ const selectedRows = this.template
+ .querySelector("[data-field='outbound']")
+ .getSelectedRows();
+ console.log('selectedRows = ' + JSON.stringify(selectedRows));
+
+ for (var i in cloneData) {
+ let b = false;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ b = true;
+ cloneData[i].check = true;
+ }
+ }
+ if (!b) {
+ cloneData[i].check = false;
+ }
+ delete cloneData[i].esdOutboundDate;
+ delete cloneData[i].esdNameUrl;
+ delete cloneData[i].esdName;
+ delete cloneData[i].hospitalName;
+ delete cloneData[i].shipmentAmount;
+ delete cloneData[i].returnAmount;
+ delete cloneData[i].uninvoicedAmount;
+ delete cloneData[i].invoiceFaceAmount;
+ delete cloneData[i].invoiceFaceAmountUrl;
+ }
+
+ console.log('this.coc = ' + JSON.stringify(this.coc));
+ console.log('this.HospitalName = ' + this.HospitalName);
+ console.log('this.HospitalInfo = ' + this.HospitalInfo);
+ console.log('this.secondaryDistributor = ' + this.secondaryDistributor);
+ console.log('this.outboundData = ' + JSON.stringify(cloneData));
+ console.log('this.deliveryId = ' + this.deliveryId);
+ console.log('this.invoiceId = ' + this.invoiceId);
+ console.log('this.accountid = ' + this.accountid);
+ console.log('this.agencyProType = ' + this.agencyProType);
+ console.log('this.reopen = ' + this.reopen);
+ console.log(
+ 'this.invoiceOrderRecoedschangeLwc = ' +
+ JSON.stringify(this.invoiceOrderRecoedschange)
+ );
+ save({
+ cocLwc: this.coc,
+ HospitalNameLwc: this.HospitalName,
+ HospitalInfoLwc: this.HospitalInfo,
+ SecondDealerLwc: this.secondaryDistributor,
+ invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
+ deliveryIdLwc: this.deliveryId,
+ invoiceIdLwc: this.invoiceId,
+ accountidLwc: this.accountid,
+ agencyProTypeLwc: this.agencyProType,
+ reopenLwc: this.reopen,
+ invoiceOrderRecoedschangeLwc: JSON.stringify(
+ this.invoiceOrderRecoedschange
+ )
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success' && r.msg == '') {
+ this.isShowSpinner = false;
+ console.log('save success');
+ let url =
+ '/lexconinvoiceview?invoiceId=' + r.entity.invoiceId;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ } else {
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+
+ //涓婁紶闄勪欢锛岀洿鎺ュ氨淇濆瓨濂斤紝鐒跺悗灞曠ず
+ handleFilesChange(event) {
+ console.log('handleFilesChange');
+ this.handleSave();
+ // if (event.target.files.length > 0) {
+ // this.filesUploaded = event.target.files;
+ // this.fileName = event.target.files[0].name;
+ // this.handleSave();
+ // }
+ }
+
+ handleSave() {
+ console.log('saveFile');
+ if (this.filesUploaded.length > 0) {
+ this.showPopSpinner = true;
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ this.showMyToast('淇濆瓨澶辫触', '鏂囦欢杩囧ぇ', 'Error');
+ return;
+ }
+ this.fileReader = new FileReader();
+
+ this.fileReader.onloadend = () => {
+ this.fileContents = this.fileReader.result;
+ let base64 = 'base64,';
+ this.content =
+ this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ this.saveToFile();
+ };
+ this.fileReader.readAsDataURL(this.file);
+ } else {
+ this.fileName = '閫夋嫨涓�涓枃浠朵笂浼�';
+ }
+ }
+
+ saveToFile() {
+ 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');
+ });
+ }
+
+ handleTypeChange(event) {
+ console.log('handleTypeChange');
+ const typeDetail = event.detail;
+ console.log('typeDetail = ' + JSON.stringify(typeDetail));
+ for (var i in this.fileData) {
+ if (this.fileData[i].recordId == typeDetail.data.recordId) {
+ this.fileData[i].typeValue = typeDetail.data.typeValue;
+ this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
+ }
+ }
+ console.log('this.fileData = ' + JSON.stringify(this.fileData));
+ }
+
+ newInvoiceJs() {
+ let url = '/lexconinvoiceview?isNew=yes';
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ }
+
+ saveAttachmentJs() {
+ debugger;
+ this.showLoadingSpinner = true;
+ let cloneData = this.deepClone(this.fileData);
+ for (var i in cloneData) {
+ delete cloneData[i].Id;
+ delete cloneData[i].recordId;
+ delete cloneData[i].url;
+ delete cloneData[i].Title;
+ delete cloneData[i].CreatedByName;
+ delete cloneData[i].CreatedByNameUrl;
+ delete cloneData[i].CreatedDate;
+ delete cloneData[i].typeValue;
+ delete cloneData[i].typeOptions;
+ delete cloneData[i].mailSelectOptsMap;
+ }
+ console.log('cloneData = ' + JSON.stringify(cloneData));
+ saveAttachment({
+ attachmentRecoedsLwc: JSON.stringify(cloneData),
+ invoiceId: this.invoiceId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.showLoadingSpinner = false;
+ this.isShowSpinner = true;
+ // const event = new ShowToastEvent({
+ // title: 'Success',
+ // variant: 'Success',
+ // message: '淇濆瓨鎴愬姛',
+ // });
+ // this.dispatchEvent(event);
+ this.showMyToast('闄勪欢淇濆瓨鎴愬姛', '', 'Success');
+ //this.init();
+ setTimeout(function () {
+ //1绉掑悗鎵ц鍒锋柊
+ window.location.reload();
+ }, 2000); //鍗曚綅鏄绉�
+ // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
+ // console.log('url = ' + url);
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // },
+ // });
+ } else {
+ this.showMyToast('涓婁紶澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ this.showMyToast('閿欒', '涓婁紶澶辫触', 'Error');
+ });
+ }
+
+ invoiceCodeSearchJs() {
+ this.isShowSpinner = true;
+ invoiceCodeSearch({
+ orderDateLwc:
+ this.deliveryFromDate == null
+ ? null
+ : new Date(this.deliveryFromDate),
+ deliverDateLwc:
+ this.deliveryToDate == null
+ ? null
+ : new Date(this.deliveryToDate),
+ invoiceStatusLwc: this.invoiceStatusValue,
+ category1Lwc: this.category1,
+ category2Lwc: this.category2,
+ accountidLwc: this.ConInvoiceListAccountId,
+ userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
+ agencyProTypeLwc: this.ConInvoiceListAgencyProType
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] =
+ '/lexconinvoiceview?invoiceId=' +
+ this.invoiceData[i].Id;
+ }
+ console.log(
+ 'this.invoiceData = ' + JSON.stringify(this.invoiceData)
+ );
+ this.isShowSpinner = false;
+ if (r.entity.raesListSize > 0) {
+ this.showMyToast(
+ '鎼滅储鎴愬姛',
+ '鍏辨绱㈠埌' + r.entity.raesListSize + '涓彂绁�',
+ 'Success'
+ );
+ } else {
+ this.showMyToast(
+ '鎼滅储澶辫触',
+ '娌℃湁鎼滅储鍒扮浉鍏冲彂绁�',
+ 'Error'
+ );
+ }
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ this.showMyToast('閿欒', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ ClearJs() {
+ this.deliveryFromDate = '';
+ this.deliveryToDate = '';
+ this.category1 = '';
+ this.category2 = '';
+ this.invoiceStatusValue = '';
+ this.isShowSpinner = true;
+ conInvoiceListInit()
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('conInvoiceListInit r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] =
+ '/lexconinvoiceview?invoiceId=' +
+ this.invoiceData[i].Id;
+ }
+ console.log(
+ 'this.invoiceData = ' + JSON.stringify(this.invoiceData)
+ );
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+
+ InvoiceorderSearchJs() {
+ this.isShowSpinner = true;
+
+ debugger;
+ let cloneData = this.outboundData;
+ const selectedRows = this.template
+ .querySelector("[data-field='outbound']")
+ .getSelectedRows();
+ console.log('selectedRows ' + JSON.stringify(selectedRows));
+ for (var i in cloneData) {
+ let b = false;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ b = true;
+ cloneData[i].check = true;
+ }
+ }
+ if (!b) {
+ cloneData[i].check = false;
+ }
+ delete cloneData[i].esdOutboundDate;
+ delete cloneData[i].esdNameUrl;
+ delete cloneData[i].esdName;
+ delete cloneData[i].hospitalName;
+ delete cloneData[i].shipmentAmount;
+ delete cloneData[i].returnAmount;
+ delete cloneData[i].uninvoicedAmount;
+ delete cloneData[i].invoiceFaceAmount;
+ delete cloneData[i].invoiceFaceAmountUrl;
+ }
+
+ console.log('this.coc = ' + JSON.stringify(this.coc));
+ console.log('this.invoiceId = ' + this.invoiceId);
+ console.log('this.accountid = ' + this.accountid);
+ console.log('this.userWorkLocation = ' + this.userWorkLocation);
+ console.log('this.agencyProType = ' + this.agencyProType);
+ console.log('this.HospitalInfo = ' + this.HospitalInfo);
+ console.log('SecondDealer = ' + this.secondaryDistributor);
+ console.log('invoiceOrderRecoedsLwc = ' + JSON.stringify(cloneData));
+
+ InvoiceorderSearch({
+ cocLwc: this.coc,
+ invoiceIdLwc: this.invoiceId,
+ accountidLwc: this.accountid,
+ userWorkLocationLwc: this.userWorkLocation,
+ agencyProTypeLwc: this.agencyProType,
+ HospitalInfoLwc: this.HospitalInfo,
+ SecondDealerLwc: this.secondaryDistributor,
+ invoiceOrderRecoedsLwc: JSON.stringify(cloneData)
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.outboundData = r.entity.invoiceOrderRecoeds;
+ console.log(
+ 'this.outboundData = ' +
+ JSON.stringify(this.outboundData)
+ );
+ let index = 0;
+ this.selectedRows = [];
+ for (var i in this.outboundData) {
+ if (this.outboundData[i].check)
+ this.selectedRows.push(this.outboundData[i].esd.Id);
+ this.outboundData[i].Id = this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdOutboundDate'] =
+ this.outboundData[i].esd.Outbound_Date__c;
+ this.outboundData[i]['esdNameUrl'] =
+ '/s/lexsummonscreat?ESetid=' +
+ this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdName'] =
+ this.outboundData[i].esd.Name;
+ if (this.EditAble) {
+ this.outboundData[i]['hospitalName'] =
+ this.outboundData[i].esd.ShipmentAccount__c;
+ this.outboundData[i]['shipmentAmount'] =
+ this.outboundData[
+ i
+ ].esd.Shipment_total_amount__c;
+ this.outboundData[i]['returnAmount'] =
+ this.outboundData[
+ i
+ ].esd.RrturnPro_total_amount__c;
+ }
+ this.outboundData[i]['uninvoicedAmount'] =
+ this.outboundData[i].esd.InvoiceNotPro_money__c;
+ this.outboundData[i]['invoiceFaceAmount'] =
+ this.outboundData[i].needInvoiceCount;
+ if (
+ !(
+ this.outboundData[i].esd.Billed_Status__c ==
+ '鍏ㄩ儴寮�绁�' ||
+ this.EditAble ||
+ this.coc.Invoice_status__c != '鑽夋涓�'
+ )
+ ) {
+ //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
+ let url =
+ '/s/lexconinvoiceview?orderId=' +
+ this.outboundData[i].esd.Id +
+ '&invoiceId=' +
+ this.invoiceId;
+ this.outboundData[i]['invoiceFaceAmountUrl'] = url;
+
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ type: 'url',
+ fieldName: 'invoiceFaceAmountUrl',
+ typeAttributes: {
+ label: {
+ fieldName: 'invoiceFaceAmount'
+ },
+ target: '_blank'
+ },
+ hideDefaultActions: true
+ };
+ this.outboundColumns.push(object5);
+ index++;
+ }
+ } else {
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ fieldName: 'invoiceFaceAmount',
+ hideDefaultActions: true
+ };
+ this.outboundColumns.push(object5);
+ index++;
+ }
+ }
+ //璁$畻鍙戠エ绁ㄩ潰閲戦
+ this.sumPrice += this.outboundData[i].needInvoiceCount;
+ }
+ console.log(
+ 'this.selectedRows = ' +
+ JSON.stringify(this.selectedRows)
+ );
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ this.showMyToast('閿欒', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ getSelectedRows(event) {
+ // console.log("getSelectedRows ");
+ // for (var i in this.outboundData) {
+ // this.outboundData[i].check = false;
+ // }
+ // const selectedRows = event.detail.selectedRows;
+ // for (var i in this.outboundData) {
+ // for (var j in selectedRows) {
+ // if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
+ // //this.outboundData[i].check = !this.outboundData[i].check;
+ // this.outboundData[i].check = true;
+ // }
+ // }
+ // }
+ // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
+ }
+
+ deleteButtonJs() {
+ this.isShowSpinner = true;
+ deleteButton({
+ cocLwc: this.coc,
+ invoiceIdLwc: this.invoiceId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.isShowSpinner = false;
+ let url = '/lexconinvoiceview';
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ } else {
+ this.showMyToast('鍒犻櫎澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ });
+ }
+
+ SetEditAbleJs() {
+ let statusEditAbleJs = 'Redirect';
+ let url =
+ '/lexconinvoiceview?invoiceId=' +
+ this.invoiceId +
+ '&KeyWords=' +
+ statusEditAbleJs;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ }
+
+ approvalJs() {
+ this.isShowSpinner = true;
+ approval({
+ outOrderStringListLwc: this.outOrderStringListLwc,
+ outordercountMapLwc: this.outordercountMapLwc,
+ invoiceIdLwc: this.invoiceId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.isShowSpinner = false;
+ let url =
+ '/s/lexconinvoiceview?invoiceId=' + this.invoiceId;
+ console.log('url = ' + url);
+ window.open(url, '_self');
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // },
+ // });
+ } else {
+ this.showMyToast('閿欒', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ });
+ }
+
+ openReportJs() {
+ console.log('openReportJs');
+ let reportUrl = this.label.LexConInvoiceViewReport;
+ let reportFilters =
+ '[{"operator":"equals","value":"' +
+ this.OrderCode +
+ '","column":"FK_NAME"}]';
+ console.log('reportUrl = ' + reportUrl);
+ let url =
+ '/s/report/' +
+ reportUrl +
+ '?reportFilters=' +
+ encodeURIComponent(reportFilters);
+ window.open(url);
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // target: '_blank'
+ // },
+ // });
+ }
+
+ reopenJs() {
+ // statusEdit = 'Redirect';
+ // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
+ let statusEditAbleJs = 'Redirect';
+ let url =
+ '/lexconinvoiceview?invoiceId=' +
+ this.invoiceId +
+ '&reopen=isreopen' +
+ '&KeyWords=' +
+ statusEditAbleJs;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ this.showLoadingSpinner = false;
+ this.showPopSpinner = false;
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content =
+ '<h2><strong>' +
+ title +
+ '<strong/></h2><h5>' +
+ message +
+ '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template
+ .querySelector('c-common-toast')
+ .showToast(variant, content, iconName, 10000);
+ }
+
+ handleLoad() {
+ console.log('handleLoad');
+ try {
+ const style = document.createElement('style');
+ style.innerText =
+ '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+
+ const style2 = document.createElement('style');
+ style2.innerText =
+ '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+
+ const style3 = document.createElement('style');
+ style3.innerText =
+ '.readOnly .slds-form-element__label {padding-top: 7px;}';
+ this.template.querySelector('.hideHelpText').appendChild(style3);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ keepTwoDecimalStr(num) {
+ const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+ let s = result.toString();
+ let rs = s.indexOf('.');
+ if (rs < 0) {
+ rs = s.length;
+ s += '.';
+ }
+ while (s.length <= rs + 2) {
+ s += '0';
+ }
+ return s;
+ }
+
+ handleLoad2() {
+ console.log('handleLoad2');
+ try {
+ const style = document.createElement('style');
+ style.innerText =
+ '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+
+ const style2 = document.createElement('style');
+ style2.innerText =
+ '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ handleUnitChange(event) {
+ console.log('handleUnitChange');
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
+ const unitDetail = event.detail;
+ console.log('unitDetail = ' + JSON.stringify(unitDetail));
+ for (var i in this.detailsData) {
+ if (this.detailsData[i].recordId == unitDetail.data.recordId) {
+ this.detailsData[i].unitValue = unitDetail.data.unitValue;
+ this.detailsData[i].esd.Invoice_Unit__c =
+ unitDetail.data.unitValue;
+ if (
+ this.detailsSelectedRows.indexOf(
+ this.detailsData[i].recordId
+ ) == -1
+ )
+ this.detailsSelectedRows.push(this.detailsData[i].recordId);
+ }
+ }
+ this.detailsSelectedRows = [...this.detailsSelectedRows];
+
+ console.log(
+ 'this.detailsSelectedRows = ' +
+ JSON.stringify(this.detailsSelectedRows)
+ );
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.0;
+ for (var j in this.detailsSelectedRows) {
+ console.log(
+ 'this.detailsData[i].Id = ' + this.detailsData[i].Id
+ );
+ console.log(
+ 'this.detailsSelectedRows[j] = ' +
+ this.detailsSelectedRows[j]
+ );
+ if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
+ this.detailsData[i].invoiceAllprice = this.amend(
+ this.detailsData[i].shipmentNumber,
+ this.detailsData[i].esdInvoiceUnitprice,
+ '*'
+ );
+ console.log(
+ 'this.detailsData[i].invoiceAllprice = ' +
+ this.detailsData[i].invoiceAllprice
+ );
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
+ this.invoiceAllpriceData[0].invoiceAllprice,
+ this.detailsData[i].invoiceAllprice,
+ '+'
);
- } else {
- this.showMyToast("鎼滅储澶辫触", "娌℃湁鎼滅储鍒扮浉鍏冲彂绁�", "Error");
- }
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
}
- })
- .catch((error) => {
- console.log("error = " + error.message);
- this.showMyToast("閿欒", "鎼滅储澶辫触", "Error");
- });
- }
-
- ClearJs() {
- this.deliveryFromDate = "";
- this.deliveryToDate = "";
- this.category1 = "";
- this.category2 = "";
- this.invoiceStatusValue = "";
- this.isShowSpinner = true;
- conInvoiceListInit()
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("conInvoiceListInit r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.invoiceData = r.entity.raesList;
- for (var i in this.invoiceData) {
- this.invoiceData[i]["NameUrl"] =
- "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
- }
- console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
- this.isShowSpinner = false;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
-
- InvoiceorderSearchJs() {
- this.isShowSpinner = true;
-
- debugger;
- let cloneData = this.outboundData;
- const selectedRows = this.template
- .querySelector("[data-field='outbound']")
- .getSelectedRows();
- console.log("selectedRows " + JSON.stringify(selectedRows));
- for (var i in cloneData) {
- let b = false;
- for (var j in selectedRows) {
- if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
- b = true;
- cloneData[i].check = true;
- }
- }
- if (!b) {
- cloneData[i].check = false;
- }
- delete cloneData[i].esdOutboundDate;
- delete cloneData[i].esdNameUrl;
- delete cloneData[i].esdName;
- delete cloneData[i].hospitalName;
- delete cloneData[i].shipmentAmount;
- delete cloneData[i].returnAmount;
- delete cloneData[i].uninvoicedAmount;
- delete cloneData[i].invoiceFaceAmount;
- delete cloneData[i].invoiceFaceAmountUrl;
+ this.detailsData = [...this.detailsData];
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
}
- console.log("this.coc = " + JSON.stringify(this.coc));
- console.log("this.invoiceId = " + this.invoiceId);
- console.log("this.accountid = " + this.accountid);
- console.log("this.userWorkLocation = " + this.userWorkLocation);
- console.log("this.agencyProType = " + this.agencyProType);
- console.log("this.HospitalInfo = " + this.HospitalInfo);
- console.log("SecondDealer = " + this.secondaryDistributor);
- console.log("invoiceOrderRecoedsLwc = " + JSON.stringify(cloneData));
-
- InvoiceorderSearch({
- cocLwc: this.coc,
- invoiceIdLwc: this.invoiceId,
- accountidLwc: this.accountid,
- userWorkLocationLwc: this.userWorkLocation,
- agencyProTypeLwc: this.agencyProType,
- HospitalInfoLwc: this.HospitalInfo,
- SecondDealerLwc: this.secondaryDistributor,
- invoiceOrderRecoedsLwc: JSON.stringify(cloneData)
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.outboundData = r.entity.invoiceOrderRecoeds;
- console.log(
- "this.outboundData = " + JSON.stringify(this.outboundData)
- );
- let index = 0;
- this.selectedRows = [];
- for (var i in this.outboundData) {
- if (this.outboundData[i].check)
- this.selectedRows.push(this.outboundData[i].esd.Id);
- this.outboundData[i].Id = this.outboundData[i].esd.Id;
- this.outboundData[i]["esdOutboundDate"] =
- this.outboundData[i].esd.Outbound_Date__c;
- this.outboundData[i]["esdNameUrl"] =
- "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id;
- this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name;
- if (this.EditAble) {
- this.outboundData[i]["hospitalName"] =
- this.outboundData[i].esd.ShipmentAccount__c;
- this.outboundData[i]["shipmentAmount"] =
- this.outboundData[i].esd.Shipment_total_amount__c;
- this.outboundData[i]["returnAmount"] =
- this.outboundData[i].esd.RrturnPro_total_amount__c;
- }
- this.outboundData[i]["uninvoicedAmount"] =
- this.outboundData[i].esd.InvoiceNotPro_money__c;
- this.outboundData[i]["invoiceFaceAmount"] =
- this.outboundData[i].needInvoiceCount;
+ handleShipmentNumber(event) {
+ console.log('handleShipmentNumber');
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
+ const numberDetail = event.detail;
+ console.log('numberDetail = ' + JSON.stringify(numberDetail));
+ if (numberDetail.data.shipmentnumber == 0) {
if (
- !(
- this.outboundData[i].esd.Billed_Status__c == "鍏ㄩ儴寮�绁�" ||
- this.EditAble ||
- this.coc.Invoice_status__c != "鑽夋涓�"
- )
+ this.detailsSelectedRows.indexOf(numberDetail.data.recordId) !=
+ -1
) {
- //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.detailsSelectedRows.splice(
+ this.detailsSelectedRows.indexOf(
+ numberDetail.data.recordId
+ ),
+ 1
+ );
}
- //璁$畻鍙戠エ绁ㄩ潰閲戦
- this.sumPrice += this.outboundData[i].needInvoiceCount;
- }
- console.log(
- "this.selectedRows = " + JSON.stringify(this.selectedRows)
- );
- this.isShowSpinner = false;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
}
- })
- .catch((error) => {
- console.log("error = " + error.message);
- this.showMyToast("閿欒", "鎼滅储澶辫触", "Error");
- });
- }
-
- getSelectedRows(event) {
- // console.log("getSelectedRows ");
- // for (var i in this.outboundData) {
- // this.outboundData[i].check = false;
- // }
- // const selectedRows = event.detail.selectedRows;
- // for (var i in this.outboundData) {
- // for (var j in selectedRows) {
- // if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
- // //this.outboundData[i].check = !this.outboundData[i].check;
- // this.outboundData[i].check = true;
- // }
- // }
- // }
- // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
- }
-
- deleteButtonJs() {
- this.isShowSpinner = true;
- deleteButton({
- cocLwc: this.coc,
- invoiceIdLwc: this.invoiceId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.isShowSpinner = false;
- let url = "/lexconinvoiceview";
- console.log("url = " + url);
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
- }
- });
- } else {
- this.showMyToast("鍒犻櫎澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + error.message);
- });
- }
-
- SetEditAbleJs() {
- let statusEditAbleJs = "Redirect";
- let url =
- "/lexconinvoiceview?invoiceId=" +
- this.invoiceId +
- "&KeyWords=" +
- statusEditAbleJs;
- console.log("url = " + url);
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
- }
- });
- }
-
- approvalJs() {
- this.isShowSpinner = true;
- approval({
- outOrderStringListLwc: this.outOrderStringListLwc,
- outordercountMapLwc: this.outordercountMapLwc,
- invoiceIdLwc: this.invoiceId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.isShowSpinner = false;
- let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId;
- console.log("url = " + url);
- window.open(url, "_self");
- // this[NavigationMixin.Navigate]({
- // type: "standard__webPage",
- // attributes: {
- // url: url,
- // },
- // });
- } else {
- this.showMyToast("閿欒", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + error.message);
- });
- }
-
- openReportJs() {
- console.log("openReportJs");
- let reportUrl = this.label.LexConInvoiceViewReport;
- let reportFilters =
- '[{"operator":"equals","value":"' +
- this.OrderCode +
- '","column":"FK_NAME"}]';
- console.log("reportUrl = " + reportUrl);
- let url =
- "/s/report/" +
- reportUrl +
- "?reportFilters=" +
- encodeURIComponent(reportFilters);
- window.open(url);
- // this[NavigationMixin.Navigate]({
- // type: "standard__webPage",
- // attributes: {
- // url: url,
- // target: '_blank'
- // },
- // });
- }
-
- reopenJs() {
- // statusEdit = 'Redirect';
- // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
- let statusEditAbleJs = "Redirect";
- let url =
- "/lexconinvoiceview?invoiceId=" +
- this.invoiceId +
- "&reopen=isreopen" +
- "&KeyWords=" +
- statusEditAbleJs;
- console.log("url = " + url);
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
- }
- });
- }
-
- showMyToast(title, message, variant) {
- this.isShowSpinner = false;
- this.showLoadingSpinner = false;
- this.showPopSpinner = false;
- this.showAttPop = false;
- this.filesUploaded = [];
- this.fileName = null;
- console.log("show custom message");
- var iconName = "";
- var content = "";
- if (variant.toLowerCase() == "success") {
- iconName = "utility:check";
- } else {
- iconName = "utility:error";
- }
- if (message != "") {
- content =
- "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
- } else {
- content = "<h2><strong>" + title + "<strong/></h2>";
- }
- this.template
- .querySelector("c-common-toast")
- .showToast(variant, content, iconName, 10000);
- }
-
- handleLoad() {
- console.log("handleLoad");
- try {
- const style = document.createElement("style");
- style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}";
- this.template.querySelector(".hideHelpText").appendChild(style);
-
- const style2 = document.createElement("style");
- style2.innerText =
- ".hehe-layoutItem .slds-form-element__label {padding : 0px}";
- this.template.querySelector(".hideHelpText").appendChild(style2);
-
- const style3 = document.createElement("style");
- style3.innerText =
- ".readOnly .slds-form-element__label {padding-top: 7px;}";
- this.template.querySelector(".hideHelpText").appendChild(style3);
- } catch (error) {
- console.log(error);
- }
- }
-
- keepTwoDecimalStr(num) {
- const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
- let s = result.toString();
- let rs = s.indexOf(".");
- if (rs < 0) {
- rs = s.length;
- s += ".";
- }
- while (s.length <= rs + 2) {
- s += "0";
- }
- return s;
- }
-
- handleLoad2() {
- console.log("handleLoad2");
- try {
- const style = document.createElement("style");
- style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}";
- this.template.querySelector(".hideHelpText").appendChild(style);
-
- const style2 = document.createElement("style");
- style2.innerText =
- ".hehe-layoutItem .slds-form-element__label {padding : 0px}";
- this.template.querySelector(".hideHelpText").appendChild(style2);
- } catch (error) {
- console.log(error);
- }
- }
-
- handleUnitChange(event) {
- console.log("handleUnitChange");
- this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
- const unitDetail = event.detail;
- console.log("unitDetail = " + JSON.stringify(unitDetail));
- for (var i in this.detailsData) {
- if (this.detailsData[i].recordId == unitDetail.data.recordId) {
- this.detailsData[i].unitValue = unitDetail.data.unitValue;
- this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue;
- if (
- this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1
- )
- this.detailsSelectedRows.push(this.detailsData[i].recordId);
- }
- }
- this.detailsSelectedRows = [...this.detailsSelectedRows];
-
- console.log(
- "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows)
- );
- for (var i in this.detailsData) {
- this.detailsData[i].invoiceAllprice = 0.0;
- for (var j in this.detailsSelectedRows) {
- console.log("this.detailsData[i].Id = " + this.detailsData[i].Id);
console.log(
- "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j]
+ 'start this.detailsSelectedRows = ' +
+ JSON.stringify(this.detailsSelectedRows)
);
- if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
- this.detailsData[i].invoiceAllprice = this.amend(
- this.detailsData[i].shipmentNumber,
- this.detailsData[i].esdInvoiceUnitprice,
- "*"
- );
- console.log(
- "this.detailsData[i].invoiceAllprice = " +
- this.detailsData[i].invoiceAllprice
- );
- }
- }
- this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
- this.invoiceAllpriceData[0].invoiceAllprice,
- this.detailsData[i].invoiceAllprice,
- "+"
- );
- }
- this.detailsData = [...this.detailsData];
- this.invoiceAllpriceData = [...this.invoiceAllpriceData];
- }
-
- handleShipmentNumber(event) {
- console.log("handleShipmentNumber");
- this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
- const numberDetail = event.detail;
- console.log("numberDetail = " + JSON.stringify(numberDetail));
- if (numberDetail.data.shipmentnumber == 0) {
- if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) {
- this.detailsSelectedRows.splice(
- this.detailsSelectedRows.indexOf(numberDetail.data.recordId),
- 1
- );
- }
- }
- console.log(
- "start this.detailsSelectedRows = " +
- JSON.stringify(this.detailsSelectedRows)
- );
- console.log("numberDetail = " + JSON.stringify(numberDetail));
- for (var i in this.detailsData) {
- if (this.detailsData[i].recordId == numberDetail.data.recordId) {
- this.detailsData[i].shipmentNumber = Number(
- numberDetail.data.shipmentnumber
- );
- this.detailsData[i].invoiceCount = Number(
- numberDetail.data.shipmentnumber
- );
- if (
- this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) ==
- -1 &&
- numberDetail.data.shipmentnumber != 0
- )
- this.detailsSelectedRows.push(this.detailsData[i].recordId);
- }
- }
-
- console.log(
- "end this.detailsSelectedRows = " +
- JSON.stringify(this.detailsSelectedRows)
- );
- this.detailsSelectedRows = [...this.detailsSelectedRows];
-
- console.log(
- "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows)
- );
- for (var i in this.detailsData) {
- this.detailsData[i].invoiceAllprice = 0.0;
- for (var j in this.detailsSelectedRows) {
- console.log("this.detailsData[i].Id = " + this.detailsData[i].Id);
- console.log(
- "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j]
- );
- if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
- this.detailsData[i].invoiceAllprice = this.amend(
- this.detailsData[i].shipmentNumber,
- this.detailsData[i].esdInvoiceUnitprice,
- "*"
- );
- console.log(
- "this.detailsData[i].invoiceAllprice = " +
- this.detailsData[i].invoiceAllprice
- );
- }
- }
- this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
- this.invoiceAllpriceData[0].invoiceAllprice,
- this.detailsData[i].invoiceAllprice,
- "+"
- );
- }
- this.detailsData = [...this.detailsData];
- this.invoiceAllpriceData = [...this.invoiceAllpriceData];
- }
-
- detailsGetSelectedRows(event) {
- console.log("detailsGetSelectedRows ");
- this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
- let selectedRows = event.detail.selectedRows;
- for (var i in this.detailsData) {
- this.detailsData[i].invoiceAllprice = 0.0;
- for (var j in selectedRows) {
- if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
- this.detailsData[i].invoiceAllprice = this.amend(
- this.detailsData[i].shipmentNumber,
- this.detailsData[i].esdInvoiceUnitprice,
- "*"
- );
- console.log(
- "this.detailsData[i].invoiceAllprice = " +
- this.detailsData[i].invoiceAllprice
- );
- }
- }
- this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
- this.invoiceAllpriceData[0].invoiceAllprice,
- this.detailsData[i].invoiceAllprice,
- "+"
- );
- console.log(
- "this.invoiceAllpriceData[0].invoiceAllprice = " +
- this.invoiceAllpriceData[0].invoiceAllprice
- );
- }
- console.log("start this.detailsData = " + JSON.stringify(this.detailsData));
- this.detailsData = [...this.detailsData];
- console.log("end this.detailsData = " + JSON.stringify(this.detailsData));
- this.invoiceAllpriceData = [...this.invoiceAllpriceData];
- }
-
- ComputePrice(index, number, price) {
- console.log("index = " + index);
- console.log("number = " + number);
- console.log("price = " + price);
- let shipmentAmount = this.amend(number, price, "*");
- console.log("shipmentAmount = " + shipmentAmount);
- let sumPrice = 0.0;
- this.data[index].shipmentAmount = shipmentAmount;
- for (var i in this.data) {
- if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
- }
- this.sumPrice = sumPrice + "鍏�";
- //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
- if (this.selectedRows.indexOf(this.data[index].Id) == -1)
- this.selectedRows.push(this.data[index].Id);
- this.data = [...this.data];
- this.selectedRows = [...this.selectedRows];
- console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
- console.log("this.data = " + JSON.stringify(this.data));
- }
-
- deepClone(obj) {
- return JSON.parse(JSON.stringify(obj));
- }
-
- detailsSaveJs() {
- this.isShowSpinner = true;
- let cloneData = this.deepClone(this.detailsData);
-
- let selectedRows = this.template
- .querySelector("c-lex-custom-lightning-datatable")
- .getSelectedRows();
- console.log("selectedRows = " + JSON.stringify(selectedRows));
-
- for (var i in cloneData) {
- delete cloneData[i].Id;
- delete cloneData[i].esdAssetModelNo;
- delete cloneData[i].packingListManual;
- delete cloneData[i].esdDeliveryListRMB;
- delete cloneData[i].esdShipmentCount;
- delete cloneData[i].esdRrturnProCount;
- delete cloneData[i].esdBoxPiece;
- delete cloneData[i].esdInvoicedProcount;
- delete cloneData[i].esdInvoiceProNotCount;
- delete cloneData[i].unitValue;
- delete cloneData[i].recordId;
- delete cloneData[i].unitOptions;
- delete cloneData[i].esdInvoiceUnitprice;
- delete cloneData[i].shipmentNumber;
- delete cloneData[i].invoiceAllprice;
- for (var j in selectedRows) {
- if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
- cloneData[i]["check"] = true;
- }
- }
- }
- console.log("cloneData = " + JSON.stringify(cloneData));
-
- detailsSave({
- consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
- invoiceIdLwc: this.invoiceId,
- orderIdLwc: this.orderId
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: url
+ console.log('numberDetail = ' + JSON.stringify(numberDetail));
+ for (var i in this.detailsData) {
+ if (this.detailsData[i].recordId == numberDetail.data.recordId) {
+ this.detailsData[i].shipmentNumber = Number(
+ numberDetail.data.shipmentnumber
+ );
+ this.detailsData[i].invoiceCount = Number(
+ numberDetail.data.shipmentnumber
+ );
+ if (
+ this.detailsSelectedRows.indexOf(
+ this.detailsData[i].recordId
+ ) == -1 &&
+ numberDetail.data.shipmentnumber != 0
+ )
+ this.detailsSelectedRows.push(this.detailsData[i].recordId);
}
- });
- } else {
- this.showMyToast("淇濆瓨澶辫触", r.msg, "Error");
}
- })
- .catch((error) => {
- console.log("error = " + error.message);
- });
- }
- //num1 num2浼犲叆涓や釜鍊� symbol +-*/绗﹀彿
- amend(num1, num2, symbol) {
- var str1 = num1.toString(),
- str2 = num2.toString(),
- result,
- str1Length,
- str2Length;
- //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
- try {
- str1Length = str1.split(".")[1].length;
- } catch (error) {
- str1Length = 0;
- }
- try {
- str2Length = str2.split(".")[1].length;
- } catch (error) {
- str2Length = 0;
- }
- var step = Math.pow(10, Math.max(str1Length, str2Length));
- switch (symbol) {
- case "+":
- result = (num1 * step + num2 * step) / step;
- break;
- case "-":
- result = (num1 * step - num2 * step) / step;
- break;
- case "*":
- result = (num1 * step * (num2 * step)) / step / step;
- break;
- case "/":
- result = (num1 * step) / (num2 * step);
- break;
- default:
- break;
- }
- return result;
- }
+ console.log(
+ 'end this.detailsSelectedRows = ' +
+ JSON.stringify(this.detailsSelectedRows)
+ );
+ this.detailsSelectedRows = [...this.detailsSelectedRows];
- //鍒犻櫎闄勪欢
- deleteAtt(event) {
- this.isShowSpinner = true;
- //var recordId = event.detail.data.recordId;
- var recordId = event.target.getAttribute("data-fileid");
- console.log("attid:" + recordId);
- deleteAtt({
- contentVersionId: recordId
- })
- .then((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");
+ console.log(
+ 'this.detailsSelectedRows = ' +
+ JSON.stringify(this.detailsSelectedRows)
+ );
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.0;
+ for (var j in this.detailsSelectedRows) {
+ console.log(
+ 'this.detailsData[i].Id = ' + this.detailsData[i].Id
+ );
+ console.log(
+ 'this.detailsSelectedRows[j] = ' +
+ this.detailsSelectedRows[j]
+ );
+ if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
+ this.detailsData[i].invoiceAllprice = this.amend(
+ this.detailsData[i].shipmentNumber,
+ this.detailsData[i].esdInvoiceUnitprice,
+ '*'
+ );
+ console.log(
+ 'this.detailsData[i].invoiceAllprice = ' +
+ this.detailsData[i].invoiceAllprice
+ );
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
+ this.invoiceAllpriceData[0].invoiceAllprice,
+ this.detailsData[i].invoiceAllprice,
+ '+'
+ );
}
- })
- .catch((error) => {
- this.showMyToast("閿欒", error.message, "Error");
- });
- }
-}
+ this.detailsData = [...this.detailsData];
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
+ }
+
+ detailsGetSelectedRows(event) {
+ console.log('detailsGetSelectedRows ');
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
+ let selectedRows = event.detail.selectedRows;
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.0;
+ for (var j in selectedRows) {
+ if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
+ this.detailsData[i].invoiceAllprice = this.amend(
+ this.detailsData[i].shipmentNumber,
+ this.detailsData[i].esdInvoiceUnitprice,
+ '*'
+ );
+ console.log(
+ 'this.detailsData[i].invoiceAllprice = ' +
+ this.detailsData[i].invoiceAllprice
+ );
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
+ this.invoiceAllpriceData[0].invoiceAllprice,
+ this.detailsData[i].invoiceAllprice,
+ '+'
+ );
+ console.log(
+ 'this.invoiceAllpriceData[0].invoiceAllprice = ' +
+ this.invoiceAllpriceData[0].invoiceAllprice
+ );
+ }
+ console.log(
+ 'start this.detailsData = ' + JSON.stringify(this.detailsData)
+ );
+ this.detailsData = [...this.detailsData];
+ console.log(
+ 'end this.detailsData = ' + JSON.stringify(this.detailsData)
+ );
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
+ }
+
+ ComputePrice(index, number, price) {
+ console.log('index = ' + index);
+ console.log('number = ' + number);
+ console.log('price = ' + price);
+ let shipmentAmount = this.amend(number, price, '*');
+ console.log('shipmentAmount = ' + shipmentAmount);
+ let sumPrice = 0.0;
+ this.data[index].shipmentAmount = shipmentAmount;
+ for (var i in this.data) {
+ if (this.data[i].shipmentAmount)
+ sumPrice += this.data[i].shipmentAmount;
+ }
+ this.sumPrice = sumPrice + '鍏�';
+ //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
+ if (this.selectedRows.indexOf(this.data[index].Id) == -1)
+ this.selectedRows.push(this.data[index].Id);
+ this.data = [...this.data];
+ this.selectedRows = [...this.selectedRows];
+ console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows));
+ console.log('this.data = ' + JSON.stringify(this.data));
+ }
+
+ deepClone(obj) {
+ return JSON.parse(JSON.stringify(obj));
+ }
+
+ detailsSaveJs() {
+ this.isShowSpinner = true;
+ let cloneData = this.deepClone(this.detailsData);
+
+ let selectedRows = this.template
+ .querySelector('c-lex-custom-lightning-datatable')
+ .getSelectedRows();
+ console.log('selectedRows = ' + JSON.stringify(selectedRows));
+
+ for (var i in cloneData) {
+ delete cloneData[i].Id;
+ delete cloneData[i].esdAssetModelNo;
+ delete cloneData[i].packingListManual;
+ delete cloneData[i].esdDeliveryListRMB;
+ delete cloneData[i].esdShipmentCount;
+ delete cloneData[i].esdRrturnProCount;
+ delete cloneData[i].esdBoxPiece;
+ delete cloneData[i].esdInvoicedProcount;
+ delete cloneData[i].esdInvoiceProNotCount;
+ delete cloneData[i].unitValue;
+ delete cloneData[i].recordId;
+ delete cloneData[i].unitOptions;
+ delete cloneData[i].esdInvoiceUnitprice;
+ delete cloneData[i].shipmentNumber;
+ delete cloneData[i].invoiceAllprice;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ cloneData[i]['check'] = true;
+ }
+ }
+ }
+ console.log('cloneData = ' + JSON.stringify(cloneData));
+
+ detailsSave({
+ consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
+ invoiceIdLwc: this.invoiceId,
+ orderIdLwc: this.orderId
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ let url = '/lexconinvoiceview?invoiceId=' + this.invoiceId;
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ });
+ } else {
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + error.message);
+ });
+ }
+
+ //num1 num2浼犲叆涓や釜鍊� symbol +-*/绗﹀彿
+ amend(num1, num2, symbol) {
+ var str1 = num1.toString(),
+ str2 = num2.toString(),
+ result,
+ str1Length,
+ str2Length;
+ //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
+ try {
+ str1Length = str1.split('.')[1].length;
+ } catch (error) {
+ str1Length = 0;
+ }
+ try {
+ str2Length = str2.split('.')[1].length;
+ } catch (error) {
+ str2Length = 0;
+ }
+ var step = Math.pow(10, Math.max(str1Length, str2Length));
+ switch (symbol) {
+ case '+':
+ result = (num1 * step + num2 * step) / step;
+ break;
+ case '-':
+ result = (num1 * step - num2 * step) / step;
+ break;
+ case '*':
+ result = (num1 * step * (num2 * step)) / step / step;
+ break;
+ case '/':
+ result = (num1 * step) / (num2 * step);
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ //鍒犻櫎闄勪欢
+ deleteAtt(event) {
+ this.isShowSpinner = true;
+ //var recordId = event.detail.data.recordId;
+ var recordId = event.target.getAttribute('data-fileid');
+ console.log('attid:' + recordId);
+ deleteAtt({
+ contentVersionId: recordId
+ })
+ .then((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');
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.html b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
index 0b6d4b0..9ecb2d7 100644
--- a/force-app/main/default/lwc/lexConsumable/lexConsumable.html
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
@@ -681,6 +681,7 @@
onfirst={goFirstPage}
onlast={goLastPage}
page-size-options={pageSizeOptions}
+ default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled}
record-start={recordStart}
@@ -707,6 +708,7 @@
onfirst={goFirstPage}
onlast={goLastPage}
page-size-options={pageSizeOptions}
+ default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled}
record-start={recordStart}
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
index 4091a4a..5a006be 100644
--- a/force-app/main/default/lwc/lexConsumable/lexConsumable.js
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -85,9 +85,9 @@
@track sortedBy;
//鍒嗛〉
@track currentPage = 1;
- @track pageSize = 10;
+ @track pageSize = 200;
// @track totalPage = 0;
- @track pageSizeOptions = [10, 25, 50, 100];
+ @track pageSizeOptions = [100, 200,300];
@track recordStart = 0;
@track recordEnd = 0;
//鎶ラ敊鎻愰啋
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
index a55dcb4..61fd499 100644
--- a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
@@ -155,6 +155,7 @@
onfirst={handleFirst}
onlast={handleLast}
page-size-options={pageSizeOptions}
+ default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled}
record-start={recordStart}
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
index a73cdb4..270892f 100644
--- a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
@@ -228,7 +228,7 @@
//鍒嗛〉start
@track sortBy = '';
- @track pageSize = 10;
+ @track pageSize = 200;
error;
records;
currentPageToken = 0;
@@ -238,7 +238,7 @@
@track pageNumber = 1;
@track paginationVisibility = false;
@track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
+ pageSizeOptions = [100, 200, 300];
@track recordStart = 0;
@track recordEnd = 0;
//end
diff --git a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
index 4192b57..4407559 100644
--- a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
+++ b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
@@ -1,49 +1,20 @@
<template>
- <template if:true={showNormal}>
- <div
- style="
- margin-left: 10px;
- margin-right: 10px;
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 14px;
- text-align: right;
- padding-right: 10px;
- "
- >
- <lightning-formatted-number value={value}></lightning-formatted-number>
- </div>
- </template>
- <template if:true={showRed}>
- <div
- style="
- margin-left: 10px;
- margin-right: 10px;
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 14px;
- background-color: red;
- text-align: right;
- padding-right: 10px;
- "
- >
- <lightning-formatted-number value={value}></lightning-formatted-number>
- </div>
- </template>
- <template if:true={showYellow}>
- <div
- style="
- margin-left: 10px;
- margin-right: 10px;
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 14px;
- background-color: yellow;
- text-align: right;
- padding-right: 10px;
- "
- >
- <lightning-formatted-number value={value}></lightning-formatted-number>
- </div>
- </template>
-</template>
+ <template if:true={showNormal}>
+ <div
+ style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:14px;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+ <template if:true={showRed}>
+ <div
+ style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:14px;background-color:red;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+ <template if:true={showYellow}>
+ <div
+ style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:14px;background-color:yellow;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.html b/force-app/main/default/lwc/lexInventory/lexInventory.html
index 18b0886..2ba1e4e 100644
--- a/force-app/main/default/lwc/lexInventory/lexInventory.html
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.html
@@ -118,7 +118,7 @@
hide-checkbox-column={hidecheckbox} class="wrapped-header-datatable" style="word-wrap:break-word; word-break:break-all; ">
</lightning-datatable>
<c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange}
- onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions}
+ onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions} default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled}
record-start={recordStart} record-end={recordEnd}
total-records={totalRecords}></c-paginator>
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.js b/force-app/main/default/lwc/lexInventory/lexInventory.js
index 9a35fb2..fc96ac2 100644
--- a/force-app/main/default/lwc/lexInventory/lexInventory.js
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.js
@@ -248,7 +248,7 @@
//鍒嗛〉start
@track sortBy = "";
@track sortDirection = "asc";
- @track pageSize = 10;
+ @track pageSize = 200;
error;
records;
currentPageToken = 0;
@@ -258,7 +258,7 @@
@track pageNumber = 1;
@track paginationVisibility = false;
@track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
+ pageSizeOptions = [100, 200, 300];
@track recordStart = 0;
@track recordEnd = 0;
//end
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
index 17867c3..5f770e0 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
@@ -1,20 +1,21 @@
<!-- sldsValidatorIgnore -->
<!-- sldsValidatorIgnore -->
<template>
- <c-common-toast></c-common-toast>
- <div class="outerBorderCss">
- <div style="padding: 5px">
- <div class="borderCss">
- <div style="padding: 15px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <!-- <div class="slds-m-top_small slds-m-bottom_medium"> -->
- <!-- <lightning-button label="鏂板缓鍑哄簱鍗�" onclick={neworderhead}
+ <c-common-toast></c-common-toast>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <div class="borderCss">
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+
+ <!-- <div class="slds-m-top_small slds-m-bottom_medium"> -->
+ <!-- <lightning-button label="鏂板缓鍑哄簱鍗�" onclick={neworderhead}
class="slds-m-left_x-small" disabled></lightning-button>
<lightning-button label="涓婁紶宸插嚭搴撲竴瑙�" onclick={editProductLimit}
class="slds-m-left_x-small"></lightning-button> -->
- 聽
- <!-- <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ 聽
+ <!-- <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
onclick={neworderhead}>
鏂板缓鍑哄簱鍗�
</button>
@@ -25,233 +26,255 @@
涓婁紶宸插嚭搴撲竴瑙�
</button> -->
- <lightning-layout multiple-rows>
- <lightning-layout-item size="6">
- <div class="slds-text-align_center">
- <div class="slds-grid slds-grid_vertical-align-center">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
- onclick={neworderhead}
- >
- 鏂板缓鍑哄簱鍗�
- </button>
- 聽
- <div
- class="slds-form-element__label searchName"
- style="visibility: hidden"
- >
- 鍑哄簱鏃� 浠�
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <div class="slds-text-align_center">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ onclick={neworderhead}
+ >
+ 鏂板缓鍑哄簱鍗�
+ </button>
+ 聽
+ <div
+ class="slds-form-element__label searchName"
+ style="visibility: hidden"
+ >
+ 鍑哄簱鏃� 浠�
+ </div>
+ <div
+ class="slds-form-element__label searchName"
+ style="visibility: hidden"
+ >
+  鍒�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ onclick={editProductLimit}
+ style="margin-left: 4px"
+ >
+ 涓婁紶宸插嚭搴撲竴瑙�
+ </button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- </div> -->
</div>
- <div
- class="slds-form-element__label searchName"
- style="visibility: hidden"
- >
-  鍒�
- </div>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
- onclick={editProductLimit}
- style="margin-left: 4px"
- >
- 涓婁紶宸插嚭搴撲竴瑙�
- </button>
- </div>
</div>
- </lightning-layout-item>
- </lightning-layout>
- <!-- </div> -->
- </div>
- </div>
- </div>
-
- <div class="borderCss">
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>妫�绱㈡潯浠�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- <div style="padding: 15px">
- <div lwc:dom="manual" class="resultDiv"></div>
- <div draggable="false">
- <lightning-layout multiple-rows>
- <lightning-layout-item size="6">
- <div class="slds-text-align_center">
- <lightning-layout multiple-rows>
- <lightning-layout-item size="6">
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label searchName">
- 鍑哄簱鏃� 浠�
- </div>
- <lightning-input
- type="date"
- variant="label-hidden"
- label="鍑哄簱鏃� 浠�"
- onchange={dataChange}
- data-field="deliveryFromDate"
- value={deliveryFromDate}
- class="inputFont"
- style="max-width: 150px"
- ></lightning-input>
- </div>
- </lightning-layout-item>
-
- <lightning-layout-item size="6">
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label searchName">
- 鍒�
- </div>
- <lightning-input
- type="date"
- variant="label-hidden"
- label="鍒�"
- onchange={dataChange}
- data-field="deliveryToDate"
- value={deliveryToDate}
- class="inputFont"
- style="max-width: 150px"
- ></lightning-input>
- </div>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- </lightning-layout-item>
-
- <lightning-layout-item size="3">
- <div class="slds-text-align_center">
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label searchName">
- 鍑哄簱鍗曞彿
- </div>
- <lightning-input
- variant="label-hidden"
- label="鍑哄簱鍗曞彿"
- onchange={dataChange}
- data-field="deliveryOrderNo"
- value={deliveryOrderNo}
- class="inputFont"
- style="max-width: 150px"
- ></lightning-input>
- </div>
- </div>
- </lightning-layout-item>
-
- <lightning-layout-item>
- <div class="slds-text-align_center">
- <div class="slds-grid slds-grid_vertical-align-center">
- <div class="slds-form-element__label searchName">
- 瀹㈡埛鍚�
- </div>
- <lightning-input
- variant="label-hidden"
- label="瀹㈡埛鍚�"
- onchange={dataChange}
- data-field="contactName"
- value={contactName}
- class="inputFont"
- style="max-width: 150px"
- ></lightning-input>
- </div>
- </div>
- </lightning-layout-item>
- </lightning-layout>
-
- <lightning-layout multiple-rows style="margin-top: 20px">
- <lightning-layout-item size="6">
- <lightning-layout multiple-rows>
- <lightning-layout-item size="6">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- onclick={searchConsumableorderdetailsJs}
- style="min-width: 180px"
- >
- 杩樻病鍑哄簱鐨勫嚭搴撳崟
- </button>
- </lightning-layout-item>
-
- <lightning-layout-item size="6">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- onclick={searchOrderInstatusJs}
- style="min-width: 215px"
- >
- 宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
- </button>
- </lightning-layout-item>
- </lightning-layout>
- </lightning-layout-item>
-
- <lightning-layout-item size="3">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
- onclick={searchConsumableorFinishJs}
- style="min-width: 225px"
- >
- 宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
- </button>
- </lightning-layout-item>
-
- <lightning-layout-item>
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
- onclick={clearJs}
- style="width: 206px"
- >
- 娓呯┖
- </button>
- </lightning-layout-item>
- </lightning-layout>
- </div>
- </div>
- </div>
-
- <div class="borderCss">
- <template if:true={isShowSpinner}>
- <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>
- <div class="headerDorderCss">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鍑哄簱鍗曚竴瑙堣〃</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
+
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <div class="slds-text-align_center">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label searchName"
+ >
+ 鍑哄簱鏃� 浠�
+ </div>
+ <lightning-input
+ type="date"
+ variant="label-hidden"
+ label="鍑哄簱鏃� 浠�"
+ onchange={dataChange}
+ data-field="deliveryFromDate"
+ value={deliveryFromDate}
+ class="inputFont"
+ style="max-width: 150px"
+ ></lightning-input>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="6">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label searchName"
+ >
+ 鍒�
+ </div>
+ <lightning-input
+ type="date"
+ variant="label-hidden"
+ label="鍒�"
+ onchange={dataChange}
+ data-field="deliveryToDate"
+ value={deliveryToDate}
+ class="inputFont"
+ style="max-width: 150px"
+ ></lightning-input>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3">
+ <div class="slds-text-align_center">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label searchName"
+ >
+ 鍑哄簱鍗曞彿
+ </div>
+ <lightning-input
+ variant="label-hidden"
+ label="鍑哄簱鍗曞彿"
+ onchange={dataChange}
+ data-field="deliveryOrderNo"
+ value={deliveryOrderNo}
+ class="inputFont"
+ style="max-width: 150px"
+ ></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item>
+ <div class="slds-text-align_center">
+ <div
+ class="slds-grid slds-grid_vertical-align-center"
+ >
+ <div
+ class="slds-form-element__label searchName"
+ >
+ 瀹㈡埛鍚�
+ </div>
+ <lightning-input
+ variant="label-hidden"
+ label="瀹㈡埛鍚�"
+ onchange={dataChange}
+ data-field="contactName"
+ value={contactName}
+ class="inputFont"
+ style="max-width: 150px"
+ ></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout
+ multiple-rows
+ style="margin-top: 20px"
+ >
+ <lightning-layout-item size="6">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchConsumableorderdetailsJs}
+ style="min-width: 180px"
+ >
+ 杩樻病鍑哄簱鐨勫嚭搴撳崟
+ </button>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="6">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchOrderInstatusJs}
+ style="min-width: 215px"
+ >
+ 宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchConsumableorFinishJs}
+ style="min-width: 225px"
+ >
+ 宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ </button>
+ </lightning-layout-item>
+
+ <lightning-layout-item>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ onclick={clearJs}
+ style="width: 206px"
+ >
+ 娓呯┖
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <template if:true={isShowSpinner}>
+ <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>
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚竴瑙堣〃</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <template if:true={showTable}>
+ <div style="padding: 7px; height: 500px">
+ <lightning-datatable
+ key-field="id"
+ data={data}
+ columns={columns}
+ hide-checkbox-column
+ default-sort-direction={defaultSortDirection}
+ sorted-direction={sortDirection}
+ sorted-by={sortedBy}
+ onsort={onHandleSort}
+ class="wrapped-header-datatable"
+ >
+ </lightning-datatable>
+ </div>
+ </template>
+ </div>
</div>
- <template if:true={showTable}>
- <div style="padding: 7px; height: 500px">
- <lightning-datatable
- key-field="id"
- data={data}
- columns={columns}
- hide-checkbox-column
- default-sort-direction={defaultSortDirection}
- sorted-direction={sortDirection}
- sorted-by={sortedBy}
- onsort={onHandleSort}
- class="wrapped-header-datatable"
- >
- </lightning-datatable>
- </div>
- </template>
- </div>
</div>
- </div>
-</template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
index 61b3805..d630908 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -1,429 +1,441 @@
-import { LightningElement, wire, api, track } from "lwc";
-import { NavigationMixin } from "lightning/navigation";
-import init from "@salesforce/apex/LexSaleAndDeliveryController.init"; //cleanUp
-import cleanUp from "@salesforce/apex/LexSaleAndDeliveryController.cleanUp";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import searchOrderInstatus from "@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus";
-import searchConsumableorderdetails from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails";
-import searchConsumableorFinish from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish";
+import { LightningElement, wire, api, track } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexSaleAndDeliveryController.init'; //cleanUp
+import cleanUp from '@salesforce/apex/LexSaleAndDeliveryController.cleanUp';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import searchOrderInstatus from '@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus';
+import searchConsumableorderdetails from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails';
+import searchConsumableorFinish from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish';
//table css
-import { loadStyle } from "lightning/platformResourceLoader";
-import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
const columns = [
- {
- label: "鍑哄簱鏃�",
- fieldName: "Outbound_Date__c",
- type: "date",
- hideDefaultActions: true,
- sortable: true,
- initialWidth: 180,
- wrapText: true
- },
- {
- label: "鍑哄簱鍗曞彿",
- fieldName: "url",
- type: "url",
- typeAttributes: {
- label: {
- fieldName: "Name"
- },
- target: "_blank"
+ {
+ label: '鍑哄簱鏃�',
+ fieldName: 'Outbound_Date__c',
+ type: 'date',
+ hideDefaultActions: true,
+ sortable: true,
+ initialWidth: 180,
+ wrapText: true
},
- hideDefaultActions: true,
- sortable: true,
- wrapText: true
- },
- {
- label: "瀹㈡埛鍚�",
- fieldName: "ShipmentAccount__c",
- hideDefaultActions: true,
- wrapText: true,
- sortable: true
- },
- {
- label: "绉戝",
- fieldName: "Order_ForCustomerText__c",
- hideDefaultActions: true,
- initialWidth: 100,
- wrapText: true
- },
- {
- label: "鍑哄簱鍗曠姸鎬�",
- fieldName: "SummonsStatus_c__c",
- hideDefaultActions: true,
- initialWidth: 100,
- sortable: true,
- wrapText: true
- },
- {
- label: "寮�绁ㄧ姸鎬�",
- fieldName: "Billed_Status__c",
- hideDefaultActions: true,
- initialWidth: 100,
- sortable: true,
- wrapText: true
- },
- {
- label: "鏈彂绁ㄩ噾棰�(鍏�)",
- fieldName: "InvoiceNotPro_money__c",
- hideDefaultActions: true,
- initialWidth: 125,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
+ {
+ label: '鍑哄簱鍗曞彿',
+ fieldName: 'url',
+ type: 'url',
+ typeAttributes: {
+ label: {
+ fieldName: 'Name'
+ },
+ target: '_blank'
+ },
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true
},
- wrapText: true
- },
- {
- label: "鍒涘缓鏃ユ湡",
- fieldName: "CreatedDate",
- hideDefaultActions: true,
- sortable: true,
- wrapText: true,
- initialWidth: 180,
- type: "date",
- typeAttributes: {
- timeZone: "Asia/Shanghai",
- day: "numeric",
- month: "numeric",
- year: "numeric",
- hour: "2-digit",
- minute: "2-digit"
+ {
+ label: '瀹㈡埛鍚�',
+ fieldName: 'ShipmentAccount__c',
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: '绉戝',
+ fieldName: 'Order_ForCustomerText__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ wrapText: true
+ },
+ {
+ label: '鍑哄簱鍗曠姸鎬�',
+ fieldName: 'SummonsStatus_c__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ sortable: true,
+ wrapText: true
+ },
+ {
+ label: '寮�绁ㄧ姸鎬�',
+ fieldName: 'Billed_Status__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ sortable: true,
+ wrapText: true
+ },
+ {
+ label: '鏈彂绁ㄩ噾棰�(鍏�)',
+ fieldName: 'InvoiceNotPro_money__c',
+ hideDefaultActions: true,
+ initialWidth: 125,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ },
+ wrapText: true
+ },
+ {
+ label: '鍒涘缓鏃ユ湡',
+ fieldName: 'CreatedDate',
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 180,
+ type: 'date',
+ typeAttributes: {
+ timeZone: 'Asia/Shanghai',
+ day: 'numeric',
+ month: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit'
+ }
}
- }
];
export default class LexSaleAndDelivery extends NavigationMixin(
- LightningElement
+ LightningElement
) {
- columns = columns;
- @track isShowSpinner = true;
- @track message = "";
- @track deliveryFromDate = "";
- @track deliveryToDate = "";
- @track deliveryOrderNo = "";
- @track contactName = "";
- @track data = [];
- @track userinfoId = "";
- @track accountid = "";
- @track agencyProType = "";
- @track userWorkLocation = "";
- @track showTable = false;
- @track hidecheckboxcolumn = true;
+ columns = columns;
+ @track isShowSpinner = true;
+ @track message = '';
+ @track deliveryFromDate = '';
+ @track deliveryToDate = '';
+ @track deliveryOrderNo = '';
+ @track contactName = '';
+ @track data = [];
+ @track userinfoId = '';
+ @track accountid = '';
+ @track agencyProType = '';
+ @track userWorkLocation = '';
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
- //鎺掑簭
- defaultSortDirection = "asc";
- sortDirection = "asc";
- sortedBy;
+ //鎺掑簭
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
- stylesLoaded = false;
- renderedCallback() {
- if (!this.stylesLoaded) {
- Promise.all([loadStyle(this, WrappedHeaderTable)])
- .then(() => {
- console.log("Custom styles loaded");
- this.stylesLoaded = true;
- })
- .catch((error) => {
- console.error("Error loading custom styles");
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log('Custom styles loaded');
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error('Error loading custom styles');
+ });
+ }
+ }
+
+ connectedCallback() {
+ init()
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.userinfoId = r.entity.userinfoId;
+ this.accountid = r.entity.accountid;
+ this.agencyProType = r.entity.agencyProType;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ console.log('this.data = ' + JSON.stringify(this.data));
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ console.log('r = ' + JSON.stringify(r));
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error');
+ });
+ }
+
+ //鏂板缓鍑哄簱鍗�
+ neworderhead() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexsummonscreat'
+ }
});
}
- }
- connectedCallback() {
- init()
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.userinfoId = r.entity.userinfoId;
- this.accountid = r.entity.accountid;
- this.agencyProType = r.entity.agencyProType;
- this.userWorkLocation = r.entity.userWorkLocation;
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- console.log("this.data = " + JSON.stringify(this.data));
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- console.log("r = " + JSON.stringify(r));
- this.showMyToast("鍒濆鍖栧け璐�", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("閿欒", "鍒濆鍖栧け璐�", "Error");
- });
- }
-
- //鏂板缓鍑哄簱鍗�
- neworderhead() {
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: "/lexsummonscreat"
- }
- });
- }
-
- //宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
- searchOrderInstatusJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchOrderInstatusJs");
- searchOrderInstatus({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- //this.isCssLoaded = true
- this.showTable = true;
- } else {
- this.showMyToast("閿欒", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
-
- //杩樻病鍑哄簱鐨勫嚭搴撳崟
- searchConsumableorderdetailsJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchConsumableorderdetailsJs");
- console.log("this.deliveryFromDate = " + this.deliveryFromDate);
- console.log("this.deliveryToDate = " + this.deliveryToDate);
- searchConsumableorderdetails({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊", "Error");
- });
- }
-
- //宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
- searchConsumableorFinishJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchConsumableorFinishJs");
- searchConsumableorFinish({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�", "Error");
- });
- }
-
- //娓呯┖
- clearJs() {
- this.deliveryFromDate = "";
- this.deliveryToDate = "";
- this.deliveryOrderNo = "";
- this.contactName = "";
- this.isShowSpinner = true;
- this.showTable = false;
- cleanUp({
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储澶辫触", "Error");
- });
- }
-
- //Capture the event fired from the paginator component
- handlePaginatorChange(event) {
- this.recordsToDisplay = event.detail.recordsToDisplay;
- this.preSelected = event.detail.preSelected;
- if (this.recordsToDisplay && this.recordsToDisplay > 0) {
- this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
- } else {
- this.rowNumberOffset = 0;
+ //宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
+ searchOrderInstatusJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchOrderInstatusJs');
+ searchOrderInstatus({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ //this.isCssLoaded = true
+ this.showTable = true;
+ } else {
+ this.showMyToast('閿欒', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
}
- }
- //鎺掑簭
- onHandleSort(event) {
- const { fieldName: sortedBy, sortDirection } = event.detail;
- const cloneData = [...this.data];
- cloneData.sort(this.sortBy(sortedBy, sortDirection === "asc" ? 1 : -1));
- this.data = cloneData;
- this.sortDirection = sortDirection;
- this.sortedBy = sortedBy;
- }
+ //杩樻病鍑哄簱鐨勫嚭搴撳崟
+ searchConsumableorderdetailsJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorderdetailsJs');
+ console.log('this.deliveryFromDate = ' + this.deliveryFromDate);
+ console.log('this.deliveryToDate = ' + this.deliveryToDate);
+ searchConsumableorderdetails({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast(
+ '鎼滅储澶辫触',
+ '鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊',
+ 'Error'
+ );
+ });
+ }
- sortBy(field, reverse, primer) {
- const key = primer
- ? function (x) {
- return primer(x[field]);
+ //宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ searchConsumableorFinishJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorFinishJs');
+ searchConsumableorFinish({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast(
+ '鎼滅储澶辫触',
+ '鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�',
+ 'Error'
+ );
+ });
+ }
+
+ //娓呯┖
+ clearJs() {
+ this.deliveryFromDate = '';
+ this.deliveryToDate = '';
+ this.deliveryOrderNo = '';
+ this.contactName = '';
+ this.isShowSpinner = true;
+ this.showTable = false;
+ cleanUp({
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast('鎼滅储澶辫触', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ //Capture the event fired from the paginator component
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
}
- : function (x) {
- return x[field];
+ }
+
+ //鎺掑簭
+ onHandleSort(event) {
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.data = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
};
-
- return function (a, b) {
- a = key(a);
- b = key(b);
- return reverse * ((a > b) - (b > a));
- };
- }
-
- dataChange(event) {
- let fieldName = event.target.getAttribute("data-field");
- let value = event.detail.value;
- switch (fieldName) {
- case "deliveryFromDate":
- this.deliveryFromDate = value;
- break;
- case "deliveryToDate":
- this.deliveryToDate = value;
- break;
- case "deliveryOrderNo":
- this.deliveryOrderNo = value;
- break;
- case "contactName":
- this.contactName = value;
- break;
- default:
- console.log("no data");
}
- }
- editProductLimit() {
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: "/lexoutboundorderimport"
- }
- });
- }
-
- showMyToast(title, message, variant) {
- this.isShowSpinner = false;
- console.log("show custom message");
- var iconName = "";
- var content = "";
- if (variant.toLowerCase() == "success") {
- iconName = "utility:check";
- } else {
- iconName = "utility:error";
+ dataChange(event) {
+ let fieldName = event.target.getAttribute('data-field');
+ let value = event.detail.value;
+ switch (fieldName) {
+ case 'deliveryFromDate':
+ this.deliveryFromDate = value;
+ break;
+ case 'deliveryToDate':
+ this.deliveryToDate = value;
+ break;
+ case 'deliveryOrderNo':
+ this.deliveryOrderNo = value;
+ break;
+ case 'contactName':
+ this.contactName = value;
+ break;
+ default:
+ console.log('no data');
+ }
}
- if (message != "") {
- content =
- "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
- } else {
- content = "<h2><strong>" + title + "<strong/></h2>";
- }
- this.template
- .querySelector("c-common-toast")
- .showToast(variant, content, iconName, 10000);
- }
- @track isModalOpen = false;
- openModal() {
- this.isModalOpen = true;
- }
-}
+ editProductLimit() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexoutboundorderimport'
+ }
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content =
+ '<h2><strong>' +
+ title +
+ '<strong/></h2><h5>' +
+ message +
+ '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template
+ .querySelector('c-common-toast')
+ .showToast(variant, content, iconName, 10000);
+ }
+
+ @track isModalOpen = false;
+ openModal() {
+ this.isModalOpen = true;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
index 62abe5a..833ce90 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
@@ -842,7 +842,7 @@
</template>
<c-paginator onprevious={handlePrevious} onnext={handleNext}
onpageschange={handlePageschange} onfirst={handleFirst} onlast={handleLast}
- page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
+ page-size-options={pageSizeOptions} default-page-size={pageSize} previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled} record-start={recordStart}
record-end={recordEnd} total-records={totalRecords}></c-paginator>
</template>
@@ -860,7 +860,7 @@
</c-lex-custom-lightning-datatable>
<c-paginator onprevious={editHandlePrevious} onnext={editHandleNext}
onpageschange={editHandlePageschange} onfirst={editHandleFirst}
- onlast={editHandleLast} page-size-options={pageSizeOptions}
+ onlast={editHandleLast} page-size-options={pageSizeOptions} default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled} record-start={recordStart}
record-end={recordEnd} total-records={totalRecords}></c-paginator>
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
index 7b3c02d..1936433 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -593,7 +593,7 @@
defaultSortDirection = 'asc';
sortDirection = 'asc';
sortedBy;
- @track pageSize = 10;
+ @track pageSize = 200;
error;
records;
currentPageToken = 0;
@@ -603,7 +603,7 @@
@track pageNumber = 1;
@track paginationVisibility = false;
@track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
+ pageSizeOptions = [100, 200, 300];
@track recordStart = 0;
@track recordEnd = 0;
//end
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.html b/force-app/main/default/lwc/lexTopPage/lexTopPage.html
index a1c10bd..2f6a06d 100644
--- a/force-app/main/default/lwc/lexTopPage/lexTopPage.html
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.html
@@ -1,20 +1,20 @@
<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>
- <template if:true={showPage}>
- <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <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>
+ <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">
@@ -29,70 +29,70 @@
<p style="height: 10px;"></p>
</div>
</div> -->
- <!-- 鏈叏閮ㄥ彂璐ц鍗曟槑缁� -->
- <template if:true={over_view}>
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong></p> -->
- </div>
- <div style="padding: 10px">
- <c-lex-custom-lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="Id"
- data={raesList}
- columns={colms}
- onclicklink={clickLick}
- ></c-lex-custom-lightning-datatable>
- </div>
- </div>
- </template>
- <!-- 浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧 -->
- <template if:true={overlimit}>
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong></p> -->
- </div>
- <div style="padding: 10px">
- <lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="prodName"
- data={overlimitdateorderdetails}
- columns={colm3}
- ></lightning-datatable>
- </div>
- </div>
- </template>
- <!-- 缁忛攢鍟嗕俊鎭�
+ <!-- 鏈叏閮ㄥ彂璐ц鍗曟槑缁� -->
+ <template if:true={over_view}>
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong></p> -->
+ </div>
+ <div style="padding: 10px">
+ <c-lex-custom-lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="Id"
+ data={raesList}
+ columns={colms}
+ onclicklink={clickLick}
+ ></c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </template>
+ <!-- 浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧 -->
+ <template if:true={overlimit}>
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong></p> -->
+ </div>
+ <div style="padding: 10px">
+ <lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="prodName"
+ data={overlimitdateorderdetails}
+ columns={colm3}
+ ></lightning-datatable>
+ </div>
+ </div>
+ </template>
+ <!-- 缁忛攢鍟嗕俊鎭�
<div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
<div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
<lightning-layout>
@@ -176,48 +176,48 @@
</lightning-accordion>
</div>
</div> -->
- <!--缁忛攢鍟嗗簱瀛樹笂涓嬮檺 -->
- <div
- style="
- border: 1px solid #d4d4d4;
- border-top: 3px solid #51606e;
- border-radius: 5px;
- margin-bottom: 7px;
- "
- >
- <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
- <lightning-layout>
- <lightning-layout-item padding="around-small">
- <p style="font-size: 18px">
- <strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong>
- </p>
- </lightning-layout-item>
- </lightning-layout>
- <!-- <p style="font-size: 16px;"><strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong></p> -->
- </div>
- <div style="padding: 10px">
- <div lwc:dom="manual" id="resultDiv" class="resultDiv"></div>
- <lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="prodName"
- data={productLimitRecords}
- columns={colm4}
- ></lightning-datatable>
- <p style="height: 10px"></p>
- <div draggable="false">
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexBorder"
- style="width: 220px"
- onclick={editProductLimit}
- >
- 缁忛攢鍟嗕骇鍝佷笂涓嬮檺缂栬緫
- </button>
+ <!--缁忛攢鍟嗗簱瀛樹笂涓嬮檺 -->
+ <div
+ style="
+ border: 1px solid #d4d4d4;
+ border-top: 3px solid #51606e;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ "
+ >
+ <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong></p> -->
+ </div>
+ <div style="padding: 10px">
+ <div lwc:dom="manual" id="resultDiv" class="resultDiv"></div>
+ <lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="prodName"
+ data={productLimitRecords}
+ columns={colm4}
+ ></lightning-datatable>
+ <p style="height: 10px"></p>
+ <div draggable="false">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ style="width: 220px"
+ onclick={editProductLimit}
+ >
+ 缁忛攢鍟嗕骇鍝佷笂涓嬮檺缂栬緫
+ </button>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <!-- 鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙� -->
- <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <!-- 鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙� -->
+ <!-- <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">
@@ -241,68 +241,71 @@
record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator>
</div>
</div> -->
- <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
- <template if:true={showPop}>
- <section
- role="dialog"
- tabindex="-1"
- aria-labelledby="modal-heading-01"
- aria-modal="true"
- aria-describedby="modal-content-id-1"
- class="slds-modal slds-fade-in-open slds-modal_small"
- style="border: 1px solid #d4d4d4"
- >
- <div class="slds-modal__container">
- <header class="slds-modal__header" style="background-color: #f3f3f3">
- <button
- style=""
- class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
- title="Close"
- onclick={closePop}
+ <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
+ <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"
>
- <lightning-icon
- icon-name="utility:close"
- alternative-text="close"
- variant="inverse"
- size="small"
- ></lightning-icon>
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2
- id="modal-heading-01"
- class="slds-text-heading_medium slds-hyphenate"
- >
- {popTitle}
- </h2>
- </header>
- <div
- class="slds-modal__content slds-p-around_medium"
- id="modal-content-id-1"
- style="border: 1px solid #f3f3f3"
- >
- <lightning-datatable
- class="wrapped-header-datatable"
- hide-checkbox-column
- key-field="prodModel"
- columns={colms2}
- data={recordList}
- ></lightning-datatable>
- </div>
- <footer class="slds-modal__footer">
- <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
- <button
- class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
- style="margin-left: 10px"
- variant="neutral"
- label="鍏抽棴"
- onclick={closePop}
- >
- 鍏抽棴
- </button>
- </footer>
- </div>
- </section>
- <div class="slds-backdrop slds-backdrop_open"></div>
+ <div class="slds-modal__container">
+ <header
+ class="slds-modal__header"
+ style="background-color: #f3f3f3"
+ >
+ <button
+ style=""
+ class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close"
+ onclick={closePop}
+ >
+ <lightning-icon
+ icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small"
+ ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2
+ id="modal-heading-01"
+ class="slds-text-heading_medium slds-hyphenate"
+ >
+ {popTitle}
+ </h2>
+ </header>
+ <div
+ class="slds-modal__content slds-p-around_medium"
+ id="modal-content-id-1"
+ style="border: 1px solid #f3f3f3"
+ >
+ <lightning-datatable
+ class="wrapped-header-datatable"
+ hide-checkbox-column
+ key-field="prodModel"
+ columns={colms2}
+ data={recordList}
+ ></lightning-datatable>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ style="margin-left: 10px"
+ variant="neutral"
+ label="鍏抽棴"
+ onclick={closePop}
+ >
+ 鍏抽棴
+ </button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
</template>
- </template>
-</template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.js b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
index 47589c0..7ecdcc9 100644
--- a/force-app/main/default/lwc/lexTopPage/lexTopPage.js
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
@@ -1,776 +1,796 @@
-import { LightningElement, wire, api, track } from "lwc";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import { NavigationMixin } from "lightning/navigation";
-import initPage from "@salesforce/apex/LexTopPageController.initPage";
-import initTotalNum from "@salesforce/apex/LexConsumableGoodsInfo.initTotalNum";
-import initArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initArrDet";
-import initArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll";
-import initDeliveryDet from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet";
-import initDeliveryDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll";
-import initNotArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet";
-import initNotArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll";
-import initMoreThan7 from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7";
-import initMoreThan7All from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All";
+import { LightningElement, wire, api, track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexTopPageController.initPage';
+import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
+import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
+import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
+import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
+import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
+import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
+import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
+import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
+import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
//table css
-import { loadStyle } from "lightning/platformResourceLoader";
-import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexTopPage extends NavigationMixin(LightningElement) {
- @track title = [];
- @track raesList = [];
- @track column = [];
- @track overlimitdateorderdetails = [];
- @track productLimitRecords = [];
- @track accountInfo;
- @track accountId;
- @track userPro_Type;
- @track pageRecords = [];
- @track csvData = [];
- @track product_Limit;
- @track over_view = false;
- @track overlimit = false;
- @track hasHos = false;
- @track activeSections = ["A", "B", "C"];
- @track isRender = false;
- @track consumableorderdetailsRecordsview;
- @track showSpinner = true;
- @track showPage = false;
- //
- @track showPop = false;
- @track popTitle;
- @track totalNum;
- @track orderNumberArrived;
- @track deliveryDetailCount;
- @track orderNumberNotarrive;
- @track moreThanSevenDays;
- stylesLoaded = false;
+ @track title = [];
+ @track raesList = [];
+ @track column = [];
+ @track overlimitdateorderdetails = [];
+ @track productLimitRecords = [];
+ @track accountInfo;
+ @track accountId;
+ @track userPro_Type;
+ @track pageRecords = [];
+ @track csvData = [];
+ @track product_Limit;
+ @track over_view = false;
+ @track overlimit = false;
+ @track hasHos = false;
+ @track activeSections = ['A', 'B', 'C'];
+ @track isRender = false;
+ @track consumableorderdetailsRecordsview;
+ @track showSpinner = true;
+ @track showPage = false;
+ //
+ @track showPop = false;
+ @track popTitle;
+ @track totalNum;
+ @track orderNumberArrived;
+ @track deliveryDetailCount;
+ @track orderNumberNotarrive;
+ @track moreThanSevenDays;
+ stylesLoaded = false;
- @track showTable = false;
- @track hidecheckboxcolumn = true;
- //鎺掑簭
- defaultSortDirection = "asc";
- sortDirection = "asc";
- sortedBy;
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+ //鎺掑簭
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
- //鍒嗛〉start
- @track sortBy = "";
- @track pageSize = 10;
- error;
- records;
- currentPageToken = 0;
- nextPageToken = this.pageSize;
- @track totalRecords = 0;
- @track loader = false;
- @track pageNumber = 1;
- @track paginationVisibility = false;
- @track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
- @track recordStart = 0;
- @track recordEnd = 0;
- //end
+ //鍒嗛〉start
+ @track sortBy = '';
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
- //鏄惁涓�鐩存樉绀烘彁绀�
- @track isNoteStay = true;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
- //鏈叏閮ㄥ彂璐ц鍗曟槑缁哻ol
- @track colms = [
- {
- label: "娑堣�楀搧璁㈠崟鍚嶇О",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "Name" },
- type: "Title",
- recordId: { fieldName: "Id" }
- },
- 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" },
- type: "TotalNum",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "宸插埌璐ф暟閲�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "OrderNumber_arrived__c" },
- type: "ArrDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "寰呯郴缁熸搷浣滃叆搴撴暟閲�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "Delivery_detail_count__c" },
- type: "DeliveryDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 150
- },
- {
- label: "杩樻病鍙戣揣鏁伴噺",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "OrderNumber_notarrive__c" },
- type: "NotArrDet",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 120
- },
- {
- label: "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�",
- type: "customOutputGood",
- typeAttributes: {
- outputValue: { fieldName: "More_than_seven_days__c" },
- type: "MoreThan7",
- recordId: { fieldName: "Id" }
- },
- hideDefaultActions: true,
- initialWidth: 150
- },
- {
- label: "鏈�鏂板彂璐ф棩鏈�",
- fieldName: "Shipment_date__c",
- hideDefaultActions: true,
- initialWidth: 105
- },
- {
- label: "棣栨鍙戣揣鏃ユ湡",
- fieldName: "First_Delivery__c",
- hideDefaultActions: true,
- initialWidth: 105
+ //鏈叏閮ㄥ彂璐ц鍗曟槑缁哻ol
+ @track colms = [
+ {
+ label: '娑堣�楀搧璁㈠崟鍚嶇О',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'Name' },
+ type: 'Title',
+ recordId: { fieldName: 'Id' }
+ },
+ 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' },
+ type: 'TotalNum',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '宸插埌璐ф暟閲�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'OrderNumber_arrived__c' },
+ type: 'ArrDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '寰呯郴缁熸搷浣滃叆搴撴暟閲�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'Delivery_detail_count__c' },
+ type: 'DeliveryDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '杩樻病鍙戣揣鏁伴噺',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'OrderNumber_notarrive__c' },
+ type: 'NotArrDet',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',
+ type: 'customOutputGood',
+ typeAttributes: {
+ outputValue: { fieldName: 'More_than_seven_days__c' },
+ type: 'MoreThan7',
+ recordId: { fieldName: 'Id' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鏈�鏂板彂璐ф棩鏈�',
+ fieldName: 'Shipment_date__c',
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: '棣栨鍙戣揣鏃ユ湡',
+ fieldName: 'First_Delivery__c',
+ hideDefaultActions: true,
+ initialWidth: 105
+ }
+ ];
+
+ @track colms2 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodModel', hideDefaultActions: true },
+ {
+ label: '鏁伴噺',
+ fieldName: 'recordCount',
+ hideDefaultActions: true,
+ initialWidth: 60,
+ cellAttributes: { alignment: 'center' }
+ }
+ ];
+
+ //浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧col
+ @track colm3 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
+ {
+ label: '鏁伴噺',
+ fieldName: 'countid',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'BoxPiece',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
+ }
+ ];
+
+ //缁忛攢鍟嗗簱瀛樹笂涓嬮檺col
+ @track colm4 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
+ {
+ label: '搴撳瓨涓嬮檺',
+ fieldName: 'limitLow',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
+ },
+ {
+ label: '搴撳瓨涓婇檺',
+ fieldName: 'limitUp',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
+ }
+ ];
+ @track columns = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ type: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ wrapText: true,
+ cellAttributes: { alignment: 'left' }
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'packing_list',
+ cellAttributes: { alignment: 'right' },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '绗笁鍒嗙被',
+ fieldName: 'Category3__c',
+ initialWidth: 85,
+ cellAttributes: { alignment: 'left' },
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '绗洓鍒嗙被',
+ fieldName: 'Category4__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: '绗簲鍒嗙被',
+ fieldName: 'Category5__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: 'CFDA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 80,
+ hideDefaultActions: true
+ },
+ {
+ label: '娉ㄥ唽璇佺紪鐮佸彿',
+ fieldName: 'approbation_No',
+ cellAttributes: { alignment: 'left' },
+ wrapText: true,
+ initialWidth: 155,
+ hideDefaultActions: true
+ },
+ {
+ label: '娉ㄥ唽璇佹晥鏈�',
+ fieldName: 'expiration_Date',
+ cellAttributes: { alignment: 'left' },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '浜у搧鏁伴噺涓嬮檺',
+ fieldName: 'lowerlimit',
+ cellAttributes: { alignment: 'right' },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '浣跨敤鏈熼檺',
+ fieldName: 'guaranteeperiod',
+ cellAttributes: { alignment: 'left' },
+ hideDefaultActions: true,
+ initialWidth: 95
+ },
+
+ {
+ label: '鏈夋晥鏈熷唴搴撳瓨',
+ type: 'customInventoryColor',
+ cellAttributes: { alignment: 'right' },
+ typeAttributes: {
+ value: { fieldName: 'limitCount' },
+ upperlimit: { fieldName: 'upperlimit' },
+ lowerlimit: { fieldName: 'lowerlimit' },
+ boxPrice: { fieldName: 'BoxPiece' }
+ },
+ hideDefaultActions: true,
+
+ initialWidth: 95
+ },
+ {
+ label: '杩囨湡搴撳瓨',
+ fieldName: 'overlimitCount',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' },
+ initialWidth: 75
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'BoxPiece',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true
+ }
+ ];
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log('Custom styles loaded');
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error('Error loading custom styles');
+ });
+ }
}
- ];
- @track colms2 = [
- { label: "浜у搧鍨嬪彿", fieldName: "prodModel", hideDefaultActions: true },
- {
- label: "鏁伴噺",
- fieldName: "recordCount",
- hideDefaultActions: true,
- initialWidth: 60,
- cellAttributes: { alignment: "center" }
+ connectedCallback() {
+ this.loader = true;
+ this.init();
}
- ];
-
- //浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧col
- @track colm3 = [
- { label: "浜у搧鍨嬪彿", fieldName: "prodName", hideDefaultActions: true },
- {
- label: "鏁伴噺",
- fieldName: "countid",
- hideDefaultActions: true,
- cellAttributes: { alignment: "left" }
- },
- {
- label: "鍗曚綅",
- fieldName: "BoxPiece",
- hideDefaultActions: true,
- cellAttributes: { alignment: "left" }
- }
- ];
-
- //缁忛攢鍟嗗簱瀛樹笂涓嬮檺col
- @track colm4 = [
- { label: "浜у搧鍨嬪彿", fieldName: "prodName", hideDefaultActions: true },
- {
- label: "搴撳瓨涓嬮檺",
- fieldName: "limitLow",
- hideDefaultActions: true,
- cellAttributes: { alignment: "left" }
- },
- {
- label: "搴撳瓨涓婇檺",
- fieldName: "limitUp",
- hideDefaultActions: true,
- cellAttributes: { alignment: "left" }
- }
- ];
- @track columns = [
- {
- label: "娑堣�楀搧鍚嶇О",
- fieldName: "Name__c",
- type: "Name",
- sortable: true,
- hideDefaultActions: true,
- wrapText: true,
- cellAttributes: { alignment: "left" }
- },
- {
- label: "瑙勬牸",
- fieldName: "packing_list",
- cellAttributes: { alignment: "right" },
- initialWidth: 50,
- wrapText: true,
- hideDefaultActions: true
- },
- {
- label: "绗笁鍒嗙被",
- fieldName: "Category3__c",
- initialWidth: 85,
- cellAttributes: { alignment: "left" },
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: "绗洓鍒嗙被",
- fieldName: "Category4__c",
- cellAttributes: { alignment: "left" },
- initialWidth: 85,
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: "绗簲鍒嗙被",
- fieldName: "Category5__c",
- cellAttributes: { alignment: "left" },
- initialWidth: 85,
- hideDefaultActions: true,
- wrapText: true,
- sortable: true
- },
- {
- label: "CFDA鐘舵��",
- fieldName: "SFDA_Status__c",
- cellAttributes: { alignment: "left" },
- initialWidth: 80,
- hideDefaultActions: true
- },
- {
- label: "娉ㄥ唽璇佺紪鐮佸彿",
- fieldName: "approbation_No",
- cellAttributes: { alignment: "left" },
- wrapText: true,
- initialWidth: 155,
- hideDefaultActions: true
- },
- {
- label: "娉ㄥ唽璇佹晥鏈�",
- fieldName: "expiration_Date",
- cellAttributes: { alignment: "left" },
- wrapText: true,
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "浜у搧鏁伴噺涓嬮檺",
- fieldName: "lowerlimit",
- cellAttributes: { alignment: "right" },
- wrapText: true,
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "浣跨敤鏈熼檺",
- fieldName: "guaranteeperiod",
- cellAttributes: { alignment: "left" },
- hideDefaultActions: true,
- initialWidth: 95
- },
-
- {
- label: "鏈夋晥鏈熷唴搴撳瓨",
- type: "customInventoryColor",
- cellAttributes: { alignment: "right" },
- typeAttributes: {
- value: { fieldName: "limitCount" },
- upperlimit: { fieldName: "upperlimit" },
- lowerlimit: { fieldName: "lowerlimit" },
- boxPrice: { fieldName: "BoxPiece" }
- },
- hideDefaultActions: true,
-
- initialWidth: 95
- },
- {
- label: "杩囨湡搴撳瓨",
- fieldName: "overlimitCount",
- hideDefaultActions: true,
- cellAttributes: { alignment: "right" },
- initialWidth: 75
- },
- {
- label: "鍗曚綅",
- fieldName: "BoxPiece",
- cellAttributes: { alignment: "left" },
- initialWidth: 50,
- wrapText: true,
- hideDefaultActions: true
- }
- ];
-
- renderedCallback() {
- if (!this.stylesLoaded) {
- Promise.all([loadStyle(this, WrappedHeaderTable)])
- .then(() => {
- console.log("Custom styles loaded");
- this.stylesLoaded = true;
+ init() {
+ this.showSpinner = true;
+ initPage({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
})
- .catch((error) => {
- console.error("Error loading custom styles");
- });
+ .then((result) => {
+ this.isNoteStay = result.isNoteStay;
+ console.log('isNoteStay:' + result.isNoteStay);
+ if (result.result == 'Success') {
+ //鍒嗛〉start
+ this.nextPageToken = result.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.paginatedAccounts.totalRecords;
+ this.recordStart = result.paginatedAccounts.recordStart;
+ this.recordEnd = result.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ result.paginatedAccounts.totalRecords / this.pageSize
+ );
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility =
+ this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ this.loader = false;
+ //鍒嗛〉end
+ this.title = result.title;
+ this.totalNum = result.totalNum;
+ this.orderNumberArrived = result.orderNumberArrived;
+ this.deliveryDetailCount = result.deliveryDetailCount;
+ this.orderNumberNotarrive = result.orderNumberNotarrive;
+ this.moreThanSevenDays = result.moreThanSevenDays;
+ this.raesList = result.raesList;
+ this.raesList.push({
+ Id: '1',
+ Name: '寰呮搷浣滃叆搴撹鍗曟眹鎬�',
+ Total_num__c: this.totalNum,
+ OrderNumber_arrived__c: this.orderNumberArrived,
+ Delivery_detail_count__c: this.deliveryDetailCount,
+ OrderNumber_notarrive__c: this.orderNumberNotarrive,
+ More_than_seven_days__c: this.moreThanSevenDays
+ });
+ this.column = result.column;
+ this.accountInfo = result.accountInfo;
+ this.accountId = result.accountInfo.Id;
+ this.pageRecords = result.pageRecords;
+ this.overlimitdateorderdetails =
+ result.overlimitdateorderdetails;
+ this.over_view = result.over_view;
+ this.overlimit = result.overlimit;
+ this.hasHos = result.hasHos;
+ this.product_Limit = result.product_Limit;
+ console.log('result==>' + JSON.stringify(result));
+ for (var i in this.pageRecords) {
+ this.pageRecords[i]['Name__c'] =
+ this.pageRecords[i].Prod.Name__c;
+ this.pageRecords[i]['Category3__c'] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]['Category4__c'] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]['Category5__c'] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]['SFDA_Status__c'] =
+ this.pageRecords[i].Prod.SFDA_Status__c;
+ }
+ //hasHos = true 鍖婚櫌鐗逛环
+ if (this.hasHos) {
+ let object1 = {
+ label: '鍖婚櫌鐗逛环',
+ fieldName: 'hospitalSpecialOffer',
+ hideDefaultActions: true,
+ type: 'boolean',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 75
+ };
+ this.columns.push(object1);
+ console.log(' this.columns' + this.columns);
+ for (var j in this.pageRecords) {
+ this.pageRecords[j]['Name__c'] =
+ this.pageRecords[j].Prod.Name__c;
+ this.pageRecords[j]['Category3__c'] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]['Category4__c'] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]['Category5__c'] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]['SFDA_Status__c'] =
+ this.pageRecords[j].Prod.SFDA_Status__c;
+ this.pageRecords[j]['hospitalSpecialOffer__c'] =
+ this.pageRecords[j].hospitalSpecialOffer;
+ }
+ }
+ this.showTable = true;
+ if (
+ this.product_Limit != null &&
+ this.product_Limit != ''
+ ) {
+ var records = this.product_Limit.split(',');
+ for (var i in records) {
+ var parms = records[i].split('|');
+ var record = new Object();
+ record['prodName'] = parms[0];
+ record['limitLow'] = parms[1];
+ record['limitUp'] = parms[2];
+ this.productLimitRecords.push(record);
+ }
+ }
+ // this.productLimitRecords = records;
+ console.log(
+ 'productLimitRecords:' +
+ JSON.stringify(this.productLimitRecords)
+ );
+ console.log('product_Limit:' + this.product_Limit);
+ this.consumableorderdetailsRecordsview =
+ result.consumableorderdetailsRecordsview;
+ //add by WangXueqin 2023/05/05
+ this.userPro_Type = result.userPro_Type;
+ console.log('this.accountId:' + this.accountId);
+ console.log(
+ 'this.accountInfo:' + JSON.stringify(this.accountInfo)
+ );
+ this.showSpinner = false;
+ this.showPage = true;
+ // this.showMyToast('鍒濆鍖栭〉闈㈡垚鍔�', '', 'success');
+ } else {
+ this.showPage = true;
+ this.showSpinner = false;
+ console.log('Error:' + result.errorMsg);
+ this.showMyToast(
+ '鍒濆鍖栭〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ })
+ .catch((error) => {
+ this.showSpinner = false;
+ console.log('Error:' + error);
+ this.showMyToast(
+ '鍒濆鍖栭〉闈㈠け璐�',
+ JSON.stringify(error),
+ 'error'
+ );
+ });
}
- }
- connectedCallback() {
- this.loader = true;
- this.init();
- }
- init() {
- this.showSpinner = true;
- initPage({
- pageSizeLWC: this.pageSize,
- pageTokenLWC: this.currentPageToken
- })
- .then((result) => {
- this.isNoteStay = result.isNoteStay;
- console.log("isNoteStay:" + result.isNoteStay);
- if (result.result == "Success") {
- //鍒嗛〉start
- this.nextPageToken = result.paginatedAccounts.nextPageToken;
- this.totalRecords = result.paginatedAccounts.totalRecords;
- this.recordStart = result.paginatedAccounts.recordStart;
- this.recordEnd = result.paginatedAccounts.recordEnd;
- this.totalPages = Math.ceil(
- result.paginatedAccounts.totalRecords / this.pageSize
- );
- console.log("this.totalPages = " + this.totalPages);
- this.paginationVisibility = this.totalPages > 1 ? true : false;
- console.log("this.sortDirection = " + this.sortDirection);
- this.loader = false;
- //鍒嗛〉end
- this.title = result.title;
- this.totalNum = result.totalNum;
- this.orderNumberArrived = result.orderNumberArrived;
- this.deliveryDetailCount = result.deliveryDetailCount;
- this.orderNumberNotarrive = result.orderNumberNotarrive;
- this.moreThanSevenDays = result.moreThanSevenDays;
- this.raesList = result.raesList;
- this.raesList.push({
- Id: "1",
- Name: "寰呮搷浣滃叆搴撹鍗曟眹鎬�",
- Total_num__c: this.totalNum,
- OrderNumber_arrived__c: this.orderNumberArrived,
- Delivery_detail_count__c: this.deliveryDetailCount,
- OrderNumber_notarrive__c: this.orderNumberNotarrive,
- More_than_seven_days__c: this.moreThanSevenDays
- });
- this.column = result.column;
- this.accountInfo = result.accountInfo;
- this.accountId = result.accountInfo.Id;
- this.pageRecords = result.pageRecords;
- this.overlimitdateorderdetails = result.overlimitdateorderdetails;
- this.over_view = result.over_view;
- this.overlimit = result.overlimit;
- this.hasHos = result.hasHos;
- this.product_Limit = result.product_Limit;
- console.log("result==>" + JSON.stringify(result));
- for (var i in this.pageRecords) {
- this.pageRecords[i]["Name__c"] = this.pageRecords[i].Prod.Name__c;
- this.pageRecords[i]["Category3__c"] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]["Category4__c"] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]["Category5__c"] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]["SFDA_Status__c"] =
- this.pageRecords[i].Prod.SFDA_Status__c;
- }
- //hasHos = true 鍖婚櫌鐗逛环
- if (this.hasHos) {
- let object1 = {
- label: "鍖婚櫌鐗逛环",
- fieldName: "hospitalSpecialOffer",
- hideDefaultActions: true,
- type: "boolean",
- cellAttributes: { alignment: "left" },
- initialWidth: 75
+ //鐐瑰嚮閾炬帴
+ clickLick(event) {
+ var outputValue = event.detail.data.value;
+ var outputType = event.detail.data.type;
+ var recordId = event.detail.data.recordId;
+ console.log(
+ 'click:' + outputValue + '---' + outputType + '---' + recordId
+ );
+ if (outputType == 'Title') {
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ESetId=' + recordId
+ }
};
- this.columns.push(object1);
- console.log(" this.columns" + this.columns);
- for (var j in this.pageRecords) {
- this.pageRecords[j]["Name__c"] = this.pageRecords[j].Prod.Name__c;
- this.pageRecords[j]["Category3__c"] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]["Category4__c"] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]["Category5__c"] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]["SFDA_Status__c"] =
- this.pageRecords[j].Prod.SFDA_Status__c;
- this.pageRecords[j]["hospitalSpecialOffer__c"] =
- this.pageRecords[j].hospitalSpecialOffer;
+ this[NavigationMixin.Navigate](config);
+ } else if (outputType == 'TotalNum') {
+ this.popTitle = '鎵�鏈変骇鍝佷竴瑙�';
+ initTotalNum({ ordId: recordId, type: '' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else if (outputType == 'ArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�';
+ initArrDetAll({ type: '' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '宸插埌璐т骇鍝佷竴瑙�';
+ initArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
}
- }
- this.showTable = true;
- if (this.product_Limit != null && this.product_Limit != "") {
- var records = this.product_Limit.split(",");
- for (var i in records) {
- var parms = records[i].split("|");
- var record = new Object();
- record["prodName"] = parms[0];
- record["limitLow"] = parms[1];
- record["limitUp"] = parms[2];
- this.productLimitRecords.push(record);
+ } else if (outputType == 'DeliveryDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�';
+ initDeliveryDetAll({ type: '' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '鏈埌璐т骇鍝佷竴瑙�';
+ initDeliveryDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
}
- }
- // this.productLimitRecords = records;
- console.log(
- "productLimitRecords:" + JSON.stringify(this.productLimitRecords)
- );
- console.log("product_Limit:" + this.product_Limit);
- this.consumableorderdetailsRecordsview =
- result.consumableorderdetailsRecordsview;
- //add by WangXueqin 2023/05/05
- this.userPro_Type = result.userPro_Type;
- console.log("this.accountId:" + this.accountId);
- console.log("this.accountInfo:" + JSON.stringify(this.accountInfo));
- this.showSpinner = false;
- this.showPage = true;
- // this.showMyToast('鍒濆鍖栭〉闈㈡垚鍔�', '', 'success');
- } else {
- this.showPage = true;
- this.showSpinner = false;
- console.log("Error:" + result.errorMsg);
- this.showMyToast("鍒濆鍖栭〉闈㈠け璐�", result.errorMsg, "error");
+ } else if (outputType == 'NotArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�';
+ initNotArrDetAll({ type: '' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '杩樻病鍙戣揣鏁伴噺';
+ initNotArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
+ } else if (outputType == 'MoreThan7') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟';
+ initMoreThan7All({ type: '' }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ } else {
+ this.popTitle = '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�';
+ initMoreThan7({ orderId: recordId }).then((result) => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ '鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�',
+ result.errorMsg,
+ 'error'
+ );
+ }
+ });
+ }
}
- })
- .catch((error) => {
- this.showSpinner = false;
- console.log("Error:" + error);
- this.showMyToast("鍒濆鍖栭〉闈㈠け璐�", JSON.stringify(error), "error");
- });
- }
-
- //鐐瑰嚮閾炬帴
- clickLick(event) {
- var outputValue = event.detail.data.value;
- var outputType = event.detail.data.type;
- var recordId = event.detail.data.recordId;
- console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
- if (outputType == "Title") {
- const config = {
- type: "standard__webPage",
- attributes: {
- url: "/lexarrivegoods?ESetId=" + recordId
- }
- };
- this[NavigationMixin.Navigate](config);
- } else if (outputType == "TotalNum") {
- this.popTitle = "鎵�鏈変骇鍝佷竴瑙�";
- initTotalNum({ ordId: recordId, type: "" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else if (outputType == "ArrDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�";
- initArrDetAll({ type: "" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "宸插埌璐т骇鍝佷竴瑙�";
- initArrDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "DeliveryDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�";
- initDeliveryDetAll({ type: "" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "鏈埌璐т骇鍝佷竴瑙�";
- initDeliveryDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "NotArrDet") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�";
- initNotArrDetAll({ type: "" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "杩樻病鍙戣揣鏁伴噺";
- initNotArrDet({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触",
- result.errorMsg,
- "error"
- );
- }
- });
- }
- } else if (outputType == "MoreThan7") {
- if (recordId == "1") {
- this.popTitle = "鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟";
- initMoreThan7All({ type: "" }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触",
- result.errorMsg,
- "error"
- );
- }
- });
- } else {
- this.popTitle = "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�";
- initMoreThan7({ orderId: recordId }).then((result) => {
- if (result.result == "Success") {
- this.recordList = result.recordList;
- console.log("data:" + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- "鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�",
- result.errorMsg,
- "error"
- );
- }
- });
- }
}
- }
- //鍏抽棴寮圭獥
- closePop() {
- this.showPop = false;
- }
-
- editProductLimit(event) {
- //add by Wang Xueqin 2023/05/05
- //let url =
- // '/LexProductLimitEdit?accountid=' +
- // this.accountId +
- // '&userPro_Type=' +
- // this.userPro_Type;
- let url =
- "/lexproductlimitedit?accountid=" +
- this.accountId +
- "&userPro_Type=" +
- this.userPro_Type;
- const config = {
- type: "standard__webPage",
- attributes: {
- url: url
- }
- };
- this[NavigationMixin.Navigate](config);
- }
-
- //鏂板缓娑堣�楀搧璁㈠崟
- newOrder() {
- this[NavigationMixin.Navigate]({
- type: "standard__objectPage",
- attributes: {
- objectApiName: "Consumable_order__c",
- actionName: "new"
- },
- state: {
- useRecordTypeCheck: 1
- }
- });
- }
-
- showMyToast(title, message, variant) {
- console.log("show custom message");
- var iconName = "";
- var content = "";
- if (variant == "success") {
- iconName = "utility:check";
- } else {
- iconName = "utility:error";
+ //鍏抽棴寮圭獥
+ closePop() {
+ this.showPop = false;
}
- if (message != "") {
- content =
- "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
- } else {
- content = "<h2><strong>" + title + "<strong/></h2>";
- }
- this.template
- .querySelector("c-common-toast")
- .showToast(variant, content, iconName, 10000);
- // var mode;
- // if(this.isNoteStay){
- // mode ='sticky';
- // }else{
- // mode = 'dismissable';
- // }
- // const evt = new ShowToastEvent({
- // title: title,
- // message: message,
- // variant: variant,
- // mode: mode
- // });
- // this.dispatchEvent(evt);
- }
- //鎺掑簭
- sortByMethod(field, reverse, primer) {
- const key = primer
- ? function (x) {
- return primer(x[field]);
- }
- : function (x) {
- return x[field];
+ editProductLimit(event) {
+ //add by Wang Xueqin 2023/05/05
+ //let url =
+ // '/LexProductLimitEdit?accountid=' +
+ // this.accountId +
+ // '&userPro_Type=' +
+ // this.userPro_Type;
+ let url = "/lexproductlimitedit?accountid=" + this.accountId + "&userPro_Type=" + this.userPro_Type;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
};
-
- return function (a, b) {
- a = key(a);
- b = key(b);
- return reverse * ((a > b) - (b > a));
- };
- }
-
- onHandleSort(event) {
- console.log("Sort");
- this.sortBy = event.detail.fieldName;
- this.sortDirection = event.detail.sortDirection;
- this.currentPageToken = 0;
- console.log("this.sortBy = " + this.sortBy);
- console.log("this.sortDirection = " + this.sortDirection);
- const { fieldName: sortedBy, sortDirection } = event.detail;
- const cloneData = [...this.pageRecords];
- cloneData.sort(
- this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1)
- );
- this.pageRecords = cloneData;
- this.sortDirection = sortDirection;
- this.sortedBy = sortedBy;
- }
- //鍒嗛〉
- handlePaginatorChange(event) {
- this.recordsToDisplay = event.detail.recordsToDisplay;
- this.preSelected = event.detail.preSelected;
- if (this.recordsToDisplay && this.recordsToDisplay > 0) {
- this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
- } else {
- this.rowNumberOffset = 0;
+ this[NavigationMixin.Navigate](config);
}
- }
- handlePrevious() {
- this.currentPageToken =
- Number(this.currentPageToken) - Number(this.pageSize);
- this.init();
- }
- handleNext() {
- this.currentPageToken =
- Number(this.currentPageToken) + Number(this.pageSize);
- this.init();
- }
- handleFirst() {
- this.currentPageToken = 0;
- this.init();
- }
+ //鏂板缓娑堣�楀搧璁㈠崟
+ newOrder() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consumable_order__c',
+ actionName: 'new'
+ },
+ state: {
+ useRecordTypeCheck: 1
+ }
+ });
+ }
- handleLast() {
- this.currentPageToken =
- this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
- this.init();
- }
+ 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);
+ }
+ //鎺掑簭
- handlePageschange(event) {
- console.log(event.detail);
- this.pageSize = event.detail;
- this.currentPageToken = 0;
- this.init();
- }
- get previousButtonDisabled() {
- return this.currentPageToken === 0;
- }
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
- get nextButtonDisabled() {
- return this.nextPageToken === undefined;
- }
-}
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+ console.log('Sort');
+ this.sortBy = event.detail.fieldName;
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy);
+ console.log('this.sortDirection = ' + this.sortDirection);
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.pageRecords];
+ cloneData.sort(
+ this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)
+ );
+ this.pageRecords = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ //鍒嗛〉
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
+ }
+ }
+ handlePrevious() {
+ this.currentPageToken =
+ Number(this.currentPageToken) - Number(this.pageSize);
+ this.init();
+ }
+
+ handleNext() {
+ this.currentPageToken =
+ Number(this.currentPageToken) + Number(this.pageSize);
+ this.init();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.init();
+ }
+
+ handleLast() {
+ this.currentPageToken =
+ this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.init();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.init();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
index a73f3c5..f226a76 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
@@ -279,6 +279,7 @@
onfirst={handleFirst}
onlast={handleLast}
page-size-options={pageSizeOptions}
+ default-page-size={pageSize}
previous-button-disabled={previousButtonDisabled}
next-button-disabled={nextButtonDisabled}
record-start={recordStart}
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
index 6dafd81..0b082e5 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -15,7 +15,7 @@
//鍒嗛〉start
@track sortBy = '';
//@track sortDirection = "asc";
- @track pageSize = 10;
+ @track pageSize = 200;
error;
records;
currentPageToken = 0;
@@ -25,7 +25,7 @@
@track pageNumber = 1;
@track paginationVisibility = false;
@track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
+ pageSizeOptions = [100, 200, 300];
@track recordStart = 0;
@track recordEnd = 0;
//end
diff --git a/force-app/main/default/lwc/paginator/paginator.html b/force-app/main/default/lwc/paginator/paginator.html
index 3add3b3..d5faa66 100644
--- a/force-app/main/default/lwc/paginator/paginator.html
+++ b/force-app/main/default/lwc/paginator/paginator.html
@@ -6,8 +6,8 @@
<label class="slds-text-color_weak slds-p-horizontal_x-small" for="recordsPerPage">Page Size:</label>
<div class="slds-select_container">
<select class="slds-select" id="recordsPerPage" onchange={handleRecordsPerPage}>
- <template for:each={pageSizeOptions} for:item="option">
- <option key={option} value={option}>{option}</option>
+ <template for:each={pageOptionsList} for:item="option">
+ <option key={option.value} value={option.value} selected={option.select}>{option.value}</option>
</template>
</select>
</div>
diff --git a/force-app/main/default/lwc/paginator/paginator.js b/force-app/main/default/lwc/paginator/paginator.js
index 290042f..ec41f0b 100644
--- a/force-app/main/default/lwc/paginator/paginator.js
+++ b/force-app/main/default/lwc/paginator/paginator.js
@@ -1,4 +1,4 @@
-import { LightningElement, api } from 'lwc';
+import { LightningElement, api ,track} from 'lwc';
export default class Paginator extends LightningElement {
@api previousButtonDisabled;
@@ -7,6 +7,19 @@
@api recordEnd;
@api totalRecords;
@api pageSizeOptions;
+ @track pageOptionsList = [];
+ @api defaultPageSize;
+
+ connectedCallback(){
+ // this.defaultPageSize = 200;
+ for(var i = 0; i < this.pageSizeOptions.length; i++){
+ var iselect = false;
+ if(this.defaultPageSize != null && this.pageSizeOptions[i] == this.defaultPageSize){
+ iselect = true;
+ }
+ this.pageOptionsList.push({value : this.pageSizeOptions[i], select : iselect});
+ }
+ }
handlePrevious() {
this.dispatchEvent(new CustomEvent('previous'));
diff --git a/force-app/main/default/pages/DealerInquiryModifyState.page b/force-app/main/default/pages/DealerInquiryModifyState.page
index 9041254..a8a3245 100644
--- a/force-app/main/default/pages/DealerInquiryModifyState.page
+++ b/force-app/main/default/pages/DealerInquiryModifyState.page
@@ -1,338 +1,169 @@
-<apex:page
- controller="DealerInquiryModifyStateController"
- docType="html-5.0"
- showHeader="false"
- sidebar="false"
- id="allPage"
- action="{!init}"
- lightningStyleSheets="true"
->
- <head>
- <title>缁忛攢鍟嗘壒閲忎慨鏀硅浠风姸鎬�</title>
+<apex:page controller="DealerInquiryModifyStateController" docType="html-5.0" showHeader="false" sidebar="false" id="allPage" action="{!init}" lightningStyleSheets="true">
+<head>
+<title>缁忛攢鍟嗘壒閲忎慨鏀硅浠风姸鎬�</title>
- <apex:stylesheet value="{!URLFOR($Resource.blockUIcssOpp)}" />
- <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" />
- <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
- <!-- TODO 鐩墠闄や簡markOpp()鏂规硶锛屽叾浠栨柟娉曢�氱敤锛宩s鏀瑰悕涓哄懆浼氬叡閫歫s锛屽悇涓敾闈釜鍒玧s鍐嶈嚜宸卞垱寤簀s -->
- <apex:includeScript value="{!URLFOR($Resource.Dealer_enquiryJs1)}" />
+<apex:stylesheet value="{!URLFOR($Resource.blockUIcssOpp)}"/>
+<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<!-- TODO 鐩墠闄や簡markOpp()鏂规硶锛屽叾浠栨柟娉曢�氱敤锛宩s鏀瑰悕涓哄懆浼氬叡閫歫s锛屽悇涓敾闈釜鍒玧s鍐嶈嚜宸卞垱寤簀s -->
+<apex:includeScript value="{!URLFOR($Resource.Dealer_enquiryJs1)}"/>
- <style>
- td .dateFormat {
+<style>
+ td .dateFormat {
display: none;
- }
+ }
+
+ div.inline { float:left; }
- div.inline {
- float: left;
- }
+ .clearBoth { clear:both; }
- .clearBoth {
- clear: both;
- }
+ div.reportBlock table.list {
+ width:auto;
+ }
- div.reportBlock table.list {
- width: auto;
- }
-
- div#out_Div {
- /* 銇撱亾銇儤銉冦儉銈掓牸绱� */
- position: relative;
+ div#out_Div { /* 銇撱亾銇儤銉冦儉銈掓牸绱� */
+ position:relative;
overflow: hidden;
- float: left;
- width: 50% !important;
- }
+ float:left;
+ width:50% !important;
+ }
- div#out_Div_L {
- position: relative;
- overflow: hidden;
- float: left;
- width: 50% !important;
- border-right: 2px solid #808383;
- }
+ div#out_Div_L {
+ position:relative;
+ overflow:hidden;
+ float:left;
+ width:50% !important;
+ border-right:2px solid #808383
+ }
- div#in_Div {
- /* tbody銇屽叆銇c仸銇勩倠銆傘亾銇撱亴銈广偗銉兗銉璞�*/
- position: relative;
- overflow: auto; /*銈广偗銉兗銉儛銉�*/
- float: left;
- width: 50% !important;
+ div#in_Div {/* tbody銇屽叆銇c仸銇勩倠銆傘亾銇撱亴銈广偗銉兗銉璞�*/
+ position:relative;
+ overflow: auto; /*銈广偗銉兗銉儛銉�*/
+ float:left;
+ width:50% !important;
height: 600px;
- }
+ }
- div#in_Div_L {
- position: relative;
- overflow-x: auto;
+ div#in_Div_L {
+ position:relative;
+ overflow-x:auto;
overflow-y: hidden;
- float: left;
- width: 50% !important;
+ float:left;
+ width:50% !important;
height: 600px;
- border-right: 2px solid #808383;
- }
+ border-right:2px solid #808383
+ }
- body .pbBody table.list tr.headerRow td {
+ body .pbBody table.list tr.headerRow td {
box-sizing: border-box;
- text-align: center;
- font-weight: normal;
- padding: 0px 0px 0px 1px;
- }
+ text-align:center;font-weight:normal;
+ padding:0px 0px 0px 1px;
+ }
- body .pbBody table.list tr.headerRow td.header1 {
- text-align: center;
- font-weight: normal;
- padding: 0px 0px 0px 0px;
- }
+ body .pbBody table.list tr.headerRow td.header1 {
+ text-align:center;font-weight:normal;
+ padding:0px 0px 0px 0px;
+ }
- body .pbBody table.list tr.dataRow td {
+ body .pbBody table.list tr.dataRow td {
box-sizing: border-box;
- padding: 0px 0px 0px 1px;
- border-width: 0px 0px 1px 0px;
- vertical-align: middle;
- word-break: break-all;
- }
+ padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
+ }
- body .pbBody table.list tr.dataRow td.dataCellBorder {
+ body .pbBody table.list tr.dataRow td.dataCellBorder {
/* 銇勩倝銇亜銆佷娇銇c仸銇勩仾銇� */
- padding: 0px 0px 0px 1px;
- border-width: 0px 0px 1px 0px;
- vertical-align: middle;
- word-break: break-all;
- }
+ padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
+ }
- body .pbBody table.list tr.dataRow td.dataCellBorder1 {
- padding: 0px 0px 0px 1px;
- border-width: 0px 0px 1px 1px;
- vertical-align: middle;
- word-break: break-all;
- }
+ body .pbBody table.list tr.dataRow td.dataCellBorder1 {
+ padding:0px 0px 0px 1px;
+ border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;
+ }
- @-moz-document url-prefix() {
- body .pbBody table.list tr.dataRow td.dataCellBorder1 {
- padding: 0px 0px 0px 0px;
- border-width: 0px 0px 1px 1px;
- vertical-align: middle;
- word-break: break-all;
- }
- }
+ @-moz-document url-prefix() {
+ body .pbBody table.list tr.dataRow td.dataCellBorder1 {padding:0px 0px 0px 0px; border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;}
+ }
- table.list td {
- width: 100px;
- }
+ table.list td {width:100px; }
- table.list td select {
- width: 95%;
- }
+ table.list td select {width:95%;}
- table.list td input {
- width: 95%;
- }
+ table.list td input {width:95%;}
- table.list td textarea {
- height: 50px;
- width: 90%;
- }
+ table.list td textarea {
+ height:50px;
+ width:90%;
+ }
- table.list .col_OCSM_Opportunity_No__c {
- width: 120px;
- }
- table.list .col_Strategic_department_Class_Name__c {
- width: 80px;
- }
- table.list .col_Change_To_Opportunity_T__c {
- width: 155px;
- }
- table.list .col_Department_Cateogy__c {
- width: 90px;
- }
- table.list .col_Department_Name_Text__c {
- width: 80px;
- }
- table.list .col_Hospital_City_Master__c {
- width: 70px;
- }
- table.list .col_Agency_Hospital__c {
- width: 146px;
- }
- /*table.list .col_Oly_Forecasted_Date__c {width: 125px;}*/
- table.list .col_Oly_Forecast_this_month__c {
- width: 135px;
- }
- table.list .col_Oly_NM_Forecast__c {
- width: 135px;
- }
- table.list .col_Oly_Forecast_last_month__c {
- width: 135px;
- }
- table.list .col_Oly_Inquiry_Stage__c {
- width: 95px;
- }
- table.list .col_Oly_Authorized_DB_No__c {
- width: 95px;
- }
- table.list .col_Oly_Inquiry_Status2__c {
- width: 95px;
- }
- table.list .col_Oly_Inquiry_Status1__c {
- width: 50px;
- }
- table.list .col_Name {
- width: 139px;
- } /*瀹㈡埛鍚�*/
- table.list .col_Salesdepartment_HP__c {
- width: 95px;
- } /*閿�鍞湰閮�(鍖婚櫌)*/
- table.list .col_State_Master__c {
- width: 80px;
- } /*鐪�*/
- table.list .col_HP_146POCM_Category_From_Dept__c {
- width: 100px;
- } /*OCM鍒嗙被(鍏紡)*/
- table.list .col_Salesdepartment_DeptClass__c {
- width: 120px;
- } /*閿�鍞湰閮�(绉戝鍒嗙被)*/
- table.list .col_OCM_man_province_HP__c {
- width: 90px;
- } /*OCM绠$悊鐪�*/
- table.list .col_City_Master__c {
- width: 80px;
- } /*甯�*/
- table.list .col_Grade__c {
- width: 70px;
- } /*鏀垮簻绛夌骇*/
- table.list .col_Attribute_Type__c {
- width: 90px;
- } /*鍖婚櫌鎵�灞炴�ц川*/
- table.list .col_Speciality_Type__c {
- width: 90px;
- } /*鍖婚櫌涓撲笟鍖哄垎*/
- table.list .col_Service_customer__c {
- width: 120px;
- } /*鍙绾︽湇鍔″悎鍚屽鎴�*/
- table.list .col_BF_owner__c {
- width: 100px;
- } /*鍛煎惛绉戜富鎷呭綋*/
- table.list .col_ENT_owner_ID__c {
- width: 100px;
- } /*鑰抽蓟鍠夌涓绘媴褰�*/
- table.list .col_GI_Main__c {
- width: 100px;
- } /*娑堝寲绉戜富鎷呭綋*/
- table.list .col_URO_owner_ID__c {
- width: 100px;
- } /*娉屽翱绉戜富鎷呭綋*/
- table.list .col_SP_Main__c {
- width: 100px;
- } /*鏅绉戜富鎷呭綋*/
- table.list .col_GYN_owner__c {
- width: 100px;
- } /*濡囩涓绘媴褰�*/
- table.list .col_Hospital_name_link__c {
- width: 100px;
- } /*鍖婚櫌鍚�(閾炬帴)*/
- table.list .col_Segment__c {
- width: 90px;
- } /*OCM绉戝绛夌骇*/
- table.list .col_Department_Budget_Sum_Price__c {
- width: 128px;
- } /*绉戝棰勭畻鎬婚噾棰�(鍏�)*/
- table.list .col_Target_amount_CV290__c {
- width: 118px;
- } /*鐩爣鏁帮細CV-290*/
- table.list .col_OPD_CV290__c {
- width: 118px;
- } /*OPD瀵硅薄锛欳V-290*/
- table.list .col_Target_amount_EUME2__c {
- width: 118px;
- } /*鐩爣鏁帮細EU-ME2*/
- table.list .col_OPD_EUME2__c {
- width: 118px;
- } /*OPD瀵硅薄锛欵U-ME2*/
- table.list .col_Target_amount_CV170__c {
- width: 118px;
- } /*鐩爣鏁帮細CV-170*/
- table.list .col_OPD_CV170__c {
- width: 118px;
- } /*OPD瀵硅薄锛欳V-170*/
- table.list .col_Target_amount_OERAW__c {
- width: 118px;
- } /*鐩爣鏁帮細OER-AW*/
- table.list .col_OPD_OERAW__c {
- width: 118px;
- } /*OPD瀵硅薄锛歄ER-AW*/
- table.list .col_Target_amount_GW__c {
- width: 118px;
- } /*鐩爣鏁帮細瀵间笣(GW)*/
- table.list .col_OPD_GW__c {
- width: 118px;
- } /*OPD瀵硅薄锛氬涓�(GW)*/
- table.list .col_Target_amount_OTVS400__c {
- width: 118px;
- } /*鐩爣鏁帮細OTV-S400*/
- table.list .col_OPD_OTVS400__c {
- width: 118px;
- } /*OPD瀵硅薄锛歄TV-S400*/
- table.list .col_Target_amount_CHS400XZ__c {
- width: 118px;
- } /*鐩爣鏁帮細CH-S400-XZ*/
- table.list .col_OPD_CHS400XZ__c {
- width: 118px;
- } /*OPD瀵硅薄锛欳H-S400-XZ*/
- table.list .col_Target_amount_3D__c {
- width: 118px;
- } /*鐩爣鏁帮細3D*/
- table.list .col_OPD_3D__c {
- width: 118px;
- } /*OPD瀵硅薄锛�3D*/
- table.list .col_Target_amount_OTVS190__c {
- width: 118px;
- } /*鐩爣鏁帮細OTV-S190*/
- table.list .col_OPD_OTVS190__c {
- width: 118px;
- } /*OPD瀵硅薄锛歄TV-S190*/
- table.list .col_Target_amount_CV190__c {
- width: 118px;
- } /*鐩爣鏁帮細CV-190*/
- table.list .col_OPD_CV190__c {
- width: 118px;
- } /*OPD瀵硅薄锛欳V-190*/
- table.list .col_Target_amount_UCES3__c {
- width: 118px;
- } /*鐩爣鏁帮細UCES-3*/
- table.list .col_OPD_UCES3__c {
- width: 118px;
- } /*OPD瀵硅薄锛歎CES-3*/
- table.list .col_Target_amount_USG400__c {
- width: 118px;
- } /*鐩爣鏁帮細USG-400*/
- table.list .col_OPD_USG400__c {
- width: 118px;
- } /*OPD瀵硅薄锛歎SG-400*/
- table.list .col_Hospital_Name__c {
- width: 139px;
- } /*鍖婚櫌鍚�*/
- table.list .col_Department_Name__c {
- width: 60px;
- } /*绉戝鍚嶇О*/
- table.list .col_Province_formula__c {
- width: 78px;
- } /*鐪�(鍏紡)*/
- table.list .col_X2_Largescale_Project__c {
- width: 78px;
- } /****鏈夋棤涓ゅ勾浠ュ唴澶ч」鐩噰璐�*/
- table.list .col_Ideal_Image_Sales__c {
- width: 148px;
- } /****鎷撳睍銉诲紑鎷撹鍒�/钀ラ攢鏂规(閿�鍞�)*/
- table.list .col_Review_Sales__c {
- width: 148px;
- } /****杩涘睍鎯呭喌(閿�鍞�)*/
- table.list .col_Submit_proposal_document__c {
- width: 58px;
- } /*鏄惁鎻愪氦鎻愭涔�*/
- table.list .col_OPP_Flag__c {
- width: 58px;
- }
- table.list .col_Sales_activity_plan__c {
- width: 178px;
- } /*娲诲姩璁″垝(閿�鍞�)*/
- /*table.list .col_Link1 {width:58px;}
+ table.list .col_OCSM_Opportunity_No__c {width:120px;}
+ table.list .col_Strategic_department_Class_Name__c{width:80px;}
+ table.list .col_Change_To_Opportunity_T__c {width:155px;}
+ table.list .col_Department_Cateogy__c {width: 90px;}
+ table.list .col_Department_Name_Text__c {width: 80px;}
+ table.list .col_Hospital_City_Master__c {width: 70px;}
+ table.list .col_Agency_Hospital__c {width: 146px;}
+ /*table.list .col_Oly_Forecasted_Date__c {width: 125px;}*/
+ table.list .col_Oly_Forecast_this_month__c {width: 135px;}
+ table.list .col_Oly_NM_Forecast__c {width: 135px;}
+ table.list .col_Oly_Forecast_last_month__c {width: 135px;}
+ table.list .col_Oly_Inquiry_Stage__c {width: 95px;}
+ table.list .col_Oly_Authorized_DB_No__c {width: 95px;}
+ table.list .col_Oly_Inquiry_Status2__c {width: 95px;}
+ table.list .col_Oly_Inquiry_Status1__c {width: 50px;}
+ table.list .col_Name {width:139px;} /*瀹㈡埛鍚�*/
+ table.list .col_Salesdepartment_HP__c {width:95px;} /*閿�鍞湰閮�(鍖婚櫌)*/
+ table.list .col_State_Master__c{width:80px;} /*鐪�*/
+ table.list .col_HP_146POCM_Category_From_Dept__c {width:100px;} /*OCM鍒嗙被(鍏紡)*/
+ table.list .col_Salesdepartment_DeptClass__c{width:120px;} /*閿�鍞湰閮�(绉戝鍒嗙被)*/
+ table.list .col_OCM_man_province_HP__c{width:90px;} /*OCM绠$悊鐪�*/
+ table.list .col_City_Master__c{width:80px;} /*甯�*/
+ table.list .col_Grade__c {width:70px;} /*鏀垮簻绛夌骇*/
+ table.list .col_Attribute_Type__c{width:90px;} /*鍖婚櫌鎵�灞炴�ц川*/
+ table.list .col_Speciality_Type__c{width:90px;} /*鍖婚櫌涓撲笟鍖哄垎*/
+ table.list .col_Service_customer__c{width:120px;} /*鍙绾︽湇鍔″悎鍚屽鎴�*/
+ table.list .col_BF_owner__c{width:100px;} /*鍛煎惛绉戜富鎷呭綋*/
+ table.list .col_ENT_owner_ID__c{width:100px;} /*鑰抽蓟鍠夌涓绘媴褰�*/
+ table.list .col_GI_Main__c{width:100px;} /*娑堝寲绉戜富鎷呭綋*/
+ table.list .col_URO_owner_ID__c{width:100px;} /*娉屽翱绉戜富鎷呭綋*/
+ table.list .col_SP_Main__c{width:100px;} /*鏅绉戜富鎷呭綋*/
+ table.list .col_GYN_owner__c{width:100px;} /*濡囩涓绘媴褰�*/
+ table.list .col_Hospital_name_link__c{width:100px;} /*鍖婚櫌鍚�(閾炬帴)*/
+ table.list .col_Segment__c{width:90px;} /*OCM绉戝绛夌骇*/
+ table.list .col_Department_Budget_Sum_Price__c {width:128px;} /*绉戝棰勭畻鎬婚噾棰�(鍏�)*/
+ table.list .col_Target_amount_CV290__c {width:118px;} /*鐩爣鏁帮細CV-290*/
+ table.list .col_OPD_CV290__c {width:118px;} /*OPD瀵硅薄锛欳V-290*/
+ table.list .col_Target_amount_EUME2__c {width:118px;} /*鐩爣鏁帮細EU-ME2*/
+ table.list .col_OPD_EUME2__c {width:118px;} /*OPD瀵硅薄锛欵U-ME2*/
+ table.list .col_Target_amount_CV170__c {width:118px;} /*鐩爣鏁帮細CV-170*/
+ table.list .col_OPD_CV170__c {width:118px;} /*OPD瀵硅薄锛欳V-170*/
+ table.list .col_Target_amount_OERAW__c {width:118px;} /*鐩爣鏁帮細OER-AW*/
+ table.list .col_OPD_OERAW__c {width:118px;} /*OPD瀵硅薄锛歄ER-AW*/
+ table.list .col_Target_amount_GW__c {width:118px;} /*鐩爣鏁帮細瀵间笣(GW)*/
+ table.list .col_OPD_GW__c {width:118px;} /*OPD瀵硅薄锛氬涓�(GW)*/
+ table.list .col_Target_amount_OTVS400__c {width:118px;} /*鐩爣鏁帮細OTV-S400*/
+ table.list .col_OPD_OTVS400__c {width:118px;} /*OPD瀵硅薄锛歄TV-S400*/
+ table.list .col_Target_amount_CHS400XZ__c {width:118px;} /*鐩爣鏁帮細CH-S400-XZ*/
+ table.list .col_OPD_CHS400XZ__c {width:118px;} /*OPD瀵硅薄锛欳H-S400-XZ*/
+ table.list .col_Target_amount_3D__c {width:118px;} /*鐩爣鏁帮細3D*/
+ table.list .col_OPD_3D__c {width:118px;} /*OPD瀵硅薄锛�3D*/
+ table.list .col_Target_amount_OTVS190__c {width:118px;} /*鐩爣鏁帮細OTV-S190*/
+ table.list .col_OPD_OTVS190__c {width:118px;} /*OPD瀵硅薄锛歄TV-S190*/
+ table.list .col_Target_amount_CV190__c {width:118px;} /*鐩爣鏁帮細CV-190*/
+ table.list .col_OPD_CV190__c {width:118px;} /*OPD瀵硅薄锛欳V-190*/
+ table.list .col_Target_amount_UCES3__c {width:118px;} /*鐩爣鏁帮細UCES-3*/
+ table.list .col_OPD_UCES3__c {width:118px;} /*OPD瀵硅薄锛歎CES-3*/
+ table.list .col_Target_amount_USG400__c {width:118px;} /*鐩爣鏁帮細USG-400*/
+ table.list .col_OPD_USG400__c {width:118px;} /*OPD瀵硅薄锛歎SG-400*/
+ table.list .col_Hospital_Name__c {width:139px;} /*鍖婚櫌鍚�*/
+ table.list .col_Department_Name__c {width:60px;} /*绉戝鍚嶇О*/
+ table.list .col_Province_formula__c {width:78px;} /*鐪�(鍏紡)*/
+ table.list .col_X2_Largescale_Project__c {width:78px;} /****鏈夋棤涓ゅ勾浠ュ唴澶ч」鐩噰璐�*/
+ table.list .col_Ideal_Image_Sales__c {width:148px;} /****鎷撳睍銉诲紑鎷撹鍒�/钀ラ攢鏂规(閿�鍞�)*/
+ table.list .col_Review_Sales__c {width:148px;} /****杩涘睍鎯呭喌(閿�鍞�)*/
+ table.list .col_Submit_proposal_document__c {width:58px;} /*鏄惁鎻愪氦鎻愭涔�*/
+ table.list .col_OPP_Flag__c {width:58px;}
+ table.list .col_Sales_activity_plan__c {width:178px;} /*娲诲姩璁″垝(閿�鍞�)*/
+ /*table.list .col_Link1 {width:58px;}
table.list .col_Link2 {width:58px;}
table.list .col_Link3 {width:58px;}
table.list .col_Link4 {width:58px;}
@@ -340,598 +171,365 @@
table.list .col_Link6 {width:58px;}
table.list .col_Link7 {width:58px;}
table.list .col_Link8 {width:58px;}*/
- body .pbBody table.list tr.headerRow td.colViewing {
- /* 銉囥儠銈┿儷銉堝�ゃ�佹渶灏忓寲銈€偆銈炽兂銈掕〃绀� */
- background-image: url("{!URLFOR($Resource.IconResizeMinus_5)}");
- background-repeat: no-repeat;
- }
- body .pbBody table.list tr.headerRow td.colUnHideIcon {
+ body .pbBody table.list tr.headerRow td.colViewing {
+ /* 銉囥儠銈┿儷銉堝�ゃ�佹渶灏忓寲銈€偆銈炽兂銈掕〃绀� */
+ background-image:url('{!URLFOR($Resource.IconResizeMinus_5)}') ;
+ background-repeat:no-repeat;
+ }
+ body .pbBody table.list tr.headerRow td.colUnHideIcon {
/* 鏈�澶у寲銈€偆銈炽兂銈掕〃绀� */
- background-image: url("{!URLFOR($Resource.IconResizePlus_5)}");
- background-repeat: no-repeat;
- }
- body .pbBody table.list tr.headerRow td.col_Scroll {
- width: 0px;
- padding: 0px;
- border-width: 0px;
- }
- body .pbBody table.list tr.dataRow td.col_Scroll {
- width: 0px;
- padding: 0px;
- border-width: 0px;
- }
- /*.zxk{
+ background-image:url('{!URLFOR($Resource.IconResizePlus_5)}');
+ background-repeat:no-repeat;
+ }
+ body .pbBody table.list tr.headerRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
+ body .pbBody table.list tr.dataRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
+ /*.zxk{
margin-bottom: 3px;
}*/
- .buttonStyle {
+ .buttonStyle{
font-size: 14px !important;
- font-family: "sans-serif" !important;
- font-weight: 500 !important;
+ font-family: 'sans-serif' !important;
+ font-weight:500 !important;
width: 70px !important;
height: 32px !important;
border-radius: 4px !important;
opacity: 1 !important;
- background: #090f84 !important;
- color: #ffffff !important;
- }
- </style>
- <script type="text/javascript">
- var heightAjustment = 120;
- var widthAjustment = 30;
- function setChangeFlgRight(cnt) {
- document.getElementById(
- "allPage:allForm:oppBlock:oppTable:" + cnt + ":changeFlgRt"
- ).value = 1;
- }
- </script>
- </head>
- <apex:slds />
- <div id="spinner" class="slds-spinner_container" style="display: none">
- <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>
+ background:#090F84 !important;
+ color:#FFFFFF !important;
+
+ }
+
+
+</style>
+<script type="text/javascript">
+var heightAjustment = 120;
+var widthAjustment = 30;
+function setChangeFlgRight(cnt) {
+ document.getElementById('allPage:allForm:oppBlock:oppTable:' + cnt + ':changeFlgRt').value = 1;
+
+}
+
+</script>
+</head>
+ <apex:slds />
+ <div id="spinner" class="slds-spinner_container" style="display:none;">
+ <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>
- </div>
- <apex:form id="allForm">
- <apex:actionFunction
- name="saveAndSearch"
- action="{!save}"
- rerender="allPanel"
- oncomplete="closeSpinner();expandAll();"
- >
- <apex:param name="firstParam" assignTo="{!saveType}" value="" />
- </apex:actionFunction>
- <apex:actionFunction
- name="saveAndSort"
- action="{!save}"
- rerender="allPanel"
- oncomplete="closeSpinner();expandAll();"
- >
- <apex:param name="firstParam" assignTo="{!saveType}" value="" />
- <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
- </apex:actionFunction>
- <apex:actionFunction
- name="searchOpp"
- action="{!chick}"
- rerender="allPanel"
- oncomplete="closeSpinner();expandAll();"
- />
- <apex:actionFunction
- name="sortTable"
- action="{!sortTable}"
- rerender="allPanel"
- oncomplete="closeSpinner();expandAll();"
- >
- <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
- </apex:actionFunction>
- <apex:outputPanel id="allPanel">
- <div id="zxk" style="margin-bottom: -15px">
- <apex:pageBlock id="searchBlock" mode="maindetail">
- <table
- style="border-bottom-width: 0px; font-size: 14px; color: #696969"
- >
- <tr>
- <td width="283px">
- <div style="color: #696969">
- 缁忛攢鍟嗗尰闄�
- <apex:inputText
- styleClass="slds-input"
- value="{!accSearch}"
- style="width: 170px"
- />
- </div>
- </td>
- <td width="250px">
- <div style="color: #696969">
- 閿�鍞媴褰�
- <apex:inputText
- styleClass="slds-input"
- value="{!aooSearch}"
- style="width: 150px"
- />
- </div>
- </td>
- <td width="230px">
- <div style="color: #696969">
- 鏄剧ず
- <apex:selectList
- styleClass="slds-input slds-combobox__input"
- style="width: 100px"
- value="{!limits}"
- size="1"
- onchange="searchOppJs_Account();return false;"
- >
- <apex:selectOptions value="{!limitOpts}" />
- </apex:selectList>
- 鏉℃暟鎹�
- </div>
- </td>
- <td>
- <a
- href="#"
- onclick="expandAll();return false;"
- style="text-decoration: underline; color: #696969"
- >鍏ㄩ儴灞曞紑</a
- >
- </td>
- </tr>
- </table>
- <p style="height: 10px"></p>
- <table
- style="
- border-bottom-width: 0px;
- font-size: 12px;
- font-size: 14px;
- color: #696969;
- "
- >
- <tr>
- <td width="220px">
- <div style="color: #696969">
- <font>鏁� 鎹� 瀛� 娈�</font
- >
- <apex:selectList
- styleClass="slds-input slds-combobox__input"
- value="{!numtext1}"
- size="1"
- style="width: 110px"
- >
- <apex:selectOptions value="{!textOpts}" />
- </apex:selectList>
- </div>
- </td>
- <td width="130px">
- <apex:selectList
- styleClass="slds-input slds-combobox__input"
- value="{!numtext2}"
- size="1"
- style="width: 110px"
- >
- <apex:selectOptions value="{!equalOpts}" />
- </apex:selectList>
- </td>
- <td width="183px">
- <apex:inputText
- styleClass="slds-input"
- style="width: 150px"
- value="{!numtext}"
- />
- </td>
- <td width="188px">
- <!-- slds-button slds-button_brand -->
- <apex:commandButton
- styleClass="buttonStyle"
- value="妫�绱�"
- onclick="searchOppJs_Account();return false;"
- style="height: 30px; width: 70px"
- />
- <apex:commandButton
- styleClass="buttonStyle"
- action="{!save}"
- value="淇濆瓨"
- rerender="allPanel"
- onclick="showSpinner();"
- oncomplete="closeSpinner();expandAll();"
- style="height: 30px; width: 70px"
- />
- </td>
- <td>
- <!-- <apex:pageMessages /> -->
- <!-- add by Link 2023-6-2 -->
- <apex:outputPanel
- rendered="{! remindMsg != '' && remindMsg != null}"
- >
- <div
- style="
- border: 1px solid #d4d4d4;
- height: 32px;
- border-radius: 5px;
- color: #ff6a00;
- font-size: 18px;
- "
- >
- <span
- class="slds-icon_container slds-icon-custom-custom53 slds-icon-text-default"
- >
- <svg aria-hidden="true" class="slds-icon">
- <use
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xlink:href="/apexpages/slds/latest/assets/icons/custom-sprite/svg/symbols.svg#custom53"
- ></use>
- </svg>
- <span class="slds-assistive-text">Custom 53</span>
- </span>
- <strong style="padding-top: 2px"> {!remindMsg}</strong>
- </div>
- </apex:outputPanel>
- </td>
- </tr>
- </table>
- </apex:pageBlock>
- </div>
- <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> -->
- <apex:pageBlock id="oppBlock" mode="maindetail">
- <!-- <apex:pageblocksection columns="1" id="oppSection"> -->
- <apex:outputPanel>
- <apex:inputHidden id="oppCount" value="{!oppCount}" />
-
- <div id="out_Div_L">
- <table
- class="list"
- style="
- border-bottom-width: 0px;
- width: 1100px;
- font-size: 14px !important;
- border-spacing: 0;
- "
- border=""
- id="tableHeader"
- >
- <tr class="dataRow" height="1px">
- <apex:variable value="{!0}" var="cnt" />
- <apex:repeat value="{!titleRight}" var="t">
- <td class="col_{!columnRightCss[cnt]}"></td>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- <td id="cell_Scroll" class="col_Scroll"></td>
- </tr>
- <tr class="headerRow" height="30px">
- <apex:variable value="{!0}" var="cnt" />
- <apex:repeat value="{!titleRight}" var="t">
- <td class="col_{!columnRightCss[cnt]}">
- <a
- href="#"
- onclick="sortTableJs_Account1('{!cnt + titleLeft.size}');return false;"
- style="
- text-decoration: underline;
- color: black;
- font-size: 14px !important;
- font-weight: bold;
- "
- ><apex:outputText value="{!t}" /></a
- >{!sortOrder[cnt + titleLeft.size]}
- </td>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- <!-- <td id="cell_Scroll" class="col_Scroll"></td> -->
- </tr>
- </table>
- </div>
- <div id="out_Div">
- <table
- class="list"
- style="
- border-bottom-width: 0px;
- width: 2000px;
- font-size: 14px !important;
- border-spacing: 0;
- "
- border=""
- id="tableHeader_L"
- >
- <tr class="dataRow" height="1px">
- <apex:variable value="{!0}" var="cnt" />
- <apex:repeat value="{!titleLeft}" var="t">
- <td class="col_{!columnLeftCss[cnt]}"></td>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- </tr>
- <tr class="headerRow" height="30px">
- <apex:variable value="{!0}" var="cnt" />
- <apex:repeat value="{!titleLeft}" var="t">
- <td class="col_{!columnLeftCss[cnt]}">
- <a
- href="#"
- onclick="sortTableJs_Account1('{!cnt}');return false;"
- style="
- text-decoration: underline;
- color: black;
- font-size: 14px !important;
- font-weight: bold;
- "
- ><apex:outputText value="{!t}" /></a
- >{!sortOrder[cnt]}
- </td>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- <!-- <td id="cell_Scroll" class="col_Scroll"></td> -->
- </tr>
- </table>
- </div>
- <!-- out_Div -->
- <div style="clear: both; height: 0px"></div>
- <div id="in_Div_L">
- <table
- class="list"
- style="
- border-bottom-width: 0px;
- width: 1100px;
- font-size: 13px;
- border-spacing: 0;
- "
- border=""
- id="tableData"
- >
- <apex:variable value="{!1}" var="cnt" />
- <apex:repeat value="{!oppRecords}" var="or" id="oppTable">
- <tr
- class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}"
- style="height: 35px"
- onmouseover="if (window.hiOn){hiOn(this);} "
- onmouseout="if (window.hiOff){hiOff(this);} "
- onblur="if (window.hiOff){hiOff(this);}"
- onfocus="if (window.hiOn){hiOn(this);}"
- >
- <apex:variable value="{!0}" var="cnt_3" />
- <apex:repeat value="{!columnsRightApi}" var="c">
- <td
- class="dataCellBorder1 col_{!columnRightCss[cnt_3]} {!cnt}_col_{!columnRightCss[cnt_3]}"
- >
- <!-- vivek start -->
- <!-- <apex:outputLink rendered="{!c[0]=='Name'}" value="/{!or.opp.Id}" target="LINK_{!or.opp.Id}"><apex:outputField rendered="{!c[0]=='Name'}" value="{!or.opp[c[0]]}" /></apex:outputLink> -->
- <!-- vivek end -->
- <!-- <apex:outputField id="q1111111111" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && or.opp.Id <> null && c[0] <> 'Name' && (c[0] <> 'Opp_Changed_Field__c' ||(c[0] == 'Opp_Changed_Field__c' &&
+ <apex:form id="allForm">
+ <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allPanel" oncomplete="closeSpinner();expandAll();">
+ <apex:param name="firstParam" assignTo="{!saveType}" value="" />
+ </apex:actionFunction>
+ <apex:actionFunction name="saveAndSort" action="{!save}" rerender="allPanel" oncomplete="closeSpinner();expandAll();">
+ <apex:param name="firstParam" assignTo="{!saveType}" value="" />
+ <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
+ </apex:actionFunction>
+ <apex:actionFunction name="searchOpp" action="{!chick}" rerender="allPanel" oncomplete="closeSpinner();expandAll();"/>
+ <apex:actionFunction name="sortTable" action="{!sortTable}" rerender="allPanel" oncomplete="closeSpinner();expandAll();">
+ <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
+ </apex:actionFunction>
+ <apex:outputPanel id="allPanel">
+ <div id="zxk" style="margin-bottom: -15px;">
+ <apex:pageBlock id="searchBlock" mode="maindetail">
+ <table style="border-bottom-width: 0px; font-size:14px;color:#696969;">
+ <tr>
+ <td width="283px">
+ <div style="color:#696969;">
+ 缁忛攢鍟嗗尰闄�
+ <apex:inputText styleClass="slds-input" value="{!accSearch}" style="width:170px"/>
+ </div>
+ </td>
+ <td width="250px">
+ <div style="color:#696969;">
+ 閿�鍞媴褰�
+ <apex:inputText styleClass="slds-input" value="{!aooSearch}" style="width:150px"/>
+ </div>
+ </td>
+ <td width="230px">
+ <div style="color:#696969;">
+ 鏄剧ず
+ <apex:selectList styleClass="slds-input slds-combobox__input" style="width:100px;" value="{!limits}" size="1" onchange="searchOppJs_Account();return false;">
+ <apex:selectOptions value="{!limitOpts}"/>
+ </apex:selectList>
+ 鏉℃暟鎹�
+ </div>
+ </td>
+ <td><a href="#" onclick="expandAll();return false;" style="text-decoration: underline;color:#696969;">鍏ㄩ儴灞曞紑</a></td>
+ </tr>
+ </table>
+ <p style="height:10px;"></p>
+ <table style="border-bottom-width: 0px; font-size:12px;font-size:14px;color:#696969;">
+ <tr>
+ <td width="220px">
+ <div style="color:#696969;">
+ <font>鏁� 鎹� 瀛� 娈�</font>
+ <apex:selectList styleClass="slds-input slds-combobox__input" value="{!numtext1}" size="1" style="width:110px">
+ <apex:selectOptions value="{!textOpts}"/>
+ </apex:selectList>
+ </div>
+ </td>
+ <td width="130px">
+ <apex:selectList styleClass="slds-input slds-combobox__input" value="{!numtext2}" size="1" style="width:110px">
+ <apex:selectOptions value="{!equalOpts}"/>
+ </apex:selectList>
+ </td>
+ <td width="183px">
+ <apex:inputText styleClass="slds-input" style="width:150px" value="{!numtext}"/>
+ </td>
+ <td width="188px">
+ <!-- slds-button slds-button_brand -->
+ <apex:commandButton styleClass="buttonStyle" value="妫�绱�" onclick="searchOppJs_Account();return false;" style="height:30px;width:70px;"/>
+ <apex:commandButton styleClass="buttonStyle" action="{!save}" value="淇濆瓨" rerender="allPanel" onclick="showSpinner();" oncomplete="closeSpinner();expandAll();" style="height:30px;width:70px;"/>
+ </td>
+ <td>
+ <!-- <apex:pageMessages /> -->
+ <!-- add by Link 2023-6-2 -->
+ <apex:outputPanel rendered="{! remindMsg != '' && remindMsg != null}">
+ <div style="border: 1px solid #D4D4D4;height:32px;border-radius:5px;color:#ff6a00;font-size:18px;">
+ <span class="slds-icon_container slds-icon-custom-custom53 slds-icon-text-default" >
+ <svg aria-hidden="true" class="slds-icon">
+ <use xmlns:xlink="http://www.w3.org/1999/xlink"
+ xlink:href="/apexpages/slds/latest/assets/icons/custom-sprite/svg/symbols.svg#custom53">
+ </use>
+ </svg>
+ <span class="slds-assistive-text">Custom 53</span>
+ </span>
+ <strong style="padding-top: 2px;"> {!remindMsg}</strong>
+ </div>
+ </apex:outputPanel>
+ </td>
+ </tr>
+ </table>
+ </apex:pageBlock>
+ </div>
+ <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;"> -->
+ <apex:pageBlock id="oppBlock" mode="maindetail">
+ <!-- <apex:pageblocksection columns="1" id="oppSection"> -->
+ <apex:outputPanel >
+ <apex:inputHidden id="oppCount" value="{!oppCount}"/>
+
+ <div id="out_Div_L">
+ <table class="list" style="border-bottom-width: 0px; width:1100px; font-size:14px !important; border-spacing:0;" border="" id="tableHeader">
+ <tr class="dataRow" height="1px">
+ <apex:variable value="{!0}" var="cnt" />
+ <apex:repeat value="{!titleRight}" var="t">
+ <td class="col_{!columnRightCss[cnt]}"></td>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ <td id="cell_Scroll" class="col_Scroll"></td>
+ </tr>
+ <tr class="headerRow" height="30px">
+ <apex:variable value="{!0}" var="cnt" />
+ <apex:repeat value="{!titleRight}" var="t">
+ <td class="col_{!columnRightCss[cnt]}">
+ <a href="#" onclick="sortTableJs_Account1('{!cnt + titleLeft.size}');return false;" style="text-decoration: underline;color:black;font-size:14px !important;font-weight: bold;"><apex:outputText value="{!t}"/></a>{!sortOrder[cnt + titleLeft.size]}
+ </td>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ <!-- <td id="cell_Scroll" class="col_Scroll"></td> -->
+ </tr>
+ </table>
+ </div>
+ <div id="out_Div">
+ <table class="list" style="border-bottom-width: 0px; width:2000px; font-size:14px !important; border-spacing:0;" border="" id="tableHeader_L">
+ <tr class="dataRow" height="1px">
+ <apex:variable value="{!0}" var="cnt" />
+ <apex:repeat value="{!titleLeft}" var="t">
+ <td class="col_{!columnLeftCss[cnt]}"></td>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ </tr>
+ <tr class="headerRow" height="30px">
+ <apex:variable value="{!0}" var="cnt" />
+ <apex:repeat value="{!titleLeft}" var="t">
+ <td class="col_{!columnLeftCss[cnt]}">
+ <a href="#" onclick="sortTableJs_Account1('{!cnt}');return false;" style="text-decoration: underline;color:black;font-size:14px !important;font-weight: bold;"><apex:outputText value="{!t}"/></a>{!sortOrder[cnt]}
+ </td>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ <!-- <td id="cell_Scroll" class="col_Scroll"></td> -->
+ </tr>
+ </table>
+
+ </div> <!-- out_Div -->
+ <div style="clear:both;height:0px;"></div>
+ <div id="in_Div_L">
+ <table class="list" style="border-bottom-width: 0px;width:1100px; font-size:13px; border-spacing:0;" border="" id="tableData">
+ <apex:variable value="{!1}" var="cnt" />
+ <apex:repeat value="{!oppRecords}" var="or" id="oppTable">
+ <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" style="height:35px;" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
+ <apex:variable value="{!0}" var="cnt_3" />
+ <apex:repeat value="{!columnsRightApi}" var="c">
+ <td class="dataCellBorder1 col_{!columnRightCss[cnt_3]} {!cnt}_col_{!columnRightCss[cnt_3]}">
+
+ <!-- vivek start -->
+ <!-- <apex:outputLink rendered="{!c[0]=='Name'}" value="/{!or.opp.Id}" target="LINK_{!or.opp.Id}"><apex:outputField rendered="{!c[0]=='Name'}" value="{!or.opp[c[0]]}" /></apex:outputLink> -->
+ <!-- vivek end -->
+ <!-- <apex:outputField id="q1111111111" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && or.opp.Id <> null && c[0] <> 'Name' && (c[0] <> 'Opp_Changed_Field__c' ||(c[0] == 'Opp_Changed_Field__c' &&
or.opp.Opp_Changed_Field__c != '璇环闃舵鍙戠敓浜嗗彉鍖�' &&or.opp.Opp_Changed_Field__c != '棰勬祴绛剧害鏃ュ彂鐢熶簡鍙樺寲' &&or.opp.Opp_Changed_Field__c != '鍖婚櫌鍚堝悓閲戦鍙戠敓浜嗗彉鍖�' && or.opp.Opp_Changed_Field__c != '璁㈣揣閲戦鍙戠敓浜嗗彉鍖�')))}" value="{!or.opp[c[0]]}" /> && or.opp.Oly_Inquiry_Status1__c <> null AgcOpp -->
- <apex:outputField
- rendered="{!c[0] == 'Change_To_Opportunity_T__c' }"
- value="{!or.opp[c[0]]}"
- />
-
- <apex:outputField
- rendered="{!columnRightRW[c[0]]=='r' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Strategic_department_Class_Name__c' }"
- value="{!or.opp[c[0]]}"
- />
- <!-- <apex:outputField id="q1111111111" rendered="{!( columnRightRW[c[0]]=='r' && c[0] <> 'Name' && (c[0] <> 'StageName__c' ||(c[0] == 'StageName__c' &&
+ <apex:outputField rendered="{!c[0] == 'Change_To_Opportunity_T__c' }" value="{!or.opp[c[0]]}" />
+
+ <apex:outputField rendered="{!columnRightRW[c[0]]=='r' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Strategic_department_Class_Name__c' }" value="{!or.opp[c[0]]}" />
+ <!-- <apex:outputField id="q1111111111" rendered="{!( columnRightRW[c[0]]=='r' && c[0] <> 'Name' && (c[0] <> 'StageName__c' ||(c[0] == 'StageName__c' &&
or.opp.Oly_Inquiry_Stage__c != '璇环闃舵鍙戠敓浜嗗彉鍖�' &&or.opp.Oly_Inquiry_Stage__c != '棰勬祴绛剧害鏃ュ彂鐢熶簡鍙樺寲' &&or.opp.Oly_Inquiry_Stage__c != '鍖婚櫌鍚堝悓閲戦鍙戠敓浜嗗彉鍖�' && or.opp.Oly_Inquiry_Stage__c != '璁㈣揣閲戦鍙戠敓浜嗗彉鍖�')))}" value="{!or.opp[c[0]]}" /> -->
- <!-- <div style ="color:red"> -->
- <!-- <apex:outputField id="q2222222" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && or.opp.Id <> null && c[0] <> 'Name' && c[0] == 'Opp_Changed_Field__c' && (
+ <!-- <div style ="color:red"> -->
+ <!-- <apex:outputField id="q2222222" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && or.opp.Id <> null && c[0] <> 'Name' && c[0] == 'Opp_Changed_Field__c' && (
or.opp.Opp_Changed_Field__c == '璇环闃舵鍙戠敓浜嗗彉鍖�' || or.opp.Opp_Changed_Field__c == '棰勬祴绛剧害鏃ュ彂鐢熶簡鍙樺寲' || or.opp.Opp_Changed_Field__c == '鍖婚櫌鍚堝悓閲戦鍙戠敓浜嗗彉鍖�' || or.opp.Opp_Changed_Field__c == '璁㈣揣閲戦鍙戠敓浜嗗彉鍖�'))}" value="{!or.opp[c[0]]}" /> -->
- <!-- <apex:outputField id="q2222222" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && c[0] <> 'Name' && c[0] == 'StageName__c' && (
+ <!-- <apex:outputField id="q2222222" rendered="{!(c.size==1 && columnRightRW[c[0]]=='r' && c[0] <> 'Name' && c[0] == 'StageName__c' && (
or.opp.Oly_Inquiry_Stage__c == '璇环闃舵鍙戠敓浜嗗彉鍖�' || or.opp.Oly_Inquiry_Stage__c == '棰勬祴绛剧害鏃ュ彂鐢熶簡鍙樺寲' || or.opp.Oly_Inquiry_Stage__c == '鍖婚櫌鍚堝悓閲戦鍙戠敓浜嗗彉鍖�' || or.opp.Oly_Inquiry_Stage__c == '璁㈣揣閲戦鍙戠敓浜嗗彉鍖�'))}" value="{!or.opp[c[0]]}" />
</div> -->
- <!-- <apex:inputField rendered="{!(c.size==1 && columnRightRW[c[0]]=='w' && or.opp.Id <> null && c[0] <> 'Name')}" value="{!or.opp[c[0]]}" onchange="setChangeFlgRight('{!or.lineNo}')"/>
+ <!-- <apex:inputField rendered="{!(c.size==1 && columnRightRW[c[0]]=='w' && or.opp.Id <> null && c[0] <> 'Name')}" value="{!or.opp[c[0]]}" onchange="setChangeFlgRight('{!or.lineNo}')"/>
<apex:outputPanel rendered="{!(c.size==1 && columnRightRW[c[0]]=='wm' && c[0] <> 'Name' && or.opp.Id <> null)}" layout="none">
<div class="requiredInput_r">
<div class="requiredBlock_r"></div>
<apex:inputField value="{!or.Opp[c[0]]}" onchange="setChangeFlg('{!or.lineNo}')"/>
</div>
</apex:outputPanel> -->
- <apex:outputField
- rendered="{!c[0] == 'Strategic_department_Class_Name__c'}"
- value="{!or.opp[c[0]]}"
- />
-
- <apex:inputField
- styleClass="slds-form-element"
- rendered="{!( columnRightRW[c[0]]=='w' && c[0] <> 'Strategic_department_Class_Name__c' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Name')}"
- value="{!or.opp[c[0]]}"
- onchange="setChangeFlgRight('{!or.lineNo}')"
- />
- <apex:outputPanel
- rendered="{!( columnRightRW[c[0]]=='wm' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Name' )}"
- layout="none"
- >
- <div class="requiredInput_r">
- <div class="requiredBlock_r"></div>
- <apex:inputField
- styleClass="slds-form-element"
- value="{!or.Opp[c[0]]}"
- onchange="setChangeFlg('{!or.lineNo}')"
- />
- </div>
- </apex:outputPanel>
- <apex:variable value="{!cnt_3 + 1}" var="cnt_3" />
- </td>
- </apex:repeat>
- <td id="cell_Scroll" class="col_Scroll">
- <apex:inputHidden value="{!or.changeFlg}" id="changeFlg" />
- <apex:inputHidden
- value="{!or.changeFlgRt}"
- id="changeFlgRt"
- />
- <script type="text/javascript">
- if ("{!or.canEdit}" == "false") {
- var right = j$("#tableData").find("tr").eq({!cnt-1});
- var rightline = j$(right).find("td");
- for (var i=0; i<rightline.length; i++) {
- j$(rightline[i]).find("input").each(function(){
- j$(this).attr("disabled",true);
- });
- j$(rightline[i]).find("a").each(function(){
- j$(this).attr("href","#");
- });
- }
- }
- if ("{!or.hasError}" == "true") {
- var left = j$("#tableData_L").find("tr").eq({!cnt-1});
- var leftFirst = j$(left).find("td").eq(1);
- j$(leftFirst).css("background-color", "gray");
- }
- if ("{!or.hasFieldError}" == "true") {
- var left = j$("#tableData_L").find("tr").eq({!cnt-1});
- var leftFirst = j$(left).find("td").eq(1);
- j$(leftFirst).css("background-color", "red");
- }
- </script>
- </td>
- </tr>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- </table>
- </div>
- <div id="in_Div">
- <table
- class="list"
- style="
- border-bottom-width: 0px;
- width: 2000px;
- font-size: 13px;
- border-spacing: 0;
- "
- border=""
- id="tableData_L"
- >
- <apex:variable value="{!1}" var="cnt_2" />
- <apex:repeat value="{!oppRecords}" var="or" id="oppTable_L">
- <tr
- class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}"
- style="height: 35px"
- onmouseover="if (window.hiOn){hiOn(this);} "
- onmouseout="if (window.hiOff){hiOff(this);} "
- onblur="if (window.hiOff){hiOff(this);}"
- onfocus="if (window.hiOn){hiOn(this);}"
- >
- <apex:variable value="{!0}" var="cnt_2" />
- <apex:repeat value="{!columnsLeftApi}" var="c">
- <td class="dataCellBorder1 col_{!columnLeftCss[cnt_2]}">
- <!-- vivek start -->
-
- <apex:outputLink
- target="_blank"
- rendered="{!c[0]=='Name'}"
- value="/{!or.AgcOpp.Id}"
- >
- <apex:outputField
- rendered="{!c[0]=='Name'}"
- value="{!or.AgcOpp[c[0]]}"
- />
- </apex:outputLink>
-
- <apex:outputPanel rendered="{!or.ifLock}">
- <apex:outputField
- rendered="{!c[0]!='Name'}"
- value="{!or.AgcOpp[c[0]]}"
- >
- </apex:outputField>
- </apex:outputPanel>
- <!-- 閿�鍞媴褰� -->
- <apex:outputPanel rendered="{!or.ifLock == false}">
- <!-- <apex:outputLink target="_blank" rendered="{!c[0]=='Agency_Person__c'}" value="/{!or.AgcOpp[c[0]]}" > -->
- <!-- <apex:outputText value="{!or.AgcOpp.Agency_Person__r.Name }" /> -->
- <!-- <apex:outputText rendered="{!c[0]=='Agency_PersonName__c'}" value="{!or.AgcOpp.Agency_PersonName__c }" /> -->
- <!-- </apex:outputLink> -->
- <!-- 缁忛攢鍟� -->
- <apex:outputLink
- target="_blank"
- rendered="{!c[0]=='Agency__c'}"
- value="/{!or.AgcOpp[c[0]]}"
- >
- <apex:outputText
- value="{!or.AgcOpp.Agency__r.Name }"
- />
- </apex:outputLink>
- <!-- OCSM璇环 -->
- <!-- <apex:outputLink target="_blank" rendered="{!c[0]=='Change_To_Opportunity__c'}" value="/{!or.AgcOpp[c[0]]}" >
+ <apex:outputField rendered="{!c[0] == 'Strategic_department_Class_Name__c'}" value="{!or.opp[c[0]]}" />
+
+ <apex:inputField styleClass="slds-form-element" rendered="{!( columnRightRW[c[0]]=='w' && c[0] <> 'Strategic_department_Class_Name__c' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Name')}" value="{!or.opp[c[0]]}" onchange="setChangeFlgRight('{!or.lineNo}')"/>
+ <apex:outputPanel rendered="{!( columnRightRW[c[0]]=='wm' && c[0] <> 'Change_To_Opportunity_T__c' && c[0] <> 'Name' )}" layout="none">
+ <div class="requiredInput_r">
+ <div class="requiredBlock_r"></div>
+ <apex:inputField styleClass="slds-form-element" value="{!or.Opp[c[0]]}" onchange="setChangeFlg('{!or.lineNo}')"/>
+ </div>
+ </apex:outputPanel>
+ <apex:variable value="{!cnt_3 + 1}" var="cnt_3" />
+ </td>
+ </apex:repeat>
+ <td id="cell_Scroll" class="col_Scroll">
+ <apex:inputHidden value="{!or.changeFlg}" id="changeFlg"/>
+ <apex:inputHidden value="{!or.changeFlgRt}" id="changeFlgRt"/>
+ <script type="text/javascript">
+ if ("{!or.canEdit}" == "false") {
+ var right = j$("#tableData").find("tr").eq({!cnt-1});
+ var rightline = j$(right).find("td");
+ for (var i=0; i<rightline.length; i++) {
+ j$(rightline[i]).find("input").each(function(){
+ j$(this).attr("disabled",true);
+ });
+ j$(rightline[i]).find("a").each(function(){
+ j$(this).attr("href","#");
+ });
+ }
+ }
+ if ("{!or.hasError}" == "true") {
+ var left = j$("#tableData_L").find("tr").eq({!cnt-1});
+ var leftFirst = j$(left).find("td").eq(1);
+ j$(leftFirst).css("background-color", "gray");
+ }
+ if ("{!or.hasFieldError}" == "true") {
+ var left = j$("#tableData_L").find("tr").eq({!cnt-1});
+ var leftFirst = j$(left).find("td").eq(1);
+ j$(leftFirst).css("background-color", "red");
+ }
+ </script>
+ </td>
+ </tr>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ </table>
+ </div>
+ <div id="in_Div">
+ <table class="list" style="border-bottom-width: 0px;width:2000px; font-size:13px; border-spacing:0;" border="" id="tableData_L">
+ <apex:variable value="{!1}" var="cnt_2" />
+ <apex:repeat value="{!oppRecords}" var="or" id="oppTable_L">
+ <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" style="height:35px;" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
+ <apex:variable value="{!0}" var="cnt_2" />
+ <apex:repeat value="{!columnsLeftApi}" var="c">
+ <td class="dataCellBorder1 col_{!columnLeftCss[cnt_2]}">
+ <!-- vivek start -->
+
+ <apex:outputLink target="_blank" rendered="{!c[0]=='Name'}" value="/{!or.AgcOpp.Id}" >
+ <apex:outputField rendered="{!c[0]=='Name'}" value="{!or.AgcOpp[c[0]]}" />
+ </apex:outputLink>
+
+ <apex:outputPanel rendered="{!or.ifLock}">
+ <apex:outputField rendered="{!c[0]!='Name'}" value="{!or.AgcOpp[c[0]]}">
+ </apex:outputField>
+ </apex:outputPanel>
+ <!-- 閿�鍞媴褰� -->
+ <apex:outputPanel rendered="{!or.ifLock == false}">
+ <!-- <apex:outputLink target="_blank" rendered="{!c[0]=='Agency_Person__c'}" value="/{!or.AgcOpp[c[0]]}" > -->
+ <!-- <apex:outputText value="{!or.AgcOpp.Agency_Person__r.Name }" /> -->
+ <!-- <apex:outputText rendered="{!c[0]=='Agency_PersonName__c'}" value="{!or.AgcOpp.Agency_PersonName__c }" /> -->
+ <!-- </apex:outputLink> -->
+ <!-- 缁忛攢鍟� -->
+ <apex:outputLink target="_blank" rendered="{!c[0]=='Agency__c'}" value="/{!or.AgcOpp[c[0]]}" >
+ <apex:outputText value="{!or.AgcOpp.Agency__r.Name }" />
+ </apex:outputLink>
+ <!-- OCSM璇环 -->
+ <!-- <apex:outputLink target="_blank" rendered="{!c[0]=='Change_To_Opportunity__c'}" value="/{!or.AgcOpp[c[0]]}" >
<apex:outputText value="{!or.AgcOpp.Agency__r.Name }" />
</apex:outputLink> -->
- <!-- 蹇呭~瀛楁 -->
- <!-- <apex:outputField rendered="{!(c[0]<>'Name' && c[0]<>'Agency_Hospital__c' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='wm')}" value="{!or.AgcOpp[c[0]] }"/> -->
- <apex:inputField
- styleClass="slds-form-element"
- rendered="{!(c[0]<>'Name' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='wm')}"
- value="{!or.AgcOpp[c[0]] }"
- onchange="setChangeFlg('{!or.lineNo}')"
- />
- <!-- vivek end -->
-
- <apex:outputField
- rendered="{!(c[0]<>'Name' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='r')}"
- value="{!or.AgcOpp[c[0]] }"
- />
- <!-- <apex:outputField rendered="{!(c[0]<>'Name' && columnLeftRW[c[0]]<>'w')}" value="{!or.AgcOpp[c[0]] }"/> -->
- <!-- 鍙紪杈戠殑瀛楁 -->
- <apex:inputField
- styleClass="slds-form-element"
- value="{!or.AgcOpp[c[0]]}"
- rendered="{!columnLeftRW[c[0]]=='w'}"
- onchange="setChangeFlg('{!or.lineNo}')"
- />
- </apex:outputPanel>
- </td>
- <apex:variable value="{!cnt_2 + 1}" var="cnt_2" />
- </apex:repeat>
- </tr>
- <apex:variable value="{!cnt + 1}" var="cnt" />
- </apex:repeat>
- </table>
- </div>
- <!-- /in_Div -->
+ <!-- 蹇呭~瀛楁 -->
+ <!-- <apex:outputField rendered="{!(c[0]<>'Name' && c[0]<>'Agency_Hospital__c' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='wm')}" value="{!or.AgcOpp[c[0]] }"/> -->
+ <apex:inputField styleClass="slds-form-element" rendered="{!(c[0]<>'Name' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='wm')}" value="{!or.AgcOpp[c[0]] }" onchange="setChangeFlg('{!or.lineNo}')"/>
+ <!-- vivek end -->
+
+
+ <apex:outputField rendered="{!(c[0]<>'Name' && c[0]<>'Product_Category1__c' && c[0]<>'Product_Category2__c' && c[0]<>'Product_Category3__c' && c[0]<>'Agency_Person__c' && c[0]<>'Agency__c' && c[0]<>'Change_To_Opportunity__c' && columnLeftRW[c[0]]=='r')}" value="{!or.AgcOpp[c[0]] }"/>
+ <!-- <apex:outputField rendered="{!(c[0]<>'Name' && columnLeftRW[c[0]]<>'w')}" value="{!or.AgcOpp[c[0]] }"/> -->
+ <!-- 鍙紪杈戠殑瀛楁 -->
+ <apex:inputField styleClass="slds-form-element" value="{!or.AgcOpp[c[0]]}" rendered="{!columnLeftRW[c[0]]=='w'}" onchange="setChangeFlg('{!or.lineNo}')"/>
+ </apex:outputPanel>
+ </td>
+ <apex:variable value="{!cnt_2 + 1}" var="cnt_2" />
+ </apex:repeat>
+ </tr>
+ <apex:variable value="{!cnt + 1}" var="cnt" />
+ </apex:repeat>
+ </table>
+
+ </div><!-- /in_Div -->
+ </apex:outputPanel>
+ </apex:pageBlock>
+ <!-- </div> -->
+ <script type="text/javascript">
+j$(function() {
+ var tableWidth = 0;
+ j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
+ var colClass = getColClassName(this);
+ if (colClass != 'col_Scroll') {
+ var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
+ tableWidth += headerCol.width();
+ }
+ });
+ // j$('table#tableData').css('width', (tableWidth + 2) + 'px');
+ // j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
+
+ // list 銇� headerRow 銇� td銇� toggleWidth() 銈掕拷鍔�
+ bindTdToggleWidth();
+ // j$("input").attr("styleClass","slds-input");
+});
+var elements = document.getElementsByTagName("select");
+for (i = 0; i < elements.length; i++) {
+ var id = elements[i].id;
+ if (id.length > 5 && id.substring(id.length - 5, id.length) == 'mlktp') {
+ elements[i].style.display = "none";
+ }
+}
+var tbl_l = document.getElementById("tableData_L");
+var input_l = tbl_l.getElementsByTagName("input");
+for (i = 0; i < input_l.length; i++) {
+ var id = input_l[i].id + '_lkid';
+ if (document.getElementById(id) != null) {
+ input_l[i].style.width = "75%";
+ }
+}
+var tbl = document.getElementById("tableData");
+var input = tbl.getElementsByTagName("input");
+for (i = 0; i < input.length; i++) {
+ var id = input[i].id + '_lkid';
+ if (document.getElementById(id) != null) {
+ input[i].style.width = "75%";
+ }
+}
+</script>
</apex:outputPanel>
- </apex:pageBlock>
- <!-- </div> -->
- <script type="text/javascript">
- j$(function () {
- var tableWidth = 0;
- j$("body .pbBody table#tableHeader tr.headerRow td").each(
- function () {
- var colClass = getColClassName(this);
- if (colClass != "col_Scroll") {
- var headerCol = j$(
- "body .pbBody table.list tr.headerRow td." + colClass
- );
- tableWidth += headerCol.width();
- }
- }
- );
- // j$('table#tableData').css('width', (tableWidth + 2) + 'px');
- // j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
-
- // list 銇� headerRow 銇� td銇� toggleWidth() 銈掕拷鍔�
- bindTdToggleWidth();
- // j$("input").attr("styleClass","slds-input");
- });
- var elements = document.getElementsByTagName("select");
- for (i = 0; i < elements.length; i++) {
- var id = elements[i].id;
- if (
- id.length > 5 &&
- id.substring(id.length - 5, id.length) == "mlktp"
- ) {
- elements[i].style.display = "none";
- }
- }
- var tbl_l = document.getElementById("tableData_L");
- var input_l = tbl_l.getElementsByTagName("input");
- for (i = 0; i < input_l.length; i++) {
- var id = input_l[i].id + "_lkid";
- if (document.getElementById(id) != null) {
- input_l[i].style.width = "75%";
- }
- }
- var tbl = document.getElementById("tableData");
- var input = tbl.getElementsByTagName("input");
- for (i = 0; i < input.length; i++) {
- var id = input[i].id + "_lkid";
- if (document.getElementById(id) != null) {
- input[i].style.width = "75%";
- }
- }
- </script>
- </apex:outputPanel>
- </apex:form>
-</apex:page>
+ </apex:form>
+</apex:page>
\ No newline at end of file
diff --git a/force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml b/force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml
index 1ff0fd6..ba744e5 100644
--- a/force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml
+++ b/force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>39.0</apiVersion>
<availableInTouch>true</availableInTouch>
diff --git a/force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml b/force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml
index 1b4f021..328cd0d 100644
--- a/force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml
+++ b/force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<classAccesses>
<apexClass>LexArriveGoodsController</apexClass>
@@ -126,9 +126,7 @@
</classAccesses>
<flowAccesses>
<enabled>true</enabled>
- <flow>
-CommunityWeeklyReport;
- </flow>
+ <flow>CommunityWeeklyReport</flow>
</flowAccesses>
<hasActivationRequired>false</hasActivationRequired>
<label>Community Consumable LEX PS</label>
diff --git a/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger b/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger
index c99b289..8529340 100644
--- a/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger
+++ b/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger
@@ -1,97 +1,76 @@
-trigger ConsumableOrderDetail2Trigger on Consumable_order_details2__c(
- after insert,
- after update,
- after delete
-) {
- Set<String> orderSet = new Set<String>();
-
- if (StaticParameter.EscapeOrderDetail2Trigger) {
- return;
- }
- if (Trigger.isInsert) {
- for (Consumable_order_details2__c local : Trigger.New) {
- if (
- local.Consumable_order_minor__c != null &&
- local.Dealer_Returned__c == false
- )
- orderSet.add(local.Consumable_order_minor__c);
+trigger ConsumableOrderDetail2Trigger on Consumable_order_details2__c (after insert, after update, after delete) {
+ Set<String> orderSet = new Set<String>();
+
+ if (StaticParameter.EscapeOrderDetail2Trigger) {
+ return ;
}
- }
-
- if (Trigger.isUpdate) {
- for (Consumable_order_details2__c local : Trigger.New) {
- //if (local.Consumable_order_minor__c!=null &&
- // local.Dealer_Arrive__c != Trigger.oldMap.get(local.Id).get('Dealer_Arrive__c'))
- if (local.Consumable_order_minor__c != null)
- orderSet.add(local.Consumable_order_minor__c);
- }
- }
-
- if (Trigger.isDelete) {
- for (Consumable_order_details2__c local : Trigger.old) {
- if (local.Consumable_order_minor__c != null)
- orderSet.add(local.Consumable_order_minor__c);
- }
- }
-
- if (orderSet.size() > 0) {
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲 SQL start by 寮犵帀灞�
- list<Consumable_order_details2__c> allresults = [
- SELECT
- Consumable_order_minor__c,
- Deliver_date__c,
- Dealer_Returned__c,
- Dealer_Arrive__c,
- RemoveBox_No__c,
- Cancellation_Date__c
- FROM Consumable_order_details2__c
- WHERE Consumable_order_minor__c IN :orderSet
- ];
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV end by 寮犵帀灞�
-
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
- map<string, Integer> orderSetResults = new Map<string, Integer>();
- for (Consumable_order_details2__c results1 : allresults) {
- if (
- results1.Dealer_Arrive__c == false ||
- results1.Dealer_Returned__c == true ||
- (results1.RemoveBox_No__c != null &&
- results1.RemoveBox_No__c != 1)
- ) {
- continue;
- }
- string Consumable_order_minor_str = String.valueOf(
- results1.Consumable_order_minor__c
- );
-
- if (orderSetResults.containsKey(Consumable_order_minor_str)) {
- orderSetResults.put(
- Consumable_order_minor_str,
- orderSetResults.get(Consumable_order_minor_str) + 1
- );
- } else {
- orderSetResults.put(Consumable_order_minor_str, 1);
- }
- }
-
- List<Consumable_Order__c> consumableOrderlist = new List<Consumable_Order__c>();
- for (String strOrder : orderSet) {
- Integer cnt = 0;
- for (string key : orderSetResults.keySet()) {
- if (key.equals(strOrder)) {
- cnt = orderSetResults.get(key);
- break;
+ if (trigger.isInsert){
+ for (Consumable_order_details2__c local : Trigger.New) {
+ if (local.Consumable_order_minor__c!=null &&
+ local.Dealer_Returned__c == false)
+ orderSet.add(local.Consumable_order_minor__c);
}
- }
-
- Consumable_Order__c consumableOrder = new Consumable_Order__c();
- consumableOrder.Id = strOrder;
- consumableOrder.OrderNumber_arrived__c = cnt;
- consumableOrderlist.add(consumableOrder);
}
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end end by 寮犵帀灞�
- /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
+ if (trigger.isUpdate){
+ for (Consumable_order_details2__c local : Trigger.New) {
+ //if (local.Consumable_order_minor__c!=null &&
+ // local.Dealer_Arrive__c != Trigger.oldMap.get(local.Id).get('Dealer_Arrive__c'))
+ if (local.Consumable_order_minor__c!=null) orderSet.add(local.Consumable_order_minor__c);
+ }
+ }
+
+ if (trigger.isDelete){
+ for (Consumable_order_details2__c local : Trigger.old) {
+ if (local.Consumable_order_minor__c!=null) orderSet.add(local.Consumable_order_minor__c);
+ }
+ }
+
+
+ if (orderSet.size()>0){
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲 SQL start by 寮犵帀灞�
+ list<Consumable_order_details2__c> allresults =
+ [SELECT Consumable_order_minor__c, Deliver_date__c,
+ Dealer_Returned__c, Dealer_Arrive__c, RemoveBox_No__c,Cancellation_Date__c
+ FROM Consumable_order_details2__c
+ WHERE Consumable_order_minor__c in :orderSet ];
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV end by 寮犵帀灞�
+
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
+ map<string,Integer> orderSetResults = new map<string,Integer>();
+ for(Consumable_order_details2__c results1 : allresults){
+ if(results1.Dealer_Arrive__c == false || results1.Dealer_Returned__c== true
+ || (results1.RemoveBox_No__c !=null && results1.RemoveBox_No__c !=1)){
+ continue;
+ }
+ string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
+
+ if(orderSetResults.containsKey(Consumable_order_minor_str)){
+ orderSetResults.put(Consumable_order_minor_str,
+ orderSetResults.get(Consumable_order_minor_str)+1);
+ }else{
+ orderSetResults.put(Consumable_order_minor_str,1);
+ }
+ }
+
+ List<Consumable_Order__c> consumableOrderlist = new List<Consumable_Order__c>();
+ for (String strOrder:orderSet){
+ Integer cnt =0;
+ for (string key : orderSetResults.keySet()) {
+ if(key.equals(strOrder)){
+ cnt = orderSetResults.get(key);
+ break;
+ }
+ }
+
+ Consumable_Order__c consumableOrder = new Consumable_Order__c();
+ consumableOrder.Id = strOrder;
+ consumableOrder.OrderNumber_arrived__c = cnt;
+ consumableOrderlist.add(consumableOrder);
+ }
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end end by 寮犵帀灞�
+
+ /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
AggregateResult[] results = [SELECT Consumable_order_minor__c,count(Id) cnt
FROM Consumable_order_details2__c
WHERE Consumable_order_minor__c in :orderSet
@@ -116,130 +95,111 @@
}
2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� end by 寮犵帀灞�
*/
- if (consumableOrderlist.size() > 0) {
- update consumableOrderlist;
- }
-
- //鏇存柊娑堣�楀搧璁㈠崟鐨勫彂璐ф棩鏈�
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
- Set<string> resultsKeySet = new Set<String>();
- map<string, Date> DeliverdateResults = new Map<string, Date>(); //鏈�鏂板彂璐ф椂闂�
- map<string, Date> DeliverdateminResults = new Map<string, Date>(); //鏈�鏃╁彂璐ф椂闂�
- for (Consumable_order_details2__c results1 : allresults) {
- if (
- results1.Dealer_Arrive__c == true ||
- results1.Dealer_Returned__c == true
- ) {
- continue;
- }
- string Consumable_order_minor_str = String.valueOf(
- results1.Consumable_order_minor__c
- );
- if (DeliverdateResults.containsKey(Consumable_order_minor_str)) {
- if (
- DeliverdateResults.get(Consumable_order_minor_str) <
- results1.Deliver_date__c
- ) {
- DeliverdateResults.put(
- Consumable_order_minor_str,
- results1.Deliver_date__c
- );
- resultsKeySet.add(Consumable_order_minor_str);
+ if (consumableOrderlist.size() > 0){
+ update consumableOrderlist;
}
- } else {
- DeliverdateResults.put(
- Consumable_order_minor_str,
- results1.Deliver_date__c
- );
- resultsKeySet.add(Consumable_order_minor_str);
- }
- //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part1 start
- if (DeliverdateminResults.containsKey(Consumable_order_minor_str)) {
- if (
- DeliverdateminResults.get(Consumable_order_minor_str) >
- results1.Deliver_date__c
- ) {
- DeliverdateminResults.put(
- Consumable_order_minor_str,
- results1.Deliver_date__c
- );
- resultsKeySet.add(Consumable_order_minor_str);
+
+ //鏇存柊娑堣�楀搧璁㈠崟鐨勫彂璐ф棩鏈�
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
+ Set<string> resultsKeySet = new Set<String>();
+ map<string,Date> DeliverdateResults = new map<string,Date>();//鏈�鏂板彂璐ф椂闂�
+ map<string,Date> DeliverdateminResults = new map<string,Date>();//鏈�鏃╁彂璐ф椂闂�
+ for(Consumable_order_details2__c results1 : allresults){
+ if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
+ continue;
+ }
+ string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
+ if(DeliverdateResults.containsKey(Consumable_order_minor_str)){
+ if(DeliverdateResults.get(Consumable_order_minor_str)
+ < results1.Deliver_date__c
+ ){
+ DeliverdateResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ resultsKeySet.add(Consumable_order_minor_str);
+ }
+ }else{
+ DeliverdateResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ resultsKeySet.add(Consumable_order_minor_str);
+ }
+ //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part1 start
+ if(DeliverdateminResults.containsKey(Consumable_order_minor_str)){
+ if(DeliverdateminResults.get(Consumable_order_minor_str)
+ > results1.Deliver_date__c
+ ){
+ DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ resultsKeySet.add(Consumable_order_minor_str);
+ }
+ }else{
+ DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ resultsKeySet.add(Consumable_order_minor_str);
+ }
+ //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part1 end
}
- } else {
- DeliverdateminResults.put(
- Consumable_order_minor_str,
- results1.Deliver_date__c
- );
- resultsKeySet.add(Consumable_order_minor_str);
- }
- //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part1 end
- }
+
+ //涓や釜DeliverdateResults.keySet()锛孌eliverdateminResults.keySet() 鍚堝苟浣滀负涓�涓狶ist 锛岄亶鍘哃ist
+ //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part2 start
+ consumableOrderlist = new List<Consumable_Order__c>();
+ for(string temp : resultsKeySet){
+ Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
+ consumableOrder1.Id = temp;
+ if(DeliverdateResults.get(temp)!=null){
+ consumableOrder1.Shipment_Date__c = DeliverdateResults.get(temp);
+ }
+ if(DeliverdateminResults.get(temp)!=null){
+ consumableOrder1.First_Delivery__c = DeliverdateResults.get(temp);
+ }
+ consumableOrderlist.add(consumableOrder1);
+ }
+
+ //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part2 end
+ // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();//鏈�鏃╁彂璐ф椂闂�
+ // for (string key : DeliverdateminResults.keySet()) {
+ // if(DeliverdateminResults.get(key)!=null){
+ // Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
+ // consumableOrder1.Id = key;
+ // consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
+ // consumableOrderminlist.add(consumableOrder1);
+ // }
+ // }
+
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end by 寮犵帀灞�
+
+ //鑾峰彇鏃╁彂璐ф棩鏈� start
+ // system.debug('DeliverdateResults==============' + DeliverdateResults);
+ // system.debug('璧板埌鏈�鏃╁彂璐ф棩鏈�');
+ // map<string,Date> DeliverdateminResults = new map<string,Date>();
+ // for(Consumable_order_details2__c results1 : allresults){
+ // if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
+ // continue;
+ // }
+ // string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
+ // if(DeliverdateminResults.containsKey(Consumable_order_minor_str)){
+ // if(DeliverdateminResults.get(Consumable_order_minor_str)
+ // > results1.Deliver_date__c
+ // ){
+ // DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ // }
- //涓や釜DeliverdateResults.keySet()锛孌eliverdateminResults.keySet() 鍚堝苟浣滀负涓�涓狶ist 锛岄亶鍘哃ist
- //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part2 start
- consumableOrderlist = new List<Consumable_Order__c>();
- for (string temp : resultsKeySet) {
- Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
- consumableOrder1.Id = temp;
- if (DeliverdateResults.get(temp) != null) {
- consumableOrder1.Shipment_Date__c = DeliverdateResults.get(temp);
- }
- if (DeliverdateminResults.get(temp) != null) {
- consumableOrder1.First_Delivery__c = DeliverdateResults.get(temp);
- }
- consumableOrderlist.add(consumableOrder1);
- }
+ // }else{
+ // DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
+ // }
+ // }
+ // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();
+ // for (string key : DeliverdateminResults.keySet()) {
+ // if(DeliverdateminResults.get(key)!=null){
+ // Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
+ // consumableOrder1.Id = key;
+ // consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
+ // consumableOrderminlist.add(consumableOrder1);
+ // }
+ // }
- //鑾峰彇鏈�鏃╁彂璐ф椂闂� pk part2 end
- // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();//鏈�鏃╁彂璐ф椂闂�
- // for (string key : DeliverdateminResults.keySet()) {
- // if(DeliverdateminResults.get(key)!=null){
- // Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
- // consumableOrder1.Id = key;
- // consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
- // consumableOrderminlist.add(consumableOrder1);
- // }
- // }
+ // if(consumableOrderminlist.size() > 0){
+ // update consumableOrderminlist;
+ // }
+ // system.debug('DeliverdateResults==============' + DeliverdateResults);
+ // //鑾峰彇鏈�鏃╁彂璐ф棩鏈� end
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end by 寮犵帀灞�
-
- //鑾峰彇鏃╁彂璐ф棩鏈� start
- // system.debug('DeliverdateResults==============' + DeliverdateResults);
- // system.debug('璧板埌鏈�鏃╁彂璐ф棩鏈�');
- // map<string,Date> DeliverdateminResults = new map<string,Date>();
- // for(Consumable_order_details2__c results1 : allresults){
- // if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
- // continue;
- // }
- // string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
- // if(DeliverdateminResults.containsKey(Consumable_order_minor_str)){
- // if(DeliverdateminResults.get(Consumable_order_minor_str)
- // > results1.Deliver_date__c
- // ){
- // DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
- // }
-
- // }else{
- // DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
- // }
- // }
- // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();
- // for (string key : DeliverdateminResults.keySet()) {
- // if(DeliverdateminResults.get(key)!=null){
- // Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
- // consumableOrder1.Id = key;
- // consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
- // consumableOrderminlist.add(consumableOrder1);
- // }
- // }
-
- // if(consumableOrderminlist.size() > 0){
- // update consumableOrderminlist;
- // }
- // system.debug('DeliverdateResults==============' + DeliverdateResults);
- // //鑾峰彇鏈�鏃╁彂璐ф棩鏈� end
-
- /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
+ /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
AggregateResult[] results1 = [SELECT Consumable_order_minor__c,max(Deliver_date__c) Deliver_date__c
FROM Consumable_order_details2__c
WHERE Consumable_order_minor__c in :orderSet
@@ -257,55 +217,46 @@
}
}
2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� end by 寮犵帀灞� */
- if (consumableOrderlist.size() > 0) {
- update consumableOrderlist;
- }
-
- //鏇存柊寰呯‘璁ゆ敹璐ф暟閲�
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
- map<string, Integer> resultsMap2 = new Map<string, Integer>();
- for (Consumable_order_details2__c results1 : allresults) {
- if (
- results1.Dealer_Arrive__c == true ||
- results1.Dealer_Returned__c == true ||
- results1.Cancellation_Date__c != null
- ) {
- continue;
- }
- string Consumable_order_minor_str = String.valueOf(
- results1.Consumable_order_minor__c
- );
- if (resultsMap2.containsKey(Consumable_order_minor_str)) {
- resultsMap2.put(
- Consumable_order_minor_str,
- resultsMap2.get(Consumable_order_minor_str) + 1
- );
- } else {
- resultsMap2.put(Consumable_order_minor_str, 1);
- }
- }
- consumableOrderlist = new List<Consumable_Order__c>();
- for (String strOrder : orderSet) {
- Integer cnt = 0;
- for (string key : resultsMap2.keySet()) {
- if (key.equals(strOrder)) {
- cnt = resultsMap2.get(key);
- break;
+ if (consumableOrderlist.size() > 0){
+ update consumableOrderlist;
}
- }
+
+ //鏇存柊寰呯‘璁ゆ敹璐ф暟閲�
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� start by 寮犵帀灞�
+ map<string,Integer> resultsMap2 = new map<string,Integer>();
+ for(Consumable_order_details2__c results1 : allresults){
+ if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true ||
+ results1.Cancellation_Date__c!=null){
+ continue;
+ }
+ string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
+ if(resultsMap2.containsKey(Consumable_order_minor_str)){
+ resultsMap2.put(Consumable_order_minor_str,
+ resultsMap2.get(Consumable_order_minor_str)+1);
+ }else{
+ resultsMap2.put(Consumable_order_minor_str,1);
+ }
+ }
+ consumableOrderlist = new List<Consumable_Order__c>();
+ for (String strOrder:orderSet){
+ Integer cnt =0;
+ for (string key : resultsMap2.keySet()) {
+ if(key.equals(strOrder)){
+ cnt = resultsMap2.get(key);
+ break;
+ }
+ }
- Consumable_Order__c consumableOrder2 = new Consumable_Order__c();
- consumableOrder2.Id = strOrder;
- consumableOrder2.Delivery_detail_count__c = cnt;
- if (consumableOrder2.Delivery_detail_count__c == 0) {
- consumableOrder2.More_than_seven_days__c = 0;
- }
- consumableOrderlist.add(consumableOrder2);
- }
+ Consumable_Order__c consumableOrder2 = new Consumable_Order__c();
+ consumableOrder2.Id = strOrder;
+ consumableOrder2.Delivery_detail_count__c = cnt;
+ if(consumableOrder2.Delivery_detail_count__c == 0){consumableOrder2.More_than_seven_days__c = 0;}
+ consumableOrderlist.add(consumableOrder2);
+ }
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end by 寮犵帀灞�
-
- /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇挎崲涓嬮潰鍘熸湁SQL 浣跨敤 map 瀹屾垚璧嬪�� end by 寮犵帀灞�
+
+ /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� start by 寮犵帀灞�
AggregateResult[] results2 = [SELECT Consumable_order_minor__c,count(Id) cnt
FROM Consumable_order_details2__c
WHERE Consumable_order_minor__c in :orderSet
@@ -329,476 +280,345 @@
consumableOrderlist.add(consumableOrder2);
}
2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熸湁SQL 涓庤祴鍊� end by 寮犵帀灞� */
- if (consumableOrderlist.size() > 0) {
- update consumableOrderlist;
- }
- }
- //Back up by DTT - Li Jun 2023-06-14 Start for reduce soql times
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鑾峰彇鎵�鏈夌殑record ID start by 寮犵帀灞�
- //List<RecordType> allrtList = [select Id,DeveloperName from RecordType where SobjectType = 'Consumable_orderdetails__c'];
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鑾峰彇鎵�鏈夌殑record ID end by 寮犵帀灞�
- //Back up by DTT - Li Jun 2023-06-14 Start
- //鍒拌揣鍜岃繑鍝佹椂,鐢熸垚鎴栦慨鏀规秷璐瑰搧璁㈣揣鏄庣粏
- Set<String> arrivedSet = new Set<String>();
- Set<String> returnSet = new Set<String>();
- if (Trigger.isUpdate || Trigger.isInsert || Trigger.isDelete) {
- if (Trigger.isUpdate || Trigger.isInsert) {
- for (Consumable_order_details2__c detail2 : Trigger.New) {
- Consumable_order_details2__c oldDetail2 = null;
- if (Trigger.isUpdate)
- oldDetail2 = Trigger.oldMap.get(detail2.Id);
- if (detail2.Consumable_Arrived_order__c != null) {
- arrivedSet.add(detail2.Consumable_Arrived_order__c);
+ if (consumableOrderlist.size() > 0){
+ update consumableOrderlist;
}
+ }
+ //Back up by DTT - Li Jun 2023-06-14 Start for reduce soql times
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鑾峰彇鎵�鏈夌殑record ID start by 寮犵帀灞�
+ //List<RecordType> allrtList = [select Id,DeveloperName from RecordType where SobjectType = 'Consumable_orderdetails__c'];
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鑾峰彇鎵�鏈夌殑record ID end by 寮犵帀灞�
+ //Back up by DTT - Li Jun 2023-06-14 Start
+ //鍒拌揣鍜岃繑鍝佹椂,鐢熸垚鎴栦慨鏀规秷璐瑰搧璁㈣揣鏄庣粏
+ Set<String> arrivedSet = new Set<String>();
+ Set<String> returnSet = new Set<String>();
+ if (trigger.isUpdate || trigger.isInsert || trigger.isDelete){
+ if (trigger.isUpdate || trigger.isInsert){
+ for (Consumable_order_details2__c detail2 : Trigger.New) {
+ Consumable_order_details2__c oldDetail2 = null;
+ if (Trigger.isUpdate) oldDetail2 = Trigger.oldMap.get(detail2.Id);
+ if (detail2.Consumable_Arrived_order__c != null) {
+ arrivedSet.add(detail2.Consumable_Arrived_order__c);
+ }
- if (
- (oldDetail2 == null ||
- oldDetail2.Consumable_Return_order__c == null) &&
- detail2.Consumable_Return_order__c != null
- ) {
- returnSet.add(detail2.Consumable_Return_order__c);
+ if ((oldDetail2 == null || oldDetail2.Consumable_Return_order__c == null) && detail2.Consumable_Return_order__c != null) {
+ returnSet.add(detail2.Consumable_Return_order__c);
+ }
+ }
}
- }
- }
- if (Trigger.isDelete) {
- for (Consumable_order_details2__c det2 : Trigger.old) {
- if (det2.Consumable_Arrived_order__c != null) {
- arrivedSet.add(det2.Consumable_Arrived_order__c);
- }
+ if (trigger.isDelete){
+ for (Consumable_order_details2__c det2 : Trigger.old) {
+ if (det2.Consumable_Arrived_order__c != null) {
+ arrivedSet.add(det2.Consumable_Arrived_order__c);
+ }
- if (det2.Consumable_Return_order__c != null) {
- returnSet.add(det2.Consumable_Return_order__c);
+ if (det2.Consumable_Return_order__c != null) {
+ returnSet.add(det2.Consumable_Return_order__c);
+ }
+ }
}
- }
- }
- System.debug('arrivedSet +++++' + arrivedSet);
+ System.debug('arrivedSet +++++' + arrivedSet);
// 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃arrivedset start by 寮犵帀灞�
- if (StaticParameter.EscapeConsumableOrderDetail2Trigger) {
- return;
- }
- // 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃arrivedset start by 寮犵帀灞�
- if (arrivedSet.size() > 0) {
- Map<Id, Consumable_order__c> arrivedMap = new Map<Id, Consumable_order__c>(
- [
- SELECT Id, RecordType.DeveloperName, Name
- FROM Consumable_order__c
- WHERE Id IN :arrivedSet
- ]
- );
- List<Consumable_orderdetails__c> detail1List = [
- SELECT
- Id,
- Name,
- Asset_Model_No__c,
- Consumable_count__c,
- Consumable_order__c
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c IN :arrivedSet
- ];
- Map<String, Consumable_orderdetails__c> detail1Map = new Map<String, Consumable_orderdetails__c>();
- for (Consumable_orderdetails__c detail1 : detail1List) {
- String key =
- '' +
- detail1.Consumable_order__c +
- detail1.Asset_Model_No__c;
- detail1Map.put(key, detail1);
- }
-
- arrivedSet.clear();
- for (Consumable_order__c arrivedCo : arrivedMap.values()) {
- if (arrivedCo.RecordType.DeveloperName == 'Arrive') {
- arrivedSet.add(arrivedCo.Id);
+ if (StaticParameter.EscapeConsumableOrderDetail2Trigger) {
+ return ;
}
- }
+ // 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃arrivedset start by 寮犵帀灞�
+ if (arrivedSet.size() > 0) {
+ Map<Id, Consumable_order__c> arrivedMap = new Map<Id, Consumable_order__c>([select Id, RecordType.DeveloperName, Name from Consumable_order__c where Id in :arrivedSet]);
+ List<Consumable_orderdetails__c> detail1List = [select Id, Name, Asset_Model_No__c, Consumable_count__c, Consumable_order__c from Consumable_orderdetails__c where Consumable_order__c in :arrivedSet];
+ Map<String,Consumable_orderdetails__c> detail1Map = new Map<String,Consumable_orderdetails__c>();
+ for (Consumable_orderdetails__c detail1 : detail1List) {
+ String key = '' + detail1.Consumable_order__c + detail1.Asset_Model_No__c;
+ detail1Map.put(key, detail1);
+ }
- AggregateResult[] results = [
- SELECT
- Consumable_Arrived_order__c,
- Asset_Model_No__c,
- count(bar_code__c) recordCount
- FROM Consumable_order_details2__c
- WHERE
- Consumable_Arrived_order__c IN :arrivedSet
- AND Dealer_Arrive__c = TRUE
- //and Dealer_Returned__c <> true
- AND (RemoveBox_No__c = NULL
- OR RemoveBox_No__c = 1)
- GROUP BY Consumable_Arrived_order__c, Asset_Model_No__c
- ];
- Map<String, Integer> keyCount = new Map<String, Integer>();
+ arrivedSet.clear();
+ for (Consumable_order__c arrivedCo : arrivedMap.values()) {
+ if (arrivedCo.RecordType.DeveloperName == 'Arrive') {
+ arrivedSet.add(arrivedCo.Id);
+ }
+ }
- for (AggregateResult ar : results) {
- String key =
- '' +
- ar.get('Consumable_Arrived_order__c') +
- ar.get('Asset_Model_No__c');
- keyCount.put(key, Integer.valueOf(ar.get('recordCount')));
- }
- //Back up by DTT - Li Jun 2023-06-14 Start
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select start by 寮犵帀灞�
- // List<RecordType> rtList = new List<RecordType>();
- // for(RecordType rtl : allrtList){
- // if('Detail1_Arrival'.equals(rtl.DeveloperName)){
- // rtList.add(rtl);
- // }
- // }
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select end by 寮犵帀灞�
- //Back up by DTT - Li Jun 2023-06-14 End
+ AggregateResult[] results = [select Consumable_Arrived_order__c, Asset_Model_No__c, count(bar_code__c) recordCount
+ from Consumable_order_details2__c
+ where Consumable_Arrived_order__c in :arrivedSet
+ and Dealer_Arrive__c = true
+ //and Dealer_Returned__c <> true
+ AND (RemoveBox_No__c=null or RemoveBox_No__c=1)
+ group by Consumable_Arrived_order__c, Asset_Model_No__c];
+ Map<String, Integer> keyCount = new Map<String, Integer>();
+
+ for(AggregateResult ar: results){
+ String key = '' + ar.get('Consumable_Arrived_order__c') + ar.get('Asset_Model_No__c');
+ keyCount.put(key, Integer.valueOf(ar.get('recordCount')));
+ }
+ //Back up by DTT - Li Jun 2023-06-14 Start
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select start by 寮犵帀灞�
+ // List<RecordType> rtList = new List<RecordType>();
+ // for(RecordType rtl : allrtList){
+ // if('Detail1_Arrival'.equals(rtl.DeveloperName)){
+ // rtList.add(rtl);
+ // }
+ // }
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select end by 寮犵帀灞�
+ //Back up by DTT - Li Jun 2023-06-14 End
- /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype start by 寮犵帀灞�
+ /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype start by 寮犵帀灞�
List<RecordType> rtList = [select Id from RecordType where DeveloperName = 'Detail1_Arrival' and SobjectType = 'Consumable_orderdetails__c'];
2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype end by 寮犵帀灞� */
- //Back up by DTT - Li Jun 2023-06-14 Start
- // Id recordTypeId = null;
- // if (rtList.size() > 0) recordTypeId = rtList[0].Id;
- //Back up by DTT - Li Jun 2023-06-14 End
- Id recordtypeId = Schema.SObjectType.Consumable_Orderdetails__c.getRecordTypeInfosByDeveloperName()
- .get('Detail1_Arrival')
- .getRecordTypeId();
- results = [
- SELECT Consumable_order__c, count(Id) noCount
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c IN :arrivedSet
- GROUP BY Consumable_order__c
- ];
- System.debug('results +++++' + results);
- Map<Id, Integer> noCount = new Map<Id, Integer>();
- for (AggregateResult ar : results) {
- noCount.put(
- (Id) ar.get('Consumable_order__c'),
- Integer.valueOf(ar.get('noCount'))
- );
- }
- System.debug('noCount +++++' + noCount);
- Map<String, Consumable_orderdetails__c> upsertMap = new Map<String, Consumable_orderdetails__c>();
- Map<String, Consumable_orderdetails__c> deletetMap = new Map<String, Consumable_orderdetails__c>();
- Map<String, String> assetModelNoMap = new Map<String, String>();
- if (Trigger.isUpdate || Trigger.isInsert) {
- for (Consumable_order_details2__c detail2 : Trigger.New) {
- //Dataloader銇у垵鏈熷湪搴櫥閷层倰銇椼仧銇傘仺銆併儑銉笺偪淇銇屽叆銇c仧銇ㄣ亶銇槑绱�1銇屾洿鏂般仌銈屻仾銇勩��
- //if (trigger.isUpdate && detail2.ManualRegisteredStock__c == true) continue;
- if (detail2.Consumable_Arrived_order__c == null)
- continue;
- String key =
- '' +
- detail2.Consumable_Arrived_order__c +
- detail2.Asset_Model_No__c;
- //if (upsertMap.get(key) != null) continue;
- Integer count = keyCount.get(key);
- Consumable_orderdetails__c detail1 = detail1Map.get(key);
+ //Back up by DTT - Li Jun 2023-06-14 Start
+ // Id recordTypeId = null;
+ // if (rtList.size() > 0) recordTypeId = rtList[0].Id;
+ //Back up by DTT - Li Jun 2023-06-14 End
+ Id recordtypeId = Schema.SObjectType.Consumable_Orderdetails__c.getRecordTypeInfosByDeveloperName().get('Detail1_Arrival').getRecordTypeId();
+ results = [select Consumable_order__c, count(Id) noCount
+ from Consumable_orderdetails__c
+ where Consumable_order__c in :arrivedSet
+ group by Consumable_order__c];
+ System.debug('results +++++' + results);
+ Map<Id, Integer> noCount = new Map<Id, Integer>();
+ for(AggregateResult ar: results){
+ noCount.put((Id)ar.get('Consumable_order__c'), Integer.valueOf(ar.get('noCount')));
+ }
+ System.debug('noCount +++++' + noCount);
+ Map<String, Consumable_orderdetails__c> upsertMap = new Map<String, Consumable_orderdetails__c>();
+ Map<String, Consumable_orderdetails__c> deletetMap = new Map<String, Consumable_orderdetails__c>();
+ Map<String, String> assetModelNoMap = new Map<String, String>();
+ if (trigger.isUpdate || trigger.isInsert){
+ for (Consumable_order_details2__c detail2 : Trigger.New) {
+ //Dataloader銇у垵鏈熷湪搴櫥閷层倰銇椼仧銇傘仺銆併儑銉笺偪淇銇屽叆銇c仧銇ㄣ亶銇槑绱�1銇屾洿鏂般仌銈屻仾銇勩��
+ //if (trigger.isUpdate && detail2.ManualRegisteredStock__c == true) continue;
+ if (detail2.Consumable_Arrived_order__c == null) continue;
+ String key = '' + detail2.Consumable_Arrived_order__c + detail2.Asset_Model_No__c;
+ //if (upsertMap.get(key) != null) continue;
+ Integer count = keyCount.get(key);
+ Consumable_orderdetails__c detail1 = detail1Map.get(key);
- if (detail1 == null)
- detail1 = new Consumable_orderdetails__c();
- detail1.Consumable_Arrivecount__c = count;
- if (detail1.Id == null) {
- Consumable_order__c co = arrivedMap.get(
- detail2.Consumable_Arrived_order__c
- );
- Integer index = noCount.get(co.Id);
- if (index == null)
- index = 0;
- if (assetModelNoMap.containsKey(detail2.Asset_Model_No__c)) {
- continue;
- } else {
- assetModelNoMap.put(
- detail2.Asset_Model_No__c,
- detail2.Asset_Model_No__c
- );
- noCount.put(co.Id, index + 1);
+ if (detail1 == null) detail1 = new Consumable_orderdetails__c();
+ detail1.Consumable_Arrivecount__c = count;
+ if (detail1.Id == null) {
+ Consumable_order__c co = arrivedMap.get(detail2.Consumable_Arrived_order__c);
+ Integer index = noCount.get(co.Id);
+ if (index == null) index = 0;
+ if(assetModelNoMap.containsKey(detail2.Asset_Model_No__c)){
+ continue;
+ }else{
+ assetModelNoMap.put(detail2.Asset_Model_No__c, detail2.Asset_Model_No__c);
+ noCount.put(co.Id, index + 1);
+ }
+ noCount.put(co.Id, index + 1);
+ String newName = co.Name+'-';
+ System.debug('index +++++' + index);
+ if (index < 99) {
+ newName += '0';
+ }
+ if (index < 9) {
+ newName += '0';
+ }
+ newName += String.valueOf(index + 1);
+ System.debug('newName +++++' + newName);
+ detail1.Name = newName;
+ //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
+ detail1.Consumable_product__c = detail2.Consumable_product__c;
+ detail1.Consumable_order__c = co.Id;
+ detail1.RecordTypeId = recordTypeId;
+ //detail1.Consumable_principal__c = co.Id;
+ detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
+
+ }
+ upsertMap.put(key, detail1);
+ }
}
- noCount.put(co.Id, index + 1);
- String newName = co.Name + '-';
- System.debug('index +++++' + index);
- if (index < 99) {
- newName += '0';
+
+ if (trigger.isUpdate){
+ for (Consumable_order_details2__c detail2 : Trigger.old) {
+ //Dataloader銇у垵鏈熷湪搴櫥閷层倰銇椼仧銇傘仺銆併儑銉笺偪淇銇屽叆銇c仧銇ㄣ亶銇槑绱�1銇屾洿鏂般仌銈屻仾銇勩��
+ //if (detail2.ManualRegisteredStock__c == true) continue;
+ if (detail2.Consumable_Arrived_order__c == null) continue;
+ String key = '' + detail2.Consumable_Arrived_order__c + detail2.Asset_Model_No__c;
+ //if (upsertMap.get(key) != null) continue;
+ Integer count = keyCount.get(key);
+ Consumable_orderdetails__c detail1 = detail1Map.get(key);
+ if ((count == null || count ==0) && detail1 !=null){
+ //delete detail1;
+ deletetMap.put(key,detail1);
+ continue;
+ }
+ if (detail1 == null) continue;
+ detail1.Consumable_Arrivecount__c = count;
+
+ if (detail1.Id == null) {
+ Consumable_order__c co = arrivedMap.get(detail2.Consumable_Arrived_order__c);
+ Integer index = noCount.get(co.Id);
+ if (index == null) index = 0;
+ System.debug('indexUp +++++' + index);
+ noCount.put(co.Id, index + 1);
+ System.debug('noCountUp +++++' + noCount);
+ String newName = co.Name+'-';
+ if (index < 99) {
+ newName += '0';
+ }
+ if (index < 9) {
+ newName += '0';
+ }
+ newName += String.valueOf(index + 1);
+ System.debug('newNameUp +++++' + newName);
+ detail1.Name = newName;
+ //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
+ detail1.Consumable_product__c = detail2.Consumable_product__c;
+ detail1.Consumable_order__c = co.Id;
+ detail1.RecordTypeId = recordTypeId;
+ //detail1.Consumable_principal__c = co.Id;
+ detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
+
+
+ }
+ upsertMap.put(key, detail1);
+ }
}
- if (index < 9) {
- newName += '0';
+
+ if (trigger.isDelete){
+ for (Consumable_order_details2__c detail2 : Trigger.old) {
+ if (detail2.Consumable_Arrived_order__c == null) continue;
+ String key = '' + detail2.Consumable_Arrived_order__c + detail2.Asset_Model_No__c;
+ //if (upsertMap.get(key) != null) continue;
+ Integer count = keyCount.get(key);
+ Consumable_orderdetails__c detail1 = detail1Map.get(key);
+ if ((count == null || count ==0) && detail1 !=null){
+ //delete detail1;
+ deletetMap.put(key,detail1);
+ continue;
+ }
+ if (detail1 == null) detail1 = new Consumable_orderdetails__c();
+ detail1.Consumable_Arrivecount__c = count;
+
+ if (detail1.Id == null) {
+ Consumable_order__c co = arrivedMap.get(detail2.Consumable_Arrived_order__c);
+ Integer index = noCount.get(co.Id);
+ if (index == null) index = 0;
+ noCount.put(co.Id, index + 1);
+ String newName = co.Name+'-';
+ if (index < 99) {
+ newName += '0';
+ }
+ if (index < 9) {
+ newName += '0';
+ }
+ newName += String.valueOf(index + 1);
+ detail1.Name = newName;
+ //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
+ detail1.Consumable_product__c = detail2.Consumable_product__c;
+ detail1.Consumable_order__c = co.Id;
+ detail1.RecordTypeId = recordTypeId;
+ //detail1.Consumable_principal__c = co.Id;
+ detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
+
+ }
+ upsertMap.put(key, detail1);
+ }
}
- newName += String.valueOf(index + 1);
- System.debug('newName +++++' + newName);
- detail1.Name = newName;
- //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
- detail1.Consumable_product__c = detail2.Consumable_product__c;
- detail1.Consumable_order__c = co.Id;
- detail1.RecordTypeId = recordTypeId;
- //detail1.Consumable_principal__c = co.Id;
- detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
- }
- upsertMap.put(key, detail1);
+
+ Database.upsert(upsertMap.values(), true);
+ if(deletetMap.size()>0){
+ Database.delete(deletetMap.values(),true);
+ }
+
}
- }
-
- if (Trigger.isUpdate) {
- for (Consumable_order_details2__c detail2 : Trigger.old) {
- //Dataloader銇у垵鏈熷湪搴櫥閷层倰銇椼仧銇傘仺銆併儑銉笺偪淇銇屽叆銇c仧銇ㄣ亶銇槑绱�1銇屾洿鏂般仌銈屻仾銇勩��
- //if (detail2.ManualRegisteredStock__c == true) continue;
- if (detail2.Consumable_Arrived_order__c == null)
- continue;
- String key =
- '' +
- detail2.Consumable_Arrived_order__c +
- detail2.Asset_Model_No__c;
- //if (upsertMap.get(key) != null) continue;
- Integer count = keyCount.get(key);
- Consumable_orderdetails__c detail1 = detail1Map.get(key);
- if ((count == null || count == 0) && detail1 != null) {
- //delete detail1;
- deletetMap.put(key, detail1);
- continue;
- }
- if (detail1 == null)
- continue;
- detail1.Consumable_Arrivecount__c = count;
-
- if (detail1.Id == null) {
- Consumable_order__c co = arrivedMap.get(
- detail2.Consumable_Arrived_order__c
- );
- Integer index = noCount.get(co.Id);
- if (index == null)
- index = 0;
- System.debug('indexUp +++++' + index);
- noCount.put(co.Id, index + 1);
- System.debug('noCountUp +++++' + noCount);
- String newName = co.Name + '-';
- if (index < 99) {
- newName += '0';
- }
- if (index < 9) {
- newName += '0';
- }
- newName += String.valueOf(index + 1);
- System.debug('newNameUp +++++' + newName);
- detail1.Name = newName;
- //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
- detail1.Consumable_product__c = detail2.Consumable_product__c;
- detail1.Consumable_order__c = co.Id;
- detail1.RecordTypeId = recordTypeId;
- //detail1.Consumable_principal__c = co.Id;
- detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
- }
- upsertMap.put(key, detail1);
- }
- }
-
- if (Trigger.isDelete) {
- for (Consumable_order_details2__c detail2 : Trigger.old) {
- if (detail2.Consumable_Arrived_order__c == null)
- continue;
- String key =
- '' +
- detail2.Consumable_Arrived_order__c +
- detail2.Asset_Model_No__c;
- //if (upsertMap.get(key) != null) continue;
- Integer count = keyCount.get(key);
- Consumable_orderdetails__c detail1 = detail1Map.get(key);
- if ((count == null || count == 0) && detail1 != null) {
- //delete detail1;
- deletetMap.put(key, detail1);
- continue;
- }
- if (detail1 == null)
- detail1 = new Consumable_orderdetails__c();
- detail1.Consumable_Arrivecount__c = count;
-
- if (detail1.Id == null) {
- Consumable_order__c co = arrivedMap.get(
- detail2.Consumable_Arrived_order__c
- );
- Integer index = noCount.get(co.Id);
- if (index == null)
- index = 0;
- noCount.put(co.Id, index + 1);
- String newName = co.Name + '-';
- if (index < 99) {
- newName += '0';
- }
- if (index < 9) {
- newName += '0';
- }
- newName += String.valueOf(index + 1);
- detail1.Name = newName;
- //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
- detail1.Consumable_product__c = detail2.Consumable_product__c;
- detail1.Consumable_order__c = co.Id;
- detail1.RecordTypeId = recordTypeId;
- //detail1.Consumable_principal__c = co.Id;
- detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
- }
- upsertMap.put(key, detail1);
- }
- }
-
- Database.upsert(upsertMap.values(), true);
- if (deletetMap.size() > 0) {
- Database.delete(deletetMap.values(), true);
- }
}
- }
- // 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃returnSet start by 寮犵帀灞�
+ // 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃returnSet start by 寮犵帀灞�
- if (Trigger.isUpdate || Trigger.isInsert) {
- if (StaticParameter.EscapeConsumableOrderDetail2Trigger) {
- return;
+ if (trigger.isUpdate || trigger.isInsert){
+ if (StaticParameter.EscapeConsumableOrderDetail2Trigger) {
+ return ;
}
// 2018骞�8鏈�14鏃� HWAG-B3D9UV 鍦ㄨ繘琛孨FM110澶勭悊鏃� 璺宠繃returnSet start by 寮犵帀灞�
- if (returnSet.size() > 0) {
- Map<Id, Consumable_order__c> returnMap = new Map<Id, Consumable_order__c>(
- [
- SELECT Id, RecordType.DeveloperName, Name
- FROM Consumable_order__c
- WHERE Id IN :returnSet
- ]
- );
- List<Consumable_orderdetails__c> detail1List = [
- SELECT
- Id,
- Name,
- Asset_Model_No__c,
- Consumable_count__c,
- Consumable_order__c
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c IN :returnSet
- ];
- Map<String, Consumable_orderdetails__c> detail1Map = new Map<String, Consumable_orderdetails__c>();
+ if (returnSet.size() > 0) {
+ Map<Id, Consumable_order__c> returnMap = new Map<Id, Consumable_order__c>([select Id, RecordType.DeveloperName, Name from Consumable_order__c where Id in :returnSet]);
+ List<Consumable_orderdetails__c> detail1List = [select Id, Name, Asset_Model_No__c, Consumable_count__c, Consumable_order__c from Consumable_orderdetails__c where Consumable_order__c in :returnSet];
+ Map<String,Consumable_orderdetails__c> detail1Map = new Map<String,Consumable_orderdetails__c>();
+
+ for (Consumable_orderdetails__c detail1 : detail1List) {
+ String key = '' + detail1.Consumable_order__c + detail1.Asset_Model_No__c;
+ detail1Map.put(key, detail1);
+ }
- for (Consumable_orderdetails__c detail1 : detail1List) {
- String key =
- '' +
- detail1.Consumable_order__c +
- detail1.Asset_Model_No__c;
- detail1Map.put(key, detail1);
- }
+ returnSet.clear();
+ for (Consumable_order__c returnCo : returnMap.values()) {
+ if (returnCo.RecordType.DeveloperName == 'ReturnGoods') {
+ returnSet.add(returnCo.Id);
+ }
+ }
- returnSet.clear();
- for (Consumable_order__c returnCo : returnMap.values()) {
- if (returnCo.RecordType.DeveloperName == 'ReturnGoods') {
- returnSet.add(returnCo.Id);
- }
- }
-
- AggregateResult[] results = [
- SELECT
- Consumable_Return_order__c,
- Asset_Model_No__c,
- count(Id) recordCount
- FROM Consumable_order_details2__c
- WHERE
- Consumable_Return_order__c IN :returnSet
- AND Dealer_Returned__c = TRUE
- GROUP BY Consumable_Return_order__c, Asset_Model_No__c
- ];
- Map<String, Integer> keyCount = new Map<String, Integer>();
- for (AggregateResult ar : results) {
- String key =
- '' +
- ar.get('Consumable_Return_order__c') +
- ar.get('Asset_Model_No__c');
- keyCount.put(key, Integer.valueOf(ar.get('recordCount')));
- }
- //Back up by DTT - Li Jun 2023-06-14 Start for reduce soql times
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select start by 寮犵帀灞�
- // List<RecordType> rtList = new List<RecordType>();
- // for(RecordType rtl : allrtList){
- // if('Detail1_ReturnGoods'.equals(rtl.DeveloperName)){
- // rtList.add(rtl);
- // }
- // }
- // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select end by 寮犵帀灞�
- //Back up by DTT - Li Jun 2023-06-14 End
- /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype start by 寮犵帀灞�
+ AggregateResult[] results = [select Consumable_Return_order__c, Asset_Model_No__c, count(Id) recordCount
+ from Consumable_order_details2__c
+ where Consumable_Return_order__c in :returnSet
+ and Dealer_Returned__c = true
+ group by Consumable_Return_order__c, Asset_Model_No__c];
+ Map<String, Integer> keyCount = new Map<String, Integer>();
+ for(AggregateResult ar: results){
+ String key = '' + ar.get('Consumable_Return_order__c') + ar.get('Asset_Model_No__c');
+ keyCount.put(key, Integer.valueOf(ar.get('recordCount')));
+ }
+ //Back up by DTT - Li Jun 2023-06-14 Start for reduce soql times
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select start by 寮犵帀灞�
+ // List<RecordType> rtList = new List<RecordType>();
+ // for(RecordType rtl : allrtList){
+ // if('Detail1_ReturnGoods'.equals(rtl.DeveloperName)){
+ // rtList.add(rtl);
+ // }
+ // }
+ // 2018骞�8鏈�9鏃� HWAG-B3D9UV 鏇夸唬涓嬮潰SQL select end by 寮犵帀灞�
+ //Back up by DTT - Li Jun 2023-06-14 End
+ /* 2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype start by 寮犵帀灞�
List<RecordType> rtList = [select Id from RecordType where DeveloperName = 'Detail1_ReturnGoods' and SobjectType = 'Consumable_orderdetails__c'];
2018骞�8鏈�9鏃� HWAG-B3D9UV 鍘熻幏鍙� recordtype end by 寮犵帀灞� */
- Id recordTypeId = Schema.SObjectType.Consumable_Orderdetails__c.getRecordTypeInfosByDeveloperName()
- .get('Detail1_ReturnGoods')
- .getRecordTypeId();
- //if (rtList.size() > 0) recordTypeId = rtList[0].Id;
+ Id recordTypeId = Schema.SObjectType.Consumable_Orderdetails__c.getRecordTypeInfosByDeveloperName().get('Detail1_ReturnGoods').getRecordTypeId();
+ //if (rtList.size() > 0) recordTypeId = rtList[0].Id;
- results = [
- SELECT Consumable_order__c, count(Id) noCount
- FROM Consumable_orderdetails__c
- WHERE Consumable_order__c IN :returnSet
- GROUP BY Consumable_order__c
- ];
- Map<Id, Integer> noCount = new Map<Id, Integer>();
- for (AggregateResult ar : results) {
- noCount.put(
- (Id) ar.get('Consumable_order__c'),
- Integer.valueOf(ar.get('noCount'))
- );
- }
-
- Map<String, Consumable_orderdetails__c> upsertMap = new Map<String, Consumable_orderdetails__c>();
- Map<String, Integer> updatedSaleCount = new Map<String, Integer>();
- Set<Id> updatedSaleId = new Set<Id>();
- Map<String, Integer> updatedShipmentCount = new Map<String, Integer>();
- Set<Id> updatedShipmentId = new Set<Id>();
- Map<String, Integer> updatedConInvoiceCount = new Map<String, Integer>();
- Map<String, String> shipmentIdMap = new Map<String, String>();
- Set<Id> updatedConInvoiceId = new Set<Id>();
- Integer returnCount = 0;
-
- for (Consumable_order_details2__c detail2 : Trigger.New) {
- Consumable_order_details2__c oldDetail2 = null;
- if (detail2.Consumable_Return_order__c == null)
- continue;
-
- String key =
- '' +
- detail2.Consumable_Return_order__c +
- detail2.Asset_Model_No__c;
-
- if (Trigger.isUpdate)
- oldDetail2 = Trigger.oldMap.get(detail2.Id);
- if (oldDetail2 != null) {
- if (keyCount.containsKey(key)) {
- returnCount += 1;
- if (oldDetail2.Consumable_Sale_order__c != null) {
- Integer sCount = updatedSaleCount.containsKey(
- '' +
- oldDetail2.Consumable_Sale_order__c +
- detail2.Asset_Model_No__c
- )
- ? updatedSaleCount.get(
- '' +
- oldDetail2.Consumable_Sale_order__c +
- detail2.Asset_Model_No__c
- )
- : 0;
- sCount += 1;
- updatedSaleCount.put(
- '' +
- oldDetail2.Consumable_Sale_order__c +
- detail2.Asset_Model_No__c,
- sCount
- );
- updatedSaleId.add(oldDetail2.Consumable_Sale_order__c);
+ results = [select Consumable_order__c, count(Id) noCount
+ from Consumable_orderdetails__c
+ where Consumable_order__c in :returnSet
+ group by Consumable_order__c];
+ Map<Id, Integer> noCount = new Map<Id, Integer>();
+ for(AggregateResult ar: results){
+ noCount.put((Id)ar.get('Consumable_order__c'), Integer.valueOf(ar.get('noCount')));
}
- if (oldDetail2.Consumable_Shipment_order__c != null) {
- Integer sCount = updatedShipmentCount.containsKey(
- '' +
- oldDetail2.Consumable_Shipment_order__c +
- detail2.Asset_Model_No__c
- )
- ? updatedShipmentCount.get(
- '' +
- oldDetail2.Consumable_Shipment_order__c +
- detail2.Asset_Model_No__c
- )
- : 0;
- sCount += 1;
- updatedShipmentCount.put(
- '' +
- oldDetail2.Consumable_Shipment_order__c +
- detail2.Asset_Model_No__c,
- sCount
- );
- updatedShipmentId.add(oldDetail2.Consumable_Shipment_order__c);
- }
- /*if (oldDetail2.Invoice_No__c != null) {
+ Map<String, Consumable_orderdetails__c> upsertMap = new Map<String, Consumable_orderdetails__c>();
+ Map<String, Integer> updatedSaleCount = new Map<String, Integer>();
+ Set<Id> updatedSaleId = new Set<Id>();
+ Map<String, Integer> updatedShipmentCount = new Map<String, Integer>();
+ Set<Id> updatedShipmentId = new Set<Id>();
+ Map<String, Integer> updatedConInvoiceCount = new Map<String, Integer>();
+ Map<String, String> shipmentIdMap = new Map<String, String>();
+ Set<Id> updatedConInvoiceId = new Set<Id>();
+ Integer returnCount = 0;
+
+ for (Consumable_order_details2__c detail2 : Trigger.New) {
+ Consumable_order_details2__c oldDetail2 = null;
+ if (detail2.Consumable_Return_order__c == null) continue;
+
+ String key = '' + detail2.Consumable_Return_order__c + detail2.Asset_Model_No__c;
+
+ if(Trigger.isUpdate) oldDetail2 = Trigger.oldMap.get(detail2.Id);
+ if (oldDetail2 != null) {
+ if (keyCount.containsKey(key)) {
+ returnCount += 1;
+ if (oldDetail2.Consumable_Sale_order__c != null) {
+ Integer sCount = updatedSaleCount.containsKey(''+oldDetail2.Consumable_Sale_order__c+detail2.Asset_Model_No__c) ? updatedSaleCount.get(''+oldDetail2.Consumable_Sale_order__c+detail2.Asset_Model_No__c) : 0;
+ sCount += 1;
+ updatedSaleCount.put(''+oldDetail2.Consumable_Sale_order__c+detail2.Asset_Model_No__c, sCount);
+ updatedSaleId.add(oldDetail2.Consumable_Sale_order__c);
+ }
+ if (oldDetail2.Consumable_Shipment_order__c != null) {
+ Integer sCount = updatedShipmentCount.containsKey(''+oldDetail2.Consumable_Shipment_order__c+detail2.Asset_Model_No__c) ? updatedShipmentCount.get(''+oldDetail2.Consumable_Shipment_order__c+detail2.Asset_Model_No__c) : 0;
+ sCount += 1;
+
+ updatedShipmentCount.put(''+oldDetail2.Consumable_Shipment_order__c+detail2.Asset_Model_No__c, sCount);
+ updatedShipmentId.add(oldDetail2.Consumable_Shipment_order__c);
+ }
+ /*if (oldDetail2.Invoice_No__c != null) {
Integer sCount = updatedConInvoiceCount.containsKey(''+oldDetail2.Invoice_No__c+oldDetail2.Consumable_Sale_order__c+detail2.Asset_Model_No__c) ? updatedConInvoiceCount.get(''+oldDetail2.Invoice_No__c+oldDetail2.Consumable_Sale_order__c+detail2.Asset_Model_No__c) : 0;
sCount += 1;
if(oldDetail2.Consumable_Shipment_order__c == null){
@@ -811,105 +631,82 @@
updatedConInvoiceId.add(oldDetail2.Invoice_No__c);
}*/
- }
- }
- if (upsertMap.get(key) != null)
- continue;
- Integer count = keyCount.get(key);
+ }
+ }
+ if (upsertMap.get(key) != null) continue;
+ Integer count = keyCount.get(key);
- Consumable_orderdetails__c detail1 = detail1Map.get(key);
+ Consumable_orderdetails__c detail1 = detail1Map.get(key);
- if (detail1 == null)
- detail1 = new Consumable_orderdetails__c();
- detail1.RrturnPro_count__c = count;
+ if (detail1 == null) detail1 = new Consumable_orderdetails__c();
+ detail1.RrturnPro_count__c = count;
- if (detail1.Id == null) {
- Consumable_order__c co = returnMap.get(
- detail2.Consumable_Return_order__c
- );
- Integer index = noCount.get(co.Id);
- if (index == null)
- index = 0;
- noCount.put(co.Id, index + 1);
- String newName = co.Name + '-';
- if (index < 99) {
- newName += '0';
- }
- if (index < 9) {
- newName += '0';
- }
- newName += String.valueOf(index + 1);
- detail1.Name = newName;
- //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
- detail1.Consumable_product__c = detail2.Consumable_product__c;
- detail1.Consumable_order__c = co.Id;
- detail1.RecordTypeId = recordTypeId;
- //detail1.Consumable_principal__c = co.Id;
- detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
- }
- upsertMap.put(key, detail1);
- }
+ if (detail1.Id == null) {
+ Consumable_order__c co = returnMap.get(detail2.Consumable_Return_order__c);
+ Integer index = noCount.get(co.Id);
+ if (index == null) index = 0;
+ noCount.put(co.Id, index + 1);
+ String newName = co.Name+'-';
+ if (index < 99) {
+ newName += '0';
+ }
+ if (index < 9) {
+ newName += '0';
+ }
+ newName += String.valueOf(index + 1);
+ detail1.Name = newName;
+ //detail1.Asset_Model_No__c = detail2.Asset_Model_No__c;
+ detail1.Consumable_product__c = detail2.Consumable_product__c;
+ detail1.Consumable_order__c = co.Id;
+ detail1.RecordTypeId = recordTypeId;
+ //detail1.Consumable_principal__c = co.Id;
+ detail1.Intra_Trade_List_RMB__c = detail2.Intra_Trade_List_RMB__c;
+
+ }
+ upsertMap.put(key, detail1);
+ }
- Database.upsert(upsertMap.values(), true);
- // 2018骞�8鏈�8鏃� HWAG-B3D9UV 鍑忓皯 select 鏁伴噺 start by 寮犵帀灞�
- List<Consumable_orderdetails__c> Consumable_orderdetailsList = [
- SELECT
- Id,
- Name,
- Asset_Model_No__c,
- RrturnPro_count__c,
- Consumable_order__c,
- Invoicedet1_OD_link__c
- FROM Consumable_orderdetails__c
- WHERE
- Consumable_order__c IN :updatedSaleId
- OR Consumable_order__c IN :updatedShipmentId
- OR Consumable_order__c IN :updatedConInvoiceId
- ];
+ Database.upsert(upsertMap.values(), true);
+ // 2018骞�8鏈�8鏃� HWAG-B3D9UV 鍑忓皯 select 鏁伴噺 start by 寮犵帀灞�
+ List<Consumable_orderdetails__c> Consumable_orderdetailsList =
+ [select Id, Name, Asset_Model_No__c, RrturnPro_count__c,
+ Consumable_order__c,Invoicedet1_OD_link__c
+ from Consumable_orderdetails__c
+ where Consumable_order__c in :updatedSaleId
+ or Consumable_order__c in :updatedShipmentId
+ or Consumable_order__c in :updatedConInvoiceId];
+
+ List<Consumable_orderdetails__c> detail1SaleList
+ = new List<Consumable_orderdetails__c>();
+
+ for (Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList){
+ if(updatedSaleId.contains(orderdetails.id)
+ && 'Sale'.equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)){
+ detail1SaleList.add(orderdetails);
+ }
+ }
- List<Consumable_orderdetails__c> detail1SaleList = new List<Consumable_orderdetails__c>();
+ List<Consumable_orderdetails__c> detail1ShipmentList
+ = new List<Consumable_orderdetails__c>();
- for (
- Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList
- ) {
- if (
- updatedSaleId.contains(orderdetails.id) &&
- 'Sale'
- .equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)
- ) {
- detail1SaleList.add(orderdetails);
- }
- }
+ for (Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList){
+ if(updatedShipmentId.contains(orderdetails.id)
+ && 'Shipment'.equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)){
+ detail1ShipmentList.add(orderdetails);
+ }
+ }
- List<Consumable_orderdetails__c> detail1ShipmentList = new List<Consumable_orderdetails__c>();
+ List<Consumable_orderdetails__c> detail1ConInvoiceList
+ = new List<Consumable_orderdetails__c>();
- for (
- Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList
- ) {
- if (
- updatedShipmentId.contains(orderdetails.id) &&
- 'Shipment'
- .equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)
- ) {
- detail1ShipmentList.add(orderdetails);
- }
- }
-
- List<Consumable_orderdetails__c> detail1ConInvoiceList = new List<Consumable_orderdetails__c>();
-
- for (
- Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList
- ) {
- if (
- updatedConInvoiceId.contains(orderdetails.id) &&
- 'Order_Invoice'
- .equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)
- ) {
- detail1ConInvoiceList.add(orderdetails);
- }
- }
- // 2018骞�8鏈�8鏃� HWAG-B3D9UV 鍑忓皯 select 鏁伴噺 end by 寮犵帀灞�
- /* 2018骞�8鏈�8鏃� HWAG-B3D9UV 娉ㄩ噴 鏇挎崲涓轰笂闈㈢殑閭d釜 end by 寮犵帀灞�
+ for (Consumable_orderdetails__c orderdetails : Consumable_orderdetailsList){
+ if(updatedConInvoiceId.contains(orderdetails.id)
+ && 'Order_Invoice'.equals(orderdetails.Consumable_order__r.RecordType.DeveloperName)){
+ detail1ConInvoiceList.add(orderdetails);
+ }
+ }
+ // 2018骞�8鏈�8鏃� HWAG-B3D9UV 鍑忓皯 select 鏁伴噺 end by 寮犵帀灞�
+ /* 2018骞�8鏈�8鏃� HWAG-B3D9UV 娉ㄩ噴 鏇挎崲涓轰笂闈㈢殑閭d釜 end by 寮犵帀灞�
List<Consumable_orderdetails__c> detail1SaleList =
[select Id, Name, Asset_Model_No__c, RrturnPro_count__c, Consumable_order__c
from Consumable_orderdetails__c
@@ -929,52 +726,33 @@
where Consumable_order__c in :updatedConInvoiceId
and Consumable_order__r.RecordType.DeveloperName = 'Order_Invoice'];
*/
- List<Consumable_orderdetails__c> updateData = new List<Consumable_orderdetails__c>();
+ List<Consumable_orderdetails__c> updateData = new List<Consumable_orderdetails__c>();
- for (Consumable_orderdetails__c detail1Sale : detail1SaleList) {
- Integer count = updatedSaleCount.get(
- '' + detail1Sale.Consumable_order__c + detail1Sale.Asset_Model_No__c
- );
- if (count != null) {
- detail1Sale.RrturnPro_count__c += count;
- updateData.add(detail1Sale);
- }
- }
- for (Consumable_orderdetails__c detail1Shipment : detail1ShipmentList) {
- Integer count = updatedShipmentCount.get(
- '' +
- detail1Shipment.Consumable_order__c +
- detail1Shipment.Asset_Model_No__c
- );
- if (count != null) {
- detail1Shipment.RrturnPro_count__c += count;
- updateData.add(detail1Shipment);
- }
- }
- for (
- Consumable_orderdetails__c detail1ConInvoice : detail1ConInvoiceList
- ) {
- Integer count = updatedConInvoiceCount.get(
- '' +
- detail1ConInvoice.Consumable_order__c +
- detail1ConInvoice.Invoicedet1_OD_link__c +
- detail1ConInvoice.Asset_Model_No__c
- );
- if (
- count != null &&
- (detail1ConInvoice.Invoicedet1_OD_link__c ==
- shipmentIdMap.get(
- '' +
- detail1ConInvoice.Invoicedet1_OD_link__c +
- detail1ConInvoice.Asset_Model_No__c
- ))
- ) {
- detail1ConInvoice.RrturnPro_count__c += count;
- //updateData.add(detail1ConInvoice);
- }
- }
+ for (Consumable_orderdetails__c detail1Sale : detail1SaleList) {
+ Integer count = updatedSaleCount.get(''+detail1Sale.Consumable_order__c+detail1Sale.Asset_Model_No__c);
+ if (count != null) {
+ detail1Sale.RrturnPro_count__c += count;
+ updateData.add(detail1Sale);
+ }
+
+ }
+ for (Consumable_orderdetails__c detail1Shipment : detail1ShipmentList) {
+ Integer count = updatedShipmentCount.get(''+detail1Shipment.Consumable_order__c+detail1Shipment.Asset_Model_No__c);
+ if (count != null) {
+ detail1Shipment.RrturnPro_count__c += count;
+ updateData.add(detail1Shipment);
+ }
+ }
+ for (Consumable_orderdetails__c detail1ConInvoice : detail1ConInvoiceList) {
+ Integer count = updatedConInvoiceCount.get(''+detail1ConInvoice.Consumable_order__c+detail1ConInvoice.Invoicedet1_OD_link__c+detail1ConInvoice.Asset_Model_No__c);
+ if (count != null && (detail1ConInvoice.Invoicedet1_OD_link__c == shipmentIdMap.get(''+detail1ConInvoice.Invoicedet1_OD_link__c+detail1ConInvoice.Asset_Model_No__c)) ) {
+ detail1ConInvoice.RrturnPro_count__c += count;
+ //updateData.add(detail1ConInvoice);
+ }
+ }
- Database.upsert(updateData, true);
+ Database.upsert(updateData, true);
+ }
+
}
- }
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml b/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml
index b571e13..7acf013 100644
--- a/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml
+++ b/force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<status>Active</status>
diff --git a/force-app/main/default/triggers/ContentDocumentLink.trigger b/force-app/main/default/triggers/ContentDocumentLink.trigger
index 368da2a..81c69ce 100644
--- a/force-app/main/default/triggers/ContentDocumentLink.trigger
+++ b/force-app/main/default/triggers/ContentDocumentLink.trigger
@@ -1,6 +1,9 @@
trigger ContentDocumentLink on ContentDocumentLink (before delete, after insert) {
+ System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ System.debug('System.Label.ByPassTrigger = ' + System.Label.ByPassTrigger);
if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+ System.debug('enter ContentDocumentLink but UserInfo.getUserId()==System.Label.ByPassTrigger');
return;
}
system.debug('enter ContentDocumentLink');
diff --git a/force-app/main/default/triggers/ContentDocumentTrigger.trigger b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
index 68a2e4e..44da932 100644
--- a/force-app/main/default/triggers/ContentDocumentTrigger.trigger
+++ b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
@@ -1,5 +1,8 @@
trigger ContentDocumentTrigger on ContentDocument(before delete) {
+ System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ System.debug('System.Label.ByPassTrigger = ' + System.Label.ByPassTrigger);
if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+ System.debug('enter ContentDocumentTrigger but UserInfo.getUserId()==System.Label.ByPassTrigger');
return;
}
System.debug('enter ContentDocumentTrigger');
diff --git a/manifest/LEXC02packagelexcommunityupdate.xml b/manifest/LEXC02packagelexcommunityupdate.xml
index 9481c04..7a2b7d9 100644
--- a/manifest/LEXC02packagelexcommunityupdate.xml
+++ b/manifest/LEXC02packagelexcommunityupdate.xml
@@ -24,6 +24,10 @@
<members>CreateTarget</members>
<members>RetrospectiveWeeklyReport</members>
<members>WeeklyReport</members>
+ <members>AgencyAccount</members>
+ <members>DealerPersonnelInformationImport</members>
+ <members>NewAgencyContact2</members>
+ <members>NewAgencyOpportunity</members>
<name>AuraDefinitionBundle</name>
</types>
<types>
--
Gitblit v1.9.1