| | |
| | | "**/.sfdx": true |
| | | }, |
| | | "salesforcedx-vscode-core.show-cli-success-msg": false, |
| | | "salesforcedx-vscode-apex.java.home": "C:\\Users\\buli\\Documents\\Software\\JDK11\\", |
| | | "open-in-browser.default": "{\"opn-in-browser.default\":\"Microsoft Edge\"}" |
| | | } |
| | |
| | | <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="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="PIConfig" type="Map" /> |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | |
| | | <!-- 批量添加日报 end--> |
| | | <!--ロード中...--> |
| | | <aura:renderIf isTrue="{!v.login}"> |
| | | <aura:renderIf isTrue="{!!v.loginEdit}"> |
| | | <lightning:spinner alternativeText="Loading" size="medium" /> |
| | | </aura:renderIf> |
| | | <!-- 批量添加日报 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> |
| | | <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> |
| | | <!-- 代理店担当者 --> |
| | | <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> |
| | | </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> |
| | | <!-- 代理店担当者 --> |
| | | <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 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> |
| | | <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> |
| | | </aura:set> |
| | | </aura:renderIf> |
| | | </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> |
| | | <!-- 批量添加日报 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> |
| | | <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 class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv01" style="z-index: 10001"> |
| | | </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"> |
| | |
| | | </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 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> |
| | | <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> |
| | | <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> |
| | | <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 aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div> |
| | | <!-- 批量添加日报 end--> |
| | | </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}" /> |
| | | <!-- 批量导出日报 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-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 |
| | | 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> |
| | | <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 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 |
| | | 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 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> |
| | | <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 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> |
| | | </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> |
| | | <!-- 医院 --> |
| | | <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" |
| | | </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}" /> |
| | | <!-- </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> |
| | | </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> |
| | | </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> |
| | | </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> |
| | | </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> |
| | | </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> |
| | | </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" |
| | | </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" /> |
| | | </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"/> 预测与OCSM签约日 --> |
| | | <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> |
| | | <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"/> 预测与OCSM签约日 --> |
| | | <lightning:inputField |
| | | value="{!v.oppdata.Close_Forecasted_Date__c}" |
| | | class="" |
| | | /> |
| | | </div> |
| | | <hr /> |
| | | </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 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_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> |
| | | <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 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:renderIf> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div |
| | | aura:id="modal_bg" |
| | | class="disp_none slds-backdrop slds-backdrop--open" |
| | | ></div> |
| | | |
| | | </aura:component> |
| | | <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 |
| | | 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 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="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}"> |
| | | <!-- 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> |
| | | <!-- 批量添加周报 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> |
| | | |
| | | <div aura:id="report" id="report"> |
| | | <div class="slds-grid slds-wrap slds-grid--pull-padded"> |
| | | <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"> |
| | | 周 |
| | | </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> |
| | | |
| | | <!-- 代理店担当者 --> |
| | | <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: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> |
| | | |
| | | <!-- 代理店担当者 --> |
| | | <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 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;"> |
| | | <span class="slds-truncate" title="Name">周报编号</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 100px;"> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 250px;"> |
| | | <span class="slds-truncate" title="Name">医院</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 100px;"> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 100px;"> |
| | | <!-- PIPL update Yin Mingjie 21/02/2022 start |
| | | </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 |
| | | <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;">{!v.fieldsmap.Agency_Contact__c}</span> |
| | | |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 100px;"> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <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} |
| | | <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" |
| | | /> |
| | | </div> |
| | | </aura:set> |
| | | </aura:renderIf> |
| | | </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--> |
| | | |
| | | <!-- <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 "> |
| | | <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--> |
| | | <!-- 批量导出周报 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" |
| | | > |
| | | 活动日开始日期 |
| | | |
| | | <!-- 批量导出周报 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}"/> |
| | | <lightning:input |
| | | type="Date" |
| | | class="slds-input slds-input_bare" |
| | | aura:id="input-report-date1" |
| | | /> |
| | | </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-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"/> |
| | |
| | | <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> |
| | | <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> |
| | | </div> |
| | | </aura:set> |
| | | </aura:if> |
| | | </div> |
| | | </div> |
| | | <div aura:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div> |
| | | <!-- 批量导出周报 end--> |
| | | </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__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 |
| | | 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 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 |
| | | 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> |
| | | <!-- 医院 --> |
| | | <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 【委托】DAMS系统周报模块内容需求增加 start--> |
| | | <!-- 支援需求 change="{!c.SupportNeeds__c}"--> |
| | | <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"> |
| | | {!v.fieldsmap.SupportNeeds__c} |
| | | <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" /> |
| | | </div> |
| | | <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end--> |
| | | <div aura:id="result" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"> |
| | | {!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> |
| | | </span> |
| | | </li> |
| | | </aura:iteration> |
| | | </ul> |
| | | </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> |
| | | </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 |
| | | 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-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 |
| | | 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 【委托】DAMS系统周报模块内容需求增加 start--> |
| | | <!-- 支援需求 change="{!c.SupportNeeds__c}"--> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop" |
| | | > |
| | | {!v.fieldsmap.SupportNeeds__c} |
| | | <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" /> |
| | | </div> |
| | | <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end--> |
| | | <div |
| | | aura:id="result" |
| | | class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop" |
| | | > |
| | | {!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 |
| | | 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 |
| | | 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"/> |
| | | <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> |
| | | </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> |
| | | |
| | | |
| | | </aura:component> |
| | | </div> |
| | | </aura:component> |
| | |
| | | .THIS .bcolor { |
| | | color: #333; |
| | | color: #333; |
| | | } |
| | | .THIS.height100vh { |
| | | height: 100vh; |
| | | height: 100vh; |
| | | } |
| | | .THIS.contents_wrapper { |
| | | /* .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: .5em 0; |
| | | text-align: center; |
| | | margin: 0.5em 0; |
| | | } |
| | | .THIS.report_list_area { |
| | | margin: 40px 0 20px 100px; |
| | | 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 .slds-spinner_container{ |
| | | position: absolute; |
| | | top:100px; |
| | | .THIS .weeklyReportSpinnerEdit { |
| | | top: 50px; |
| | | } |
| | | .THIS .marginTop{ |
| | | margin-top: 10px; |
| | | |
| | | .THIS .slds-spinner_container { |
| | | position: absolute; |
| | | top: 100px; |
| | | } |
| | | |
| | | .THIS .slds-spinner_containerEdit { |
| | | position: absolute; |
| | | top: 50px; |
| | | } |
| | | |
| | | .THIS .marginTop { |
| | | margin-top: 10px; |
| | | } |
| | | .THIS .custom-input .uiInput { |
| | | height: 2rem; /* 调整高度为你需要的值,如 2rem */ |
| | | height: 2rem; |
| | | } |
| | | /* add by Deloitte-Link 2023-6-19 end*/ |
| | | /* add by Deloitte-Link 2023-6-19 end*/ |
| | |
| | | ({ |
| | | doInit : function(component, event, helper) { |
| | | console.log('zhj 新方案weeklyReport'); |
| | | if (window.location.href.endsWith("weekly-report")) { |
| | | helper.doinit(component, event, helper); |
| | | } else { |
| | | helper.hideCmp(component, event, helper); |
| | | } |
| | | component.set("v.showErrorInfo", false); |
| | | }, |
| | | doInit: function (component, event, helper) { |
| | | console.log("zhj 新方案weeklyReport"); |
| | | if (window.location.href.endsWith("weekly-report")) { |
| | | helper.doinit(component, event, helper); |
| | | } else { |
| | | helper.hideCmp(component, event, helper); |
| | | } |
| | | component.set("v.showErrorInfo", false); |
| | | }, |
| | | |
| | | createAopp : function(component, event, helper) { |
| | | 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); |
| | | }, |
| | | 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); |
| | | }, |
| | | |
| | | 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) { |
| | | /* |
| | | 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) { |
| | | /* |
| | | 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); |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | let agencyReport = Object.create(null); |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | 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); |
| | | |
| | | 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 |
| | | /* |
| | | // 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 |
| | | /* |
| | | 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方法查询出医院下面所有客户人员dataid |
| | | 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" |
| | | }); |
| | | var agencyHospitalid = component.get("v.hospitalLinkId"); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | debugger; |
| | | let hospitalName = ""; |
| | | //调用后端searchAgencyDataId方法查询出医院下面所有客户人员dataid |
| | | 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; |
| | | } |
| | | }) |
| | | //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); |
| | | 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'); |
| | | |
| | | // component.set('v.login',true); |
| | | // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper); |
| | | var token = component.get("v.AWStoken"); |
| | | var newUrl = component.get("v.AWSinsert") + "V2"; |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | }else{ |
| | | component.find('OppMessage').setError(vaildationFailReason); |
| | | 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" |
| | | }); |
| | | } |
| | | } |
| | | // 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')); |
| | | }, |
| | | ); |
| | | //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); |
| | | |
| | | 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); |
| | | }, |
| | | // var token = component.get('v.AWStoken'); |
| | | // var newUrl = component.get('v.AWSinsert'); |
| | | |
| | | 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); |
| | | }, |
| | | // component.set('v.login',true); |
| | | // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper); |
| | | |
| | | 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); |
| | | }, |
| | | // 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 |
| | | }, |
| | | |
| | | 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;} |
| | | createCancel: function (component, event, helper) { |
| | | helper.createCancel(component, event, helper); |
| | | }, |
| | | |
| | | // ####--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); |
| | | |
| | | }, |
| | | 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") |
| | | ); |
| | | }, |
| | | |
| | | export_condition : function(component,event,helper){ |
| | | 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") |
| | | ); |
| | | }, |
| | | |
| | | 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); |
| | | }, |
| | | }) |
| | | 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); |
| | | } |
| | | }); |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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.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; |
| | | |
| | | //发货明细 |
| | | //到货正确信息 |
| | | 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(); |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>58.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public without sharing class AssetHandler extends Oly_TriggerHandler { |
| | | public static Map<String, List<Rental_Apply_Equipment_Set_Detail__c>> queueRaesdMap; |
| | | private Map<Id, Asset> newMap; |
| | | private Map<Id, Asset> oldMap; |
| | | private List<Asset> newList; |
| | | private List<Asset> oldList; |
| | | private static final Map<String, Schema.RecordTypeInfo> DEVELOPERNAMEMAP = Schema.SObjectType.Asset.getRecordTypeInfosByDeveloperName(); // 20230306 ljh add |
| | | @TestVisible |
| | | private static Set<String> testTargetDepts; |
| | | @TestVisible |
| | | private static Id Account_Asset_Id; |
| | | public static Boolean disabled = false; |
| | | |
| | | public static Map<String , List<Rental_Apply_Equipment_Set_Detail__c>> queueRaesdMap; |
| | | private Map<Id, Asset> newMap; |
| | | private Map<Id, Asset> oldMap; |
| | | private List<Asset> newList; |
| | | private List<Asset> oldList; |
| | | @TestVisible private static Set<String> testTargetDepts; |
| | | @TestVisible private static Id Account_Asset_Id; |
| | | public static Boolean disabled = false; |
| | | public AssetHandler() { |
| | | this.newMap = (Map<Id, Asset>) Trigger.newMap; |
| | | this.oldMap = (Map<Id, Asset>) Trigger.oldMap; |
| | | this.newList = (List<Asset>) Trigger.new; |
| | | this.oldList = (List<Asset>) Trigger.old; |
| | | |
| | | public AssetHandler() { |
| | | this.newMap = (Map<Id, Asset>) Trigger.newMap; |
| | | this.oldMap = (Map<Id, Asset>) Trigger.oldMap; |
| | | this.newList = (List<Asset>) Trigger.new; |
| | | this.oldList = (List<Asset>) Trigger.old; |
| | | Integer i = 0; |
| | | } |
| | | |
| | | protected override void beforeInsert() { |
| | | beforeSetValue(); |
| | | //动态更新 Asset的 AccountId的 Logic |
| | | beforeSetAccountId(); |
| | | |
| | | //第一次不加变更的时候不知道第一次是多少 |
| | | updateChangeQuantityReason(); |
| | | |
| | | workflowCode(); |
| | | } |
| | | protected override void beforeUpdate() { |
| | | if (!disabled) { |
| | | beforeSetValue(); |
| | | //动态更新 Asset的 AccountId的 Logic |
| | | beforeSetAccountId(); |
| | | |
| | | updateChangeQuantityReason(); |
| | | |
| | | // 20230309 gzw 优化 注释代码 |
| | | |
| | | // 虚拟维修保修合同保修开始结束日期更新 |
| | | // updateMaintenance_Contract_Asset(); |
| | | |
| | | // 20230309 gzw 优化 注释代码 |
| | | |
| | | updateRentalCount(); |
| | | |
| | | workflowCode(); |
| | | } |
| | | } |
| | | |
| | | protected override void beforeInsert() { |
| | | beforeSetValue(); |
| | | //动态更新 Asset的 AccountId的 Logic |
| | | beforeSetAccountId(); |
| | | protected override void afterInsert() { |
| | | //有新的Asset的时候 暂定分配 |
| | | queueRedistribution(); |
| | | } |
| | | |
| | | //第一次不加变更的时候不知道第一次是多少 |
| | | updateChangeQuantityReason(); |
| | | protected override void afterUpdate() { |
| | | if (!disabled) { |
| | | mainAssetUpdateed_OneToOneRecord(); |
| | | // 已经改进 Must_Input_ChangeQuantityReason 的 valida before可以完成 ChangeQuantityReason__c = '' |
| | | ////入力規則によってbeforeクリアできません, |
| | | cleanChangeQuantityReason(); |
| | | // 清理字段「待废弃数(丢失/盘亏)修改理由」 |
| | | cleanGiveupReturnReason(); |
| | | //当主体参照的Asset的Last断开的时候重新寻找暂定分配 |
| | | queueRedistribution(); |
| | | // before では数式項目がnullの場合があります |
| | | formulaToTextCheck(); |
| | | // check一对一link表 |
| | | checkOneToOneLink(); |
| | | // 虚拟维修保修合同保修开始结束日期更新 |
| | | updateMaintenance_Contract_Asset(); |
| | | } |
| | | protected override void beforeUpdate() { |
| | | if(!disabled){ |
| | | beforeSetValue(); |
| | | //动态更新 Asset的 AccountId的 Logic |
| | | beforeSetAccountId(); |
| | | } |
| | | |
| | | updateChangeQuantityReason(); |
| | | |
| | | // 虚拟维修保修合同保修开始结束日期更新 |
| | | updateMaintenance_Contract_Asset(); |
| | | |
| | | updateRentalCount(); |
| | | //20230309 sx 保有设备workflow代码化 start |
| | | private void workflowCode() { |
| | | /*List<Id> accIds = new List<Id>(); |
| | | List<Id> productIds = new List<Id>(); |
| | | List<Id> hospitalIds = new List<Id>(); |
| | | for(Asset nObj : newList) { |
| | | accIds.add(nObj.Account.Id); |
| | | productIds.add(nObj.Product2.Id); |
| | | hospitalIds.add(nObj.Hospital__c); |
| | | } |
| | | |
| | | } |
| | | //查找客户List |
| | | Map<Id, Account> accMap = new Map<Id, Account>([SELECT Id, Name, Management_Code__c from Account where Id in :accIds]); |
| | | Map<Id, Product2> productMap = new Map<Id, Product2>([SELECT Id, Name, RecordTypeId, RecordType.Name, Serial_Lot_No__c ,ProductCode from Product2 where Id in :productIds]); |
| | | Map<Id, Account> hosMap = new Map<Id, Account>([SELECT Id, Name, RecordType.Name from Account where id in :hospitalIds]); |
| | | |
| | | protected override void afterInsert() { |
| | | //有新的Asset的时候 暂定分配 |
| | | queueRedistribution(); |
| | | } |
| | | |
| | | protected override void afterUpdate() { |
| | | if(!disabled){ |
| | | mainAssetUpdateed_OneToOneRecord(); |
| | | // 已经改进 Must_Input_ChangeQuantityReason 的 valida before可以完成 ChangeQuantityReason__c = '' |
| | | ////入力規則によってbeforeクリアできません, |
| | | cleanChangeQuantityReason(); |
| | | // 清理字段「待废弃数(丢失/盘亏)修改理由」 |
| | | cleanGiveupReturnReason(); |
| | | //当主体参照的Asset的Last断开的时候重新寻找暂定分配 |
| | | queueRedistribution(); |
| | | // before では数式項目がnullの場合があります |
| | | formulaToTextCheck(); |
| | | // check一对一link表 |
| | | checkOneToOneLink(); |
| | | // 虚拟维修保修合同保修开始结束日期更新 |
| | | updateMaintenance_Contract_Asset(); |
| | | } |
| | | } |
| | | // 借出明细更新借出_分配_数(Sys)和已借出数(Sys) |
| | | private void updateRentalCount() { |
| | | Set<Id> idSet = new Set<Id>(); |
| | | for(Id assId : this.newMap.keySet()) { |
| | | if(this.newMap.get(assId).AssetManageConfirm__c && |
| | | this.newMap.get(assId).Account_Management_Code__c != System.Label.Account_Asset_FJZ ) { |
| | | idSet.add(assId); |
| | | this.newMap.get(assId).Out_of_wh_Sys__c = 0; |
| | | this.newMap.get(assId).Rental_Count_Sys__c = 0; |
| | | Map<Id, Account> acc_assMap = new Map<Id, Account>(); |
| | | Map<Id, Product2> pro_proMap = new Map<Id, Product2>(); |
| | | Map<Id, Account> hos_assMap = new Map<Id, Account>(); |
| | | for(Asset nObj : newList){ |
| | | if(accMap.containsKey(nObj.Account.Id)) { |
| | | acc_assMap.put(nObj.Id, accMap.get(nObj.Account.Id)); |
| | | } |
| | | if(productMap.containsKey(nObj.Product2.Id)) { |
| | | pro_proMap.put(nObj.Id, productMap.get(nObj.Product2.Id)); |
| | | } |
| | | if(hosMap.containsKey(nObj.Hospital__c)) { |
| | | hos_assMap.put(nObj.Id, hosMap.get(nObj.Id)); |
| | | } |
| | | }*/ |
| | | Date today = Date.today(); |
| | | |
| | | for (Asset nObj : newList) { |
| | | //保有设备HPID文本化 |
| | | nObj.Asset_Year_Txt__c = nObj.Asset_Year__c; |
| | | nObj.HP_ID_Text__c = nObj.HP_Id__c; |
| | | nObj.Gurantee_End_day1__c = nObj.Gurantee_End_day__c; |
| | | |
| | | //覆盖设备的可选对象文本化 |
| | | if ( |
| | | Trigger.isInsert || |
| | | (Trigger.isUpdate && |
| | | nObj.Posting_Date__c != oldMap.get(nObj.Id).Posting_Date__c) |
| | | ) { |
| | | if ( |
| | | String.isBlank(nObj.IF_Coverage_Target_Asset__c) || |
| | | '0'.equals(nObj.IF_Coverage_Target_Asset__c) |
| | | ) { |
| | | nObj.IF_Coverage_Target_Asset__c = |
| | | nObj.IF_Coverage_Target_Asset_FF__c + ''; |
| | | } |
| | | if(!idSet.isEmpty()) { |
| | | for (Rental_Apply_Equipment_Set_Detail__c raesd : [ |
| | | |
| | | if ( |
| | | nObj.IF_Coverage_Target_Asset_FF__c == 3 && |
| | | nObj.FY23_Asset_Age__c == null |
| | | ) { |
| | | nObj.FY23_Asset_Age__c = 0; |
| | | } |
| | | } |
| | | |
| | | //市场对应录入时间自动录入 |
| | | if ( |
| | | (Trigger.isInsert && nObj.Market_Product_Category__c != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.Market_Product_Category__c != |
| | | oldMap.get(nObj.Id).Market_Product_Category__c && |
| | | nObj.Market_Product_Category__c != null) |
| | | ) { |
| | | nObj.Marketing_Input_Date__c = today; |
| | | } |
| | | |
| | | /*//待报废变更为使用中 |
| | | if(nObj.RecordType.Name == '备品' |
| | | && nObj.Manage_type__c == '个体管理' |
| | | && nObj.Quantity > 0 && nObj.Status == '待报废' |
| | | && ( (nObj.Abandoned_RealThing__c == null && nObj.Abandoned_Inventory__c == null) || (nObj.Abandoned_RealThing__c + nObj.Abandoned_Inventory__c) == 0) |
| | | && acc_assMap.get(nObj.Id).Management_Code__c != System.Label.Account_Asset_FJZ) { |
| | | nObj.Status = '使用中'; |
| | | nObj.Tobe_Discarded_Date__c = null; |
| | | }*/ |
| | | |
| | | /*//AssetMarkUpdate |
| | | if(Trigger.isUpdate && nObj.IF_Information_From__c == false && nObj.AssetMark__c == null) { |
| | | if(pro_proMap.containsKey(nObj.Id)){ |
| | | if(pro_proMap.get(nObj.Id).RecordType.Name == '竞品-主机' ) { |
| | | nObj.AssetMark__c = '竞品主机'; |
| | | }else if(pro_proMap.get(nObj.Id).RecordType.Name == '竞品-耗材') { |
| | | nObj.AssetMark__c = '竞品耗材'; |
| | | }else if(pro_proMap.get(nObj.Id).Serial_Lot_No__c == 'S/N tracing') { |
| | | nObj.AssetMark__c = '主机'; |
| | | } |
| | | } |
| | | else { |
| | | nObj.AssetMark__c = '耗材'; |
| | | } |
| | | }*/ |
| | | |
| | | /*//AssetName=ProductName |
| | | if(nObj.Name.equals('*') || (nObj.Product2.Id != null && nObj.Product2 != oldMap.get(nObj.Id).Product2)) { |
| | | nObj.Name = pro_proMap.get(nObj.Id).Name; |
| | | }*/ |
| | | |
| | | //AssetTextCopy |
| | | if ( |
| | | Trigger.isInsert || |
| | | (Trigger.isUpdate && nObj.Product2 != oldMap.get(nObj.Id).Product2) |
| | | ) { |
| | | nObj.BSSCategory_Text__c = nObj.BSSCategory__c; |
| | | nObj.Brand_Name_Text__c = nObj.Brand_Name__c; |
| | | nObj.Category2_Text__c = nObj.Category2__c; |
| | | nObj.Category3_Text__c = nObj.Category3__c; |
| | | nObj.Category4_Text__c = nObj.Category4__c; |
| | | nObj.Category5_Text__c = nObj.Category5__c; |
| | | } |
| | | |
| | | //CIC安装状态确认日 |
| | | if ( |
| | | nObj.CIC_call_back_check__c && nObj.CIC_call_back_confirm_day__c == null |
| | | ) { |
| | | nObj.CIC_call_back_confirm_day__c = today; |
| | | } |
| | | |
| | | //Equipment_Last_confirmed_day |
| | | if ( |
| | | (Trigger.isInsert && |
| | | (nObj.Status != null || |
| | | nObj.Installation_Site__c != null || |
| | | nObj.Final_Examination_Date__c != null || |
| | | nObj.Hospital_Manage_Number__c != null)) || |
| | | (Trigger.isUpdate && |
| | | (nObj.Status != oldMap.get(nObj.Id).Status || |
| | | nObj.Installation_Site__c != oldMap.get(nObj.Id).Installation_Site__c || |
| | | nObj.Final_Examination_Date__c != |
| | | oldMap.get(nObj.Id).Final_Examination_Date__c || |
| | | nObj.Hospital_Manage_Number__c != |
| | | oldMap.get(nObj.Id).Hospital_Manage_Number__c)) |
| | | ) { |
| | | nObj.Equipment_Last_checking_day__c = today; |
| | | } |
| | | |
| | | /*//Product_Code+Serial_No |
| | | if(Trigger.isUpdate && nObj.IsCompetitorProduct == false && nObj.Manage_type__c != '数量管理' && nObj.AssetMark__c != '耗材' && nObj.Loaner_accsessary__c != true && nObj.unknow_serial_NO_product__c != false) { |
| | | if(nObj.Product2.Id == null) { |
| | | nObj.Product_Serial_No__c = nObj.Id; |
| | | }else { |
| | | nObj.Product_Serial_No__c = pro_proMap.get(nObj.Id).ProductCode + ' ' + nObj.SerialNumber; |
| | | if(nObj.Delete_Flag__c){ |
| | | nObj.Product_Serial_No__c += ':' + acc_assMap.get(nObj.Id).Management_Code__c; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | //Product_Code+Serial_No Clear |
| | | if ( |
| | | (Trigger.isInsert && nObj.IsCompetitorProduct) || |
| | | (Trigger.isUpdate && |
| | | nObj.IsCompetitorProduct && |
| | | !oldMap.get(nObj.Id).IsCompetitorProduct) |
| | | ) { |
| | | nObj.Product_Serial_No__c = ''; |
| | | } |
| | | |
| | | /*//Product_Code+Serial_No+Salesdepartment |
| | | if(Trigger.isUpdate && nObj.IsCompetitorProduct == false && nObj.Manage_type__c == '数量管理' && nObj.AssetMark__c == '耗材' && nObj.Loaner_accsessary__c == true && nObj.unknow_serial_NO_product__c == false) { |
| | | if(nObj.Product2.Id == null) { |
| | | nObj.Product_Serial_No__c = nObj.Id; |
| | | }else { |
| | | nObj.Product_Serial_No__c = pro_proMap.get(nObj.Id).ProductCode + ' ' + nObj.SerialNumber + ':' + nObj.Salesdepartment__c.subString(0,nObj.Salesdepartment__c.indexOf(':')); |
| | | if(nObj.Delete_Flag__c){ |
| | | nObj.Product_Serial_No__c += ':' + acc_assMap.get(nObj.Id).Management_Code__c; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | /*//Product_Code+Serial_No UnkownSerial |
| | | if(Trigger.isUpdate && nObj.unknow_serial_NO_product__c == true) { |
| | | nObj.SerialNumber = nObj.serial_past__c; |
| | | if(nObj.Product2.Id == null) { |
| | | nObj.Product_Serial_No__c = nObj.Id; |
| | | }else { |
| | | nObj.Product_Serial_No__c = pro_proMap.get(nObj.Id).ProductCode + ':' + nObj.serial_past__c; |
| | | if(nObj.Delete_Flag__c){ |
| | | nObj.Product_Serial_No__c += ':' + acc_assMap.get(nObj.Id).Management_Code__c; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | //更新备品资产管理负责本部选项 |
| | | if ( |
| | | (Trigger.isInsert && nObj.Internal_demo_incharge_demo__c != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.Internal_demo_incharge_demo__c != |
| | | oldMap.get(nObj.Id).Internal_demo_incharge_demo__c) |
| | | ) { |
| | | nObj.Internal_demo_incharge_demo_text__c = nObj.Internal_demo_incharge_demo__c; |
| | | } |
| | | |
| | | /*//自动更新资产所属(医院资产) |
| | | if(Trigger.isUpdate && nObj.RecordType.Name == '医院保有设备' && hos_assMap.containskey(nObj.Id) && hos_assMap.get(nObj.Id).RecordType.Name == '病院' && acc_assMap.get(nObj.Id).Id == '00110000015Bx0h' ) { |
| | | nObj.Asset_Owner__c = '医院资产'; |
| | | }*/ |
| | | |
| | | /*//自动更新资产所属(奥林巴斯) |
| | | if(nObj.RecordType.Name == '医院保有设备' || (acc_assMap.containskey(nObj.Id) && acc_assMap.get(nObj.Id).Id == '00110000015Bx0h')) { |
| | | nObj.Asset_Owner__c = '奥林巴斯'; |
| | | }*/ |
| | | |
| | | /*//自动更新资产所属(经销商资产) |
| | | if(nObj.RecordType.Name == '医院保有设备' && (acc_assMap.containskey(nObj.Id) && hos_assMap.get(nObj.Id).RecordType.Name == '販売店')) { |
| | | nObj.Asset_Owner__c = '经销商资产'; |
| | | }*/ |
| | | |
| | | //手动创建的耗材信息修改 |
| | | if ( |
| | | nObj.RecordTypeId == '01210000000kOPM' && |
| | | nObj.Information_From__c == '手动输入' && |
| | | nObj.AssetMark__c == '耗材' |
| | | ) { |
| | | nObj.Guarantee_period_for_products__c = nObj.Posting_Date__c; |
| | | nObj.InstallDate = nObj.Posting_Date__c; |
| | | } |
| | | |
| | | //出货日自动赋值 |
| | | if (Trigger.isInsert && nObj.Information_From__c == '手动输入') { |
| | | nObj.Posting_Date__c = Date.newInstance(1900, 1, 1); |
| | | } |
| | | |
| | | //新逻辑保修期限对应 |
| | | if (nObj.New_logic_data__c) { |
| | | nObj.Guarantee_period_for_products__c = nObj.Guarantee_period_formula__c; |
| | | } |
| | | |
| | | //成本中心更新编码Update |
| | | if ( |
| | | (Trigger.isInsert && nObj.Internal_cost_center_cd__c != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.Internal_cost_center_cd__c != |
| | | oldMap.get(nObj.Id).Internal_cost_center_cd__c) |
| | | ) { |
| | | nObj.Internal_demo_incharge_demo_text__c = nObj.Internal_cost_center_formula__c; |
| | | } |
| | | |
| | | //成本中心更新选项Update |
| | | if ( |
| | | (Trigger.isInsert && nObj.Internal_cost_center__c != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.Internal_cost_center__c != |
| | | oldMap.get(nObj.Id).Internal_cost_center__c) |
| | | ) { |
| | | nObj.Internal_cost_center_text__c = nObj.Internal_cost_center__c; |
| | | } |
| | | |
| | | //待报废日登录 |
| | | if ( |
| | | Trigger.isUpdate && |
| | | nObj.Fixture_Status__c != oldMap.get(nObj.Id).Fixture_Status__c && |
| | | nObj.Fixture_Status__c != '废弃' && |
| | | (nObj.Abandoned_RealThing__c > 0 || |
| | | nObj.Abandoned_Inventory__c > 0) && |
| | | nObj.Manage_type__c == '个体管理' |
| | | ) { |
| | | nObj.Status = '待报废'; |
| | | nObj.Tobe_Discarded_Date__c = today; |
| | | } |
| | | |
| | | //退货转备品DEL置FALSE |
| | | if ( |
| | | Trigger.isUpdate && |
| | | ((nObj.RecordType != oldMap.get(nObj.Id).RecordType && |
| | | nObj.RecordTypeId == '01210000000kOPR') || |
| | | (nObj.AccountId != oldMap.get(nObj.Id).AccountId && |
| | | nObj.AccountId == '0011000000VAiwz')) && |
| | | nObj.Delete_Flag__c |
| | | ) { |
| | | nObj.Delete_Flag__c = false; |
| | | } |
| | | |
| | | //追溯设备耗材Mark更新 |
| | | if ( |
| | | '追溯系统'.equals(nObj.Information_From__c) && |
| | | String.isBlank(nObj.AssetMark__c) |
| | | ) { |
| | | nObj.AssetMark__c = '耗材'; |
| | | } |
| | | |
| | | //納入商品状態変更(使用中) |
| | | if ( |
| | | (Trigger.isInsert && nObj.Status == '使用中') || |
| | | (Trigger.isUpdate && |
| | | nObj.Status != oldMap.get(nObj.Id).Status && |
| | | nObj.Status == '使用中') |
| | | ) { |
| | | nObj.Status_Busy_Date__c = today; |
| | | } |
| | | |
| | | //納入商品状態変更(廃棄) |
| | | if ( |
| | | (Trigger.isInsert && nObj.Status == '廃棄') || |
| | | (Trigger.isUpdate && |
| | | nObj.Status != oldMap.get(nObj.Id).Status && |
| | | nObj.Status == '廃棄') |
| | | ) { |
| | | nObj.Discarded_Date__c = today; |
| | | nObj.Quantity = 0; |
| | | nObj.Abandoned_Inventory__c = null; |
| | | nObj.Abandoned_RealThing__c = null; |
| | | nObj.ChangeQuantityReason__c = '废弃'; |
| | | } |
| | | |
| | | //納入商品状態変更(不明) |
| | | if ( |
| | | (Trigger.isInsert && nObj.Status == '不明') || |
| | | (Trigger.isUpdate && |
| | | nObj.Status != oldMap.get(nObj.Id).Status && |
| | | nObj.Status == '不明') |
| | | ) { |
| | | nObj.Indistinctness_Date__c = today; |
| | | } |
| | | |
| | | //納入商品状態変更(未使用) |
| | | if ( |
| | | (Trigger.isInsert && nObj.Status == '未使用') || |
| | | (Trigger.isUpdate && |
| | | nObj.Status != oldMap.get(nObj.Id).Status && |
| | | nObj.Status == '未使用') |
| | | ) { |
| | | nObj.Unused_Date__c = today; |
| | | } |
| | | |
| | | /*//納品確認書の診療科コード_セット |
| | | if(!(nObj.Product2.Id != null && nObj.IsCompetitorProduct == false && nObj.InstallDate != null) && nObj.Install_Account_Code__c == null) { |
| | | nObj.Install_Account_Code__c = acc_assMap.get(nObj.Id).Management_Code__c; |
| | | nObj.Install_Account_Name__c = acc_assMap.get(nObj.Id).Name; |
| | | nObj.Install_Hospital_Name__c = hos_assMap.get(nObj.Id).Name; |
| | | nObj.Install_Hospital_code__c = hos_assMap.get(nObj.Id).Management_Code__c; |
| | | }*/ |
| | | |
| | | //病院管理番号変更日 |
| | | if ( |
| | | (Trigger.isInsert && nObj.Hospital_Manage_Number__c != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.Hospital_Manage_Number__c != |
| | | oldMap.get(nObj.Id).Hospital_Manage_Number__c) |
| | | ) { |
| | | nObj.Hospital_Manage_Number_Change_Date__c = today; |
| | | } |
| | | |
| | | //更新-2次前点检日 |
| | | if ( |
| | | Trigger.isUpdate && |
| | | nObj.Final_Examination_Date__c != |
| | | oldMap.get(nObj.Id).Final_Examination_Date__c |
| | | ) { |
| | | nObj.X2_second_past_inspection__c = oldMap.get(nObj.Id) |
| | | .Final_Examination_Date__c; |
| | | } |
| | | |
| | | // 文本化 多年保修期至 |
| | | nObj.Extend_Gurantee_DateTo_Text__c = nObj.Extend_Gurantee_DateTo__c; |
| | | |
| | | // 保修天数工作流 |
| | | if ( |
| | | Trigger.isInsert || |
| | | (Trigger.isUpdate && |
| | | (nObj.Guarantee_period_for_products__c != |
| | | oldMap.get(nObj.Id).Guarantee_period_for_products__c || |
| | | nObj.InstallDate__c != oldMap.get(nObj.Id).InstallDate__c || |
| | | nObj.ChangeWarrantyStartDate__c != |
| | | oldMap.get(nObj.Id).ChangeWarrantyStartDate__c)) |
| | | ) { |
| | | nObj.GuaranteePeriod__c = nObj.guarantee_period__c; |
| | | } |
| | | |
| | | // 有安装日,更新状态到[使用中] |
| | | if ( |
| | | (Trigger.isInsert && nObj.InstallDate != null) || |
| | | (Trigger.isUpdate && |
| | | nObj.InstallDate != null && |
| | | nObj.InstallDate != oldMap.get(nObj.Id).InstallDate) |
| | | ) { |
| | | nObj.Status_Busy_Date__c = today; |
| | | nObj.Status = '使用中'; |
| | | } |
| | | |
| | | // 备品再退货转DEL置TRUE |
| | | if ( |
| | | nObj.AccountId == '00110000015Bx0h' && |
| | | nObj.RecordTypeId == '01210000000kOPM' && |
| | | !nObj.Delete_Flag__c |
| | | ) { |
| | | nObj.Delete_Flag__c = true; |
| | | } |
| | | |
| | | // 设定备品所属公司(上海)FromVBA |
| | | if ( |
| | | (Trigger.isInsert && nObj.CompanyCodeOfEquipment_txt__c == '5112') || |
| | | (Trigger.isUpdate && |
| | | nObj.CompanyCodeOfEquipment_txt__c != |
| | | oldMap.get(nObj.Id).CompanyCodeOfEquipment_txt__c && |
| | | nObj.CompanyCodeOfEquipment_txt__c == '5112') |
| | | ) { |
| | | nObj.CompanyOfEquipment__c = '上海'; |
| | | } |
| | | |
| | | // 设定备品所属公司(沈阳)FromVBA |
| | | if ( |
| | | (Trigger.isInsert && nObj.CompanyCodeOfEquipment_txt__c == '5114') || |
| | | (Trigger.isUpdate && |
| | | nObj.CompanyCodeOfEquipment_txt__c != |
| | | oldMap.get(nObj.Id).CompanyCodeOfEquipment_txt__c && |
| | | nObj.CompanyCodeOfEquipment_txt__c == '5114') |
| | | ) { |
| | | nObj.CompanyOfEquipment__c = '沈阳'; |
| | | } |
| | | |
| | | // 设定备品所属公司(北京)FromVBA |
| | | if ( |
| | | (Trigger.isInsert && nObj.CompanyCodeOfEquipment_txt__c == '5111') || |
| | | (Trigger.isUpdate && |
| | | nObj.CompanyCodeOfEquipment_txt__c != |
| | | oldMap.get(nObj.Id).CompanyCodeOfEquipment_txt__c && |
| | | nObj.CompanyCodeOfEquipment_txt__c == '5111') |
| | | ) { |
| | | nObj.CompanyOfEquipment__c = '北京'; |
| | | } |
| | | |
| | | // 设定备品所属公司(广州)FromVBA |
| | | if ( |
| | | (Trigger.isInsert && nObj.CompanyCodeOfEquipment_txt__c == '5113') || |
| | | (Trigger.isUpdate && |
| | | nObj.CompanyCodeOfEquipment_txt__c != |
| | | oldMap.get(nObj.Id).CompanyCodeOfEquipment_txt__c && |
| | | nObj.CompanyCodeOfEquipment_txt__c == '5113') |
| | | ) { |
| | | nObj.CompanyOfEquipment__c = '广州'; |
| | | } |
| | | } |
| | | } |
| | | //20230309 sx 保有设备workflow代码化 end |
| | | |
| | | // 借出明细更新借出_分配_数(Sys)和已借出数(Sys) |
| | | private void updateRentalCount() { |
| | | Set<Id> idSet = new Set<Id>(); |
| | | for (Id assId : this.newMap.keySet()) { |
| | | if ( |
| | | this.newMap.get(assId).AssetManageConfirm__c && |
| | | this.newMap.get(assId).Account_Management_Code__c != |
| | | System.Label.Account_Asset_FJZ |
| | | ) { |
| | | idSet.add(assId); |
| | | this.newMap.get(assId).Out_of_wh_Sys__c = 0; |
| | | this.newMap.get(assId).Rental_Count_Sys__c = 0; |
| | | } |
| | | } |
| | | if (!idSet.isEmpty()) { |
| | | // 备品性能优化改修 20230312 by lc Start |
| | | List<AggregateResult> raesdTempList2 = [ |
| | | SELECT COUNT(Id) num, Asset__c |
| | | FROM Rental_Apply_Equipment_Set_Detail__c |
| | | //备品发货报错对应 20230413 by lc Start |
| | | //WHERE Detail_Finish__c = false |
| | | WHERE |
| | | Detail_Not_Finish_Text__c = TRUE |
| | | //备品发货报错对应 20230413 by lc End |
| | | AND Asset__c IN :idSet |
| | | AND Shippment_loaner_time2__c != NULL |
| | | GROUP BY Asset__c |
| | | ]; |
| | | if (raesdTempList2 != null && raesdTempList2.size() > 0) { |
| | | for (AggregateResult ar : raesdTempList2) { |
| | | String assetId = String.valueOf(ar.get('Asset__c')); |
| | | Integer tempNum = Integer.valueOf(ar.get('num')); |
| | | this.newMap.get(assetId).Rental_Count_Sys__c += tempNum; |
| | | } |
| | | } |
| | | |
| | | List<AggregateResult> raesdTempList1 = [ |
| | | SELECT COUNT(Id) num, Asset__c |
| | | FROM Rental_Apply_Equipment_Set_Detail__c |
| | | //备品发货报错对应 20230413 by lc Start |
| | | //WHERE Detail_Finish__c = false |
| | | WHERE |
| | | Detail_Not_Finish_Text__c = TRUE |
| | | //备品发货报错对应 20230413 by lc End |
| | | AND Asset__c IN :idSet |
| | | GROUP BY Asset__c |
| | | ]; |
| | | if (raesdTempList1 != null && raesdTempList1.size() > 0) { |
| | | for (AggregateResult ar : raesdTempList1) { |
| | | String assetId = String.valueOf(ar.get('Asset__c')); |
| | | Integer tempNum = Integer.valueOf(ar.get('num')); |
| | | this.newMap.get(assetId).Out_of_wh_Sys__c += tempNum; |
| | | idSet.remove(assetId); |
| | | } |
| | | } |
| | | |
| | | /*for (Rental_Apply_Equipment_Set_Detail__c raesd : [ |
| | | SELECT Id, Shippment_loaner_time2__c, Asset__c |
| | | FROM Rental_Apply_Equipment_Set_Detail__c |
| | | WHERE Detail_Finish__c = false |
| | |
| | | this.newMap.get(raesd.Asset__c).Rental_Count_Sys__c += 1; |
| | | } |
| | | idSet.remove(raesd.Asset__c); |
| | | } |
| | | if(!idSet.isEmpty()) { |
| | | // 没有字段可以完全准确地区分备品设备与耗材设备,只好把备品里没出现过的设备当成耗材来查 |
| | | for (Consum_Apply_Equipment_Set_Detail__c caesd : [ |
| | | SELECT Id, Shippment_loaner_time2__c, Asset__c |
| | | FROM Consum_Apply_Equipment_Set_Detail__c |
| | | WHERE Detail_Finish__c = false |
| | | AND Asset__c IN :idSet |
| | | ]) { |
| | | this.newMap.get(caesd.Asset__c).Out_of_wh_Sys__c += 1; |
| | | if(caesd.Shippment_loaner_time2__c != null) { |
| | | this.newMap.get(caesd.Asset__c).Rental_Count_Sys__c += 1; |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | // 备品性能优化改修 20230312 by lc End |
| | | |
| | | if (!idSet.isEmpty()) { |
| | | // 没有字段可以完全准确地区分备品设备与耗材设备,只好把备品里没出现过的设备当成耗材来查 |
| | | for (Consum_Apply_Equipment_Set_Detail__c caesd : [ |
| | | SELECT Id, Shippment_loaner_time2__c, Asset__c |
| | | FROM Consum_Apply_Equipment_Set_Detail__c |
| | | WHERE Detail_Finish__c = FALSE AND Asset__c IN :idSet |
| | | ]) { |
| | | this.newMap.get(caesd.Asset__c).Out_of_wh_Sys__c += 1; |
| | | if (caesd.Shippment_loaner_time2__c != null) { |
| | | this.newMap.get(caesd.Asset__c).Rental_Count_Sys__c += 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //多年保修 start |
| | | private void updateMaintenance_Contract_Asset(){ |
| | | StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; |
| | | Set<id> AssetIDSet = new Set<id>(); |
| | | for(Asset tempAsset : newList){ |
| | | if(String.isNotBlank(tempAsset.warrantyType__c)){ |
| | | AssetIDSet.add(tempAsset.id); |
| | | } |
| | | } |
| | | if(AssetIDSet.size() > 0 ){ |
| | | list<Maintenance_Contract_Asset__c> MCAList = |
| | | [select id,startDateGurantee__c, |
| | | startDateGurantee_Text__c,endDateGurantee__c, |
| | | endDateGurantee_Text__c,Return_Flag__c,ChangeAcc_flag__c, |
| | | Maintenance_Price_Amount__c,Maintenance_Price_Amount_text__c, |
| | | GuaranteePrice_Amount__c,GuaranteePrice_Amount_text__c |
| | | from Maintenance_Contract_Asset__c |
| | | where Asset__c in : AssetIDSet |
| | | and Maintenance_Contract__r.RecordType.DeveloperName = 'VM_Contract' |
| | | ]; |
| | | if(MCAList.size() > 0){ |
| | | list<Maintenance_Contract_Asset__c> UpdateMcaList = |
| | | new list<Maintenance_Contract_Asset__c> (); |
| | | for(Maintenance_Contract_Asset__c tempMCA : MCAList ){ |
| | | if(tempMCA.startDateGurantee__c != tempMCA.startDateGurantee_Text__c |
| | | || tempMCA.endDateGurantee__c != tempMCA.endDateGurantee_Text__c |
| | | || tempMCA.Maintenance_Price_Amount__c != tempMCA.Maintenance_Price_Amount_Text__c |
| | | || tempMCA.GuaranteePrice_Amount__c != tempMCA.GuaranteePrice_Amount_text__c){ |
| | | UpdateMcaList.add(tempMCA); |
| | | } |
| | | } |
| | | Oly_TriggerHandler.bypass('SetContractEstimatePriceHandler'); |
| | | update UpdateMcaList; |
| | | Oly_TriggerHandler.clearBypass('SetContractEstimatePriceHandler'); |
| | | } |
| | | } |
| | | } |
| | | //多年保修 start |
| | | private void updateMaintenance_Contract_Asset() { |
| | | StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; |
| | | Set<id> AssetIDSet = new Set<id>(); |
| | | for (Asset tempAsset : newList) { |
| | | // 20230306 ljh update start |
| | | Id Shipment = DEVELOPERNAMEMAP.get('Shipment').getRecordTypeId(); |
| | | // if(String.isNotBlank(tempAsset.warrantyType__c)){ |
| | | if ( |
| | | String.isNotBlank(tempAsset.warrantyType__c) && |
| | | Shipment != tempAsset.RecordTypeId |
| | | ) { |
| | | // 20230306 ljh update end |
| | | AssetIDSet.add(tempAsset.id); |
| | | } |
| | | } |
| | | //多年保修 end |
| | | |
| | | private void beforeSetValue() { |
| | | for (Asset nObj : newList) { |
| | | // 有线下数据, 所以不需要下面的logic |
| | | //if (nObj.Quantity == null) { |
| | | // nObj.Quantity = 1; |
| | | //} |
| | | if (Trigger.isInsert) { |
| | | nObj.Last_Reserve_RAES_Detail__c = null; |
| | | nObj.Last_Reserve_TAES_Detail__c = null; |
| | | nObj.Pre_Reserve_RAES_Detail__c = null; |
| | | nObj.Pre_Reserve_TAES_Detail__c = null; |
| | | nObj.Fixture_OneToOne_Link__c = null; |
| | | } |
| | | |
| | | if (Trigger.isUpdate) { |
| | | Asset oObj = oldMap.get(nObj.Id); |
| | | if (oObj.Last_Reserve_RAES_Detail__c != null && nObj.Last_Reserve_RAES_Detail__c == null |
| | | && oObj.Last_Reserve_RAES_Detail_Flag__c == true) { |
| | | nObj.Pre_Reserve_RAES_Detail__c = oObj.Last_Reserve_RAES_Detail__c; |
| | | } |
| | | if (oObj.Last_Reserve_TAES_Detail__c != null && nObj.Last_Reserve_TAES_Detail__c == null |
| | | // TODO 由于__r超20,字段建不出来 |
| | | // && oObj.Last_Reserve_TAES_Detail_Flag__c == true |
| | | ) { |
| | | nObj.Pre_Reserve_TAES_Detail__c = oObj.Last_Reserve_TAES_Detail__c; |
| | | } |
| | | } |
| | | |
| | | // 必ず最後で置く |
| | | nObj.Fixture_Status2_text__c = nObj.Fixture_Status2__c; |
| | | nObj.Fixture_Status3_text__c = nObj.Fixture_Status3__c; |
| | | nObj.BTreeIndexKey__c = nObj.Asset_Owner__c |
| | | + ':' + nObj.Asset_loaner_category__c |
| | | + ':' + String.valueOf(nobj.Freeze_sign_Abandoned_Flag__c) |
| | | + ':' + String.valueOf(nObj.Delete_Flag__c) |
| | | + ':' + String.valueOf(nObj.AssetManageConfirm__c); |
| | | |
| | | if (nObj.Status == FixtureUtil.assetStatusMap.get(FixtureUtil.AssetStatus.Dai_Fei_Qi.ordinal())) { |
| | | nObj.Freeze_sign__c = false; |
| | | } |
| | | // gzw CHAN-CCR6MW 【委托】【保有设备】保有设备发货日逻辑 start |
| | | if(Trigger.isInsert && nObj.Posting_Date__c == null){ |
| | | nObj.Posting_Date__c = Date.newInstance(1900, 1, 1); |
| | | } |
| | | // gzw CHAN-CCR6MW 【委托】【保有设备】保有设备发货日逻辑 end |
| | | if (AssetIDSet.size() > 0) { |
| | | list<Maintenance_Contract_Asset__c> MCAList = [ |
| | | SELECT |
| | | id, |
| | | startDateGurantee__c, |
| | | startDateGurantee_Text__c, |
| | | endDateGurantee__c, |
| | | endDateGurantee_Text__c, |
| | | Return_Flag__c, |
| | | ChangeAcc_flag__c, |
| | | Maintenance_Price_Amount__c, |
| | | Maintenance_Price_Amount_text__c, |
| | | GuaranteePrice_Amount__c, |
| | | GuaranteePrice_Amount_text__c |
| | | FROM Maintenance_Contract_Asset__c |
| | | WHERE |
| | | Asset__c IN :AssetIDSet |
| | | AND Maintenance_Contract__r.RecordType.DeveloperName = 'VM_Contract' |
| | | ]; |
| | | if (MCAList.size() > 0) { |
| | | list<Maintenance_Contract_Asset__c> UpdateMcaList = new List<Maintenance_Contract_Asset__c>(); |
| | | for (Maintenance_Contract_Asset__c tempMCA : MCAList) { |
| | | if ( |
| | | tempMCA.startDateGurantee__c != tempMCA.startDateGurantee_Text__c || |
| | | tempMCA.endDateGurantee__c != tempMCA.endDateGurantee_Text__c || |
| | | tempMCA.Maintenance_Price_Amount__c != |
| | | tempMCA.Maintenance_Price_Amount_Text__c || |
| | | tempMCA.GuaranteePrice_Amount__c != |
| | | tempMCA.GuaranteePrice_Amount_text__c |
| | | ) { |
| | | UpdateMcaList.add(tempMCA); |
| | | } |
| | | } |
| | | Oly_TriggerHandler.bypass('SetContractEstimatePriceHandler'); |
| | | update UpdateMcaList; |
| | | Oly_TriggerHandler.clearBypass('SetContractEstimatePriceHandler'); |
| | | } |
| | | } |
| | | } |
| | | //多年保修 end |
| | | |
| | | // かならず before |
| | | private void updateChangeQuantityReason() { |
| | | for (Asset nObj : newList) { |
| | | Asset oObj; |
| | | String oQuantity = ''; |
| | | String oAbandoned_Inventory = ''; |
| | | if (Trigger.isUpdate) { |
| | | oObj = oldMap.get(nObj.Id); |
| | | oQuantity = oObj.Quantity == null ? '' : String.valueOf(oObj.Quantity); |
| | | oAbandoned_Inventory = oObj.Abandoned_Inventory__c == null ? '' : String.valueOf(oObj.Abandoned_Inventory__c); |
| | | } |
| | | String nQuantity = nObj.Quantity == null ? '' : String.valueOf(nObj.Quantity); |
| | | String nAbandoned_Inventory = nObj.Abandoned_Inventory__c == null ? '' : String.valueOf(nObj.Abandoned_Inventory__c); |
| | | if ((oQuantity != nQuantity && String.isNotBlank(nObj.ChangeQuantityReason__c)) || Trigger.isInsert) { |
| | | String rs = nObj.ChangeQuantityReason__c; |
| | | nObj.ChangeQuantityHistory__c = String.format(System.Label.ChangeQuantityHistory, |
| | | new String[]{oQuantity, nQuantity, rs}); |
| | | // before里面入立规则过不了改到 |
| | | // 已经改进 Must_Input_ChangeQuantityReason 的 valida before可以完成 ChangeQuantityReason__c = '' |
| | | // nObj.ChangeQuantityReason__c = ''; |
| | | } |
| | | private void beforeSetValue() { |
| | | for (Asset nObj : newList) { |
| | | // 有线下数据, 所以不需要下面的logic |
| | | //if (nObj.Quantity == null) { |
| | | // nObj.Quantity = 1; |
| | | //} |
| | | if (Trigger.isInsert) { |
| | | nObj.Last_Reserve_RAES_Detail__c = null; |
| | | nObj.Last_Reserve_TAES_Detail__c = null; |
| | | nObj.Pre_Reserve_RAES_Detail__c = null; |
| | | nObj.Pre_Reserve_TAES_Detail__c = null; |
| | | nObj.Fixture_OneToOne_Link__c = null; |
| | | } |
| | | |
| | | if (oAbandoned_Inventory != nAbandoned_Inventory || Trigger.isInsert) { |
| | | String rs = nObj.Giveup_Return__c; |
| | | nObj.ChangeAbandoned_InventoryHistory__c = String.format(System.Label.ChangeAbandoned_InventoryHistory, |
| | | new String[]{oAbandoned_Inventory, nAbandoned_Inventory, rs}); |
| | | } |
| | | if (Trigger.isUpdate) { |
| | | Asset oObj = oldMap.get(nObj.Id); |
| | | if ( |
| | | oObj.Last_Reserve_RAES_Detail__c != null && |
| | | nObj.Last_Reserve_RAES_Detail__c == null && |
| | | oObj.Last_Reserve_RAES_Detail_Flag__c == true |
| | | ) { |
| | | nObj.Pre_Reserve_RAES_Detail__c = oObj.Last_Reserve_RAES_Detail__c; |
| | | } |
| | | if ( |
| | | oObj.Last_Reserve_TAES_Detail__c != null && |
| | | nObj.Last_Reserve_TAES_Detail__c == null |
| | | ) { |
| | | // TODO 由于__r超20,字段建不出来 |
| | | // && oObj.Last_Reserve_TAES_Detail_Flag__c == true |
| | | nObj.Pre_Reserve_TAES_Detail__c = oObj.Last_Reserve_TAES_Detail__c; |
| | | } |
| | | } |
| | | |
| | | // 必ず最後で置く |
| | | nObj.Fixture_Status2_text__c = nObj.Fixture_Status2__c; |
| | | nObj.Fixture_Status3_text__c = nObj.Fixture_Status3__c; |
| | | nObj.BTreeIndexKey__c = |
| | | nObj.Asset_Owner__c + |
| | | ':' + |
| | | nObj.Asset_loaner_category__c + |
| | | ':' + |
| | | String.valueOf(nobj.Freeze_sign_Abandoned_Flag__c) + |
| | | ':' + |
| | | String.valueOf(nObj.Delete_Flag__c) + |
| | | ':' + |
| | | String.valueOf(nObj.AssetManageConfirm__c); |
| | | |
| | | if ( |
| | | nObj.Status == |
| | | FixtureUtil.assetStatusMap.get( |
| | | FixtureUtil.AssetStatus.Dai_Fei_Qi.ordinal() |
| | | ) |
| | | ) { |
| | | nObj.Freeze_sign__c = false; |
| | | } |
| | | // gzw CHAN-CCR6MW 【委托】【保有设备】保有设备发货日逻辑 start |
| | | if (Trigger.isInsert && nObj.Posting_Date__c == null) { |
| | | nObj.Posting_Date__c = Date.newInstance(1900, 1, 1); |
| | | } |
| | | // gzw CHAN-CCR6MW 【委托】【保有设备】保有设备发货日逻辑 end |
| | | } |
| | | } |
| | | |
| | | //// かならず afterUpdate |
| | | private void cleanChangeQuantityReason() { |
| | | // TODO 更新自己table 原则需要Static的Class变量(因为会有复数的Method去更新自己的) |
| | | List<Asset> assList = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (String.isBlank(nObj.ChangeQuantityReason__c) == false) { |
| | | assList.add(new Asset(Id = nObj.Id, |
| | | ChangeQuantityReason__c = '')); |
| | | } |
| | | } |
| | | if (!assList.isEmpty()) { |
| | | update assList; |
| | | } |
| | | // かならず before |
| | | private void updateChangeQuantityReason() { |
| | | for (Asset nObj : newList) { |
| | | Asset oObj; |
| | | String oQuantity = ''; |
| | | String oAbandoned_Inventory = ''; |
| | | if (Trigger.isUpdate) { |
| | | oObj = oldMap.get(nObj.Id); |
| | | oQuantity = oObj.Quantity == null ? '' : String.valueOf(oObj.Quantity); |
| | | oAbandoned_Inventory = oObj.Abandoned_Inventory__c == null |
| | | ? '' |
| | | : String.valueOf(oObj.Abandoned_Inventory__c); |
| | | } |
| | | String nQuantity = nObj.Quantity == null |
| | | ? '' |
| | | : String.valueOf(nObj.Quantity); |
| | | String nAbandoned_Inventory = nObj.Abandoned_Inventory__c == null |
| | | ? '' |
| | | : String.valueOf(nObj.Abandoned_Inventory__c); |
| | | if ( |
| | | (oQuantity != nQuantity && |
| | | String.isNotBlank(nObj.ChangeQuantityReason__c)) || Trigger.isInsert |
| | | ) { |
| | | String rs = nObj.ChangeQuantityReason__c; |
| | | nObj.ChangeQuantityHistory__c = String.format( |
| | | System.Label.ChangeQuantityHistory, |
| | | new List<String>{ oQuantity, nQuantity, rs } |
| | | ); |
| | | // before里面入立规则过不了改到 |
| | | // 已经改进 Must_Input_ChangeQuantityReason 的 valida before可以完成 ChangeQuantityReason__c = '' |
| | | // nObj.ChangeQuantityReason__c = ''; |
| | | } |
| | | |
| | | if (oAbandoned_Inventory != nAbandoned_Inventory || Trigger.isInsert) { |
| | | String rs = nObj.Giveup_Return__c; |
| | | nObj.ChangeAbandoned_InventoryHistory__c = String.format( |
| | | System.Label.ChangeAbandoned_InventoryHistory, |
| | | new List<String>{ oAbandoned_Inventory, nAbandoned_Inventory, rs } |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // afterUpdate |
| | | // 清理字段「待废弃数(丢失/盘亏)修改理由」 |
| | | private void cleanGiveupReturnReason() { |
| | | List<Asset> assList = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (String.isBlank(nObj.Giveup_Return__c) == false) { |
| | | assList.add(new Asset( |
| | | Id = nObj.Id, |
| | | Giveup_Return__c = '')); |
| | | } |
| | | } |
| | | if (!assList.isEmpty()) { |
| | | update assList; |
| | | } |
| | | //// かならず afterUpdate |
| | | private void cleanChangeQuantityReason() { |
| | | // TODO 更新自己table 原则需要Static的Class变量(因为会有复数的Method去更新自己的) |
| | | List<Asset> assList = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (String.isBlank(nObj.ChangeQuantityReason__c) == false) { |
| | | assList.add(new Asset(Id = nObj.Id, ChangeQuantityReason__c = '')); |
| | | } |
| | | } |
| | | |
| | | // かならず after, oObj.Id と nObj.Id を使うため |
| | | // Last_Reserve_RAES_Detail__c (个体管理) のlink 変わった場合、 |
| | | // Fixture_OneToOne_Link__c より Asset に積み上げしている数字も連動になる、Fixture_OneToOne_Link__c を空更新 |
| | | // 更新項目Fixture_OneToOne_Link__c.In_wh_Fu_Shu_Pin_You_Xiao_Ku_Cun__c = Fixture_OneToOne_Link__c.In_wh_Fu_Shu_Pin_You_Xiao_Ku_Cun_F__c |
| | | private void mainAssetUpdateed_OneToOneRecord() { |
| | | Set<Id> aSetIdSet = new Set<Id>(); |
| | | System.debug(LoggingLevel.INFO, '*** mainAssetUpdateed_OneToOneRecord: '); |
| | | for (Integer i = 0; i < newList.size(); i++) { |
| | | Asset nObj = newList[i]; |
| | | Asset oObj = oldList[i]; |
| | | if (oObj.Last_Reserve_RAES_Detail__c != nObj.Last_Reserve_RAES_Detail__c) { |
| | | if (String.isNotBlank(oObj.Id)) { |
| | | aSetIdSet.add(oObj.Id); |
| | | } |
| | | if (String.isNotBlank(nObj.Id)) { |
| | | aSetIdSet.add(nObj.Id); |
| | | } |
| | | } |
| | | } |
| | | if (!aSetIdSet.isEmpty()) { |
| | | List<Fixture_OneToOne_Link__c> oneToOneList = [ |
| | | SELECT Id FROM Fixture_OneToOne_Link__c WHERE Main_Asset__c IN :aSetIdSet]; |
| | | if (!oneToOneList.isEmpty()) { update oneToOneList; } |
| | | } |
| | | if (!assList.isEmpty()) { |
| | | update assList; |
| | | } |
| | | } |
| | | |
| | | // * 不会有暂定分配后再拿去修理的备品走重新设置暂定分配的逻辑(queueRedistribution方法) |
| | | // * 理由:明细暂定分配的时候创建修理的话会报以下错误 |
| | | // * 借出_分配_数 不能大于 设备的总数 ------> Asset 入力规则 You_Xiao_Ku_Cun_chk |
| | | // * 暂定分配-1 |
| | | // * 修理-1 |
| | | // * 数量1 |
| | | // * 1-1-1 = -1 |
| | | // * |
| | | // * 如果暂定分配想修理的话分配暂定分配的那一条明细 |
| | | // * 然后再出出库前检测的时候选择NG修理 |
| | | // かならず after |
| | | private void queueRedistribution() { |
| | | if (queueRaesdMap == null) { |
| | | queueRaesdMap = new Map<String , List<Rental_Apply_Equipment_Set_Detail__c>>(); |
| | | // afterUpdate |
| | | // 清理字段「待废弃数(丢失/盘亏)修改理由」 |
| | | private void cleanGiveupReturnReason() { |
| | | List<Asset> assList = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (String.isBlank(nObj.Giveup_Return__c) == false) { |
| | | assList.add(new Asset(Id = nObj.Id, Giveup_Return__c = '')); |
| | | } |
| | | } |
| | | if (!assList.isEmpty()) { |
| | | update assList; |
| | | } |
| | | } |
| | | |
| | | // かならず after, oObj.Id と nObj.Id を使うため |
| | | // Last_Reserve_RAES_Detail__c (个体管理) のlink 変わった場合、 |
| | | // Fixture_OneToOne_Link__c より Asset に積み上げしている数字も連動になる、Fixture_OneToOne_Link__c を空更新 |
| | | // 更新項目Fixture_OneToOne_Link__c.In_wh_Fu_Shu_Pin_You_Xiao_Ku_Cun__c = Fixture_OneToOne_Link__c.In_wh_Fu_Shu_Pin_You_Xiao_Ku_Cun_F__c |
| | | private void mainAssetUpdateed_OneToOneRecord() { |
| | | Set<Id> aSetIdSet = new Set<Id>(); |
| | | System.debug(LoggingLevel.INFO, '*** mainAssetUpdateed_OneToOneRecord: '); |
| | | for (Integer i = 0; i < newList.size(); i++) { |
| | | Asset nObj = newList[i]; |
| | | Asset oObj = oldList[i]; |
| | | if ( |
| | | oObj.Last_Reserve_RAES_Detail__c != nObj.Last_Reserve_RAES_Detail__c |
| | | ) { |
| | | if (String.isNotBlank(oObj.Id)) { |
| | | aSetIdSet.add(oObj.Id); |
| | | } |
| | | Map<String, Set<Id>> modelNoAssetIdMap = new Map<String, Set<Id>>(); |
| | | Set<Id> raesdIdSet = new Set<Id>(); |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> updList = new List<Rental_Apply_Equipment_Set_Detail__c>(); |
| | | String whkey = ''; |
| | | for (Asset nObj : newList) { |
| | | //ToDo現在排队できるのは主体だけなので,今後个体管理の附属品も排队できるの場合があったらこのIFぶんを直す必要があります |
| | | if (!(nObj.Loaner_accsessary__c == false |
| | | && nObj.Asset_Owner__c == 'Olympus' |
| | | && nObj.Equipment_Type__c != '检测用备品' |
| | | && nObj.Delete_Flag__c == False |
| | | && nObj.You_Xiao_Ku_Cun__c > 0 |
| | | && nObj.Freeze_sign_Abandoned_Flag__c == False) |
| | | ) { |
| | | continue; |
| | | } |
| | | if (String.isNotBlank(nObj.Id)) { |
| | | aSetIdSet.add(nObj.Id); |
| | | } |
| | | } |
| | | } |
| | | if (!aSetIdSet.isEmpty()) { |
| | | List<Fixture_OneToOne_Link__c> oneToOneList = [ |
| | | SELECT Id |
| | | FROM Fixture_OneToOne_Link__c |
| | | WHERE Main_Asset__c IN :aSetIdSet |
| | | ]; |
| | | if (!oneToOneList.isEmpty()) { |
| | | update oneToOneList; |
| | | } |
| | | } |
| | | } |
| | | |
| | | String key = nObj.Fixture_Model_No_F__c; |
| | | //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | if (String.isNotBlank(nObj.Internal_asset_location__c)) { |
| | | key += nObj.Internal_asset_location__c; |
| | | } |
| | | // * 不会有暂定分配后再拿去修理的备品走重新设置暂定分配的逻辑(queueRedistribution方法) |
| | | // * 理由:明细暂定分配的时候创建修理的话会报以下错误 |
| | | // * 借出_分配_数 不能大于 设备的总数 ------> Asset 入力规则 You_Xiao_Ku_Cun_chk |
| | | // * 暂定分配-1 |
| | | // * 修理-1 |
| | | // * 数量1 |
| | | // * 1-1-1 = -1 |
| | | // * |
| | | // * 如果暂定分配想修理的话分配暂定分配的那一条明细 |
| | | // * 然后再出出库前检测的时候选择NG修理 |
| | | // かならず after |
| | | private void queueRedistribution() { |
| | | if (queueRaesdMap == null) { |
| | | queueRaesdMap = new Map<String, List<Rental_Apply_Equipment_Set_Detail__c>>(); |
| | | } |
| | | Map<String, Set<Id>> modelNoAssetIdMap = new Map<String, Set<Id>>(); |
| | | Set<Id> raesdIdSet = new Set<Id>(); |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> updList = new List<Rental_Apply_Equipment_Set_Detail__c>(); |
| | | String whkey = ''; |
| | | for (Asset nObj : newList) { |
| | | //ToDo現在排队できるのは主体だけなので,今後个体管理の附属品も排队できるの場合があったらこのIFぶんを直す必要があります |
| | | if ( |
| | | !(nObj.Loaner_accsessary__c == false && |
| | | nObj.Asset_Owner__c == 'Olympus' && |
| | | nObj.Equipment_Type__c != '检测用备品' && |
| | | nObj.Delete_Flag__c == false && |
| | | nObj.You_Xiao_Ku_Cun__c > 0 && |
| | | nObj.Freeze_sign_Abandoned_Flag__c == false) |
| | | ) { |
| | | continue; |
| | | } |
| | | |
| | | if (String.isNotBlank(nObj.Salesdepartment__c)) { |
| | | key += nObj.Salesdepartment__c; |
| | | } |
| | | if (String.isNotBlank(nObj.Equipment_Type__c)) { |
| | | key += nObj.Equipment_Type__c; |
| | | } |
| | | if (String.isNotBlank(nObj.Product_category__c)) { |
| | | key += nObj.Product_category__c; |
| | | } |
| | | String key = nObj.Fixture_Model_No_F__c; |
| | | //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | if (String.isNotBlank(nObj.Internal_asset_location__c)) { |
| | | key += nObj.Internal_asset_location__c; |
| | | } |
| | | |
| | | |
| | | System.debug(LoggingLevel.INFO, '*** key: ' + key); |
| | | //有新的Asset的时候 暂定分配 |
| | | // You_Xiao_Ku_Cun__c > 0 在上面已经做了判断 |
| | | if (Trigger.isInsert && String.isBlank(nObj.Last_Reserve_RAES_Detail__c)) { |
| | | if (String.isBlank(nObj.Fixture_Model_No_F__c) == false) { |
| | | // modelNoAssetIdMap.put(nObj.Fixture_Model_No_F__c, nObj.Id); |
| | | if (modelNoAssetIdMap.containsKey(key) == false) { |
| | | modelNoAssetIdMap.put(key, new Set<Id>()); |
| | | } |
| | | modelNoAssetIdMap.get(key).add(nObj.Id); |
| | | } |
| | | } |
| | | //当主体参照的Asset的Last断开的时候重新寻找暂定分配 |
| | | //ToDo状況確認 |
| | | /* |
| | | if (String.isNotBlank(nObj.Salesdepartment__c)) { |
| | | key += nObj.Salesdepartment__c; |
| | | } |
| | | if (String.isNotBlank(nObj.Equipment_Type__c)) { |
| | | key += nObj.Equipment_Type__c; |
| | | } |
| | | if (String.isNotBlank(nObj.Product_category__c)) { |
| | | key += nObj.Product_category__c; |
| | | } |
| | | |
| | | System.debug(LoggingLevel.INFO, '*** key: ' + key); |
| | | //有新的Asset的时候 暂定分配 |
| | | // You_Xiao_Ku_Cun__c > 0 在上面已经做了判断 |
| | | if ( |
| | | Trigger.isInsert && String.isBlank(nObj.Last_Reserve_RAES_Detail__c) |
| | | ) { |
| | | if (String.isBlank(nObj.Fixture_Model_No_F__c) == false) { |
| | | // modelNoAssetIdMap.put(nObj.Fixture_Model_No_F__c, nObj.Id); |
| | | if (modelNoAssetIdMap.containsKey(key) == false) { |
| | | modelNoAssetIdMap.put(key, new Set<Id>()); |
| | | } |
| | | modelNoAssetIdMap.get(key).add(nObj.Id); |
| | | } |
| | | } |
| | | //当主体参照的Asset的Last断开的时候重新寻找暂定分配 |
| | | //ToDo状況確認 |
| | | /* |
| | | || (nObj.Asset_Owner__c != oObj.Asset_Owner__c && nObj.Asset_Owner__c == 'Olympus') |
| | | || (nObj.Equipment_Type__c != oObj.Equipment_Type__c && oObj.Equipment_Type__c == '检测用备品') |
| | | || (nObj.Delete_Flag__c != oObj.Delete_Flag__c && nObj.Delete_Flag__c == false) |
| | | || (nObj.Freeze_sign__c != oObj.Freeze_sign__c && nObj.Delete_Flag__c == false) |
| | | */ |
| | | // You_Xiao_Ku_Cun__c > 0 在上面已经做了判断 |
| | | else { |
| | | Asset oObj = oldMap.get(nObj.Id); |
| | | if (nObj.Loaner_accsessary__c == false && String.isBlank(nObj.Last_Reserve_RAES_Detail__c) |
| | | && (nObj.Last_Reserve_RAES_Detail__c != oObj.Last_Reserve_RAES_Detail__c |
| | | || (nObj.Asset_Owner__c != oObj.Asset_Owner__c && nObj.Asset_Owner__c == 'Olympus') |
| | | //备品存放地 OLY_OCM-722 恢复存放地的条件 |
| | | || (nObj.Internal_asset_location__c != oObj.Internal_asset_location__c) |
| | | //备品分类并且不是 检测用备品 |
| | | || (nObj.Equipment_Type__c != oObj.Equipment_Type__c && nObj.Equipment_Type__c != '检测用备品') |
| | | //销售本部 |
| | | || (nObj.Salesdepartment__c != oObj.Salesdepartment__c) |
| | | //产品分类(GI/SP) |
| | | || (nObj.Product_category__c != oObj.Product_category__c) |
| | | //备品配套明细型号 |
| | | || (nObj.Fixture_Model_No_F__c != oObj.Fixture_Model_No_F__c) |
| | | || (nObj.Delete_Flag__c != oObj.Delete_Flag__c && nObj.Delete_Flag__c == true) |
| | | || (nObj.Freeze_sign_Abandoned_Flag__c != oObj.Freeze_sign_Abandoned_Flag__c && nObj.Freeze_sign_Abandoned_Flag__c == false) |
| | | ) |
| | | ) { |
| | | if (String.isBlank(nObj.Fixture_Model_No_F__c) == false) { |
| | | if (modelNoAssetIdMap.containsKey(key) == false) { |
| | | modelNoAssetIdMap.put(key, new Set<Id>()); |
| | | } |
| | | modelNoAssetIdMap.get(key).add(nObj.Id); |
| | | } |
| | | if (String.isNotBlank(oObj.Last_Reserve_RAES_Detail__c)) { |
| | | raesdIdSet.add(oObj.Last_Reserve_RAES_Detail__c); |
| | | } |
| | | } |
| | | // You_Xiao_Ku_Cun__c > 0 在上面已经做了判断 |
| | | else { |
| | | Asset oObj = oldMap.get(nObj.Id); |
| | | if ( |
| | | nObj.Loaner_accsessary__c == false && |
| | | String.isBlank(nObj.Last_Reserve_RAES_Detail__c) && |
| | | (nObj.Last_Reserve_RAES_Detail__c != |
| | | oObj.Last_Reserve_RAES_Detail__c || |
| | | (nObj.Asset_Owner__c != oObj.Asset_Owner__c && |
| | | nObj.Asset_Owner__c == 'Olympus') || |
| | | //备品存放地 OLY_OCM-722 恢复存放地的条件 |
| | | (nObj.Internal_asset_location__c != |
| | | oObj.Internal_asset_location__c) || |
| | | //备品分类并且不是 检测用备品 |
| | | (nObj.Equipment_Type__c != oObj.Equipment_Type__c && |
| | | nObj.Equipment_Type__c != '检测用备品') || |
| | | //销售本部 |
| | | (nObj.Salesdepartment__c != oObj.Salesdepartment__c) || |
| | | //产品分类(GI/SP) |
| | | (nObj.Product_category__c != oObj.Product_category__c) || |
| | | //备品配套明细型号 |
| | | (nObj.Fixture_Model_No_F__c != oObj.Fixture_Model_No_F__c) || |
| | | (nObj.Delete_Flag__c != oObj.Delete_Flag__c && |
| | | nObj.Delete_Flag__c == true) || |
| | | (nObj.Freeze_sign_Abandoned_Flag__c != |
| | | oObj.Freeze_sign_Abandoned_Flag__c && |
| | | nObj.Freeze_sign_Abandoned_Flag__c == false)) |
| | | ) { |
| | | if (String.isBlank(nObj.Fixture_Model_No_F__c) == false) { |
| | | if (modelNoAssetIdMap.containsKey(key) == false) { |
| | | modelNoAssetIdMap.put(key, new Set<Id>()); |
| | | } |
| | | modelNoAssetIdMap.get(key).add(nObj.Id); |
| | | } |
| | | if (String.isNotBlank(oObj.Last_Reserve_RAES_Detail__c)) { |
| | | raesdIdSet.add(oObj.Last_Reserve_RAES_Detail__c); |
| | | } |
| | | } |
| | | if (modelNoAssetIdMap.isEmpty()) { |
| | | return; |
| | | } |
| | | System.debug(LoggingLevel.INFO, '*** raesdIdSet: ' + JSON.serialize(raesdIdSet)); |
| | | //modified by denny 2021-11-17 |
| | | List<String> keyList = new List<String>(); |
| | | keyList.addAll(modelNoAssetIdMap.keySet()); |
| | | System.debug(LoggingLevel.INFO, '*** keyList: ' + keyList); |
| | | List<Rental_Apply_Sequence__c> targetSequence = [SELECT Id,Apply_Set_Detail__c, |
| | | Apply_Set_Detail_ExternalKey__c, |
| | | Demo_Purpose2__c, Equipment_Type__c, ExternalKey__c, |
| | | Fixture_Model_No__c, |
| | | Internal_asset_location__c, Invalid_Flag__c, |
| | | Product_category__c, |
| | | Rental_Apply__c,Series_No__c, |
| | | Series_Unequal_Queue_Flag__c, Salesdepartment__c |
| | | FROM Rental_Apply_Sequence__c |
| | | WHERE Series_No__c > 0 AND Invalid_Flag__c =false |
| | | AND Apply_Set_Detail__c NOT IN:raesdIdSet |
| | | AND ExternalKey__c IN:keyList |
| | | AND Apply_Set_Detail__r.Cancel_Select__c = false |
| | | ORDER BY Series_No__c ]; |
| | | System.debug(LoggingLevel.INFO, '*** targetSequence: ' + targetSequence); |
| | | Map<String,List<Rental_Apply_Sequence__c>> sequenceMap = new Map<String,List<Rental_Apply_Sequence__c>>(); |
| | | for(Rental_Apply_Sequence__c sequeuece:targetSequence){ |
| | | if(!sequenceMap.containsKey(sequeuece.Externalkey__c)){ |
| | | sequenceMap.put(sequeuece.Externalkey__c,new List<Rental_Apply_Sequence__c>()); |
| | | } |
| | | } |
| | | if (modelNoAssetIdMap.isEmpty()) { |
| | | return; |
| | | } |
| | | System.debug( |
| | | LoggingLevel.INFO, |
| | | '*** raesdIdSet: ' + JSON.serialize(raesdIdSet) |
| | | ); |
| | | //modified by denny 2021-11-17 |
| | | List<String> keyList = new List<String>(); |
| | | keyList.addAll(modelNoAssetIdMap.keySet()); |
| | | System.debug(LoggingLevel.INFO, '*** keyList: ' + keyList); |
| | | List<Rental_Apply_Sequence__c> targetSequence = [ |
| | | SELECT |
| | | Id, |
| | | Apply_Set_Detail__c, |
| | | Apply_Set_Detail_ExternalKey__c, |
| | | Demo_Purpose2__c, |
| | | Equipment_Type__c, |
| | | ExternalKey__c, |
| | | Fixture_Model_No__c, |
| | | Internal_asset_location__c, |
| | | Invalid_Flag__c, |
| | | Product_category__c, |
| | | Rental_Apply__c, |
| | | Series_No__c, |
| | | Series_Unequal_Queue_Flag__c, |
| | | Salesdepartment__c |
| | | FROM Rental_Apply_Sequence__c |
| | | WHERE |
| | | Series_No__c > 0 |
| | | AND Invalid_Flag__c = FALSE |
| | | AND Apply_Set_Detail__c NOT IN :raesdIdSet |
| | | AND ExternalKey__c IN :keyList |
| | | AND Apply_Set_Detail__r.Cancel_Select__c = FALSE |
| | | ORDER BY Series_No__c |
| | | ]; |
| | | System.debug(LoggingLevel.INFO, '*** targetSequence: ' + targetSequence); |
| | | Map<String, List<Rental_Apply_Sequence__c>> sequenceMap = new Map<String, List<Rental_Apply_Sequence__c>>(); |
| | | for (Rental_Apply_Sequence__c sequeuece : targetSequence) { |
| | | if (!sequenceMap.containsKey(sequeuece.Externalkey__c)) { |
| | | sequenceMap.put( |
| | | sequeuece.Externalkey__c, |
| | | new List<Rental_Apply_Sequence__c>() |
| | | ); |
| | | } |
| | | sequenceMap.get(sequeuece.Externalkey__c).add(sequeuece); |
| | | } |
| | | Map<String, Rental_Apply_Equipment_Set_Detail__c> updateMap = new Map<String, Rental_Apply_Equipment_Set_Detail__c>(); |
| | | for (String key : sequenceMap.keySet()) { |
| | | for (Rental_Apply_Sequence__c sequeuece : sequenceMap.get(key)) { |
| | | if (!updateMap.containsKey(sequeuece.Apply_Set_Detail__c)) { |
| | | System.debug( |
| | | LoggingLevel.INFO, |
| | | '*** modelNoAssetIdMap: ' + JSON.serialize(modelNoAssetIdMap) |
| | | ); |
| | | if (modelNoAssetIdMap.containsKey(key)) { |
| | | List<Id> assIdList = new List<Id>(); |
| | | assIdList.addAll(modelNoAssetIdMap.get(key)); |
| | | String assIdbk = assIdList.get(0); |
| | | Rental_Apply_Equipment_Set_Detail__c raesd = new Rental_Apply_Equipment_Set_Detail__c(); |
| | | raesd.Id = sequeuece.Apply_Set_Detail__c; |
| | | raesd.Asset__c = assIdbk; |
| | | System.debug('raesd.Asset__c' + raesd.Asset__c); |
| | | raesd.Queue_Number__c = 0; // 暂定分配 |
| | | updateMap.put(raesd.Id, raesd); |
| | | |
| | | modelNoAssetIdMap.get(key).remove(assIdbk); |
| | | if (modelNoAssetIdMap.get(key).isEmpty()) { |
| | | modelNoAssetIdMap.remove(key); |
| | | } |
| | | sequenceMap.get(sequeuece.Externalkey__c).add(sequeuece); |
| | | System.debug( |
| | | LoggingLevel.INFO, |
| | | '*** modelNoAssetIdMap: ' + JSON.serialize(modelNoAssetIdMap) |
| | | ); |
| | | } |
| | | } |
| | | Map<String,Rental_Apply_Equipment_Set_Detail__c> updateMap = new Map<String,Rental_Apply_Equipment_Set_Detail__c>(); |
| | | for(String key:sequenceMap.keySet()){ |
| | | for(Rental_Apply_Sequence__c sequeuece:sequenceMap.get(key)){ |
| | | if(!updateMap.containsKey(sequeuece.Apply_Set_Detail__c)){ |
| | | System.debug(LoggingLevel.INFO, '*** modelNoAssetIdMap: ' + JSON.serialize(modelNoAssetIdMap)); |
| | | if(modelNoAssetIdMap.containsKey(key)){ |
| | | List<Id> assIdList = new List<Id>(); |
| | | assIdList.addAll(modelNoAssetIdMap.get(key)); |
| | | String assIdbk = assIdList.get(0); |
| | | Rental_Apply_Equipment_Set_Detail__c raesd = new Rental_Apply_Equipment_Set_Detail__c(); |
| | | raesd.Id = sequeuece.Apply_Set_Detail__c; |
| | | raesd.Asset__c = assIdbk; |
| | | System.debug('raesd.Asset__c' + raesd.Asset__c); |
| | | raesd.Queue_Number__c = 0; // 暂定分配 |
| | | updateMap.put(raesd.Id,raesd); |
| | | } |
| | | } |
| | | System.debug( |
| | | LoggingLevel.INFO, |
| | | '*** updateMap.values(): ' + JSON.serialize(updateMap.values()) |
| | | ); |
| | | update updateMap.values(); |
| | | |
| | | // Fixture_Model_No_F__c を見ることができない、データがおおいので。 |
| | | // Fixture_Set_Detail__r.Fixture_Model_No_F__c をみるか Fixture_Model_No_text__c をみるか |
| | | // whkey += ' ('; |
| | | // whkey += ' ((Fixture_Set_Detail__c != null and Fixture_Set_Detail__r.Product2__r.Fixture_Model_No_T__c =\'' + String.escapeSingleQuotes(nObj.Fixture_Model_No_F__c) + '\')'; |
| | | // whkey += ' OR Fixture_Model_No_text__c =\'' + String.escapeSingleQuotes(nObj.Fixture_Model_No_F__c) + '\''; |
| | | // whkey += ' )'; |
| | | |
| | | modelNoAssetIdMap.get(key).remove(assIdbk); |
| | | if (modelNoAssetIdMap.get(key).isEmpty()) { |
| | | modelNoAssetIdMap.remove(key); |
| | | } |
| | | System.debug(LoggingLevel.INFO, '*** modelNoAssetIdMap: ' + JSON.serialize(modelNoAssetIdMap)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // String wher = ''; |
| | | // //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | // if (String.isNotBlank(nObj.Internal_asset_location__c)) { |
| | | // wher += ' and Internal_asset_location_before__c =\'' + String.escapeSingleQuotes(nObj.Internal_asset_location__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Salesdepartment__c)) { |
| | | // wher += ' and Salesdepartment_before__c =\'' + String.escapeSingleQuotes(nObj.Salesdepartment__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Product_category__c)) { |
| | | // wher += ' and Product_category_text__c =\'' + String.escapeSingleQuotes(nObj.Product_category__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Equipment_Type__c)) { |
| | | // wher += ' and Equipment_Type_text__c =\'' + String.escapeSingleQuotes(nObj.Equipment_Type__c) + '\''; |
| | | // } |
| | | |
| | | // whkey += wher + ' ) OR'; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(whkey)) { |
| | | // whkey = '( ' + whkey.removeEnd('OR') + ')'; |
| | | // } |
| | | |
| | | // String soql = 'SELECT Fixture_Model_No_F__c, Substitute_flag__c, Asset__c,' |
| | | // + ' Queue_Number__c, Fixture_Model_No_text__c, Salesdepartment_before__c,' |
| | | // + ' Product_category_text__c, Equipment_Type_text__c, Internal_asset_location_before__c' |
| | | // + ' FROM Rental_Apply_Equipment_Set_Detail__c' |
| | | // + ' where Id != :raesdIdSet and ' |
| | | // + whkey |
| | | // + ' and Queue_Number__c > 0' |
| | | // + ' and Cancel_Select__c = false' |
| | | // + ' order by Queue_Number__c ASC'; |
| | | // System.debug('whkey' + whkey); |
| | | // System.debug('soql' + soql); |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> targetRaesd = Database.query(soql); |
| | | // System.debug('targetRaesd' + targetRaesd); |
| | | // for (Rental_Apply_Equipment_Set_Detail__c raesd : targetRaesd) { |
| | | // // TODO Fixture_Set_Detail__c に チェック追加 Rental_Apply_Equipment_Set_Detail__c 新数据, 有 没有分配(分配时间) 的话, 不能 Delete Fixture_Set_Detail__c |
| | | // String key = ''; |
| | | // if (raesd.Substitute_flag__c) { |
| | | // key = raesd.Fixture_Model_No_text__c; |
| | | // } else { |
| | | // key = raesd.Fixture_Model_No_F__c; |
| | | // } |
| | | // //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | // if (String.isNotBlank(raesd.Internal_asset_location_before__c)) { |
| | | // key += '_' + raesd.Internal_asset_location_before__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Salesdepartment_before__c)) { |
| | | // key += '_' + raesd.Salesdepartment_before__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Product_category_text__c)) { |
| | | // key += '_' + raesd.Product_category_text__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Equipment_Type_text__c)) { |
| | | // key += '_' + raesd.Equipment_Type_text__c; |
| | | // } |
| | | // if (queueRaesdMap.containsKey(key) == false) { |
| | | // queueRaesdMap.put(key, new List<Rental_Apply_Equipment_Set_Detail__c>()); |
| | | // } |
| | | // queueRaesdMap.get(key).add(raesd); |
| | | // } |
| | | |
| | | // System.debug('queueRaesdMap' + queueRaesdMap); |
| | | // System.debug('modelNoAssetIdMap' + modelNoAssetIdMap); |
| | | |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> uplist = new List<Rental_Apply_Equipment_Set_Detail__c>(); |
| | | // for (String raesdkey : queueRaesdMap.keySet()) { |
| | | // for (Rental_Apply_Equipment_Set_Detail__c raesd : queueRaesdMap.get(raesdkey)) { |
| | | // System.debug(raesdkey); |
| | | // // 这里的queueRaesdMap在用完后没有清空,导致与最新查出的targetRaesd不一致 |
| | | // // 担心直接清空会造成其它问题,所以加or来保证明细的Asset__c只会被更新一次 |
| | | // if (modelNoAssetIdMap.containsKey(raesdkey) == false || String.isNotBlank(raesd.Asset__c)) { |
| | | // // 基本発生しない、queueRaesdMap <= modelNoAssetIdMap |
| | | // continue; |
| | | // } |
| | | // Id assIdbk; |
| | | // for (Id assId : modelNoAssetIdMap.get(raesdkey)) { |
| | | // assIdbk = assId; |
| | | // raesd.Asset__c = assId; |
| | | // System.debug('raesd.Asset__c' + raesd.Asset__c); |
| | | // raesd.Queue_Number__c = 0; // 暂定分配 |
| | | // uplist.add(raesd); |
| | | // System.debug('raesd Idis' + raesd.Id); |
| | | // break; |
| | | // } |
| | | // modelNoAssetIdMap.get(raesdkey).remove(assIdbk); |
| | | // if (modelNoAssetIdMap.get(raesdkey).isEmpty()) { |
| | | // modelNoAssetIdMap.remove(raesdkey); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // //排队更新 |
| | | // if (!uplist.isEmpty()) { |
| | | // update uplist; |
| | | // } |
| | | } |
| | | |
| | | //before 数式の値がnullになる可能性がありますのでここでも一回チェックします |
| | | private void formulaToTextCheck() { |
| | | List<Asset> assets = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (nObj.Fixture_Status2_text__c != nObj.Fixture_Status2__c) { |
| | | Asset ass = new Asset(Id = nObj.Id); |
| | | ass.Fixture_Status2_text__c = nObj.Fixture_Status2__c; |
| | | assets.add(ass); |
| | | } |
| | | } |
| | | if (!assets.isEmpty()) { |
| | | update assets; |
| | | } |
| | | } |
| | | |
| | | private void checkOneToOneLink() { |
| | | Set<Id> otoIds = new Set<Id>(); // 待删除link的Id |
| | | Set<Id> assetIds = new Set<Id>(); |
| | | Set<String> centers = new Set<String>{ |
| | | '北京 备品中心', |
| | | '上海 备品中心', |
| | | '广州 备品中心' |
| | | }; |
| | | for (Asset nObj : newList) { |
| | | //待废弃,废弃,和数量0的备品需要断开一对一link (目前只处理个体管理的) |
| | | if ( |
| | | (nObj.Fixture_Status__c == |
| | | FixtureUtil.assetFixtureStatusMap.get( |
| | | FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal() |
| | | ) || |
| | | nObj.Fixture_Status__c == |
| | | FixtureUtil.assetFixtureStatusMap.get( |
| | | FixtureUtil.AssetFixtureStatus.Dai_Fei_Qi.ordinal() |
| | | ) || |
| | | nObj.Quantity == 0) && |
| | | nObj.Manage_type__c == |
| | | FixtureUtil.managetypeMap.get(FixtureUtil.Managetype.Ge_Ti_Guan_Li) |
| | | ) { |
| | | //是一对一主体或者是一对一个体附属品 |
| | | if ( |
| | | nObj.Main_OneToOne__c == true || |
| | | nObj.Fixture_OneToOne_Link__c <> null |
| | | ) { |
| | | if (centers.contains(nObj.Internal_asset_location__c)) { |
| | | assetIds.add(nObj.Id); |
| | | } |
| | | } |
| | | System.debug(LoggingLevel.INFO, '*** updateMap.values(): ' + JSON.serialize(updateMap.values())); |
| | | update updateMap.values(); |
| | | |
| | | // Fixture_Model_No_F__c を見ることができない、データがおおいので。 |
| | | // Fixture_Set_Detail__r.Fixture_Model_No_F__c をみるか Fixture_Model_No_text__c をみるか |
| | | // whkey += ' ('; |
| | | // whkey += ' ((Fixture_Set_Detail__c != null and Fixture_Set_Detail__r.Product2__r.Fixture_Model_No_T__c =\'' + String.escapeSingleQuotes(nObj.Fixture_Model_No_F__c) + '\')'; |
| | | // whkey += ' OR Fixture_Model_No_text__c =\'' + String.escapeSingleQuotes(nObj.Fixture_Model_No_F__c) + '\''; |
| | | // whkey += ' )'; |
| | | |
| | | // String wher = ''; |
| | | // //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | // if (String.isNotBlank(nObj.Internal_asset_location__c)) { |
| | | // wher += ' and Internal_asset_location_before__c =\'' + String.escapeSingleQuotes(nObj.Internal_asset_location__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Salesdepartment__c)) { |
| | | // wher += ' and Salesdepartment_before__c =\'' + String.escapeSingleQuotes(nObj.Salesdepartment__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Product_category__c)) { |
| | | // wher += ' and Product_category_text__c =\'' + String.escapeSingleQuotes(nObj.Product_category__c) + '\''; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(nObj.Equipment_Type__c)) { |
| | | // wher += ' and Equipment_Type_text__c =\'' + String.escapeSingleQuotes(nObj.Equipment_Type__c) + '\''; |
| | | // } |
| | | |
| | | // whkey += wher + ' ) OR'; |
| | | // } |
| | | |
| | | |
| | | |
| | | // if (String.isNotBlank(whkey)) { |
| | | // whkey = '( ' + whkey.removeEnd('OR') + ')'; |
| | | // } |
| | | |
| | | |
| | | |
| | | // String soql = 'SELECT Fixture_Model_No_F__c, Substitute_flag__c, Asset__c,' |
| | | // + ' Queue_Number__c, Fixture_Model_No_text__c, Salesdepartment_before__c,' |
| | | // + ' Product_category_text__c, Equipment_Type_text__c, Internal_asset_location_before__c' |
| | | // + ' FROM Rental_Apply_Equipment_Set_Detail__c' |
| | | // + ' where Id != :raesdIdSet and ' |
| | | // + whkey |
| | | // + ' and Queue_Number__c > 0' |
| | | // + ' and Cancel_Select__c = false' |
| | | // + ' order by Queue_Number__c ASC'; |
| | | // System.debug('whkey' + whkey); |
| | | // System.debug('soql' + soql); |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> targetRaesd = Database.query(soql); |
| | | // System.debug('targetRaesd' + targetRaesd); |
| | | // for (Rental_Apply_Equipment_Set_Detail__c raesd : targetRaesd) { |
| | | // // TODO Fixture_Set_Detail__c に チェック追加 Rental_Apply_Equipment_Set_Detail__c 新数据, 有 没有分配(分配时间) 的话, 不能 Delete Fixture_Set_Detail__c |
| | | // String key = ''; |
| | | // if (raesd.Substitute_flag__c) { |
| | | // key = raesd.Fixture_Model_No_text__c; |
| | | // } else { |
| | | // key = raesd.Fixture_Model_No_F__c; |
| | | // } |
| | | // //暂定分配不看存放地 OLY_OCM-722 恢复存放地的条件 |
| | | // if (String.isNotBlank(raesd.Internal_asset_location_before__c)) { |
| | | // key += '_' + raesd.Internal_asset_location_before__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Salesdepartment_before__c)) { |
| | | // key += '_' + raesd.Salesdepartment_before__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Product_category_text__c)) { |
| | | // key += '_' + raesd.Product_category_text__c; |
| | | // } |
| | | |
| | | // if (String.isNotBlank(raesd.Equipment_Type_text__c)) { |
| | | // key += '_' + raesd.Equipment_Type_text__c; |
| | | // } |
| | | // if (queueRaesdMap.containsKey(key) == false) { |
| | | // queueRaesdMap.put(key, new List<Rental_Apply_Equipment_Set_Detail__c>()); |
| | | // } |
| | | // queueRaesdMap.get(key).add(raesd); |
| | | // } |
| | | |
| | | // System.debug('queueRaesdMap' + queueRaesdMap); |
| | | // System.debug('modelNoAssetIdMap' + modelNoAssetIdMap); |
| | | |
| | | // List<Rental_Apply_Equipment_Set_Detail__c> uplist = new List<Rental_Apply_Equipment_Set_Detail__c>(); |
| | | // for (String raesdkey : queueRaesdMap.keySet()) { |
| | | // for (Rental_Apply_Equipment_Set_Detail__c raesd : queueRaesdMap.get(raesdkey)) { |
| | | // System.debug(raesdkey); |
| | | // // 这里的queueRaesdMap在用完后没有清空,导致与最新查出的targetRaesd不一致 |
| | | // // 担心直接清空会造成其它问题,所以加or来保证明细的Asset__c只会被更新一次 |
| | | // if (modelNoAssetIdMap.containsKey(raesdkey) == false || String.isNotBlank(raesd.Asset__c)) { |
| | | // // 基本発生しない、queueRaesdMap <= modelNoAssetIdMap |
| | | // continue; |
| | | // } |
| | | // Id assIdbk; |
| | | // for (Id assId : modelNoAssetIdMap.get(raesdkey)) { |
| | | // assIdbk = assId; |
| | | // raesd.Asset__c = assId; |
| | | // System.debug('raesd.Asset__c' + raesd.Asset__c); |
| | | // raesd.Queue_Number__c = 0; // 暂定分配 |
| | | // uplist.add(raesd); |
| | | // System.debug('raesd Idis' + raesd.Id); |
| | | // break; |
| | | // } |
| | | // modelNoAssetIdMap.get(raesdkey).remove(assIdbk); |
| | | // if (modelNoAssetIdMap.get(raesdkey).isEmpty()) { |
| | | // modelNoAssetIdMap.remove(raesdkey); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // //排队更新 |
| | | // if (!uplist.isEmpty()) { |
| | | // update uplist; |
| | | // } |
| | | } |
| | | } |
| | | |
| | | //before 数式の値がnullになる可能性がありますのでここでも一回チェックします |
| | | private void formulaToTextCheck() { |
| | | List<Asset> assets = new List<Asset>(); |
| | | for (Asset nObj : newList) { |
| | | if (nObj.Fixture_Status2_text__c != nObj.Fixture_Status2__c) { |
| | | Asset ass = new Asset(Id = nObj.Id); |
| | | ass.Fixture_Status2_text__c = nObj.Fixture_Status2__c; |
| | | assets.add(ass); |
| | | } |
| | | } |
| | | if (!assets.isEmpty()) { |
| | | update assets; |
| | | } |
| | | if (assetIds.size() > 0) { |
| | | Map<Id, Fixture_OneToOne_Link__c> linkMap = new Map<Id, Fixture_OneToOne_Link__c>( |
| | | [ |
| | | SELECT Id |
| | | FROM Fixture_OneToOne_Link__c |
| | | WHERE Main_Asset__c IN :assetIds OR Accessory_Asset__c IN :assetIds |
| | | ] |
| | | ); |
| | | if (!linkMap.isEmpty()) { |
| | | delete linkMap.values(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void checkOneToOneLink() { |
| | | Set<Id> otoIds = new Set<Id>(); // 待删除link的Id |
| | | Set<Id> assetIds = new Set<Id>(); |
| | | Set<String> centers = new Set<String> {'北京 备品中心', '上海 备品中心', '广州 备品中心'}; |
| | | for (Asset nObj : newList) { |
| | | //待废弃,废弃,和数量0的备品需要断开一对一link (目前只处理个体管理的) |
| | | if ((nObj.Fixture_Status__c == FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()) |
| | | || nObj.Fixture_Status__c == FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Fei_Qi.ordinal()) |
| | | || nObj.Quantity == 0) && nObj.Manage_type__c == FixtureUtil.managetypeMap.get(FixtureUtil.Managetype.Ge_Ti_Guan_Li)){ |
| | | //是一对一主体或者是一对一个体附属品 |
| | | if (nObj.Main_OneToOne__c == true || nObj.Fixture_OneToOne_Link__c <> null) { |
| | | if(centers.contains(nObj.Internal_asset_location__c)) { |
| | | assetIds.add(nObj.Id); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 动态设定 Asset.AccountId (备品共享_杭州_华东营业本部) |
| | | * Condition: |
| | | * - before insert, before update |
| | | * - 确认字段变化 (保有设备的备品存放地(Internal_asset_location__c)+所在地区(本部)(Salesdepartment__c)) |
| | | * - Salesdepartment__c IN ('1.华北营业本部','2.东北营业本部','3.西北营业本部','4.华东营业本部','5.华南营业本部','6.西南营业本部') |
| | | * - Asset 是 办事处备品 |
| | | * Execute: |
| | | * - 找 Label: OCM_Management_Province_Mapping, 的 办事处, 设定 AccountId |
| | | * - 没有找的话, 不更新AccountId, 自动做 Account, Group, ApexShare |
| | | */ |
| | | private void beforeSetAccountId() { |
| | | Set<String> targetDepts = new Set<String>{ |
| | | '1.华北营业本部', |
| | | '2.东北营业本部', |
| | | '3.西北营业本部', |
| | | '4.华东营业本部', |
| | | '5.华南营业本部', |
| | | '6.西南营业本部' |
| | | }; |
| | | Set<String> targetCenters = new Set<String>{ |
| | | '北京 备品中心', |
| | | '上海 备品中心', |
| | | '广州 备品中心' |
| | | }; |
| | | if (Test.isRunningTest() && testTargetDepts != null) { |
| | | targetDepts = testTargetDepts; |
| | | } |
| | | // 存放地 → 省 的 Map |
| | | Map<String, String> targetProvs = AssetWebService.getOcmMgtProvMap(); |
| | | |
| | | if (assetIds.size() > 0) { |
| | | Map<Id, Fixture_OneToOne_Link__c> linkMap = new Map<Id, Fixture_OneToOne_Link__c>([ |
| | | // 收集对象 Asset |
| | | Map<Asset, String> assetAccShareNameMap = new Map<Asset, String>(); |
| | | Datetime execNow = System.now(); |
| | | for (Asset nObj : newList) { |
| | | Asset oObj = (null == this.oldMap) ? null : this.oldMap.get(nObj.Id); |
| | | |
| | | // 作成, 确认字段有没有变化 |
| | | if ( |
| | | Trigger.isInsert || |
| | | (oObj != null && |
| | | (oObj.RecordTypeId != nObj.RecordTypeId || |
| | | oObj.Asset_loaner_category__c != nObj.Asset_loaner_category__c || |
| | | oObj.AssetManageConfirm__c != nObj.AssetManageConfirm__c || |
| | | oObj.Internal_asset_location__c != nObj.Internal_asset_location__c || |
| | | oObj.Salesdepartment__c != nObj.Salesdepartment__c || |
| | | oObj.OlympusAccShareName__c != nObj.OlympusAccShareName__c) && |
| | | (targetCenters.contains(nObj.Internal_asset_location__c) || |
| | | targetProvs.containsKey(nObj.Internal_asset_location__c)) && |
| | | !nObj.TransferToOther__c) |
| | | ) { |
| | | // 是不是备品的确认 |
| | | if ( |
| | | System.Label.Asset_RecordType == nObj.RecordTypeId && |
| | | true == nObj.AssetManageConfirm__c && |
| | | nObj.Asset_loaner_category__c != '耗材' |
| | | ) { |
| | | // 办事处备品 → 动态设定 Asset.AccountId 的対象 |
| | | if ( |
| | | targetProvs.containsKey(nObj.Internal_asset_location__c) && |
| | | targetDepts.contains(nObj.Salesdepartment__c) |
| | | ) { |
| | | String accShareName = |
| | | '备品共享_' + |
| | | targetProvs.get(nObj.Internal_asset_location__c) + |
| | | '_' + |
| | | nObj.Salesdepartment__c.right(6); |
| | | nObj.OlympusAccShareName__c = accShareName; |
| | | assetAccShareNameMap.put(nObj, accShareName); |
| | | } else { |
| | | if (AssetHandler.Account_Asset_Id == null) { |
| | | // Static 只会执行一遍 |
| | | AssetHandler.Account_Asset_Id = [ |
| | | SELECT Id |
| | | FROM Fixture_OneToOne_Link__c |
| | | WHERE Main_Asset__c in :assetIds |
| | | OR Accessory_Asset__c IN: assetIds |
| | | ]); |
| | | if(!linkMap.isEmpty()){ |
| | | delete linkMap.values(); |
| | | FROM Account |
| | | WHERE AgentCode_Ext__c = :System.Label.Account_Asset |
| | | ] |
| | | .Id; |
| | | } |
| | | nObj.OlympusAccShareName__c = ''; |
| | | nObj.AccountId = AssetHandler.Account_Asset_Id; |
| | | } |
| | | } else { |
| | | // 更新成 不是备品 的时候, 更新的程序里 要 care AccountId |
| | | nObj.OlympusAccShareName__c = ''; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 动态设定 Asset.AccountId (备品共享_杭州_华东营业本部) |
| | | * Condition: |
| | | * - before insert, before update |
| | | * - 确认字段变化 (保有设备的备品存放地(Internal_asset_location__c)+所在地区(本部)(Salesdepartment__c)) |
| | | * - Salesdepartment__c IN ('1.华北营业本部','2.东北营业本部','3.西北营业本部','4.华东营业本部','5.华南营业本部','6.西南营业本部') |
| | | * - Asset 是 办事处备品 |
| | | * Execute: |
| | | * - 找 Label: OCM_Management_Province_Mapping, 的 办事处, 设定 AccountId |
| | | * - 没有找的话, 不更新AccountId, 自动做 Account, Group, ApexShare |
| | | */ |
| | | private void beforeSetAccountId() { |
| | | Set<String> targetDepts = new Set<String> {'1.华北营业本部','2.东北营业本部','3.西北营业本部','4.华东营业本部','5.华南营业本部','6.西南营业本部'}; |
| | | Set<String> targetCenters = new Set<String> {'北京 备品中心', '上海 备品中心', '广州 备品中心'}; |
| | | if (Test.isRunningTest() && testTargetDepts != null) { |
| | | targetDepts = testTargetDepts; |
| | | } |
| | | // 存放地 → 省 的 Map |
| | | Map<String, String> targetProvs = AssetWebService.getOcmMgtProvMap(); |
| | | // check 是不是 accShareName 都有 |
| | | Set<String> insertAccShareNameSet = new Set<String>(); |
| | | if (assetAccShareNameMap.size() > 0) { |
| | | Map<String, Id> accShareId = new Map<String, Id>(); |
| | | for (Account accShare : [ |
| | | SELECT Id, Department_Name__c |
| | | FROM Account |
| | | WHERE |
| | | RecordTypeId = :System.Label.Department_OTH |
| | | AND Department_Name__c IN :assetAccShareNameMap.values() |
| | | ]) { |
| | | accShareId.put(accShare.Department_Name__c, accShare.Id); |
| | | } |
| | | |
| | | // 收集对象 Asset |
| | | Map<Asset, String> assetAccShareNameMap = new Map<Asset, String>(); |
| | | Datetime execNow = System.now(); |
| | | for (Asset nObj : newList) { |
| | | Asset oObj = (null == this.oldMap) ? null : this.oldMap.get(nObj.Id); |
| | | |
| | | // 作成, 确认字段有没有变化 |
| | | if (Trigger.isInsert |
| | | || (oObj != null |
| | | && (oObj.RecordTypeId != nObj.RecordTypeId |
| | | || oObj.Asset_loaner_category__c != nObj.Asset_loaner_category__c |
| | | || oObj.AssetManageConfirm__c != nObj.AssetManageConfirm__c |
| | | || oObj.Internal_asset_location__c != nObj.Internal_asset_location__c |
| | | || oObj.Salesdepartment__c != nObj.Salesdepartment__c |
| | | || oObj.OlympusAccShareName__c != nObj.OlympusAccShareName__c |
| | | ) |
| | | && (targetCenters.contains(nObj.Internal_asset_location__c) |
| | | || targetProvs.containsKey(nObj.Internal_asset_location__c) |
| | | ) |
| | | && !nObj.TransferToOther__c |
| | | ) |
| | | ) { |
| | | // 是不是备品的确认 |
| | | if (System.Label.Asset_RecordType == nObj.RecordTypeId |
| | | && true == nObj.AssetManageConfirm__c |
| | | && nObj.Asset_loaner_category__c != '耗材' |
| | | ) { |
| | | // 办事处备品 → 动态设定 Asset.AccountId 的対象 |
| | | if (targetProvs.containsKey(nObj.Internal_asset_location__c) |
| | | && targetDepts.contains(nObj.Salesdepartment__c) |
| | | ) { |
| | | String accShareName = '备品共享_' |
| | | + targetProvs.get(nObj.Internal_asset_location__c) + '_' + nObj.Salesdepartment__c.right(6); |
| | | nObj.OlympusAccShareName__c = accShareName; |
| | | assetAccShareNameMap.put(nObj, accShareName); |
| | | } |
| | | else { |
| | | if (AssetHandler.Account_Asset_Id == null) { |
| | | // Static 只会执行一遍 |
| | | AssetHandler.Account_Asset_Id = [SELECT Id FROM Account WHERE AgentCode_Ext__c =: System.Label.Account_Asset].Id; |
| | | } |
| | | nObj.OlympusAccShareName__c = ''; |
| | | nObj.AccountId = AssetHandler.Account_Asset_Id; |
| | | } |
| | | } else { |
| | | // 更新成 不是备品 的时候, 更新的程序里 要 care AccountId |
| | | nObj.OlympusAccShareName__c = ''; |
| | | } |
| | | } |
| | | // assetAccShareNameMap 的 Key会有变化 |
| | | // 这个 for loop后 就不能使用 assetAccShareNameMap.get(XXXX) 了 |
| | | for (Asset nObj : assetAccShareNameMap.keySet()) { |
| | | String accShareName = assetAccShareNameMap.get(nObj); |
| | | if (accShareId.containsKey(accShareName)) { |
| | | // 找到 Account 设定 AccountId, "Olympus社内 其他 备品" => "Olympus社内 其他 备品共享_XXX" |
| | | nObj.AccountId = accShareId.get(accShareName); |
| | | } else { |
| | | // 找不到 AccountId, 新建 Account, Group, ApexShare |
| | | insertAccShareNameSet.add(accShareName); |
| | | } |
| | | } |
| | | } |
| | | if (insertAccShareNameSet.size() > 0) { |
| | | // AssetHandler.futureInsertAccShare(JSON.serialize(insertAccShareNameSet), execNow); |
| | | System.enqueueJob( |
| | | new MyQueueableClass(JSON.serialize(insertAccShareNameSet), execNow) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // check 是不是 accShareName 都有 |
| | | Set<String> insertAccShareNameSet = new Set<String>(); |
| | | if (assetAccShareNameMap.size() > 0) { |
| | | Map<String, Id> accShareId = new Map<String, Id>(); |
| | | for (Account accShare : [SELECT Id |
| | | , Department_Name__c |
| | | FROM Account |
| | | WHERE RecordTypeId =: System.Label.Department_OTH |
| | | AND Department_Name__c IN: assetAccShareNameMap.values()]) { |
| | | accShareId.put(accShare.Department_Name__c, accShare.Id); |
| | | } |
| | | |
| | | // assetAccShareNameMap 的 Key会有变化 |
| | | // 这个 for loop后 就不能使用 assetAccShareNameMap.get(XXXX) 了 |
| | | for (Asset nObj : assetAccShareNameMap.keySet()) { |
| | | String accShareName = assetAccShareNameMap.get(nObj); |
| | | if (accShareId.containsKey(accShareName)) { |
| | | // 找到 Account 设定 AccountId, "Olympus社内 其他 备品" => "Olympus社内 其他 备品共享_XXX" |
| | | nObj.AccountId = accShareId.get(accShareName); |
| | | } |
| | | else { |
| | | // 找不到 AccountId, 新建 Account, Group, ApexShare |
| | | insertAccShareNameSet.add(accShareName); |
| | | } |
| | | } |
| | | } |
| | | if (insertAccShareNameSet.size() > 0) { |
| | | // AssetHandler.futureInsertAccShare(JSON.serialize(insertAccShareNameSet), execNow); |
| | | System.enqueueJob(new MyQueueableClass(JSON.serialize(insertAccShareNameSet), execNow)); |
| | | } |
| | | /** |
| | | * 新建 备品共享_XXX 客户数据 |
| | | * @param insertAccShareNameJson Json String of List<String> ["备品共享_XXX", "备品共享_YYY"] |
| | | */ |
| | | private static void insertAccShare( |
| | | String insertAccShareNameJson, |
| | | Datetime execNow |
| | | ) { |
| | | Set<String> insertAccShareNameSet = (Set<String>) JSON.deserialize( |
| | | insertAccShareNameJson, |
| | | Set<String>.class |
| | | ); |
| | | if (insertAccShareNameSet.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * 新建 备品共享_XXX 客户数据 |
| | | * @param insertAccShareNameJson Json String of List<String> ["备品共享_XXX", "备品共享_YYY"] |
| | | */ |
| | | private static void insertAccShare(String insertAccShareNameJson, Datetime execNow) { |
| | | Set<String> insertAccShareNameSet = (Set<String>) JSON.deserialize(insertAccShareNameJson, Set<String>.class); |
| | | if (insertAccShareNameSet.isEmpty()) { return; } |
| | | |
| | | // Olympus社内 其他 |
| | | List<Account> olympusAccount_OtherDC; |
| | | try { |
| | | olympusAccount_OtherDC = [SELECT Id, ParentId |
| | | FROM Account |
| | | WHERE Parent.AgentCode_Ext__c = '9999999' AND Department_Class_Name__c = '其他' |
| | | FOR Update]; |
| | | } catch (Exception e) { |
| | | System.enqueueJob(new MyQueueableClass(insertAccShareNameJson, execNow)); |
| | | return; |
| | | } |
| | | |
| | | List<Account> isInsertedList = [SELECT Id, Department_Name__c |
| | | FROM Account |
| | | WHERE ParentId =: olympusAccount_OtherDC[0].Id |
| | | AND Department_Name__c IN: insertAccShareNameSet]; |
| | | if (isInsertedList.size() > 0) { |
| | | Map<String, Account> insertedAccount = new Map<String, Account>(); |
| | | for (Account insertedAcc : isInsertedList) { |
| | | insertedAccount.put(insertedAcc.Department_Name__c, insertedAcc); |
| | | insertAccShareNameSet.remove(insertedAcc.Department_Name__c); |
| | | } |
| | | // Update Asset.AccountId |
| | | AssetHandler.updateAssetAccount(insertedAccount, execNow); |
| | | } |
| | | |
| | | |
| | | if (insertAccShareNameSet.size() > 0) { |
| | | Map<String, Account> insertAccount = new Map<String, Account>(); |
| | | for (String accShareName : insertAccShareNameSet) { |
| | | insertAccount.put(accShareName, new Account( |
| | | Name = '*', |
| | | Hospital__c = olympusAccount_OtherDC[0].ParentId, |
| | | ParentId = olympusAccount_OtherDC[0].Id, |
| | | Department_Class__c = olympusAccount_OtherDC[0].Id, |
| | | Other_dept_category__c = '其他科室', |
| | | Department_Name__c = accShareName, |
| | | OwnerId = System.Label.Batch_User_Id, |
| | | RecordTypeId = System.Label.Department_OTH |
| | | )); |
| | | } |
| | | AssetHandler.insertAccGrantShare(insertAccount, execNow); |
| | | } |
| | | // Olympus社内 其他 |
| | | List<Account> olympusAccount_OtherDC; |
| | | try { |
| | | olympusAccount_OtherDC = [ |
| | | SELECT Id, ParentId |
| | | FROM Account |
| | | WHERE |
| | | Parent.AgentCode_Ext__c = '9999999' |
| | | AND Department_Class_Name__c = '其他' |
| | | FOR UPDATE |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.enqueueJob(new MyQueueableClass(insertAccShareNameJson, execNow)); |
| | | return; |
| | | } |
| | | |
| | | private static void insertAccGrantShare(Map<String, Account> insertAccountMap, Datetime execNow) { |
| | | if (insertAccountMap.isEmpty()) { return; } |
| | | Set<String> accShareNameSet = insertAccountMap.keySet(); |
| | | // insert Account的时候, 跳过 NFM001 |
| | | // OLY_OCM-1230 需要执行NFM001Trigger |
| | | // ControllerUtil.EscapeNFM001Trigger = true; |
| | | insert insertAccountMap.values(); |
| | | |
| | | Map<String, Group> insertGroup = new Map<String, Group>(); |
| | | Map<String, Group> groupNameMap = new Map<String, Group>(); |
| | | for (String accShareName : accShareNameSet) { |
| | | insertGroup.put(accShareName, new Group( |
| | | Name = accShareName |
| | | )); |
| | | } |
| | | |
| | | // Check 有没有 Group |
| | | for (Group grp : [SELECT Id, Name FROM Group WHERE Type = 'Regular' AND Name IN: accShareNameSet]) { |
| | | // 已经有Group 的话 不用 insert |
| | | insertGroup.remove(grp.Name); |
| | | groupNameMap.put(grp.Name, grp); |
| | | } |
| | | if (insertGroup.size() > 0) { |
| | | insert insertGroup.values(); |
| | | // groupNameMap 含 所有 accShareNameSet 的 Group, 并且 都有 Id |
| | | groupNameMap.putAll(insertGroup); |
| | | } |
| | | |
| | | // 赋 Account 共享权限 |
| | | List<AccountShare> insertShareList = new List<AccountShare>(); |
| | | for (String accShareName : accShareNameSet) { |
| | | insertShareList.add(new AccountShare( |
| | | UserOrGroupId = groupNameMap.get(accShareName).Id, |
| | | AccountId = insertAccountMap.get(accShareName).Id, |
| | | AccountAccessLevel = 'Edit', |
| | | OpportunityAccessLevel = 'None' |
| | | )); |
| | | } |
| | | insert insertShareList; |
| | | // Update Asset.AccountId |
| | | AssetHandler.updateAssetAccount(insertAccountMap, execNow); |
| | | List<Account> isInsertedList = [ |
| | | SELECT Id, Department_Name__c |
| | | FROM Account |
| | | WHERE |
| | | ParentId = :olympusAccount_OtherDC[0].Id |
| | | AND Department_Name__c IN :insertAccShareNameSet |
| | | ]; |
| | | if (isInsertedList.size() > 0) { |
| | | Map<String, Account> insertedAccount = new Map<String, Account>(); |
| | | for (Account insertedAcc : isInsertedList) { |
| | | insertedAccount.put(insertedAcc.Department_Name__c, insertedAcc); |
| | | insertAccShareNameSet.remove(insertedAcc.Department_Name__c); |
| | | } |
| | | // Update Asset.AccountId |
| | | AssetHandler.updateAssetAccount(insertedAccount, execNow); |
| | | } |
| | | |
| | | private static void updateAssetAccount(Map<String, Account> accShareNameAccountMap, Datetime execNow) { |
| | | if (accShareNameAccountMap.isEmpty()) { return; } |
| | | Set<String> accShareNameSet = accShareNameAccountMap.keySet(); |
| | | if (insertAccShareNameSet.size() > 0) { |
| | | Map<String, Account> insertAccount = new Map<String, Account>(); |
| | | for (String accShareName : insertAccShareNameSet) { |
| | | insertAccount.put( |
| | | accShareName, |
| | | new Account( |
| | | Name = '*', |
| | | Hospital__c = olympusAccount_OtherDC[0].ParentId, |
| | | ParentId = olympusAccount_OtherDC[0].Id, |
| | | Department_Class__c = olympusAccount_OtherDC[0].Id, |
| | | Other_dept_category__c = '其他科室', |
| | | Department_Name__c = accShareName, |
| | | OwnerId = System.Label.Batch_User_Id, |
| | | RecordTypeId = System.Label.Department_OTH |
| | | ) |
| | | ); |
| | | } |
| | | AssetHandler.insertAccGrantShare(insertAccount, execNow); |
| | | } |
| | | } |
| | | |
| | | List<Asset> updAssetAccount = new List<Asset>(); |
| | | for (Asset nObj : [SELECT Id, OlympusAccShareName__c, AccountId |
| | | FROM Asset |
| | | WHERE OlympusAccShareSameFlag__c = '0' |
| | | AND OlympusAccShareName__c IN: accShareNameSet |
| | | AND LastModifiedDate >=: execNow]) { |
| | | nObj.AccountId = accShareNameAccountMap.get(nObj.OlympusAccShareName__c).Id; |
| | | updAssetAccount.add(nObj); |
| | | } |
| | | update updAssetAccount; |
| | | private static void insertAccGrantShare( |
| | | Map<String, Account> insertAccountMap, |
| | | Datetime execNow |
| | | ) { |
| | | if (insertAccountMap.isEmpty()) { |
| | | return; |
| | | } |
| | | Set<String> accShareNameSet = insertAccountMap.keySet(); |
| | | // insert Account的时候, 跳过 NFM001 |
| | | // OLY_OCM-1230 需要执行NFM001Trigger |
| | | // ControllerUtil.EscapeNFM001Trigger = true; |
| | | insert insertAccountMap.values(); |
| | | |
| | | Map<String, Group> insertGroup = new Map<String, Group>(); |
| | | Map<String, Group> groupNameMap = new Map<String, Group>(); |
| | | for (String accShareName : accShareNameSet) { |
| | | insertGroup.put(accShareName, new Group(Name = accShareName)); |
| | | } |
| | | |
| | | @TestVisible |
| | | class MyQueueableClass implements Queueable { |
| | | String insertAccShareNameJson; |
| | | Datetime execNow; |
| | | |
| | | public MyQueueableClass(String insertAccShareNameJson, Datetime execNow) { |
| | | this.insertAccShareNameJson = insertAccShareNameJson; |
| | | this.execNow = execNow; |
| | | } |
| | | |
| | | public void execute(QueueableContext context) { |
| | | AssetHandler.insertAccShare(insertAccShareNameJson, execNow); |
| | | } |
| | | // Check 有没有 Group |
| | | for (Group grp : [ |
| | | SELECT Id, Name |
| | | FROM Group |
| | | WHERE Type = 'Regular' AND Name IN :accShareNameSet |
| | | ]) { |
| | | // 已经有Group 的话 不用 insert |
| | | insertGroup.remove(grp.Name); |
| | | groupNameMap.put(grp.Name, grp); |
| | | } |
| | | } |
| | | if (insertGroup.size() > 0) { |
| | | insert insertGroup.values(); |
| | | // groupNameMap 含 所有 accShareNameSet 的 Group, 并且 都有 Id |
| | | groupNameMap.putAll(insertGroup); |
| | | } |
| | | |
| | | // 赋 Account 共享权限 |
| | | List<AccountShare> insertShareList = new List<AccountShare>(); |
| | | for (String accShareName : accShareNameSet) { |
| | | insertShareList.add( |
| | | new AccountShare( |
| | | UserOrGroupId = groupNameMap.get(accShareName).Id, |
| | | AccountId = insertAccountMap.get(accShareName).Id, |
| | | AccountAccessLevel = 'Edit', |
| | | OpportunityAccessLevel = 'None' |
| | | ) |
| | | ); |
| | | } |
| | | insert insertShareList; |
| | | // Update Asset.AccountId |
| | | AssetHandler.updateAssetAccount(insertAccountMap, execNow); |
| | | } |
| | | |
| | | private static void updateAssetAccount( |
| | | Map<String, Account> accShareNameAccountMap, |
| | | Datetime execNow |
| | | ) { |
| | | if (accShareNameAccountMap.isEmpty()) { |
| | | return; |
| | | } |
| | | Set<String> accShareNameSet = accShareNameAccountMap.keySet(); |
| | | |
| | | List<Asset> updAssetAccount = new List<Asset>(); |
| | | for (Asset nObj : [ |
| | | SELECT Id, OlympusAccShareName__c, AccountId |
| | | FROM Asset |
| | | WHERE |
| | | OlympusAccShareSameFlag__c = '0' |
| | | AND OlympusAccShareName__c IN :accShareNameSet |
| | | AND LastModifiedDate >= :execNow |
| | | ]) { |
| | | nObj.AccountId = accShareNameAccountMap.get(nObj.OlympusAccShareName__c) |
| | | .Id; |
| | | updAssetAccount.add(nObj); |
| | | } |
| | | update updAssetAccount; |
| | | } |
| | | |
| | | @TestVisible |
| | | class MyQueueableClass implements Queueable { |
| | | String insertAccShareNameJson; |
| | | Datetime execNow; |
| | | |
| | | public MyQueueableClass(String insertAccShareNameJson, Datetime execNow) { |
| | | this.insertAccShareNameJson = insertAccShareNameJson; |
| | | this.execNow = execNow; |
| | | } |
| | | |
| | | public void execute(QueueableContext context) { |
| | | AssetHandler.insertAccShare(insertAccShareNameJson, execNow); |
| | | } |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>35.0</apiVersion> |
| | | <apiVersion>50.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | global without sharing class Batch_FixAttachmentToFiles implements Database.Batchable<sObject>{ |
| | | // Id batchJobId = Database.executeBatch(new Batch_FixAttachmentToFiles(Datetime.newInstance(2023, 5, 20, 8, 0, 0),'Consumable_order__c'),2000); |
| | | private Datetime endDate = null; |
| | | private String objectApiName = null; |
| | | public Batch_FixAttachmentToFiles(Datetime setTime,String objectType) { |
| | | endDate = setTime; |
| | | objectApiName = objectType; |
| | | 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'; |
| | | } |
| | | return Database.getQueryLocator(queryObject); |
| | | } |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext BC) { |
| | | String queryObject = 'SELECT Id FROM ' + objectApiName + ' WHERE CreatedDate >=:endDate' + ' order by CreatedDate desc'; |
| | | System.debug('queryObject:' + queryObject); |
| | | return Database.getQueryLocator(queryObject);//取指定Object下面的Id或者处理全部 |
| | | global void execute(Database.BatchableContext BC, List<Attachment> scope) { |
| | | List<ContentVersion> insertContents = new List<ContentVersion>(); |
| | | Map<string, id> nameParentMaps = new Map<string, id>(); |
| | | for (Attachment att : scope) { |
| | | nameParentMaps.put(att.Name, att.ParentId); |
| | | 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.Name; //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); |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, List<sObject> scope) { |
| | | Set<Id> setId = new Set<Id>(); |
| | | for(sObject sc: scope){ |
| | | setId.add(sc.Id); |
| | | } |
| | | List<ContentVersion> insertContents = new List<ContentVersion>(); |
| | | Map<string,id> nameParentMaps = new Map<string,id>(); |
| | | for (Attachment att : [select Id,Name ,OwnerId,ParentId, Body, CreatedById from Attachment where ParentId in: setId Order by Name desc]) { |
| | | nameParentMaps.put(att.name, att.ParentId); |
| | | 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.Name; //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; |
| | | set<Id> contentIds = new set<Id>(); |
| | | for(ContentVersion cv : insertContents){ |
| | | contentIds.add(cv.id); |
| | | } |
| | | List<ContentVersion> conDocuments = [SELECT ContentDocumentId, Title 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.Title); //Add attachment parentId |
| | | cDocLink.ShareType = 'V'; //V - Viewer permission. C - Collaborator permission. I - Inferred permission. |
| | | cDocLink.Visibility = 'AllUsers'; |
| | | insertDocLinks.add(cDocLink); |
| | | } |
| | | Insert insertDocLinks; |
| | | if (insertContents.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | |
| | | insert insertContents; |
| | | set<Id> contentIds = new Set<Id>(); |
| | | for (ContentVersion cv : insertContents) { |
| | | contentIds.add(cv.id); |
| | | } |
| | | } |
| | | List<ContentVersion> conDocuments = [ |
| | | SELECT ContentDocumentId, Title |
| | | 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.Title); //Add attachment parentId |
| | | cDocLink.ShareType = 'V'; //V - Viewer permission. C - Collaborator permission. I - Inferred permission. |
| | | cDocLink.Visibility = 'AllUsers'; |
| | | insertDocLinks.add(cDocLink); |
| | | } |
| | | insert insertDocLinks; |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | } |
| | | } |
| | |
| | | @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; |
| | | } |
| | | |
| | | // テストデータ |
| | | |
| | | 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.newinstance(2022, 11, 30); |
| | | 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(); |
| | | |
| | | 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代理店医院'; |
| | | 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(); |
| | | |
| | | @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; |
| | | } |
| | | |
| | | 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); |
| | | |
| | | // テストデータ |
| | | |
| | | // 初始化测试 |
| | | 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(); |
| | | 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; |
| | | |
| | | 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(); |
| | | 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; |
| | | |
| | | 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(); |
| | | 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 |
| | | ]; |
| | | |
| | | } |
| | | 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(); |
| | | System.assertEquals('責任者', contactlist[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.startTest(); |
| | | controller.tmpAO.MaxActivityDate__c = date.valueOf('2018-02-02'); |
| | | controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-12-12'); |
| | | controller.chick(); |
| | | // |
| | | 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 = 'テスト' |
| | | ]; |
| | | // |
| | | |
| | | 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(); |
| | | Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c(); |
| | | agency_hospital_link.Name = 'test1代理店医院'; |
| | | 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; |
| | | // |
| | | |
| | | } |
| | | 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(); |
| | | //保存时状态changeFlgRt为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(); |
| | | } |
| | | } |
| | | //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); |
| | | |
| | | // 初始化测试 |
| | | 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(); |
| | | //保存时状态changeFlgRt为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(); |
| | | } |
| | | } |
| | |
| | | fieldAPIToLabelMap = new Map<String, String>(); |
| | | layoutSections = new List<LayoutSection>(); |
| | | String theRespBody = getLayoutSchema(recordTypeId, objectType, userMode); |
| | | System.debug('theRespBody = ' + theRespBody); |
| | | Map<String, Object> layoutSection = (Map<String, Object>) JSON.deserializeUntyped( |
| | | theRespBody |
| | | ); |
| | |
| | | req.setHeader('Authorization', 'Bearer ' + UserInfo.getsessionid()); |
| | | } |
| | | Http client = new Http(); |
| | | System.debug('req = ' + req); |
| | | resp = client.send(req); |
| | | system.debug('Schema Body:' + JSON.serialize(resp.getBody())); |
| | | return resp.getBody(); |
| | |
| | | } |
| | | public static Integer ControllerUtil() { |
| | | Integer i = 0; |
| | | |
| | | return i; |
| | | } |
| | | } |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 }; |
| | | |
| | | 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; |
| | | |
| | | //发货明细 |
| | | //到货正确信息 |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 }; |
| | | |
| | | 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; |
| | | |
| | | //发货明细 |
| | | //到货正确信息 |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 |
| | | }; |
| | | |
| | | LexArriveGoodsMainController.init(); |
| | | LexArriveGoodsMainController.searchConsumableorderdetails( |
| | | 'Too001', |
| | | null, |
| | | myAccount1.Id, |
| | | '北京', |
| | | 'ET' |
| | | ); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 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 = '販売店' |
| | | ]; |
| | | 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; |
| | | |
| | | 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 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public with sharing class LexCancelRemoveBoxController { |
| | | //经销商产品分类 |
| | | public static String agencyProType {get;set;} |
| | | public static String userPro_Typestr = null; |
| | | public static String barcode { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; } |
| | | //错误明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; } |
| | | //拆盒明细 |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; } |
| | | public static boolean saveFLGbln {get;set;} |
| | | //错误信息 |
| | | public static String alertMessage {set;get;} |
| | | //拆盒明细件数 |
| | | public static Integer getinventorysize(){ |
| | | return ConsumableorderdetailsRecordsdummy.size(); |
| | | } |
| | | public static Map<String, String> ExistIdMap = new Map<String, String>(); |
| | | public static Map<String, String> ErrorIdMap = new Map<String, String>(); |
| | | public static Map<String, String> AllMap = new Map<String, String>(); |
| | | public static List<String> BarCodeListP = new List<String>(); |
| | | //不符合的barcode和型号 |
| | | public static list<String> notInlist = new list<String>(); |
| | | public static String baseUrl {get;private set;} |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | //public String[] proidList =new String[]{}; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | //经销商产品分类 |
| | | public 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; |
| | | public LexCancelRemoveBoxController() { |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInventory = new List<ConsumableorderdetailsInfo>(); |
| | | saveFLGbln = false; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [ |
| | | SELECT accountid, Work_Location__c, UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId |
| | | ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | List<account> accountInfo = [ |
| | | SELECT Name |
| | | FROM account |
| | | WHERE id = :accountid |
| | | ]; |
| | | //String view_product = accountInfo[0].view_product__c; |
| | | accountName = accountInfo[0].Name; |
| | | //proidList = view_product.split(','); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | 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, '请输入BarCode号', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。')); |
| | | // return; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | // ExistIdMap.clear(); |
| | | // ErrorIdMap.clear(); |
| | | // notInlist.clear(); |
| | | // ConsumableorderdetailsRecordserror.clear(); |
| | | // ConsumableorderdetailsRecordsdummy.clear(); |
| | | |
| | | 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'; |
| | | // 产品类型不同 |
| | | 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); |
| | | } |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid]; |
| | | //String view_product = accountInfo[0].view_product__c; |
| | | accountName = accountInfo[0].Name; |
| | | //proidList = view_product.split(','); |
| | | data.put('accountName',accountName); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | 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 = 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); |
| | | } |
| | | 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, '请输入BarCode号', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。')); |
| | | // 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_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); |
| | | } |
| | | |
| | | // ExistIdMap.clear(); |
| | | // ErrorIdMap.clear(); |
| | | // notInlist.clear(); |
| | | // ConsumableorderdetailsRecordserror.clear(); |
| | | // ConsumableorderdetailsRecordsdummy.clear(); |
| | | |
| | | // 产品类型不同 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c,Product_Type__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | AND (not Product_Type__c like : userPro_Typestr) |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品类型'+ reSet1[i].Product_Type__c +'与产品类型'+ agencyProType +'不符,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //没有拆盒 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | //AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,在库,没有拆盒 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品没有拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已出货,未到货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = FALSE |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品还未到货'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒已出货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Shipment__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在出货履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒已销售 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Saled__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在销售履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒返品 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Returned__c = true |
| | | AND Return_date__c != null |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在返品履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //拆盒后盘点过(盘点日期不为空) |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Inventory_date__c != null |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品存在盘点履历'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //不同工作地 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c !=: userWorkLocation |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品属于' + reSet1[i].Arrive_Owner_Work_Location__c + ',不能取消拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet = [SELECT Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__c, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Dealer_Arrive__c, |
| | | Guarantee_period_for_products__c, |
| | | CFDA_Status__c, |
| | | ProductPacking_list_manual__c, |
| | | Report_Product_Approbation__c, |
| | | Report_Product_Expiration__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != null |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | if(reSet.size()>0){ |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过错误的消耗品明细 |
| | | continue; |
| | | } |
| | | else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } |
| | | else{ |
| | | ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i])); |
| | | ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | AllMap.putAll(ExistIdMap); |
| | | |
| | | //得到不存在的BarCode |
| | | for(Integer i = 0; i < BarCodeListP.size(); i++){ |
| | | if(ExistIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else if(ErrorIdMap.containsKey(BarCodeListP[i])){ |
| | | continue; |
| | | }else{ |
| | | notInlist.add(BarCodeListP[i]); |
| | | } |
| | | } |
| | | if(notInlist.size()>0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。')); |
| | | return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在。', ''); |
| | | } |
| | | data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy)); |
| | | data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror)); |
| | | data.put('dataSize',ConsumableorderdetailsRecordsdummy.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | } |
| | | |
| | | //取消拆盒确认 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC cancelRemoveBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | accountName = accountName; |
| | | userWorkLocation =userWorkLocation; |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class); |
| | | |
| | | |
| | | List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>(); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | if(ConsumableorderdetailsRecordsdummy.size()<1){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在取消拆盒明细')); |
| | | return new ResponseBodyLWC('Error',500, '不存在取消拆盒明细', ''); |
| | | // return null; |
| | | //拆盒已出货 |
| | | 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); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //拆盒已销售 |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | //拆盒返品 |
| | | 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); |
| | | } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | } |
| | | } |
| | | |
| | | //拆盒后盘点过(盘点日期不为空) |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Inventory_date__c != NULL |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != NULL |
| | | AND Bar_Code__c IN :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品存在盘点履历'; |
| | | ConsumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | /* |
| | | } |
| | | } |
| | | |
| | | //不同工作地 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Bar_Code__c IN :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = |
| | | '该商品属于' + |
| | | reSet1[i].Arrive_Owner_Work_Location__c + |
| | | ',不能取消拆盒'; |
| | | ConsumableorderdetailsRecordserror.add( |
| | | new ConsumableorderdetailsInfo(reSet1[i], str) |
| | | ); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__c, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Dealer_Arrive__c, |
| | | Guarantee_period_for_products__c, |
| | | CFDA_Status__c, |
| | | ProductPacking_list_manual__c, |
| | | Report_Product_Approbation__c, |
| | | Report_Product_Expiration__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != NULL |
| | | AND Bar_Code__c IN :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Product_Type__c LIKE :userPro_Typestr |
| | | ]; |
| | | if (reSet.size() > 0) { |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | if (ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) { |
| | | // 跳过错误的消耗品明细 |
| | | continue; |
| | | } else if (ExistIdMap.containsKey(reSet[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | ConsumableorderdetailsRecordsdummy.add( |
| | | new ConsumableorderdetailsInfo(reSet[i]) |
| | | ); |
| | | ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | AllMap.putAll(ExistIdMap); |
| | | |
| | | //得到不存在的BarCode |
| | | for (Integer i = 0; i < BarCodeListP.size(); i++) { |
| | | if (ExistIdMap.containsKey(BarCodeListP[i])) { |
| | | continue; |
| | | } else if (ErrorIdMap.containsKey(BarCodeListP[i])) { |
| | | continue; |
| | | } else { |
| | | notInlist.add(BarCodeListP[i]); |
| | | } |
| | | } |
| | | if (notInlist.size() > 0) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | 'BarCode' + notInlist + '不存在。', |
| | | '' |
| | | ); |
| | | } |
| | | data.put( |
| | | 'ConsumableorderdetailsRecordsdummy', |
| | | JSON.serialize(ConsumableorderdetailsRecordsdummy) |
| | | ); |
| | | data.put( |
| | | 'ConsumableorderdetailsRecordserror', |
| | | JSON.serialize(ConsumableorderdetailsRecordserror) |
| | | ); |
| | | data.put('dataSize', ConsumableorderdetailsRecordsdummy.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //取消拆盒确认 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC cancelRemoveBoxConfirm( |
| | | String saveConsumableorderdetailsRecordsdummy, |
| | | String accountName, |
| | | String userWorkLocation, |
| | | String agencyProType |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | userPro_Typestr = '%' + agencyProType + '%'; |
| | | accountName = accountName; |
| | | userWorkLocation = userWorkLocation; |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | saveConsumableorderdetailsRecordsdummy, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | |
| | | List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>(); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | if (ConsumableorderdetailsRecordsdummy.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在取消拆盒明细')); |
| | | return new ResponseBodyLWC('Error', 500, '不存在取消拆盒明细', ''); |
| | | // return null; |
| | | } |
| | | |
| | | List<String> BarCodeList = new List<String>(); |
| | | for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) { |
| | | BarCodeList.add(tmp.esd.Bar_Code__c); |
| | | } |
| | | |
| | | try { |
| | | //取得通番大于001的在库明细 |
| | | List<Consumable_order_details2__c> orderDetails2del = [ |
| | | SELECT |
| | | Id, |
| | | Box_Piece__c, |
| | | RemoveBox_date__c, |
| | | RemoveBox_No__c, |
| | | Bar_Code__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != NULL |
| | | AND RemoveBox_No__c > 1 |
| | | AND Bar_Code__c IN :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Product_Type__c LIKE :userPro_Typestr |
| | | ]; |
| | | |
| | | List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> orderlistupd = new List<Consumable_order_details2__c>(); |
| | | |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2del) { |
| | | Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c(); |
| | | delDetails2.Id = detail2tmp.Id; |
| | | |
| | | //删除通番大于001的明细2 |
| | | //delete delDetails2; |
| | | orderlistdel.add(delDetails2); |
| | | } |
| | | |
| | | //取得通番001的在库明细 |
| | | List<Consumable_order_details2__c> orderDetails2 = [ |
| | | SELECT |
| | | Id, |
| | | Box_Piece__c, |
| | | RemoveBox_date__c, |
| | | RemoveBox_No__c, |
| | | Bar_Code__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c, |
| | | /*,ContractNo__c*/ |
| | | //add by rebtx 2020-10-13 end |
| | | // tcm start |
| | | Consumable_order_minor__r.ContractNo__c |
| | | // tcm end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Box_Piece__c = '个' |
| | | AND RemoveBox_date__c != NULL |
| | | AND RemoveBox_No__c = 1 |
| | | AND Bar_Code__c IN :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Product_Type__c LIKE :userPro_Typestr |
| | | ]; |
| | | |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2) { |
| | | Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c(); |
| | | updDetails2.Id = detail2tmp.Id; |
| | | updDetails2.Box_Piece__c = '盒'; |
| | | updDetails2.RemoveBox_date__c = null; |
| | | updDetails2.RemoveBox_No__c = null; |
| | | |
| | | // tcm start |
| | | if ( |
| | | String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c) |
| | | ) { |
| | | updDetails2.ContractNo_text__c = detail2tmp.ContractNo_text__c; |
| | | } else { |
| | | updDetails2.ContractNo_text__c = detail2tmp.Consumable_order_minor__r.ContractNo__c; |
| | | } |
| | | // updDetails2.ContractNo_text__c = detail2tmp.ContractNo__c; |
| | | // tcm end |
| | | |
| | | //通番001のデータの管理単位を盒に戻し、通番をクリア |
| | | //update updDetails2; |
| | | orderlistupd.add(updDetails2); |
| | | } |
| | | |
| | | if (orderlistdel.size() > 0) { |
| | | delete orderlistdel; |
| | | } |
| | | |
| | | if (orderlistupd.size() > 0) { |
| | | update orderlistupd; |
| | | } |
| | | saveFLGbln = true; |
| | | alertMessage = '取消拆盒完成'; |
| | | data.put('saveFLGbln', saveFLGbln); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = alertMessage; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // return null; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @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; |
| | |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | */ |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 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>(); |
| | | |
| | | //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 = '販売店' |
| | | ]; |
| | | 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 = '販売店' |
| | | ]; |
| | | 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 = '販売店' |
| | | ]; |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 = '販売店' |
| | | ]; |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | 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 getdone() { |
| | | return (invoiceOrderdetail1Recoeds.size() > 0); |
| | | } |
| | | |
| | | public static Boolean getExistOutbound() { |
| | | return (coc.Outbound_order__c != null); |
| | | } |
| | | |
| | | public static String getInvoiceName() { |
| | | return (coc.Name); |
| | | } |
| | | public static List<Consumable_Orderdetails__c> conoList { get; set; } |
| | | |
| | | public static String shipmentAccount { |
| | | get { |
| | | return (coc.ShipmentAccount__c); |
| | | } |
| | | } |
| | | public static String statusEdit = ''; |
| | | public static Boolean editAble { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderRecoeds { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderdetail1Recoeds { get; set; } |
| | | public static List<InvoiceOrderInfo> invoiceOrderRecoedschange { get; set; } |
| | | public static List<InvoiceOrderInfo> attachmentRecoeds { get; set; } |
| | | public static List<Consumable_order__c> invoiceOrderList { get; set; } |
| | | public static List<Consumable_order__c> invoiceOrderSelectedList { get; set; } |
| | | public static Map<String, Decimal> ordermx1defaultMap { get; set; } |
| | | public static Map<String, Decimal> outorderMoneytMap { get; set; } |
| | | public static Map<String, Consumable_Orderdetails__c> outordercountMap { |
| | | get; |
| | | set; |
| | | } |
| | | public static List<String> outOrderStringList { get; set; } |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | public static Map<String, String> provinceOptsMap { get; set; } |
| | | public static String SecondDealer { get; set; } |
| | | public static String HospitalInfo { get; set; } |
| | | public static String HospitalName { get; set; } |
| | | |
| | | public static Boolean getExistOutbound() { |
| | | return (coc.Outbound_order__c != null); |
| | | public static Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size(); |
| | | } |
| | | } |
| | | |
| | | public static String getInvoiceName() { |
| | | return (coc.Name); |
| | | 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 List<Consumable_Orderdetails__c> conoList { get; set; } |
| | | 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 String shipmentAccount { |
| | | get { |
| | | return (coc.ShipmentAccount__c); |
| | | Dealerelationship = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__c = :accountid |
| | | ]; |
| | | List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>(); |
| | | AgencyHospitalLink = [ |
| | | SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId |
| | | ]; |
| | | // 新規 |
| | | if (invoiceId == null || invoiceId == '') { |
| | | if (deliveryId == null || deliveryId == '') { |
| | | String msoql = makeSoql(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | } |
| | | } |
| | | 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(); |
| | | } else { |
| | | if (statusEdit == '' || statusEdit == null) { |
| | | EditAble = false; |
| | | } else if (statusEdit != '' && statusEdit != null) { |
| | | EditAble = true; |
| | | } |
| | | } |
| | | |
| | | 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 = [ |
| | | 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 |
| | | ]; |
| | | 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 |
| | | 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 |
| | | ]; |
| | | // 新規 |
| | | if (invoiceId == null || invoiceId == '') { |
| | | if (deliveryId == null || deliveryId == '') { |
| | | String msoql = makeSoql(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | } |
| | | } else { |
| | | if (statusEdit == '' || statusEdit == null) { |
| | | EditAble = false; |
| | | } else if (statusEdit != '' && statusEdit != null) { |
| | | EditAble = true; |
| | | } |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_ForHospital__r.Name, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId |
| | | ]; |
| | | coc.Name = ''; |
| | | if (coc.Order_ForDealer__c != null) { |
| | | SecondDealer = coc.Order_ForDealer__c; |
| | | } |
| | | 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 (coc.Order_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | 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 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //发票关联出库单取得(出库单) |
| | | 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])); |
| | | } |
| | | 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 { |
| | | 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 = '发票' |
| | | 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 (coc.Order_ForDealer__c != null) { |
| | | SecondDealer = coc.Order_ForDealer__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_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | 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; |
| | | } |
| | | //到链接表中查找关联出库单 |
| | | List<Consumable_order_LinkTable__c> outOrderList = [ |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | ]; |
| | | 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); |
| | | } |
| | | ) |
| | | 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 { |
| | | 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); |
| | | } |
| | | 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; |
| | | } |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, String> consumableaccessoriesMap = new Map<String, String>(); |
| | | Map<String, String> invorceOrderIdMap = new Map<String, String>(); |
| | | List<Consumable_accessories_invoice__c> consumableaccessories = [ |
| | | SELECT Id, Name, Attachment_ID__c, Accessories_type__c |
| | | FROM Consumable_accessories_invoice__c |
| | | WHERE Invoice_code__c = :invoiceId |
| | | ]; |
| | | System.debug('consumableaccessories = ' + consumableaccessories); |
| | | if (consumableaccessories.size() > 0) { |
| | | for (Integer i = 0; i < consumableaccessories.size(); i++) { |
| | | consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c); |
| | | invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id); |
| | | } |
| | | } |
| | | |
| | | //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) { |
| | | ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id); |
| | | ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id); |
| | | } |
| | | } |
| | | data.put('EditAble', EditAble); |
| | | data.put('isChange', isChange); |
| | | data.put('coc', coc); |
| | | data.put('ExistOutbound', getExistOutbound()); |
| | | data.put('invoiceOrderRecoeds', invoiceOrderRecoeds); |
| | | data.put('provinceOptsMap', provinceOptsMap); |
| | | data.put('HospitalName', HospitalName); |
| | | data.put('HospitalInfo', HospitalInfo); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('done', getdone()); |
| | | data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds); |
| | | data.put('accountid', accountid); |
| | | data.put('invoiceOrderRecoedschange',invoiceOrderRecoedschange); |
| | | data.put('attachmentRecoeds',attachmentRecoeds); |
| | | data.put('outOrderStringList',outOrderStringList); |
| | | data.put('outordercountMap',outordercountMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | //保存 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save( |
| | | Consumable_order__c cocLwc, |
| | | String HospitalNameLwc, |
| | | String HospitalInfoLwc, |
| | | String SecondDealerLwc, |
| | | String invoiceOrderRecoedsLwc, |
| | | String deliveryIdLwc, |
| | | String invoiceIdLwc, |
| | | String accountidLwc, |
| | | String agencyProTypeLwc, |
| | | String reopenLwc, |
| | | String invoiceOrderRecoedschangeLwc |
| | | ) { |
| | | System.debug('enter LexConInvoiceViewController.save success'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalName = HospitalNameLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | System.debug('HospitalInfo = ' + HospitalInfo); |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | deliveryId = deliveryIdLwc; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | reopen = reopenLwc; |
| | | invoiceOrderRecoedschange = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class); |
| | | |
| | | List<String> chukudanID = new List<String>(); |
| | | if (coc.Name == '' || coc.Name == null) { |
| | | // coc.Name.addError('请录入发票号'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票号', ''); |
| | | } |
| | | if (coc.Invoice_Date__c == null) { |
| | | // coc.Invoice_Date__c.addError('请录入发票日期'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票日期', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) { |
| | | // coc.addError('必须输入客户名或者二级经销商'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入客户名或者二级经销商', ''); |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) { |
| | | //coc.addError('请输入客户名、二级经销商只可输入一个'); |
| | | errorMsg += '请输入客户名、二级经销商只可输入一个'; |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (coc.Order_ForCustomerText__c == null) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else { |
| | | if (coc.Order_ForCustomerText__c != null) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | } |
| | | String shipmentAccountString = ''; |
| | | if (HospitalInfo != null) { |
| | | shipmentAccountString = HospitalInfo; |
| | | } else if (String.isNotEmpty(SecondDealer)) { |
| | | shipmentAccountString = SecondDealer; |
| | | } else { |
| | | shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c; |
| | | } |
| | | |
| | | Integer x = 0; |
| | | List<String> invoiceOrderAccountList = new List<String>(); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (String.isBlank(deliveryId)) { |
| | | if (ass.check == true) { |
| | | x++; |
| | | System.debug(shipmentAccountString); |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (ass.esd.Order_ForHospital__c != shipmentAccountString) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | if ( |
| | | ass.esd.Order_ForDealer__c != shipmentAccountString && |
| | | ass.esd.Order_ForDealerText__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) { |
| | | if ( |
| | | (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') && |
| | | ass.esd.ShipmentAccount__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | 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 { |
| | | 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); |
| | | } |
| | | } |
| | | outOrderIdList.add(ass.esd.Id); |
| | | deleteDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } |
| | | // 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, '请选择需要开发票的出库单!', ''); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | Consumable_order__c invoiceHead = new Consumable_order__c(); |
| | | List<String> outOrderIdList = new List<String>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Map<String, String> insertDetMap = new Map<String, String>(); |
| | | Map<String, String> deleteDetMap = new Map<String, String>(); |
| | | //新建发票时 |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | if (String.isBlank(invoiceId)) { |
| | | invoiceHead.Name = coc.Name; |
| | | if (coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c)) |
| | | coc.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_type__c = '发票'; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //if (deliveryId != null) { |
| | | if (String.isNotBlank(deliveryId)) { |
| | | invoiceHead.Outbound_order__c = deliveryId; |
| | | } |
| | | invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | // if (SecondDealer == null) { |
| | | if (String.isBlank(SecondDealer)) { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | |
| | | insert invoiceHead; |
| | | |
| | | invoiceId = invoiceHead.Id; |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | invoiceHead = cocinfo[0]; |
| | | } |
| | | if (!String.isBlank(deliveryId)) { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } else { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (!String.isBlank(deliveryId)) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | if (ass.check == true) { |
| | | chukudanID.add(ass.esd.Id); |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | //deleteDetMap.put(ass.esd.Id,invoiceHead.Id); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'deleteDetMap +++++' + deleteDetMap.size())); |
| | | //return null; |
| | | if (insertDetMap.size() > 0) { |
| | | for (String field : insertDetMap.keySet()) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :field AND Invoice_Code_link__c = :insertDetMap.get(field) |
| | | ]; |
| | | if (existLinkinfo.size() < 1) { |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | upsert invoiceLinkList; |
| | | } |
| | | } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) { |
| | | System.debug('进入reopen'); |
| | | invoiceHead.Name = coc.Name; |
| | | invoiceHead.Order_type__c = '发票'; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //if (deliveryId != null) { |
| | | if (String.isNotBlank(deliveryId)) { |
| | | invoiceHead.Outbound_order__c = deliveryId; |
| | | } |
| | | invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | //if (SecondDealer == null) { |
| | | if (String.isBlank(SecondDealer)) { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | insert invoiceHead; |
| | | System.debug('invoiceHead = ' + invoiceHead); |
| | | |
| | | List<String> updateChukudanId = new List<String>(); |
| | | //获取原发票相关联的链接表信息 |
| | | List<Consumable_order_LinkTable__c> tLinkList = [ |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ]; |
| | | |
| | | for (Consumable_order_LinkTable__c colc : tLinkList) { |
| | | colc.Invoice_Code_link__c = invoiceHead.Id; |
| | | updateChukudanId.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | System.debug('tLinkList = ' + tLinkList); |
| | | update tLinkList; |
| | | //更新发票明细信息 |
| | | //获取出库单,设置关联关系 |
| | | //获取出库单明细信息,因为出库单信息和出库单明细信息是关联的,所有只需要回滚出库单明细信息即可 |
| | | |
| | | Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> tempCountList = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoicedet1_OD_link__c, |
| | | InvoicedProduct_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_BoxCount__c, |
| | | Invoice_Unit__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | for (Consumable_Orderdetails__c cocTemp : tempCountList) { |
| | | cocTemp.Consumable_order__c = invoiceHead.Id; |
| | | tempCocMap.put(cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c, cocTemp); |
| | | } |
| | | System.debug('tempCountList = ' + tempCountList); |
| | | update tempCountList; |
| | | List<Consumable_Orderdetails__c> updateFromList = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_order__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoice_Unitprice__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | Consumable_order__r.Invoice_total_amount__c, |
| | | ProductPacking_list_manual__c, |
| | | InvoicedProduct_RMB__c, |
| | | Invoiced_BoxCount__c, |
| | | Shipment_amount__c, |
| | | Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :updateChukudanId |
| | | ]; |
| | | for (Consumable_Orderdetails__c corderc : updateFromList) { |
| | | String tempStr = corderc.Consumable_order__c + corderc.Asset_Model_No__c; |
| | | if (tempCocMap.get(tempStr) != null) { |
| | | //设置已发票金额 出库单的已发票金额 - 发票的发票金额 |
| | | corderc.InvoicedProCost_RMB__c = corderc.InvoicedProCost_RMB__c - tempCocMap.get(tempStr).InvoicedProduct_RMB__c; |
| | | //设置已发票数量 出库单的已发票数量 - 发票的发票数量(盒) |
| | | corderc.Invoiced_Procount__c = corderc.Invoiced_Procount__c - tempCocMap.get(tempStr).Invoiced_BoxCount__c; |
| | | //设置发票单价 |
| | | if (corderc.Box_Piece__c == '盒' && corderc.Invoice_Unit__c == '个') { |
| | | corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c / corderc.ProductPacking_list_manual__c; |
| | | } else { |
| | | corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Consumable_order__c tempcoc = new Consumable_order__c(); |
| | | tempcoc.Id = invoiceId; |
| | | System.debug('tempcoc = ' + tempcoc); |
| | | delete tempcoc; |
| | | invoiceId = invoiceHead.Id; |
| | | System.debug('updateFromList = ' + updateFromList); |
| | | update updateFromList; |
| | | //-------------------------------------------------------------------------- |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | outOrderIdList.add(ass.esd.Id); |
| | | deleteDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } |
| | | if (outOrderIdList.size() > 0) { |
| | | getdefaultMapinfo(outOrderIdList); |
| | | } |
| | | //被选中的出库单集合 |
| | | if (insertDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | //存在没有与发票建立关联关系的出库单 |
| | | List<String> templist2 = new List<String>(); |
| | | for (Consumable_order_LinkTable__c colc : existLinkinfo) { |
| | | templist2.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | //获取该出库单 |
| | | for (String field : insertDetMap.keySet()) { |
| | | if (!templist2.contains(field)) { |
| | | //该出库单不存在与链接表中,新建链接 |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkList = ' + invoiceLinkList); |
| | | upsert invoiceLinkList; |
| | | } |
| | | //删除出库单链接表 |
| | | if (deleteDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>(); |
| | | deleteOutboundorder(deleteDetMap, invoiceHead.Id); |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | for (Consumable_order_LinkTable__c colctemp : existLinkinfo) { |
| | | if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) { |
| | | //存在与该发票关联的出库单 |
| | | invoiceLinkdetList.add(colctemp); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkdetList = ' + invoiceLinkdetList); |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | } else { |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-04 end |
| | | //编辑后保存 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | invoiceHead = cocinfo[0]; |
| | | } |
| | | if (String.isNotBlank(deliveryId)) { |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | |
| | | //换货单产品数量 |
| | | Map<String, Decimal> needchangeOrderProcountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> returnProcountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> changeOrderProcountMap = new Map<String, Decimal>(); |
| | | List<Consumable_Orderdetails__c> detaliFromList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Invoice_Cost_RMB__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :deliveryId |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : detaliFromList) { |
| | | needchangeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c); |
| | | } |
| | | //发票返品信息 |
| | | List<Consumable_Orderdetails__c> returnCountList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | |
| | | for (Consumable_Orderdetails__c changeOD : returnCountList) { |
| | | if (changeOD.RrturnPro_count__c > 0) { |
| | | if (returnProcountMap.containsKey(changeOD.Asset_Model_No__c)) { |
| | | returnProcountMap.put( |
| | | changeOD.Asset_Model_No__c, |
| | | returnProcountMap.get(changeOD.Asset_Model_No__c) + changeOD.RrturnPro_count__c |
| | | ); |
| | | } else { |
| | | returnProcountMap.put(changeOD.Asset_Model_No__c, changeOD.RrturnPro_count__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已换货单出库数量信息 |
| | | List<Consumable_Orderdetails__c> returnCount1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | Consumable_order__c IN ( |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ) |
| | | AND Consumable_order__r.Onchange_order__c = TRUE |
| | | AND Consumable_order__c != :deliveryId |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : returnCount1List) { |
| | | changeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c); |
| | | } |
| | | outOrderchange(insertDetMap); |
| | | } else { |
| | | invoiceHead.Name = coc.Name; |
| | | invoiceHead.Invoice_status__c = coc.Invoice_status__c; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'HospitalName +++++' + HospitalName)); |
| | | //return null; |
| | | if (HospitalName != null && HospitalName != '') { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForHospital__c = null; |
| | | } |
| | | invoiceHead.Order_ForDealer__c = SecondDealer == '' ? null : SecondDealer; |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | update invoiceHead; |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | insertDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } else { |
| | | outOrderIdList.add(ass.esd.Id); |
| | | deleteDetMap.put(ass.esd.Id, invoiceHead.Id); |
| | | } |
| | | } |
| | | if (outOrderIdList.size() > 0) { |
| | | getdefaultMapinfo(outOrderIdList); |
| | | } |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-08 start |
| | | //被选中的出库单集合 |
| | | if (insertDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | //存在没有与发票建立关联关系的出库单 |
| | | List<String> templist2 = new List<String>(); |
| | | for (Consumable_order_LinkTable__c colc : existLinkinfo) { |
| | | templist2.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | //获取该出库单 |
| | | for (String field : insertDetMap.keySet()) { |
| | | if (!templist2.contains(field)) { |
| | | //该出库单不存在与链接表中,新建链接 |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | upsert invoiceLinkList; |
| | | } |
| | | if (deleteDetMap.size() > 0) { |
| | | List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>(); |
| | | deleteOutboundorder(deleteDetMap, invoiceHead.Id); |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id |
| | | ]; |
| | | for (Consumable_order_LinkTable__c colctemp : existLinkinfo) { |
| | | if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) { |
| | | //存在与该发票关联的出库单 |
| | | invoiceLinkdetList.add(colctemp); |
| | | } |
| | | } |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(ex); |
| | | // return null; |
| | | System.debug('Exception ex = ' + ex.getMessage() + ex.getLineNumber()); |
| | | errorMsg += ex.getMessage() + ex.getLineNumber(); |
| | | } |
| | | data.put('invoiceId', invoiceId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void newinvoicedetails1(List<String> chukudanID) { |
| | | //新规发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>(); |
| | | //出库单明细更新 |
| | | List<Consumable_Orderdetails__c> outOrderList1 = new List<Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> detaliFromList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Consumable_Product__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Dealer_Custom_Price__c, |
| | | Sum_of_money__c, |
| | | Box_Piece__c, |
| | | Used_date__c, |
| | | Send_date__c, |
| | | Invoice_Unit__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :chukudanID AND InvoiceProNot_count__c > 0 |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < detaliFromList.size(); i++) { |
| | | Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c(); |
| | | invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c; |
| | | invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c; |
| | | String str = string.valueOf(i + 1); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | invoiceInsert1.Name = |
| | | coc.Name + |
| | | '-' + |
| | | detaliFromList[i].Name.substring(detaliFromList[i].Name.length() - 7, detaliFromList[i].Name.length()); |
| | | invoiceInsert1.Shipment_Count__c = detaliFromList[i].InvoiceProNot_count__c; |
| | | invoiceInsert1.Consumable_Product__c = detaliFromList[i].Consumable_Product__c; |
| | | invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i].Intra_Trade_List_RMB__c; |
| | | invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i].Delivery_List_RMB__c; |
| | | invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i].Dealer_Custom_Price__c; |
| | | invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | |
| | | if (detaliFromList[i].Box_Piece__c == '盒' && detaliFromList[i].Invoice_Unit__c == '个') { |
| | | invoiceInsert1.Invoice_Unitprice__c = |
| | | detaliFromList[i].Delivery_List_RMB__c / detaliFromList[i].ProductPacking_list_manual__c; |
| | | } else { |
| | | invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i].Delivery_List_RMB__c; |
| | | } |
| | | invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c; |
| | | invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c; |
| | | if (detaliFromList[i].Invoiced_Procount__c == null) |
| | | detaliFromList[i].Invoiced_Procount__c = 0; |
| | | if (detaliFromList[i].RrturnPro_count__c == null) |
| | | detaliFromList[i].RrturnPro_count__c = 0; |
| | | invoiceInsert1.Invoiced_Count__c = detaliFromList[i].InvoiceProNot_count__c; |
| | | if (detaliFromList[i].InvoicedProCost_RMB__c == null) |
| | | detaliFromList[i].InvoicedProCost_RMB__c = 0; |
| | | invoiceInsert1.InvoicedProCost_RMB__c = invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c; |
| | | invoiceInsert1.Consumable_order__c = invoiceId; |
| | | invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i].Consumable_order__c; |
| | | invoiceorderList1.add(invoiceInsert1); |
| | | } |
| | | System.debug('invoiceorderList1 +++++' + invoiceorderList1.size()); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | if (invoiceorderList1.size() > 0) { |
| | | try { |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | insert invoiceorderList1; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | //ApexPages.addMessages(ex); |
| | | errorMsg += ex.getMessage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void getdefaultMapinfo(List<String> orderIdList) { |
| | | List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>(); |
| | | existLinkinfo = [ |
| | | SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :orderIdList |
| | | ]; |
| | | // for (Integer i = 0; i < existLinkinfo.size(); i++) { |
| | | // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0); |
| | | // } |
| | | } |
| | | |
| | | public static void deleteOutboundorder(Map<String, String> deleteMap, String value) { |
| | | //删除发票明细1 |
| | | List<Consumable_Orderdetails__c> detInvoicedet1List = [ |
| | | SELECT Id, Consumable_Shipment_order__c, Consumable_Sale_order__c, Consumable_product__c, Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet() |
| | | ]; |
| | | System.debug('detInvoicedet1List = ' + detInvoicedet1List); |
| | | delete detInvoicedet1List; |
| | | } |
| | | |
| | | //换货单链接表 发票明细2做成 |
| | | public static void outOrderchange(Map<String, String> insertDetMap) { |
| | | List<string> chukudanID = new List<string>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | if (insertDetMap.size() > 0) { |
| | | //获取该出库单 |
| | | for (String field : insertDetMap.keySet()) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :field |
| | | ]; |
| | | if (existLinkinfo.size() > 0) { |
| | | delete existLinkinfo; |
| | | } |
| | | 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); |
| | | p.Id = field; |
| | | p.ConInvoice_Code__c = insertDetMap.get(field); |
| | | p.Onchange_order__c = true; |
| | | update p; |
| | | } |
| | | } |
| | | insert invoiceLinkList; |
| | | } |
| | | //换货出库单明细1更新 |
| | | List<Consumable_Orderdetails__c> detaliFrom1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Consumable_Sale_order__r.Name, |
| | | Consumable_Shipment_order__r.Name |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :chukudanID |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : detaliFrom1List) { |
| | | changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c; |
| | | } |
| | | update detaliFrom1List; |
| | | } |
| | | |
| | | //上传ContentVersion附件 |
| | | @AuraEnabled |
| | | public static String saveFile(Id recordId, String fileName, String base64Data) { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = recordId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | System.debug('cv.Id = ' + cv.Id); |
| | | return cv.Id; |
| | | } |
| | | |
| | | // 保存附件 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC saveAttachment(String attachmentRecoedsLwc,String invoiceId) { |
| | | System.debug('进入 saveAttachment'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | invoiceId = invoiceId; |
| | | attachmentRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(attachmentRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | try { |
| | | Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c(); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (!String.isBlank(ass.mailSelectOptsin)) { |
| | | attachmentdetails.Id = ass.invoiceOrderId; |
| | | attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId; |
| | | attachmentdetails.Accessories_type__c = ass.mailSelectOptsin; |
| | | if (String.isBlank(ass.invoiceOrderId)) { |
| | | attachmentdetails.Invoice_code__c = invoiceId; |
| | | } |
| | | upsert attachmentdetails; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 检索(未开发票出库单) |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC InvoiceorderSearch(Consumable_order__c cocLwc,String invoiceIdLwc,String accountidLwc,String userWorkLocationLwc,String agencyProTypeLwc,String HospitalInfoLwc,String SecondDealerLwc,String invoiceOrderRecoedsLwc) { |
| | | System.debug('进入 InvoiceorderSearch'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | |
| | | Map<String, String> invoiceOrderMap = new Map<String, String>(); |
| | | String msoql = ''; |
| | | List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>(); |
| | | if (String.isBlank(invoiceId)) { |
| | | msoql = makeSoql(); |
| | | } else { |
| | | msoql = makeSoqlInit(); |
| | | } |
| | | invoiceOrderList = new List<Consumable_order__c>(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | invoiceOrderdetailMid.add(ass); |
| | | invoiceOrderMap.put(ass.esd.Name, ass.esd.Name); |
| | | } |
| | | } |
| | | invoiceOrderRecoeds = new List<InvoiceOrderInfo>(); |
| | | invoiceOrderRecoeds.addAll(invoiceOrderdetailMid); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) { |
| | | } else { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name); |
| | | } |
| | | } |
| | | data.put('invoiceOrderRecoeds',invoiceOrderRecoeds); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND Billed_Status__c != \'全部开票\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\''; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | private static String makeSoqlInit() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\' '; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (SecondDealer != null) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | // 删除按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC deleteButton(String invoiceIdLwc,Consumable_order__c cocLwc) { |
| | | System.debug('进入 deleteButton'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | system.debug('====invoiceId==========>' + invoiceId); |
| | | List<Consumable_Orderdetails__c> consList = [ |
| | | SELECT id, Consumable_order__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | try { |
| | | system.debug('====cons==========>' + consList); |
| | | delete consList; |
| | | if (coc.id == invoiceId && coc.Invoice_status__c == '草案中') { |
| | | delete coc; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | // 提交按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC approval(List<String> outOrderStringListLwc,Map<String, Consumable_Orderdetails__c> outordercountMapLwc,String invoiceIdLwc) { |
| | | System.debug('进入 approval'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | outOrderStringList = outOrderStringListLwc; |
| | | outordercountMap = outordercountMapLwc; |
| | | invoiceId= invoiceIdLwc; |
| | | //更新发票明细2链接 |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>(); |
| | | //更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>(); |
| | | //需要更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdet1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_order__r.Name, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :outOrderStringList |
| | | ]; |
| | | for (Integer i = 0; i < outOrderdet1List.size(); i++) { |
| | | if (outordercountMap.containsKey(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)) { |
| | | Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c(); |
| | | invoiceUpdte1.Id = outOrderdet1List[i].Id; |
| | | invoiceUpdte1.Invoice_Unit__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unit__c; |
| | | if ( |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c == |
| | | '盒' && |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c == |
| | | '个' |
| | | ) { |
| | | Decimal OldinvoicedProcount = 0; |
| | | OldinvoicedProcount = (outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c / |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .ProductPacking_list_manual__c) |
| | | .setScale(2); |
| | | invoiceUpdte1.Invoiced_Procount__c = outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount; |
| | | } else { |
| | | invoiceUpdte1.Invoiced_Procount__c = |
| | | outOrderdet1List[i].Invoiced_Procount__c + |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .Invoiced_Count__c; |
| | | } |
| | | invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unitprice__c; |
| | | invoiceUpdte1.InvoicedProCost_RMB__c = invoiceUpdte1.Invoiced_Procount__c * outOrderdet1List[i].Delivery_List_RMB__c; |
| | | |
| | | Decimal invoicedProcount = 0; |
| | | if ( |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c == |
| | | '盒' && |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c == |
| | | '个' |
| | | ) { |
| | | invoicedProcount = (outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c / |
| | | outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .ProductPacking_list_manual__c) |
| | | .setScale(2); |
| | | } else { |
| | | invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c) |
| | | .Invoiced_Count__c; |
| | | } |
| | | |
| | | if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.Error, |
| | | // '出库单' + |
| | | // outOrderdet1List[i].Consumable_order__r.Name + |
| | | // '中,' + |
| | | // outOrderdet1List[i].Asset_Model_No__c + |
| | | // '还没开票数量小于发票数量,请确认是否有返品' |
| | | // ) |
| | | // ); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '出库单' + outOrderdet1List[i].Consumable_order__r.Name + '中,' + outOrderdet1List[i].Asset_Model_No__c + '还没开票数量小于发票数量,请确认是否有返品', ''); |
| | | } |
| | | |
| | | outOrderdetUp1List.add(invoiceUpdte1); |
| | | } |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | //出库单明细1更新 |
| | | if (outOrderdetUp1List.size() > 0) { |
| | | ControllerUtil.updateOrderDetails1Satus(outOrderdetUp1List); |
| | | } |
| | | //发票状态更新 |
| | | cocinfo = [ |
| | | SELECT Id, Name, Invoice_status__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | 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 |
| | | ]; |
| | | System.debug('cocinfo = ' + cocinfo); |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | 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('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(), ''); |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end |
| | | //新建发票明细1 |
| | | if (chukudanID.size() > 0) { |
| | | newinvoicedetails1(chukudanID); |
| | | } |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | } 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; |
| | | } |
| | | |
| | | 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 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 |
| | | ]; |
| | | |
| | | // 出库订单 |
| | | 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; |
| | | } |
| | | for (Integer i = 0; i < detaliFromList.size(); i++) { |
| | | Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c(); |
| | | invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c; |
| | | invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c; |
| | | String str = string.valueOf(i + 1); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | invoiceInsert1.Name = |
| | | coc.Name + |
| | | '-' + |
| | | detaliFromList[i] |
| | | .Name.substring( |
| | | detaliFromList[i].Name.length() - 7, |
| | | detaliFromList[i].Name.length() |
| | | ); |
| | | invoiceInsert1.Shipment_Count__c = detaliFromList[i] |
| | | .InvoiceProNot_count__c; |
| | | invoiceInsert1.Consumable_Product__c = detaliFromList[i] |
| | | .Consumable_Product__c; |
| | | invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i] |
| | | .Intra_Trade_List_RMB__c; |
| | | invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i] |
| | | .Delivery_List_RMB__c; |
| | | invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i] |
| | | .Dealer_Custom_Price__c; |
| | | invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | |
| | | if ( |
| | | detaliFromList[i].Box_Piece__c == '盒' && |
| | | detaliFromList[i].Invoice_Unit__c == '个' |
| | | ) { |
| | | invoiceInsert1.Invoice_Unitprice__c = |
| | | detaliFromList[i].Delivery_List_RMB__c / |
| | | detaliFromList[i].ProductPacking_list_manual__c; |
| | | } else { |
| | | invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i] |
| | | .Delivery_List_RMB__c; |
| | | } |
| | | invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c; |
| | | invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c; |
| | | if (detaliFromList[i].Invoiced_Procount__c == null) |
| | | detaliFromList[i].Invoiced_Procount__c = 0; |
| | | if (detaliFromList[i].RrturnPro_count__c == null) |
| | | detaliFromList[i].RrturnPro_count__c = 0; |
| | | invoiceInsert1.Invoiced_Count__c = detaliFromList[i] |
| | | .InvoiceProNot_count__c; |
| | | if (detaliFromList[i].InvoicedProCost_RMB__c == null) |
| | | detaliFromList[i].InvoicedProCost_RMB__c = 0; |
| | | invoiceInsert1.InvoicedProCost_RMB__c = |
| | | invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c; |
| | | invoiceInsert1.Consumable_order__c = invoiceId; |
| | | invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i] |
| | | .Consumable_order__c; |
| | | invoiceorderList1.add(invoiceInsert1); |
| | | } |
| | | } |
| | | System.debug('invoiceorderList1 +++++' + invoiceorderList1.size()); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | if (invoiceorderList1.size() > 0) { |
| | | try { |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | insert invoiceorderList1; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | //ApexPages.addMessages(ex); |
| | | errorMsg += ex.getMessage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void getdefaultMapinfo(List<String> orderIdList) { |
| | | List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>(); |
| | | existLinkinfo = [ |
| | | SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :orderIdList |
| | | ]; |
| | | // for (Integer i = 0; i < existLinkinfo.size(); i++) { |
| | | // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0); |
| | | // } |
| | | } |
| | | |
| | | public static void deleteOutboundorder( |
| | | Map<String, String> deleteMap, |
| | | String value |
| | | ) { |
| | | //删除发票明细1 |
| | | List<Consumable_Orderdetails__c> detInvoicedet1List = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_Shipment_order__c, |
| | | Consumable_Sale_order__c, |
| | | Consumable_product__c, |
| | | Asset_Model_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | Consumable_order__c = :value |
| | | AND Invoicedet1_OD_link__c = :deleteMap.keySet() |
| | | ]; |
| | | System.debug('detInvoicedet1List = ' + detInvoicedet1List); |
| | | delete detInvoicedet1List; |
| | | } |
| | | |
| | | //换货单链接表 发票明细2做成 |
| | | public static void outOrderchange(Map<String, String> insertDetMap) { |
| | | List<string> chukudanID = new List<string>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | if (insertDetMap.size() > 0) { |
| | | for (String field : insertDetMap.keySet()) { |
| | | List<Consumable_order_LinkTable__c> existLinkinfo = [ |
| | | SELECT Id |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :field |
| | | ]; |
| | | if (existLinkinfo.size() > 0) { |
| | | delete existLinkinfo; |
| | | } |
| | | chukudanID.add(field); |
| | | Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c(); |
| | | invoiceLink.Name = field + insertDetMap.get(field); |
| | | invoiceLink.Outboundorder_Code_link__c = field; |
| | | invoiceLink.Invoice_Code_link__c = insertDetMap.get(field); |
| | | invoiceLinkList.add(invoiceLink); |
| | | p.Id = field; |
| | | p.ConInvoice_Code__c = insertDetMap.get(field); |
| | | p.Onchange_order__c = true; |
| | | update p; |
| | | } |
| | | insert invoiceLinkList; |
| | | } |
| | | //换货出库单明细1更新 |
| | | List<Consumable_Orderdetails__c> detaliFrom1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Consumable_Sale_order__r.Name, |
| | | Consumable_Shipment_order__r.Name |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :chukudanID |
| | | ]; |
| | | for (Consumable_Orderdetails__c changeOD : detaliFrom1List) { |
| | | changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c; |
| | | } |
| | | update detaliFrom1List; |
| | | } |
| | | |
| | | //上传ContentVersion附件 |
| | | @AuraEnabled |
| | | public static String saveFile( |
| | | Id recordId, |
| | | String fileName, |
| | | String base64Data |
| | | ) { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = recordId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | System.debug('cv.Id = ' + cv.Id); |
| | | return cv.Id; |
| | | } |
| | | |
| | | // 保存附件 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC saveAttachment( |
| | | String attachmentRecoedsLwc, |
| | | String invoiceId |
| | | ) { |
| | | System.debug('进入 saveAttachment'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | invoiceId = invoiceId; |
| | | attachmentRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize( |
| | | attachmentRecoedsLwc, |
| | | List<InvoiceOrderInfo>.class |
| | | ); |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | try { |
| | | Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c(); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (!String.isBlank(ass.mailSelectOptsin)) { |
| | | attachmentdetails.Id = ass.invoiceOrderId; |
| | | attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId; |
| | | attachmentdetails.Accessories_type__c = ass.mailSelectOptsin; |
| | | if (String.isBlank(ass.invoiceOrderId)) { |
| | | attachmentdetails.Invoice_code__c = invoiceId; |
| | | } |
| | | upsert attachmentdetails; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | e.getMessage() + e.getLineNumber(), |
| | | '' |
| | | ); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 检索(未开发票出库单) |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC InvoiceorderSearch( |
| | | Consumable_order__c cocLwc, |
| | | String invoiceIdLwc, |
| | | String accountidLwc, |
| | | String userWorkLocationLwc, |
| | | String agencyProTypeLwc, |
| | | String HospitalInfoLwc, |
| | | String SecondDealerLwc, |
| | | String invoiceOrderRecoedsLwc |
| | | ) { |
| | | System.debug('进入 InvoiceorderSearch'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize( |
| | | invoiceOrderRecoedsLwc, |
| | | List<InvoiceOrderInfo>.class |
| | | ); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | |
| | | Map<String, String> invoiceOrderMap = new Map<String, String>(); |
| | | String msoql = ''; |
| | | List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>(); |
| | | if (String.isBlank(invoiceId)) { |
| | | msoql = makeSoql(); |
| | | } else { |
| | | msoql = makeSoqlInit(); |
| | | } |
| | | invoiceOrderList = new List<Consumable_order__c>(); |
| | | invoiceOrderList = Database.query(msoql); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (ass.check == true) { |
| | | invoiceOrderdetailMid.add(ass); |
| | | invoiceOrderMap.put(ass.esd.Name, ass.esd.Name); |
| | | } |
| | | } |
| | | invoiceOrderRecoeds = new List<InvoiceOrderInfo>(); |
| | | invoiceOrderRecoeds.addAll(invoiceOrderdetailMid); |
| | | for (Integer i = 0; i < invoiceOrderList.size(); i++) { |
| | | if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) { |
| | | } else { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i])); |
| | | invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name); |
| | | } |
| | | } |
| | | data.put('invoiceOrderRecoeds', invoiceOrderRecoeds); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND Billed_Status__c != \'全部开票\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\''; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += |
| | | ' AND ShipmentAccount__c = \'' + |
| | | coc.Order_ForDealerText__c + |
| | | '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | private static String makeSoqlInit() { |
| | | String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\''; |
| | | soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\''; |
| | | soql += ' ) '; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' AND Order_ProType__c =\'' + agencyProType + '\''; |
| | | soql += ' AND SummonsForDirction__c != \'互相调货\' '; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\''; |
| | | } |
| | | if (SecondDealer != null) { |
| | | soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\''; |
| | | } |
| | | if (coc.Order_ForDealerText__c != null) { |
| | | soql += |
| | | ' AND ShipmentAccount__c = \'' + |
| | | coc.Order_ForDealerText__c + |
| | | '\''; |
| | | } |
| | | soql += ' AND InvoiceNotPro_total_amount__c > 0'; |
| | | soql += ' AND Onchange_order__c = false limit 1000'; |
| | | return soql; |
| | | } |
| | | |
| | | // 删除按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC deleteButton( |
| | | String invoiceIdLwc, |
| | | Consumable_order__c cocLwc |
| | | ) { |
| | | System.debug('进入 deleteButton'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | system.debug('====invoiceId==========>' + invoiceId); |
| | | List<Consumable_Orderdetails__c> consList = [ |
| | | SELECT id, Consumable_order__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | try { |
| | | system.debug('====cons==========>' + consList); |
| | | delete consList; |
| | | if (coc.id == invoiceId && coc.Invoice_status__c == '草案中') { |
| | | delete coc; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | e.getMessage() + ' ' + e.getLineNumber(), |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 提交按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC approval( |
| | | List<String> outOrderStringListLwc, |
| | | Map<String, Consumable_Orderdetails__c> outordercountMapLwc, |
| | | String invoiceIdLwc |
| | | ) { |
| | | System.debug('进入 approval'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | outOrderStringList = outOrderStringListLwc; |
| | | outordercountMap = outordercountMapLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | //更新发票明细2链接 |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>(); |
| | | //更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>(); |
| | | //需要更新出库单明细1 |
| | | List<Consumable_Orderdetails__c> outOrderdet1List = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_order__r.Name, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c IN :outOrderStringList |
| | | ]; |
| | | for (Integer i = 0; i < outOrderdet1List.size(); i++) { |
| | | if ( |
| | | outordercountMap.containsKey( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | ) { |
| | | Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c(); |
| | | invoiceUpdte1.Id = outOrderdet1List[i].Id; |
| | | invoiceUpdte1.Invoice_Unit__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unit__c; |
| | | if ( |
| | | outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Box_Piece__c == '盒' && |
| | | outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unit__c == '个' |
| | | ) { |
| | | Decimal OldinvoicedProcount = 0; |
| | | OldinvoicedProcount = (outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c / |
| | | outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .ProductPacking_list_manual__c) |
| | | .setScale(2); |
| | | invoiceUpdte1.Invoiced_Procount__c = |
| | | outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount; |
| | | } else { |
| | | invoiceUpdte1.Invoiced_Procount__c = |
| | | outOrderdet1List[i].Invoiced_Procount__c + |
| | | outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoiced_Count__c; |
| | | } |
| | | invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get( |
| | | outOrderdet1List[i].Consumable_order__c + |
| | | outOrderdet1List[i].Asset_Model_No__c |
| | | ) |
| | | .Invoice_Unitprice__c; |
| | | 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; |
| | | } |
| | | @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; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public with sharing class LexConInvoicedetailsController { |
| | | //出库单使用 |
| | | public static Consumable_order__c coc { get; set; } |
| | | //出库单使用 |
| | | public static Consumable_order__c coc { get; set; } |
| | | |
| | | //发票使用 |
| | | public static Consumable_order__c invoicecode { get; set; } |
| | | //发票使用 |
| | | public static Consumable_order__c invoicecode { get; set; } |
| | | |
| | | //价格计算结果 |
| | | public static Decimal sumPrice {get;set;} |
| | | //价格计算结果 |
| | | public static Decimal sumPrice { get; set; } |
| | | |
| | | //出库单ID |
| | | private static String orderId {get;set;} |
| | | //发票单ID |
| | | private static String invoiceId {get;set;} |
| | | //出库单ID |
| | | private static String orderId { get; set; } |
| | | //发票单ID |
| | | private static String invoiceId { get; set; } |
| | | //出库单明细1,画面显示使用 |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { |
| | | get; |
| | | set; |
| | | } |
| | | //明细数量 |
| | | public static Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return consumableorderdetails1Records == null |
| | | ? 0 |
| | | : consumableorderdetails1Records.size(); |
| | | } |
| | | } |
| | | |
| | | //页面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String orderIdLwc, String invoiceIdLwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | orderId = orderIdLwc; |
| | | invoiceId = invoiceIdLwc; |
| | | consumableorderdetails1Records = new List<ConsumableorderdetailsInfo>(); |
| | | sumPrice = 0; |
| | | coc = new Consumable_order__c(); |
| | | //出库单信息 |
| | | coc = [ |
| | | SELECT Id, Name, Outbound_Date__c, Order_ForDealerText__c, Dealer_Info__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :orderId |
| | | ]; |
| | | //发票信息 |
| | | invoicecode = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | ShipmentAccount__c, |
| | | Order_ForCustomerText__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId |
| | | ]; |
| | | //发票明细1 |
| | | Map<String, Consumable_Orderdetails__c> invoiceorderdet1CountMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | List<Consumable_Orderdetails__c> invoiceorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Invoicedet1_OD_link__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | Consumable_order__c = :invoiceId |
| | | AND Invoicedet1_OD_link__c = :orderId |
| | | ]; |
| | | for (Integer i = 0; i < invoiceorderdetails1.size(); i++) { |
| | | invoiceorderdet1CountMap.put( |
| | | invoiceorderdetails1[i].Asset_Model_No__c, |
| | | invoiceorderdetails1[i] |
| | | ); |
| | | } |
| | | //出库单明细1,画面显示使用 |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; } |
| | | //明细数量 |
| | | public static Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size(); |
| | | } |
| | | 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]) |
| | | ); |
| | | } |
| | | |
| | | //页面初始化 |
| | | @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]); |
| | | 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; |
| | | } |
| | | //出库单明细1,画面显示使用 |
| | | List<Consumable_Orderdetails__c> consumableorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Consumable_Product__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Dealer_Custom_Price__c, |
| | | Sum_of_money__c, |
| | | Used_date__c, |
| | | Send_date__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | Consumable_Product__r.Packing_list_manual__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :orderId |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails1.size(); i++) { |
| | | consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i])); |
| | | 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; |
| | | } |
| | | 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; |
| | | } |
| | | 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; |
| | | } |
| | | data.put('invoicecode',invoicecode); |
| | | data.put('coc',coc); |
| | | data.put('consumableorderdetails1Records',consumableorderdetails1Records); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | Decimal invoiceAllprice = 0.00; |
| | | invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c) |
| | | .setScale(2); |
| | | ass.invoiceAllprice = invoiceAllprice; |
| | | } else { |
| | | ass.invoiceCount = ass.esd.InvoiceProNot_count__c; |
| | | ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c; |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | } |
| | | data.put('invoicecode', invoicecode); |
| | | data.put('coc', coc); |
| | | data.put('consumableorderdetails1Records', consumableorderdetails1Records); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc,String invoiceIdLwc,String orderIdLwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | @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); |
| | | 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>(); |
| | | 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>(); |
| | | 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); |
| | | } |
| | | 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; |
| | | //发票明细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); |
| | | 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, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | 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 |
| | | ) |
| | | ); |
| | | } |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | if (invoiceorderList1.size() > 0) { |
| | | insert invoiceorderList1; |
| | | } |
| | | if (invoiceorderUpList1.size() > 0) { |
| | | update invoiceorderUpList1; |
| | | } |
| | | if (invoiceorderDeList1.size() > 0) { |
| | | delete invoiceorderDeList1; |
| | | } |
| | | } catch (Exception e) { |
| | | ApexPages.addmessages(e); |
| | | // Database.rollback(sp); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | e.getMessage() + ' ' + e.getLineNumber(), |
| | | '' |
| | | ); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal invoiceCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal invoiceAllprice { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Packing_list_manual { get; set; } |
| | | public List<SelectOption> Invoice_UnitOpts { get; set; } |
| | | @AuraEnabled |
| | | public Map<String,String> Invoice_UnitOptsMap { get; set; } |
| | | // 消耗品产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | invoiceAllprice = 0; |
| | | // 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; |
| | | Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c; |
| | | if (!Test.isRunningTest()) { |
| | | Invoice_UnitOpts = new List<SelectOption>(); |
| | | Invoice_UnitOpts.add(new SelectOption('盒', '盒')); |
| | | Invoice_UnitOpts.add(new SelectOption('个', '个')); |
| | | } |
| | | |
| | | Invoice_UnitOpts = new List<SelectOption>(); |
| | | Invoice_UnitOpts.add(new SelectOption('盒', '盒')); |
| | | Invoice_UnitOpts.add(new SelectOption('个', '个')); |
| | | |
| | | Invoice_UnitOptsMap = new Map<String,String>(); |
| | | Invoice_UnitOptsMap.put('盒', '盒'); |
| | | Invoice_UnitOptsMap.put('个', '个'); |
| | | } |
| | | Invoice_UnitOptsMap = new Map<String, String>(); |
| | | Invoice_UnitOptsMap.put('盒', '盒'); |
| | | Invoice_UnitOptsMap.put('个', '个'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @isTest |
| | | private class LexConInvoicedetailsControllerTest { |
| | | @isTest |
| | | static void itShould() { |
| | | user myUser_test; |
| | | Account myAccount1; |
| | | Account myAccount2; |
| | | Product2__c pro2; |
| | | Product2__c pro1; |
| | | Product2 prod01; |
| | | Product2 prod02; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectHos = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | if (rectHos.size() == 0) { |
| | | return; |
| | | } |
| | | //产品信息 |
| | | 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 |
| | | ); |
| | | 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 |
| | | }; |
| | | |
| | | 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 |
| | | ); |
| | | Product2__c pro5 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | Product2__c pro3 = new Product2__c( |
| | | Name = 'Pro004', |
| | | OT_CODE_Text__c = 'Test004', |
| | | Product2__c = prod04.Id |
| | | ); |
| | | Product2__c pro4 = new Product2__c( |
| | | Name = 'Pro005', |
| | | OT_CODE_Text__c = 'Test005', |
| | | 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 }; |
| | | |
| | | 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' |
| | | ); |
| | | insert myUser_test; |
| | | } |
| | | System.runAs(myUser_test) { |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c( |
| | | Name = 'invoice01', |
| | | Order_type__c = '发票', |
| | | Invoice_status__c = '已完成', |
| | | Invoice_Date__c = Date.today(), |
| | | RecordTypeid = System.Label.RT_ConOrder_Invoice, |
| | | Order_ForHospital__c = myAccount2.Id, |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Dealer_info__c = myAccount1.Id |
| | | ); |
| | | insert invoiceorder; |
| | | |
| | | //出库单 |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | Order_ForHospital__c = myAccount2.Id, |
| | | 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 = '已完成', |
| | | Order_ForHospital__c = myAccount2.Id, |
| | | 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 }; |
| | | |
| | | 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 |
| | | Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c(); |
| | | invoicedet1.Name = 'invoicetest1_001001'; |
| | | //orderdet1.Consumable_principal__c = testList1.Id; |
| | | 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; |
| | | Consumable_orderdetails__c invoicedet2 = new Consumable_orderdetails__c(); |
| | | invoicedet2.Name = 'invoiceTest1_001002'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | 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; |
| | | Consumable_orderdetails__c invoicedet3 = new Consumable_orderdetails__c(); |
| | | invoicedet3.Name = 'invoiceTest1_001003'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | 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; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | invoicedet1, |
| | | invoicedet2, |
| | | invoicedet3 |
| | | }; |
| | | |
| | | //出库单明细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 = '个'; |
| | | orderdet1 = new Consumable_orderdetails__c(); |
| | | orderdet1.Name = 'Test1_0010011'; |
| | | //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 = pro2.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 = '盒'; |
| | | Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c(); |
| | | orderdet2.Name = 'Test1_0010012'; |
| | | //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 = pro2.Id; |
| | | orderdet2.Box_Piece__c = '盒'; |
| | | orderdet2.Shipment_Count__c = 10; |
| | | 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 = '个'; |
| | | orderdet2.Invoiced_Count__c = 3; |
| | | orderdet2 = new Consumable_orderdetails__c(); |
| | | orderdet2.Name = 'Test1_0010031'; |
| | | //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; |
| | | orderdet2.Box_Piece__c = '个'; |
| | | orderdet2.Shipment_Count__c = 10; |
| | | 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 = '盒'; |
| | | orderdet2.Invoiced_Count__c = 3; |
| | | |
| | | Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c(); |
| | | orderdet3.Name = 'Test1_001002'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet3.Consumable_order__c = testList1.Id; |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Box_Piece__c = '盒'; |
| | | orderdet3.Consumable_product__c = pro2.Id; |
| | | orderdet3.Invoice_Unit__c = '个'; |
| | | orderdet3.Shipment_Count__c = 11; |
| | | orderdet3.Delivery_List_RMB__c = 2.0; |
| | | orderdet3.Invoiced_Procount__c = 3; |
| | | orderdet3.RrturnPro_count__c = 3; |
| | | orderdet3.Invoiced_Count__c = 3; |
| | | orderdet3 = new Consumable_orderdetails__c(); |
| | | orderdet3.Name = 'Test1_001003'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet3.Consumable_order__c = testList1.Id; |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Box_Piece__c = '盒'; |
| | | orderdet3.Consumable_product__c = pro1.Id; |
| | | orderdet3.Invoice_Unit__c = '盒'; |
| | | orderdet3.Shipment_Count__c = 11; |
| | | orderdet3.Delivery_List_RMB__c = 2.0; |
| | | orderdet3.Invoiced_Procount__c = 3; |
| | | orderdet3.RrturnPro_count__c = 3; |
| | | orderdet3.Invoiced_Count__c = 3; |
| | | |
| | | Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c(); |
| | | orderdet4.Name = 'Test1_001004'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet4.Consumable_order__c = testList1.Id; |
| | | orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Box_Piece__c = '盒'; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | orderdet4.Invoice_Unit__c = '个'; |
| | | orderdet4.Shipment_Count__c = 11; |
| | | orderdet4.Delivery_List_RMB__c = 2.0; |
| | | orderdet4.Invoiced_Procount__c = 3; |
| | | orderdet4.Invoiced_Count__c = 3; |
| | | orderdet4.RrturnPro_count__c = 3; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | |
| | | // PageReference page = new PageReference('/apex/ConInvoicedetails?orderId=' + testList1.Id + '&invoiceId=' + invoiceorder.id); |
| | | // page.setRedirect(true); |
| | | // System.Test.setCurrentPage(page); |
| | | // page = new Pagereference('/ConInvoiceView?invoiceId='+invoiceorder.id); |
| | | // page.setRedirect(true); |
| | | |
| | | LexConInvoicedetailsController.init('', ''); |
| | | // System.assertEquals(4, conTest.consumableorderdetails1Records.size()); |
| | | // conTest.consumableorderdetails1Records[0].check= true; |
| | | // conTest.consumableorderdetails1Records[0].invoiceCount= 1; |
| | | // conTest.consumableorderdetails1Records[0].esd.Invoice_Unit__c = '个'; |
| | | // conTest.consumableorderdetails1Records[1].check= true; |
| | | // conTest.consumableorderdetails1Records[1].invoiceCount= 2; |
| | | // conTest.consumableorderdetails1Records[1].esd.Invoice_Unit__c = '个'; |
| | | // conTest.save(); |
| | | // conTest.returnToinvoice(); |
| | | // Consumable_orderdetails__c testInvoice = [select id,Name,Invoiced_Count__c,Invoice_Unit__c,Invoice_Unitprice__c from Consumable_orderdetails__c where id=:invoicedet1.Id]; |
| | | // System.assertEquals(4, conTest.invoiceOrderRecoedsCount); |
| | | // System.assertEquals('个', testInvoice.Invoice_Unit__c); |
| | | } |
| | | } |
| | | @isTest |
| | | static void all() { |
| | | User myUser_test; |
| | | Account myAccount1; |
| | | Account myAccount2; |
| | | Product2__c pro2; |
| | | Product2__c pro1; |
| | | Product2 prod01; |
| | | Product2 prod02; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof = [ |
| | |
| | | if (rectHos.size() == 0) { |
| | | return; |
| | | } |
| | | //产品信息 |
| | | 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 |
| | | ); |
| | | 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 |
| | | }; |
| | | 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 |
| | | ); |
| | | Product2__c pro5 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | Product2__c pro3 = new Product2__c( |
| | | Name = 'Pro004', |
| | | OT_CODE_Text__c = 'Test004', |
| | | Product2__c = prod04.Id |
| | | ); |
| | | Product2__c pro4 = new Product2__c( |
| | | Name = 'Pro005', |
| | | OT_CODE_Text__c = 'Test005', |
| | | 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 }; |
| | | myAccount1 = new Account( |
| | | Name = 'testaccount001', |
| | | Dealer_discount__c = 10, |
| | |
| | | insert myUser_test; |
| | | } |
| | | System.runAs(myUser_test) { |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod03 = new Product2( |
| | | Name = 'Test03', |
| | | ProductCode = 'Test03', |
| | | Asset_Model_No__c = 'Test03', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod04 = new Product2( |
| | | Name = 'Test04', |
| | | ProductCode = 'Test04', |
| | | Asset_Model_No__c = 'Test04', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 2, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod05 = new Product2( |
| | | Name = 'Test05', |
| | | ProductCode = 'Test05', |
| | | Asset_Model_No__c = 'Test05', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod06 = new Product2( |
| | | Name = 'Test06', |
| | | ProductCode = 'Test06', |
| | | Asset_Model_No__c = 'Test06', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ |
| | | prod01, |
| | | prod02, |
| | | prod03, |
| | | prod04, |
| | | prod05, |
| | | prod06 |
| | | }; |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | Product2__c pro3 = new Product2__c( |
| | | Name = 'Pro004', |
| | | OT_CODE_Text__c = 'Test004', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | Product2__c pro4 = new Product2__c( |
| | | Name = 'Pro005', |
| | | OT_CODE_Text__c = 'Test005', |
| | | Product2__c = prod04.Id |
| | | ); |
| | | Product2__c pro5 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod05.Id |
| | | ); |
| | | Product2__c pro6 = new Product2__c( |
| | | Name = 'Pro006', |
| | | OT_CODE_Text__c = 'Test006', |
| | | Product2__c = prod06.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 }; |
| | | //发票 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice02'; |
| | |
| | | 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'; |
| | | //orderdet1.Consumable_principal__c = testList1.Id; |
| | | invoicedet1.Consumable_order__c = invoiceorder.id; |
| | | invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | invoicedet1.Consumable_count__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'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | invoicedet2.Consumable_order__c = invoiceorder.Id; |
| | | invoicedet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | invoicedet2.Consumable_count__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'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | invoicedet3.Consumable_order__c = invoiceorder.Id; |
| | | invoicedet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | invoicedet3.Consumable_count__c = 1; |
| | |
| | | invoicedet3.InvoicedProCost_RMB__c = 1; |
| | | invoicedet3.Invoiced_Procount__c = 3; |
| | | invoicedet3.RrturnPro_count__c = 3; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | invoicedet1, |
| | | invoicedet2, |
| | | invoicedet3 |
| | | }; |
| | | 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.Invoiced_Procount__c = 3; |
| | | orderdet1.RrturnPro_count__c = 3; |
| | | orderdet1.Invoice_Unit__c = '个'; |
| | | orderdet1 = new Consumable_orderdetails__c(); |
| | | orderdet1.Name = 'Test1_0010011'; |
| | | //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 = pro2.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_0010012'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | 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 = 10; |
| | | 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 = '个'; |
| | | orderdet2.Invoiced_Count__c = 3; |
| | | orderdet2 = new Consumable_orderdetails__c(); |
| | | orderdet2.Name = 'Test1_0010031'; |
| | | //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; |
| | | orderdet2.Box_Piece__c = '个'; |
| | | orderdet2.Shipment_Count__c = 10; |
| | | 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 = '盒'; |
| | | orderdet2.Invoiced_Count__c = 3; |
| | | codList.add(orderdet2); |
| | | |
| | | Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c(); |
| | | orderdet3.Name = 'Test1_001002'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet3.Name = 'Test1_0010012'; |
| | | orderdet3.Consumable_order__c = testList1.Id; |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Box_Piece__c = '盒'; |
| | | orderdet3.Consumable_product__c = pro2.Id; |
| | | orderdet3.Invoice_Unit__c = '个'; |
| | | orderdet3.Shipment_Count__c = 11; |
| | | orderdet3.Delivery_List_RMB__c = 2.0; |
| | | orderdet3.Invoiced_Procount__c = 3; |
| | | orderdet3.RrturnPro_count__c = 3; |
| | | orderdet3.Invoiced_Count__c = 3; |
| | | orderdet3 = new Consumable_orderdetails__c(); |
| | | orderdet3.Name = 'Test1_001003'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet3.Consumable_order__c = testList1.Id; |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Box_Piece__c = '盒'; |
| | | orderdet3.Consumable_product__c = pro1.Id; |
| | | orderdet3.Invoice_Unit__c = '盒'; |
| | | orderdet3.Shipment_Count__c = 11; |
| | | 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_001004'; |
| | | //orderdet2.Consumable_principal__c = testList2.Id; |
| | | orderdet4.Name = 'Test1_0010031'; |
| | | orderdet4.Consumable_order__c = testList1.Id; |
| | | orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Box_Piece__c = '盒'; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | orderdet4.Invoice_Unit__c = '个'; |
| | | orderdet4.Shipment_Count__c = 11; |
| | | 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.Invoiced_Count__c = 3; |
| | | orderdet4.RrturnPro_count__c = 3; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | 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); |
| | | //序列化Json |
| | | |
| | | System.Test.startTest(); |
| | | System.debug( |
| | | '===>数据' + |
| | | LexConInvoicedetailsController.consumableorderdetails1Records |
| | | ); |
| | | |
| | | List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> test = LexConInvoicedetailsController.consumableorderdetails1Records; |
| | | |
| | | List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList = LexConInvoicedetailsController.consumableorderdetails1Records; |
| | | LexConInvoicedetailsController.save( |
| | | JSON.serialize(test), |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | public without sharing class LexConsumableAccountController { |
| | | //经销商用户产品分类(ET、ENG) |
| | | 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、ENG) |
| | | public static String agencyProType { get; set; } |
| | | public static String agencyProTypestr { get; set; } |
| | | //选项卡名称 |
| | | public static String filterName { get; set; } |
| | | //选项卡类型 |
| | | public static String hosptialType { get; set; } |
| | | public static ApexPages.StandardSetController setCon { get; set; } |
| | | //画面显示数量 |
| | | public static Integer size { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | //显示集合 |
| | | public static List<Account> pageRecords { get; set; } |
| | | //经销商信息 |
| | | private static String accountName { get; set; } |
| | | private static String accountId { get; set; } |
| | | //排序使用 |
| | | // public static String sortKey { get; set; } |
| | | // public static String preSortKey { get; private set; } |
| | | // public static Boolean sortOrderAsc { get; private set; } |
| | | // public static String[] sortOrder { get; private set; } |
| | | // //排序使用 |
| | | // private static String[] orderby = new String[]{ 'Name','State_Master__c','Salesdepartment_HP__c','CreatedDate','Is_Active__c','RecordType.Name','Grade__c','OCM_Category__c','City_Master__c','Town__c','Phone'}; |
| | | //上周开始、结束日期 |
| | | private static Datetime lastweekstart { get; set; } |
| | | private static Datetime lastweekend { get; set; } |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | |
| | | //初始化 |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init( |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC, |
| | | String fiscalYear |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | |
| | | User Useracc = [ |
| | | SELECT accountid, UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :UserInfo.getUserId() |
| | | ]; |
| | | accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid] |
| | | .id; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | agencyProTypestr = '%' + agencyProType + '%'; |
| | | System.debug('accountId = ' + accountId); |
| | | System.debug('agencyProTypestr = ' + agencyProTypestr); |
| | | List<Account> allSelectAccount = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE |
| | | Agency__c = :accountId |
| | | AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | ]; |
| | | totalCount = allSelectAccount.size(); |
| | | |
| | | List<Account> selectAccList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE |
| | | Agency__c = :accountId |
| | | AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | LIMIT :pageSize |
| | | ]; |
| | | System.debug('selectAccList = ' + selectAccList); |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) |
| | | ? pageToken + pageSize |
| | | : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd |
| | | ? recordEnd |
| | | : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | //销量前十的客户 |
| | | // List<Account> acList = [ |
| | | // SELECT |
| | | // id, |
| | | // Name, |
| | | // State_Master__c, |
| | | // State_Master__r.Name, |
| | | // Salesdepartment_HP__c, |
| | | // CreatedDate, |
| | | // Is_Active__c, |
| | | // RecordType.Name, |
| | | // Grade__c, |
| | | // OCM_Category__c, |
| | | // City_Master__c, |
| | | // City_Master__r.Name, |
| | | // Town__c, |
| | | // Phone |
| | | // FROM Account |
| | | // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '有効' AND RecordType.Name = '病院' |
| | | // LIMIT 10 |
| | | // ]; |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | if (fiscalYear == 'thisYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales( |
| | | thisDatetime, |
| | | nextDatetime |
| | | ); |
| | | topInfo.saleAmount = Decimal.valueOf( |
| | | String.valueOf(saleAmountList[0].get('saleAmount')) |
| | | ); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales( |
| | | thisDatetime, |
| | | nextDatetime |
| | | ); |
| | | } else if (fiscalYear == 'lastYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales( |
| | | lastDatetime, |
| | | thisDatetime2 |
| | | ); |
| | | topInfo.saleAmount = Decimal.valueOf( |
| | | String.valueOf(saleAmountList[0].get('saleAmount')) |
| | | ); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales( |
| | | lastDatetime, |
| | | thisDatetime2 |
| | | ); |
| | | } else { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales( |
| | | lastDatetime, |
| | | nextDatetime |
| | | ); |
| | | topInfo.saleAmount = Decimal.valueOf( |
| | | String.valueOf(saleAmountList[0].get('saleAmount')) |
| | | ); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales( |
| | | lastDatetime, |
| | | nextDatetime |
| | | ); |
| | | } |
| | | |
| | | // Map<String,Decimal> mapTemp = new Map<String,Decimal>(); |
| | | // for (AggregateResult ar : arList) { |
| | | // if(!mapTemp.get(String.valueOf(ar.get('hospitalName')))){ |
| | | // mapTemp.put(String.valueOf(ar.get('hospitalName'),Decimal.valueOf(String.valueOf(ar.get('thisAmount'))))); |
| | | // }else { |
| | | // Decimal decimal = mapTemp.get(String.valueOf(ar.get('hospitalName'))); |
| | | // decimal += Decimal.valueOf(String.valueOf(ar.get('thisAmount'))); |
| | | // mapTemp.put(String.valueOf(ar.get('hospitalName'),decimal)); |
| | | // } |
| | | // } |
| | | // System.debug('mapTemp = ' + mapTemp); |
| | | // //排序Decimal从大到小 |
| | | // List<Decimal> decimalList = new List<Decimal>(mapTemp.values()); |
| | | // decimalList.sort((a, b) => b.compareTo(a)); |
| | | // Map<String, Decimal> sortedMap = new Map<String, Decimal>(); |
| | | // for (String key : mapTemp.keySet()) { |
| | | // sortedMap.put(key, mapTemp.get(key)); |
| | | // } |
| | | |
| | | // System.debug('Sorted Map: ' + sortedMap); |
| | | |
| | | //查询客户信息(名称,省,县) |
| | | System.debug('arList = ' + arList); |
| | | List<String> accountList = new List<String>(); |
| | | for (AggregateResult ar : arList) { |
| | | System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount'))); |
| | | if (String.valueOf(ar.get('thisAmount')) != '0.0') { |
| | | accountList.add(String.valueOf(ar.get('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); |
| | | data.put('pageRecords', selectAccList); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('accountId', accountId); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('agencyProTypestr', agencyProTypestr); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | e.getMessage() + e.getLineNumber(), |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | try { |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | 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')) |
| | | ); |
| | | 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')) |
| | | ); |
| | | 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')) |
| | | ); |
| | | 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(), |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | |
| | | @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 static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String fiscalYear) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | |
| | | User Useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid].id; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | agencyProTypestr = '%' + agencyProType + '%'; |
| | | System.debug('accountId = ' + accountId); |
| | | System.debug('agencyProTypestr = ' + agencyProTypestr); |
| | | List<Account> allSelectAccount = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | ]; |
| | | totalCount = allSelectAccount.size(); |
| | | |
| | | List<Account> selectAccList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE |
| | | id IN ( |
| | | SELECT Hospital__c |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr |
| | | ) |
| | | LIMIT :pageSize |
| | | ]; |
| | | System.debug('selectAccList = ' + selectAccList); |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | //销量前十的客户 |
| | | // List<Account> acList = [ |
| | | // SELECT |
| | | // id, |
| | | // Name, |
| | | // State_Master__c, |
| | | // State_Master__r.Name, |
| | | // Salesdepartment_HP__c, |
| | | // CreatedDate, |
| | | // Is_Active__c, |
| | | // RecordType.Name, |
| | | // Grade__c, |
| | | // OCM_Category__c, |
| | | // City_Master__c, |
| | | // City_Master__r.Name, |
| | | // Town__c, |
| | | // Phone |
| | | // FROM Account |
| | | // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '有効' AND RecordType.Name = '病院' |
| | | // LIMIT 10 |
| | | // ]; |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | if (fiscalYear == 'thisYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime); |
| | | } else if (fiscalYear == 'lastYear') { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2); |
| | | } else { |
| | | AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime); |
| | | topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime); |
| | | } |
| | | |
| | | //查询客户信息(名称,省,县) |
| | | List<String> accountList = new List<String>(); |
| | | for (AggregateResult ar : arList) { |
| | | System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount'))); |
| | | if(String.valueOf(ar.get('thisAmount')) != '0.0'){ |
| | | accountList.add(String.valueOf(ar.get('hospitalName'))); |
| | | topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount')))); |
| | | } |
| | | } |
| | | |
| | | System.debug('accountList = ' + accountList); |
| | | System.debug('topInfo = ' + topInfo); |
| | | |
| | | List<Account> acList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE Name = :accountList |
| | | ]; |
| | | |
| | | List<Account> acListTemp = new List<Account>(); |
| | | |
| | | for (String s : accountList) { |
| | | for (Account a : acList) { |
| | | if (s == a.Name) { |
| | | acListTemp.add(a); |
| | | } |
| | | } |
| | | } |
| | | |
| | | topInfo.acList = acListTemp; |
| | | |
| | | data.put('topInfo', topInfo); |
| | | data.put('pageRecords', selectAccList); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('accountId', accountId); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('agencyProTypestr', agencyProTypestr); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | try { |
| | | TopInfo topInfo = new TopInfo(); |
| | | |
| | | Date today = Date.today(); |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 4, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 4, 1); |
| | | |
| | | AggregateResult[] arList = null; |
| | | |
| | | System.debug('fiscalYear = ' + fiscalYear); |
| | | 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'))); |
| | | 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'))); |
| | | 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'))); |
| | | System.debug('topInfo.saleAmount = ' + topInfo.saleAmount); |
| | | } |
| | | arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime); |
| | | } |
| | | //查询客户信息(名称,省,县) |
| | | List<String> accountList = new List<String>(); |
| | | for (AggregateResult ar : arList) { |
| | | System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount'))); |
| | | if(String.valueOf(ar.get('thisAmount')) != '0.0'){ |
| | | accountList.add(String.valueOf(ar.get('hospitalName'))); |
| | | topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount')))); |
| | | } |
| | | |
| | | } |
| | | System.debug('accountList = ' + accountList); |
| | | System.debug('topInfo = ' + topInfo); |
| | | List<Account> acList = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Salesdepartment_HP__c, |
| | | CreatedDate, |
| | | Is_Active__c, |
| | | RecordType.Name, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | City_Master__c, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Phone |
| | | FROM Account |
| | | WHERE Name = :accountList |
| | | ]; |
| | | List<Account> acListTemp = new List<Account>(); |
| | | for (String s : accountList) { |
| | | for (Account a : acList) { |
| | | if (s == a.Name) { |
| | | acListTemp.add(a); |
| | | } |
| | | } |
| | | } |
| | | topInfo.acList = acListTemp; |
| | | data.put('topInfo', topInfo); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | } |
| | | } |
| | | |
| | | public Integer pageNumber { get; set; } |
| | | @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; |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | filterName = filterNameLwc; |
| | | accountId = accountIdLwc; |
| | | agencyProTypestr = agencyProTypeLwc; |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | //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; } |
| | | |
| | | String soql = makeSoql(filterName, accountId); |
| | | System.debug('soql1+++++++ ' + soql); |
| | | List<Account> allSelectAccount = Database.query(soql); |
| | | |
| | | totalCount = allSelectAccount.size(); |
| | | if (String.isNotBlank(sortField)) { |
| | | soql += ' order by ' + sortField + ' ' + sortOrder; |
| | | } |
| | | soql += ' limit ' + pagesize + ' offset ' + pageToken; |
| | | System.debug('soql2+++++++ ' + soql); |
| | | List<Account> selectAccList = Database.query(soql); |
| | | System.debug('selectAccList = ' + selectAccList); |
| | | |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | data.put('pageRecords', selectAccList); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), ''); |
| | | } |
| | | public TopInfo() { |
| | | acList = new List<Account>(); |
| | | deList = new List<Decimal>(); |
| | | } |
| | | |
| | | //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>(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | @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(); |
| | | |
| | | static testMethod void testMethod1() { |
| | | 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; |
| | | |
| | | // 代理店医院 |
| | | agency_hospital_link.Name = 'test1代理店医院'; |
| | | 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 = '草案中'; |
| | | 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; |
| | | |
| | | // 代理店医院 |
| | | agency_hospital_link.Name = 'test1代理店医院'; |
| | | 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) { |
| | | PageReference page = new PageReference('/apex/ConsumableAccount'); |
| | | System.Test.setCurrentPage(page); |
| | | ConsumableAccountController ca = new ConsumableAccountController(); |
| | | //ConsumableAccountController.getlistViewOptions(); |
| | | ca.init(); |
| | | |
| | | ca.filterName = '61. 医院_Hospital草案中的医院'; |
| | | ca.changelistView(); |
| | | |
| | | ca.filterName = '62. 医院_Hospital申请中的医院'; |
| | | ca.changelistView(); |
| | | |
| | | ca.filterName = '63. 医院_Hospital上周创建的医院'; |
| | | ca.changelistView(); |
| | | |
| | | ca.refreshPageSize(); |
| | | |
| | | ca.sortKey = '0'; |
| | | 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' |
| | | ); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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; |
| | | |
| | | LexConsumableAccountInfoController cai = new LexConsumableAccountInfoController(); |
| | | LexConsumableAccountInfoController.init(account1.Id); |
| | | LexConsumableAccountInfoController.init(''); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public with sharing class LexConsumableAccountSOQL { |
| | | public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){ |
| | | AggregateResult[] arList = new List<AggregateResult>([ |
| | | SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | CreatedDate >= :thisDatetime |
| | | AND CreatedDate < :nextDatetime |
| | | AND Consumable_order__r.Order_ForHospital__r.name != '' |
| | | GROUP BY Consumable_order__r.Order_ForHospital__r.Name |
| | | ORDER BY sum(Sale_amount__c) DESC |
| | | LIMIT 10 |
| | | ]); |
| | | return arList; |
| | | } |
| | | public static AggregateResult[] 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 |
| | | ]; |
| | | 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; |
| | | } |
| | | } |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 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 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(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test) { |
| | | //产品数据 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Product_Status__c = '正常销售', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | SFDA_Approbated_Status__c = '有效', |
| | | Category3__c = 'US', |
| | | Category4__c = 'ALOKA', |
| | | Category5__c = '体外超声', |
| | | 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; |
| | | |
| | | //订单 |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test) { |
| | | //产品数据 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Product_Status__c = '正常销售', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | SFDA_Approbated_Status__c = '有效', |
| | | Category3__c = 'US', |
| | | Category4__c = 'ALOKA', |
| | | Category5__c = '体外超声', |
| | | 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; |
| | | |
| | | //创建医院 |
| | | 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 = '販売店' |
| | | ]; |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | SFDA_Approbated_Status__c = '有效', |
| | | Category3__c = 'US', |
| | | Category4__c = 'ALOKA', |
| | | Category5__c = '体外超声', |
| | | 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; |
| | | } |
| | | |
| | | 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 = '販売店' |
| | | ]; |
| | | 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; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test) { |
| | | //产品数据 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Product_Status__c = '正常销售', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | SFDA_Approbated_Status__c = '有效', |
| | | Category3__c = 'US', |
| | | Category4__c = 'ALOKA', |
| | | Category5__c = '体外超声', |
| | | 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; |
| | | |
| | | //订单 |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | SFDA_Approbated_Status__c = '有效', |
| | | Category3__c = 'US', |
| | | Category4__c = 'ALOKA', |
| | | Category5__c = '体外超声', |
| | | 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 = '正常销售', |
| | | 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 = '正常销售', |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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; |
| | | } |
| | | |
| | | 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; |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | @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 = '販売店' |
| | | ]; |
| | | 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(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 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 = '販売店' |
| | | ]; |
| | | 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(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 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 = '販売店' |
| | | ]; |
| | | 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(Orderdet3.Id); |
| | | LexConsumableGoodsInfo.initNotArrDet(Orderdet3.Id); |
| | | LexConsumableGoodsInfo.initArrDet(Orderdet3.Id); |
| | | LexConsumableGoodsInfo.initDeliveryDet(Orderdet3.Id); |
| | | LexConsumableGoodsInfo.initTotalNum(Orderdet3.Id, '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 = '販売店' |
| | | ]; |
| | | 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 = '販売店' |
| | | ]; |
| | | 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 = '販売店' |
| | | ]; |
| | | 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'); |
| | | } |
| | | } |
| | | } |
| force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml
force-app/main/default/classes/LexInventoryController.cls
force-app/main/default/classes/LexInventoryControllerTest.cls
force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml
force-app/main/default/classes/LexInventoryListController.cls
force-app/main/default/classes/LexInventoryListControllerTest.cls
force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml
force-app/main/default/classes/LexInventoryViewControllerTest.cls
force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml
force-app/main/default/classes/LexLicenceReminderControllerTest.cls
force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml
force-app/main/default/classes/LexOutboundorderImportController.cls
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml
force-app/main/default/classes/LexOverdueStockController.cls
force-app/main/default/classes/LexOverdueStockControllerTest.cls
force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml
force-app/main/default/classes/LexProductLimitEditControllerTest.cls
force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml
force-app/main/default/classes/LexRemoveBoxControllerTest.cls
force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml
force-app/main/default/classes/LexSaleOrderController.cls
force-app/main/default/classes/LexSaleOrderControllerTest.cls
force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml
force-app/main/default/classes/LexSearchContractControllerTest.cls
force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml
force-app/main/default/classes/LexSearchHospitalControllerTest.cls
force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml
force-app/main/default/classes/LexSummonsCreatController.cls
force-app/main/default/classes/LexSummonsCreatControllerTest.cls
force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml
force-app/main/default/classes/LexTopPageControllerTest.cls
force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml
force-app/main/default/classes/LexUpAccountProLimit.cls
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml
force-app/main/default/classes/LexUtilityTest.cls
force-app/main/default/classes/LexUtilityTest.cls-meta.xml
force-app/main/default/classes/LookupSearchResultTest.cls
force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml
force-app/main/default/classes/NewAndEditLeadController.cls
force-app/main/default/classes/Product2Handler.cls
force-app/main/default/classes/RentalApplyEquipmentSetDetailHandler.cls
force-app/main/default/classes/ResponseBodyLWCTest.cls
force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
force-app/main/default/pages/OFSInsReportLayout.page
force-app/main/default/pages/StraightBackAddress.page
force-app/main/default/pages/StraightBackAddress.page-meta.xml
force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml
manifest/LEXC01packagelexcommunitynew.xml
manifest/LEXC02packagelexcommunityupdate.xml
manifest/package.xml |