| | |
| | | { |
| | | "target-org": "LEXOlympusDev" |
| | | } |
| | |
| | | <aura:component controller="RetrospectiveWeeklyReportController" |
| | | 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:'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="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" /> |
| | | <!-- 使用产品1(产品型号) --> |
| | | <aura:attribute name="UseProduct1" 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: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:handler name="change" value="{!v.UseProduct3}" action="{!c.UseProduct3Change}" /> |
| | | <aura:attribute name="UseProduct3List" type="Map" /> |
| | | <aura:attribute name="UseProduct3Id" type="string" default="" /> |
| | | <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="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--> |
| | | <!-- Imports --> |
| | | <!-- <aura:import library="lightningcomponentdemo:mockdataFaker" property="mockdataLibrary"/> --> |
| | | <!-- attributes --> |
| | | <aura:attribute name="errorData" type="Object" /> |
| | | <aura:attribute name="errorColumns" type="List" /> |
| | | <!-- show Error information --> |
| | | <aura:attribute name="showErrorInfo" type="Boolean" default="false" /> |
| | | <!-- end DTT-zhj 增加错误信息table 2023-05-16--> |
| | | |
| | | <aura:attribute name="PIConfig" type="Map" /> |
| | | |
| | | <aura:attribute name="doctor_list" type="Map" /> |
| | | <!-- <aura:attribute name="doctor_title" type="String" /> --> |
| | | <aura:attribute name="opportunity_list" type="Map" /> |
| | | <aura:attribute name="edit_copy_select_report_id" type="String" /> |
| | | <aura:attribute name="create_agency_report_id" type="String" /> |
| | | <aura:attribute name="reports" type="List" /> |
| | | <aura:attribute name="reports_now" type="List" /> |
| | | <aura:attribute name="reports_now_count" type="Integer" /> |
| | | <aura:attribute name="mode" type="String" /> |
| | | <aura:attribute name="select_report_data" type="Map" /> |
| | | <aura:attribute name="select_report_data_radio" type="Map" /> |
| | | <aura:attribute name="default_select_doctor_id" type="String" /> |
| | | <aura:attribute name="default_select_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" /> |
| | | <!-- 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" /> |
| | | |
| | | <aura:attribute name="PIConfig" type="Map"/> |
| | | |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | |
| | | <!-- 批量添加周报 end--> |
| | | <!--ロード中...--> |
| | | <aura:renderIf isTrue="{!v.login}"> |
| | | <div class="slds-spinner_container height100vh"> |
| | | <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert"> |
| | | <span class="slds-assistive-text">Loading</span> |
| | | <div class="slds-spinner__dot-a"></div> |
| | | <div class="slds-spinner__dot-b"></div> |
| | | </div> |
| | | </div> |
| | | </aura:renderIf> |
| | | <div aura:id="report" id="report" class="contents_wrapper"> |
| | | <div class="slds-grid slds-wrap slds-grid--pull-padded"> |
| | | <div style="width: 230px;"></div> |
| | | <div |
| | | class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"> |
| | | 周 |
| | | </div> |
| | | <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" |
| | | 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: 200px;"> |
| | | </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}" /> |
| | | </div> |
| | | <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"> |
| | | <ui:button aura:id="copy_button" label="复制" press="{!c.copy_button}" disabled="true" /> |
| | | <ui:button aura:id="import" label="导入" press="{!c.import}" /> |
| | | <ui:button aura:id="export" label="导出" press="{!c.export_condition}" /> |
| | | </div> |
| | | </div> |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | |
| | | <!-- 批量添加日报 end--> |
| | | <!--ロード中...--> |
| | | <aura:renderIf isTrue="{!v.login}"> |
| | | <div class="slds-spinner_container height100vh"> |
| | | <div |
| | | class="slds-spinner--brand slds-spinner slds-spinner--medium" |
| | | role="alert" |
| | | > |
| | | <span class="slds-assistive-text">Loading</span> |
| | | <div class="slds-spinner__dot-a"></div> |
| | | <div class="slds-spinner__dot-b"></div> |
| | | </div> |
| | | </div> |
| | | <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;"> |
| | | </aura:renderIf> |
| | | <div aura:id="report" id="report" class="contents_wrapper"> |
| | | <div class="slds-grid slds-wrap slds-grid--pull-padded"> |
| | | <div style="width: 200px"></div> |
| | | <div |
| | | class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12" |
| | | > |
| | | 周 |
| | | </div> |
| | | <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" |
| | | 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}" /> |
| | | </div> |
| | | <div |
| | | style="width: 350px" |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12" |
| | | > |
| | | <ui:button |
| | | aura:id="copy_button" |
| | | label="复制" |
| | | press="{!c.copy_button}" |
| | | disabled="true" |
| | | /> |
| | | <ui:button |
| | | aura:id="delete_button" |
| | | label="删除" |
| | | press="{!c.delete_button}" |
| | | disabled="true" |
| | | /> |
| | | <ui:button aura:id="import" label="导入" press="{!c.import}" /> |
| | | <ui:button |
| | | aura:id="export" |
| | | label="导出" |
| | | press="{!c.export_condition}" |
| | | /> |
| | | <ui:button |
| | | aura:id="returnbutton" |
| | | label="返回" |
| | | press="{!c.return_main_page}" |
| | | /> |
| | | </div> |
| | | </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" |
| | | style="width: 250px" |
| | | ></th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <span class="slds-truncate" title="Name" |
| | | >{!v.fieldsmap.Person_In_Charge2__c}</span |
| | | > |
| | | <!-- {!v.fieldsmap.Person_In_Charge2__c} 担当--> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps" style="width: 250px"> |
| | | <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 |
| | | > |
| | | <!-- {!v.fieldsmap.Department_Cateogy__c} 科室--> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <span class="slds-truncate" title="Name">拜访人</span> |
| | | <!-- {!v.fieldsmap.doctor2__c} 拜访人 --> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <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"> |
| | | <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"> |
| | | <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 |
| | | > |
| | | </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_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}"> |
| | | <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.DealerPersonnel__r.Name}" |
| | | >{!item.DealerPersonnel__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.WorkMark__c}"> |
| | | <lightning:input |
| | | type="checkbox" |
| | | checked="{!item.WorkMark__c}" |
| | | disabled="true" |
| | | /> |
| | | </span> |
| | | </span> |
| | | </td> |
| | | </tr> |
| | | </aura:iteration> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <aura:renderIf isTrue="{!v.report_count > 0}"> |
| | | <aura:set attribute="else"> |
| | | <div class="no_data_area">{!v.list_message}</div> |
| | | </aura:set> |
| | | </aura:renderIf> |
| | | </div> |
| | | <!-- 批量添加日报 start--> |
| | | <div |
| | | aura:id="modal_import" |
| | | role="dialog" |
| | | tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large" |
| | | aria-labelledby="headerTarget" |
| | | > |
| | | <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01"> |
| | | <!-- <ui:inputText aura:id="articleURL" /> --> |
| | | <div class="demo-only" style="height: 8rem"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div |
| | | class="slds-notify slds-notify_toast slds-theme_success" |
| | | role="alert" |
| | | > |
| | | <div class="slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large" |
| | | > |
| | | <lightning:icon |
| | | alternativeText="Success" |
| | | iconName="utility:success" |
| | | size="small" |
| | | class="buttonColor slds-m-right_small" |
| | | /> |
| | | <h2 class="slds-text-heading_small">{!v.successMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | class="slds-modal slds-fade-in-open slds-hide" |
| | | aura:id="errorDiv01" |
| | | style="z-index: 10001" |
| | | > |
| | | <!-- <ui:inputText aura:id="articleURL" /> --> |
| | | <div class="demo-only" style="height: 8rem"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div |
| | | class="slds-notify slds-notify_toast slds-theme_error" |
| | | role="status" |
| | | > |
| | | <div class="slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large" |
| | | > |
| | | <lightning:icon |
| | | alternativeText="error" |
| | | iconName="utility:error" |
| | | size="small" |
| | | class="buttonColor slds-m-right_small" |
| | | /> |
| | | <h2 class="slds-text-heading_small">{!v.errorMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="slds-modal__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> |
| | | <lightning:input |
| | | type="file" |
| | | class="file" |
| | | uara:id="file" |
| | | onchange="{!c.CreateRecord}" |
| | | /> |
| | | </div> |
| | | <aura:set attribute="else"> |
| | | <ui:outputRichText |
| | | class="uiOutputRichText slds-m--around-large" |
| | | value="{!v.TableContent}" |
| | | /> |
| | | <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> |
| | | <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"> |
| | | <lightning:datatable |
| | | keyField="id" |
| | | data="{! v.errorData }" |
| | | columns="{! v.errorColumns }" |
| | | hideCheckboxColumn="true" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </aura:if> |
| | | </aura:set> |
| | | </aura:if> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | aura:id="modal_importbg" |
| | | class="disp_none slds-backdrop slds-backdrop--open" |
| | | ></div> |
| | | <!-- 批量添加日报 end--> |
| | | |
| | | <!-- 批量导出日报 start--> |
| | | <div |
| | | aura:id="modal_export" |
| | | role="dialog" |
| | | tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large" |
| | | > |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__header"> |
| | | <h4 id="headerTarget" class="slds-float--left"></h4> |
| | | <h2 id="headerTarget" class="slds-text-heading--medium"> |
| | | 日报批量导出 |
| | | </h2> |
| | | <ui:button |
| | | aura:id="close_button" |
| | | label="关闭" |
| | | class="close_button slds-button slds-button--neutral slds-order--1" |
| | | press="{!c.close_export}" |
| | | /> |
| | | </div> |
| | | <div |
| | | class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium" |
| | | > |
| | | <aura:if isTrue="{!v.showMain}"> |
| | | <div class="slds-grid slds-wrap slds-grid--pull-padded"> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4" |
| | | ></div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4" |
| | | > |
| | | 活动日开始日期 |
| | | <lightning:input |
| | | type="Date" |
| | | class="slds-input slds-input_bare" |
| | | aura:id="input-report-date1" |
| | | /> |
| | | </div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4" |
| | | > |
| | | 活动日结束日期 |
| | | <lightning:input |
| | | type="Date" |
| | | class="slds-input slds-input_bare" |
| | | aura:id="input-report-date2" |
| | | /> |
| | | </div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4" |
| | | ></div> |
| | | <div class="slds-p-around--large slds-align--absolute-center"> |
| | | <lightning:button |
| | | label="确认" |
| | | variant="brand" |
| | | onclick="{!c.select_repores_date}" |
| | | /> |
| | | <lightning:button |
| | | label="取消" |
| | | variant="brand" |
| | | onclick="{!c.close_export}" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <aura:set attribute="else"> |
| | | <ui:outputRichText |
| | | class="uiOutputRichText slds-m--around-large" |
| | | value="{!v.TableContent2}" |
| | | /> |
| | | <div class="slds-p-around--large slds-align--absolute-center"> |
| | | <lightning:button |
| | | label="确认" |
| | | variant="brand" |
| | | onclick="{!c.exportDate}" |
| | | /> |
| | | <lightning:button |
| | | label="取消" |
| | | variant="brand" |
| | | onclick="{!c.close_export}" |
| | | /> |
| | | </div> |
| | | </aura:set> |
| | | </aura:if> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | aura:id="modal_exportbg" |
| | | class="disp_none slds-backdrop slds-backdrop--open" |
| | | ></div> |
| | | <!-- 批量导出日报 end--> |
| | | <div |
| | | aura:id="modal_window" |
| | | role="dialog" |
| | | tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large" |
| | | aria-labelledby="headerTarget" |
| | | > |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv"> |
| | | <!-- <ui:inputText aura:id="articleURL" /> --> |
| | | <div class="demo-only" style="height: 8rem"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div |
| | | class="slds-notify slds-notify_toast slds-theme_success" |
| | | role="alert" |
| | | > |
| | | <div class="slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large" |
| | | > |
| | | <lightning:icon |
| | | alternativeText="Success" |
| | | iconName="utility:success" |
| | | size="small" |
| | | class="buttonColor slds-m-right_small" |
| | | /> |
| | | <h2 class="slds-text-heading_small">{!v.successMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | class="slds-modal slds-fade-in-open slds-hide" |
| | | aura:id="errorDiv" |
| | | style="z-index: 10001" |
| | | > |
| | | <!-- <ui:inputText aura:id="articleURL" /> --> |
| | | <div class="demo-only" style="height: 8rem"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div |
| | | class="slds-notify slds-notify_toast slds-theme_error" |
| | | role="status" |
| | | > |
| | | <div class="slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large" |
| | | > |
| | | <lightning:icon |
| | | alternativeText="error" |
| | | iconName="utility:error" |
| | | size="small" |
| | | class="buttonColor slds-m-right_small" |
| | | /> |
| | | <h2 class="slds-text-heading_small">{!v.errorMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="slds-modal__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-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" |
| | | > |
| | | 活动日 |
| | | <lightning:input |
| | | type="date" |
| | | value="{!v.data.Report_Date__c}" |
| | | aura:id="input-report-date" |
| | | variant="label-hidden" |
| | | /> |
| | | </div> |
| | | <!-- 医院 --> |
| | | <div |
| | | aura:id="hospital_list" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | 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-5 slds-large-size--1-of-6" |
| | | > |
| | | {!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-5 slds-large-size--1-of-6" |
| | | style="width: 145px" |
| | | > |
| | | {!v.fieldsmap.DealerPersonnel__c} |
| | | <ui:inputSelect |
| | | aura:id="select_DealerPersonnel" |
| | | class="slds-select" |
| | | /> |
| | | </div> |
| | | <!-- 活动区分 --> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | > |
| | | {!v.fieldsmap.WorkRecord__c} |
| | | <ui:inputSelect |
| | | aura:id="select_purpose_type" |
| | | class="slds-select" |
| | | change="{!c.select_purpose_type}" |
| | | /> |
| | | </div> |
| | | <!-- 拜访人 {!v.fieldsmap.doctor2__c}--> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | 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-5 slds-large-size--1-of-12" |
| | | > |
| | | <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-6" |
| | | > |
| | | 产品分类(第三分类) |
| | | <ui:inputSelect |
| | | aura:id="select_ProductClassification" |
| | | class="slds-select" |
| | | change="{!c.selectProductClassification}" |
| | | /> |
| | | </div> |
| | | <!-- 使用产品1(产品型号) UseProduct1__c --> |
| | | <div |
| | | aura:id="UseProduct1_List" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | data-select="single" |
| | | > |
| | | <!-- label="使用产品1(产品型号)" --> |
| | | 使用产品1(产品型号) |
| | | <lightning:input |
| | | aura:id="UseProduct1_TEXT" |
| | | class="field" |
| | | value="{!v.UseProduct1}" |
| | | updateOn="keyup" |
| | | variant="label-hidden" |
| | | /> |
| | | <div class="slds-lookup__menu" id="lookup-11"> |
| | | <ul |
| | | class="slds-lookup__list" |
| | | role="listbox" |
| | | style="max-height: 230px" |
| | | > |
| | | <aura:iteration |
| | | var="UseProduct1" |
| | | items="{!v.UseProduct1List}" |
| | | > |
| | | <li |
| | | role="presentation" |
| | | onclick="{!c.seletUseProduct1Change}" |
| | | data-accid="{!UseProduct1.Id}" |
| | | data-accName="{!UseProduct1.Asset_Model_No__c}" |
| | | > |
| | | <span |
| | | class="slds-lookup__item-action slds-media" |
| | | id="lookup-option-498" |
| | | role="option" |
| | | > |
| | | <div class="slds-media__body"> |
| | | <div class="slds-lookup__result-text"> |
| | | {!UseProduct1.Asset_Model_No__c} |
| | | </div> |
| | | </div> |
| | | </span> |
| | | </li> |
| | | </aura:iteration> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <!-- 使用产品2 UseProduct2__c --> |
| | | <div |
| | | aura:id="UseProduct2_List" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | data-select="single" |
| | | > |
| | | <!-- label="使用产品2" --> |
| | | 使用产品2 |
| | | <lightning:input |
| | | aura:id="UseProduct2_TEXT" |
| | | class="field" |
| | | value="{!v.UseProduct2}" |
| | | updateOn="keyup" |
| | | variant="label-hidden" |
| | | /> |
| | | <div class="slds-lookup__menu" id="lookup-22"> |
| | | <ul |
| | | class="slds-lookup__list" |
| | | role="listbox" |
| | | style="max-height: 230px" |
| | | > |
| | | <aura:iteration |
| | | var="UseProduct2" |
| | | items="{!v.UseProduct2List}" |
| | | > |
| | | <li |
| | | role="presentation" |
| | | onclick="{!c.seletUseProduct2Change}" |
| | | data-accid="{!UseProduct2.Id}" |
| | | data-accName="{!UseProduct2.Asset_Model_No__c}" |
| | | > |
| | | <span |
| | | class="slds-lookup__item-action slds-media" |
| | | id="lookup-option-498" |
| | | role="option" |
| | | > |
| | | <div class="slds-media__body"> |
| | | <div class="slds-lookup__result-text"> |
| | | {!UseProduct2.Asset_Model_No__c} |
| | | </div> |
| | | </div> |
| | | </span> |
| | | </li> |
| | | </aura:iteration> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <!-- 使用产品3 UseProduct3__c --> |
| | | <div |
| | | aura:id="UseProduct3_List" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | 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-6" |
| | | > |
| | | {!v.fieldsmap.EffectProgress__c} |
| | | <ui:inputSelect |
| | | aura:id="select_EffectProgress" |
| | | class="slds-select" |
| | | /> |
| | | </div> |
| | | <hr /> |
| | | <!-- 产品1同类耗材科室月使用量 ConsumptionOfConsumables__c--> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | > |
| | | {!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" |
| | | 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"> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <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"> |
| | | <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> |
| | | <!-- {!v.fieldsmap.Department_Cateogy__c} 科室--> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <span class="slds-truncate" title="Name">医院人员</span> |
| | | <!-- {!v.fieldsmap.doctor2__c} 医院人员 --> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.DealerPersonnel__c}</span> |
| | | <!-- {!v.fieldsmap.visitor_title__c} 职位--> |
| | | </th> |
| | | </tr> |
| | | <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}" 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> |
| | | </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.DealerPersonnel__r.Name}">{!item.DealerPersonnel__r.Name}</span> |
| | | </span> |
| | | </td> |
| | | </tr> |
| | | </aura:iteration> |
| | | <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> |
| | | <aura:renderIf isTrue="{!v.report_count > 0}"> |
| | | <aura:set attribute="else"> |
| | | <div class="no_data_area"> |
| | | {!v.list_message} |
| | | </div> |
| | | </aura:set> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </aura:renderIf> |
| | | </div> |
| | | </div> |
| | | <!-- 批量添加周报 start--> |
| | | <div aura:id="modal_import" role="dialog" tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget"> |
| | | <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01"> |
| | | <ui:inputText aura:id="articleURL" /> |
| | | <div class="demo-only" style="height: 8rem;"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div class="slds-notify slds-notify_toast slds-theme_success" role="alert"> |
| | | <div class=" slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"> |
| | | <lightning:icon alternativeText="Success" iconName="utility:success" size="small" |
| | | class="buttonColor slds-m-right_small" /> |
| | | <h2 class="slds-text-heading_small ">{!v.successMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="slds-modal__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> |
| | | <lightning:input type="file" class="file" uara:id="file" onchange="{!c.CreateRecord}" /> |
| | | </div> |
| | | <aura:set attribute="else"> |
| | | <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent}" /> |
| | | <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> |
| | | </div> |
| | | |
| | | </aura:set> |
| | | </aura:if> |
| | | </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 aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div> |
| | | <!-- 批量添加周报 end--> |
| | | </div> |
| | | <div |
| | | aura:id="modal_confirm_bg" |
| | | class="disp_none slds-backdrop slds-backdrop--open" |
| | | ></div> |
| | | |
| | | <!-- 批量导出周报 start--> |
| | | <div aura:id="modal_export" role="dialog" tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__header"> |
| | | <h4 id="headerTarget" class="slds-float--left"></h4> |
| | | <h2 id="headerTarget" class="slds-text-heading--medium">周报批量导出</h2> |
| | | <ui:button aura:id="close_button" label="关闭" |
| | | class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_export}" /> |
| | | </div> |
| | | <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"> |
| | | <aura:if isTrue="{!v.showMain}"> |
| | | <div class="slds-grid slds-wrap slds-grid--pull-padded"> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"> |
| | | </div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"> |
| | | 活动日开始日期 |
| | | <lightning:input type="Date" class="slds-input slds-input_bare " |
| | | aura:id="input-report-date1" /> |
| | | </div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"> |
| | | 活动日结束日期 |
| | | <lightning:input type="Date" class="slds-input slds-input_bare " |
| | | aura:id="input-report-date2" /> |
| | | </div> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"> |
| | | </div> |
| | | <div class="slds-p-around--large slds-align--absolute-center"> |
| | | <lightning:button label="确认" variant="brand" onclick="{!c.select_repores_date}" /> |
| | | <lightning:button label="取消" variant="brand" onclick="{!c.close_export}" /> |
| | | </div> |
| | | </div> |
| | | <aura:set attribute="else"> |
| | | <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent2}" /> |
| | | <div class="slds-p-around--large slds-align--absolute-center"> |
| | | <lightning:button label="确认" variant="brand" onclick="{!c.exportDate}" /> |
| | | <lightning:button label="取消" variant="brand" onclick="{!c.close_export}" /> |
| | | </div> |
| | | </aura:set> |
| | | </aura:if> |
| | | </div> |
| | | </div> |
| | | <div |
| | | 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:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div> |
| | | <!-- 批量导出周报 end--> |
| | | <div aura:id="modal_window" role="dialog" tabindex="-1" |
| | | class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv"> |
| | | <ui:inputText aura:id="articleURL" /> |
| | | <div class="demo-only" style="height: 8rem;"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div class="slds-notify slds-notify_toast slds-theme_success" role="alert"> |
| | | <div class=" slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"> |
| | | <lightning:icon alternativeText="Success" iconName="utility:success" size="small" |
| | | class="buttonColor slds-m-right_small" /> |
| | | <h2 class="slds-text-heading_small ">{!v.successMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv" style="z-index: 10001"> |
| | | <ui:inputText aura:id="articleURL" /> |
| | | <div class="demo-only" style="height: 8rem;"> |
| | | <div class="slds-notify_container slds-is-relative"> |
| | | <div class="slds-notify slds-notify_toast slds-theme_error" role="status"> |
| | | <div class=" slds-m-left_xx-large"> |
| | | <div |
| | | class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"> |
| | | <lightning:icon alternativeText="error" iconName="utility:error" size="small" |
| | | class="buttonColor slds-m-right_small" /> |
| | | <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="slds-modal__header"> |
| | | <h4 id="headerTarget" class="slds-float--left">{!v.dialog_type}</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"> |
| | | 活动日 |
| | | <lightning:input type="date" value="{!v.data.Report_Date__c}" aura:id="input-report-date" /> |
| | | </div> |
| | | <!-- 医院 --> |
| | | <div aura:id="hospital_list" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | data-select="single"> |
| | | <lightning:input aura:id="hospital_input_text" label="医院" class="field" |
| | | value="{!v.hospital}" 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-6"> |
| | | {!v.fieldsmap.Department_Cateogy__c} |
| | | <ui:inputText aura:id="select_department" class="slds-select" |
| | | change="{!c.select_department}" /> |
| | | </div> |
| | | <!-- 经销商人员 change="{!c.select_DealerPersonnel}" --> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"> |
| | | {!v.fieldsmap.DealerPersonnel__c} |
| | | <ui:inputSelect aura:id="select_DealerPersonnel" class="slds-select" /> |
| | | </div> |
| | | <p hidden="hidden"> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12"> |
| | | <br /> |
| | | <ui:button label="新建" class="slds-button" press="{!c.createCon}" disabled="true" |
| | | aura:id="new_con" /> |
| | | </div> |
| | | </p> |
| | | <!-- 工作记录 --> |
| | | <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.WorkRecord__c} |
| | | <ui:inputSelect aura:id="select_purpose_type" class="slds-select" |
| | | change="{!c.select_purpose_type}" /> |
| | | </div> |
| | | <!-- 医院人员 {!v.fieldsmap.doctor2__c}--> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"> |
| | | 医院人员 |
| | | <ui:inputSelect aura:id="select_doctor" class="slds-select" change="{!c.doctor_change}" /> |
| | | </div> |
| | | <hr /> |
| | | <!-- 产品分类(第三分类) change="{!c.select_ProductClassification}" --> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"> |
| | | 产品分类(第三分类) |
| | | <ui:inputSelect aura:id="select_ProductClassification" class="slds-select" |
| | | change="{!c.selectProductClassification}" /> |
| | | </div> |
| | | <!-- 使用产品1(产品型号) UseProduct1__c --> |
| | | <div aura:id="UseProduct1_List" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | data-select="single"> |
| | | <lightning:input aura:id="UseProduct1_TEXT" label="使用产品1(产品型号)" class="field" |
| | | value="{!v.UseProduct1}" updateOn="keyup" /> |
| | | <div class="slds-lookup__menu" id="lookup-11"> |
| | | <ul class="slds-lookup__list" role="listbox"> |
| | | <aura:iteration var="UseProduct1" items="{!v.UseProduct1List}"> |
| | | <li role="presentation" onclick="{!c.seletUseProduct1Change}" |
| | | data-accid="{!UseProduct1.Id}" data-accName="{!UseProduct1.Name}"> |
| | | <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.Name}</div> |
| | | </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-6" |
| | | data-select="single"> |
| | | <lightning:input aura:id="UseProduct2_TEXT" label="使用产品2" class="field" |
| | | value="{!v.UseProduct2}" updateOn="keyup" /> |
| | | <div class="slds-lookup__menu" id="lookup-22"> |
| | | <ul class="slds-lookup__list" role="listbox"> |
| | | <aura:iteration var="UseProduct2" items="{!v.UseProduct2List}"> |
| | | <li role="presentation" onclick="{!c.seletUseProduct2Change}" |
| | | data-accid="{!UseProduct2.Id}" data-accName="{!UseProduct2.Name}"> |
| | | <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.Name}</div> |
| | | </div> |
| | | </span> |
| | | </li> |
| | | </aura:iteration> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <!-- 使用产品3 UseProduct3__c --> |
| | | <div aura:id="UseProduct3_List" |
| | | class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6" |
| | | data-select="single"> |
| | | <lightning:input aura:id="UseProduct3_TEXT" label="使用产品3" class="field" |
| | | value="{!v.UseProduct3}" updateOn="keyup" /> |
| | | <div class="slds-lookup__menu" id="lookup-33"> |
| | | <ul class="slds-lookup__list" role="listbox"> |
| | | <aura:iteration var="UseProduct3" items="{!v.UseProduct3List}"> |
| | | <li role="presentation" onclick="{!c.seletUseProduct3Change}" |
| | | data-accid="{!UseProduct3.Id}" data-accName="{!UseProduct3.Name}"> |
| | | <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.Name}</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-6"> |
| | | {!v.fieldsmap.EffectProgress__c} |
| | | <ui:inputSelect aura:id="select_EffectProgress" class="slds-select" /> |
| | | </div> |
| | | <hr /> |
| | | <!-- 科室同类耗材月使用量 ConsumptionOfConsumables__c--> |
| | | <div |
| | | class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"> |
| | | {!v.fieldsmap.ConsumptionOfConsumables__c} |
| | | <ui:inputText aura:id="select_ConsumptionOfConsumables" class="slds-select" |
| | | change="{!c.select_ConsumptionOfConsumables}" /> |
| | | </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}" /> |
| | | </div> |
| | | <!-- 工作标记 WorkMark__c--> |
| | | <div style="padding-left: 20px;"> |
| | | {!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__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}">{!item.doctor2__r.Name}</span> |
| | | </span> |
| | | </td> |
| | | <td role="gridcell" class="slds-cell-edit"> |
| | | <span class="slds-grid slds-grid--align-spread"> |
| | | <span class="slds-truncate" |
| | | title="{!item.visitor_title__c}">{!item.visitor_title__c}</span> |
| | | </span> |
| | | </td> |
| | | <td role="gridcell" class="slds-cell-edit"> |
| | | <span class="slds-grid slds-grid--align-spread"> |
| | | <span class="slds-truncate" |
| | | title="{!item.WorkRecord__c}">{!item.WorkRecord__c}</span> |
| | | </span> |
| | | </td> |
| | | </tr> |
| | | </aura:iteration> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </aura:renderIf> |
| | | </div> |
| | | </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> |
| | | <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> |
| | | </div> |
| | | </aura:component> |
| | |
| | | ({ |
| | | doInit : function(component, event, helper) { |
| | | helper.doinit(component, event, helper); |
| | | }, |
| | | doInit: function (component, event, helper) { |
| | | helper.doinit(component, event, helper); |
| | | component.set("v.errorColumns", [ |
| | | { |
| | | label: "错误行", |
| | | fieldName: "errorRow", |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: "错误信息", |
| | | fieldName: "errorInfo", |
| | | type: "text", |
| | | hideDefaultActions: true |
| | | } |
| | | ]); |
| | | }, |
| | | |
| | | createAopp : function(component, event, helper) { |
| | | var addRecordEvent = $A.get('e.force:createRecord'); |
| | | addRecordEvent.setParams({ |
| | | entityApiName: 'Agency_Opportunity__c', |
| | | recordTypeId: '012100000006KW7' |
| | | }); |
| | | addRecordEvent.fire(); |
| | | }, |
| | | |
| | | new_report : function(component, event, helper) { |
| | | component.find('save_button').set('v.label', '保存并新建'); |
| | | helper.new_report(component, event, helper); |
| | | }, |
| | | |
| | | 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(); |
| | | }, |
| | | |
| | | 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) { |
| | | event.preventDefault(); // stop form submission |
| | | var showValidationError = false; |
| | | var fields = component.find("newOpportunityField"); |
| | | var vaildationFailReason = ''; |
| | | 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 = "医生区分(职务)不能为空!"; |
| | | } |
| | | |
| | | } |
| | | }); |
| | | if (!showValidationError) { |
| | | helper.newlyBuild(component, event, helper); |
| | | }else{ |
| | | component.find('OppMessage').setError(vaildationFailReason); |
| | | new_report: function (component, event, helper) { |
| | | component.find("save_button").set("v.label", "保存并新建"); |
| | | helper.new_report(component, event, helper); |
| | | }, |
| | | |
| | | copy_button: function (component, event, helper) { |
| | | component.find("save_button").set("v.label", "保存并新建"); |
| | | helper.copy_button(component, event, helper); |
| | | }, |
| | | delete_button: function (component, event, helper) { |
| | | helper.delete_button(component, event, helper); |
| | | }, |
| | | change_report_radio: function (component, event, helper) { |
| | | helper.change_report_radio(component, event, helper); |
| | | }, |
| | | |
| | | 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) { |
| | | event.preventDefault(); // stop form submission |
| | | var showValidationError = false; |
| | | var fields = component.find("newOpportunityField"); |
| | | var vaildationFailReason = ""; |
| | | let agencyReport = Object.create(null); |
| | | fields.forEach(function (field) { |
| | | if ( |
| | | field.get("v.fieldName") === "Type__c" && |
| | | $A.util.isEmpty(field.get("v.value")) |
| | | ) { |
| | | showValidationError = true; |
| | | vaildationFailReason = "分类不能为空!"; |
| | | } else if ( |
| | | field.get("v.fieldName") === "Doctor_Division1__c" && |
| | | $A.util.isEmpty(field.get("v.value")) |
| | | ) { |
| | | showValidationError = true; |
| | | if (vaildationFailReason != "") { |
| | | vaildationFailReason += "医生区分(职务)不能为空!"; |
| | | } else { |
| | | vaildationFailReason = "医生区分(职务)不能为空!"; |
| | | } |
| | | }, |
| | | |
| | | 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')); |
| | | }, |
| | | } |
| | | //SWAG-CF58C3 fy start |
| | | if (field.get("v.fieldName") === "Name") { |
| | | agencyReport["name"] = field.get("v.value"); |
| | | } else if (field.get("v.fieldName") === "Type__c") { |
| | | agencyReport["type"] = field.get("v.value"); |
| | | } else if (field.get("v.fieldName") === "Doctor_Division1__c") { |
| | | agencyReport["doctorDivision1"] = field.get("v.value"); |
| | | } |
| | | //SWAG-CF58C3 fy end |
| | | }); |
| | | if (!showValidationError) { |
| | | //SWAG-CF58C3 fy start |
| | | var agencyHospitalid = component.get("v.hospitalLinkId"); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | debugger; |
| | | let hospitalName = ""; |
| | | //调用后端searchAgencyDataId方法查询出医院下面所有客户人员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); |
| | | |
| | | no_button : function(component, event, helper) { |
| | | component.set('v.confirm_status', 2); |
| | | helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text')); |
| | | }, |
| | | |
| | | toggle_report : function(component, event, helper) { |
| | | helper.toggle_report(component, event, helper); |
| | | }, |
| | | var token = component.get("v.AWStoken"); |
| | | var newUrl = component.get("v.AWSinsert") + "V2"; |
| | | |
| | | 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); |
| | | }, |
| | | //使用产品1 |
| | | UseProduct1Change : function(component, event, helper) { |
| | | var UseProduct1Name = event.getParam("value"); |
| | | if (UseProduct1Name.match(/(\S+\s)+/)) { |
| | | helper.searchUseProduct1(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct1(component, event, helper); |
| | | } |
| | | }, |
| | | seletUseProduct1Change : function(component, event, helper) { |
| | | helper.seletUseProduct1Change(component, event, helper); |
| | | }, |
| | | //使用产品2 |
| | | UseProduct2Change : function(component, event, helper) { |
| | | var UseProduct2Name = event.getParam("value"); |
| | | if (UseProduct2Name.match(/(\S+\s)+/)) { |
| | | helper.searchUseProduct2(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct2(component, event, helper); |
| | | } |
| | | }, |
| | | seletUseProduct2Change : function(component, event, helper) { |
| | | helper.seletUseProduct2Change(component, event, helper); |
| | | }, |
| | | productcategoryChange2 : function(component, event, helper) { |
| | | helper.productcategoryChange2(component, event, helper); |
| | | }, |
| | | //使用产品3 |
| | | UseProduct3Change : function(component, event, helper) { |
| | | var UseProduct3Name = event.getParam("value"); |
| | | if (UseProduct3Name.match(/(\S+\s)+/)) { |
| | | helper.searchUseProduct3(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct3(component, event, helper); |
| | | } |
| | | }, |
| | | seletUseProduct3Change : function(component, event, helper) { |
| | | helper.seletUseProduct3Change(component, event, helper); |
| | | }, |
| | | |
| | | |
| | | select_department : function(component, event, helper) { |
| | | helper.setOpportunity_cfilter(component); |
| | | }, |
| | | doctor_change : function(component, event, helper) { |
| | | helper.doctor_change(component, event, helper); |
| | | }, |
| | | stageNameChange : function(component, event, helper) { |
| | | helper.stageNameChange(component, event, helper); |
| | | }, |
| | | onDragOver : function(component, event, helper) { |
| | | event.preventDefault(); |
| | | }, |
| | | |
| | | onDrop : function(component, event, helper) { |
| | | event.stopPropagation(); |
| | | event.preventDefault(); |
| | | event.dataTransfer.dropEffect='copy'; |
| | | var files=event.dataTransfer.files; |
| | | helper.readFile(component,helper,files[0]); |
| | | }, |
| | | CreateRecord : function(component, event, helper){ |
| | | var files = event.getSource().get("v.files"); |
| | | helper.readFile(component,helper,files[0]); |
| | | }, |
| | | |
| | | processFileContent : function(component,event,helper){ |
| | | helper.saveRecords(component,event,helper); |
| | | }, |
| | | |
| | | cancel : function(component,event,helper){ |
| | | component.set("v.showMain",true); |
| | | }, |
| | | |
| | | import : function(component,event,helper){ |
| | | helper.showImport(component); |
| | | }, |
| | | exportDate : function(component,event,helper){ |
| | | var stockData = component.get("v.reports_date"); |
| | | console.log('导出数据'+stockData); |
| | | var csv = helper.convertArrayOfObjectsToCSV(component,stockData); |
| | | if (csv == null){return;} |
| | | |
| | | var universalBOM = "\uFEFF"; |
| | | var hiddenElement = document.createElement('a'); |
| | | hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM+csv); |
| | | hiddenElement.target = '_self'; // |
| | | hiddenElement.download = 'ExportData.csv'; // CSV file Name* you can change it.[only name not .csv] |
| | | document.body.appendChild(hiddenElement); // Required for FireFox browser |
| | | hiddenElement.click(); // using click() js function to download csv file |
| | | |
| | | }, |
| | | export_condition : function(component,event,helper){ |
| | | helper.showExport(component); |
| | | }, |
| | | |
| | | select_repores_date : function(component,event,helper){ |
| | | helper.select_repores_date(component,event,helper); |
| | | }, |
| | | export : function(component,event,helper){ |
| | | console.log('进入export'); |
| | | var stockData = component.get("v.reports_date"); |
| | | console.log('查出的数据'+stockData); |
| | | }, |
| | | close_import : function(component,event,helper){ |
| | | component.set("v.showMain",true); |
| | | helper.close_import(component); |
| | | }, |
| | | close_export : function(component,event,helper){ |
| | | component.set("v.showMain",true); |
| | | helper.close_export(component); |
| | | }, |
| | | select_ConsumptionOfConsumables : function(component,event,helper){ |
| | | helper.select_ConsumptionOfConsumables(component,event,helper); |
| | | }, |
| | | select_purpose_type : function(component,event,helper){ |
| | | helper.selectPurposeType(component,event,helper); |
| | | }, |
| | | select_warlocksNumber : function(component,event,helper){ |
| | | helper.select_warlocksNumber(component,event,helper); |
| | | }, |
| | | selectProductClassification : function(component,event,helper){ |
| | | helper.selectProductClassification(component,event,helper); |
| | | }, |
| | | selectpurposetype : function(component,event,helper){ |
| | | helper.selectpurposetype(component,event,helper); |
| | | component.set("v.login", true); |
| | | helper.insert_agencycontact( |
| | | component, |
| | | token, |
| | | newUrl, |
| | | requestData, |
| | | agencyHospitalid, |
| | | helper, |
| | | hospitalName |
| | | ); |
| | | } else { |
| | | helper.ShowToast({ |
| | | message: data.message, |
| | | type: "error" |
| | | }); |
| | | } |
| | | } else { |
| | | helper.ShowToast({ |
| | | message: "searchAgency失败", |
| | | type: "error" |
| | | }); |
| | | } |
| | | } |
| | | ); |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | // var arr = new Array(); |
| | | // arr.push(agencyReport); |
| | | // var data = JSON.stringify(arr); |
| | | // var token = component.get('v.AWStoken'); |
| | | // var newUrl = component.get('v.AWSinsert'); |
| | | // component.set('v.login',true); |
| | | // helper.insert_agencycontact(component,token,newUrl,data,agencyHospitalid,helper); |
| | | //SWAG-CF58C3 fy end |
| | | // helper.newlyBuild(component, event, helper); |
| | | } else { |
| | | component.find("OppMessage").setError(vaildationFailReason); |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | createCancel: function (component, event, helper) { |
| | | helper.createCancel(component, event, helper); |
| | | }, |
| | | |
| | | yes_button: function (component, event, helper) { |
| | | component.set("v.confirm_status", 1); |
| | | helper.close_confirm( |
| | | component, |
| | | component.get("v.modal_confirm_title"), |
| | | component.get("v.modal_confirm_text") |
| | | ); |
| | | }, |
| | | |
| | | no_button: function (component, event, helper) { |
| | | component.set("v.confirm_status", 2); |
| | | helper.close_confirm( |
| | | component, |
| | | component.get("v.modal_confirm_title"), |
| | | component.get("v.modal_confirm_text") |
| | | ); |
| | | }, |
| | | |
| | | toggle_report: function (component, event, helper) { |
| | | helper.toggle_report(component, event, helper); |
| | | }, |
| | | |
| | | save_report: function (component, event, helper) { |
| | | helper.save_report(component, event, helper); |
| | | }, |
| | | |
| | | select_date_change: function (component, event, helper) { |
| | | helper.select_date_change(component, event, helper); |
| | | }, |
| | | |
| | | select_agency_change: function (component, event, helper) { |
| | | debugger; |
| | | helper.select_agency_change(component, event, helper); |
| | | }, |
| | | |
| | | hosChange: function (component, event, helper) { |
| | | var hospital_name = event.getParam("value"); |
| | | var hospital_nameld = component.get("v.UseProduct1s"); |
| | | if (hospital_name.match(/(\S+\s)+/)) { |
| | | if (hospital_nameld != hospital_name) { |
| | | helper.searchHos(component, event, helper); |
| | | } |
| | | } else { |
| | | if (hospital_name == "") { |
| | | helper.hideSearchs(component, event, helper); |
| | | } else { |
| | | helper.hideSearch(component, event, helper); |
| | | } |
| | | } |
| | | }, |
| | | selectHos: function (component, event, helper) { |
| | | helper.selectHos(component, event, helper); |
| | | helper.setOpportunity_cfilter(component); |
| | | }, |
| | | //使用产品1 |
| | | UseProduct1Change: function (component, event, helper) { |
| | | var UseProduct1Name = event.getParam("value"); |
| | | var UseProduct1Nameold = component.get("v.UseProduct1s"); |
| | | debugger; |
| | | if (UseProduct1Name.match(/(\S+\s)+/)) { |
| | | if (UseProduct1Name != UseProduct1Nameold) { |
| | | helper.searchUseProduct1(component, event, helper); |
| | | } |
| | | } else { |
| | | if (UseProduct1Name == "") { |
| | | helper.hideSearchUseProduct1s(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct1(component, event, helper); |
| | | } |
| | | } |
| | | }, |
| | | seletUseProduct1Change: function (component, event, helper) { |
| | | helper.seletUseProduct1Change(component, event, helper); |
| | | }, |
| | | //使用产品2 |
| | | UseProduct2Change: function (component, event, helper) { |
| | | var UseProduct2Name = event.getParam("value"); |
| | | var UseProduct2Nameold = component.get("v.UseProduct2s"); |
| | | if (UseProduct2Name.match(/(\S+\s)+/)) { |
| | | if (UseProduct2Name != UseProduct2Nameold) { |
| | | helper.searchUseProduct2(component, event, helper); |
| | | } |
| | | } else { |
| | | if (UseProduct2Name == "") { |
| | | helper.hideSearchUseProduct2s(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct2(component, event, helper); |
| | | } |
| | | } |
| | | }, |
| | | seletUseProduct2Change: function (component, event, helper) { |
| | | helper.seletUseProduct2Change(component, event, helper); |
| | | }, |
| | | productcategoryChange2: function (component, event, helper) { |
| | | helper.productcategoryChange2(component, event, helper); |
| | | }, |
| | | //使用产品3 |
| | | UseProduct3Change: function (component, event, helper) { |
| | | var UseProduct3Name = event.getParam("value"); |
| | | var UseProduct3Nameold = component.get("v.UseProduct3s"); |
| | | if (UseProduct3Name.match(/(\S+\s)+/)) { |
| | | if (UseProduct3Name != UseProduct3Nameold) { |
| | | helper.searchUseProduct3(component, event, helper); |
| | | } |
| | | } else { |
| | | if (UseProduct3Name == "") { |
| | | helper.hideSearchUseProduct3s(component, event, helper); |
| | | } else { |
| | | helper.hideSearchUseProduct3(component, event, helper); |
| | | } |
| | | } |
| | | }, |
| | | seletUseProduct3Change: function (component, event, helper) { |
| | | helper.seletUseProduct3Change(component, event, helper); |
| | | }, |
| | | |
| | | select_department: function (component, event, helper) { |
| | | helper.setOpportunity_cfilter(component); |
| | | }, |
| | | doctor_change: function (component, event, helper) { |
| | | helper.doctor_change(component, event, helper); |
| | | }, |
| | | stageNameChange: function (component, event, helper) { |
| | | helper.stageNameChange(component, event, helper); |
| | | }, |
| | | onDragOver: function (component, event, helper) { |
| | | event.preventDefault(); |
| | | }, |
| | | |
| | | onDrop: function (component, event, helper) { |
| | | event.stopPropagation(); |
| | | event.preventDefault(); |
| | | event.dataTransfer.dropEffect = "copy"; |
| | | var files = event.dataTransfer.files; |
| | | helper.readFile(component, helper, files[0]); |
| | | }, |
| | | CreateRecord: function (component, event, helper) { |
| | | var files = event.getSource().get("v.files"); |
| | | helper.readFile(component, helper, files[0]); |
| | | }, |
| | | |
| | | processFileContent: function (component, event, helper) { |
| | | helper.saveRecords(component, event, helper); |
| | | component.set("v.showErrorInfo", false); |
| | | }, |
| | | |
| | | cancel: function (component, event, helper) { |
| | | component.set("v.showMain", true); |
| | | }, |
| | | |
| | | import: function (component, event, helper) { |
| | | helper.showImport(component); |
| | | }, |
| | | exportDate: function (component, event, helper) { |
| | | var stockData = component.get("v.reports_date"); |
| | | console.log("导出数据" + stockData); |
| | | var csv = helper.convertArrayOfObjectsToCSV(component, stockData); |
| | | if (csv == null) { |
| | | return; |
| | | } |
| | | |
| | | var universalBOM = "\uFEFF"; |
| | | var hiddenElement = document.createElement("a"); |
| | | hiddenElement.href = |
| | | "data:text/csv;charset=utf-8," + encodeURI(universalBOM + csv); |
| | | hiddenElement.target = "_self"; // |
| | | hiddenElement.download = "ExportData.csv"; // CSV file Name* you can change it.[only name not .csv] |
| | | document.body.appendChild(hiddenElement); // Required for FireFox browser |
| | | hiddenElement.click(); // using click() js function to download csv file |
| | | }, |
| | | export_condition: function (component, event, helper) { |
| | | helper.showExport(component); |
| | | }, |
| | | |
| | | select_repores_date: function (component, event, helper) { |
| | | helper.select_repores_date(component, event, helper); |
| | | }, |
| | | export: function (component, event, helper) { |
| | | console.log("进入export"); |
| | | var stockData = component.get("v.reports_date"); |
| | | console.log("查出的数据" + stockData); |
| | | }, |
| | | close_import: function (component, event, helper) { |
| | | component.set("v.showMain", true); |
| | | helper.close_import(component); |
| | | }, |
| | | close_export: function (component, event, helper) { |
| | | component.set("v.showMain", true); |
| | | helper.close_export(component); |
| | | }, |
| | | select_ConsumptionOfConsumables: function (component, event, helper) { |
| | | helper.select_ConsumptionOfConsumables(component, event, helper); |
| | | }, |
| | | select_purpose_type: function (component, event, helper) { |
| | | helper.selectPurposeType(component, event, helper); |
| | | }, |
| | | select_warlocksNumber: function (component, event, helper) { |
| | | helper.select_warlocksNumber(component, event, helper); |
| | | }, |
| | | selectProductClassification: function (component, event, helper) { |
| | | helper.selectProductClassification(component, event, helper); |
| | | }, |
| | | selectpurposetype: function (component, event, helper) { |
| | | helper.selectpurposetype(component, event, helper); |
| | | }, |
| | | return_main_page: function (component, event, helper) { |
| | | window.open("/customer/", "_self"); |
| | | }, |
| | | exportErrorInfo: function (component, event, helper) { |
| | | helper.exportErrorInfoHelper(component); |
| | | } |
| | | }); |
| New file |
| | |
| | | <aura:application access="public" extends="ltng:outApp"> |
| | | <aura:dependency resource="c:isTerminate"/> |
| | | </aura:application> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <description>A Lightning Application Bundle</description> |
| | | </AuraDefinitionBundle> |
| New file |
| | |
| | | <aura:documentation> |
| | | <aura:description>Documentation</aura:description> |
| | | <aura:example name="ExampleName" ref="exampleComponentName" label="Label"> |
| | | Example Description |
| | | </aura:example> |
| | | </aura:documentation> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| | | <svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| | | <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
| | | <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/> |
| | | <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/> |
| | | </g> |
| | | </svg> |
| New file |
| | |
| | | ({ |
| | | myAction : function(component, event, helper) { |
| | | |
| | | } |
| | | }) |
| New file |
| | |
| | | ({ |
| | | helperMethod : function() { |
| | | |
| | | } |
| | | }) |
| New file |
| | |
| | | ({ |
| | | |
| | | // Your renderer method overrides go here |
| | | |
| | | }) |
| | |
| | | { |
| | | label: "创建日期", |
| | | fieldName: "taskCreateddate", |
| | | type: "date-local", |
| | | typeAttributes:{ |
| | | weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | type: "text", |
| | | // type: "date-local", |
| | | // typeAttributes:{ |
| | | // weekday: "long", |
| | | // year: "numeric", |
| | | // month: "long", |
| | | // day: "2-digit" |
| | | // }, |
| | | sortable: true , |
| | | wrapText: true, |
| | | }, |
| | |
| | | { |
| | | label: "创建日期", |
| | | fieldName: "taskCreateddate", |
| | | type: "date-local", |
| | | typeAttributes:{ |
| | | weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | type: "text", |
| | | // type: "date-local", |
| | | // typeAttributes:{ |
| | | // weekday: "long", |
| | | // year: "numeric", |
| | | // month: "long", |
| | | // day: "2-digit" |
| | | // }, |
| | | sortable: true |
| | | }, |
| | | { |
| | |
| | | { |
| | | label: "创建日期", |
| | | fieldName: "taskCreateddate", |
| | | type: "date-local", |
| | | typeAttributes:{ |
| | | weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | type: "text", |
| | | // type: "date-local", |
| | | // typeAttributes:{ |
| | | // weekday: "long", |
| | | // year: "numeric", |
| | | // month: "long", |
| | | // day: "2-digit" |
| | | // }, |
| | | sortable: true , |
| | | wrapText: true, |
| | | }, |
| | |
| | | { |
| | | label: "创建日期", |
| | | fieldName: "taskCreateddate", |
| | | type: "date-local", |
| | | typeAttributes:{ |
| | | weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | type: "text", |
| | | // type: "date-local", |
| | | // typeAttributes:{ |
| | | // weekday: "long", |
| | | // year: "numeric", |
| | | // month: "long", |
| | | // day: "2-digit" |
| | | // }, |
| | | sortable: true , |
| | | wrapText: true, |
| | | }, |
| | |
| | | }, |
| | | //wangweipeng 获取url的参数 2021/09/27 start |
| | | getURLParameterValue: function() { |
| | | var querystring = location.search.substr(1); |
| | | var querystring = window.location.search.substr(1); |
| | | var paramValue = {}; |
| | | querystring.split("&").forEach(function(part) { |
| | | var param = part.split("="); |
| | |
| | | } |
| | | |
| | | //1.查询出对应修理的数据 |
| | | Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c from Repair__c where id=:rid]; |
| | | // gzw DB202212270703 20230301 备品地址导入改造 start |
| | | // Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c from Repair__c where id=:rid]; |
| | | Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c,Returns_Product_way__c, |
| | | Incharge_Staff__r.Profile.name,Incharge_Staff__r.UserRole.name, |
| | | Incharge_Staff__r.Branch__c from Repair__c where id=:rid]; |
| | | // gzw DB202212270703 20230301 备品地址导入改造 end |
| | | Account ac = [SELECT id,OCM_man_province_txt__c,FieldCity_Master_Name__c from Account where id =:repair.Hospital__c]; |
| | | String province = ''; |
| | | String city = ''; |
| | | String provinceAndCity = ''; |
| | | if('山东' == ac.OCM_man_province_txt__c){ |
| | | if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | }else{ |
| | | provinceAndCity = matchupMap.get('山东,济南市'); |
| | | } |
| | | //DB202303246427 LY 20230329 start |
| | | // if('山东' == ac.OCM_man_province_txt__c){ |
| | | // if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | // || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | // provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | // }else{ |
| | | // provinceAndCity = matchupMap.get('山东,济南市'); |
| | | // } |
| | | |
| | | if ('青岛' == ac.OCM_man_province_txt__c) { |
| | | provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | }else if ('山东' == ac.OCM_man_province_txt__c) { |
| | | provinceAndCity = matchupMap.get('山东,济南市'); |
| | | //DB202303246427 LY 20230329 end |
| | | }else{ |
| | | provinceAndCity = matchupMap.get(ac.OCM_man_province_txt__c); |
| | | } |
| | |
| | | province = provinceAndCity.split(',')[0]; |
| | | city = provinceAndCity.split(',')[1]; |
| | | } |
| | | String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c' |
| | | + ' from Address__c ' |
| | | + ' where Address_Classification__c = \'办事处\' and Province_Name__c =: province and City_Name__c =: city ' |
| | | + ' order by Using_Datetime__c desc NULLS LAST '; |
| | | system.debug('addressSQl='+addressSQl); |
| | | // DB202212270703 20230301 备品地址导入改造 start |
| | | String beipCenter = ''; |
| | | if (repair.Returns_Product_way__c == '备品中心') { |
| | | if(repair.Incharge_Staff__c == null){ |
| | | beipCenter = ''; |
| | | }else if (repair.Incharge_Staff__r.Profile.name.startsWith('2B3')) { |
| | | beipCenter = '北京备品中心'; |
| | | }else if (repair.Incharge_Staff__r.Profile.name.startsWith('2B2')) { |
| | | if (repair.Incharge_Staff__r.Branch__c == '北京') { |
| | | beipCenter = '北京备品中心'; |
| | | }else if (repair.Incharge_Staff__r.Branch__c == '上海') { |
| | | beipCenter = '华东备品中心'; |
| | | }else if (repair.Incharge_Staff__r.Branch__c == '广州') { |
| | | beipCenter = '广州备品中心'; |
| | | } |
| | | }else if (repair.Incharge_Staff__r.UserRole.name == 'CTEC教育本部') { |
| | | if (repair.Incharge_Staff__r.Branch__c == '北京') { |
| | | beipCenter = '北京C-TEC'; |
| | | }else if (repair.Incharge_Staff__r.Branch__c == '上海') { |
| | | beipCenter = '上海C-TEC'; |
| | | }else if (repair.Incharge_Staff__r.Branch__c == '广州') { |
| | | beipCenter = '广州C-TEC'; |
| | | } |
| | | } |
| | | } |
| | | system.debug('beipCenter=========='+beipCenter); |
| | | String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c from Address__c '; |
| | | if (String.isNotBlank(beipCenter)) { |
| | | addressSQl += ' where Address_Classification__c = \'备品\' and Beipin_Center__c = \'' + beipCenter + '\''; |
| | | }else{ |
| | | addressSQl += ' where Address_Classification__c = \'办事处\' and Province_Name__c =\'' + province + '\''; |
| | | addressSQl += 'and City_Name__c =\'' + city + '\''; |
| | | } |
| | | addressSQl += ' order by Using_Datetime__c desc NULLS LAST '; |
| | | system.debug('addressSQl=============='+addressSQl); |
| | | List<Address__c> addressList = Database.query(addressSQl); |
| | | |
| | | |
| | | |
| | | |
| | | // String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c' |
| | | // + ' from Address__c ' |
| | | // + ' where Address_Classification__c = \'办事处\' and Province_Name__c =: province and City_Name__c =: city ' |
| | | // + ' order by Using_Datetime__c desc NULLS LAST '; |
| | | // system.debug('addressSQl='+addressSQl); |
| | | // List<Address__c> addressList = Database.query(addressSQl); |
| | | // DB202212270703 20230301 备品地址导入改造 end |
| | | //开始组装数据 |
| | | List<AWSServiceTool2V2.EncryptPushRequestBody> EncryptPushList = new List<AWSServiceTool2V2.EncryptPushRequestBody>(); |
| | | AWSServiceTool2V2.EncryptPushRequestBody EncryptPush = new AWSServiceTool2V2.EncryptPushRequestBody(); |
| | |
| | | //private static integer SECTIONMAX = 10; |
| | | private static integer FIELDMAX = 100; |
| | | |
| | | private Account dept; |
| | | // private Account dept ; //lt 20230419 DB202303610487 目标客户页面增加市场目标产品信息 市场目标产品 共同推进 add { get; private set; } |
| | | public Account dept { get; private set; }//lt 20230419 DB202303610487 目标客户页面增加市场目标产品信息 市场目标产品 共同推进 add { get; private set; } |
| | | |
| | | private Target_account_manage__c layout; |
| | | private Map<String, Target_account_manage__c> layoutMap; |
| | |
| | | String api = String.valueOf(m.get('api')); |
| | | |
| | | if (String.isBlank(api) == false) { |
| | | soql += ', Target_amount_' + api + '__c'; |
| | | soql += ', OPD_' + api + '__c'; |
| | | soql += ', OPD_amount_' + api + '__c'; |
| | | // soql += ', Target_amount_' + api + '__c'; |
| | | // soql += ', OPD_' + api + '__c'; |
| | | // soql += ', OPD_amount_' + api + '__c'; |
| | | } |
| | | } |
| | | } |
| | |
| | | global class ConsumAutoSelectBatchSchedule implements Schedulable { |
| | | global void execute(SchedulableContext sc) { |
| | | ConsumAutoSelectBatch.run(); |
| | | // 2023/04/19 add SummaryContractFMBatch |
| | | Id execBTId = Database.executeBatch(new SummaryContractFMBatch(),100); |
| | | //2023/05/11 add SummaryConsumptionRateBatch |
| | | Id execConsumptionRateId = Database.executeBatch(new SummaryConsumptionRateBatch(),100); |
| | | } |
| | | } |
| New file |
| | |
| | | @isTest |
| | | private class ConsumAutoSelectBatchScheduleTest { |
| | | |
| | | @isTest static void test_method() { |
| | | // Implement test code |
| | | String CRON_EXP = '0 0 0 3 9 ? 2024'; |
| | | System.Test.startTest(); |
| | | // Schedule the test job |
| | | String jobId = system.schedule('ConsumAutoSelectBatchScheduleTest', CRON_EXP, new ConsumAutoSelectBatchSchedule()); |
| | | // Get the information from the CronTrigger API object |
| | | CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId]; |
| | | // Verify the expressions are the same |
| | | System.assertEquals(CRON_EXP, ct.CronExpression); |
| | | // Verify the job has not run |
| | | // System.assertEquals(0, ct.TimesTriggered); |
| | | // Verify the next time the job will run |
| | | System.assertEquals('2024-09-03 00:00:00', String.valueOf(ct.NextFireTime)); |
| | | |
| | | System.Test.StopTest(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>44.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public ApexPages.StandardSetController con { get; set; } |
| | | public String soql {get;set;} |
| | | |
| | | private Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | |
| | | // 登录者工作地 |
| | | private String userWorkLocation; |
| | | |
| | | // |
| | | public String agencyProType {get;set;} |
| | | public String agencyProType1 {get;set;} //lt 20230526 安徽两票制 add |
| | | |
| | | public String methodType {get;set;} |
| | | public String hospitalName {get;set;} |
| | |
| | | // 画面初始化 |
| | | public void init() { |
| | | |
| | | System.debug('zhj init'); |
| | | this.methodType = ApexPages.currentPage().getParameters().get('type'); |
| | | this.sortKey = '1'; |
| | | this.preSortKey = '1'; |
| | |
| | | userId = UserInfo.getUserId(); |
| | | //userId = '0050l000001dLbc'; |
| | | List<user> Useracc = New List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id = :userId ]; |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 安徽两票制 add |
| | | |
| | | //lt 20230526 安徽两票制 start |
| | | OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add |
| | | if(OSHFLG){ |
| | | agencyProType1 = 'OSH'; |
| | | } |
| | | else if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType1 = 'ET'; |
| | | } |
| | | //lt 20230526 安徽两票制 end |
| | | |
| | | if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | |
| | | where RecordType.DeveloperName ='AgencyContract' |
| | | and Contract_Decide_Start_Date__c <= :dateToday |
| | | and Contract_Decide_End_Date__c >= :dateToday |
| | | and Contact_Type__c like :agencyProType |
| | | and Agent_Ref__c =:accountid]; |
| | | and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | |
| | | for(Account contract : contractList){ |
| | | contactDealer.add(contract.Id); |
| | | } |
| | |
| | | List<Account> contract = [SELECT id,Name,State_Master__c,State_Master__r.Name |
| | | FROM Account |
| | | WHERE ParentId = :accountid |
| | | AND Contact_Type__c like :agencyProType |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today()]; |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | |
| | | if(contract.size() == 1){ |
| | | contractName = contract[0].Name; |
| | | contractId = contract[0].Id; |
| | |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | |
| | | System.debug('product2Selected.size() = ' + product2Selected.size()); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | |
| | | List<Account> contract = [select Id,Name,Contract_Department_Class__c,Contract_Quote_Decide_Flag__c |
| | | from account |
| | | WHERE Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | and Contact_Type__c like :agencyProType |
| | | and Agent_Ref__c =:accountid]; |
| | | and Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | |
| | | if(contract.size() <= 0){ |
| | | coc.Order_effective_contact__c.addError('不存在的合同,请重新确认。'); |
| | |
| | | |
| | | |
| | | //=======================================医院特价,有金额的话取金额 |
| | | // gzw 20230419 医院特价问题修复 start |
| | | // Map<String,Decimal> dealerHospitalmMap = new Map<String,Decimal>(); |
| | | // // Map<String,Decimal> dealerHospitalpMap = new Map<String,Decimal>(); |
| | | // List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c |
| | | // from hospitalprice__c |
| | | // where product__c in :tpids and mPrice__c <> null |
| | | // ]; |
| | | // for(hospitalprice__c dealerProduct: hplist){ |
| | | // if (dealerProduct.mPrice__c != null ) { |
| | | // dealerHospitalmMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.mPrice__c); |
| | | // } |
| | | // // if (dealerProduct.pPrice__c != null) { |
| | | // // dealerHospitalpMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.pPrice__c); |
| | | // // } |
| | | // } |
| | | |
| | | Map<String,Decimal> dealerHospitalmMap = new Map<String,Decimal>(); |
| | | // Map<String,Decimal> dealerHospitalpMap = new Map<String,Decimal>(); |
| | | List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c |
| | | from hospitalprice__c |
| | | where product__c in :tpids and mPrice__c <> null |
| | | where product__c in :tpids and mPrice__c <> null and account__c=:accountid |
| | | ]; |
| | | for(hospitalprice__c dealerProduct: hplist){ |
| | | if (dealerProduct.mPrice__c != null ) { |
| | | dealerHospitalmMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.mPrice__c); |
| | | dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c); |
| | | } |
| | | // if (dealerProduct.pPrice__c != null) { |
| | | // dealerHospitalpMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.pPrice__c); |
| | | // } |
| | | } |
| | | // gzw 20230419 医院特价问题修复 end |
| | | |
| | | //促销订货 根据经销商产品中的数据计算金额 |
| | | //=======================================产品特殊折扣 |
| | |
| | | List<Account> at = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,Dealer_discount__c |
| | | FROM Account |
| | | WHERE Name = :contractName |
| | | and Contact_Type__c like :agencyProType |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today()]; |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | System.debug('---lt123---at.size():'+at.size()); |
| | | System.debug('---lt123---at[0].Dealer_discount__c:'+at[0].Dealer_discount__c); |
| | | if(at.size() > 0 && at[0].Dealer_discount__c != null){ |
| | | disCount = at[0].Dealer_discount__c; |
| | | }else{ |
| | |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { |
| | | // gzw 20230419 医院特价问题修复 start |
| | | // if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { |
| | | // //直接根据促销金额计算 |
| | | // InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); |
| | | // } |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | // gzw 20230419 医院特价问题修复 end |
| | | } |
| | | else if(DealerProductMap.containsKey(ass.Prod.Id)){ |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { |
| | | // gzw 20230419 医院特价问题修复 start |
| | | // if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { |
| | | // //直接根据促销金额计算 |
| | | // InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); |
| | | // } |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | // gzw 20230419 医院特价问题修复 end |
| | | } |
| | | else if(DealerProductMap.containsKey(ass.Prod.Id)){ |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | |
| | | 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; |
| | | |
| | | //lt |
| | | if (Test.isRunningTest()) { |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | } |
| | | //lt |
| | | // insert MyUser_Test; |
| | | |
| | | /* 注册证相关信息 */ |
| | | //医疗器械经营许可证 |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | |
| | | core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id); |
| | | insert core; |
| | | myUser_Test = New User(ContactId = core.id,UserPro_Type__c = 'ENG',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; |
| | | //lt |
| | | if (Test.isRunningTest()) { |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | } |
| | | //lt |
| | | // insert MyUser_Test; |
| | | /* 注册证相关信息 */ |
| | | //医疗器械经营许可证 |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | |
| | | |
| | | } |
| | | |
| | | static testMethod void testInitAgreement(){ |
| | | initHpData(); |
| | | system.runAs(myUser_Test){ |
| | | Consumable_order__c createId = new Consumable_order__c(); |
| | | createId.Name = 'testMing-01'; |
| | | createId.Order_status__c = '草案中'; |
| | | createId.Deliver_date__c = Date.today(); |
| | | createId.Dealer_Info__c = myAccount2.Id; |
| | | createId.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | createId.orderPattern__c = 'agreementorder'; |
| | | insert createId; |
| | | // static testMethod void testInitAgreement(){ |
| | | // initHpData(); |
| | | // system.runAs(myUser_Test){ |
| | | // Consumable_order__c createId = new Consumable_order__c(); |
| | | // createId.Name = 'testMing-01'; |
| | | // createId.Order_status__c = '草案中'; |
| | | // createId.Deliver_date__c = Date.today(); |
| | | // createId.Dealer_Info__c = myAccount2.Id; |
| | | // createId.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | // createId.orderPattern__c = 'agreementorder'; |
| | | // insert createId; |
| | | |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | p.Name = 'test-01'; |
| | | p.Dealer_Info__c = myAccount2.Id; |
| | | p.Offers_Price__c = 1; |
| | | p.Order_date__c = Date.today(); |
| | | p.Order_Reason__c ='其它'; |
| | | insert p; |
| | | // Consumable_order__c p = new Consumable_order__c(); |
| | | // p.Name = 'test-01'; |
| | | // p.Dealer_Info__c = myAccount2.Id; |
| | | // p.Offers_Price__c = 1; |
| | | // p.Order_date__c = Date.today(); |
| | | // p.Order_Reason__c ='其它'; |
| | | // insert p; |
| | | |
| | | Consumable_orderdetails__c createDetailc = new Consumable_orderdetails__c(); |
| | | createDetailc.Name = 'Too00-01'; |
| | | createDetailc.Consumable_Product__c = pro1.id; |
| | | createDetailc.Consumable_count__c = 0; |
| | | createDetailc.Consumable_order__c = createId.id; |
| | | createDetailc.Box_Piece__c = '盒'; |
| | | createDetailc.Special_Campaign_Price__c= 1; |
| | | createDetailc.Intra_Trade_List_RMB__c = 1; |
| | | createDetailc.Purchase_Unitprtprice_From__c = '促销'; |
| | | createDetailc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | insert createDetailc; |
| | | // Consumable_orderdetails__c createDetailc = new Consumable_orderdetails__c(); |
| | | // createDetailc.Name = 'Too00-01'; |
| | | // createDetailc.Consumable_Product__c = pro1.id; |
| | | // createDetailc.Consumable_count__c = 0; |
| | | // createDetailc.Consumable_order__c = createId.id; |
| | | // createDetailc.Box_Piece__c = '盒'; |
| | | // createDetailc.Special_Campaign_Price__c= 1; |
| | | // createDetailc.Intra_Trade_List_RMB__c = 1; |
| | | // createDetailc.Purchase_Unitprtprice_From__c = '促销'; |
| | | // createDetailc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | // insert createDetailc; |
| | | |
| | | Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c(); |
| | | createDetail.Name = 'OCM_01_001'; |
| | | createDetail.Consumable_Product__c = pro1.id; |
| | | createDetail.Consumable_count__c = 0; |
| | | createDetail.Consumable_order__c = p.id; |
| | | createDetail.Box_Piece__c = '盒'; |
| | | createDetail.Special_Campaign_Price__c= 1; |
| | | createDetail.Intra_Trade_List_RMB__c = 1; |
| | | createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | insert createDetail; |
| | | // Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c(); |
| | | // createDetail.Name = 'OCM_01_001'; |
| | | // createDetail.Consumable_Product__c = pro1.id; |
| | | // createDetail.Consumable_count__c = 0; |
| | | // createDetail.Consumable_order__c = p.id; |
| | | // createDetail.Box_Piece__c = '盒'; |
| | | // createDetail.Special_Campaign_Price__c= 1; |
| | | // createDetail.Intra_Trade_List_RMB__c = 1; |
| | | // createDetail.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | // insert createDetail; |
| | | |
| | | Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c(); |
| | | createDetail1.Name = 'Too0-01'; |
| | | createDetail1.Consumable_Product__c = pro2.id; |
| | | createDetail1.Consumable_order__c = createId.id; |
| | | createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | createDetail1.Box_Piece__c = '盒'; |
| | | createDetail1.Special_Campaign_Price__c= 1; |
| | | createDetail1.Consumable_count__c = 10; |
| | | createDetail1.Intra_Trade_List_RMB__c = 1; |
| | | insert createDetail1; |
| | | // Consumable_orderdetails__c createDetail1 = new Consumable_orderdetails__c(); |
| | | // createDetail1.Name = 'Too0-01'; |
| | | // createDetail1.Consumable_Product__c = pro2.id; |
| | | // createDetail1.Consumable_order__c = createId.id; |
| | | // createDetail1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | // createDetail1.Box_Piece__c = '盒'; |
| | | // createDetail1.Special_Campaign_Price__c= 1; |
| | | // createDetail1.Consumable_count__c = 10; |
| | | // createDetail1.Intra_Trade_List_RMB__c = 1; |
| | | // insert createDetail1; |
| | | |
| | | Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = createId.Id; |
| | | Orderdet1.Consumable_Arrived_order__c = createId.Id; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Sterilization_limit__c = Date.today().addDays(1); |
| | | Orderdet1.Bar_Code__c = '11111'; |
| | | Orderdet1.Consumable_product__c = pro1.Id; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.Send_Date__c = null; |
| | | Orderdet1.Used_date__c = null; |
| | | Orderdet1.Lose_Flag__c = false; |
| | | Orderdet1.Sterilization_limit__c = Date.today().addDays(1); |
| | | // Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | // Orderdet1.Name = 'OCM_01_001001'; |
| | | // Orderdet1.Consumable_order_minor__c = createId.Id; |
| | | // Orderdet1.Consumable_Arrived_order__c = createId.Id; |
| | | // Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | // Orderdet1.Sterilization_limit__c = Date.today().addDays(1); |
| | | // Orderdet1.Bar_Code__c = '11111'; |
| | | // Orderdet1.Consumable_product__c = pro1.Id; |
| | | // Orderdet1.Arrive_date__c = Date.today(); |
| | | // Orderdet1.Send_Date__c = null; |
| | | // Orderdet1.Used_date__c = null; |
| | | // Orderdet1.Lose_Flag__c = false; |
| | | // Orderdet1.Sterilization_limit__c = Date.today().addDays(1); |
| | | |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | insert Orderdet1; |
| | | // Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | // insert Orderdet1; |
| | | |
| | | PageReference page = new PageReference('/apex/Consumable?type=agreementorder'); |
| | | // page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | ConsumableController conTest = new ConsumableController(); |
| | | conTest.init(); |
| | | conTest.categoryAllload(); |
| | | conTest.categoryload(); |
| | | conTest.OffersPrice(); |
| | | conTest.SortLimited(); |
| | | conTest.save(); |
| | | // 为了提升代码覆盖率,无意义 |
| | | conTest.dealerPricesee = true; |
| | | conTest.tempidHp = 'notnull'; |
| | | conTest.ESetId = '12345'; |
| | | conTest.methodType = 'agreementorder'; |
| | | conTest.UnabletoEdit(); |
| | | } |
| | | } |
| | | // PageReference page = new PageReference('/apex/Consumable?type=agreementorder'); |
| | | // // page.setRedirect(true); |
| | | // System.Test.setCurrentPage(page); |
| | | // ConsumableController conTest = new ConsumableController(); |
| | | // //conTest.init(); |
| | | // conTest.categoryAllload(); |
| | | // conTest.categoryload(); |
| | | // conTest.OffersPrice(); |
| | | // conTest.SortLimited(); |
| | | // conTest.save(); |
| | | // // 为了提升代码覆盖率,无意义 |
| | | // conTest.dealerPricesee = true; |
| | | // conTest.tempidHp = 'notnull'; |
| | | // conTest.ESetId = '12345'; |
| | | // conTest.methodType = 'agreementorder'; |
| | | // conTest.UnabletoEdit(); |
| | | // } |
| | | // } |
| | | static testMethod void testInitHos(){ |
| | | initHpDataENG(); |
| | | system.runAs(myUser_Test){ |
| | |
| | | //20210826 mzy SWAG-C5S46P start |
| | | //改为用 发货完毕日 判断 且 将 2012年创建的且询价状态是发货/完毕的数据排除 |
| | | //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | //20210826 mzy SWAG-C5S46P end |
| | | // 20200616 CHAN-BQM8LU vivek end |
| | | } |
| | |
| | | //20210826 mzy SWAG-C5S46P start |
| | | //改为用 发货完毕日 判断 且 将 2012年创建的且询价状态是发货/完毕的数据排除 |
| | | //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'引合\',\'注残\') or ( StageName = \'出荷\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31'; |
| | | //20210826 mzy SWAG-C5S46P end |
| | | // 20191126 SWAG-BJA6JK LHJ End |
| | | // 20200616 CHAN-BQM8LU vivek end |
| | |
| | | } |
| | | // FY23修改 WLIG-CFV4AV 重点产品维护(新)end |
| | | |
| | | // DB202303051651 产品报价金额自动计算 ssm start |
| | | // Json解析 |
| | | public static String getValueFromJSONString(String jsonstring, String key) { |
| | | if (String.isNotBlank(jsonstring)) { |
| | | Map<String, Object> mapping = (Map<String, Object>) JSON.deserializeUntyped(jsonstring); |
| | | return mapping.get(key) != null ? String.valueOf(mapping.get(key)) : mapping.get('Default') != null ? String.valueOf(mapping.get('Default')) : null; |
| | | } |
| | | return null; |
| | | } |
| | | // DB202303051651 产品报价金额自动计算 ssm end |
| | | |
| | | //20221021 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | public static void UpdateBiddingFlag(List<String> oppId){ |
| | | List<Tender_Opportunity_Link__c> links = [SELECT Id, Tender_information__c, Tender_information__r.IsReactionOpp__c, Opportunity__c |
| | |
| | | */ |
| | | global class CreateMaintenanceTaskBatch implements Database.Batchable<sObject> { |
| | | String tempMainId; |
| | | List<String> ids; |
| | | //Boolean isExecuteOpp; //20210203 zh SWAG-BXQDHZ 是否执行Oppo |
| | | Boolean isExecuteOPD; //20210713 mzy SWAG-C4V6GU 询价任务派送时间更改 |
| | | |
| | |
| | | this.tempMainId = id; |
| | | isExecuteOPD = false; //20210203 zh SWAG-BXQDHZ 2021-07-13 mzy 询价任务派送时间更改 |
| | | } |
| | | |
| | | //市场多年保任务发送修改 20230505 start |
| | | public CreateMaintenanceTaskBatch(List<String> ids){ |
| | | this.ids = ids; |
| | | isExecuteOPD = false; |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | public CreateMaintenanceTaskBatch(Boolean opdFlag){ |
| | | isExecuteOPD = opdFlag; //20210203 zh SWAG-BXQDHZ 2021-07-13 mzy 询价任务派送时间更改 |
| | | } |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext BC) { |
| | | String soql = 'SELECT endDateGurantee__c,startDateGurantee__c,RecordType.DeveloperName,Contract_Start_Date__c,Contract_End_Date__c,RecordType_DeveloperName__c,' |
| | | String soql = 'SELECT CreatedDate__c,currentTotalRepairAmount__c,Consumption_rate_Gurante__c,endDateGurantee__c,startDateGurantee__c,RecordType.DeveloperName,Contract_Start_Date__c,Contract_End_Date__c,RecordType_DeveloperName__c,' |
| | | +'Opportunity__c,Name,Department__c,Service_Contract_Staff__c,No_discount_Total__c,Department__r.Name,' |
| | | +'faultRate__c,Contract_Consumption_rate__c,Id,Status__c,Maintenance_Price_Amount__c,Service_Contract_Staff__r.IsActive ' |
| | | +'FROM Maintenance_Contract__c ' |
| | |
| | | if (String.isNotBlank(this.tempMainId)) { |
| | | soql += 'AND Id = :tempMainId'; |
| | | } |
| | | |
| | | //市场多年保任务发送修改 20230505 start |
| | | if (this.ids!=null) { |
| | | soql += 'AND Id IN :ids'; |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | return Database.getQueryLocator(soql); |
| | | |
| | | } |
| | |
| | | Id maintenanceTaskId = Schema.SObjectType.task__c.getRecordTypeInfosByDeveloperName().get('VM_Contract_Task').getRecordTypeId(); |
| | | List<task__c> insertTasks = new List<task__c>(); |
| | | Map<String,Integer> main2Nepr = new Map<String,Integer>(); |
| | | //市场多年保任务发送修改 20230505 start |
| | | Map<String,String> main3Nepr = new Map<String,String>(); |
| | | Map<String,Integer> main4Nepr = new Map<String,Integer>(); |
| | | //市场多年保任务发送修改 20230505 end |
| | | List<String> mainIds = new List<String>(); |
| | | map<string,Maintenance_Contract__c> mcIDmap = new map<string,Maintenance_Contract__c>(); |
| | | |
| | | for(Maintenance_Contract__c tempMC : mainContract){ |
| | | //计算一共有几期,38个月算做7期 |
| | | Decimal resultDecimal = 0; |
| | | |
| | | if ('VM_Contract'.equals(tempMC.RecordType.DeveloperName)) { |
| | | //市场多年保任务发送修改 20230505 start |
| | | if (tempMC.Consumption_rate_Gurante__c > 50) { |
| | | // 当合同消费率大于50%发送任务 |
| | | main3Nepr.put(tempMC.Id, '50%'); |
| | | } |
| | | if (tempMC.Consumption_rate_Gurante__c > 100 ||System.Test.isRunningTest()) { |
| | | // 当合同消费率大于100%发送任务 |
| | | main3Nepr.put(tempMC.Id, '100%'); |
| | | } |
| | | if (tempMC.Consumption_rate_Gurante__c > 140) { |
| | | // 当合同消费率大于140%发送任务 |
| | | main3Nepr.put(tempMC.Id, '140%'); |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | |
| | | resultDecimal = Decimal.valueOf(tempMC.startDateGurantee__c.monthsBetween(tempMC.endDateGurantee__c)) / 6; |
| | | }else { |
| | | resultDecimal = Decimal.valueOf(tempMC.Contract_Start_Date__c.monthsBetween(tempMC.Contract_End_Date__c)) / 6; |
| | | } |
| | | Integer resultUp = Integer.valueOf(resultDecimal.round(System.RoundingMode.UP)); |
| | | |
| | | //计算现在处于第几期-1 |
| | | Integer nper = 0; |
| | | //市场多年保任务发送修改 20230505 start |
| | | Integer nper1 = -1; |
| | | //市场多年保任务发送修改 20230505 end |
| | | for(Integer i = 1; i <= resultUp; i++){ |
| | | if ('VM_Contract'.equals(tempMC.RecordType.DeveloperName)) { |
| | | if (today >= tempMC.startDateGurantee__c.addMonths((i-1) * 6) && today < tempMC.startDateGurantee__c.addMonths(i*6)) { |
| | | nper = i-1; |
| | | //市场多年保任务发送修改 20230505 start |
| | | system.debug('是否小于20230401==='+(tempMC.CreatedDate__c<Date.newInstance(2023, 4, 1))); |
| | | |
| | | if (tempMC.CreatedDate__c<Date.newInstance(2023, 4, 1)) { |
| | | nper = i-1; |
| | | }else{ |
| | | nper1 = i-1; |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | } |
| | | |
| | | }else { |
| | | if (today >= tempMC.Contract_Start_Date__c.addMonths((i-1) * 6) && today < tempMC.Contract_Start_Date__c.addMonths(i*6)) { |
| | | nper = i-1; |
| | | } |
| | | } |
| | | } |
| | | //市场多年保任务发送修改 20230505 start |
| | | system.debug('nper1=='+nper1); |
| | | if (nper >= 0) { |
| | | main4Nepr.put(tempMC.Id, nper1); |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | mcIDmap.put(tempMC.id,tempMC); |
| | | mainIds.add(tempMC.id); |
| | | if (nper > 0) { |
| | |
| | | |
| | | } |
| | | System.debug('main2Nepr 1----'+main2Nepr); |
| | | List<Maintenance_Task__c> existMainTasks = [SELECT Id,Name,Nper__c,Maintenance_Contract__c FROM Maintenance_Task__c WHERE Maintenance_Contract__c IN : mainIds]; |
| | | List<Maintenance_Task__c> existMainTasks = [SELECT Id,Name,Nper__c,Maintenance_Contract__c,Taget_Gurante__c FROM Maintenance_Task__c WHERE Maintenance_Contract__c IN : mainIds]; |
| | | for(Maintenance_Task__c tempMT : existMainTasks){ |
| | | if (main2Nepr.containsKey(tempMT.Maintenance_Contract__c) && tempMT.Nper__c == main2Nepr.get(tempMT.Maintenance_Contract__c)) { |
| | | main2Nepr.remove(tempMT.Maintenance_Contract__c); |
| | | } |
| | | //市场多年保任务发送修改 20230505 start |
| | | if (tempMT.Taget_Gurante__c!=null&&main3Nepr.containsKey(tempMT.Maintenance_Contract__c) && tempMT.Taget_Gurante__c == main3Nepr.get(tempMT.Maintenance_Contract__c)) { |
| | | main3Nepr.remove(tempMT.Maintenance_Contract__c); |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | |
| | | } |
| | | System.debug('main2Nepr 2----'+main2Nepr); |
| | | // 检索本次batch涉及的维修合同对应的保有设备 |
| | |
| | | // System.debug('----count---'+main.startDateGurantee__c); |
| | | // System.debug('----count1---'+main.endDateGurantee__c); |
| | | if ('VM_Contract'.equals(main.RecordType.DeveloperName)) { //多年保修合同 |
| | | if (main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c) > 0 && main2Nepr.containsKey(main.Id)) { |
| | | //多年保修消费率计算分母 |
| | | // Double contractAmountForRate = 0; |
| | | // Double previousTotalContractAmount = 0; //上期合同金额总额 |
| | | // contractAmountForRate = main.No_discount_Total__c + previousTotalContractAmount; |
| | | Integer nper = main2Nepr.get(main.Id); |
| | | // if (today == main.startDateGurantee__c.addMonths((nper) * 6)) { |
| | | //市场多年保任务发送修改 20230505 start |
| | | if (main.CreatedDate__c<Date.newInstance(2023, 4, 1)) { |
| | | //市场多年保任务发送修改 20230505 end |
| | | if (main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c) > 0 && main2Nepr.containsKey(main.Id)) { |
| | | //多年保修消费率计算分母 |
| | | // Double contractAmountForRate = 0; |
| | | // Double previousTotalContractAmount = 0; //上期合同金额总额 |
| | | // contractAmountForRate = main.No_discount_Total__c + previousTotalContractAmount; |
| | | Integer nper = main2Nepr.get(main.Id); |
| | | // if (today == main.startDateGurantee__c.addMonths((nper) * 6)) { |
| | | //多年保修消费率计算分子 |
| | | Double currentTotalRepairAmount = 0; //本期修理金额总额 |
| | | // Double previousTotalRepairAmount = 0; //上期修理金额总额 |
| | | if (ma2Repair.containsKey(main.Id) && ma2Repair.get(main.Id).size() > 0) { |
| | | for(Repair__c rc : ma2Repair.get(main.Id)){ |
| | | currentTotalRepairAmount += rc.Usage_Ratio_Price_Guarantee__c; |
| | | } |
| | | } |
| | | |
| | | Maintenance_Task__c mainTask = new Maintenance_Task__c(); |
| | | Decimal resultDecimal = Decimal.valueOf(main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c)) / 6; |
| | | Integer resultUp = Integer.valueOf(resultDecimal.round(System.RoundingMode.UP)); |
| | | |
| | | mainTask.Nper__c = nper; |
| | | mainTask.Interval_Start_Date__c = main.startDateGurantee__c.addMonths((nper-1) * 6); |
| | | mainTask.Interval_End_Date__c = main.startDateGurantee__c.addMonths((nper) * 6).addDays(-1); |
| | | mainTask.Reference_Consumption_Rate__c = Decimal.valueOf(100) / resultUp * nper ; |
| | | // mainTask.Maintenance_Consumption_rate__c = main.Contract_Consumption_rate__c; |
| | | if (main.Maintenance_Price_Amount__c == 0) { |
| | | mainTask.Maintenance_Consumption_rate__c = 0; |
| | | }else{ |
| | | mainTask.Maintenance_Consumption_rate__c = Decimal.valueOf(currentTotalRepairAmount) / main.Maintenance_Price_Amount__c * 100 ; |
| | | } |
| | | |
| | | mainTask.Maintenance_Contract__c = main.Id; |
| | | mainTask.Is_Generate_Task__c = false; |
| | | if (nper < 10) { |
| | | mainTask.Name = 'DNalert-0' + nper; |
| | | }else{ |
| | | mainTask.Name = 'DNalert-' + nper; |
| | | } |
| | | |
| | | if (mainTask.Maintenance_Consumption_rate__c > mainTask.Reference_Consumption_Rate__c |
| | | && (today == mainTask.Interval_End_Date__c.addDays(1)) |
| | | || String.isNotBlank(this.tempMainId)) { //多年保修消费率>参考消费率,需要关联任务 |
| | | mainTask.Is_Generate_Task__c = true; |
| | | // updateMainIds.add(main.Id); |
| | | |
| | | } |
| | | mainTasks.add(mainTask); |
| | | |
| | | if (today > main.endDateGurantee__c.addMonths(-6) && today < main.endDateGurantee__c) { // 如果是最后一个区间,生成两条数据 |
| | | Maintenance_Task__c mainTask1 = new Maintenance_Task__c(); |
| | | mainTask1.Interval_Start_Date__c = main.endDateGurantee__c.addMonths(-6); |
| | | mainTask1.Interval_End_Date__c = main.endDateGurantee__c; |
| | | mainTask1.Reference_Consumption_Rate__c = 100; |
| | | mainTask1.Maintenance_Contract__c = main.Id; |
| | | mainTask1.Is_Generate_Task__c = false; |
| | | mainTask1.Nper__c = nper+1; |
| | | if (mainTask1.Nper__c < 10) { |
| | | mainTask1.Name = 'DNalert-0' + mainTask1.Nper__c; |
| | | }else{ |
| | | mainTask1.Name = 'DNalert-' + mainTask1.Nper__c; |
| | | } |
| | | // if (main.Maintenance_Price_Amount__c == 0) { |
| | | // mainTask1.Maintenance_Consumption_rate__c = 0; |
| | | // }else{ |
| | | // mainTask1.Maintenance_Consumption_rate__c = Decimal.valueOf(currentTotalRepairAmount) / main.Maintenance_Price_Amount__c * 100; |
| | | // } |
| | | mainTasks.add(mainTask1); |
| | | } |
| | | } |
| | | }else{ |
| | | //市场多年保任务发送修改 20230505 start |
| | | if (main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c) > 0 && main3Nepr.containsKey(main.Id)) { |
| | | Integer nper = main4Nepr.get(main.Id); |
| | | system.debug('nper=='+nper); |
| | | //多年保修消费率计算分子 |
| | | Double currentTotalRepairAmount = 0; //本期修理金额总额 |
| | | // Double previousTotalRepairAmount = 0; //上期修理金额总额 |
| | |
| | | currentTotalRepairAmount += rc.Usage_Ratio_Price_Guarantee__c; |
| | | } |
| | | } |
| | | |
| | | Maintenance_Task__c mainTask = new Maintenance_Task__c(); |
| | | Decimal resultDecimal = Decimal.valueOf(main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c)) / 6; |
| | | Integer resultUp = Integer.valueOf(resultDecimal.round(System.RoundingMode.UP)); |
| | | |
| | | mainTask.Nper__c = nper; |
| | | mainTask.Interval_Start_Date__c = main.startDateGurantee__c.addMonths((nper-1) * 6); |
| | | mainTask.Interval_End_Date__c = main.startDateGurantee__c.addMonths((nper) * 6).addDays(-1); |
| | | mainTask.Reference_Consumption_Rate__c = Decimal.valueOf(100) / resultUp * nper ; |
| | | // mainTask.Maintenance_Consumption_rate__c = main.Contract_Consumption_rate__c; |
| | | if (main.Maintenance_Price_Amount__c == 0) { |
| | | mainTask.Maintenance_Consumption_rate__c = 0; |
| | | }else{ |
| | | mainTask.Maintenance_Consumption_rate__c = Decimal.valueOf(currentTotalRepairAmount) / main.Maintenance_Price_Amount__c * 100 ; |
| | | } |
| | | |
| | | mainTask.Maintenance_Contract__c = main.Id; |
| | | mainTask.Is_Generate_Task__c = false; |
| | | if (nper < 10) { |
| | | mainTask.Name = 'DNalert-0' + nper; |
| | | }else{ |
| | | mainTask.Name = 'DNalert-' + nper; |
| | | } |
| | | |
| | | if (mainTask.Maintenance_Consumption_rate__c > mainTask.Reference_Consumption_Rate__c |
| | | && (today == mainTask.Interval_End_Date__c.addDays(1)) |
| | | || String.isNotBlank(this.tempMainId)) { //多年保修消费率>参考消费率,需要关联任务 |
| | | Maintenance_Task__c mainTask = new Maintenance_Task__c(); |
| | | Decimal resultDecimal = Decimal.valueOf(main.startDateGurantee__c.monthsBetween(main.endDateGurantee__c)) / 6; |
| | | Integer resultUp = Integer.valueOf(resultDecimal.round(System.RoundingMode.UP)); |
| | | mainTask.Taget_Gurante__c = main3Nepr.get(main.Id); |
| | | mainTask.Nper__c = nper; |
| | | mainTask.Interval_Start_Date__c = today; |
| | | mainTask.Interval_End_Date__c = today.addMonths(6); |
| | | mainTask.Maintenance_Consumption_rate__c = main.Consumption_rate_Gurante__c; |
| | | mainTask.Reference_Consumption_Rate__c = Decimal.valueOf(main3Nepr.get(main.Id).replace('%', '')); |
| | | mainTask.Maintenance_Contract__c = main.Id; |
| | | mainTask.Is_Generate_Task__c = false; |
| | | mainTask.Name = 'DNalert---' + mainTask.Taget_Gurante__c; |
| | | mainTask.Is_Generate_Task__c = true; |
| | | // updateMainIds.add(main.Id); |
| | | |
| | | } |
| | | mainTasks.add(mainTask); |
| | | |
| | | if (today > main.endDateGurantee__c.addMonths(-6) && today < main.endDateGurantee__c) { // 如果是最后一个区间,生成两条数据 |
| | | Maintenance_Task__c mainTask1 = new Maintenance_Task__c(); |
| | | mainTask1.Interval_Start_Date__c = main.endDateGurantee__c.addMonths(-6); |
| | | mainTask1.Interval_End_Date__c = main.endDateGurantee__c; |
| | | mainTask1.Reference_Consumption_Rate__c = 100; |
| | | mainTask1.Maintenance_Contract__c = main.Id; |
| | | mainTask1.Is_Generate_Task__c = false; |
| | | mainTask1.Nper__c = nper+1; |
| | | if (mainTask1.Nper__c < 10) { |
| | | mainTask1.Name = 'DNalert-0' + mainTask1.Nper__c; |
| | | }else{ |
| | | mainTask1.Name = 'DNalert-' + mainTask1.Nper__c; |
| | | if (mainTask.Taget_Gurante__c!=null) { |
| | | mainTasks.add(mainTask); |
| | | } |
| | | // if (main.Maintenance_Price_Amount__c == 0) { |
| | | // mainTask1.Maintenance_Consumption_rate__c = 0; |
| | | // }else{ |
| | | // mainTask1.Maintenance_Consumption_rate__c = Decimal.valueOf(currentTotalRepairAmount) / main.Maintenance_Price_Amount__c * 100; |
| | | // } |
| | | mainTasks.add(mainTask1); |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | //市场多年保任务发送修改 20230505 end |
| | | }else{ // 服务合同或维修合同 |
| | | if (main.Contract_Start_Date__c.monthsBetween(main.Contract_End_Date__c) > 0 && main2Nepr.containsKey(main.Id)) { |
| | | Integer nper = main2Nepr.get(main.Id); |
| | |
| | | task.Name = '多年保修消费率预警任务(' + mcIDmap.get(mainta.Maintenance_Contract__c).Department__r.Name + ')'; |
| | | task.OwnerId = mcIDmap.get(mainta.Maintenance_Contract__c).Service_Contract_Staff__c; |
| | | insertTasks.add(task); |
| | | //市场多年保任务发送修改 20230505 start |
| | | main2Tasks.put(task.Maintenance_Contract__c,mainta); |
| | | //市场多年保任务发送修改 20230505 end |
| | | } |
| | | // } |
| | | // } |
| | |
| | | if (updateMainTasks.size() > 0) { |
| | | update updateMainTasks; |
| | | } |
| | | |
| | | |
| | | |
| | | if (System.Test.isRunningTest()) { |
| | | integer i = 0; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | |
| | | asset.Guarantee_period_year__c = 3; |
| | | insert asset; |
| | | Maintenance_Contract__c mContract = createMaintenanceContract(hp, dc, dpt1); |
| | | mContract.currentTotalRepairAmount__c = 3; |
| | | mContract.currentTotalRepairAmount__c = 300000; |
| | | mContract.previousTotalRepairAmount__c = 2; |
| | | update mContract; |
| | | Maintenance_Contract_Asset__c middleTable = new Maintenance_Contract_Asset__c(); |
| | |
| | | // insert mainTask; |
| | | |
| | | System.Test.StartTest(); |
| | | Maintenance_Contract__c mc1 = [select id,Maintenance_Price_Amount__c from Maintenance_Contract__c where currentTotalRepairAmount__c = 300000 limit 1]; |
| | | system.debug('mc1==****==========================================='+mc1.Maintenance_Price_Amount__c); |
| | | Database.executeBatch(new CreateMaintenanceTaskBatch(mContract.Id)); |
| | | System.Test.StopTest(); |
| | | } |
| | |
| | | asset.Guarantee_period_year__c = 3; |
| | | insert asset; |
| | | Maintenance_Contract__c mContract = createMaintenanceContract(hp, dc, dpt1); |
| | | mContract.currentTotalRepairAmount__c = 3; |
| | | mContract.currentTotalRepairAmount__c = 300; |
| | | mContract.previousTotalRepairAmount__c = 2; |
| | | update mContract; |
| | | |
| | |
| | | // insert task; |
| | | |
| | | System.Test.StartTest(); |
| | | Maintenance_Contract__c mc1 = [select id,Maintenance_Price_Amount__c from Maintenance_Contract__c where currentTotalRepairAmount__c = 300 limit 1]; |
| | | system.debug('mc1==****'+mc1.Maintenance_Price_Amount__c); |
| | | Database.executeBatch(new CreateMaintenanceTaskBatch()); |
| | | System.Test.StopTest(); |
| | | } |
| | |
| | | contract.Hospital__c = hp.Id; |
| | | contract.Department_Class__c = dc.Id; |
| | | contract.Department__c = dpt1.Id; |
| | | contract.currentTotalRepairAmount__c = 300000; |
| | | contract.previousTotalRepairAmount__c = 2; |
| | | contract.Service_Contract_Staff__c = UserInfo.getUserId(); |
| | | contract.Payment_Plan_Sum_First__c = 1; |
| | | contract.Status__c = '契約'; |
| | |
| | | contract2.Hospital__c = hp.Id; |
| | | contract2.Department_Class__c = dc.Id; |
| | | contract2.Department__c = dpt1.Id; |
| | | contract2.currentTotalRepairAmount__c = 300000; |
| | | contract2.previousTotalRepairAmount__c = 2; |
| | | contract2.Contract_Start_Date__c = Date.newInstance(2020, 12, 31); |
| | | contract2.Contract_End_Date__c = Date.newInstance(2023, 12, 31); |
| | | contract2.SalesOfficeCode_selection__c = '北京RC'; |
| | |
| | | middleTable.startDateGurantee_changgeAcc__c = Date.newInstance(2020, 12,31); |
| | | middleTable.Return_Flag__c = false; |
| | | middleTable.ChangeAcc_flag__c = false; |
| | | middleTable.Maintenance_Price_Amount_Text__c = 120000; |
| | | middleTable.No_discount__c = 1; |
| | | insert middleTable; |
| | | |
| | |
| | | public without sharing class LexArriveGoodsController { |
| | | public static String barcode { get; set; } |
| | | public static Consumable_order__c coc { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> detailsSummary { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableInventoryUse = new List<ConsumableorderdetailsInfo>(); |
| | | //更新明细取消时间 |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Cancle = new List<Consumable_order_details2__c>(); |
| | | // 更新借调信息 add by gzw 2020-0-415 start |
| | | public static Map<String, Consumable_order_details2__c> orderdetails2trMap = new Map<String, Consumable_order_details2__c>(); |
| | | // 更新借调信息 add by gzw 2020-0-415 end |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Insert = new List<Consumable_order_details2__c>(); |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Nobox = new List<Consumable_order_details2__c>(); |
| | | public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; } |
| | | public static transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> ShowGoodsofReturnList { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList { get; set; } |
| | | //add by rentx 20210602 CHAN-C3K4ZQ |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } |
| | | //add by rentx 20210602 CHAN-C3K4ZQ |
| | | public static List<String> GrList = new List<String>(); |
| | | //超出定货数量的产品 |
| | | public static List<String> cancellationProList = new List<String>(); |
| | | //错误信息 |
| | | public static String alertMessage { get; set; } |
| | | public static integer getinventorysize() { |
| | | return consumableInventory.size(); |
| | | } |
| | | public static integer geterrorsize() { |
| | | return ConsumableorderdetailsRecordserror.size(); |
| | | } |
| | | public static Set<String> noboxBarcodeList = new Set<String>(); |
| | | public static transient Map<String, String> ExistIdMap = new Map<String, String>(); |
| | | public static transient Map<String, String> ErrorIdMap = new Map<String, String>(); |
| | | public static transient Map<String, String> AllMap = new Map<String, String>(); |
| | | public static Map<String, String> otherAgencyMap = new Map<String, String>(); |
| | | public static transient Map<String, String> barMcodeMap = new Map<String, String>(); |
| | | public static Map<String, Integer> BarcodeCntMap = new Map<String, Integer>(); |
| | | public static transient List<String> BarCodeListP = new List<String>(); |
| | | public static Map<String, Decimal> orderProductCunMap = new Map<String, Decimal>(); |
| | | public static Map<String, Decimal> orderProductArrivedCunMap = new Map<String, Decimal>(); |
| | | public static Map<String, Decimal> orderWantArriveCunMap = new Map<String, Decimal>(); |
| | | //超出型号和数量 |
| | | public static Map<String, Decimal> overOrderCunMap = new Map<String, Decimal>(); |
| | | //超出BARCODE和型号 |
| | | public static Map<String, List<String>> overOrderBARcodeCunMap = new Map<String, List<String>>(); |
| | | public static List<String> overOrderBARcodeTTTTTT = new List<String>(); |
| | | //不符合的barcode和型号 |
| | | public static Map<String, List<String>> notEqualBARcodeCunMap = new Map<String, List<String>>(); |
| | | public static List<String> overOrderBARcodeSSSSSS = new List<String>(); |
| | | public static List<String> productList = new List<String>(); |
| | | public static List<String> notInlist = new List<String>(); |
| | | //不选择订单时保存订单ID、产品型号用 |
| | | //库存登录使用 |
| | | public static List<String> notInStorelist = new List<String>(); |
| | | public static List<String> exitBarCodeList = new List<String>(); |
| | | |
| | | public static Map<String, String> HosErrorMap = new Map<String, String>(); |
| | | public static List<String> HosErrorList = new List<String>(); |
| | | public static String baseUrl { get; private set; } |
| | | public static String ESetId { get; set; } |
| | | public static String arriveId = ''; |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | public static Decimal orderCountAll = 0; |
| | | public static Decimal orderCountNotarrive = 0; |
| | | private static id return_Order_id = null; |
| | | private static id inventory_Order_id = null; |
| | | public static boolean ReturnFLGbln { get; set; } |
| | | public static boolean saveFLGbln { get; set; } |
| | | public static String ArrType { get; set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | |
| | | //用户产品区分 |
| | | public static String userPro_Typestr = null; |
| | | public static String userPro_Type = null; |
| | | public static String product_Type = null; |
| | | public static Boolean EngFlag = false; |
| | | public static Boolean ETFlag = false; |
| | | |
| | | @AuraEnabled |
| | | public static Results init(String arrTypeStr, String eSetIdStr) { |
| | | Results results = new Results(); |
| | | ESetId = eSetIdStr; |
| | | ArrType = arrTypeStr; |
| | | ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInventory = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInventoryUse = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetails2Cancle = new List<Consumable_order_details2__c>(); |
| | | orderdetails2trMap = new Map<String, Consumable_order_details2__c>(); |
| | | detailsSummary = new List<ConsumableorderdetailsInfo>(); |
| | | saveFLGbln = false; |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | try { |
| | | 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; |
| | | userPro_Type = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(userPro_Type)) { |
| | | userPro_Type = 'ET'; |
| | | } |
| | | |
| | | if (userPro_Type == 'ENG') { |
| | | product_Type = 'ET'; |
| | | EngFlag = true; |
| | | } else { |
| | | product_Type = 'ENG'; |
| | | ETFlag = true; |
| | | } |
| | | userPro_Typestr = '%' + userPro_Type + '%'; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | system.debug('userWorkLocation' + userWorkLocation); |
| | | List<account> accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo[0].Name; |
| | | system.debug('accountName' + accountName); |
| | | coc = new Consumable_order__c(); |
| | | if (ArrType == 'ReG') { |
| | | ReturnFLGbln = true; |
| | | } else { |
| | | ReturnFLGbln = false; |
| | | } |
| | | if (ESetId != '' && ESetId != null) { |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_Orderdetails__c> reSet = new List<Consumable_Orderdetails__c>(); |
| | | qs = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Order_status__c, |
| | | Dealer_Info__c, |
| | | Deliver_date__c, |
| | | ReturnGs_Upload_Date__c, |
| | | Order_Reason__c, |
| | | Order_date__c, |
| | | Contract_application_decision__c, |
| | | Order_type__c, |
| | | Total_num__c, |
| | | OrderNumber_arrived__c, |
| | | Delivery_detail_count__c, |
| | | OrderNumber_notarrive__c, |
| | | orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Dealer_Info__c = :accountid |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | coc = qs[0]; |
| | | orderCountAll = coc.Total_num__c; |
| | | orderCountNotarrive = coc.OrderNumber_notarrive__c; |
| | | } |
| | | //产品定货数量 |
| | | reSet = [ |
| | | SELECT Asset_Model_No__c, Consumable_order__c, Consumable_count__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ]; |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | productList.add(reSet[i].Asset_Model_No__c); |
| | | orderProductCunMap.put(reSet[i].Asset_Model_No__c, reSet[i].Consumable_count__c); |
| | | orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c, 0); |
| | | orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c, 0); |
| | | overOrderCunMap.put(reSet[i].Asset_Model_No__c, 0); |
| | | overOrderBARcodeCunMap.put(reSet[i].Asset_Model_No__c, overOrderBARcodeTTTTTT); |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__c, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Dealer_Arrive__c, |
| | | Guarantee_period_for_products__c, |
| | | CFDA_Status__c, |
| | | Box_Piece__c, |
| | | Rrturn_count__c, |
| | | ProductPacking_list_manual__c, |
| | | Report_Product_Approbation__c, |
| | | Report_Product_Expiration__c, |
| | | ContractNo_text__c, |
| | | Consumable_order_minor__r.ContractNo__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Consumable_order_minor__c = :ESetId |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Box_Piece__c != '个' |
| | | ]; |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (orderProductArrivedCunMap.containsKey(reSet1[i].Asset_Model_No__c)) { |
| | | orderProductArrivedCunMap.put( |
| | | reSet1[i].Asset_Model_No__c, |
| | | orderProductArrivedCunMap.get(reSet1[i].Asset_Model_No__c) + 1 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | results.accountId = accountid; |
| | | results.accountName = accountName; |
| | | results.userProType = userPro_Type; |
| | | results.userProTypestr = userPro_Typestr; |
| | | results.productType = product_Type; |
| | | results.saveFLGbln = saveFLGbln; |
| | | results.returnFLGbln = ReturnFLGbln; |
| | | results.engFlag = EngFlag; |
| | | results.etFlag = ETFlag; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.productList = productList; |
| | | results.orderProductCunMap = orderProductCunMap; |
| | | results.orderProductArrivedCunMap = orderProductArrivedCunMap; |
| | | results.orderWantArriveCunMap = orderWantArriveCunMap; |
| | | results.overOrderCunMap = overOrderCunMap; |
| | | results.overOrderBARcodeCunMap = overOrderBARcodeCunMap; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results methodName() { |
| | | Results results = new Results(); |
| | | try { |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String accountId; |
| | | @AuraEnabled |
| | | public String accountName; |
| | | @AuraEnabled |
| | | public String userProType; |
| | | @AuraEnabled |
| | | public String userProTypestr; |
| | | @AuraEnabled |
| | | public String productType; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public String inventoryOrderId; |
| | | @AuraEnabled |
| | | public String returnOrderId; |
| | | @AuraEnabled |
| | | public String arriveId; |
| | | @AuraEnabled |
| | | public Boolean returnFLGbln; |
| | | @AuraEnabled |
| | | public Boolean saveFLGbln; |
| | | @AuraEnabled |
| | | public Boolean engFlag; |
| | | @AuraEnabled |
| | | public Boolean etFlag; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public List<String> productList; |
| | | @AuraEnabled |
| | | public Map<String, Decimal> orderProductCunMap; |
| | | @AuraEnabled |
| | | public Map<String, Decimal> orderProductArrivedCunMap; |
| | | @AuraEnabled |
| | | public Map<String, Decimal> orderWantArriveCunMap; |
| | | @AuraEnabled |
| | | public Map<String, Decimal> overOrderCunMap; |
| | | @AuraEnabled |
| | | public Map<String, List<String>> overOrderBARcodeCunMap; |
| | | } |
| | | |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public String ProductName { get; set; } |
| | | @AuraEnabled |
| | | public String barCodeNo { get; set; } |
| | | @AuraEnabled |
| | | public Date sterilizationlimitDate { get; set; } |
| | | @AuraEnabled |
| | | public String serialNoorLotNo { get; set; } |
| | | @AuraEnabled |
| | | public String tracingCodeNo { get; set; } |
| | | @AuraEnabled |
| | | public String ReturnReason { get; set; } |
| | | @AuraEnabled |
| | | public String oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public String ErrorReason { get; set; } |
| | | @AuraEnabled |
| | | public boolean canEdit { get; set; } |
| | | @AuraEnabled |
| | | public Integer intMark { get; set; } |
| | | @AuraEnabled |
| | | public Decimal arriveAmount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal arrivedCount { get; set; } |
| | | |
| | | public String ReportProductExpirationDate { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | intMark = 1; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | canEdit = false; |
| | | if (e.Box_Piece__c == '盒') { |
| | | e.Rrturn_count__c = 1; |
| | | canEdit = true; |
| | | } |
| | | |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e, List<String> barinfoL) { |
| | | esd = new Consumable_order_details2__c(); |
| | | ProductName = e.Name__c; |
| | | Prod = e; |
| | | barCodeNo = barinfoL[0]; |
| | | if (String.isNotBlank(barinfoL[1])) { |
| | | sterilizationlimitDate = Date.valueOf(barinfoL[1]); |
| | | } |
| | | serialNoorLotNo = barinfoL[2]; |
| | | tracingCodeNo = barinfoL[3]; |
| | | ReturnReason = ''; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e, List<String> barinfoL) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | barCodeNo = barinfoL[0]; |
| | | if (String.isNotBlank(barinfoL[1])) { |
| | | sterilizationlimitDate = Date.valueOf(barinfoL[1]); |
| | | } |
| | | serialNoorLotNo = barinfoL[2]; |
| | | tracingCodeNo = barinfoL[3]; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | Prod = e; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | public without sharing class LexArriveGoodsMainController { |
| | | /*****************検索用******************/ |
| | | //经销商产品分类 |
| | | public static String agencyProType {get;set;} |
| | | // public static Consumable_order__c coc { get; set; } |
| | | public static String category1 { get; set; } |
| | | private static String cate1ForSort = null; |
| | | private static Date cate2ForSort = Date.today(); |
| | | private static Date cate2 = Date.today(); |
| | | private static String[] columus = new String[]{ 'Product2__c.Name'}; |
| | | // 产品 ID |
| | | private static String ESetId = ''; |
| | | private static String accountid = null; |
| | | // 订单 字段标签 |
| | | public static List<String> title { get; private set; } |
| | | // 订单 字段名 |
| | | public static List<String> column; |
| | | public static List<List<String>> columns { get; private set; } |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 20200904 ljh 汇总使用 start |
| | | public static Integer Total_num {get; set;} |
| | | public static Integer OrderNumber_arrived {get; set;} |
| | | public static Integer Delivery_detail_count {get; set;} |
| | | public static Integer OrderNumber_notarrive {get; set;} |
| | | public static Integer More_than_seven_days {get; set;} |
| | | |
| | | @AuraEnabled |
| | | public static Results init(){ |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | List<String> idList = new List<String>(); |
| | | idList.add('a2K10000002zHyDEAU'); |
| | | idList.add('a2K10000002zIJEEA2'); |
| | | idList.add('a2K10000002zK9rEAE'); |
| | | idList.add('a2K10000004AKGBEA4'); |
| | | idList.add('a2K10000004ALqeEAG'); |
| | | idList.add('a2K10000004AMmrEAG'); |
| | | idList.add('a2K10000004ANvDEAW'); |
| | | idList.add('a2K10000004AOVxEAO'); |
| | | idList.add('a2K10000004AOJZEA4'); |
| | | idList.add('a2K10000004AOLuEAO'); |
| | | idList.add('a2K10000004AOLfEAO'); |
| | | // coc = new Consumable_order__c(); |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> Useracc = New List<user>(); |
| | | Useracc = [select accountid, Work_Location__c,UserPro_Type__c from user where id =:userId]; |
| | | 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'; |
| | | } |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Order_ProType__c =\'' + agencyProType +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' and showFalseNotshowTrue__c = false order by Deliver_date__c'; // |
| | | // soql = 'select id,name,ContractNo__c,Total_num__c,OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,More_than_seven_days__c,Shipment_date__c,First_Delivery__c from Consumable_order__c where id in :idList'; |
| | | raesList = Database.query(soql); |
| | | //20200904 ljh add start |
| | | Total_num = 0; |
| | | OrderNumber_arrived = 0; |
| | | Delivery_detail_count = 0; |
| | | OrderNumber_notarrive = 0; |
| | | More_than_seven_days = 0; |
| | | System.debug('-----1------'+raesList); |
| | | for(Consumable_order__c conorder :raesList){ |
| | | if(conorder.Total_num__c != null){ |
| | | Total_num += (Integer)conorder.Total_num__c; |
| | | } |
| | | if(conorder.OrderNumber_arrived__c != null){ |
| | | OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c; |
| | | } |
| | | if(conorder.Delivery_detail_count__c != null){ |
| | | Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c; |
| | | } |
| | | if(conorder.OrderNumber_notarrive__c != null){ |
| | | OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c; |
| | | } |
| | | if(conorder.More_than_seven_days__c != null){ |
| | | More_than_seven_days += (Integer)conorder.More_than_seven_days__c; |
| | | } |
| | | } |
| | | results.agencyProType = agencyProType; |
| | | results.accountId = accountid; |
| | | results.title = title; |
| | | results.raesList = raesList; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.totalNum = Total_num; |
| | | results.orderNumberArrived = OrderNumber_arrived; |
| | | results.deliveryDetailCount = Delivery_detail_count; |
| | | results.orderNumberNotarrive = OrderNumber_notarrive; |
| | | results.moreThanSevenDays = More_than_seven_days; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails(String category1Str, Date cate2Str, String accountidStr, String userWorkLocationStr, String agencyProTypeStr){ |
| | | Results results = new Results(); |
| | | category1 = category1Str; |
| | | cate2 = cate2Str; |
| | | accountid = accountidStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | agencyProType = agencyProTypeStr; |
| | | try { |
| | | // cate2 = coc.Shipment_date__c; |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) '; |
| | | soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += 'and showFalseNotshowTrue__c = false'; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if(cate2 != null){ |
| | | soql += ' and Shipment_date__c = :cate2 '; |
| | | } |
| | | soql += ' and Order_ProType__c =\'' + agencyProType +'\''; |
| | | soql += ' order by Deliver_date__c'; |
| | | system.debug('====soql:' + soql); |
| | | raesList = Database.query(soql); |
| | | results.raesList = raesList; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String category1; |
| | | @AuraEnabled |
| | | public Date cate2; |
| | | @AuraEnabled |
| | | public String eSetId; |
| | | @AuraEnabled |
| | | public String accountId; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public Integer totalNum; |
| | | @AuraEnabled |
| | | public Integer orderNumberArrived; |
| | | @AuraEnabled |
| | | public Integer deliveryDetailCount; |
| | | @AuraEnabled |
| | | public Integer orderNumberNotarrive; |
| | | @AuraEnabled |
| | | public Integer moreThanSevenDays; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexArriveGsDetailsController { |
| | | public static Consumable_order__c coc { get; set; } |
| | | private static String accountid = null; |
| | | private static Decimal orderallcount = 0; |
| | | public static Boolean arrivetoorder { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } |
| | | private static String eSetId = ''; |
| | | private static Integer consumableorderdetailsCount = null; |
| | | |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static Results init(String eSetIdStr) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | eSetId = eSetIdStr; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | try { |
| | | //取经销商信息 |
| | | String userId = UserInfo.getUserId(); |
| | | List<user> useracc = New List<user>(); |
| | | useracc = [select accountid from user where id =:userId]; |
| | | accountid = useracc[0].accountid; |
| | | List<Consumable_order__c> rs = New List<Consumable_order__c>(); |
| | | if(eSetId == NULL || eSetId == '') { |
| | | |
| | | }else { |
| | | rs = [SELECT id,name,Order_reason__c,Arrive_Order__c,Arrive_Order__r.Total_num__c,Arrive_Order__r.IsShipment__c,Arrive_Order__r.Name, |
| | | recordtypeid,Order_status__c,Deliver_date__c,Arrive_total_amount__c |
| | | FROM Consumable_order__c |
| | | WHERE id =:eSetId]; |
| | | coc = new Consumable_order__c(); |
| | | if(rs.size()>0){ |
| | | coc = rs[0]; |
| | | orderallcount = coc.Arrive_Order__r.Total_num__c; |
| | | } |
| | | if(coc.Arrive_Order__c == null){ |
| | | arrivetoorder = true; |
| | | } |
| | | List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [SELECT Id,Dealer_Arrive__c,Bar_Code__c, RecordTypeid, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name,Dealer_Saled__c, |
| | | Sterilization_limit__c,Deliver_date__c, |
| | | Intra_Trade_List_RMB__c,Asset_Model_No__c,Arrive_Date__c,Send_Date__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Product2__r.Packing_list_manual__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_Arrived_order__c = :eSetId |
| | | ORDER BY Name ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){ |
| | | bss.packing_list = bss.Prod.Product2__r.Packing_list_manual__c; |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | //update by rentx 20210622 start CHAN-C3K4ZQ |
| | | bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null ? '' : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format(); |
| | | bss.Sterilization_limitStr = bss.esd.Sterilization_limit__c == null ? '' : bss.esd.Sterilization_limit__c.format(); |
| | | //update by rentx 20210622 end CHAN-C3K4ZQ |
| | | } |
| | | consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | //add by rentx 20210622 CHAN-C3K4ZQ |
| | | // makeRecordsView(consumableorderdetailsRecords); |
| | | //add by rentx 20210622 CHAN- |
| | | for(ConsumableorderdetailsInfo con : consumableorderdetailsRecords){ |
| | | con.prodName = con.esd.Consumable_Product__r.Name__c; |
| | | } |
| | | results.coc = coc; |
| | | results.accountid = accountid; |
| | | results.orderallcount = orderallcount; |
| | | results.arrivetoorder = arrivetoorder; |
| | | results.consumableorderdetailsRecords = consumableorderdetailsRecords; |
| | | results.consumableorderdetailsCount = consumableorderdetailsCount; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //出库 |
| | | @AuraEnabled |
| | | public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm) { |
| | | Results results = new Results(); |
| | | try { |
| | | orderallcount = orderallcountParm; |
| | | consumableorderdetailsCount = consumableorderdetailsCountParm; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>(); |
| | | //发货明细2 |
| | | orderdetails = [SELECT Id |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_order_minor__c =:coc.Arrive_Order__c |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = true ]; |
| | | if(orderallcount!= consumableorderdetailsCount){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '订单不完全到货,无法出库'; |
| | | return results; |
| | | } |
| | | if(coc.Arrive_Order__r.IsShipment__c == true){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '订单已经出库'; |
| | | return results; |
| | | } |
| | | results.url = '/lexsummonscreat?arriveorder=' + eSetId +'&KeyWords=Redirect'; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public Decimal orderallcount; |
| | | @AuraEnabled |
| | | public Boolean arrivetoorder; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords; |
| | | @AuraEnabled |
| | | public Integer consumableorderdetailsCount; |
| | | @AuraEnabled |
| | | public String url; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd; |
| | | @AuraEnabled |
| | | public Product2__c Prod; |
| | | @AuraEnabled |
| | | public Decimal packing_list; |
| | | @AuraEnabled |
| | | public Date expiration_Date; |
| | | @AuraEnabled |
| | | public String approbation_No; |
| | | @AuraEnabled |
| | | public String expiration_DateStr; |
| | | @AuraEnabled |
| | | public String Sterilization_limitStr; |
| | | @AuraEnabled |
| | | public String prodName; |
| | | |
| | | |
| | | // 已存在消耗品明细用 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 排序Consumable_order__c |
| | | 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>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | 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 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 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; |
| | | } |
| | | |
| | | // 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; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | 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; |
| | | Prod = e; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | //esd = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | //ProductName = productName; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | */ |
| | | // 排序 |
| | | 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>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexConInvoiceList { |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String agencyProType { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static String category2 { get; set; } |
| | | //发票开始、结束日期 |
| | | private static Date cate1 { get; set; } |
| | | private static Date cate2 { get; set; } |
| | | // 登录用户 ID |
| | | private static String userinfoId { get; set; } |
| | | private static String invoiceStatus { get; set; } |
| | | //经销商id |
| | | private static String accountid { get; set; } |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | //排序使用 |
| | | private static String[] orderby = new List<String>{ 'Invoice_Date__c', 'Name', 'ShipmentAccount__c' }; |
| | | 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 userWorkLocation { get; set; } |
| | | public static Map<String, String> statusMap { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | statusMap = new Map<String, String>(); |
| | | raesList = new List<Consumable_order__c>(); |
| | | coc = new Consumable_order__c(); |
| | | cate1 = coc.Order_date__c; |
| | | cate2 = coc.Deliver_date__c; |
| | | userinfoId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId]; |
| | | 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'; |
| | | } |
| | | invoiceStatus = coc.Invoice_status__c; |
| | | String soql = makeSoql(category1, category2, invoiceStatus); |
| | | raesList = Database.query(soql); |
| | | |
| | | statusMap = getPicklistValues('Consumable_order__c', 'Invoice_status__c'); |
| | | |
| | | data.put('userinfoId', userinfoId); |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('raesList', raesList); |
| | | data.put('statusMap', statusMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 发票单检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC invoiceCodeSearch( |
| | | Date orderDateLwc, |
| | | Date deliverDateLwc, |
| | | String invoiceStatusLwc, |
| | | String category1Lwc, |
| | | String category2Lwc, |
| | | String accountidLwc, |
| | | String userWorkLocationLwc, |
| | | String agencyProTypeLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | cate1 = orderDateLwc; |
| | | cate2 = deliverDateLwc; |
| | | invoiceStatus = invoiceStatusLwc; |
| | | category1 = category1Lwc; |
| | | category2 = category2Lwc; |
| | | accountid = accountidLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | // 获得发票一览 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = makeSoql(category1, category2, invoiceStatus); |
| | | raesList = Database.query(soql); |
| | | // if(raesList.size()>0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共检索到' + raesList.size() + '个发票')); |
| | | // }else{ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有搜索到相关发票。')); |
| | | // } |
| | | data.put('raesList', raesList); |
| | | data.put('raesListSize', raesList.size()); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 做成检索SQL文 |
| | | private static String makeSoql(String invoiceCode, String accountName, String invoiceStatus) { |
| | | String soql = 'SELECT Id, Name,Invoice_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Invoice_status__c, '; |
| | | soql += ' InvoicedPro_total_amount__c,InvoiceNotPro_total_amount__c,Invoice_total_amount__c,Invoice_attachment__c,Invoicedet_attachment__c FROM Consumable_order__c '; |
| | | soql += ' WHERE Dealer_Info__c = \'' + accountid + '\''; |
| | | soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' AND recordtypeid = \'' + System.Label.RT_ConOrder_Invoice + '\''; |
| | | if (cate1 != null) { |
| | | soql += ' AND Invoice_Date__c >= :cate1 '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' AND Invoice_Date__c <= :cate2 '; |
| | | } |
| | | if (!String.isBlank(invoiceCode)) { |
| | | soql += ' AND Name like \'%' + String.escapeSingleQuotes(invoiceCode.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(accountName)) { |
| | | soql += ' AND ShipmentAccount__c like \'%' + String.escapeSingleQuotes(accountName.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(invoiceStatus)) { |
| | | soql += ' AND Invoice_status__c =\'' + invoiceStatus + '\' '; |
| | | } |
| | | System.debug('soql+++++' + soql); |
| | | return soql; |
| | | } |
| | | |
| | | /* |
| | | 通过sObjectName和指定字段获取PickList的value值 |
| | | */ |
| | | public static Map<String, String> getPicklistValues(String sObjectName, String sFieldName) { |
| | | Map<String, String> picValues = new Map<String, String>(); |
| | | picValues.put('-无-', ''); |
| | | Map<String, Schema.SObjectType> sObjectDescribeMap = Schema.getGlobalDescribe(); |
| | | if (sObjectDescribeMap.containsKey(sObjectName)) { |
| | | Map<String, Schema.SobjectField> sObjectFieldsMap = sObjectDescribeMap.get(sObjectName).getDescribe().fields.getMap(); |
| | | if (sObjectFieldsMap.containsKey(sFieldName)) { |
| | | Schema.DescribeFieldResult sObjectFieldDescribe = sObjectFieldsMap.get(sFieldName).getDescribe(); |
| | | List<Schema.PicklistEntry> lPickEntryList = sObjectFieldDescribe.getPicklistValues(); |
| | | //tPicklistEntry.isDefaultValue() |
| | | for (Schema.PicklistEntry tPicklistEntry : lPickEntryList) { |
| | | picValues.put(tPicklistEntry.getLabel(), tPicklistEntry.getValue()); |
| | | } |
| | | } else { |
| | | //TODO 不存在此字段的执行 |
| | | } |
| | | } else { |
| | | // TODO 不存在此sObject的执行 |
| | | } |
| | | return picValues; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | 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 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 Integer invoiceOrderRecoedsCount { |
| | | get { |
| | | return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size(); |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | ]; |
| | | 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])); |
| | | } |
| | | } 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; |
| | | } |
| | | |
| | | if (coc.Order_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | |
| | | //发票关联出库单取得(出库单) |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | } |
| | | } else { |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Invoice_status__c, |
| | | Invoice_Date__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__c, |
| | | Order_ForHospital__r.Name, |
| | | Order_date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | SummonsForDirction__c, |
| | | Order_ForCustomerText__c, |
| | | Invoice_Note__c, |
| | | Invoice_attachment__c, |
| | | Invoicedet_attachment__c, |
| | | Outbound_order__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :invoiceId AND Order_type__c = '发票' |
| | | ]; |
| | | if (coc.Order_ForDealer__c != null) { |
| | | SecondDealer = coc.Order_ForDealer__c; |
| | | } |
| | | if (coc.Order_ForHospital__c != null) { |
| | | HospitalInfo = coc.Order_ForHospital__c; |
| | | HospitalName = coc.Order_ForHospital__r.Name; |
| | | } |
| | | //到链接表中查找关联出库单 |
| | | List<Consumable_order_LinkTable__c> outOrderList = [ |
| | | SELECT Outboundorder_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Invoice_Code_link__c = :invoiceId |
| | | ]; |
| | | for (Integer i = 0; i < outOrderList.size(); i++) { |
| | | outOrderStringList.add(outOrderList[i].Outboundorder_Code_link__c); |
| | | } |
| | | //取得出库单信息 |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id IN :outOrderStringList AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | outorderMoneytMap.put(invoiceOrderSelectedList[i].id, 0); |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | if (String.isNotBlank(deliveryId)) { |
| | | //发票关联出库单取得(出库单) |
| | | isChange = true; |
| | | invoiceOrderSelectedList = [ |
| | | SELECT |
| | | Id, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForHospital__r.Name, |
| | | Order_ForDealerText__c, |
| | | Name, |
| | | Outbound_Date__c, |
| | | ShipmentAccount__c, |
| | | Shipment_total_amount__c, |
| | | RrturnPro_total_amount__c, |
| | | Total_Invoiced_Procount__c, |
| | | InvoiceNotPro_total_amount__c, |
| | | InvoiceNotPro_money__c, |
| | | Invoice_total_amount__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :deliveryId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) { |
| | | if (!outorderMoneytMap.containsKey(invoiceOrderSelectedList[i].Id)) { |
| | | invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | invoiceOrderRecoedschange.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i])); |
| | | } |
| | | } |
| | | } |
| | | //发票明细一览 |
| | | List<Consumable_Orderdetails__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_ZS_order__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Invoicedet1_OD_link__c, |
| | | Invoicedet1_OD_link__r.Name, |
| | | Consumable_order__r.Name, |
| | | Product_OutDate__c, |
| | | Asset_Model_No__c, |
| | | Invoice_Unitprice__c, |
| | | Delivery_List_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | InvoicedProCost_RMB__c, |
| | | Box_Piece__c, |
| | | Invoice_Unit__c, |
| | | ProductPacking_list_manual__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ORDER BY Invoicedet1_OD_link__c |
| | | ]; |
| | | if (countDel.size() > 0) { |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | outordercountMap.put(countDel[i].Invoicedet1_OD_link__c + countDel[i].Asset_Model_No__c, countDel[i]); |
| | | if (outorderMoneytMap.containsKey(countDel[i].Invoicedet1_OD_link__c)) { |
| | | outorderMoneytMap.put( |
| | | countDel[i].Invoicedet1_OD_link__c, |
| | | outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) + countDel[i].InvoicedProCost_RMB__c |
| | | ); |
| | | } |
| | | invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i])); |
| | | } |
| | | } |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (outorderMoneytMap.containsKey(ass.esd.id)) { |
| | | ass.needInvoiceCount = outorderMoneytMap.get(ass.esd.id); |
| | | } |
| | | ass.check = true; |
| | | } |
| | | } |
| | | |
| | | if (SecondDealer == null || SecondDealer == '') { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } else { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__r.Name == SecondDealer) { |
| | | provinceOpts.add(new SelectOption(Dealerelationship[i].Dealer_subordinate__c, SecondDealer)); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, SecondDealer); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, String> consumableaccessoriesMap = new Map<String, String>(); |
| | | Map<String, String> invorceOrderIdMap = new Map<String, String>(); |
| | | List<Consumable_accessories_invoice__c> consumableaccessories = [ |
| | | SELECT Id, Name, Attachment_ID__c, Accessories_type__c |
| | | FROM Consumable_accessories_invoice__c |
| | | WHERE Invoice_code__c = :invoiceId |
| | | ]; |
| | | System.debug('consumableaccessories = ' + consumableaccessories); |
| | | if (consumableaccessories.size() > 0) { |
| | | for (Integer i = 0; i < consumableaccessories.size(); i++) { |
| | | consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c); |
| | | invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id); |
| | | } |
| | | } |
| | | |
| | | //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | | if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) { |
| | | ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id); |
| | | ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id); |
| | | } |
| | | } |
| | | data.put('EditAble', EditAble); |
| | | data.put('isChange', isChange); |
| | | data.put('coc', coc); |
| | | data.put('ExistOutbound', getExistOutbound()); |
| | | data.put('invoiceOrderRecoeds', invoiceOrderRecoeds); |
| | | data.put('provinceOptsMap', provinceOptsMap); |
| | | data.put('HospitalName', HospitalName); |
| | | data.put('HospitalInfo', HospitalInfo); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('done', getdone()); |
| | | data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds); |
| | | data.put('accountid', accountid); |
| | | data.put('invoiceOrderRecoedschange',invoiceOrderRecoedschange); |
| | | data.put('attachmentRecoeds',attachmentRecoeds); |
| | | data.put('outOrderStringList',outOrderStringList); |
| | | data.put('outordercountMap',outordercountMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | //保存 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save( |
| | | Consumable_order__c cocLwc, |
| | | String HospitalNameLwc, |
| | | String HospitalInfoLwc, |
| | | String SecondDealerLwc, |
| | | String invoiceOrderRecoedsLwc, |
| | | String deliveryIdLwc, |
| | | String invoiceIdLwc, |
| | | String accountidLwc, |
| | | String agencyProTypeLwc, |
| | | String reopenLwc, |
| | | String invoiceOrderRecoedschangeLwc |
| | | ) { |
| | | System.debug('enter LexConInvoiceViewController.save success'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | coc = cocLwc; |
| | | HospitalName = HospitalNameLwc; |
| | | HospitalInfo = HospitalInfoLwc; |
| | | System.debug('HospitalInfo = ' + HospitalInfo); |
| | | SecondDealer = SecondDealerLwc; |
| | | errorMsg = ''; |
| | | deliveryId = deliveryIdLwc; |
| | | invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | reopen = reopenLwc; |
| | | invoiceOrderRecoedschange = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class); |
| | | |
| | | List<String> chukudanID = new List<String>(); |
| | | if (coc.Name == '' || coc.Name == null) { |
| | | // coc.Name.addError('请录入发票号'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票号', ''); |
| | | } |
| | | if (coc.Invoice_Date__c == null) { |
| | | // coc.Invoice_Date__c.addError('请录入发票日期'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请录入发票日期', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) { |
| | | // coc.addError('必须输入客户名或者二级经销商'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入客户名或者二级经销商', ''); |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) { |
| | | //coc.addError('请输入客户名、二级经销商只可输入一个'); |
| | | errorMsg += '请输入客户名、二级经销商只可输入一个'; |
| | | } |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (coc.Order_ForCustomerText__c == null) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else { |
| | | if (coc.Order_ForCustomerText__c != null) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | } |
| | | String shipmentAccountString = ''; |
| | | if (HospitalInfo != null) { |
| | | shipmentAccountString = HospitalInfo; |
| | | } else if (String.isNotEmpty(SecondDealer)) { |
| | | shipmentAccountString = SecondDealer; |
| | | } else { |
| | | shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c; |
| | | } |
| | | |
| | | Integer x = 0; |
| | | List<String> invoiceOrderAccountList = new List<String>(); |
| | | for (InvoiceOrderInfo ass : invoiceOrderRecoeds) { |
| | | if (String.isBlank(deliveryId)) { |
| | | if (ass.check == true) { |
| | | x++; |
| | | System.debug(shipmentAccountString); |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | if (ass.esd.Order_ForHospital__c != shipmentAccountString) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | if ( |
| | | ass.esd.Order_ForDealer__c != shipmentAccountString && |
| | | ass.esd.Order_ForDealerText__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) { |
| | | if ( |
| | | (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') && |
| | | ass.esd.ShipmentAccount__c != shipmentAccountString |
| | | ) { |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | |
| | | System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + ' ' + shipmentAccountString); |
| | | if (ass.esd.Order_ForHospital__c != shipmentAccountString) { |
| | | System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | //if (String.isNotEmpty(SecondDealer)) { |
| | | if (String.isNotEmpty(SecondDealer)) { |
| | | if (ass.esd.Order_ForDealer__c != shipmentAccountString) { |
| | | System.debug('String.isNotEmpty(SecondDealer) ass.esd.Order_ForHospital__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) { |
| | | if ( |
| | | (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') && |
| | | ass.esd.ShipmentAccount__c != shipmentAccountString |
| | | ) { |
| | | System.debug('HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'); |
| | | invoiceOrderAccountList.add(ass.esd.Name); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // invoiceOrderAccountList.add('12345'); |
| | | if (invoiceOrderAccountList.size() > 0) { |
| | | orderRemind = invoiceOrderAccountList + '出库单客户名与发票客户名不一致!'; |
| | | // coc.addError(invoiceOrderAccountList + '出库单客户名与发票客户名不一致!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, invoiceOrderAccountList + '出库单客户名与发票客户名不一致!', ''); |
| | | } else { |
| | | orderRemind = ''; |
| | | } |
| | | if (String.isBlank(deliveryId)) { |
| | | if (x < 1) { |
| | | // coc.addError('请选择需要开发票的出库单!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请选择需要开发票的出库单!', ''); |
| | | } |
| | | } |
| | | Consumable_order__c invoiceHead = new Consumable_order__c(); |
| | | List<String> outOrderIdList = new List<String>(); |
| | | List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>(); |
| | | Map<String, String> insertDetMap = new Map<String, String>(); |
| | | Map<String, String> deleteDetMap = new Map<String, String>(); |
| | | //新建发票时 |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | if (String.isBlank(invoiceId)) { |
| | | invoiceHead.Name = coc.Name; |
| | | if (coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c)) |
| | | coc.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_type__c = '发票'; |
| | | invoiceHead.Invoice_Date__c = coc.Invoice_Date__c; |
| | | invoiceHead.Dealer_Info__c = accountid; |
| | | invoiceHead.Invoice_Note__c = coc.Invoice_Note__c; |
| | | invoiceHead.Invoice_status__c = '草案中'; |
| | | invoiceHead.Order_ProType__c = agencyProType; |
| | | invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | //if (deliveryId != null) { |
| | | if (String.isNotBlank(deliveryId)) { |
| | | invoiceHead.Outbound_order__c = deliveryId; |
| | | } |
| | | invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | // if (SecondDealer == null) { |
| | | if (String.isBlank(SecondDealer)) { |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | invoiceHead.Order_ForHospital__c = HospitalInfo; |
| | | } |
| | | } else { |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | |
| | | 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; |
| | | } |
| | | 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 |
| | | ]; |
| | | 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; |
| | | } |
| | | |
| | | 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>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexConInvoicedetailsController { |
| | | //出库单使用 |
| | | public static Consumable_order__c coc { get; set; } |
| | | |
| | | //发票使用 |
| | | public static Consumable_order__c invoicecode { get; set; } |
| | | |
| | | //价格计算结果 |
| | | public static Decimal sumPrice {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,画面显示使用 |
| | | 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])); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | if (invoiceorderdet1CountMap.containsKey(ass.esd.Asset_Model_No__c)) { |
| | | ass.check = true; |
| | | if ( |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == null || |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == '' |
| | | ) { |
| | | ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c; |
| | | } else { |
| | | ass.esd.Invoice_Unit__c = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c; |
| | | } |
| | | if ( |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == null || |
| | | invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == 0 |
| | | ) { |
| | | ass.invoiceCount = ass.esd.Invoiced_Count__c; |
| | | } else { |
| | | ass.invoiceCount = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c; |
| | | } |
| | | |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | Decimal invoiceAllprice = 0.00; |
| | | invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c).setScale(2); |
| | | ass.invoiceAllprice = invoiceAllprice; |
| | | } else { |
| | | ass.invoiceCount = ass.esd.InvoiceProNot_count__c; |
| | | ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c; |
| | | ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | } |
| | | data.put('invoicecode',invoicecode); |
| | | data.put('coc',coc); |
| | | data.put('consumableorderdetails1Records',consumableorderdetails1Records); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc,String invoiceIdLwc,String orderIdLwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | consumableorderdetails1Records= (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetails1RecordsLwc, List<ConsumableorderdetailsInfo>.class); |
| | | invoiceId = invoiceIdLwc; |
| | | orderId = orderIdLwc; |
| | | System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records); |
| | | System.debug('invoiceId = ' + invoiceId); |
| | | System.debug('orderId = ' + orderId); |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | //新规发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>(); |
| | | //更新发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderUpList1 = new List<Consumable_Orderdetails__c>(); |
| | | //删除发票明细1 |
| | | List<Consumable_Orderdetails__c> invoiceorderDeList1 = new List<Consumable_Orderdetails__c>(); |
| | | |
| | | Map<String, Consumable_Orderdetails__c> invoiceordet1Map = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | List<String> consumableorderList = new List<String>(); |
| | | List<String> consumableNameList = new List<String>(); |
| | | try { |
| | | //更新出库单明细1 |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | consumableorderList.add(ass.esd.Asset_Model_No__c); |
| | | } |
| | | |
| | | //发票明细1获取 |
| | | List<Consumable_Orderdetails__c> invoiceorderdetails1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_No__c, |
| | | Invoice_Unit__c, |
| | | Box_Piece__c, |
| | | Invoicedet1_OD_link__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId AND Asset_Model_No__c IN :consumableorderList |
| | | ]; |
| | | for (Integer i = 0; i < invoiceorderdetails1.size(); i++) { |
| | | invoiceordet1Map.put( |
| | | invoiceorderdetails1[i].Invoicedet1_OD_link__c + invoiceorderdetails1[i].Asset_Model_No__c, |
| | | invoiceorderdetails1[i] |
| | | ); |
| | | } |
| | | List<Consumable_Orderdetails__c> invoicedetails1count = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Invoicedet1_OD_link__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Count__c, |
| | | Shipment_Count__c, |
| | | RrturnPro_count__c, |
| | | Delivery_List_RMB__c, |
| | | InvoicedProCost_RMB__c, |
| | | Invoiced_Procount__c, |
| | | Invoiced_Count__c, |
| | | Sum_of_money__c, |
| | | Invoice_Unitprice__c, |
| | | InvoiceProNot_count__c, |
| | | Invoice_Cost_RMB__c, |
| | | Invoice_Unit__c, |
| | | Invoice_No__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :invoiceId |
| | | ]; |
| | | Integer invoiceRecordscon = invoicedetails1count.size() + 1; |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) { |
| | | if (ass.check == true && ass.invoiceCount > 0) { |
| | | if (String.isEmpty(String.valueOf(ass.invoiceCount))) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请输入发票数量!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入发票数量!', ''); |
| | | } |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | if (ass.invoiceCount > (ass.esd.InvoiceProNot_count__c * ass.Packing_list_manual).setScale(0)) { |
| | | // ass.esd.InvoiceProNot_count__c.addError('发票数量不能超过还没发票数量!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量不能超过还没发票数量!', ''); |
| | | } |
| | | } else { |
| | | if (ass.invoiceCount > ass.esd.InvoiceProNot_count__c) { |
| | | // ass.esd.InvoiceProNot_count__c.addError('发票数量不能超过还没发票数量!'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量不能超过还没发票数量!', ''); |
| | | } |
| | | } |
| | | |
| | | //if(ass.esd.Invoice_Unit__c =='个'){ |
| | | String invoiceCount = String.valueOf(ass.invoiceCount); |
| | | if (!Pattern.matches('^\\+{0,1}[1-9]\\d*', invoiceCount)) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '发票数量必须是整数')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '发票数量必须是整数', ''); |
| | | } |
| | | //} |
| | | |
| | | if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Shipment_Count__c = ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoiced_Count__c = ass.invoiceCount; |
| | | //invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Delivery_List_RMB__c * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c) |
| | | .Invoice_Unit__c = ass.esd.Invoice_Unit__c; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Box_Piece__c = ass.esd.Box_Piece__c; |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = |
| | | (ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual) * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoice_Unitprice__c = |
| | | ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = |
| | | ass.esd.Delivery_List_RMB__c * ass.invoiceCount; |
| | | invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c) |
| | | .Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | |
| | | invoiceorderUpList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)); |
| | | invoiceRecordscon++; |
| | | } else { |
| | | String str = string.valueOf(invoiceRecordscon); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c(); |
| | | invoiceInsert1.Used_date__c = ass.esd.Used_date__c; |
| | | invoiceInsert1.Send_date__c = ass.esd.Send_date__c; |
| | | invoiceInsert1.Name = |
| | | invoicecode.Name + |
| | | '-' + |
| | | ass.esd.Name.substring(ass.esd.Name.length() - 7, ass.esd.Name.length()); |
| | | invoiceInsert1.Shipment_Count__c = ass.invoiceCount; |
| | | invoiceInsert1.Consumable_Product__c = ass.esd.Consumable_Product__c; |
| | | invoiceInsert1.Intra_Trade_List_RMB__c = ass.esd.Intra_Trade_List_RMB__c; |
| | | invoiceInsert1.Delivery_List_RMB__c = ass.esd.Delivery_List_RMB__c; |
| | | invoiceInsert1.Dealer_Custom_Price__c = ass.esd.Dealer_Custom_Price__c; |
| | | invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | if (ass.esd.Box_Piece__c == '盒' && ass.esd.Invoice_Unit__c == '个') { |
| | | invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual; |
| | | } else { |
| | | invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c; |
| | | } |
| | | //invoiceInsert1.Invoice_Unitprice__c = ass.esd.Invoice_Unitprice__c; |
| | | invoiceInsert1.Invoice_Unit__c = ass.esd.Invoice_Unit__c; |
| | | invoiceInsert1.Box_Piece__c = ass.esd.Box_Piece__c; |
| | | if (ass.esd.Invoiced_Procount__c == null) |
| | | ass.esd.Invoiced_Procount__c = 0; |
| | | invoiceInsert1.Invoiced_Count__c = ass.invoiceCount; |
| | | if (ass.esd.InvoicedProCost_RMB__c == null) |
| | | ass.esd.InvoicedProCost_RMB__c = 0; |
| | | invoiceInsert1.InvoicedProCost_RMB__c = ass.invoiceCount * invoiceInsert1.Invoice_Unitprice__c; |
| | | invoiceInsert1.Consumable_order__c = invoiceId; |
| | | invoiceInsert1.Invoicedet1_OD_link__c = orderId; |
| | | invoiceRecordscon++; |
| | | invoiceorderList1.add(invoiceInsert1); |
| | | } |
| | | } else { |
| | | if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) { |
| | | invoiceorderDeList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (invoiceorderList1.size() > 0) { |
| | | insert invoiceorderList1; |
| | | } |
| | | if (invoiceorderUpList1.size() > 0) { |
| | | update invoiceorderUpList1; |
| | | } |
| | | if (invoiceorderDeList1.size() > 0) { |
| | | delete invoiceorderDeList1; |
| | | } |
| | | } catch (Exception e) { |
| | | ApexPages.addmessages(e); |
| | | // Database.rollback(sp); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, 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; |
| | | |
| | | Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c; |
| | | |
| | | 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('个', '个'); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | 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; } |
| | | |
| | | //初始化 |
| | | @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(), ''); |
| | | } |
| | | } |
| | | |
| | | @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); |
| | | 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); |
| | | 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(); |
| | | 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(), ''); |
| | | } |
| | | } |
| | | |
| | | //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 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexConsumableAccountInfoController { |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String accId) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | Account obj = new Account(); |
| | | if (accId != null) { |
| | | List<Account> accList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Owner.Name, |
| | | Site, |
| | | Alias_Name2__c, |
| | | Grade__c, |
| | | OCM_Category__c, |
| | | Is_Active__c, |
| | | Ban_On_Use_Reason__c, |
| | | Attribute_Type__c, |
| | | Speciality_Type__c, |
| | | State_Master__r.Name, |
| | | City_Master__r.Name, |
| | | Town__c, |
| | | Street__c, |
| | | Address_Together__c, |
| | | Phone, |
| | | PhoneCall__c, |
| | | Fax, |
| | | Postal_Code__c, |
| | | Parent.Name, |
| | | Address__c |
| | | FROM Account |
| | | WHERE Id = :accId |
| | | ]; |
| | | if (accList != null && accList.size() > 0) { |
| | | obj = accList.get(0); |
| | | } |
| | | }else { |
| | | return new ResponseBodyLWC('Error', 500, 'accId为空', ''); |
| | | } |
| | | data.put('obj', obj); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | 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[] 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; |
| | | } |
| | | |
| | | |
| | | } |
| 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> |
| | |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | public static String agencyProType { get; set; } |
| | | public static String agencyProType1 {get;set;} //lt 20230526 安徽两票制 add |
| | | private static Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | public static String methodType { get; set; } |
| | | public static String hospitalName { get; set; } |
| | | public static String hospitalId { get; set; } |
| | |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | break; |
| | | } else { |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | if (addNo >= size) |
| | | break; |
| | | // if (addNo >= size) |
| | | // break; |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | |
| | | @AuraEnabled |
| | | public static Results init(String type, String esetId, String keywordStr) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 安徽两票制 add |
| | | //lt 20230526 安徽两票制 start |
| | | OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add |
| | | if(OSHFLG){ |
| | | agencyProType1 = 'OSH'; |
| | | } |
| | | else if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType1 = 'ET'; |
| | | } |
| | | //lt 20230526 安徽两票制 end |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | |
| | | RecordType.DeveloperName = 'AgencyContract' |
| | | AND Contract_Decide_Start_Date__c <= :dateToday |
| | | AND Contract_Decide_End_Date__c >= :dateToday |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Agent_Ref__c = :accountid |
| | | and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | for (Account contract : contractList) { |
| | | contactDealer.add(contract.Id); |
| | |
| | | FROM Account |
| | | WHERE |
| | | ParentId = :accountid |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() == 1) { |
| | | contractName = contract[0].Name; |
| | |
| | | AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | if(cdc1.Consumable_Product__c != null){ |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | } |
| | | } |
| | | soql = makeSoqlorderdet(); |
| | | System.debug('soql:'+soql); |
| | | size = orderzaikuId.size(); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | |
| | | } |
| | | } |
| | | //附件 |
| | | attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId]; |
| | | if (attachmentinfo.size() > 0) { |
| | | for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | // |
| | | consumableorderdetailsRecords.sort(); |
| | | getPageInfo(); |
| | | } |
| | |
| | | List<String> upper = new List<String>(); |
| | | if (String.isNotBlank(ESetid)) { |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) { |
| | | upper.add(bss.esd.Consumable_Product__r.Name__c); |
| | | if(bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null){ |
| | | if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) { |
| | | upper.add(bss.esd.Consumable_Product__r.Name__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-','')); |
| | | //return msg |
| | | consumableorderdetailsRecordsview = consumableorderdetailsRecords; |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.coc = coc; |
| | | results.editAble = editAble; |
| | |
| | | results.attachmentRecoeds = attachmentRecoeds; |
| | | results.cansee = cansee; |
| | | results.agencyProType = agencyProType; |
| | | results.agencyProType1 = agencyProType1; |
| | | results.OSHFLG = OSHFLG; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.accountName = accountName; |
| | | results.category_Goods = category_Goods; |
| | |
| | | } |
| | | } |
| | | |
| | | //库存排序 |
| | | public static void SortStore() { |
| | | if (sortKey == preSortKey) { |
| | | // 方向が変わるのみ |
| | | sortOrderAsc = !sortOrderAsc; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } else { |
| | | sortOrderAsc = true; |
| | | sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } |
| | | preSortKey = sortKey; |
| | | List<ConsumableorderdetailsInfo> selectedSort = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> noselectedSort = new List<ConsumableorderdetailsInfo>(); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | ass.sortBy = sortOrderAsc; |
| | | if (ass.check == true) { |
| | | selectedSort.add(ass); |
| | | } else { |
| | | noselectedSort.add(ass); |
| | | } |
| | | } |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | if (selectedSort.size() > 0) { |
| | | if (searchDone != 'searchDone') { |
| | | selectedSort.sort(); |
| | | } |
| | | consumableorderdetailsRecordsview.addAll(selectedSort); |
| | | } |
| | | if (noselectedSort.size() > 0) { |
| | | noselectedSort.sort(); |
| | | consumableorderdetailsRecordsview.addAll(noselectedSort); |
| | | } |
| | | } |
| | | |
| | | //限制性排序 |
| | | public static void SortLimited() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | //AND Consumable_order_minor__r.Dealer_Info__c = :accountid |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | if (sortKey == preSortKey) { |
| | | // 方向が変わるのみ |
| | | sortOrderAsc = !sortOrderAsc; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↓' : '↑'); |
| | | } else { |
| | | sortOrderAsc = true; |
| | | sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↓' : '↑'); |
| | | } |
| | | preSortKey = sortKey; |
| | | // 所有产品取得 |
| | | if ( |
| | | (EsetId == null || ESetId == '') || (EsetId != null && ESetId != '' && statusEdit == 'Redirect' && searchDone == 'searchDone') |
| | | ) { |
| | | String strProd = null; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (strProd == null || strProd.length() == 0) { |
| | | strProd = '\'' + String.valueOf(ass.prod.Id) + '\''; |
| | | } else { |
| | | strProd += ',\'' + String.valueOf(ass.prod.Id) + '\''; |
| | | } |
| | | } |
| | | String soqll = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | //update by rentx 2020-12-31 start |
| | | if (agencyProType == 'ET') { |
| | | soqll += ' AND Pro2_Dealer_Object__c = true'; |
| | | } |
| | | if (agencyProType == 'ENG') { |
| | | soqll += ' AND Pro2_Dealer_ENG__c = true'; |
| | | } |
| | | soqll += ' AND Intra_Trade_List_RMB__c > 0 '; |
| | | //update by rentx 2020-12-31 end |
| | | soqll += ' AND Id IN (' + strProd + ')'; |
| | | soqll += |
| | | ' order by ' + |
| | | columus_no[Integer.valueOf(sortKey)] + |
| | | ' ' + |
| | | (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | List<Product2__c> queryList = Database.query(soqll); |
| | | // 選択済みの明细を取得 |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | selectedIdMap.put(ass.Prod.id, ass.Prod.id); |
| | | reSet.add(ass); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | if (selectedIdMap.containsKey(queryList[i].Id)) { |
| | | // 跳过已经选择的消耗品明细 |
| | | continue; |
| | | } else { |
| | | // 未选择的消耗品明细 |
| | | MidMap.put(queryList[i].Id, new ConsumableorderdetailsInfo(queryList[i])); |
| | | } |
| | | } |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = reSet; |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.Id)) { |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | |
| | | consumableorderdetailsRecordsview.add(bss); |
| | | } |
| | | } |
| | | } else if (searchDone != 'searchDone') { |
| | | String strProd = null; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (strProd == null || strProd.length() == 0) { |
| | | strProd = '\'' + String.valueOf(ass.prod.Id) + '\''; |
| | | } else { |
| | | strProd += ',\'' + String.valueOf(ass.prod.Id) + '\''; |
| | | } |
| | | } |
| | | String SqlOrder = 'SELECT Id, Name, Consumable_order__c, Consumable_Product__r.Name__c,'; |
| | | SqlOrder += ' Consumable_Product__c,Consumable_Product__r.Name,'; |
| | | SqlOrder += 'Consumable_Count__c,Consumable_Product__r.Intra_Trade_List_RMB__c,'; |
| | | SqlOrder += 'Consumable_Product__r.Asset_Model_No__c,Sum_of_money__c, '; |
| | | SqlOrder += 'Consumable_Product__r.SFDA_Status__c,Consumable_Product__r.Product2__r.Packing_list_manual__c,Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,'; |
| | | SqlOrder += 'Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,Consumable_Product__r.Category3__c,Consumable_Product__r.Category4__c,Consumable_Product__r.Category5__c '; |
| | | SqlOrder += |
| | | 'FROM Consumable_orderdetails__c WHERE recordtypeid != \'' + |
| | | System.Label.RT_ConOrderDetail1_Sale + |
| | | '\' AND Consumable_order__c = \'' + |
| | | ESetId + |
| | | '\''; |
| | | SqlOrder += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | SqlOrder += ' AND Consumable_Product__c IN (' + strProd + ')'; |
| | | SqlOrder += |
| | | ' order by ' + |
| | | columus[Integer.valueOf(sortKey)] + |
| | | ' ' + |
| | | (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | List<Consumable_Orderdetails__c> queryList = Database.query(SqlOrder); |
| | | // 選択済みの明细を取得 |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | // 未选择的消耗品明细 |
| | | MidMap.put(queryList[i].Consumable_Product__c, new ConsumableorderdetailsInfo(queryList[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | //把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecordsview.add(bss); |
| | | } |
| | | } |
| | | productLimtAndDateView(); |
| | | } |
| | | |
| | | //库存上下限 |
| | | public static void productLimtAndDateView() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //库存上下限 |
| | | public static void productLimtAndDate() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | |
| | | String dealerProductIdStr, |
| | | String methodTypeStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | Boolean editAbleStr |
| | | Boolean editAbleStr, |
| | | List<String> proLimitAndDateList |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | |
| | | specialCampaign = specialCampaignStr; |
| | | methodType = methodTypeStr; |
| | | editAble = editAbleStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | |
| | | // makeMessage(); |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | if(consumableorderdetailsRecordsview.size() > 0){ |
| | | if(consumableorderdetailsRecords.size() > 0){ |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '搜索到' + consumableorderdetailsRecordsview.size() + '件产品'; |
| | | results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品'; |
| | | }else { |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Fail'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | |
| | | cate1ForSort = category1; |
| | | // 显示数据条数信息 |
| | | noOfRecords = consumableorderdetailsRecords.size(); |
| | | getConsumableShowTableFieldValue(); |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | if(consumableorderdetailsRecordsview.size() > 0){ |
| | | results.result = 'Success'; |
| | |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | break; |
| | | } else { |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | if (addNo >= size){ |
| | | break; |
| | | } |
| | | // if (addNo >= size){ |
| | | // break; |
| | | // } |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | |
| | | } |
| | | } |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | System.debug('sqlTail:'+sqlTail); |
| | | System.debug('orderzaikuId:'+orderzaikuId); |
| | | if (orderzaikuId.size() > 0) { |
| | | soql += ' AND Id in' + sqlTail; |
| | | } |
| | |
| | | Results results = new Results(); |
| | | try { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | Blob contentBlob = EncodingUtil.base64Decode(base64Data); |
| | | Attachment att = new Attachment(); |
| | | att.ParentId = pId; |
| | | att.Name = fileName; |
| | | att.Body = contentBlob; |
| | | insert att; |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = pId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId]; |
| | | c.Consumable_pdf_insert_day__c = Date.today(); |
| | | update c; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | |
| | | String consumableorderdetailsRecordsviewStr, |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String hospitalIdStr |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ) { |
| | | ESetId = ''; |
| | | return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodType,ESetId,hospitalIdStr); |
| | | return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr); |
| | | } |
| | | |
| | | //保存按钮 |
| | |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String eSetIdStr, |
| | | String hospitalIdStr |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | |
| | | methodType = methodTypeStr; |
| | | ESetId = eSetIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | agencyProType1 = agencyProType1Str; |
| | | OSHFLG = OSHFLGStr; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | |
| | | FROM account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Agent_Ref__c = :accountid |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Agent_Ref__c =:accountid |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() <= 0) { |
| | | // coc.Order_effective_contact__c.addError('不存在的合同,请重新确认。'); |
| | |
| | | FROM Account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (at.size() > 0 && at[0].Dealer_discount__c != null) { |
| | | disCount = at[0].Dealer_discount__c; |
| | |
| | | return results; |
| | | } |
| | | |
| | | //删除附件 |
| | | @AuraEnabled |
| | | public static Results deleteAtt(String contentVersionId){ |
| | | Results results = new Results(); |
| | | try { |
| | | ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId]; |
| | | String contentDocumentId = conVersion.ContentDocumentId; |
| | | ContentDocument conDocument = [SELECT Id FROM ContentDocument where Id = :contentDocumentId]; |
| | | delete conDocument; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public static void getConsumableShowTableFieldValue(){ |
| | | for(ConsumableorderdetailsInfo con :consumableorderdetailsRecordsview){ |
| | | if(con.Prod != null){ |
| | | con.recordId = con.Prod.Id; |
| | | if(!con.oldCheck){ |
| | | con.prodName = con.Prod.Name__c; |
| | | // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c); |
| | | } |
| | | con.prodSFDAStatus = con.Prod.SFDA_Status__c; |
| | | con.prodCategory3 = con.Prod.Category3__c; |
| | | con.prodCategory4 = con.Prod.Category4__c; |
| | | con.prodCategory5 = con.Prod.Category5__c; |
| | | con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c; |
| | | } |
| | | if(con.esd != null){ |
| | | // if(con.oldCheck){ |
| | | // con.prodName = con.esd.Consumable_Product__r.Name__c; |
| | | // } |
| | | con.consumableCount = con.esd.Consumable_count__c; |
| | | } |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Attachment Concc { get; set; } |
| | | public ContentVersion Concc { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | |
| | | public Decimal orderGoods_Limit { get; set; } |
| | | @AuraEnabled |
| | | public Date Campaign_EndDate { get; set; } |
| | | @AuraEnabled |
| | | public String recordId { get; set; } |
| | | @AuraEnabled |
| | | public String prodName { get; set; } |
| | | @AuraEnabled |
| | | public String prodSFDAStatus { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory3 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory4 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory5 { get; set; } |
| | | @AuraEnabled |
| | | public Decimal prodIntraTradeList { get; set; } |
| | | @AuraEnabled |
| | | public Decimal consumableCount { get; set; } |
| | | |
| | | |
| | | // 已存产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | |
| | | allnumber_piece = 0; |
| | | } |
| | | //附件 |
| | | public ConsumableorderdetailsInfo(Attachment e) { |
| | | public ConsumableorderdetailsInfo(ContentVersion e) { |
| | | Concc = e; |
| | | } |
| | | // 排序Consumable_order__c |
| | |
| | | public String methodType; |
| | | @AuraEnabled |
| | | public List<String> proLimitAndDate; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | @AuraEnabled |
| | | public Boolean OSHFLG; |
| | | @AuraEnabled |
| | | public String agencyProType1; |
| | | } |
| | | |
| | | public class CusOption { |
| New file |
| | |
| | | public without sharing class LexConsumableGoodsInfo { |
| | | |
| | | //所有产品一览 |
| | | @AuraEnabled |
| | | public static Results initTotalNum(String ordId, String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allOtherDetIifo = new List<ShowRecords>(); |
| | | Set<String> orderId = new Set<String>(); |
| | | if(ordId != '1'){ |
| | | orderId.add(ordId); |
| | | } |
| | | try { |
| | | if(!(orderId.size() > 0)){ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | String temp = (String)conorder.Id; |
| | | orderId.add(temp); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | } |
| | | List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c]; |
| | | }else{ |
| | | conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =:orderId]; |
| | | } |
| | | |
| | | Map<String,Decimal> allConOrderMap = new Map<String,Decimal>(); |
| | | for(Consumable_Orderdetails__c con : conOrderList1){ |
| | | if(con.Consumable_count__c == null){ |
| | | con.Consumable_count__c = 0; |
| | | } |
| | | if(allConOrderMap.containsKey(con.Asset_Model_No__c)){ |
| | | allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c); |
| | | }else{ |
| | | allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c); |
| | | } |
| | | } |
| | | for(String pmodel : allConOrderMap.keySet()){ |
| | | if(allConOrderMap.get(pmodel) > 0){ |
| | | ShowRecords showrecord2 = new ShowRecords(); |
| | | showrecord2.recordCount = allConOrderMap.get(pmodel); |
| | | showrecord2.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord2); |
| | | } |
| | | } |
| | | results.result = 'Success'; |
| | | results.recordList = allOtherDetIifo; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //已到货产品一览 |
| | | @AuraEnabled |
| | | public static Results initArrDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> arrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | arrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = arrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //已到货产品一览All |
| | | @AuraEnabled |
| | | public static Results initArrDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str |
| | | GROUP BY Asset_Model_No__c]; |
| | | // List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | allArrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = allArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //未到货产品一览 |
| | | @AuraEnabled |
| | | public static Results initDeliveryDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> notArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = false |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< notArrDetList.size();i++){ |
| | | notArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | } |
| | | results.recordList = notArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //未到货产品一览All |
| | | @AuraEnabled |
| | | public static Results initDeliveryDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allNotArrDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | GROUP BY Asset_Model_No__c]; |
| | | // List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | allNotArrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | results.recordList = allNotArrDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //还没发货数量 |
| | | @AuraEnabled |
| | | public static Results initNotArrDet(String orderId){ |
| | | Results results = new Results(); |
| | | List<Consumable_Orderdetails__c> otherArrDetIifo = new List<Consumable_Orderdetails__c>(); |
| | | List<ShowRecords> otherArrList = new List<ShowRecords>(); |
| | | try{ |
| | | List<showRecords> arrDetIifo = new List<showRecords>(); |
| | | List<showRecords> notArrDetIifo = new List<showRecords>(); |
| | | List<showRecords> allArrDetIifo = new List<showRecords>(); |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId]; |
| | | List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str AND Dealer_Arrive__c = true |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< arrDetList.size();i++){ |
| | | arrDetIifo.add(new showRecords(arrDetList[i])); |
| | | } |
| | | |
| | | List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = false |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | for(Integer i = 0 ; i< notArrDetList.size();i++){ |
| | | notArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | } |
| | | |
| | | // List<AggregateResult> allArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | // WHERE Id =: str |
| | | // GROUP BY Asset_Model_No__c]; |
| | | List<Consumable_Orderdetails__c> allArrDetList = [SELECT Asset_Model_No__c,Consumable_count__c FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c =: orderId]; |
| | | // for(Integer i = 0 ; i< allArrDetList.size();i++){ |
| | | // allArrDetIifo.add(new showRecords(notArrDetList[i])); |
| | | // } |
| | | Map<String,Decimal> arrDetMap = new Map<String,Decimal>(); |
| | | for(showRecords arr : arrDetIifo){ |
| | | arrDetMap.put(arr.prodModel, arr.recordCount); |
| | | } |
| | | for(showRecords notarr : notArrDetIifo){ |
| | | if(arrDetMap.containsKey(notarr.prodModel)){ |
| | | arrDetMap.put(notarr.prodModel, arrDetMap.get(notarr.prodModel)+notarr.recordCount); |
| | | }else{ |
| | | arrDetMap.put(notarr.prodModel, notarr.recordCount); |
| | | } |
| | | } |
| | | List<String> AssetModelNoEdList = new List<String>();//20200904 ljh add |
| | | for(Consumable_Orderdetails__c allarr : allArrDetList){ |
| | | for(String promodel : arrDetMap.keySet()){ |
| | | if(allarr.Asset_Model_No__c == promodel){ |
| | | if((allarr.Consumable_count__c - arrDetMap.get(promodel)) > 0){ |
| | | allarr.Consumable_count__c = (allarr.Consumable_count__c - arrDetMap.get(promodel)); |
| | | otherArrDetIifo.add(allarr); |
| | | } |
| | | AssetModelNoEdList.add(promodel);//20200904 ljh add |
| | | } |
| | | } |
| | | } |
| | | //20200904 ljh add start |
| | | for(Consumable_Orderdetails__c allarr1 : allArrDetList){ |
| | | if(!AssetModelNoEdList.contains(allarr1.Asset_Model_No__c)){ |
| | | otherArrDetIifo.add(allarr1); |
| | | } |
| | | } |
| | | for(Consumable_Orderdetails__c conOrderDetail : otherArrDetIifo){ |
| | | ShowRecords record = new ShowRecords(); |
| | | record.prodModel = conOrderDetail.Asset_Model_No__c; |
| | | record.recordCount = conOrderDetail.Consumable_count__c; |
| | | otherArrList.add(record); |
| | | } |
| | | results.recordList = otherArrList; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //还没发货数量All |
| | | @AuraEnabled |
| | | public static Results initNotArrDetAll(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> allOtherDetIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | }else{ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | GROUP BY Asset_Model_No__c]; |
| | | Map<String,Decimal> conOrderMap = new Map<String,Decimal>(); |
| | | for(AggregateResult agg : arrDetList){ |
| | | conOrderMap.put(String.valueOf(agg.get('prodModel')), Integer.valueOf(agg.get('recordCount'))); |
| | | } |
| | | |
| | | List<Consumable_Orderdetails__c> conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =: orderId ]; |
| | | Map<String,Decimal> allConOrderMap = new Map<String,Decimal>(); |
| | | for(Consumable_Orderdetails__c con : conOrderList1){ |
| | | if(con.Consumable_count__c == null){ |
| | | con.Consumable_count__c = 0; |
| | | } |
| | | if(allConOrderMap.containsKey(con.Asset_Model_No__c)){ |
| | | allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c); |
| | | }else{ |
| | | allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c); |
| | | } |
| | | } |
| | | for(String pmodel : allConOrderMap.keySet()){ |
| | | if(conOrderMap.containsKey(pmodel)){ |
| | | if(allConOrderMap.get(pmodel) - conOrderMap.get(pmodel) > 0){ |
| | | showRecords showrecord1 = new showRecords(); |
| | | showrecord1.recordCount = allConOrderMap.get(pmodel) - conOrderMap.get(pmodel); |
| | | showrecord1.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord1); |
| | | } |
| | | }else{ |
| | | showRecords showrecord2 = new showRecords(); |
| | | showrecord2.recordCount = allConOrderMap.get(pmodel); |
| | | showrecord2.prodModel = pmodel; |
| | | allOtherDetIifo.add(showrecord2); |
| | | } |
| | | } |
| | | results.recordList = allOtherDetIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //发货七天还未到货数 |
| | | @AuraEnabled |
| | | public static Results initMoreThan7(String orderId){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>(); |
| | | try{ |
| | | List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Consumable_order_minor__c != null |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Arrive__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Consumable_order_minor__r.showFalseNotshowTrue__c = false |
| | | AND Deliver_date__c < LAST_N_DAYS:7 |
| | | AND Consumable_order_minor__c = :orderId |
| | | GROUP BY Asset_Model_No__c]; |
| | | |
| | | for(Integer i = 0 ; i< morethan7daysList.size() ; i++){ |
| | | morethansevendaysIifo.add(new showRecords(morethan7daysList[i])); |
| | | } |
| | | results.recordList = morethansevendaysIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //发货七天还未到货数All |
| | | @AuraEnabled |
| | | public static Results initMoreThan7All(String type){ |
| | | Results results = new Results(); |
| | | List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>(); |
| | | try{ |
| | | String userId = UserInfo.getUserId(); |
| | | List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId ]; |
| | | String accountid = userList[0].accountid; |
| | | String userPro_Type = userList[0].UserPro_Type__c; |
| | | String userWorklocation = userList[0].Work_Location__c; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | String rtTypeDelivery = System.Label.RT_ConOrder_Delivery; |
| | | List<Consumable_order__c> conorderlist = new List<Consumable_order__c>(); |
| | | //20200916 ljh update start |
| | | if(Test.isRunningTest()){ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | |
| | | }else{ |
| | | //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | if(type !=null && type.equals('all')){ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | }else{ |
| | | conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false]; |
| | | } |
| | | } |
| | | system.debug('==============>conorderlist'+conorderlist); |
| | | system.debug('==============>conorderlist'+conorderlist.size()); |
| | | //20200916 ljh update end |
| | | // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation]; |
| | | System.debug('======'+conorderlist+'daxiao:'+conorderlist.size()); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | System.debug('======'+conorder.Owner.Name+'======'); |
| | | } |
| | | Set<String> orderId = new Set<String>(); |
| | | for(Consumable_order__c conorder : conorderlist){ |
| | | orderId.add(conorder.Id); |
| | | } |
| | | System.debug('ANY o'+orderId); |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | if(Test.isRunningTest()){ |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ]; |
| | | }else{ |
| | | //20200916 ljh update start |
| | | //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | if(type !=null && type.equals('all')){ |
| | | system.debug('all============'); |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | system.debug('allconList==========='+conList.size()); |
| | | }else{ |
| | | system.debug('notall============='); |
| | | conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | system.debug('notallconList==========='+conList.size()); |
| | | } |
| | | //20200916 ljh update end |
| | | } |
| | | // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery]; |
| | | Map<String,String> srtMap = new Map<String,String>(); |
| | | for(Consumable_order_details2__c con : conList){ |
| | | srtMap.put(con.Bar_Code__c, con.Id); |
| | | } |
| | | List<String> str = new List<String>(); |
| | | for(String s : srtMap.keySet()){ |
| | | str.add(srtMap.get(s)); |
| | | } |
| | | List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c |
| | | WHERE Id =: str and Cancellation_Flag__c = false |
| | | AND Consumable_order_minor__c != null |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Arrive__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Consumable_order_minor__r.showFalseNotshowTrue__c = false |
| | | AND Deliver_date__c < LAST_N_DAYS:7 |
| | | GROUP BY Asset_Model_No__c]; |
| | | system.debug('Morethan7daysList================>'+morethan7daysList.size()); |
| | | for(Integer i = 0 ; i< morethan7daysList.size() ; i++){ |
| | | morethansevendaysIifo.add(new showRecords(morethan7daysList[i])); |
| | | system.debug('MorethansevendaysIifo+++++++'+morethansevendaysIifo); |
| | | } |
| | | results.recordList = morethansevendaysIifo; |
| | | results.result = 'Success'; |
| | | }catch (Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<ShowRecords> recordList; |
| | | } |
| | | |
| | | |
| | | public class ShowRecords implements Comparable { |
| | | @AuraEnabled |
| | | public Decimal recordCount { get; set; } |
| | | @AuraEnabled |
| | | public String prodModel { get; set; } |
| | | |
| | | public ShowRecords() {} |
| | | |
| | | public ShowRecords(AggregateResult e) { |
| | | recordCount =Integer.valueOf(e.get('recordCount')); |
| | | prodModel = String.valueOf(e.get('prodModel')); |
| | | } |
| | | // 排序 |
| | | 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>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | /*** |
| | | * |
| | | * |
| | | * |
| | | * |
| | | */ |
| | | public without sharing class LexConsumableOrderManageController { |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String agencyProType { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static String baseUrl { get; private set; } |
| | | private static String[] columus = new List<String>{ 'Product2__c.Name' }; |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | public static List<CusOption> provinceCusOpts; |
| | | private static String accountid = null; |
| | | public static List<String> title { get; private set; } |
| | | public static List<String> column; |
| | | public static List<List<String>> columns { get; private set; } |
| | | public static List<Consumable_order__c> raesList { get; private set; } |
| | | private static String userWorkLocation; |
| | | public static Boolean hasHop { get; set; } |
| | | public static Boolean hasSpecial { get; set; } |
| | | public LexConsumableOrderManageController() { |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init1() { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | String userId = UserInfo.getUserId(); |
| | | // String userId = '0050l000007CAieAAG'; |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [ |
| | | SELECT accountid, Work_Location__c, UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userId |
| | | ]; |
| | | accountid = Useracc[0].accountid; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | coc = new Consumable_order__c(); |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('order_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | List<CusCol> cols = new List<CusCol>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | //add by Link |
| | | CusCol col = new CusCol(); |
| | | col.label = fsm.getLabel(); |
| | | col.fieldName = fsm.getFieldPath(); |
| | | col.hideDefaultActions = true; |
| | | // col.sortable = true; |
| | | col.wrapText = true; |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c') { |
| | | col.type = 'url'; |
| | | col.fieldName = 'hosUrl'; |
| | | TypeAttr typeAttributes1 = new TypeAttr(); |
| | | CusLable cusLabel = new CusLable(); |
| | | cusLabel.fieldName = 'hosName'; |
| | | typeAttributes1.label = cusLabel; |
| | | typeAttributes1.target = '_blank'; |
| | | col.typeAttributes = typeAttributes1; |
| | | } |
| | | if (fsm.getFieldPath() == 'Name') { |
| | | col.type = 'url'; |
| | | col.fieldName = 'nameUrl'; |
| | | TypeAttr typeAttributes1 = new TypeAttr(); |
| | | CusLable cusLabel = new CusLable(); |
| | | cusLabel.fieldName = 'Name'; |
| | | typeAttributes1.label = cusLabel; |
| | | typeAttributes1.target = '_blank'; |
| | | col.typeAttributes = typeAttributes1; |
| | | } |
| | | cols.add(col); |
| | | //update by rentx 2020-12-22 start |
| | | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | title.add(fsm.getLabel()); |
| | | } |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | } |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOpts.add(new SelectOption('草案中', '草案中')); |
| | | provinceOpts.add(new SelectOption('已提交', '已提交')); |
| | | provinceOpts.add(new SelectOption('批准', '批准')); |
| | | provinceOpts.add(new SelectOption('驳回', '驳回')); |
| | | //针对lwc的自定义option |
| | | provinceCusOpts = new List<CusOption>(); |
| | | provinceCusOpts.add(new CusOption('-无-', '')); |
| | | provinceCusOpts.add(new CusOption('草案中', '草案中')); |
| | | provinceCusOpts.add(new CusOption('已提交', '已提交')); |
| | | provinceCusOpts.add(new CusOption('批准', '批准')); |
| | | provinceCusOpts.add(new CusOption('驳回', '驳回')); |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '订单' + '\''; |
| | | soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\''; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\''; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c '; |
| | | System.debug('====soql====' + soql); |
| | | raesList = Database.query(soql); |
| | | //add by rentx 2021-3-10 start |
| | | //为 hasHop 赋值 判断当前经销商下是否有特价医院 |
| | | List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hopList == null || hopList.size() == 0) { |
| | | hasHop = false; |
| | | } else { |
| | | hasHop = true; |
| | | } |
| | | //为 hasSpecial 赋值 判断当前经销商下是否有促销商品 |
| | | //查询当前经销商下的有效合同 |
| | | List<Account> contractList = [ |
| | | SELECT Id, Name, RecordType.DeveloperName |
| | | FROM Account |
| | | WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid |
| | | ]; |
| | | List<Id> dealIds = new List<Id>(); |
| | | if (contractList != null && contractList.size() > 0) { |
| | | for (Account acc : contractList) { |
| | | dealIds.add(acc.Id); |
| | | } |
| | | List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds]; |
| | | if (deList == null || deList.size() == 0) { |
| | | hasSpecial = false; |
| | | } else { |
| | | hasSpecial = true; |
| | | } |
| | | } else { |
| | | hasSpecial = false; |
| | | } |
| | | results.result = 'Success'; |
| | | results.provinceOpts = provinceCusOpts; |
| | | results.raesList = raesList; |
| | | results.agencyProType = agencyProType; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.accountid = accountid; |
| | | results.hasHop = hasHop; |
| | | results.hasSpecial = hasSpecial; |
| | | results.title = title; |
| | | results.cols = cols; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails( |
| | | String categoryStr, |
| | | Date orderDate, |
| | | String orderStatus, |
| | | String accountidStr, |
| | | String agencyProTypeStr, |
| | | String userWorkLocationStr |
| | | ) { |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | accountid = accountidStr; |
| | | if (String.isBlank(categoryStr)) { |
| | | category1 = null; |
| | | } else { |
| | | category1 = categoryStr; |
| | | } |
| | | coc = new Consumable_order__c(); |
| | | if (String.isBlank(orderStatus)) { |
| | | coc.Order_status__c = null; |
| | | } else { |
| | | coc.Order_status__c = orderStatus; |
| | | } |
| | | coc.Order_date__c = orderDate; |
| | | try { |
| | | Date cate2 = coc.Order_date__c; |
| | | String cate3 = coc.Order_status__c; |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('order_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | //update by rentx 2020-12-22 start |
| | | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | title.add(fsm.getLabel()); |
| | | } |
| | | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { |
| | | } else { |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | } |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += |
| | | ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + |
| | | '订单' + |
| | | '\' and RecordtypeId = \'' + |
| | | System.Label.RT_ConOrder_Order + |
| | | '\' and Dealer_Info__c =\'' + |
| | | accountid + |
| | | '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Order_date__c = :cate2'; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Order_status__c = :cate3 '; |
| | | } |
| | | soql += ' order by Order_status__c '; |
| | | system.debug('====soql:' + soql); |
| | | raesList = Database.query(soql); |
| | | system.debug('====raesList:' + raesList); |
| | | if (raesList.size() > 0) { |
| | | results.result = 'Success'; |
| | | results.raesList = raesList; |
| | | results.errorMsg = '共有' + raesList.size() + '个订单'; |
| | | } else { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = '没有搜索到相关订单'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.raesList = new List<Consumable_order__c>(); |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<CusOption> provinceOpts; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public Boolean hasHop; |
| | | @AuraEnabled |
| | | public Boolean hasSpecial; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public List<CusCol> cols; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | |
| | | public class CusOption { |
| | | CusOption(String label, String value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | |
| | | public class CusCol { |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String fieldName; |
| | | @AuraEnabled |
| | | public String type; |
| | | @AuraEnabled |
| | | public Boolean sortable; |
| | | @AuraEnabled |
| | | public Boolean wrapText; |
| | | @AuraEnabled |
| | | public Boolean hideDefaultActions; |
| | | @AuraEnabled |
| | | public TypeAttr typeAttributes; |
| | | } |
| | | |
| | | public class TypeAttr { |
| | | @AuraEnabled |
| | | public CusLable label; |
| | | @AuraEnabled |
| | | public String target; |
| | | } |
| | | |
| | | public class CusLable { |
| | | @AuraEnabled |
| | | public String fieldName; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class LexDealerInquiryModifyStateController { |
| | | public static List<OpportunityInfo> oppRecords { get; set; } |
| | | // ページレイアウトの情報を取得 |
| | | private static Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>(); |
| | | // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null; |
| | | public static List<OpportunityInfo> OPPORTList { get; set; } |
| | | /*****************検索用******************/ |
| | | |
| | | /*******************检索属性值*******************/ |
| | | |
| | | public static String accSearch { get; set; }//经销商医院 |
| | | public static String aooSearch { get; set; }//担当人 |
| | | public static String numtext1 { get; set; } //数据字段01 |
| | | public static String numtext { get; set; }//数据字段03 |
| | | public static String numtext2 { get; set; } //数据字段02 |
| | | public static String timetext1 { get; set; } //日期01 |
| | | public static String timetext2 { get; set; } //日期02 |
| | | public static Agency_Opportunity__c tmpAO { get; set; } //检索日期用 |
| | | public static Agency_Opportunity__c tmpBO { get; set; } //检索日期用 |
| | | public static String limits { get; set; }//日期03 |
| | | |
| | | public static List<SelectOption> dateOpts { get; private set; } |
| | | public static List<CusOption> textCusOpts; |
| | | public static List<SelectOption> textOpts { get; private set; } |
| | | |
| | | public static List<CusOption> timeCusOpts; |
| | | public static List<SelectOption> timeOpts { get; private set; } |
| | | |
| | | public static List<CusOption> equalCusOpts; |
| | | public static List<SelectOption> equalOpts { get; private set; } |
| | | public static List<SelectOption> timeequalOpts { get; private set; } |
| | | public static List<CusOption> limitCusOpts; |
| | | public static List<SelectOption> limitOpts { get; private set; } |
| | | |
| | | /*****************画面表示Bean******************/ |
| | | public static Integer oppCount { get; set; } |
| | | public static String saveType { get; set; } |
| | | |
| | | 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[] columus = new String[] {'Id'}; |
| | | public static String[] selColumus = null; |
| | | public static Set<String> columusSet = new Set<String> {'Id'}; |
| | | |
| | | // 项目set 字段标签 |
| | | public static List<String> titleLeft { get; private set; } |
| | | public static List<String> titleRight { get; private set; } |
| | | // 项目set 字段名 |
| | | public static List<List<String>> columnsLeftApi { get; private set; } // 参照項目用 |
| | | public static List<List<String>> columnsRightApi { get; private set; } // 参照項目用 |
| | | public static List<String> columnLeftCss { get; private set; } // css 用 |
| | | public static List<String> columnRightCss { get; private set; } // css 用 |
| | | public static Map<String, String> columnLeftRW { get; private set; } // r,w,wm用 |
| | | public static Map<String, String> columnRightRW { get; private set; } // r,w,wm用 |
| | | private static String strColumus; |
| | | private static String strRtColumus; |
| | | |
| | | @TestVisible private static String accTypeForSort = null; |
| | | private static Integer oppLimit = 500; |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | // public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | |
| | | public LexDealerInquiryModifyStateController() { |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init(Integer pageSizeLWC,Integer pageTokenLWC) { |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | Results results = new Results(); |
| | | oppRecords = new List<OpportunityInfo>(); |
| | | |
| | | //dateOpts = new List<SelectOption>(); |
| | | //dateOpts.add(new SelectOption('', '--无--')); |
| | | //dateOpts.add(new SelectOption('Registration_Day__c', '登录日')); |
| | | //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '禁用日期')); |
| | | |
| | | //数据字段下拉列表 |
| | | // textOpts = new List<SelectOption>(); |
| | | // textOpts.add(new SelectOption('', '--无--')); |
| | | // textOpts.add(new SelectOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | // textOpts.add(new SelectOption('Agency__r.Name', '经销商')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | // textOpts.add(new SelectOption('Department_Cateogy__c', '科室分类')); |
| | | // textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | // // textOpts.add(new SelectOption('Name', '询价名称')); |
| | | // textOpts.add(new SelectOption('StageName__c', '询价阶段')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | // //精琢科技 zxk 2021-08-25 start |
| | | // // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '状态2')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | // //精琢科技 zxk 2021-08-25 end |
| | | // textOpts.add(new SelectOption('Hospital_City_Master__c', '市')); |
| | | |
| | | //custom option |
| | | textCusOpts = new List<CusOption>(); |
| | | textCusOpts.add(new CusOption('', '--无--')); |
| | | textCusOpts.add(new CusOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | textCusOpts.add(new CusOption('Agency__r.Name', '经销商')); |
| | | textCusOpts.add(new CusOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | textCusOpts.add(new CusOption('Department_Cateogy__c', '科室分类')); |
| | | textCusOpts.add(new CusOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | textCusOpts.add(new CusOption('StageName__c', '询价阶段')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | textCusOpts.add(new CusOption('Hospital_City_Master__c', '市')); |
| | | |
| | | |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '销售本部')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '省')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '市')); |
| | | //日期字段下拉列表 |
| | | // timeOpts = new List<SelectOption>(); |
| | | // timeOpts.add(new SelectOption('', '--无--')); |
| | | // timeOpts.add(new SelectOption('Created_Day__c', '创建日')); |
| | | // timeOpts.add(new SelectOption('Bid_Planned_Date__c', '预测招标日')); |
| | | // timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | // timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | // timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | // timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | timeCusOpts = new List<CusOption>(); |
| | | timeCusOpts.add(new CusOption('', '--无--')); |
| | | timeCusOpts.add(new CusOption('Created_Day__c', '创建日')); |
| | | timeCusOpts.add(new CusOption('Bid_Planned_Date__c', '预测招标日')); |
| | | timeCusOpts.add(new CusOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | timeCusOpts.add(new CusOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | timeCusOpts.add(new CusOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | timeCusOpts.add(new CusOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | |
| | | |
| | | //数据字段中间连接符号 |
| | | // equalOpts = new List<SelectOption>(); |
| | | // equalOpts.add(new SelectOption('=', '等于')); |
| | | // equalOpts.add(new SelectOption('<>', '不等于')); |
| | | // equalOpts.add(new SelectOption('<', '<')); |
| | | // equalOpts.add(new SelectOption('>', '>')); |
| | | // equalOpts.add(new SelectOption('<=', '<=')); |
| | | // equalOpts.add(new SelectOption('>=', '>=')); |
| | | // equalOpts.add(new SelectOption('contains', '包含')); |
| | | // equalOpts.add(new SelectOption('notcontains', '不包含')); |
| | | // equalOpts.add(new SelectOption('starts with', '起始字符')); |
| | | |
| | | equalCusOpts = new List<CusOption>(); |
| | | equalCusOpts.add(new CusOption('=', '等于')); |
| | | equalCusOpts.add(new CusOption('<>', '不等于')); |
| | | equalCusOpts.add(new CusOption('<', '<')); |
| | | equalCusOpts.add(new CusOption('>', '>')); |
| | | equalCusOpts.add(new CusOption('<=', '<=')); |
| | | equalCusOpts.add(new CusOption('>=', '>=')); |
| | | equalCusOpts.add(new CusOption('contains', '包含')); |
| | | equalCusOpts.add(new CusOption('notcontains', '不包含')); |
| | | equalCusOpts.add(new CusOption('starts with', '起始字符')); |
| | | |
| | | //日期字段连接符号 |
| | | //timeequalOpts = new List<SelectOption>(); |
| | | //timeequalOpts.add(new SelectOption('=', '等于')); |
| | | //timeequalOpts.add(new SelectOption('<>', '不等于')); |
| | | //timeequalOpts.add(new SelectOption('<', '<')); |
| | | //timeequalOpts.add(new SelectOption('>', '>')); |
| | | //timeequalOpts.add(new SelectOption('<=', '<=')); |
| | | //timeequalOpts.add(new SelectOption('>=', '>=')); |
| | | //数据显示条数 |
| | | // limitOpts = new List<SelectOption>(); |
| | | // limitOpts.add(new SelectOption('10', '10')); |
| | | // limitOpts.add(new SelectOption('20', '20')); |
| | | // limitOpts.add(new SelectOption('50', '50')); |
| | | // limitOpts.add(new SelectOption('100', '100')); |
| | | // limitOpts.add(new SelectOption('200', '200')); |
| | | // limitOpts.add(new SelectOption('1000', '全部')); |
| | | //数据显示默认条数 |
| | | limits = '20'; |
| | | |
| | | limitCusOpts = new List<CusOption>(); |
| | | limitCusOpts.add(new CusOption('10', '10')); |
| | | limitCusOpts.add(new CusOption('20', '20')); |
| | | limitCusOpts.add(new CusOption('50', '50')); |
| | | limitCusOpts.add(new CusOption('100', '100')); |
| | | limitCusOpts.add(new CusOption('200', '200')); |
| | | limitCusOpts.add(new CusOption('1000', '全部')); |
| | | try{ |
| | | PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap(); |
| | | soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element(); |
| | | soap.SessionHeader.sessionId = UserInfo.getSessionId(); |
| | | soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/partner/services/Soap/u/33.0'; |
| | | // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0'; |
| | | |
| | | PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult(); |
| | | if (System.Test.isRunningTest()) { |
| | | // UnitTest 用 |
| | | // PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult(); |
| | | PartnerSoapSforceCom.RecordTypeMapping rtMap = new PartnerSoapSforceCom.RecordTypeMapping(); |
| | | PartnerSoapSforceCom.DescribeLayout editLayout = new PartnerSoapSforceCom.DescribeLayout(); |
| | | PartnerSoapSforceCom.DescribeLayoutSection editLayoutSection = new PartnerSoapSforceCom.DescribeLayoutSection(); |
| | | PartnerSoapSforceCom.DescribeLayoutRow layoutRow = new PartnerSoapSforceCom.DescribeLayoutRow(); |
| | | PartnerSoapSforceCom.DescribeLayoutItem layoutItem = new PartnerSoapSforceCom.DescribeLayoutItem(); |
| | | PartnerSoapSforceCom.DescribeLayoutComponent layoutComponent = new PartnerSoapSforceCom.DescribeLayoutComponent(); |
| | | dlr.recordTypeMappings = new List<PartnerSoapSforceCom.RecordTypeMapping>(); |
| | | dlr.recordTypeMappings.add(rtMap); |
| | | rtMap.recordTypeId = 'recordTypeId'; |
| | | dlr.layouts = new List<PartnerSoapSforceCom.DescribeLayout>(); |
| | | dlr.layouts.add(editLayout); |
| | | editLayout.editLayoutSections = new List<PartnerSoapSforceCom.DescribeLayoutSection>(); |
| | | editLayout.editLayoutSections.add(editLayoutSection); |
| | | editLayoutSection.layoutRows = new List<PartnerSoapSforceCom.DescribeLayoutRow>(); |
| | | editLayoutSection.layoutRows.add(layoutRow); |
| | | layoutRow.layoutItems = new List<PartnerSoapSforceCom.DescribeLayoutItem>(); |
| | | layoutRow.layoutItems.add(layoutItem); |
| | | layoutItem.layoutComponents = new List<PartnerSoapSforceCom.DescribeLayoutComponent>(); |
| | | layoutItem.layoutComponents.add(layoutComponent); |
| | | // return dlr; |
| | | } else { |
| | | dlr = soap.describeLayout('Agency_Opportunity__c', null, null); |
| | | // dlr = soap.describeLayout('asdas', null, null); |
| | | } |
| | | |
| | | // PartnerSoapSforceCom.DescribeLayoutResult dlr = soap.describeLayout('Agency_Opportunity__c', null, null); |
| | | Map<String, PartnerSoapSforceCom.DescribeLayout> layputMap = new Map<String, PartnerSoapSforceCom.DescribeLayout>(); |
| | | for (PartnerSoapSforceCom.DescribeLayout layout : dlr.layouts) { |
| | | layputMap.put(layout.id, layout); |
| | | } |
| | | for (Integer lidx = 0; lidx < dlr.recordTypeMappings.size(); lidx++) { |
| | | String recordTypeId = dlr.recordTypeMappings[lidx].recordTypeId; |
| | | Map<String, String> rtnInner = new Map<String, String>(); |
| | | editLayoutItemRWMap.put(recordTypeId, rtnInner); |
| | | System.debug('recordTypeId=' + recordTypeId); |
| | | PartnerSoapSforceCom.DescribeLayout layout = layputMap.get(dlr.recordTypeMappings[lidx].layoutId); |
| | | for (PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections) { |
| | | for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) { |
| | | for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) { |
| | | if (item.layoutComponents != null && item.layoutComponents.size() > 0 |
| | | && String.isBlank(item.layoutComponents[0].value) == false) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'r'); |
| | | if (item.editableForUpdate) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'w'); |
| | | } |
| | | if (item.required) { |
| | | rtnInner.put(item.layoutComponents[0].value, 'wm'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // editLayoutItemRWMap = SoapApi.getEditRWByRecordType('Agency_Opportunity__c', null); |
| | | tmpAO = new Agency_Opportunity__c(); |
| | | tmpBO = new Agency_Opportunity__c(); |
| | | setLayoutRWInfo(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('limitCusOpts==>'+limitCusOpts); |
| | | System.debug('searchOppInner==>'+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey)); |
| | | LexDealerInquiryModifyStateController.Results returnList = searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('returnList==>'+ returnList); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = oppRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > oppRecords.size()) { |
| | | endIdx = oppRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageoppRecords.add(oppRecords.get(i)); |
| | | } |
| | | //end |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | results.timeCusOpts = timeCusOpts; |
| | | results.equalCusOpts = equalCusOpts; |
| | | results.limitCusOpts = limitCusOpts; |
| | | results.textCusOpts = textCusOpts; |
| | | results.limits = limits; |
| | | results.strColumus = strColumus; |
| | | results.strRtColumus = strRtColumus; |
| | | results.paginatedAccounts = paginatedAccounts; |
| | | results.pageoppRecords = pageoppRecords; |
| | | results.Msg = returnList.Msg; |
| | | |
| | | |
| | | System.debug('results==>'+results); |
| | | |
| | | }catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.Msg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | |
| | | // return null; |
| | | return results; |
| | | } |
| | | //用于获取经销商询价字段集和询价字段集以及相应的读写权限 |
| | | @TestVisible private static void setLayoutRWInfo() { |
| | | // if (this.sortOrder == null) { |
| | | if (sortOrder == null) { |
| | | selColumus = new String[] {}; |
| | | strColumus = ''; |
| | | ID accRecordTypeId = accTypeForSort; |
| | | |
| | | Map<String, String> DESC_RW = editLayoutItemRWMap.get('012100000006KW7AAM'); |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Agency_Opportunity__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('DealerInquiryModifyState'); |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | titleLeft = new List<String>(); |
| | | List<String> columnLeft = new List<String>(); |
| | | columnLeftCss = new List<String>(); |
| | | columnsLeftApi = new List<List<String>>(); |
| | | columnLeftRW = new Map<String, String>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | titleLeft.add(fsm.getLabel()); |
| | | columnLeft.add(fsm.getFieldPath()); |
| | | List<String> splitFieldPath = fsm.getFieldPath().split('\\.'); |
| | | columnsLeftApi.add(splitFieldPath); |
| | | if (DESC_RW == null) { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } else if (splitFieldPath.size() == 1) { |
| | | String rw = DESC_RW.get(fsm.getFieldPath()); |
| | | if (rw != null) { |
| | | columnLeftRW.put(fsm.getFieldPath(), rw); |
| | | } else { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } else { |
| | | columnLeftRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } |
| | | for (String str : columnLeftRW.keySet()) { |
| | | System.debug(str + '=+=+=+=+=' + columnLeftRW.get(str)); |
| | | } |
| | | for (String s : columnLeft) { |
| | | if (columusSet.contains(s) == false) { |
| | | columus.add(s); |
| | | columusSet.add(s); |
| | | } |
| | | if (selColumus.contains(s) == false) { |
| | | selColumus.add(s); |
| | | } |
| | | columnLeftCss.add(s.replace('.', '_')); |
| | | } |
| | | strRtColumus = ''; |
| | | Schema.FieldSet fsRt = fsMap.get('DealerOpportunity'); |
| | | List<FieldSetMember> fsmListRt = fsRt.getFields(); |
| | | titleRight = new List<String>(); |
| | | List<String> columnRight = new List<String>(); |
| | | columnRightCss = new List<String>(); |
| | | columnsRightApi = new List<List<String>>(); |
| | | columnRightRW = new Map<String, String>(); |
| | | |
| | | for (FieldSetMember fsm : fsmListRt) { |
| | | titleRight.add(fsm.getLabel()); |
| | | columnRight.add(fsm.getFieldPath()); |
| | | List<String> splitFieldPath = fsm.getFieldPath().split('\\.'); |
| | | columnsRightApi.add(splitFieldPath); |
| | | if (DESC_RW == null) { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } else if (splitFieldPath.size() == 1) { |
| | | String rw = DESC_RW.get(fsm.getFieldPath()); |
| | | if (rw != null) { |
| | | columnRightRW.put(fsm.getFieldPath(), rw); |
| | | } else { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } else { |
| | | columnRightRW.put(fsm.getFieldPath(), 'r'); |
| | | } |
| | | } |
| | | for (String s : columnRight) { |
| | | selColumus.add(s); |
| | | if (strRtColumus == '') { |
| | | strRtColumus = s; |
| | | } else { |
| | | strRtColumus = strRtColumus + ',' + s; |
| | | } |
| | | columnRightCss.add(s.replace('.', '_')); |
| | | |
| | | } |
| | | strColumus = String.join(columus, ','); |
| | | System.debug('======-======-======strColumus' + strColumus); |
| | | System.debug('======-======-======strRtColumus' + strRtColumus); |
| | | sortOrderAsc = true; |
| | | sortOrder = new String[selColumus.size()]; |
| | | for (Integer i = 0; i < selColumus.size(); i++) sortOrder[i] = ' '; |
| | | } |
| | | } |
| | | //用于拼接SOQL语句 根据不同检索条件拼接不同SOQL语句。 |
| | | @AuraEnabled |
| | | public static Results searchOppInner(String strColumus,String strRtColumus,String accSearch,String aooSearch,String numtext,String numtext1,String numtext2,String sortKeyLWC) { |
| | | Results results = new Results(); |
| | | sortKey = sortKeyLWC; |
| | | |
| | | //SOQL:拼接检索条件以及经销商询价的SOQL语句 |
| | | // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)]; |
| | | // String querySoql = ''; |
| | | // Integer queryint = 0; |
| | | // for(User user : userlist2){ |
| | | // if(queryint == 0){ |
| | | // querySoql += '\''+user.Id+'\''; |
| | | // queryint++; |
| | | // }else{ |
| | | // querySoql += ',\''+user.Id+'\''; |
| | | // } |
| | | |
| | | // } |
| | | // System.debug('pppqqq222'+userlist2); |
| | | // System.debug('pppqqq333'+querySoql); |
| | | // AND Ownerid in ( '+querySoql+')' |
| | | |
| | | String soql = 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' + |
| | | strColumus + ',' + strRtColumus + |
| | | ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' '; |
| | | //数据字段:经销商医院 +SOQL |
| | | if (!String.isBlank(accSearch)) { |
| | | accSearch = accSearch.trim(); |
| | | // soql += 'AND Agency__r.Name ' + ' LIKE \'%' + accSearch + '%\' '; |
| | | soql += 'AND Agency_Hospital__r.Name ' + ' LIKE \'%' + accSearch + '%\' '; |
| | | } |
| | | //数据字段:担当人 +SOQL |
| | | if (!String.isBlank(aooSearch)) { |
| | | String newAooSearch = aooSearch.trim(); |
| | | // soql += 'AND Change_To_Opportunity__r.Owner.Alias = ' + '\'' + newAooSearch + '\'';//Name |
| | | soql += 'AND Agency_PersonName__c ' + ' LIKE \'%' + newAooSearch + '%\' '; |
| | | } |
| | | //数据字段:03 手动填写项 准备调用makeTextSql; |
| | | if (!String.isBlank(numtext)) { |
| | | String newNumtext = numtext.trim(); |
| | | String str = makeTextSql(numtext1, numtext2, newNumtext); |
| | | soql += str; |
| | | System.debug('+++++++++++++=============++++++++++++++++++' + soql); |
| | | } |
| | | //点击排序 |
| | | // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7); |
| | | //start注释 by WangXueqin |
| | | // if (String.isBlank(this.sortKey)) { |
| | | // soql += ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits); |
| | | // } else { |
| | | // if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) { |
| | | // soql += ' order by ' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits); |
| | | // } else { |
| | | // soql += ' order by Change_To_Opportunity__r.' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits); |
| | | // } |
| | | // } |
| | | // system.debug(soql); |
| | | //end |
| | | |
| | | |
| | | |
| | | // List<User> userlist1 = [select id,name from user ]; |
| | | // System.debug('pppqqq111'+userlist1); |
| | | |
| | | List<Agency_Opportunity__c> InfoList = Database.query(soql); |
| | | System.debug('+++++++-------------------'+InfoList); |
| | | |
| | | // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql); |
| | | // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c); |
| | | for (Agency_Opportunity__c apt : InfoList) { |
| | | System.debug('pppqqq' + apt.Agency_PersonName__c + '====' + apt.Name); |
| | | } |
| | | |
| | | List<OpportunityInfo> oppinfoList = new List<OpportunityInfo>(); |
| | | if (InfoList != null && InfoList.size() > 0) { |
| | | String str = ''; |
| | | for (Agency_Opportunity__c agc : InfoList) { |
| | | if (str == '' && agc.Change_To_Opportunity__r.Id != null) { |
| | | str = '\'' + agc.Change_To_Opportunity__r.Id + '\''; |
| | | } else if (agc.Change_To_Opportunity__r.Id != null) { |
| | | str += ',\'' + agc.Change_To_Opportunity__r.Id + '\''; |
| | | |
| | | } |
| | | } |
| | | for (Agency_Opportunity__c info : InfoList) { |
| | | oppinfoList.add(new OpportunityInfo(info, info)); |
| | | oppinfoList[oppinfoList.size() - 1].lineNo = oppinfoList.size() - 1; |
| | | } |
| | | } |
| | | oppRecords = oppinfoList.clone(); |
| | | oppCount = oppRecords.size(); |
| | | //显示提示操作信息 |
| | | if (String.isBlank(saveType) && String.isBlank(sortKey)) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '取得最近的 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '取得最近的 ' + oppCount + ' 条数据'; |
| | | return results; |
| | | } else if (!String.isBlank(sortKey)) { |
| | | if (oppCount > oppLimit) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件')); |
| | | results.result = 'Success'; |
| | | results.Msg = '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件'; |
| | | |
| | | } else { |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | } |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | } |
| | | // //分页 |
| | | // PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | // totalCount = oppRecords.size(); |
| | | // paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | // paginatedAccounts.recordStart = pageToken + 1; |
| | | // paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | // Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | // paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | // paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | // Integer startIdx; |
| | | // Integer endIdx; |
| | | // List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | // startIdx = pageToken; |
| | | // endIdx = startIdx + pageSize; |
| | | // if (endIdx > oppRecords.size()) { |
| | | // endIdx = oppRecords.size(); |
| | | // } |
| | | // for (Integer i = startIdx; i < endIdx; i++) { |
| | | // pageoppRecords.add(oppRecords.get(i)); |
| | | // } |
| | | // //end |
| | | |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | return results; |
| | | |
| | | } |
| | | //检索条件:数据字段1,数据字段2,数据字段3均满足进入此方法 判断多种情况 |
| | | private static String makeTextSql(String textOpts, String equalOpts, String numtext) { |
| | | String soql = ''; |
| | | if (!String.isBlank(textOpts)) { |
| | | //寻找检索条件包含‘ ’ 空格的多重检索条件 |
| | | //system.debug('314-textOpts:'+textOpts); |
| | | if ((equalOpts == 'contains' || equalOpts == 'notcontains') && numtext.contains(',')) { |
| | | //system.debug('316-equalOpts:'+equalOpts); |
| | | //system.debug('316-numtext:'+numtext); |
| | | String[] vals = numtext.split(','); |
| | | String cSql = ''; |
| | | soql += ' AND ('; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | |
| | | //精琢科技 zxk 2021-08-25 start |
| | | String val = vals[icount]; |
| | | if (equalOpts == 'contains') { |
| | | cSql = makeTextSqlStr(textOpts, equalOpts, val); |
| | | soql += cSql; |
| | | |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | } |
| | | } else if (equalOpts == 'notcontains') { |
| | | cSql = makeTextSqlStr(textOpts, equalOpts, val); |
| | | soql += cSql; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' AND '; |
| | | } |
| | | } |
| | | |
| | | } |
| | | //精琢科技 zxk 2021-08-25 end |
| | | |
| | | |
| | | // String val = vals[icount]; |
| | | // cSql = this.makeTextSqlStr(textOpts, equalOpts, val); |
| | | // system.debug(cSql); |
| | | // soql += cSql; |
| | | // if (icount < vals.size() - 1) { |
| | | // soql += ' OR '; |
| | | // } |
| | | // } |
| | | soql += ')'; |
| | | } |
| | | //寻找检索条件包含‘,’ 逗号的多重检索条件 |
| | | else if ((equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')) { |
| | | String[] vals = numtext.split(','); |
| | | soql += ' AND ( '; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | String val = vals[icount]; |
| | | if (equalOpts == '=') { |
| | | soql += textOpts + ' = \'' + val + '\''; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | } |
| | | } else if (equalOpts == '<>') { |
| | | soql += textOpts + ' <> \'' + val + '\''; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' AND '; |
| | | } |
| | | } |
| | | } |
| | | soql += ')'; |
| | | } |
| | | //检索连接符为包含以及不包含 |
| | | else if (equalOpts.equals('contains') || equalOpts.equals('notcontains')) { |
| | | if (equalOpts.equals('contains')) { |
| | | soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\''; |
| | | } else if (equalOpts.equals('notcontains')) { |
| | | soql += ' AND ( NOT ' + textOpts + ' LIKE \'%' + numtext + '%\' ) '; |
| | | } |
| | | } |
| | | //检索连接符为等于以及不等于 |
| | | else if (equalOpts == '=' || equalOpts == '<>') { |
| | | soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\''; |
| | | } |
| | | |
| | | //精琢科技 zxk 2021-08-25 start |
| | | //起始字符 |
| | | else if (equalOpts == 'starts with' && numtext.contains(' ')) { |
| | | String[] vals = numtext.split(' '); |
| | | soql += ' AND ( '; |
| | | for (Integer icount = 0; icount < vals.size(); icount++) { |
| | | String val = vals[icount]; |
| | | if (equalOpts == 'starts with') { |
| | | soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ; |
| | | if (icount < vals.size() - 1) { |
| | | soql += ' OR '; |
| | | |
| | | } |
| | | } |
| | | } |
| | | soql += ')'; |
| | | |
| | | } |
| | | //精琢科技 zxk 2021-08-25 end |
| | | |
| | | // //起始字符 |
| | | // else if (equalOpts == 'starts with'){ |
| | | // soql += 'AND ' + textOpts + ' LIKE \'' + numtext + '%\''; |
| | | // } |
| | | //检索连接符的其他情况 |
| | | else { |
| | | String cSql = makeTextSqlStr(textOpts, equalOpts, numtext); |
| | | if (equalOpts != '<>') { |
| | | soql += cSql; |
| | | } else { |
| | | soql += ' and (NOT ' + cSql + ') '; |
| | | } |
| | | } |
| | | } |
| | | return soql; |
| | | } |
| | | //检索条件:数据字段1,数据字段2,数据字段3均满足,并且进入makeTextSql()之后,内含数据字段包含多种时进入此方法。 |
| | | @TestVisible private static String makeTextSqlStr(String textOpts, String equalOpts, String val) { |
| | | String soql = ''; |
| | | if (!String.isBlank(textOpts)) { |
| | | String tmpVal = val; |
| | | if (!String.isBlank(tmpVal)) { |
| | | if (equalOpts == 'contains' || equalOpts == 'notcontains') { |
| | | if (equalOpts == 'contains') { |
| | | soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ; |
| | | } else if (equalOpts == 'notcontains') { |
| | | soql += ' ( NOT ' + textOpts + ' LIKE \'%' + val + '%\' ) ' ; |
| | | } |
| | | } else if (equalOpts == '=' || equalOpts == '<>') { |
| | | if (equalOpts == '=') { |
| | | soql += ' AND ' + textOpts + ' = ' + val ; |
| | | } else if (equalOpts == '<>') { |
| | | soql += ' AND ' + textOpts + ' <> ' + val ; |
| | | } |
| | | } |
| | | } else { |
| | | soql = ' AND ' + textOpts; |
| | | if (equalOpts == '=') { |
| | | soql += ' = ' + tmpVal; |
| | | } else if (equalOpts == '<>') { |
| | | soql += ' <> ' + tmpVal; |
| | | } else if (equalOpts == 'contains') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else if (equalOpts == 'notcontains') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else if (equalOpts == 'starts with') { |
| | | soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\''; |
| | | } else { |
| | | soql += ' ' + equalOpts + ' ' + tmpVal; |
| | | } |
| | | } |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | //检索按钮:点击检索按钮触发此方法; |
| | | // public static PageReference chick() { |
| | | // setLayoutRWInfo(); |
| | | // searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey,pageSizeLWC,pageTokenLWC); |
| | | // return null; |
| | | // } |
| | | //页面内容有修改时,页面判断后传值给changeFlg以及changeFlgRt属性,点击保存时调用此方法,进行保存。 |
| | | @AuraEnabled |
| | | public static Results save(List<OpportunityInfo> oppRecordsLWC) { |
| | | //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp ); |
| | | Results results = new Results(); |
| | | oppRecords = oppRecordsLWC; |
| | | try { |
| | | List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>(); |
| | | // List<Opportunity> updOpps = new List<Opportunity>(); |
| | | for (OpportunityInfo oi : oppRecords) { |
| | | if (oi.changeFlg == '1') { |
| | | oi.changeFlg = '0'; |
| | | updTarget.add(oi.AgcOpp); |
| | | |
| | | } |
| | | // if (oi.changeFlgRt == '1' && oi.opp.id != null) { |
| | | // oi.changeFlgRt = '0'; |
| | | // updOpps.add(oi.opp); |
| | | // } |
| | | } |
| | | if (updTarget.size() > 0) { |
| | | system.debug('updTarget.size:' + updTarget.size() ); |
| | | update updTarget; |
| | | } |
| | | // if (updOpps.size() > 0) { |
| | | // update updOpps; |
| | | // } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了')); |
| | | results.result = 'Success'; |
| | | results.Msg = '保存完了'; |
| | | return results; |
| | | } catch (Exception e) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请确定科室分类和产品区分的关系')); |
| | | } |
| | | if(saveType == '1') { |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | saveType = ''; |
| | | } else if (saveType == '2') { |
| | | sortTable(); |
| | | saveType = ''; |
| | | } else { |
| | | } |
| | | return null; |
| | | } |
| | | //全部展开调用此方法 |
| | | public static PageReference sortTable() { |
| | | oppRecords = new List<OpportunityInfo>(); |
| | | if (sortKey == preSortKey) { |
| | | if (String.isBlank(sortKey) == false) { |
| | | // 方向が変わるのみ |
| | | sortOrderAsc = !sortOrderAsc; |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } |
| | | } else { |
| | | sortOrderAsc = true; |
| | | if (String.isBlank(preSortKey) == false) { |
| | | sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | } |
| | | sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | } |
| | | preSortKey = sortKey; |
| | | |
| | | setLayoutRWInfo(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | return null; |
| | | } |
| | | //分页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; } |
| | | } |
| | | |
| | | //自定义类OpportunityInfo,用于创建虚拟字段,合并输出。 |
| | | class OpportunityInfo { |
| | | // public Opportunity opp { get; set; } |
| | | @AuraEnabled |
| | | public Agency_Opportunity__c opp { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canEdit { get; private set; } |
| | | @AuraEnabled |
| | | public Boolean hasError { get; private set; } |
| | | @AuraEnabled |
| | | public Boolean hasFieldError { get; private set; } |
| | | @AuraEnabled |
| | | public Integer lineNo { get; private set; } |
| | | @AuraEnabled |
| | | public String changeFlg { get; set; } |
| | | @AuraEnabled |
| | | public String changeFlgRt { get; set; } |
| | | @AuraEnabled |
| | | public Boolean ifLock { get; set; } |
| | | //public String accType { get; private set; } |
| | | @AuraEnabled |
| | | public Agency_Opportunity__c AgcOpp { get; set; } |
| | | public OpportunityInfo(Agency_Opportunity__c record, Agency_Opportunity__c oppo) { |
| | | opp = oppo; |
| | | canEdit = true; |
| | | hasError = false; |
| | | hasFieldError = false; |
| | | lineNo = 0; |
| | | changeFlg = '0'; |
| | | changeFlgRt = '0'; |
| | | ifLock = Approval.isLocked(record); |
| | | AgcOpp = record; |
| | | } |
| | | } |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String Msg; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> oppRecords; |
| | | @AuraEnabled |
| | | public Integer oppCount ; |
| | | @AuraEnabled |
| | | public List<CusOption> timeCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> textCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> equalCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> limitCusOpts; |
| | | @AuraEnabled |
| | | public String limits; |
| | | @AuraEnabled |
| | | public String strColumus; |
| | | @AuraEnabled |
| | | public String strRtColumus; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> pageoppRecords; |
| | | @AuraEnabled |
| | | public PaginatedAccounts paginatedAccounts; |
| | | @AuraEnabled |
| | | public Boolean canEdit; |
| | | @AuraEnabled |
| | | public String changeFlg; |
| | | } |
| | | public class CusOption { |
| | | CusOption(String value,String label) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public without sharing class LexInventoryController { |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | //分页使用数据 |
| | | public static String fileName { get; set; } |
| | | public static Integer size{get;set;} |
| | |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 丢失和巡回的,实际炒作用 |
| | | @AuraEnabled |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 产品单位的List |
| | | public static List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>(); |
| | | |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords; |
| | | |
| | |
| | | //list<String> notexitlist = new list<String>(); |
| | | public static Map<String,String> reFindProduct = new Map<String,String>(); |
| | | //排序用 |
| | | public static String sortKey; |
| | | public static String preSortKey; |
| | | public static Boolean sortOrderAsc; |
| | | public static String[] sortOrder; |
| | | // public static String sortKey; |
| | | // public static String preSortKey; |
| | | // public static Boolean sortOrderAsc; |
| | | // public static String[] sortOrder; |
| | | //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 有,BarCodeListP 没有 |
| | | /*****************经销商ID******************/ |
| | | private static String accountid = null; |
| | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | |
| | | System.debug('pandiandetailsMap====>'+pandiandetailsMap); |
| | | initStandardController(); |
| | | makepagerecords(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[1]; |
| | | sortOrder = new String[]{' ',' ','↓'}; |
| | | // sortKey = '1'; |
| | | // preSortKey = '1'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new String[1]; |
| | | // sortOrder = new String[]{' ',' ','↓'}; |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | //String userId = '00510000006k82X'; |
| | | //String userId = '00510000005QO75'; |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId]; |
| | | accountid = Useracc.accountid; |
| | | accountid = Useracc.Accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start |
| | | //开始制作表头数据 |
| | | List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | SFDA_Status__c,Packing_list_manual__c, |
| | | Asset_Model_No__c |
| | | from Product2__c |
| | | //where Estimation_Entry_Possibility__c = '○' |
| | | where Product_Type__c like : sqlagencyProType |
| | | ]; |
| | | for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | } |
| | | // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | // SFDA_Status__c,Packing_list_manual__c, |
| | | // Asset_Model_No__c |
| | | // from Product2__c |
| | | // //where Estimation_Entry_Possibility__c = '○' |
| | | // where Product_Type__c like : sqlagencyProType |
| | | // ]; |
| | | // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | // } |
| | | //查询库存 追加返品库存 |
| | | List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName]; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size())); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start |
| | | //开始制作表头数据 |
| | | Set<Id> Product2cIdSet = new Set<Id>(); |
| | | for(Consumable_order_details2__c con_or_d2item: ProductCount_Res){ |
| | | Product2cIdSet.add(con_or_d2item.Consumable_Product__c); |
| | | } |
| | | List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | SFDA_Status__c,Packing_list_manual__c, |
| | | Asset_Model_No__c |
| | | from Product2__c |
| | | //where Estimation_Entry_Possibility__c = '○' |
| | | where Id in:Product2cIdSet |
| | | and Product_Type__c like : sqlagencyProType |
| | | ]; |
| | | for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | } |
| | | system.debug('productCount_Unfull_bak'+productCount_Unfull_bak.size()); |
| | | // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size(); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro)); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy end |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size())); |
| | | for(Integer i = 0 ; i< ProductCount_Res.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '盒'){ |
| | |
| | | } |
| | | //consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | listCut(); |
| | | |
| | | |
| | | |
| | | system.debug('ConsumableorderdetailsRecordsview'+ConsumableorderdetailsRecordsview); |
| | | System.debug('ConsumableorderdetailsRecordsview==>'+ConsumableorderdetailsRecordsview); |
| | | // data.put('ConsumableorderdetailsRecordsview',ConsumableorderdetailsRecordsview); |
| | | |
| | | // for(ConsumableorderdetailsInfo con: ConsumableorderdetailsRecordsview){ |
| | | // consumableorderdetailsviewRecords.add(con); |
| | | // } |
| | | System.debug('consumableorderdetailsviewRecords===>'+consumableorderdetailsviewRecords); |
| | | System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords); |
| | | |
| | | |
| | | |
| | | data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('accountName',accountName); |
| | | data.put('accountid',accountid); |
| | | |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | |
| | | //========20160311======ADD_End================================== |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC){ |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){ |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC); |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | |
| | | |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | |
| | | // consumableorderdetailsRecords = consumableorderdetailsRecordsLWC; |
| | | System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords); |
| | | System.debug('agencyProType===>'+sqlagencyProType); |
| | | System.debug('accountName===>'+accountName); |
| | | |
| | | |
| | | |
| | | /* BarCodelist做成 */ |
| | |
| | | } |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | res.code = 400; |
| | | res.status = 'fail'; |
| | | res.msg = 'barcode为空'; |
| | | return res; |
| | | // return; |
| | | |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | System.debug('codPageRecords===>'+codPageRecords); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | data.put('reSet1',reSet1); |
| | | System.debug('reSet1===>'+reSet1); |
| | | res.code = 200; |
| | | res.status = 'Success1'; |
| | | |
| | | return res; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | order by Name]; |
| | | System.debug('reSet===>'+reSet); |
| | | Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | | // 20200509 add gzw 记录需要销存数量 |
| | | Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | |
| | | System.debug('=====>codPageRecords2'+codPageRecords); |
| | | System.debug('=====>consumableorderdetailsRecords'+consumableorderdetailsRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | data.put('pandiandetailsMap',JSON.serialize(pandiandetailsMap)); |
| | | |
| | | |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | data.put('reSet',reSet); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | System.debug('=====>consumableorderdetailsRecordsview'+consumableorderdetailsRecordsview); |
| | | res.code = 200; |
| | | res.status = 'Sucess'; |
| | | return res; |
| | | } |
| | | |
| | | public static ResponseBodyLWC saveConfirm(Boolean iSinventory,String consumableorderdetailsRecordsLWC) { |
| | | save(iSinventory,consumableorderdetailsRecordsLWC); |
| | | // LexInventoryController.oinoi |
| | | return null; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC) { |
| | | public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) { |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | agencyProType = agencyProType; |
| | | accountid =accountid; |
| | | pandiandetailsMap = pandiandetailsMap; |
| | | reSet =reSet; |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | return new ResponseBodyLWC('Error',500, '请先点【BarCode录入】', ''); |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | // return null; |
| | | } |
| | |
| | | ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407 |
| | | } |
| | | |
| | | }catch (Exception ex) { |
| | | }catch (Exception e) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(ex); |
| | | return null; |
| | | // ApexPages.addMessages(ex); |
| | | return new ResponseBodyLWC('Error',500, e.getMessage()+e.getLineNumber(), ''); |
| | | // return null; |
| | | } |
| | | // FIXME impliment BarCodeListAdjust |
| | | /************************************************************************************************/ |
| | | // return ProS(); |
| | | data.put('eSetId',eSetId); |
| | | data.put('InsListUp',InsListUp); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | |
| | | Pagereference pr = page.InventoryCSV; |
| | | return pr; |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal countid { get; set; } |
| | | @AuraEnabled |
| | | public String ProdId{get;set;} |
| | | @AuraEnabled |
| | | public Decimal Pandian { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Diff { get; set; } |
| | | @AuraEnabled |
| | | public Decimal refind { get; set; } |
| | | @AuraEnabled |
| | | public String DiffReason { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public String boxPiece { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { |
| | | |
| New file |
| | |
| | | public without sharing class LexInventoryListController { |
| | | /*****************検索用******************/ |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static String baseUrl {get;private set;} |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError { get; set; } |
| | | // 盘点明细1 |
| | | private static List<Consumable_orderdetails__c> consumableorderdetails1 = new List<Consumable_orderdetails__c>(); |
| | | // 盘点明细2 |
| | | private static List<Consumable_order_details2__c> consumableorderdetailsSelected = new List<Consumable_order_details2__c>(); |
| | | |
| | | // 盘点单号 ID |
| | | private static String ESetId = ''; |
| | | public LexInventoryListController() { |
| | | //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8'); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | ESetId = ApexPages.currentPage().getParameters().get('esetId'); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>(); |
| | | } |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String eSetId) { |
| | | system.debug('eSetId====>'+eSetId); |
| | | ESetId = eSetId; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order__c> qs = New List<Consumable_order__c>(); |
| | | qs = [select Name,Inventory_date__c,Order_date__c From Consumable_order__c Where Id =:ESetId]; |
| | | System.debug('qs===>'+qs); |
| | | if (qs.size()>0){ |
| | | coc = qs[0]; |
| | | } |
| | | // 選択済みの明细を取得 |
| | | consumableorderdetailsSelected = [ |
| | | select Id, Name, Consumable_Product__c, |
| | | Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c,Bar_Code__c, |
| | | Consumable_Product__r.Asset_Model_No__c,Lose_Flag__c, |
| | | recordtypeid,Lose_reason__c |
| | | from Consumable_order_details2__c |
| | | where Consumable_Inventory_order__c = :ESetId |
| | | order by Name ]; |
| | | System.debug('consumableorderdetailsSelected==>'+consumableorderdetailsSelected); |
| | | |
| | | for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) { |
| | | consumableorderdetailsRecordsError.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i])); |
| | | } |
| | | consumableorderdetails1 = [ |
| | | select Id, Name,Diff__c,inventory_sum__c, |
| | | Count_Sum__c,Consumable_order__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name,Consumable_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c,Consumable_Product__r.Name__c, |
| | | Sum_of_money__c,recordtypeid,Lose_reason__c,Product_Refind__c |
| | | from Consumable_orderdetails__c |
| | | where Consumable_order__c = :ESetId |
| | | order by Name ]; |
| | | for (Integer i = 0; i < consumableorderdetails1.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i])); |
| | | } |
| | | data.put('qs',qs); |
| | | System.debug('consumableorderdetailsRecords====>'+consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError)); |
| | | // if(ConsumableorderdetailsRecordsError.size()!=null){ |
| | | // data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError)); |
| | | // } |
| | | System.debug('ConsumableorderdetailsRecordsError====>'+ConsumableorderdetailsRecordsError); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | public Product2__c Prod { get; set; } |
| | | // 明细1 |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 明细2 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexInventoryViewController { |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | // public static Integer pagecount { get; set; } |
| | | // public static Integer currentpage { get; set; } |
| | | // public static Boolean hasPrevious { get; set; } |
| | | // public static Boolean hasNext { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> pageRecords { get; set; } |
| | | public static String soql { 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[] columus = new List<String>{ |
| | | // 'Product2__c.Name__c', |
| | | // 'Asset_Model_No__c', |
| | | // '', |
| | | // 'Category3__c', |
| | | // 'Category4__c', |
| | | // 'Category5__c', |
| | | // '' |
| | | // }; |
| | | |
| | | public static String[] proLimitAndDate = new List<String>{}; |
| | | private static Map<String, Date> productkucun = new Map<String, Date>(); |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> categoryOptionMap { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category4OptionMap { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category5OptionMap { get; set; } |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static String category_Goods { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static Boolean editAble { get; set; } |
| | | // 经销商在库产品ID |
| | | public static List<String> orderDetZaikuList = new List<String>(); |
| | | // 产品 ID |
| | | public static String ESetId { get; set; } |
| | | public static String idCheck { get; set; } |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | private static String accountid = null; |
| | | public static String accountName { get; set; } |
| | | // 查看产品 |
| | | // private String[] ProidListAll = new String[]{}; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType { get; set; } |
| | | public static String sqlagencyProType; |
| | | |
| | | // add by rentx 2021-3-10 |
| | | public static Boolean hasHos { get; set; } |
| | | // add by rentx 2021-3-10 |
| | | |
| | | public LexInventoryViewController() { |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | editAble = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | // page |
| | | // pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // currentpage = 0; |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC) { |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | |
| | | // 取用户ID |
| | | String userId = UserInfo.getUserId(); |
| | | User useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | accountid = useracc.accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Account accountInfo = [SELECT Name, Dealer_discount__c, Product_Limit_Date__c FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.Name; |
| | | // 经销商查看产品 |
| | | String product_Limit = accountInfo.Product_Limit_Date__c; |
| | | |
| | | if (product_Limit != null && product_Limit != '') { |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, Product2__c> MidMap = new Map<String, Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // 库存明细取得 |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | orderDetZaikuList = new List<String>(); |
| | | System.debug('sqlagencyProType = ' + sqlagencyProType); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | List<AggregateResult> orderDetZaiku = [ |
| | | SELECT count(Id), Consumable_Product__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | GROUP BY Consumable_Product__c |
| | | ]; |
| | | |
| | | for (AggregateResult zaikuId : orderDetZaiku) { |
| | | orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c'))); |
| | | } |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ]; |
| | | System.debug('MidMap = ' + MidMap); |
| | | System.debug('CountDel111 = ' + CountDel); |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | List<Product2__c> product2Selected = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Name__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Category3__c, |
| | | Category4__c, |
| | | Category5__c, |
| | | SFDA_Status__c, |
| | | Product2__r.SFDA_Approbation_No__c, |
| | | Product2__r.SFDA_Expiration_Date__c, |
| | | Product2__r.Packing_list_manual__c |
| | | FROM Product2__c |
| | | WHERE Id IN :orderDetZaikuList |
| | | ]; |
| | | System.debug('product2Selected = ' + product2Selected); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, product2Selected[i]); |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | /////////////////////====================================update by rentx |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // update by rentx 2021-01-27 start |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | // 然后循环CountDel做Box和piece2个map |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | // 把Boxmap里的值从新赋给boxRecords |
| | | System.debug('newMidBoxMap = ' + newMidBoxMap); |
| | | for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.sortBy = false; |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | |
| | | boxRecords.sort(); |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : boxRecords) { |
| | | consumableorderdetailsRecords.add(bss); |
| | | // 该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id + '个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个A'); |
| | | // } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | Integer hosnum = 0; |
| | | // add by rentx 2021-3-10 end |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if (productkucun.get(bss.Prod.Id) != null) { |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | if (bss.hospitalSpecialOffer) { |
| | | hosnum = hosnum + 1; |
| | | } |
| | | } |
| | | if (hosnum > 0) { |
| | | hasHos = true; |
| | | } else { |
| | | hasHos = false; |
| | | } |
| | | // add by rentx 2021-3-10 end |
| | | // listCut(); |
| | | |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | |
| | | categoryOptionList = new List<SelectOption>(); |
| | | categoryOptionList.add(new SelectOption('', '-无-')); |
| | | categoryOptionMap.put('', '-无-'); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | categoryOptionMap.put(deliverycnt, deliverycnt); |
| | | } |
| | | |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap.put('', '-无-'); |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap.put('', '-无-'); |
| | | System.debug('categoryOptionList===>' + category4OptionList); |
| | | System.debug('category4OptionList===>' + category4OptionList); |
| | | System.debug('category5OptionList===>' + category4OptionList); |
| | | |
| | | //// 总件数 |
| | | totalcount = consumableorderdetailsRecords.size(); |
| | | //// 页数 |
| | | // pagecount = (totalcount + pagesize - 1) / pagesize; |
| | | |
| | | //// 显示第一页 |
| | | |
| | | // moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | // data.put('categoryOptionList',categoryOptionList); |
| | | 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('paginatedAccounts', paginatedAccounts); |
| | | |
| | | data.put('categoryOptionMap', categoryOptionMap); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('orderDetZaikuList', orderDetZaikuList); |
| | | data.put('accountid', accountid); |
| | | data.put('accountName', accountName); |
| | | data.put('sqlagencyProType', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('pageRecords', pageRecords); |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('hasHos', hasHos); |
| | | data.put('productLimtAndDate',proLimitAndDate); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryAllload(String category3LWC,String agencyProTypeLWC) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | category3 = category3LWC; |
| | | agencyProType = '%' + agencyProTypeLWC + '%'; |
| | | |
| | | System.debug('category3LWC===>'+category3LWC); |
| | | System.debug('agencyProType===>'+agencyProType); |
| | | |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | System.debug('类别4'+category4OptionList); |
| | | System.debug('类别5'+category5OptionList); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void categoryload() { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Category3_text__c = :category3 |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category4_text__c = :category4 |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | } |
| | | // 检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String category1, |
| | | String Category3, |
| | | String Category4, |
| | | String Category5, |
| | | List<String> orderDetZaikuListLWC, |
| | | String accountName, |
| | | string agencyProType, |
| | | string userWorkLocation, |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC, |
| | | String sortFieldLWC, |
| | | String sortOrderLWC |
| | | ) { |
| | | try { |
| | | System.debug('orderDetZaikuListLWC===>'+orderDetZaikuListLWC); |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | orderDetZaikuList = new List<String>(); |
| | | |
| | | orderDetZaikuList = orderDetZaikuListLWC; |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | System.debug('====>accountName' + accountName); |
| | | System.debug('====>sqlagencyProType' + sqlagencyProType); |
| | | System.debug('====>userWorkLocation' + userWorkLocation); |
| | | System.debug('====>category1' + category1); |
| | | System.debug('====>Category3' + Category3); |
| | | System.debug('====>Category4' + Category4); |
| | | System.debug('====>Category5' + Category5); |
| | | // sortKey = '2'; |
| | | // preSortKey = '2'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '↓' }; |
| | | |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ]; |
| | | System.debug('CountDel = ' + CountDel); |
| | | |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, Product2__c> MidMap = new Map<String, Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | |
| | | // 所有产品取得 |
| | | String soql = makeSoql(category1, category_Goods, category3, category4, category5); |
| | | //orderDetZaikuList |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('soql====>' + soql); |
| | | //排序 |
| | | // if (String.isNotBlank(sortField) && String.isNotBlank(sortOrder)) { |
| | | // if(sortFieldLWC != 'limitCount'){ |
| | | // soql += ' ORDER BY ' + sortField + ' ' + sortOrder; |
| | | |
| | | // } |
| | | // } |
| | | System.debug('soql = ' + soql); |
| | | //soql += ' ORDER BY ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | List<Product2__c> queryList = Database.query(soql); |
| | | System.debug('queryList = ' + queryList); |
| | | |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | MidMap.put(queryList[i].Id, queryList[i]); |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | System.debug('CountDel = ' + CountDel); |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | //然后循环CountDel做Box和piece2个map |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个') { |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) { |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get( |
| | | CountDel[i].Consumable_Product__c + |
| | | CountDel[i].Box_Piece__c + |
| | | tex |
| | | ) |
| | | .clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } else { |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Isoverdue__c == 1) { |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('newMidBoxMap = ' + newMidBoxMap); |
| | | //把Boxmap里的值从新赋给boxRecords |
| | | for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.sortBy = false; |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | |
| | | boxRecords.sort(); |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (bss.allnumber > 0) { |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | System.debug('boxRecords = ' + boxRecords); |
| | | for (ConsumableorderdetailsInfo bss : boxRecords) { |
| | | consumableorderdetailsRecords.add(bss); |
| | | //该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id + '个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id + '个A'); |
| | | // } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) { |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id + '个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | System.debug('consumableorderdetailsRecords zzz = ' + consumableorderdetailsRecords); |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if (productkucun.get(bss.Prod.Id) != null) { |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | } |
| | | //listCut(); |
| | | |
| | | // sortKey = '2'; |
| | | // preSortKey = '2'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '↓' }; |
| | | |
| | | // //总件数 |
| | | totalcount = consumableorderdetailsRecords.size(); |
| | | // //页数 |
| | | // pagecount=(totalcount + pagesize - 1) / pagesize; |
| | | |
| | | //显示第一页 |
| | | //currentpage = 0; |
| | | //moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | 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<ConsumableorderdetailsInfo> pageRecordsCompare = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('queryList = ' + JSON.serialize(queryList)); |
| | | for (Integer i = 0; i < queryList.size(); i++) { |
| | | for(ConsumableorderdetailsInfo ci : pageRecords){ |
| | | if(queryList[i].Id == ci.Prod.Id){ |
| | | System.debug('queryList[i].Id =' + queryList[i].Id); |
| | | System.debug('ci.Prod.Id =' + queryList[i].Id); |
| | | pageRecordsCompare.add(ci); |
| | | } |
| | | } |
| | | } |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('pageRecords', pageRecordsCompare); |
| | | data.put('hasHos', hasHos); |
| | | system.debug('===========>pageRecords' + pageRecordsCompare); |
| | | system.debug('===========>data' + data); |
| | | if (pageRecords.isEmpty()) { |
| | | res.msg = '未搜索到相关消耗品订单!'; |
| | | res.status = 'fail'; |
| | | res.code = 500; |
| | | } else { |
| | | res.status = 'Success'; |
| | | res.msg = '共有' + pageRecords.size() + '条数据'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | } |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getStackTraceString(), ''); |
| | | } |
| | | } |
| | | |
| | | public static void productLimtAndDate() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void datelimitSearch() { |
| | | List<String> barcodekucun = new List<String>(); |
| | | List<Consumable_order_details2__c> orderkucun = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Recordtypeid, Guarantee_period_for_products__c, Sterilization_limit__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Consumable_Product__c, Sterilization_limit__c ASC |
| | | ]; |
| | | for (Integer i = 0; i < orderkucun.size(); i++) { |
| | | if (productkucun.containsKey(orderkucun[i].Consumable_Product__c)) { |
| | | continue; |
| | | } else { |
| | | productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //名称排序 |
| | | // public static void SortLimited() { |
| | | // Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // Map<String, ConsumableorderdetailsInfo> newMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | // if (sortKey == preSortKey) { |
| | | // // 方向が変わるのみ |
| | | // sortOrderAsc = !sortOrderAsc; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } else { |
| | | // sortOrderAsc = true; |
| | | // sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } |
| | | |
| | | // preSortKey = sortKey; |
| | | // // 所有产品取得 |
| | | // String soql = makeSoql(null, null, null, null, null); |
| | | // soql += ' ORDER BY ' + columus[Integer.valueOf(sortKey)] + ' ' + (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); |
| | | // List<Product2__c> queryList = Database.query(soql); |
| | | // for (Integer i = 0; i < queryList.size(); i++) { |
| | | // MidMap.put(queryList[i].Id + '盒', null); |
| | | // MidMap.put(queryList[i].Id + '个', null); |
| | | // } |
| | | |
| | | // //update by rentx 2020-12-29 |
| | | // for (Integer i = 0; i < pageRecords.size(); i++) { |
| | | // if (MidMap.containsKey(pageRecords[i].prod.Id + pageRecords[i].BoxPiece)) { |
| | | // ConsumableorderdetailsInfo Jstage = pageRecords[i].clone(); |
| | | // if (Jstage.hospitalSpecialOffer == true) { |
| | | // newMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage); |
| | | // } else { |
| | | // MidMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | |
| | | // //update byr entx 2020-12-29 |
| | | // //再把map里的值从新赋给CpageRecords |
| | | // for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | // if (bss != null) { |
| | | // pageRecords.add(bss); |
| | | // if (newMap.get(bss.Prod.Id + bss.BoxPiece) != null) { |
| | | // pageRecords.add(newMap.get(bss.Prod.Id + bss.BoxPiece)); |
| | | // newMap.remove(bss.Prod.Id + bss.BoxPiece); |
| | | // } |
| | | // } |
| | | // } |
| | | // for (ConsumableorderdetailsInfo bss : newMap.values()) { |
| | | // if (bss != null) { |
| | | // pageRecords.add(bss); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //库存排序 |
| | | // public static void SortStore() { |
| | | // if (sortKey == preSortKey) { |
| | | // // 方向が変わるのみ |
| | | // sortOrder = !sortOrder; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } else { |
| | | // sortOrderAsc = true; |
| | | // sortOrder[Integer.valueOf(preSortKey)] = ' '; |
| | | // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '↑' : '↓'); |
| | | // } |
| | | // preSortKey = sortKey; |
| | | |
| | | // for (ConsumableorderdetailsInfo ass : pageRecords) { |
| | | // ass.sortBy = sortOrderAsc; |
| | | // } |
| | | // pageRecords.sort(); |
| | | // } |
| | | |
| | | |
| | | //检索sql文做成 |
| | | private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) { |
| | | System.debug('orderDetZaikuList = ' + orderDetZaikuList); |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderDetZaikuList.size(); i++) { |
| | | if (i < orderDetZaikuList.size() - 1) { |
| | | sqlTail += orderDetZaikuList[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderDetZaikuList[i] + '\')'; |
| | | } |
| | | } |
| | | String soql = 'select Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Category3__c,Category4__c,Category5__c,'; |
| | | soql += ' SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c FROM Product2__c '; |
| | | soql += ' WHERE Id in' + sqlTail; |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | return soql; |
| | | } |
| | | //首页 |
| | | // public static void moveToFirst() { |
| | | // if (currentpage == 1) |
| | | // return; |
| | | // currentpage = 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //尾页 |
| | | // public static void moveToLast() { |
| | | // if (currentpage >= pagecount) |
| | | // return; |
| | | // currentpage = pagecount; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //上一页 |
| | | // public static void moveToPrevious() { |
| | | // if (currentpage == 1) |
| | | // return; |
| | | // currentpage = currentpage - 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //下一页 |
| | | // public static void moveToNext() { |
| | | // if (currentpage >= pagecount) |
| | | // return; |
| | | |
| | | // currentpage = currentpage + 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | // //判断是否可翻页 |
| | | // public static void canMove() { |
| | | // hasPrevious = false; |
| | | // hasNext = false; |
| | | // if (pagecount > 1 && currentpage > 1) |
| | | // hasPrevious = true; |
| | | // if (pagecount > 1 && currentpage < pagecount) |
| | | // hasNext = true; |
| | | // } |
| | | |
| | | //刷新当前页 |
| | | // public static PageReference refreshPageSize() { |
| | | // makeCurrentPageRecords(); |
| | | // return null; |
| | | // } |
| | | |
| | | //编辑当前页内容 |
| | | public static void makeCurrentPageRecords() { |
| | | // pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | // System.debug('consumableorderdetailsRecords =' + consumableorderdetailsRecords); |
| | | // for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) { |
| | | // pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | // } |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | if (endIdx > consumableorderdetailsRecords.size()) { |
| | | endIdx = consumableorderdetailsRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | } |
| | | } |
| | | |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order__c Concc { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Date guaranteeperiod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | esd = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | allnumber = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexLicenceReminderController { |
| | | |
| | | @AuraEnabled |
| | | public static Results initReminder(){ |
| | | Results results = new Results(); |
| | | try { |
| | | User useracc = [SELECT AccountId, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | String accountId = useracc.AccountId; |
| | | List<Account> accList = [SELECT Name,Medical_Equipment_Expiration_Date__c FROM Account WHERE Id =:accountId]; |
| | | Account accountInfo = new Account(); |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.isShowReminder = false; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | if(accountInfo.Medical_Equipment_Expiration_Date__c != null){ |
| | | Integer days = LexUtility.getLicenceReminderDays(); |
| | | Date today = Date.today(); |
| | | // Date today = Date.newInstance(2024, 7, 21); |
| | | Integer numberDaysDue = today.daysBetween(accountInfo.Medical_Equipment_Expiration_Date__c); |
| | | if(numberDaysDue > days){ |
| | | results.isShowReminder = false; |
| | | }else{ |
| | | results.isShowReminder = true; |
| | | results.days = numberDaysDue; |
| | | } |
| | | results.result = 'Success'; |
| | | }else { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到医疗器械经营企业许可证有效期限'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.isShowReminder = false; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public Boolean isShowReminder; |
| | | @AuraEnabled |
| | | public Integer days; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexOutboundorderImportController { |
| | | //经销商产品分类 |
| | | public static String agencyProType { get; set; } |
| | | private static String sqlagencyProType; |
| | | public static Blob csvFileBody { get; set; } |
| | | public static string csvAsString { get; set; } |
| | | public static String[] csvFileLines { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> orderRecords { get; set; } |
| | | public static List<String[]> csvRecordStr { get; set; } |
| | | public static Map<String, String> hospitalconMap { get; set; } |
| | | public static Map<String, String> product2conMap { get; set; } |
| | | public static Map<String, String> hospitalSysMap { get; set; } |
| | | public static Map<String, String> secondAgencyMap { get; set; } |
| | | private static String accountid { get; set; } |
| | | private static String accountName { get; set; } |
| | | private static Integer messageCount; |
| | | public static boolean saveFLGbln { get; set; } |
| | | private static List<String> barcodeList { get; set; } |
| | | private static List<String> barcodePieceList { get; set; } |
| | | public static Map<String, Integer> barcodePieceMap { get; set; } |
| | | public static boolean errorflg { get; set; } |
| | | public static String errorMessage { get; set; } |
| | | private static String userWorkLocation { get; set; } |
| | | public static String errorMsg { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | messageCount = 0; |
| | | errorflg = false; |
| | | errorMessage = null; |
| | | User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountid = Useracc.accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.name; |
| | | |
| | | data.put('accountid', accountid); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('accountName', accountName); |
| | | data.put('sqlagencyProType', sqlagencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC importCSVFile( |
| | | String base64DataLwc, |
| | | String sqlagencyProTypeLwc, |
| | | String userWorkLocationLwc, |
| | | String accountNameLwc |
| | | ) { |
| | | System.debug('enter importCSVFile'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | errorMsg = ''; |
| | | sqlagencyProType = sqlagencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | accountName = accountNameLwc; |
| | | String base64Data = EncodingUtil.urlDecode(base64DataLwc, 'UTF-8'); |
| | | csvFileBody = EncodingUtil.base64Decode(base64Data); |
| | | product2conMap = new Map<String, String>(); |
| | | |
| | | messageCount = 0; |
| | | errormessage = null; |
| | | saveFLGbln = false; |
| | | csvRecordStr = new List<String[]>(); |
| | | barcodeList = new List<String>(); |
| | | barcodePieceMap = new Map<String, Integer>(); |
| | | barcodePieceList = new List<String>(); |
| | | orderRecords = new List<ConsumableorderdetailsInfo>(); |
| | | hospitalconMap = new Map<String, String>(); |
| | | if (csvFileBody == null) { |
| | | errorflg = true; |
| | | saveFLGbln = true; |
| | | // errormessage = '读取内容为空。'; |
| | | return new ResponseBodyLWC('Error', 500, '读取内容为空。', ''); |
| | | } else { |
| | | //产品数据查找 |
| | | map<string, string> orderNameMap = new Map<string, string>(); |
| | | try { |
| | | csvAsString = csvFileBody.toString(); |
| | | csvFileLines = csvAsString.split('\n'); |
| | | for (Integer i = 0; i < csvFileLines.size(); i++) { |
| | | string[] csvRecordData = csvFileLines[i].split(','); |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | if (String.valueOf(csvRecordData[9]) == '个') { |
| | | barcodePieceList.add(csvRecordData[6]); |
| | | barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7])); |
| | | } |
| | | } |
| | | String[] csvRecordDataStr = new List<String>(13); |
| | | for (Integer j = 0; j < csvRecordData.size(); j++) { |
| | | csvRecordDataStr[j] = csvRecordData[j]; |
| | | } |
| | | if (i == 0) { |
| | | csvRecordDataStr[12] = '产品'; |
| | | } else { |
| | | csvRecordDataStr[12] = ''; |
| | | } |
| | | csvRecordStr.add(csvRecordDataStr); |
| | | } |
| | | Map<String, String> productBarcodeMap = new Map<String, String>(); |
| | | List<Consumable_order_details2__c> cOrderDet = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodeList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Consumable_order_details2__c pdinfo : cOrderDet) { |
| | | productBarcodeMap.put(pdinfo.Bar_Code__c, pdinfo.Consumable_Product__c); |
| | | } |
| | | for (String[] csvlistStr : csvRecordStr) { |
| | | if (productBarcodeMap.containsKey(csvlistStr[6])) { |
| | | csvlistStr[12] = productBarcodeMap.get(csvlistStr[6]); |
| | | } else { |
| | | } |
| | | } |
| | | //检索存在拆盒产品数量 |
| | | Map<String, Integer> exitpieceBarcodeMap = new Map<String, Integer>(); |
| | | AggregateResult[] pieceOrderDet = [ |
| | | SELECT count(Id) cnt, Bar_Code__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodePieceList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | GROUP BY Bar_Code__c |
| | | ]; |
| | | for (AggregateResult ar : pieceOrderDet) { |
| | | exitpieceBarcodeMap.put(String.valueOf(ar.get('Bar_Code__c')), Integer.valueOf(ar.get('cnt'))); |
| | | } |
| | | for (String bc : barcodePieceList) { |
| | | if (!exitpieceBarcodeMap.containsKey(bc)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 不存在或单位错误,请确认。') |
| | | // ); |
| | | errorMsg += 'Barcode ' + bc + ' 不存在或单位错误,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (exitpieceBarcodeMap.containsKey(bc) && exitpieceBarcodeMap.get(bc) < barcodePieceMap.get(bc)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 库存不足,请确认。')); |
| | | errorMsg += 'Barcode ' + bc + ' 库存不足,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | //ApexPages.addMessages(e); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage()+e.getStackTraceString(), ''); |
| | | } |
| | | getorderinfo(); |
| | | dataInfoconfim(); |
| | | getorderdet2info(csvRecordStr); |
| | | if (saveFLGbln == false) { |
| | | getorderdetinfo(csvRecordStr); |
| | | } |
| | | data.put('orderRecords', orderRecords); |
| | | data.put('saveFLGbln', saveFLGbln); |
| | | data.put('csvRecordStr', csvRecordStr); |
| | | data.put('barcodeList', barcodeList); |
| | | data.put('secondAgencyMap',secondAgencyMap); |
| | | data.put('hospitalSysMap',hospitalSysMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | return res; |
| | | } |
| | | } |
| | | |
| | | public static void getorderinfo() { |
| | | map<string, string> orderNameMap = new Map<string, string>(); |
| | | try { |
| | | csvAsString = csvFileBody.toString(); |
| | | csvFileLines = csvAsString.split('\n'); |
| | | for (Integer i = 1; i < csvFileLines.size(); i++) { |
| | | Consumable_order__c cocObj = new Consumable_order__c(); |
| | | string[] csvRecordData = csvFileLines[i].split(','); |
| | | if (orderNameMap.containsKey(csvRecordData[0])) |
| | | continue; |
| | | cocObj.Name = csvRecordData[0]; |
| | | if (String.isNotBlank(csvRecordData[1])) { |
| | | cocObj.SummonsForDirction__c = csvRecordData[1]; |
| | | } else { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '出货目的为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '出货目的为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | cocObj.Order_Attachment__c = csvRecordData[2]; |
| | | cocObj.Order_Indication__c = csvRecordData[3]; |
| | | cocObj.Order_ForCustomerText__c = csvRecordData[4]; |
| | | cocObj.Invoice_Note__c = csvRecordData[5]; |
| | | if (String.isBlank(csvRecordData[11])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + cocObj.Name + '的产品中,存在出库日期为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + cocObj.Name + '的产品中,存在出库日期为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cocObj.Outbound_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | if (String.isNotEmpty(csvRecordData[2])) { |
| | | hospitalconMap.put(csvRecordData[2].trim(), csvRecordData[0].trim()); |
| | | } |
| | | orderNameMap.put(csvRecordData[0], csvRecordData[0]); |
| | | orderRecords.add(new ConsumableorderdetailsInfo(cocObj)); |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | public static void dataInfoconfim() { |
| | | //确认医院信息 |
| | | hospitalSysMap = new Map<String, String>(); |
| | | secondAgencyMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfo ass : orderRecords) { |
| | | if ( |
| | | (ass.order.SummonsForDirction__c == '销售给二级经销商' || |
| | | ass.order.SummonsForDirction__c == '直接销售给医院' || |
| | | ass.order.SummonsForDirction__c == '医院试用') && |
| | | (String.isBlank(ass.hospitalName) || |
| | | String.isBlank(ass.hospitalCode) || |
| | | String.isBlank(ass.order.Order_ForCustomerText__c)) |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '医院相关信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '医院相关信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | //return null; |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '销售给二级经销商') { |
| | | if (String.isBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '经销商信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '经销商信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '直接销售给医院') { |
| | | if (String.isNotBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '不需要二级经销商,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '不需要二级经销商,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | if (ass.order.SummonsForDirction__c == '互相调货') { |
| | | if (String.isBlank(ass.agencyName)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '经销商信息不能空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '经销商信息不能空,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | if ( |
| | | String.isNotBlank(ass.hospitalName) || |
| | | String.isNotBlank(ass.hospitalCode) || |
| | | String.isNotBlank(ass.order.Order_ForCustomerText__c) |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单' + ass.order.Name + '不需要医院相关信息,请确认。') |
| | | // ); |
| | | errorMsg += '出库单' + ass.order.Name + '不需要医院相关信息,请确认。<br />'; |
| | | messageCount++; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | } |
| | | System.debug('accountName = ' + accountName); |
| | | List<Agency_Hospital_Link__c> hospitalInfo = [ |
| | | SELECT Hospital__c, Hospital__r.Management_Code__c, Hospital__r.Name |
| | | FROM Agency_Hospital_Link__c |
| | | WHERE Agency__r.Name = :accountName |
| | | ]; |
| | | List<Dealer_elationship__c> secondAgencyInfo = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__r.Name = :accountName |
| | | ]; |
| | | for (Agency_Hospital_Link__c hpinfo : hospitalInfo) { |
| | | hospitalSysMap.put(hpinfo.Hospital__r.Management_Code__c, hpinfo.Hospital__c); |
| | | } |
| | | for (Dealer_elationship__c safo : secondAgencyInfo) { |
| | | secondAgencyMap.put(safo.Dealer_subordinate__r.Name, safo.Dealer_subordinate__c); |
| | | } |
| | | //出库单信息验证 |
| | | System.debug('hospitalconMap = ' + hospitalconMap); |
| | | System.debug('hospitalSysMap = ' + hospitalSysMap); |
| | | for (String widget : hospitalconMap.keySet()) { |
| | | if (!hospitalSysMap.containsKey(widget)) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // hospitalconMap.get(widget) + |
| | | // ' 的医院编码' + |
| | | // widget + |
| | | // ' 不存在或者不是本经销商负责的医院,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += |
| | | '出库单 ' + |
| | | hospitalconMap.get(widget) + |
| | | ' 的医院编码' + |
| | | widget + |
| | | ' 不存在或者不是本经销商负责的医院,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void getorderdet2info(List<String[]> csvRecordStr) { |
| | | barcodeList = new List<String>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | } |
| | | if (String.isBlank(csvRecordData[9])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 不存在出库单位,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 不存在出库单位,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.valueOf(csvRecordData[9]) != '盒' && String.valueOf(csvRecordData[9]) != '个') { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 出库单位不正确,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 出库单位不正确,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | } |
| | | if (String.isBlank(csvRecordData[8])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.isNotBlank(csvRecordData[8])) { |
| | | if ( |
| | | Decimal.valueOf(csvRecordData[8]) == 0 && |
| | | (String.valueOf(csvRecordData[1]) == '直接销售给医院' || |
| | | String.valueOf(csvRecordData[1]) == '销售给二级经销商') |
| | | ) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '产品出货单价不能为0,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '产品出货单价不能为0,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | } |
| | | if (String.isBlank(csvRecordData[6])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的产品中,存在barcode为空,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的产品中,存在barcode为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (String.isBlank(csvRecordData[12])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的barcode ' + |
| | | // cod2Obj.Bar_Code__c + |
| | | // ' 不存在或不是在库产品,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的barcode ' + cod2Obj.Bar_Code__c + ' 不存在或不是在库产品,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.isBlank(csvRecordData[11])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // cod2Obj.TracingCode__c + |
| | | // '的产品中,存在出库日期为空,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + cod2Obj.TracingCode__c + '的产品中,存在出库日期为空,请确认。'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | public static void getorderdetinfo(List<String[]> csvRecordStr) { |
| | | map<string, string> orderdetMap = new Map<string, string>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12])) |
| | | continue; |
| | | codObj.Remarks__c = csvRecordData[0]; |
| | | if (String.isBlank(csvRecordData[7])) { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '产品出货数量为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '产品出货数量为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else if (Decimal.valueOf(csvRecordData[7]) > 1 && String.valueOf(csvRecordData[9]) == '盒') { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message( |
| | | // ApexPages.severity.ERROR, |
| | | // '出库单 ' + |
| | | // csvRecordData[0] + |
| | | // '存在单位是盒,产品出货数量大于1,请确认。' |
| | | // ) |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '存在单位是盒,产品出货数量大于1,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } else { |
| | | codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]); |
| | | } |
| | | codObj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } else { |
| | | if (messageCount >= 100) |
| | | break; |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.ERROR, '出库单 ' + csvRecordData[0] + '产品出货单价为空,请确认。') |
| | | // ); |
| | | errorMsg += '出库单 ' + csvRecordData[0] + '出库单 ' + csvRecordData[0] + '产品出货单价为空,请确认。<br />'; |
| | | saveFLGbln = true; |
| | | messageCount++; |
| | | } |
| | | //if(String.isNotBlank(csvRecordData[10])){ |
| | | // codObj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]); |
| | | //} |
| | | codObj.Lose_reason__c = csvRecordData[12]; |
| | | codObj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim()); |
| | | orderdetMap.put(csvRecordData[0] + csvRecordData[12], csvRecordData[0] + csvRecordData[12]); |
| | | //orderdetRecords.add(new ConsumableorderdetailsInfo(codObj)); |
| | | } |
| | | } catch (Exception e) { |
| | | //return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC dataImport( |
| | | List<String[]> csvRecordStrLwc, |
| | | String orderRecordsLwc, |
| | | String sqlagencyProTypeLwc, |
| | | String userWorkLocationLwc, |
| | | String accountNameLwc, |
| | | String accountidLwc, |
| | | String agencyProTypeLwc, |
| | | Map<String, String> secondAgencyMapLwc, |
| | | Map<String, String> hospitalSysMapLwc |
| | | ) { |
| | | List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>(); |
| | | product2conMap = new Map<String, String>(); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | csvRecordStr = csvRecordStrLwc; |
| | | orderRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class); |
| | | System.debug('orderRecords = ' + orderRecords); |
| | | sqlagencyProType = sqlagencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | accountName = accountNameLwc; |
| | | secondAgencyMap = secondAgencyMapLwc; |
| | | hospitalSysMap = hospitalSysMapLwc; |
| | | accountid = accountidLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | System.debug('agencyProType = ' + agencyProType); |
| | | |
| | | errorMsg = ''; |
| | | System.debug('csvRecordStr = ' + csvRecordStr); |
| | | orderdetRecords = getorderdetList(csvRecordStr); |
| | | orderdet2BoxRecords = getorderdet2BoxList(csvRecordStr); |
| | | orderdet2PieceRecords = getorderdet2pieceList(csvRecordStr); |
| | | System.debug('orderdetRecords = ' + orderdetRecords); |
| | | System.debug('orderdet2BoxRecords = ' + orderdet2BoxRecords); |
| | | System.debug('orderdet2PieceRecords = ' + orderdet2PieceRecords); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | Map<String, String> orderInfoMap = new Map<String, String>(); |
| | | List<Consumable_order__c> coc = new List<Consumable_order__c>(); |
| | | for (ConsumableorderdetailsInfo ass : orderRecords) { |
| | | ass.order.Order_type__c = '传票'; |
| | | ass.order.SummonsStatus_c__c = '已完成'; |
| | | ass.order.Order_ProType__c = agencyProType; |
| | | ass.order.Dealer_Info__c = accountid; |
| | | ass.order.Order_ForHospital__c = hospitalSysMap.get(ass.hospitalCode); |
| | | if (secondAgencyMap.containsKey(ass.agencyName)) { |
| | | ass.order.Order_ForDealer__c = secondAgencyMap.get(ass.agencyName); |
| | | } else { |
| | | ass.order.Order_ForDealerText__c = ass.agencyName; |
| | | } |
| | | ass.order.RecordTypeId = System.Label.RT_ConOrder_Sale; |
| | | coc.add(ass.order); |
| | | } |
| | | System.debug('coc = ' + coc); |
| | | if (coc.size() > 0) { |
| | | insert coc; |
| | | } |
| | | for (Consumable_order__c order : coc) { |
| | | orderInfoMap.put(order.Name, order.Id); |
| | | } |
| | | List<Consumable_Orderdetails__c> cod = new List<Consumable_Orderdetails__c>(); |
| | | for (String field : orderInfoMap.keySet()) { |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfo ass : orderdetRecords) { |
| | | if (ass.orderName == field) { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | ass.orderdetails1.Name = ass.orderName + '-' + str; |
| | | ass.orderdetails1.Consumable_order__c = orderInfoMap.get(ass.orderName); |
| | | ass.orderdetails1.Consumable_Product__c = ass.productName; |
| | | ass.orderdetails1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | cod.add(ass.orderdetails1); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | System.debug('cod = ' + cod); |
| | | if (cod.size() > 0) { |
| | | insert cod; |
| | | } |
| | | //盒的数据检索 |
| | | List<Consumable_Order_details2__c> cod2List = new List<Consumable_Order_details2__c>(); |
| | | List<Consumable_order_details2__c> cOrderDet = [ |
| | | SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c IN :barcodeList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '盒' |
| | | ]; |
| | | for (ConsumableorderdetailsInfo ass : orderdet2BoxRecords) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c codtest : cOrderDet) { |
| | | Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c(); |
| | | if (codtest.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | cod2 = codtest; |
| | | cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Used_date__c = ass.orderdetails2.Used_date__c; |
| | | cod2.Send_Date__c = ass.orderdetails2.Send_Date__c; |
| | | //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c; |
| | | cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c; |
| | | cod2List.add(cod2); |
| | | cOrderDet.remove(idx); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | |
| | | //个的数据检索 |
| | | List<Consumable_order_details2__c> cOrderDetPiece = [ |
| | | SELECT Id, Bar_Code__c, RemoveBox_No__c, Name, Consumable_Product__c, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Bar_Code__c IN :barcodePieceList |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Box_Piece__c = '个' |
| | | ORDER BY Bar_Code__c, RemoveBox_No__c DESC |
| | | ]; |
| | | for (ConsumableorderdetailsInfo ass : orderdet2PieceRecords) { |
| | | Decimal idy = 1; |
| | | for (Integer idx = 0; idx < cOrderDetPiece.size(); idx++) { |
| | | Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c(); |
| | | if (cOrderDetPiece[idx].Bar_Code__c == ass.orderdetails2.Bar_Code__c && idy <= ass.pieceCount) { |
| | | cod2 = cOrderDetPiece[idx].Clone(); |
| | | cod2.Id = cOrderDetPiece[idx].Id; |
| | | cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName); |
| | | cod2.Used_date__c = ass.orderdetails2.Used_date__c; |
| | | cod2.Send_Date__c = ass.orderdetails2.Send_Date__c; |
| | | //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c; |
| | | cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c; |
| | | cod2List.add(cod2); |
| | | cOrderDetPiece[idx].Bar_Code__c = ''; |
| | | idy++; |
| | | //break; |
| | | } |
| | | } |
| | | } |
| | | if (cod2List.size() > 0) { |
| | | update cod2List; |
| | | } |
| | | errorflg = true; |
| | | //errorMessage = '保存完成。'; |
| | | saveFLGbln = true; |
| | | |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = errorMsg; |
| | | return res; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), ''); |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdetList(List<String[]> csvRecordStr) { |
| | | List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>(); |
| | | map<string, Decimal> orderdetMap = new Map<string, Decimal>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c(); |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) { |
| | | orderdetMap.put( |
| | | csvRecordData[0] + |
| | | csvRecordData[12] + |
| | | csvRecordData[9], |
| | | orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7]) |
| | | ); |
| | | continue; |
| | | } else { |
| | | orderdetMap.put(csvRecordData[0] + csvRecordData[12] + csvRecordData[9], Decimal.valueOf(csvRecordData[7])); |
| | | } |
| | | codObj.Remarks__c = csvRecordData[0]; |
| | | codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]); |
| | | codObj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | codObj.Lose_reason__c = csvRecordData[12]; |
| | | if (String.isNotBlank(csvRecordData[11])) { |
| | | codObj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim()); |
| | | orderdetRecords.add(new ConsumableorderdetailsInfo(codObj)); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : orderdetRecords) { |
| | | if (orderdetMap.containsKey(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c)) { |
| | | ass.orderdetails1.Shipment_Count__c = orderdetMap.get(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c); |
| | | } |
| | | } |
| | | System.debug('orderdetRecords = ' + orderdetRecords); |
| | | return orderdetRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | System.debug('orderdetRecords = null ' + e.getLineNumber()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdet2BoxList(List<String[]> csvRecordStr) { |
| | | barcodeList = new List<String>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (String.valueOf(csvRecordData[9]) == '盒') { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodeList.add(csvRecordData[6]); |
| | | } |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | //if(String.isNotBlank(csvRecordData[10])){ |
| | | // cod2Obj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]); |
| | | //} |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.valueOf(csvRecordData[1]) == '销售给二级经销商' || String.valueOf(csvRecordData[1]) == '直接销售给医院') { |
| | | cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | orderdet2BoxRecords.add(new ConsumableorderdetailsInfo(cod2Obj)); |
| | | } |
| | | } |
| | | return orderdet2BoxRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';'; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> getorderdet2pieceList(List<String[]> csvRecordStr) { |
| | | barcodePieceList = new List<String>(); |
| | | List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>(); |
| | | try { |
| | | for (Integer i = 1; i < csvRecordStr.size(); i++) { |
| | | string[] csvRecordData = csvRecordStr[i]; |
| | | if (String.valueOf(csvRecordData[9]) == '个') { |
| | | Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c(); |
| | | cod2Obj.TracingCode__c = csvRecordData[0]; |
| | | cod2Obj.Bar_Code__c = csvRecordData[6]; |
| | | if (String.isNotBlank(csvRecordData[6])) { |
| | | barcodePieceList.add(csvRecordData[6]); |
| | | } |
| | | cod2Obj.Box_Piece__c = csvRecordData[9]; |
| | | if (String.isNotBlank(csvRecordData[8])) { |
| | | cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]); |
| | | } |
| | | cod2Obj.Return_reason__c = csvRecordData[12]; |
| | | if (String.valueOf(csvRecordData[1]) == '销售给二级经销商' || String.valueOf(csvRecordData[1]) == '直接销售给医院') { |
| | | cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim()); |
| | | } else { |
| | | cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim()); |
| | | } |
| | | cod2Obj.Rrturn_count__c = Decimal.valueOf(csvRecordData[7]); |
| | | orderdet2PieceRecords.add(new ConsumableorderdetailsInfo(cod2Obj)); |
| | | } |
| | | } |
| | | return orderdet2PieceRecords; |
| | | } catch (Exception e) { |
| | | // ApexPages.addMessages(e); |
| | | // return null; |
| | | errorMsg += e.getMessage(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order__c order { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public String orderName { get; set; } |
| | | @AuraEnabled |
| | | public String hospitalCode { get; set; } |
| | | @AuraEnabled |
| | | public String hospitalName { get; set; } |
| | | @AuraEnabled |
| | | public String agencyName { get; set; } |
| | | @AuraEnabled |
| | | public String productName { get; set; } |
| | | @AuraEnabled |
| | | public Decimal pieceCount { get; set; } |
| | | // 取到的订单信息 |
| | | public ConsumableorderdetailsInfo(Consumable_order__c e) { |
| | | order = e; |
| | | hospitalCode = e.Order_Attachment__c; |
| | | hospitalName = e.Order_Indication__c; |
| | | agencyName = e.Invoice_Note__c; |
| | | e.Order_Attachment__c = ''; |
| | | e.Order_Indication__c = ''; |
| | | e.Invoice_Note__c = ''; |
| | | } |
| | | // 取到的订单明细 |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | orderName = e.Remarks__c; |
| | | productName = e.Lose_reason__c; |
| | | e.Lose_reason__c = ''; |
| | | e.Remarks__c = ''; |
| | | } |
| | | // 取到的产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails2 = e; |
| | | orderName = e.TracingCode__c; |
| | | productName = e.Return_reason__c; |
| | | pieceCount = e.Rrturn_count__c; |
| | | e.TracingCode__c = ''; |
| | | e.Return_reason__c = ''; |
| | | e.Rrturn_count__c = null; |
| | | } |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | public with sharing class LexOverdueStockController { |
| | | |
| | | /*****************検索用******************/ |
| | | public static String barcode { get; set; } |
| | | |
| | |
| | | // 经销商信息 |
| | | private static Account accountInfo; |
| | | |
| | | //判断操作人员是否销存 |
| | | //判断操作人员是否销存 |
| | | public static Boolean iSinventory = false; |
| | | |
| | | public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>(); |
| | | |
| | | public static Integer pageRecordsSize { |
| | | public static Integer pageRecordsSize { |
| | | get { |
| | | return codPageRecords == null ? 0 : codPageRecords.size(); |
| | | } |
| | | } |
| | | |
| | | public LexOverdueStockController() { |
| | | |
| | | } |
| | | |
| | | // 画面初始化 |
| | |
| | | codPageRecords = new List<orderBean>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | // 过期库存汇总信息 |
| | | List<AggregateResult> orderDetZaiku = [ |
| | | SELECT count(Id) countsum, Consumable_Product__c prodid, Consumable_Product__r.Name_Text__c prodname, Box_Piece__c boxPiece |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | GROUP BY Consumable_Product__c, Box_Piece__c, Consumable_Product__r.Name_Text__c |
| | | ]; |
| | | List<AggregateResult> orderDetZaiku = [SELECT count(Id) countsum, |
| | | Consumable_Product__c prodid, |
| | | Consumable_Product__r.Name_Text__c prodname, |
| | | Box_Piece__c boxPiece |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c]; |
| | | |
| | | for (AggregateResult overdue : orderDetZaiku) { |
| | | for(AggregateResult overdue : orderDetZaiku){ |
| | | codPageRecords.add(new orderBean(overdue)); |
| | | } |
| | | |
| | | system.debug('codPageRecords====>' + codPageRecords); |
| | | data.put('codPageRecords', JSON.serialize(codPageRecords)); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('accountName', accountInfo.Name); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('orderDetZaiku', JSON.serialize(orderDetZaiku)); |
| | | system.debug('codPageRecords====>'+codPageRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('accountName',accountInfo.Name); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('orderDetZaiku',JSON.serialize(orderDetZaiku)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchorderBean( |
| | | String agencyProTypeLWC, |
| | | String userWorkLocationLWC, |
| | | String accountNameLWC, |
| | | String barcodeLWC, |
| | | String codPageRecordsLWC |
| | | ) { |
| | | public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(codPageRecordsLWC, List<orderBean>.class); |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(codPageRecordsLWC,List<orderBean>.class); |
| | | sqlagencyProType = '%' + agencyProTypeLWC + '%'; |
| | | system.debug('sqlagencyProType==>' + sqlagencyProType); |
| | | system.debug('sqlagencyProType==>'+ sqlagencyProType); |
| | | barcode = barcodeLWC; |
| | | system.debug('barcode==>' + barcode); |
| | | system.debug('barcode==>'+ barcode); |
| | | userWorkLocation = userWorkLocationLWC; |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid]; |
| | | |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | |
| | | iSinventory = true; |
| | | Set<String> barCodeoverdue = new Set<String>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | List<String> barCodeListP = ParseBarCode(barcode); |
| | | List<String> barCodeListP = ParseBarCode( barcode ); |
| | | // 页面显示数据初始化 |
| | | for (orderBean codPage : codPageRecords) { |
| | | codPage.pandian = 0; |
| | | } |
| | | // 查询所有过期库存 |
| | | List<Consumable_order_details2__c> orderDetZaiku = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_Product__c, |
| | | Bar_Code__c, |
| | | Consumable_Product__r.Name__c, |
| | | Dealer_Info_text__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | Sterilization_limit__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ]; |
| | | List<Consumable_order_details2__c> orderDetZaiku = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation]; |
| | | // 没有输入条码时,循环页面,所有打钩产品全部销存 |
| | | // 取得所有 |
| | | overdueList = new List<Consumable_order_details2__c>(); |
| | | if (String.isBlank(barcode)) { |
| | | System.debug('barcode空'); |
| | | for (orderBean codPage : codPageRecords) { |
| | | for(orderBean codPage : codPageRecords){ |
| | | if (codPage.check) { |
| | | for (Consumable_order_details2__c cod2 : orderDetZaiku) { |
| | | if (cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c) { |
| | | overduePageRecords.add(new orderBean(cod2, '过期库存销存')); |
| | | for(Consumable_order_details2__c cod2 : orderDetZaiku){ |
| | | if(cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | // return; |
| | | System.debug('overdueList===>' + overdueList); |
| | | System.debug('overduePageRecords====>' + overduePageRecords); |
| | | data.put('overdueList', JSON.serialize(overdueList)); |
| | | data.put('overduePageRecords', JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords', JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory', iSinventory); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = '所有打勾产品销存成功'; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | System.debug('overduePageRecords = ' + overduePageRecords); |
| | | data.put('overduePageRecords',JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory',iSinventory); |
| | | data.put('overdueList',overdueList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | // res.msg = '请输入BarCode号'; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 输入barcode时 |
| | | |
| | | // BarCode的检索 所有在库 |
| | | List<Consumable_order_details2__c> reSet = [ |
| | | SELECT |
| | | Id, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name__c, |
| | | Box_Piece__c, |
| | | Bar_Code_search__c, |
| | | Dealer_Shipment__c, |
| | | Dealer_Saled__c, |
| | | Lose_Flag__c, |
| | | Bar_Code__c, |
| | | Cancellation_Flag__c, |
| | | Isoverdue__c, |
| | | Sterilization_limit__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code_search__c IN :BarCodeListP |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | ORDER BY Name |
| | | ]; |
| | | List<Consumable_order_details2__c> reSet = [select Id,Consumable_Product__c, |
| | | Consumable_Product__r.Name__c,Box_Piece__c,Bar_Code_search__c, |
| | | Dealer_Shipment__c,Dealer_Saled__c,Lose_Flag__c,Bar_Code__c, |
| | | Cancellation_Flag__c,Isoverdue__c,Sterilization_limit__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Arrive__c = true |
| | | AND Cancellation_Flag__c = false |
| | | and Dealer_Returned__c = false |
| | | and Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | order by Name]; |
| | | |
| | | System.debug('reSet===>'+reSet); |
| | | |
| | | System.debug('reSet===>' + reSet); |
| | | |
| | | for (Consumable_order_details2__c cod2 : reSet) { |
| | | if ( |
| | | (cod2.Dealer_Shipment__c == false && |
| | | cod2.Dealer_Saled__c == false && |
| | | cod2.Lose_Flag__c == false && |
| | | cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0 |
| | | ) { |
| | | for(Consumable_order_details2__c cod2 : reSet){ |
| | | if ((cod2.Dealer_Shipment__c == false && cod2.Dealer_Saled__c == false |
| | | && cod2.Lose_Flag__c == false && cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0) { |
| | | for (orderBean codPage : codPageRecords) { |
| | | if (cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece) { |
| | | overduePageRecords.add(new orderBean(cod2, '过期库存销存')); |
| | | if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | codPage.pandian++; |
| | | codPage.pandian ++; |
| | | codPage.check = true; |
| | | } |
| | | } |
| | | } else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) { |
| | | overduePageRecords.add(new orderBean(cod2, '产品已经出库')); |
| | | } else { |
| | | overduePageRecords.add(new orderBean(cod2, '不是过期库存')); |
| | | }else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) { |
| | | overduePageRecords.add(new orderBean(cod2,'产品已经出库')); |
| | | }else{ |
| | | overduePageRecords.add(new orderBean(cod2,'不是过期库存')); |
| | | } |
| | | } |
| | | System.debug('overduePageRecords = ' + overduePageRecords); |
| | | data.put('overduePageRecords', JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords', JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory', iSinventory); |
| | | data.put('overdueList', overdueList); |
| | | data.put('overduePageRecords',JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory',iSinventory); |
| | | data.put('overdueList',overdueList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory, string saveCodPageRecords, String saveoverdueList) { |
| | | public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | system.debug('saveCodPageRecords=============>' + saveCodPageRecords); |
| | | List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(saveCodPageRecords, List<orderBean>.class); |
| | | List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>) JSON.deserialize( |
| | | saveoverdueList, |
| | | List<Consumable_order_details2__c>.class |
| | | ); |
| | | system.debug('saveCodPageRecords=============>'+saveCodPageRecords); |
| | | system.debug('saveoverdueList'+saveoverdueList); |
| | | overdueList = saveoverdueList; |
| | | // if(saveoverdueList==null){ |
| | | // return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // } |
| | | |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(saveCodPageRecords,List<orderBean>.class); |
| | | // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class); |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid]; |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if (!iSinventory) { |
| | | if(!iSinventory){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | return new ResponseBodyLWC('Error', 500, '请先点【BarCode录入】', ''); |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // return null; |
| | | } |
| | | integer Lo = 0; |
| | | for (orderBean header : codPageRecords) { |
| | | if (header.check == true) { |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Lo++; |
| | | } |
| | | } |
| | | if (Lo == 0) { |
| | | if(Lo == 0){ |
| | | iSinventory = false; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要销存的明细。')); |
| | | return new ResponseBodyLWC('Error', 500, '请选择要销存的明细', ''); |
| | | return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | // return null; |
| | | } |
| | | Integer orderDetNo = 1; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Consumable_order__c po = new Consumable_order__c(); |
| | | po.Name = '*'; |
| | | po.Name ='*'; |
| | | po.Order_status__c = '批准'; |
| | | po.Inventory_date__c = Date.today(); |
| | | po.Order_type__c = '销存'; |
| | | po.Dealer_Info__c = accountInfo.Id; |
| | | po.Order_ProType__c = agencyProType; |
| | | po.RecordTypeid = System.Label.RT_ConOrder_Overdue; |
| | | try { |
| | | insert po; |
| | | Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id = :po.id]; |
| | | List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>(); |
| | | for (orderBean header : codPageRecords) { |
| | | if (header.check == true) { |
| | | try{ |
| | | insert po; |
| | | Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id]; |
| | | List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>(); |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Consumable_orderdetails__c insPan = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(orderDetNo); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | if(str.length() == 1){ |
| | | str = '0' + str; |
| | | } |
| | | insPan.Name = order.Name + '-' + str; |
| | | insPan.Name = order.Name + '-'+ str; |
| | | insPan.Consumable_Product__c = header.prodId; |
| | | insPan.Consumable_order__c = po.Id; |
| | | insPan.Lose_reason__c = '过期库存销存'; |
| | | insPan.Overdue_count__c = header.pandian; |
| | | insPan.Overdue_SUM__c = header.overlimitCount; |
| | | insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory; |
| | | orderDetNo++; |
| | | orderDetNo ++; |
| | | InsList.add(insPan); |
| | | } |
| | | } |
| | | // 生成明细1 |
| | | if (InsList.size() > 0) { |
| | | if(InsList.size()>0){ |
| | | insert InsList; |
| | | } |
| | | |
| | | for (Consumable_order_details2__c cod : overdueList) { |
| | | for(Consumable_order_details2__c cod : overdueList){ |
| | | cod.Consumable_Inventory_order__c = po.Id; |
| | | cod.Inventory_date__c = Date.today(); |
| | | cod.Lose_reason__c = '过期库存销存'; |
| | | cod.Lose_Flag__c = true; |
| | | |
| | | } |
| | | if (overdueList.size() > 0) { |
| | | if(overdueList.size()>0){ |
| | | ControllerUtil.updateOrderDetailsSatus(overdueList); |
| | | } |
| | | } catch (Exception ex) { |
| | | |
| | | }catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(ex); |
| | | return null; |
| | | } |
| | | // return new Pagereference('/' + po.Id); |
| | | data.put('Id', po.Id); |
| | | data.put('Id',po.Id); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | public static List<String> ParseBarCode(String Code) { |
| | | Map<String, Integer> barcodeCountMap = new Map<String, Integer>(); |
| | | String[] Cache = new List<String>{}; |
| | | public static List<String> ParseBarCode(String Code){ |
| | | Map<String,Integer> barcodeCountMap = new Map<String,Integer>(); |
| | | String[] Cache = new String[]{}; |
| | | Cache = Code.split('\n'); |
| | | List<String> Buff = new List<String>(); |
| | | for (String A : Cache) { |
| | | List <String> Buff = new List<String>(); |
| | | for(String A : Cache){ |
| | | A = A.trim().toUpperCase(); |
| | | if (barcodeCountMap.containsKey(A)) { |
| | | barcodeCountMap.put(A, barcodeCountMap.get(A) + 1); |
| | | } else { |
| | | barcodeCountMap.put(A, 1); |
| | | if(barcodeCountMap.containsKey(A)){ |
| | | barcodeCountMap.put(A,barcodeCountMap.get(A) + 1); |
| | | }else{ |
| | | barcodeCountMap.put(A,1); |
| | | } |
| | | Buff.add(A + barcodeCountMap.get(A)); |
| | | } |
| | | return Buff; |
| | | } |
| | | |
| | | // Data Bean |
| | | // Data Bean |
| | | class orderBean implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | |
| | | // 过期库存 |
| | | @AuraEnabled |
| | | public Integer overlimitCount { get; set; } |
| | | // 销存数量 |
| | | @AuraEnabled |
| | | public Integer pandian { get; set; } |
| | | // 销存原因 |
| | | @AuraEnabled |
| | | public String diffReason { get; set; } |
| | | // 单位 |
| | | @AuraEnabled |
| | | public String boxPiece { get; set; } |
| | | @AuraEnabled |
| | | public String prodname { get; set; } |
| | | @AuraEnabled |
| | | public String prodid { get; set; } |
| | | orderBean(Consumable_order_details2__c e, string str) { |
| | | orderBean(Consumable_order_details2__c e,string str) { |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | DiffReason = str; |
| | |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | orderBean compareToesd = (orderBean) compareTo; |
| | | orderBean compareToesd =(orderBean)compareTo; |
| | | Integer returnValue = 0; |
| | | if (overlimitCount > compareToesd.overlimitCount) { |
| | | if (overlimitCount > compareToesd.overlimitCount ) { |
| | | returnValue = -1; |
| | | } else if (overlimitCount < compareToesd.overlimitCount) { |
| | | } else if (overlimitCount < compareToesd.overlimitCount ) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| New file |
| | |
| | | public without sharing class LexProductLimitEditController { |
| | | public static String accountid { get; set; } |
| | | public static String product_Limit { get; set; } |
| | | //--------AddStart-----XHL--------------20180929------------- |
| | | public static String userPro_Type { get; set; } |
| | | public static Boolean EngFlag = false; |
| | | public static Boolean ETFlag = false; |
| | | //--------AddEnd-----XHL--------------20180929------------- |
| | | // 画面初始化 |
| | | public LexProductLimitEditController (){ |
| | | accountid= ApexPages.currentPage().getParameters().get('accountid'); |
| | | //--------AddStart-----XHL--------------20181008------------- |
| | | userPro_Type= ApexPages.currentPage().getParameters().get('userPro_Type'); |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //--------AddEnd-----XHL--------------20181008------------- |
| | | } |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String accountid,string userPro_Type) { |
| | | System.debug('userPro_Type==>'+userPro_Type); |
| | | System.debug('accountid==>'+accountid); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | |
| | | List<Account> accinfo = New List<Account>(); |
| | | //--------UpdateStart-----XHL--------------20181008------------- |
| | | accinfo = [SELECT Product_Limit_Date__c,Product_Limit_DateENG__c |
| | | FROM Account |
| | | WHERE id =:accountid]; |
| | | if(accinfo.size() > 0){ |
| | | if(EngFlag){ |
| | | product_Limit = accinfo [0].Product_Limit_DateENG__c; |
| | | }else if(ETFlag){ |
| | | product_Limit = accinfo [0].Product_Limit_Date__c; |
| | | } |
| | | |
| | | } |
| | | System.debug('product_Limit==>'+product_Limit); |
| | | data.put('product_Limit',product_Limit); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | //--------UpdateEnd-----XHL--------------20181008------------- |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexRemoveBoxController { |
| | | //经销商产品分类 |
| | | 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 LexRemoveBoxController(){ |
| | | 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('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy)); |
| | | data.put('accountName',accountName); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | 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); |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | // 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 |
| | | 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 |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已规格=1 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND ProductPacking_list_manual__c = 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,就是在库,没拆盒,规格=1 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | }else{ |
| | | String str = '该商品规格为1,不能拆盒'; |
| | | ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); |
| | | ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | //已出货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, |
| | | Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, |
| | | Deliver_date__c,Bar_Code__c, |
| | | Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c, |
| | | recordtypeid,Consumable_order_minor__r.Arrive_Order__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Shipment__c = true |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | 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 |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Saled__c = true |
| | | AND Dealer_Returned__c = false |
| | | AND Dealer_Arrive__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | 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 |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Box_Piece__c = '个' |
| | | AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; //没出库,没销售,就是在库,已拆盒 |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | 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 |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Cancellation_Flag__c = true |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | 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 |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | // gzw 无法拆盒,去掉销售明细 20210802 |
| | | AND Dealer_Shipment__c= false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | // gzw 无法拆盒,去掉销售明细 20210802 |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != : userWorkLocation |
| | | ORDER BY Name ]; |
| | | if(reSet1.size() > 0){ |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ |
| | | // 跳过已经处理的消耗品明细 |
| | | 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, |
| | | Agencyinfo_fromSAP__c, |
| | | Frist_Storage_Agency__c, |
| | | Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = : userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | if(reSet.size()>0){ |
| | | for (Integer i = 0; i < reSet.size(); i++) { |
| | | if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){ |
| | | // 跳过错误的消耗品明细 |
| | | 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 removeBoxConfirm(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){ |
| | | return new ResponseBodyLWC('Error',500, '不存在拆盒明细', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在拆盒明细')); |
| | | // return null; |
| | | } |
| | | |
| | | List<String> BarCodeList = new List<String>(); |
| | | for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) { |
| | | BarCodeList.add(tmp.esd.Bar_Code__c); |
| | | } |
| | | |
| | | try{ |
| | | //取得在库信息 |
| | | List<Consumable_order_details2__c> orderDetails2 = [SELECT |
| | | Id, |
| | | Name, |
| | | Bar_Code__c, |
| | | TracingCode__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Purchase_Unitprice_From__c, |
| | | Guarantee_period_for_products__c, |
| | | Used_account__c, |
| | | Consumable_ZS_order__c, |
| | | Cancellation_Date__c, |
| | | Consumable_product__c, |
| | | Consumable_order_minor__c, |
| | | Direct_Arrive_Product__c, |
| | | Arrive_date__c, |
| | | Consumable_Arrived_order__c, |
| | | Unitprice_To_agency__c, |
| | | SerialLotNo__c, |
| | | Sterilization_limit__c, |
| | | Invoice_Date__c, |
| | | Lose_reason__c, |
| | | Asset_Model_No__c, |
| | | Deliver_date__c, |
| | | Inventory_date__c, |
| | | Consumable_Inventory_order__c, |
| | | Dealer_Arrive__c, |
| | | ProductPacking_list_manual__c, |
| | | Agencyinfo_fromSAP__c, |
| | | Frist_Storage_Agency__c, |
| | | Dealer_Info_text__c, |
| | | //add by rentx 2020-10-13 start |
| | | ContractNo_text__c |
| | | /*,ContractNo__c*/ |
| | | //add by rentx 2020-10-13 end |
| | | // tcm start |
| | | ,Consumable_order_minor__r.ContractNo__c |
| | | // tcm end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Box_Piece__c = '盒' |
| | | AND ProductPacking_list_manual__c > 1 |
| | | AND Bar_Code__c in :BarCodeList |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Product_Type__c like : userPro_Typestr |
| | | ]; |
| | | |
| | | List<Consumable_order_details2__c> orderDetails2del = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> orderDetails2ins = new List<Consumable_order_details2__c>(); |
| | | for (Consumable_order_details2__c detail2tmp : orderDetails2) { |
| | | Decimal num = detail2tmp.ProductPacking_list_manual__c; |
| | | Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c(); |
| | | delDetails2.Id = detail2tmp.Id; |
| | | |
| | | //删除拆盒前在库 |
| | | //delete delDetails2; |
| | | orderDetails2del.add(delDetails2); |
| | | |
| | | for(integer i=0; i < num; i++){ |
| | | Consumable_order_details2__c insertDetails2 = new Consumable_order_details2__c(); |
| | | insertDetails2 = detail2tmp.clone(); |
| | | |
| | | insertDetails2.Id = null; |
| | | //单位(盒/个) |
| | | insertDetails2.Box_Piece__c = '个'; |
| | | //拆盒番号 |
| | | insertDetails2.RemoveBox_No__c = i+1; |
| | | //拆盒日期 |
| | | insertDetails2.RemoveBox_date__c = Date.today(); |
| | | //add by rentx 2020-10-13 start 拆盒/取消拆盒时,记录SAP合同号 |
| | | // insertDetails2.ContractNo_text__c= detail2tmp.ContractNo__c; |
| | | // tcm start |
| | | if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) { |
| | | insertDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c; |
| | | }else { |
| | | insertDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c; |
| | | } |
| | | // tcm end |
| | | //登录拆盒后在库 |
| | | //insert insertDetails2; |
| | | orderDetails2ins.add(insertDetails2); |
| | | } |
| | | } |
| | | |
| | | if (orderDetails2del.size()>0){ |
| | | delete orderDetails2del; |
| | | } |
| | | |
| | | if(orderDetails2ins.size()>0){ |
| | | insert orderDetails2ins; |
| | | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | 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; } |
| | | @AuraEnabled |
| | | public String oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public String ErrorReason { get; set; } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | 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; |
| | | Prod = e; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) { |
| | | //esd = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | //ProductName = productName; |
| | | barCodeNo = barCode; |
| | | sterilizationlimitDate = sterilizationlimit; |
| | | serialNoorLotNo = serialNoorLot; |
| | | tracingCodeNo = tracingCode; |
| | | } |
| | | */ |
| | | // 排序 |
| | | 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>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | res.entity = data; |
| | | userinfoId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | Useracc = [ |
| | | SELECT accountid, Work_Location__c, UserPro_Type__c |
| | | FROM user |
| | | WHERE id = :userinfoId |
| | | ]; |
| | | Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId]; |
| | | accountid = Useracc[0].accountid; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | System.debug( |
| | | 'userinfoId = ' + |
| | | userinfoId + |
| | | ' accountid = ' + |
| | | accountid + |
| | | ' agencyProType = ' + |
| | | agencyProType + |
| | | ' userWorkLocation = ' + |
| | | userWorkLocation |
| | | userinfoId + |
| | | ' accountid = ' + |
| | | accountid + |
| | | ' agencyProType = ' + |
| | | agencyProType + |
| | | ' userWorkLocation = ' + |
| | | userWorkLocation |
| | | ); |
| | | //默认检索显示未完成的指示单 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | |
| | | res.entity = data; |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | System.debug('cate2 = ' + cate2); |
| | | System.debug('cate3 = ' + cate3); |
| | | // 获得订单一览 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC cleanUp(String accountid, String agencyProType, String userWorkLocation) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | // 获得显示数据 |
| | | List<Consumable_order__c> raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | soql += 'order by SummonsStatus_c__c'; |
| | | System.debug('soql = ' + soql); |
| | | raesList = Database.query(soql); |
| | | data.put('raesList', raesList); |
| | | if (raesList.size() > 0) { |
| | | res.msg = '共有' + raesList.size() + '个出库单'; |
| | | } else { |
| | | res.msg = '没有搜索到相关出库单。'; |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| New file |
| | |
| | | public without sharing class LexSaleOrderController { |
| | | public static boolean isRunning = false; |
| | | public static String barcode { get; set; } |
| | | public static Consumable_order__c coc { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { get; set; } |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; } |
| | | public static Map<String, String> existIdMap { get; set; } |
| | | public static Map<String, String> errorIdMap { get; set; } |
| | | public static Map<String, String> allMap { get; set; } |
| | | public static Map<String, String> orderpieceorboxMap { get; set; } |
| | | public static Map<String, Decimal> orderpriceMap { get; set; } |
| | | public static Map<String, Decimal> orderagencypriceMap { get; set; } |
| | | public static Map<String, Decimal> orderdetCountMap { get; set; } |
| | | public static Map<String, Integer> BarcodeCntMap { get; set; } |
| | | public static String baseUrl { get; private set; } |
| | | public static String ESetId { get; set; } |
| | | public static String accountName { get; set; } |
| | | public static String userWorkLocation { get; set; } |
| | | public static Boolean hasSpecialHos { get; set; } |
| | | public static Map<String, Integer> msiMap { get; set; } |
| | | public static List<Consumable_orderdetails__c> orderdetails { get; set; } |
| | | public static String accountid { get; set; } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC GoodsDeliveryInit(String ESetId) { |
| | | System.debug('LexSaleOrderController GoodsDeliveryInit'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | String UserName = UserInfo.getUserId(); |
| | | user useracc = [SELECT Accountid, Work_Location__c FROM user WHERE id = :UserName]; |
| | | accountid = useracc.Accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.Name; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | coc = new Consumable_order__c(); |
| | | List<Consumable_order_details2__c> arriveDat = new List<Consumable_order_details2__c>(); |
| | | orderpieceorboxMap = new Map<String, String>(); |
| | | orderdetails = new List<Consumable_orderdetails__c>(); |
| | | orderagencypriceMap = new Map<String, Decimal>(); |
| | | orderpriceMap = new Map<String, Decimal>(); |
| | | orderdetCountMap = new Map<String, Decimal>(); |
| | | if (String.isNotBlank(ESetId)) { |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | NoConfirmedPrice__c, |
| | | Order_ForDealer__r.Name, |
| | | Summons_Order_type__c, |
| | | Order_status__c, |
| | | Dealer_Info__c, |
| | | Dealer_Info__r.Name, |
| | | SummonsStatus_c__c, |
| | | Deliver_date__c, |
| | | Order_Reason__c, |
| | | Order_date__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Arrive_Order__c, |
| | | Arrive_Order__r.IsShipment__c, |
| | | Outbound_Date__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_ForCustomerText__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-16 |
| | | if (coc.Arrive_Order__c != null) { |
| | | arriveDat = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Guarantee_period_for_products__c, |
| | | Box_Piece__c, |
| | | // gzw add 20210308 报错修复 |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ]; |
| | | for (Integer j = 0; j < arriveDat.size(); j++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(arriveDat[j])); |
| | | } |
| | | } |
| | | |
| | | orderdetails = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_product__r.Name, |
| | | Shipment_Count__c, |
| | | Box_Piece__c, |
| | | Delivery_List_RMB__c, |
| | | Unitprice_To_agency__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | orderpieceorboxMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Box_Piece__c); |
| | | if (orderdetails[i].Unitprice_To_agency__c != null && orderdetails[i].Unitprice_To_agency__c != 0) { |
| | | orderagencypriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Unitprice_To_agency__c); |
| | | } |
| | | orderpriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Delivery_List_RMB__c); |
| | | orderdetCountMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Shipment_Count__c); |
| | | } |
| | | List<hospitalprice__c> hlist = [ |
| | | SELECT id |
| | | FROM hospitalprice__c |
| | | WHERE hospital__c = :coc.ShipmentAccount__c AND account__c = :accountid |
| | | ]; |
| | | if (hlist == null || hlist.size() == 0) { |
| | | hasSpecialHos = false; |
| | | } else { |
| | | hasSpecialHos = true; |
| | | } |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | data.put('coc', coc); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('accountid', accountid); |
| | | data.put('orderdetails', orderdetails); |
| | | data.put('orderpieceorboxMap', orderpieceorboxMap); |
| | | data.put('orderpriceMap', orderpriceMap); |
| | | data.put('orderagencypriceMap', orderagencypriceMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC SearchPro( |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountName, |
| | | String userWorkLocation, |
| | | String accountid, |
| | | List<Consumable_orderdetails__c> orderdetails, |
| | | Map<String, String> orderpieceorboxMap |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | coc = cocLwc; |
| | | orderdetails = orderdetails; |
| | | barcode = barcodeLwc; |
| | | accountName = accountName; |
| | | userWorkLocation = userWorkLocation; |
| | | accountid = accountid; |
| | | orderdetails = orderdetails; |
| | | orderpieceorboxMap = orderpieceorboxMap; |
| | | //判断是否和订单联动 |
| | | if (coc.Arrive_Order__c != null) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'无需到货确认,请直接出库。')); |
| | | // return; |
| | | return new ResponseBodyLWC('Error', 500, '无需到货确认,请直接出库', ''); |
| | | } |
| | | //判断barcode是否为空 |
| | | if (barcode == null || barcode == '') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输BarCode号。')); |
| | | // return; |
| | | return new ResponseBodyLWC('Error', 500, '请输BarCode号', ''); |
| | | } |
| | | list<String> exitlist = new List<String>(); |
| | | list<String> notexitlist = new List<String>(); |
| | | existIdMap = new Map<String, String>(); |
| | | errorIdMap = new Map<String, String>(); |
| | | allMap = new Map<String, String>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); |
| | | List<String> barCodeListP = new List<String>(); |
| | | List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>(); |
| | | |
| | | //BarCodelist做成 |
| | | barCodeListP = ParseBarCode(barcode); |
| | | //针对所有商品到货确认 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | hospitalSpecialOffer__c, |
| | | exchangeOutPattern__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>(); |
| | | Set<Id> proIds = new Set<Id>(); |
| | | |
| | | for (String barcode : barCodeListP) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c cod2 : reSet1) { |
| | | if (cod2.Bar_Code__c == barcode) { |
| | | newdet2.add(cod2); |
| | | reSet1.remove(idx); |
| | | proIds.add(cod2.Consumable_product__c); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | Map<String, String> proHosMap = new Map<String, String>(); |
| | | Map<String, String> proIdMap = new Map<String, String>(); |
| | | List<hospitalprice__c> hpList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hpList != null && hpList.size() > 0) { |
| | | for (hospitalprice__c hp : hpList) { |
| | | if (hp.product__c != null && String.valueof(hp.product__c).length() >= 15) { |
| | | proIdMap.put(('' + hp.product__c).subString(0, 15) + '是', ''); |
| | | if (hp.hospital__c == coc.Order_ForHospital__c) { |
| | | proHosMap.put(('' + hp.product__c).subString(0, 15) + '是', ''); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | for (Integer j = 0; j < newdet2.size(); j++) { |
| | | if ( |
| | | newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && |
| | | newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c |
| | | ) { |
| | | String str = '该商品出货单位错误'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | if (coc.OutPattern__c == true) { |
| | | if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | //add by rentx 2021-03-22 start |
| | | if (newdet2[j].exchangeOutPattern__c == true) { |
| | | //如果当前经销商下没有维护对应的特价产品 报错 |
| | | if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | String str = '没有维护该产品的特价医院'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | //add by rentx 2021-03-22 end |
| | | |
| | | if (hpList != null && hpList.size() > 0) { |
| | | if (proHosMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | continue; |
| | | } else if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) { |
| | | continue; |
| | | } else { |
| | | String str = '该商品出库医院错误'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //管理编码为空时,报错 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND (TracingCode__c = NULL |
| | | OR TracingCode__c = '') |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该产品没有管理编码,无法出库,请与特约经销商管理部人员联系,修正数据'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Cancellation_Flag__c = TRUE |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经取消'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //不是本出库单的出库产品 |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else if (!orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)) { |
| | | String str = '不是本出库单的出库产品'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | Dealer_Info_text__c, |
| | | Arrive_Owner_Work_Location__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Bar_Code__c IN :barCodeListP |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Arrive__c = TRUE |
| | | AND ((Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | OR Dealer_Info_text__c != :accountName) |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | // 当前经销商是否存在此产品判断 |
| | | boolean containsFlg = false; |
| | | for (Consumable_order_details2__c cod2 : newdet2) { |
| | | if (cod2.Bar_Code__c == reSet1[i].Bar_Code__c) { |
| | | containsFlg = true; |
| | | break; |
| | | } |
| | | } |
| | | if (containsFlg == false) { |
| | | String str = '该商品是' + reSet1[i].Arrive_Owner_Work_Location__c + '的库存'; |
| | | if (reSet1[i].Dealer_Info_text__c != accountName) { |
| | | str = '该商品在其他经销商库存'; |
| | | } |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Saled__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经销售'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Shipment__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出库'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Lose_Flag__c = TRUE |
| | | AND Box_Piece__c = '盒' |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经丢失'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | reSet = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | TracingCode__c, |
| | | Transfer_Time__c, |
| | | Frist_Transfer_Agency__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | //对应录入barcode数量的检索结果 |
| | | newdet2 = new List<Consumable_order_details2__c>(); |
| | | for (String barcode : barCodeListP) { |
| | | Integer idx = 0; |
| | | for (Consumable_order_details2__c cod2 : reSet) { |
| | | if (cod2.Bar_Code__c == barcode) { |
| | | newdet2.add(cod2); |
| | | reSet.remove(idx); |
| | | break; |
| | | } |
| | | idx++; |
| | | } |
| | | } |
| | | Map<String, String> checkBarcodeResult = new Map<String, String>(); |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Integer a = 0; |
| | | for (Integer j = 0; j < newdet2.size(); j++) { |
| | | if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && a < orderdetails[i].Shipment_Count__c) { |
| | | if ( |
| | | (existIdMap.containsKey(newdet2[j].Bar_Code__c) && newdet2[j].Bar_Code__c == '盒') || |
| | | errorIdMap.containsKey(newdet2[j].Bar_Code__c) |
| | | ) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else if (newdet2[j].Isoverdue__c == 0) { |
| | | String str = '该商品已经超出减菌有效期的有效范围'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } else if (newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c) { |
| | | String str = '该商品出货单位错误'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) { |
| | | Matcher n = Pattern.compile('[0-9]').matcher(newdet2[j].TracingCode__c); |
| | | if (n.find()) { |
| | | if (newdet2[j].TracingCode__c.length() == 5) { |
| | | String tr = newdet2[j].TracingCode__c; |
| | | String Ctr = tr.substring(tr.length() - 3,tr.length()); |
| | | String Btr = tr.substring(tr.length() - 4,tr.length()-3); |
| | | String Atr = tr.substring(tr.length() - 5,tr.length()-4); |
| | | if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { |
| | | String str = '管理编码有误,请检查条形码数据。'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j],str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c,newdet2[j].Bar_Code__c); |
| | | continue; |
| | | } |
| | | } |
| | | // String str = '管理编码中有数字,请与管理员确认是否错误。'; |
| | | // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | // continue; |
| | | } |
| | | checkBarcodeResult.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(newdet2[j])); |
| | | a++; |
| | | existIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } else if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | if (a >= orderdetails[i].Shipment_Count__c && orderdetails[i].Box_Piece__c == '个') { |
| | | // 跳过超过数量的消耗品明细 |
| | | continue; |
| | | } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | //CHAN-C23BWX update by rentx 2021-04-28 start |
| | | // String str = '该商品超出订货数量'; |
| | | String str = '该产品超出出库单产品范围'; |
| | | //CHAN-C23BWX update by rentx 2021-04-28 end |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str)); |
| | | errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Dealer_Arrive__c = FALSE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND ((Consumable_order_minor__c != NULL |
| | | AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) |
| | | OR (Consumable_order_minor__c = NULL |
| | | AND Cancellation_Flag__c = FALSE)) |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品未到货确认'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | allMap.putAll(errorIdMap); |
| | | allMap.putAll(existIdMap); |
| | | //得到不存在的BarCode |
| | | for (Integer i = 0; i < barCodeListP.size(); i++) { |
| | | if (allMap.containsKey(barCodeListP[i])) { |
| | | continue; |
| | | } else { |
| | | exitlist.add(barCodeListP[i]); |
| | | } |
| | | } |
| | | reSet1 = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | recordtypeid, |
| | | Consumable_order_minor__r.Arrive_Order__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE (Dealer_Saled__c = TRUE OR Dealer_Shipment__c = TRUE) AND Dealer_Returned__c = FALSE AND Bar_Code__c IN :exitlist |
| | | ORDER BY Name |
| | | ]; |
| | | if (reSet1.size() > 0) { |
| | | for (Integer i = 0; i < reSet1.size(); i++) { |
| | | if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) { |
| | | // 跳过已经处理的消耗品明细 |
| | | continue; |
| | | } else { |
| | | String str = '该商品已经出货'; |
| | | consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str)); |
| | | errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | allMap.putAll(errorIdMap); |
| | | for (Integer i = 0; i < barCodeListP.size(); i++) { |
| | | if (allMap.containsKey(barCodeListP[i])) { |
| | | continue; |
| | | } else { |
| | | notexitlist.add(barCodeListP[i]); |
| | | } |
| | | } |
| | | if (notexitlist.size() > 0) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode号'+ notexitlist + '不存在。')); |
| | | return new ResponseBodyLWC('Error', 500, 'BarCode号' + notexitlist + '不存在。', ''); |
| | | } |
| | | data.put('consumableorderdetailsRecords', consumableorderdetailsRecords); |
| | | data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 去的页面上的barcode,转换成List |
| | | public static List<String> ParseBarCode(String Code) { |
| | | String[] Cache = new List<String>{}; |
| | | Cache = Code.split('\n'); |
| | | List<String> Buff = new List<String>(); |
| | | for (String A : Cache) { |
| | | A = A.trim(); |
| | | Buff.add(A.toUpperCase()); |
| | | } |
| | | return Buff; |
| | | } |
| | | |
| | | // 出货 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC ProdElivery( |
| | | String ESetIdLwc, |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String consumableorderdetailsRecordsLwc, |
| | | List<Consumable_orderdetails__c> orderdetailsLwc, |
| | | Map<String, Decimal> orderpriceMapLwc, |
| | | Map<String, Decimal> orderagencypriceMapLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | ESetId = ESetIdLwc; |
| | | coc = cocLwc; |
| | | barcode = barcodeLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsLwc, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | orderdetails = orderdetailsLwc; |
| | | orderpriceMap = orderpriceMapLwc; |
| | | orderagencypriceMap = orderagencypriceMap; |
| | | BarcodeCntMap = new Map<String, Integer>(); |
| | | if (coc.Arrive_Order__r.IsShipment__c == true) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '订单已经出货')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '订单已经出货', ''); |
| | | } |
| | | |
| | | if (consumableorderdetailsRecords.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无出货明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '无出货明细', ''); |
| | | } |
| | | |
| | | Getconsumableorderdetails2Nobox(); |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | String key = '' + ass.orderdetails2.Bar_Code__c; |
| | | Integer deliverycnt = BarcodeCntMap.get(key); |
| | | if ( |
| | | ass.orderdetails2.Box_Piece__c == '个' && |
| | | (ass.outboundCount == null || |
| | | String.valueof(ass.outboundCount) == '' || |
| | | ass.outboundCount <= 0) |
| | | ) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入产品 ' + ass.Prod.Name + ' 的出货数量', ''); |
| | | } |
| | | if (ass.outboundCount > deliverycnt) { |
| | | // ass.orderdetails2.Rrturn_count__c.addError('超出出库数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Decimal a = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | a = a + ass.outboundCount; |
| | | } |
| | | } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+a)); |
| | | |
| | | if (a < orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'数量小于出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '数量小于出货数量', ''); |
| | | } else if (a > orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'超出出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', ''); |
| | | } |
| | | } |
| | | List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | List<Consumable_orderdetails__c> orderdetails1List = [ |
| | | SELECT Id, Used_date__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | | } |
| | | //coc.Order_type__c = '出货'; |
| | | coc.RecordTypeId = System.Label.RT_ConOrder_Shipment; |
| | | // update start by vivek 2019-7-15 |
| | | // coc.SummonsStatus_c__c = '已完成'; |
| | | if (coc.NoConfirmedPrice__c) { |
| | | coc.SummonsStatus_c__c = '价格未定'; |
| | | } else { |
| | | coc.SummonsStatus_c__c = '已完成'; |
| | | } |
| | | // update start by vivek 2019-7-15 |
| | | coc.Outbound_Date__c = Date.today(); |
| | | update coc; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | insDetails.Id = codctmp.Id; |
| | | insDetails.Consumable_Sale_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Consumable_Shipment_order__c = ESetId; |
| | | insDetails.Send_Date__c = Date.today(); |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null |
| | | ? coc.Dealer_Info__r.Name |
| | | : ass.orderdetails2.Frist_Transfer_Agency__c; |
| | | insDetails.Agency_Transfer__c = true; |
| | | } |
| | | cnt++; |
| | | Ins.add(insDetails); |
| | | if (cnt > ass.outboundCount) |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | insDetails.Id = ass.orderdetails2.Id; |
| | | insDetails.Consumable_Sale_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Consumable_Shipment_order__c = ESetId; |
| | | insDetails.Send_Date__c = Date.today(); |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null |
| | | ? 1 |
| | | : ass.orderdetails2.Transfer_Time__c + 1; |
| | | insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null |
| | | ? coc.Dealer_Info__r.Name |
| | | : ass.orderdetails2.Frist_Transfer_Agency__c; |
| | | insDetails.Agency_Transfer__c = true; |
| | | } |
| | | Ins.add(insDetails); |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | ControllerUtil.updateOrderDetailsSatus(Ins); |
| | | } |
| | | if (coc.Arrive_Order__c != null) { |
| | | Consumable_order__c OrderUps = new Consumable_order__c(); |
| | | OrderUps.Id = coc.Arrive_Order__c; |
| | | OrderUps.IsShipment__c = true; |
| | | update OrderUps; |
| | | } |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | return new ResponseBodyLWC('Error', 500, ex.getMessage(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 销售 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC ProSale( |
| | | String ESetIdLwc, |
| | | Consumable_order__c cocLwc, |
| | | String barcodeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String consumableorderdetailsRecordsLwc, |
| | | List<Consumable_orderdetails__c> orderdetailsLwc, |
| | | Map<String, Decimal> orderpriceMapLwc, |
| | | Map<String, Decimal> orderagencypriceMapLwc |
| | | ) { |
| | | System.debug('enter ProSale'); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | ESetId = ESetIdLwc; |
| | | coc = cocLwc; |
| | | barcode = barcodeLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsLwc, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | orderdetails = orderdetailsLwc; |
| | | orderpriceMap = orderpriceMapLwc; |
| | | orderagencypriceMap = orderagencypriceMapLwc; |
| | | System.debug('ESetId = ' + ESetId); |
| | | System.debug('coc = ' + coc); |
| | | System.debug('barcode = ' + barcode); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug('consumableorderdetailsRecords = ' + consumableorderdetailsRecords); |
| | | System.debug('orderdetails = ' + orderdetails); |
| | | System.debug('orderpriceMap = ' + orderpriceMap); |
| | | System.debug('orderagencypriceMap = ' + orderagencypriceMap); |
| | | BarcodeCntMap = new Map<String, Integer>(); |
| | | |
| | | if (consumableorderdetailsRecords.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无销售明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '无销售明细', ''); |
| | | } |
| | | if (coc.Arrive_Order__r.IsShipment__c == true) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '订单已经销售')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '订单已经销售', ''); |
| | | } |
| | | Getconsumableorderdetails2Nobox(); |
| | | |
| | | System.debug('BarcodeCntMap = ' + BarcodeCntMap); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | String key = '' + ass.orderdetails2.Bar_Code__c; |
| | | Integer deliverycnt = BarcodeCntMap.get(key); |
| | | if (ass.orderdetails2.Box_Piece__c == '个' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量')); |
| | | // return null; |
| | | System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c); |
| | | System.debug('ass.outboundCount = ' + ass.outboundCount); |
| | | return new ResponseBodyLWC('Error', 500, '请输入产品 ' + ass.Prod.Name + ' 的出货数量', ''); |
| | | } |
| | | if (ass.outboundCount > deliverycnt) { |
| | | // ass.orderdetails2.Rrturn_count__c.addError('超出出库数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '超出出库数量', ''); |
| | | } |
| | | } |
| | | |
| | | for (Integer i = 0; i < orderdetails.size(); i++) { |
| | | Decimal a = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) { |
| | | a = a + ass.outboundCount; |
| | | } |
| | | } |
| | | if (a < orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'数量小于出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '数量小于出货数量', ''); |
| | | } else if (a > orderdetails[i].Shipment_Count__c) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'商品'+orderdetails[i].Consumable_product__r.Name +'超出出货数量')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '商品' + orderdetails[i].Consumable_product__r.Name + '超出出货数量', ''); |
| | | } |
| | | } |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | List<Consumable_orderdetails__c> orderdetails1List = [ |
| | | SELECT Id, Used_date__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | try { |
| | | if (orderdetails1List.size() > 0) { |
| | | for (Integer i = 0; i < orderdetails1List.size(); i++) { |
| | | orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Sale; |
| | | orderdetails1List[i].Used_date__c = Date.today(); |
| | | } |
| | | ControllerUtil.updateOrderDetails1Satus(orderdetails1List); |
| | | } |
| | | //coc.Order_type__c = '销售'; |
| | | coc.RecordTypeId = System.Label.RT_ConOrder_Sale; |
| | | // update start by vivek 2019-7-15 |
| | | // coc.SummonsStatus_c__c = '已完成'; |
| | | if (coc.NoConfirmedPrice__c) { |
| | | coc.SummonsStatus_c__c = '价格未定'; |
| | | } else { |
| | | coc.SummonsStatus_c__c = '已完成'; |
| | | } |
| | | // update start by vivek 2019-7-15 |
| | | coc.Outbound_Date__c = Date.today(); |
| | | update coc; |
| | | //销售明细 |
| | | List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>(); |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (ass.orderdetails2.Box_Piece__c == '个') { |
| | | Decimal cnt = 1; |
| | | for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) { |
| | | insDetails.Id = codctmp.Id; |
| | | insDetails.Consumable_Shipment_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | } |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | | insDetails.Consumable_Sale_order__c = ESetId; |
| | | cnt++; |
| | | Ins.add(insDetails); |
| | | if (cnt > ass.outboundCount) |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); |
| | | insDetails.Id = ass.orderdetails2.Id; |
| | | insDetails.Consumable_Shipment_order__c = null; |
| | | insDetails.Consumable_Return_order__c = null; |
| | | insDetails.Consumable_ZS_order__c = ESetId; |
| | | insDetails.Return_date__c = null; |
| | | insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) { |
| | | insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c); |
| | | } |
| | | insDetails.Return_reason__c = null; |
| | | insDetails.Used_date__c = Date.today(); |
| | | insDetails.Consumable_Sale_order__c = ESetId; |
| | | Ins.add(insDetails); |
| | | } |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableorderdetails2Nobox +++'+consumableorderdetails2Nobox.size())); |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Ins +++'+Ins)); |
| | | //return null; |
| | | if (Ins.size() > 0) { |
| | | ControllerUtil.updateOrderDetailsSatus(Ins); |
| | | } |
| | | if (coc.Arrive_Order__c != null) { |
| | | Consumable_order__c orderUps = new Consumable_order__c(); |
| | | orderUps.Id = coc.Arrive_Order__c; |
| | | orderUps.IsShipment__c = true; |
| | | update orderUps; |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static integer Getconsumableorderdetails2Nobox() { |
| | | if (String.isBlank(barcode)) { |
| | | return 0; |
| | | } |
| | | List<String> barCodeListP = ParseBarCode(barcode); |
| | | consumableorderdetails2Nobox = new List<Consumable_order_details2__c>(); |
| | | BarcodeCntMap.clear(); |
| | | consumableorderdetails2Nobox = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | recordtypeid, |
| | | Used_account__c, |
| | | Product_Pattern__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Guarantee_period_for_products__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | ORDER BY RemoveBox_No__c DESC |
| | | ]; |
| | | |
| | | AggregateResult[] results = [ |
| | | SELECT Bar_Code__c, count(Id) recordCount |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Bar_Code__c IN :barCodeListP |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Box_Piece__c = '个' |
| | | GROUP BY Bar_Code__c |
| | | ]; |
| | | |
| | | for (AggregateResult ar : results) { |
| | | String key = '' + ar.get('Bar_Code__c'); |
| | | BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount'))); |
| | | } |
| | | return consumableorderdetails2Nobox.size(); |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public String oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public String ErrorReason { get; set; } |
| | | @AuraEnabled |
| | | public Decimal outboundCount { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) { |
| | | orderdetails1 = new Consumable_orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | orderdetails1 = new Consumable_orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | if (e.Box_Piece__c == '盒') { |
| | | outboundCount = 1; |
| | | } |
| | | oldConsumableCount = e.name; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) { |
| | | orderdetails1 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | outboundCount = e.Shipment_Count__c; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSearchContractController { |
| | | private static Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | |
| | | @AuraEnabled |
| | | public static Results init(String ctype){ |
| | | Results results = new Results(); |
| | | try { |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | User useracc = [SELECT accountid,OSHFLG__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | OSHFLG = Useracc.OSHFLG__c; //lt 20230517 安徽两票制 add; |
| | | String accountId = Useracc.accountid; |
| | | List<Account> attList = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c, |
| | | Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c |
| | | FROM Account |
| | | WHERE ParentId = :accountId |
| | | AND Contact_Type__c like :ctype |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Secondary_contract__c = false |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | results.attList = attList; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchContract(String searchName, String accountId, String ctype, Boolean OSHFLGStr){ |
| | | Results results = new Results(); |
| | | OSHFLG = OSHFLGStr; |
| | | try { |
| | | results.attList = Database.query(makeSoql(searchName,Date.today(),accountId,ctype)); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | private static String makeSoql(String CateName,Date timetest,String accountId, String ctype){ |
| | | |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,'; |
| | | soql += ' Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c,OSH_Dealer__c FROM Account'; |
| | | soql += ' where ParentId = \'' + accountId + '\'' ; |
| | | soql += ' AND OSH_Dealer__c = ' + OSHFLG + '' ; //lt 20230517 安徽两票制 add |
| | | soql += ' AND Secondary_contract__c = false' ; |
| | | soql += ' AND Contact_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\''; |
| | | soql += ' AND Contract_Decide_Start_Date__c <=' + String.valueOf(timetest).substring(0, 10); |
| | | soql += ' AND Contract_Decide_End_Date__c >= ' + String.valueOf(timetest).substring(0, 10); |
| | | if(!String.isBlank(CateName)){ |
| | | soql += ' AND Name like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\''; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<Account> attList; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexSearchHospitalController { |
| | | |
| | | @AuraEnabled |
| | | public static Results init(){ |
| | | Results results = new Results(); |
| | | try { |
| | | User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ]; |
| | | String accountId = Useracc.accountid; |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ; |
| | | soql += ' order by Name desc limit 100'; |
| | | results.attList = Database.query(soql); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchHospital(String searchName, String accountId){ |
| | | Results results = new Results(); |
| | | try { |
| | | results.attList = Database.query(makeSoql(searchName, accountId)); |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | private static String makeSoql(String searchName,String accountId){ |
| | | String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account'; |
| | | soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ; |
| | | if(String.isNotBlank(searchName)){ |
| | | soql += ' AND Name like \'%' + searchName+ '%\''; |
| | | } |
| | | soql += ' order by Name desc limit 100'; |
| | | return soql; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<Account> attList; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | // 到货订单来的时候 |
| | | if (getExistarrive()) { |
| | | if (editAble) { |
| | | alertMessage = '到货订单直接出库,出库单明细不可编辑。'; |
| | | alertMessage = '到货订单直接出库,出库单明细不可编辑'; |
| | | } |
| | | if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') { |
| | | system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c); |
| | |
| | | res.entity = data; |
| | | //订单信息确认 |
| | | if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) { |
| | | // coc.SummonsForDirction__c.addError('请输入指示单目的。'); |
| | | // coc.SummonsForDirction__c.addError('请输入指示单目的'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入指示单目的。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入指示单目的', ''); |
| | | } else if (coc.SummonsForDirction__c == '直接销售给医院') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院。'); |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室。'); |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('不需要二级经销商和经销商(录入)信息。' ); |
| | | // coc.addError('不需要二级经销商和经销商(录入)信息' ); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要二级经销商和经销商(录入)信息。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '不需要二级经销商和经销商(录入)信息', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '医院试用') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院。'); |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室。'); |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '销售给二级经销商') { |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)。'); |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院。'); |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室。'); |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '互相调货') { |
| | | if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) { |
| | | // coc.addError('不需要输入医院。'); |
| | | // coc.addError('不需要输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入医院。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入医院', ''); |
| | | } |
| | | if (String.isNotBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室。'); |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)。'); |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | } |
| | | |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '经销商:' + coc.Order_ForDealerText__c + ' 没有消耗品:' + proStr.substring(0, proStr.length() - 1) + ' 的特价', |
| | | '经销商:' + |
| | | coc.Order_ForDealerText__c + |
| | | ' 没有消耗品:' + |
| | | proStr.substring(0, proStr.length() - 1) + |
| | | ' 的特价', |
| | | '' |
| | | ); |
| | | } |
| | |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量。'); |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } |
| | | |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位。'); |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)。'); |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位。'); |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量。'); |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量。', ''); |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } else { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | |
| | | public static List<LookupSearchResult> search(String searchTerm) { |
| | | System.debug('searchTerm = ' + searchTerm); |
| | | String nameCondition = ''; |
| | | nameCondition += '%' + String.escapeSingleQuotes(''.replaceAll('%', '\\%')) + '%'; |
| | | List<Account> accs; |
| | | nameCondition += '%' + String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) + '%'; |
| | | List<Account> accs = new List<Account>(); |
| | | System.debug('nameCondition = ' + nameCondition); |
| | | accs = [ |
| | | SELECT id, Parentid |
| | | FROM Account |
| | | WHERE |
| | | Parent.Name LIKE :nameCondition |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | ]; |
| | | //查询条件修改 |
| | | //筛选判断条件:当前财年的4/1 ~ 第二年的6/30 & ET or ENG类型 & 当前用户类型 |
| | | //1 and 2 |
| | | //1. Integer year 2022/4/1 ~ 2023/6/30 |
| | | //开始日期 + 结束日期 |
| | | //Contract_Decide_Start_Date__c>=开始日期 and Contract_Decide_End_Date__c<结束日期 |
| | | //2. 添加经销商允销类型:ET经销商协议;ENG耗材经销商协议 |
| | | //取当前用户的类型,如果用户类型是ET,ET经销商协议 = true |
| | | // Date today = Date.today(); |
| | | // Integer thisYear = today.year(); |
| | | // Integer nextYear = today.year() + 1; |
| | | // Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | // Date nextDatetime = Date.newInstance(nextYear, 6, 30); |
| | | // System.debug('thisDatetime = ' + thisDatetime); |
| | | // System.debug('nextDatetime = ' + nextDatetime); |
| | | |
| | | // User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()]; |
| | | // System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId()); |
| | | // System.debug('UserProTypecTemp = ' + UserProTypecTemp); |
| | | // System.debug('UserProTypecTemp.UserPro_Type__c = ' + UserProTypecTemp.UserPro_Type__c); |
| | | // if (UserProTypecTemp.UserPro_Type__c == 'ENG') { |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // // AND |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | | // AND Contract_Decide_End_Date__c <= :nextDatetime |
| | | // AND ENG_Dealer__c = true |
| | | // ORDER BY Name |
| | | // LIMIT 49 |
| | | // ]; |
| | | // } |
| | | // if (UserProTypecTemp.UserPro_Type__c == 'ET') { |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // // AND |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | | // AND Contract_Decide_End_Date__c <= :nextDatetime |
| | | // AND ET_SP_Dealer__c = true |
| | | // ORDER BY Name |
| | | // LIMIT 49 |
| | | // ]; |
| | | // } |
| | | |
| | | |
| | | Date today = Date.today(); |
| | | //Date today = Date.newInstance(2023, 3, 1); |
| | | Integer thisMonth = today.month(); |
| | | System.debug('thisMonth = ' + thisMonth); |
| | | |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 7, 1); |
| | | Date nextDatetime = Date.newInstance(nextYear, 7, 1); |
| | | System.debug('lastDatetime = ' + lastDatetime); |
| | | System.debug('thisDatetime = ' + thisDatetime); |
| | | System.debug('thisDatetime2 = ' + thisDatetime2); |
| | | System.debug('nextDatetime = ' + nextDatetime); |
| | | System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId()); |
| | | User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()]; |
| | | |
| | | String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition '; |
| | | if(thisMonth < 4){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 '; |
| | | }else if(thisMonth >= 4 && thisMonth <= 6){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | }else{ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | } |
| | | if (UserProTypecTemp.UserPro_Type__c == 'ENG') { |
| | | sql += 'AND ENG_Dealer__c = true'; |
| | | } |
| | | if (UserProTypecTemp.UserPro_Type__c == 'ET') { |
| | | sql += 'AND ET_SP_Dealer__c = true'; |
| | | } |
| | | System.debug('sql = ' + sql); |
| | | accs = Database.query(sql); |
| | | // 用于保存特约经销商匹配到的其父类的id |
| | | Set<String> pids = new Set<String>(); |
| | | for (Account acc : accs) { |
| | | pids.add(acc.Parentid); |
| | | } |
| | | |
| | | accs = [ |
| | | SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | FROM Account |
| | |
| | | OR (Name = '奥林巴斯(北京)销售服务有限公司' |
| | | AND Name LIKE :nameCondition)) |
| | | AND RecordType.DeveloperName = 'Agency' |
| | | AND Is_Active__c != '無効' |
| | | ORDER BY Name |
| | | LIMIT 5 |
| | | LIMIT 49 |
| | | ]; |
| | | |
| | | // accs = [ |
| | | // SELECT id, Parentid |
| | | // FROM Account |
| | | // WHERE |
| | | // Parent.Name LIKE :nameCondition |
| | | // AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | // AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | // ]; |
| | | |
| | | // 用于保存特约经销商匹配到的其父类的id |
| | | // Set<String> pids = new Set<String>(); |
| | | // for (Account acc : accs) { |
| | | // pids.add(acc.Parentid); |
| | | // } |
| | | // accs = [ |
| | | // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity |
| | | // FROM Account |
| | | // WHERE |
| | | // (Id IN :pids |
| | | // OR (Name = '奥林巴斯(北京)销售服务有限公司' |
| | | // AND Name LIKE :nameCondition)) |
| | | // AND RecordType.DeveloperName = 'Agency' |
| | | // AND Is_Active__c != '無効' |
| | | // ORDER BY Name |
| | | // LIMIT 5 |
| | | // ]; |
| | | System.debug('accs = ' + accs); |
| | | List<LookupSearchResult> results = new List<LookupSearchResult>(); |
| | | String accountIcon = 'standard:account'; |
| | | for (Account account : accs) { |
| | |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<ContentVersion> cvList = [ |
| | | SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate |
| | | SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :recordId |
| | | ]; |
| | |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | public without sharing class LexTopPageController { |
| | | //经销商信息 |
| | | public static account accountInfo; |
| | | /*****************画面表示Bean******************/ |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords =new List<ConsumableorderdetailsInfo>(); |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | //page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | // public static Integer pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // public static Integer totalcount; |
| | | // public static Integer pagecount; |
| | | // public static Integer currentpage = 0; |
| | | // public static Boolean hasPrevious; |
| | | // public static Boolean hasNext; |
| | | public static List<ConsumableorderdetailsInfo> pageRecords; |
| | | public static String soql {get;set;} |
| | | // 汇总使用 |
| | | public static Integer Total_num; |
| | | public static Integer OrderNumber_arrived; |
| | | public static Integer Delivery_detail_count; |
| | | public static Integer OrderNumber_notarrive; |
| | | public static Integer More_than_seven_days; |
| | | //排序使用 |
| | | // public static String sortKey; |
| | | // public static String preSortKey; |
| | | // public static Boolean sortOrderAsc; |
| | | // public static String[] sortOrder; |
| | | /*****************一周未到货订单一览对应start******************/ |
| | | // 订单 字段标签 |
| | | public static List<String> title; |
| | | // 订单 字段名 |
| | | public static List<String> column; |
| | | public static List<List<String>> columns; |
| | | // 画面显示数据 |
| | | public static List<Consumable_order__c> raesList; |
| | | /*****************一周未到货订单一览对应end******************/ |
| | | //排序使用 |
| | | private static String[] orderby = new String[]{ 'Product2__c.Name__c'}; |
| | | //产品上下限 |
| | | public static String[] proLimitAndDate =new String[]{}; |
| | | public static String product_Limit; |
| | | //库存产品最早有效期限 |
| | | private static Map<String,Date> productkucun = new Map<String,Date>(); |
| | | //消费期限小于一年的产品 |
| | | public static List<ConsumableorderdetailsInfo> overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>(); |
| | | public static String accountid; |
| | | public static String accountName; |
| | | public static List<String> orderDetZaikuList = new List<String>(); |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | // 未到货订单信息(超过一周)显示控制 |
| | | public static Boolean over_view { |
| | | get { |
| | | return raesList.size() > 0 ? true : false; |
| | | } |
| | | } |
| | | // 使用期限小于一年的产品 显示控制 |
| | | public static Boolean overlimit { |
| | | get { |
| | | return overlimitdateorderdetails.size() > 0 ? true : false; |
| | | } |
| | | } |
| | | //用户产品区分 |
| | | public static String userPro_Type; |
| | | public static String userPro_Typestr = null; |
| | | public static Boolean EngFlag = false; |
| | | public static Boolean ETFlag = false; |
| | | public static Boolean hasHos; |
| | | |
| | | @AuraEnabled |
| | | public static Results initAgency(){ |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | accountid = useracc.accountid; |
| | | List<Account> accList = new List<Account>(); |
| | | accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c, |
| | | Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c, |
| | | Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c, |
| | | Business_Authorization_No__c,Business_Paper_Expiration_Date__c, |
| | | Credit_Check_No__c,Dealer_discount__c, |
| | | Phone,Address_Together__c,Is_Active_Formula__c, |
| | | Management_Code__c,Sales_Shop_Class__c,Postal_Code__c, |
| | | Fax,Address__c,Deposit_Receipt_Finished__c, |
| | | Deposit_Receipt_Completion_Day__c, |
| | | Product_Limit_Date__c, |
| | | Product_Limit_DateENG__c |
| | | FROM account WHERE id =:accountid]; |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | results.result = 'Success'; |
| | | results.accountInfo = accountInfo; |
| | | }catch(Exception e){ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results initPage(Integer pageSizeLWC,Integer pageTokenLWC){ |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>(); |
| | | //page |
| | | // pagesize = Integer.valueof(system.label.orderdetLimitsize); |
| | | // currentpage = 0; |
| | | |
| | | User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()]; |
| | | // String uid = '0051000000E7Pv9AAF'; |
| | | // User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:uid]; |
| | | accountid = useracc.accountid; |
| | | userWorkLocation = useracc.Work_Location__c; |
| | | userPro_Type = useracc.UserPro_Type__c; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | userPro_Typestr = '%' + userPro_Type + '%'; |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //经销商·基本信息获取 |
| | | List<Account> accList = new List<Account>(); |
| | | accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c, |
| | | Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c, |
| | | Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c, |
| | | Business_Authorization_No__c,Business_Paper_Expiration_Date__c, |
| | | Credit_Check_No__c,Dealer_discount__c, |
| | | Phone,Address_Together__c,Is_Active_Formula__c, |
| | | Management_Code__c,Sales_Shop_Class__c,Postal_Code__c, |
| | | Fax,Address__c,Deposit_Receipt_Finished__c, |
| | | Deposit_Receipt_Completion_Day__c, |
| | | Product_Limit_Date__c, |
| | | Product_Limit_DateENG__c |
| | | FROM account WHERE id =:accountid]; |
| | | if(accList.size() == 1){ |
| | | accountInfo = accList[0]; |
| | | }else{ |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '未获取到经销商信息'; |
| | | return results; |
| | | } |
| | | accountName = accountInfo.Name; |
| | | if(EngFlag){ |
| | | product_Limit = accountInfo.Product_Limit_DateENG__c; |
| | | }else if(ETFlag){ |
| | | product_Limit = accountInfo.Product_Limit_Date__c; |
| | | } |
| | | if(product_Limit != null && product_Limit !=''){ |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //库存明细取得 |
| | | orderDetZaikuList = new List<String>(); |
| | | List<AggregateResult> orderDetZaiku = [SELECT count(Id), |
| | | Consumable_Product__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | group by Consumable_Product__c]; |
| | | for(AggregateResult zaikuId : orderDetZaiku){ |
| | | orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c'))); |
| | | } |
| | | Map<String,Product2__c> MidMap = new Map<String,Product2__c>(); |
| | | List<Product2__c> product2Selected = [SELECT Id, Name, |
| | | Name__c, |
| | | Asset_Model_No__c, |
| | | Category3__c, |
| | | Category4__c, |
| | | Category5__c, |
| | | SFDA_Status__c, |
| | | Product2__r.SFDA_Approbation_No__c, |
| | | Product2__r.SFDA_Expiration_Date__c, |
| | | Product2__r.Packing_list_manual__c |
| | | FROM Product2__c |
| | | WHERE Id in :orderDetZaikuList |
| | | ]; |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, product2Selected[i]); |
| | | } |
| | | //返品库存统计 |
| | | List<Consumable_order_details2__c> CountDel = [SELECT Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation]; |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒'){ |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone(); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | } |
| | | } |
| | | }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个'){ |
| | | String tex = 'A'; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | tex = 'B'; |
| | | } |
| | | if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex )){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex).clone(); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c)); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage); |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage); |
| | | } |
| | | } |
| | | } |
| | | //如果是 医院特价创建的明细2 则 |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> newHosMidBoxList = new List<ConsumableorderdetailsInfo>(); |
| | | //把Boxmap里的值从新赋给boxRecords |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | if(bss.allnumber>0){ |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if(bss.allnumber>0){ |
| | | bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | bss.overlimitCount = bss.allnumber - bss.limitCount; |
| | | } |
| | | } |
| | | //排序应该是 非医院特价的盒,医院特价的盒,非医院特价的个,医院特价的个 |
| | | //add by rentx 2020-11-27 先判断医院特价的盒 和 个 |
| | | //2020-11-27 日 于 rentx 注释 start |
| | | String temp = 'A'; |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | //该产品是医院特价产品 |
| | | if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个B')) { |
| | | if (newMidPieceMap.get(bss.Prod.Id+'个B').hospitalSpecialOffer) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个B')); |
| | | newMidPieceMap.remove(bss.Prod.Id+'个B'); |
| | | } |
| | | } |
| | | |
| | | if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个A')) { |
| | | // if (newMidPieceMap.get(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个A')); |
| | | newMidPieceMap.remove(bss.Prod.Id+'个A'); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id+'个B')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B')); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | if (newMidPieceMap.containsKey(bss.Prod.Id+'个A')) { |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A')); |
| | | } |
| | | } |
| | | // consumableorderdetailsRecords.addAll(newMidPieceMap.values()); |
| | | //2020-11-27 日 于 rentx 注释 end |
| | | // consumableorderdetailsRecords.addAll(newMidPieceMap.values()); |
| | | //2020-11-27 日 于 rentx 注释 end |
| | | |
| | | notarriveorder(); |
| | | productLimtAndDate(); |
| | | datelimitSearch(); |
| | | //add by rentx |
| | | Integer ishos = 0; |
| | | for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){ |
| | | if(productkucun.get(bss.Prod.Id) != null){ |
| | | bss.guaranteeperiod = productkucun.get(bss.Prod.Id); |
| | | } |
| | | //add by rentx 2021-3-10 start |
| | | if (bss.hospitalSpecialOffer) { |
| | | ishos = ishos+1; |
| | | } |
| | | |
| | | } |
| | | if (ishos > 0) { |
| | | hasHos = true; |
| | | }else{ |
| | | hasHos = false; |
| | | } |
| | | //add by rentx 2021-3-10 end |
| | | //consumableorderdetailsRecords.sort(); |
| | | //list分割 |
| | | //listCut(); |
| | | // sortKey = '0'; |
| | | // preSortKey = '0'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new String[1]; |
| | | // sortOrder = new String[]{' ', '↓'}; |
| | | //总件数 |
| | | totalCount = consumableorderdetailsRecords.size(); |
| | | //页数 |
| | | // pagecount=(totalcount + pagesize - 1) / pagesize; |
| | | //显示第一页 |
| | | // moveToFirst(); |
| | | makeCurrentPageRecords(); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | System.debug('pageToken==>'+ pageToken); |
| | | System.debug('pageSize===>'+ pageSize); |
| | | |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | System.debug('paginatedAccounts.recordStart'+ paginatedAccounts.recordStart); |
| | | System.debug('paginatedAccounts.pageNumber'+ paginatedAccounts.pageNumber); |
| | | System.debug('paginatedAccounts.nextPageToken===>'+paginatedAccounts.nextPageToken); |
| | | System.debug('recordEnd'+ recordEnd); |
| | | |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | //end |
| | | System.debug('PaginatedAccounts===>'+PaginatedAccounts); |
| | | |
| | | //赋值回传 |
| | | results.result = 'Success'; |
| | | results.title = title; |
| | | results.raesList = raesList; |
| | | results.columns = columns; |
| | | results.over_view = over_view; |
| | | results.overlimit = overlimit; |
| | | results.hasHos = hasHos; |
| | | results.overlimitdateorderdetails = overlimitdateorderdetails; |
| | | results.accountInfo = accountInfo; |
| | | results.pageRecords = pageRecords; |
| | | results.product_Limit = product_Limit; |
| | | results.totalNum = Total_num; |
| | | results.orderNumberArrived = OrderNumber_arrived; |
| | | results.deliveryDetailCount = Delivery_detail_count; |
| | | results.orderNumberNotarrive = OrderNumber_notarrive; |
| | | results.moreThanSevenDays = More_than_seven_days; |
| | | //add by WangXueqin 2023/05/05 |
| | | results.userPro_Type = userPro_Type; |
| | | results.paginatedAccounts = paginatedAccounts; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //超过一周未到货订单 |
| | | public static void notarriveorder(){ |
| | | //over_view = false; |
| | | Date orderdate = Date.today().addDays(-7); |
| | | |
| | | List<Consumable_order_details2__c> orderdetails = [SELECT Id,Name,Consumable_order_minor__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Deliver_date__c < :orderdate |
| | | and Consumable_order_minor__c !=null |
| | | and Dealer_Info_text__c = :accountName |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = false |
| | | ]; |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO , 'userPro_Type——————' + userPro_Type)); |
| | | Map<String, String> notarriveorderMap = new Map<String, String>(); |
| | | List<String> notarriveorderid = new List<String>(); |
| | | for(Integer i = 0; i < orderdetails.size(); i++){ |
| | | if(notarriveorderMap.containsKey(orderdetails[i].Consumable_order_minor__c)){ |
| | | continue; |
| | | }else{ |
| | | notarriveorderMap.put(orderdetails[i].Consumable_order_minor__c, orderdetails[i].Consumable_order_minor__c); |
| | | //notarriveorderid.add('\'' + orderdetails[i].Consumable_order_minor__c +'\''); |
| | | notarriveorderid.add(orderdetails[i].Consumable_order_minor__c); |
| | | } |
| | | } |
| | | // 获得订单一览 |
| | | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); |
| | | Schema.FieldSet fs = fsMap.get('arrive_view'); |
| | | // 获得订单中的所有项目 |
| | | List<FieldSetMember> fsmList = fs.getFields(); |
| | | // 获得字段标签和字段名 |
| | | title = new List<String>(); |
| | | column = new List<String>(); |
| | | columns = new List<List<String>>(); |
| | | for (FieldSetMember fsm : fsmList) { |
| | | title.add(fsm.getLabel()); |
| | | column.add(fsm.getFieldPath()); |
| | | columns.add(fsm.getFieldPath().split('\\.')); |
| | | } |
| | | system.debug('columns=====================>'+columns); |
| | | // 获得显示数据 |
| | | raesList = new List<Consumable_order__c>(); |
| | | String soql = 'select Id'; |
| | | for (String s : column) { |
| | | soql += ',' + s; |
| | | } |
| | | soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Delivery_detail_count__c > 0 and showFalseNotshowTrue__c = false '; |
| | | soql += ' and Order_ProType__c = \'' + userPro_Type + '\' ' ; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | |
| | | if(notarriveorderid.size() < 1){ |
| | | soql +=' AND Id = null '; |
| | | }else{ |
| | | String sqlTail = '(\''; |
| | | for(Integer i = 0 ; i< notarriveorderid.size();i++){ |
| | | if(i<notarriveorderid.size()-1){ |
| | | sqlTail += notarriveorderid[i]+'\',\''; |
| | | }else{ |
| | | sqlTail += notarriveorderid[i]+'\')'; |
| | | } |
| | | } |
| | | //over_view = true; |
| | | soql +=' AND Id in ' + sqlTail; |
| | | } |
| | | system.debug('soql_____11111__' + soql); |
| | | raesList = Database.query(soql); |
| | | // update end by vivek2020-01-15 |
| | | Total_num = 0; |
| | | OrderNumber_arrived = 0; |
| | | Delivery_detail_count = 0; |
| | | OrderNumber_notarrive = 0; |
| | | More_than_seven_days = 0; |
| | | for(Consumable_order__c conorder :raesList){ |
| | | Total_num += (Integer)conorder.Total_num__c; |
| | | OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c; |
| | | Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c; |
| | | OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c; |
| | | More_than_seven_days += (Integer)conorder.More_than_seven_days__c; |
| | | } |
| | | // update end by vivek2020-01-15 |
| | | } |
| | | |
| | | public static void productLimtAndDate(){ |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String,String> productLimt = new Map<String,String>(); |
| | | for(Integer i = 0; i < proLimitAndDate.size(); i++){ |
| | | nowName = proLimitAndDate[i]; |
| | | if( nowName.indexOf( '|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|')); |
| | | nowName = nowName.subString( nowName.indexOf( '|')+1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(productLimt.containsKey(ass.Prod.Asset_Model_No__c)){ |
| | | ass.lowerlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|'))); |
| | | ass.upperlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')+1)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void datelimitSearch(){ |
| | | Set<String> barcodekucun = new Set<String>(); |
| | | //--------UpdateStart-----XHL--------------20180929------------- |
| | | List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c, |
| | | Recordtypeid,Guarantee_period_for_products__c, |
| | | Sterilization_limit__c,Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like :userPro_Typestr |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | ORDER BY Consumable_Product__c, Sterilization_limit__c asc ]; |
| | | //--------UpdateEnd-----XHL--------------20180929------------- |
| | | for(Integer i = 0 ; i< orderkucun.size();i++){ |
| | | if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){ |
| | | continue; |
| | | }else{ |
| | | productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c); |
| | | } |
| | | } |
| | | barcodekucun.clear(); |
| | | for(Integer i = 0 ; i< orderkucun.size();i++){ |
| | | if(orderkucun[i].Sterilization_limit__c < Date.today().addYears(1)){ |
| | | if(barcodekucun.contains(orderkucun[i].Bar_Code__c)){ |
| | | continue; |
| | | }else{ |
| | | barcodekucun.add(orderkucun[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | List<AggregateResult> overlimitdatedetails = [SELECT Asset_Model_No__c prodName , |
| | | Box_Piece__c BoxPiece,count(id) countid |
| | | FROM Consumable_order_details2__c |
| | | WHERE Bar_Code__c in :barcodekucun |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | GROUP BY Asset_Model_No__c,Box_Piece__c |
| | | ORDER BY Asset_Model_No__c,Box_Piece__c]; |
| | | for(Integer i = 0 ; i< overlimitdatedetails.size();i++){ |
| | | overlimitdateorderdetails.add(new ConsumableorderdetailsInfo(overlimitdatedetails[i])); |
| | | } |
| | | } |
| | | |
| | | //首页 |
| | | // public static void moveToFirst(){ |
| | | // if(currentpage == 1) return; |
| | | // currentpage = 1; |
| | | // canMove(); |
| | | // } |
| | | |
| | | //判断是否可翻页 |
| | | // public static void canMove(){ |
| | | // hasPrevious = false; |
| | | // hasNext = false; |
| | | // if(pagecount > 1 && currentpage > 1) hasPrevious = true; |
| | | // if(pagecount > 1 && currentpage < pagecount) hasNext = true; |
| | | // } |
| | | |
| | | //编辑当前页内容 |
| | | public static void makeCurrentPageRecords(){ |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | if (endIdx > consumableorderdetailsRecords.size()) { |
| | | endIdx = consumableorderdetailsRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecords.add(consumableorderdetailsRecords.get(i)); |
| | | } |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // Data Bean |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | //public Boolean check { get; set; } |
| | | //public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public Date guaranteeperiod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal countid { get; set; } |
| | | @AuraEnabled |
| | | public String prodName { get; set; } |
| | | @AuraEnabled |
| | | public Decimal limitCount { get; set; } |
| | | @AuraEnabled |
| | | public Decimal overlimitCount { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set ;} |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | //check = false; |
| | | //oldCheck = false; |
| | | esd = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | oldConsumableCount = null; |
| | | allnumber = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(AggregateResult e) { |
| | | countid =Integer.valueOf(e.get('countid')); |
| | | prodName = String.valueOf(e.get('prodname')); |
| | | BoxPiece = String.valueOf(e.get('BoxPiece')); |
| | | } |
| | | |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo; |
| | | Integer returnValue = 0; |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public List<String> title; |
| | | @AuraEnabled |
| | | public List<Consumable_order__c> raesList; |
| | | @AuraEnabled |
| | | public List<List<String>> columns; |
| | | @AuraEnabled |
| | | public Boolean over_view; |
| | | @AuraEnabled |
| | | public Boolean overlimit; |
| | | @AuraEnabled |
| | | public Boolean hasHos; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> overlimitdateorderdetails; |
| | | @AuraEnabled |
| | | public Account accountInfo; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> pageRecords; |
| | | @AuraEnabled |
| | | public String product_Limit; |
| | | @AuraEnabled |
| | | public Integer totalNum; |
| | | @AuraEnabled |
| | | public Integer orderNumberArrived; |
| | | @AuraEnabled |
| | | public Integer deliveryDetailCount; |
| | | @AuraEnabled |
| | | public Integer orderNumberNotarrive; |
| | | @AuraEnabled |
| | | public Integer moreThanSevenDays; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | //add by WangXueqin 2023/05/05 |
| | | @AuraEnabled |
| | | public String userPro_Type; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> pageCodeRecords; |
| | | @AuraEnabled |
| | | public PaginatedAccounts paginatedAccounts; |
| | | |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexUpAccountProLimit { |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC upAccount(String accountId,String productLimit,String userPro_Type){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | //--------AddStart-----XHL--------------20180929------------- |
| | | Boolean EngFlag = false; |
| | | Boolean ETFlag = false; |
| | | String userPro_Typestr = null; |
| | | if(String.isBlank(userPro_Type)){ |
| | | userPro_Type = 'ET'; |
| | | } |
| | | if(userPro_Type == 'ENG'){ |
| | | EngFlag = true; |
| | | }else{ |
| | | ETFlag = true; |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type)); |
| | | //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type)); |
| | | userPro_Typestr = '%' + userPro_Type + '%'; |
| | | //--------AddEnd-----XHL--------------20180929------------- |
| | | system.debug('userPro_Type' + userPro_Type); |
| | | String checkResoultstr = checkResoult(productLimit); |
| | | system.debug('checkResoultstr====>'+checkResoultstr); |
| | | if(String.isNotBlank(checkResoultstr)){ |
| | | return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', ''); |
| | | // return checkResoultstr; |
| | | } |
| | | //String[] proidList =new String[]{}; |
| | | String[] proList =new String[]{}; |
| | | String[] pro_List =new String[]{}; |
| | | List<Account> acc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Product_Limit_Date__c |
| | | FROM |
| | | Account |
| | | WHERE |
| | | Id = : accountId |
| | | FOR UPDATE |
| | | ]; |
| | | if(null == acc || acc.size() == 0) { |
| | | // return '没有经销商:' + accountId + '的数据。'; |
| | | return new ResponseBodyLWC('Error',500,'没有经销商:' + accountId + '的数据', ''); |
| | | } |
| | | //proidList = acc[0].view_product__c.split(','); |
| | | //--------UpdateStart-----XHL--------------20180929------------- |
| | | String sql = ''; |
| | | List<Product2__c> roduct2List = [SELECT Asset_Model_No__c |
| | | FROM Product2__c |
| | | WHERE Product_Type__c like :userPro_Typestr limit 10000];//Add Limit by Li Jun 20230601, need to remove limit later |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'roduct2List:'+ roduct2List)); |
| | | //sql = 'SELECT Asset_Model_No__c ' |
| | | // + ' FROM Product2__c ' |
| | | // + ' WHERE Pro2_Dealer_Object__c = true'; |
| | | //if(EngFlag){ |
| | | // sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ; |
| | | //}else if(ETFlag){ |
| | | // sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag; |
| | | //} |
| | | //system.debug('sqlZZZZZZ' + sql); |
| | | //List<Product2__c> roduct2List = Database.query(sql); |
| | | //--------UpdateEnd-----XHL--------------20180929------------- |
| | | Map<String, String> productMap = new Map<String, String>(); |
| | | proList = productLimit.split(','); |
| | | system.debug('productLimitDDDDD' + productLimit); |
| | | system.debug('proListFFFFF' + proList); |
| | | if(proList.size() > 0 && String.isNotEmpty(proList[0])){ |
| | | for(Integer i = 0; i < proList.size(); i++){ |
| | | pro_List.add(proList[i].subString(0,proList[i].indexOf( '|'))); |
| | | } |
| | | } |
| | | if(roduct2List.size() > 0){ |
| | | for(Product2__c pro2 :roduct2List){ |
| | | productMap.put(pro2.Asset_Model_No__c, pro2.Asset_Model_No__c); |
| | | } |
| | | } |
| | | for(Integer i = 0; i < pro_List.size(); i++){ |
| | | if(!productMap.containsKey(pro_List[i])){ |
| | | // return '经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在!'; |
| | | return new ResponseBodyLWC('Error',500,'经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在', ''); |
| | | } |
| | | } |
| | | String productLimitDa = ''; |
| | | for(String str : productLimit.split(',')){ |
| | | |
| | | if(str != null && str != ''){ |
| | | productLimitDa += ',' + str; |
| | | } |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try{ |
| | | Account accinfo = new Account(); |
| | | accinfo.Id = accountId; |
| | | if(EngFlag){ |
| | | accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1); |
| | | }else if(ETFlag){ |
| | | accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1); |
| | | } |
| | | |
| | | UPDATE accinfo; |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // return ''; |
| | | }catch(DmlException de){ |
| | | Database.rollback(sp); |
| | | throw de; |
| | | } |
| | | } |
| | | public static String checkResoult (String productLimit){ |
| | | String[] proLimit = productLimit.split(','); |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | List<String> asstModelNo = new List<String>(); |
| | | Map<String,String> asstModelNoMap = new Map<String,String>(); |
| | | List<String> asstModelNoCount = new List<String>(); |
| | | for(Integer i = 0; i < proLimit.size(); i++){ |
| | | nowName = proLimit[i]; |
| | | if( nowName.indexOf( '|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|')); |
| | | } |
| | | asstModelNo.add(nowRightAsstModelNo); |
| | | } |
| | | |
| | | for(Integer i = 0; i < asstModelNo.size(); i++){ |
| | | if(asstModelNoMap.containsKey(asstModelNo[i])){ |
| | | asstModelNoCount.add(asstModelNo[i]); |
| | | }else{ |
| | | asstModelNoMap.put(asstModelNo[i], asstModelNo[i]); |
| | | } |
| | | } |
| | | if(asstModelNoCount.size() > 0){ |
| | | return '产品:' + asstModelNoCount + '的数据重复'; |
| | | // return new ResponseBodyLWC('Error',500,'产品:' + asstModelNoCount + '的数据重复。', ''); |
| | | }else{ |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public without sharing class LexUtility { |
| | | |
| | | //查询是否一直显示提示 |
| | | public static Boolean getIsNoteStay(){ |
| | | NoteStay__c noteStay = NoteStay__c.getInstance('NoteStay'); |
| | | return noteStay.IsStay__c; |
| | | } |
| | | |
| | | //查询许可证提醒天数 |
| | | public static Integer getLicenceReminderDays(){ |
| | | LicenceReminderDate__c days = LicenceReminderDate__c.getInstance('180Days'); |
| | | return days.ReminderDays__c.intValue(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | * Class used to serialize a single Lookup search result item |
| | | * The Lookup controller returns a List<LookupSearchResult> when sending search result back to Lightning |
| | | */ |
| | | public class LookupSearchResult implements Comparable { |
| | | private Id id; |
| | | private String sObjectType; |
| | | private String icon; |
| | | private String title; |
| | | private String subtitle; |
| | | public virtual class LookupSearchResult implements Comparable { |
| | | protected String id; |
| | | protected String sObjectType; |
| | | protected String icon; |
| | | protected String title; |
| | | protected String subtitle; |
| | | |
| | | |
| | | protected LookupSearchResult() { |
| | | } |
| | | |
| | | public LookupSearchResult(Id id, String sObjectType, String icon, String title, String subtitle) { |
| | | /** |
| | | * @param id the lookup entry identifier (generally a record ID) |
| | | * @param sObjectType Optional - The sObject type of the selected record. This value is not used for lookup rendering. It's passed back to the selection handler in case you search on multiple object types. |
| | | * @param icon Optional - A qualified SLDS icon name taken from https://www.lightningdesignsystem.com/icons. It defaults to standard:default. |
| | | * @param title Required - The label of the lookup entry |
| | | * @param subtitle Optional - A subtitle that is displayed under the lookup entry label |
| | | */ |
| | | public LookupSearchResult(String id, String sObjectType, String icon, String title, String subtitle) { |
| | | this.id = id; |
| | | this.sObjectType = sObjectType; |
| | | this.icon = icon; |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public Id getId() { |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <apiVersion>57.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | |
| | | //2022-6-22 yjk 询价跟进任务 start |
| | | protected override void afterInsert() { |
| | | updateTask(); |
| | | updateTask(); |
| | | } |
| | | |
| | | // 2022-7-29 ssm XLIU-CGSC8R 【委托】[改善】询价里删除批准的失单报告状态1自动变 |
| | |
| | | |
| | | private void updateTask(){ |
| | | List<Id> oppIdList = new List<Id>(); |
| | | Set<Id> oppIdSet = new Set<Id>(); |
| | | Set<Id> oppIdSet = new Set<Id>(); |
| | | Set<Id> sdoppidSet = new Set<Id>(); |
| | | List<Id> updateOppId = new List<Id>(); |
| | | List<Opportunity> updateOpp = new List<Opportunity>(); |
| | | Map<String,String> cancelMap = new Map<String,String>();//lt 20230425 招标终止 add |
| | | |
| | | for(Lost_cancel_report__c lcr : newList){ |
| | | oppIdList.add(lcr.Opportunity__c); |
| | | |
| | | cancelMap.put(lcr.Opportunity__c, lcr.RecordType.Name);//lt 20230425 招标终止 add |
| | | } |
| | | // 20221202 ljh DB202211594688 start |
| | | // List<task__c> taskList = [select id,taskStatus__c,OpportunityId__c from task__c where RecordType.Name ='中标结果确认' and taskStatus__c = '02 接受' and OpportunityId__c in :oppIdList]; |
| | |
| | | // //updateOppId.add(tsk.OpportunityId__c); //20220823 you 没有任务时, |
| | | // } |
| | | // LoseListTask 失单报告任务 winBiddingTask 中标结果确认 |
| | | List<task__c> taskList = [select id,taskStatus__c,OpportunityId__c,RecordType.Name from task__c where (RecordType.Name ='中标结果确认' or RecordType.Name ='失单报告任务') and OpportunityId__c in :oppIdList]; |
| | | for(task__c tsk : taskList){ |
| | | List<task__c> taskList = [select id,taskStatus__c,OpportunityId__c,RecordType.Name |
| | | from task__c |
| | | where (RecordType.Name ='中标结果确认' or RecordType.Name ='失单报告任务') |
| | | and OpportunityId__c in :oppIdList]; |
| | | // 20230508 ljh DB202305008316 start |
| | | /*for(task__c tsk : taskList){ |
| | | //lt 20230425 招标终止 start |
| | | System.debug('---lt123---cancelMap:'+cancelMap); |
| | | System.debug('---lt123---cancelMap.get(tsk.OpportunityId__c):'+cancelMap.get(tsk.OpportunityId__c)); |
| | | if(cancelMap.containsKey(tsk.OpportunityId__c)){ |
| | | if(cancelMap.get(tsk.OpportunityId__c) == 'PCL_Cancel_report'){ |
| | | tsk.taskStatus__c = '04 取消'; |
| | | tsk.cancelReasonSelect__c = '项目终止'; |
| | | } |
| | | }else |
| | | //lt 20230425 招标终止 end |
| | | if(tsk.RecordType.Name == '中标结果确认' && tsk.taskStatus__c == '02 接受'){ |
| | | tsk.taskStatus__c = '03 完成'; |
| | | } |
| | |
| | | sdoppidSet.add(tsk.OpportunityId__c); |
| | | } |
| | | oppIdSet.add(tsk.OpportunityId__c); |
| | | }*/ |
| | | List<task__c> Uptask = new List<task__c>(); |
| | | for(task__c tsk : taskList){ |
| | | task__c temp = new task__c(); |
| | | temp.Id = tsk.Id; |
| | | if(cancelMap.containsKey(tsk.OpportunityId__c)){ |
| | | if(cancelMap.get(tsk.OpportunityId__c) == 'PCL_Cancel_report'){ |
| | | temp.taskStatus__c = '04 取消'; |
| | | temp.cancelReasonSelect__c = '项目终止'; |
| | | } |
| | | }else |
| | | if(tsk.RecordType.Name == '中标结果确认' && tsk.taskStatus__c == '02 接受'){ |
| | | temp.taskStatus__c = '03 完成'; |
| | | } |
| | | if(tsk.RecordType.Name == '失单报告任务'){ |
| | | sdoppidSet.add(tsk.OpportunityId__c); |
| | | } |
| | | oppIdSet.add(tsk.OpportunityId__c); |
| | | Uptask.add(temp); |
| | | } |
| | | // 20230508 ljh DB202305008316 end |
| | | |
| | | // for(Id oppId : oppIdList){//20220823 you |
| | | for(Id oppId : oppIdSet){ |
| | | // 20221202 ljh DB202211594688 end |
| | |
| | | updateOpp.add(opptemp); |
| | | } |
| | | |
| | | |
| | | update updateOpp; |
| | | update taskList; |
| | | // 20230508 ljh DB202305008316 start |
| | | // update taskList; |
| | | update Uptask; |
| | | // 20230508 ljh DB202305008316 end |
| | | |
| | | } |
| | | //2022-6-22 yjk 询价跟进任务 end |
| | | |
| | |
| | | |
| | | //20220708 询价任务开发,结束失单任务状态,筛选需要的修改的失单任务 start |
| | | Set<String> oppIdSet = new Set<String>(); |
| | | Set<String> passOppIdSet = new Set<String>(); |
| | | for (Lost_cancel_report__c n: newList) { |
| | | if ((n.Report_Status__c != oldMap.get(n.Id).Report_Status__c) && n.Report_Status__c == '申请中') { |
| | | oppIdSet.add(n.Opportunity__c); |
| | | } |
| | | if ((n.Report_Status__c != oldMap.get(n.Id).Report_Status__c) && n.Report_Status__c == '批准') { |
| | | passOppIdSet.add(n.Opportunity__c); |
| | | } |
| | | } |
| | | // 20230411 多失单报告合并,取出待合并的询价 start |
| | | Map<String, Opportunity> mapOpps = new Map<String, Opportunity>(); |
| | | List<Opportunity> lstOpps = [select Id, RivalHostsNumber__c, CompetitorProduct1__c, |
| | | CompetitorProduct2__c, CompetitorProduct3__c, Lost_reason_main__c, |
| | | Lost_Reason_Sub__c, Agencies__c, PCLLostBrands__c, of_lost_system_processor__c, |
| | | LostPrices__c |
| | | from Opportunity |
| | | where Id in :passOppIdSet]; |
| | | for(Opportunity opp : lstOpps) { |
| | | mapOpps.put(opp.Id, opp); |
| | | } |
| | | System.debug('mapOpps: ' + mapOpps); |
| | | // 20230411 多失单报告合并,取出待合并的询价 end |
| | | // 20220720 ljh add 记录取消/失单报告提交时点的战略产品判断 start |
| | | if(oppIdSet.size() > 0 ){ |
| | | List<OpportunityLineItem> OppLIlist = [select Id,Key_product_147P_Text__c,Key_product_147P__c from OpportunityLineItem where OpportunityId in :oppIdSet]; |
| | |
| | | } |
| | | update OppLIlist; |
| | | // 20220720 ljh add 记录取消/失单报告提交时点的战略产品判断 end |
| | | List<task__c> taskList = [select id,taskStatus__c from task__c where RecordType.Name ='失单报告任务' and taskStatus__c = '02 接受' and OpportunityId__c in :oppIdSet]; |
| | | List<task__c> taskList = [select id,taskStatus__c |
| | | from task__c |
| | | where RecordType.Name ='失单报告任务' |
| | | and taskStatus__c = '02 接受' |
| | | and OpportunityId__c in :oppIdSet]; |
| | | for(task__c tsk : taskList){ |
| | | tsk.taskStatus__c = '03 完成'; |
| | | tsk.taskStatus__c = '03 完成'; |
| | | } |
| | | update taskList; |
| | | }// 20220720 ljh update |
| | |
| | | List<String> ppList=new List<String>(); //失单品牌 |
| | | // List<String> yyList=new List<String>(); //失单原因 |
| | | //初始化 |
| | | Opportunity opp=new Opportunity(); |
| | | // 20230411 多失单报告合并,取出待合并的询价 start |
| | | Opportunity opp = mapOpps != null && mapOpps.containsKey(arrMap.get(lcro).Opportunity__c) ? mapOpps.get(arrMap.get(lcro).Opportunity__c) : new Opportunity(); |
| | | //20220930 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | opp.RivalHostsNumber__c = 0; |
| | | opp.RivalHostsNumber__c = opp.RivalHostsNumber__c != null ? opp.RivalHostsNumber__c : 0; |
| | | //20220930 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | opp.Id=arrMap.get(lcro).Opportunity__c; opp.PCLLostBrands__c=''; opp.Agencies__c=''; //Id ,品牌,经销商 |
| | | opp.Id = String.isNotBlank(opp.Id) ? opp.Id : arrMap.get(lcro).Opportunity__c; |
| | | opp.PCLLostBrands__c = String.isNotBlank(opp.PCLLostBrands__c) ? opp.PCLLostBrands__c : ''; |
| | | opp.Agencies__c = String.isNotBlank(opp.Agencies__c) ? opp.Agencies__c : ''; |
| | | System.debug('opp: ' + opp); |
| | | // 20230411 多失单报告合并,取出待合并的询价 end |
| | | // for产品 |
| | | for (PCLLostProduct__c lcr : lcrList) { |
| | | if (opp.Id==lcr.Opportunity__c) { |
| | | |
| | | //20220930 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | if(lcr.ProductClass__c == '主机'){ |
| | | opp.RivalHostsNumber__c += lcr.Quantity__c; |
| | |
| | | opp.of_lost_system_processor__c=lcr.PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c; |
| | | } |
| | | } |
| | | //20230215 lt DB202302247719 start |
| | | //20230215 lt DB202302247719 start |
| | | if(arrMap.get(lcro).TotalAmountLost__c != null){ |
| | | if(opp.LostPrices__c == null){ |
| | | opp.LostPrices__c = 0; |
| | | } |
| | | opp.LostPrices__c+=arrMap.get(lcro).TotalAmountLost__c; |
| | | // System.debug('lt123---opp.LostPrices__c---失单金额2: '+opp.LostPrices__c); |
| | | } |
| | | //20230215 lt DB202302247719 end |
| | | |
| | |
| | | oppList.add(opp); |
| | | } |
| | | update oppList; |
| | | |
| | | } |
| | | // tcm 20211126 更新询价信息 end |
| | | |
| | |
| | | } |
| | | System.debug('oppIds: ' + oppIds); |
| | | if (oppIds.size() > 0) { |
| | | List<Opportunity> opps = [select Id, StageName, Final_Contract_Proceeded_Date__c, Lost_Opportunity_Date__c from Opportunity where Id in :oppIds and StageName in ('敗戦', '削除')]; |
| | | System.debug('opps: ' + opps); |
| | | //DB202303237846 lt 20230316 add , Lost_Cancel_Report__c,Lost_Cancel_Report__r.Report_Status__c,Lost_Cancel_Report__r.LostType__c |
| | | List<Opportunity> opps = [select Id, StageName, Final_Contract_Proceeded_Date__c, Lost_Opportunity_Date__c, Lost_Cancel_Report__c,Lost_Cancel_Report__r.Report_Status__c,Lost_Cancel_Report__r.LostType__c from Opportunity where Id in :oppIds and StageName in ('敗戦', '削除')]; |
| | | System.debug('opps: ' + opps); |
| | | //DB202303237846 lt 20230316 start |
| | | Set<String> oppSet = new Set<String>(); |
| | | List<Lost_Cancel_Report__c> oppreps = [select Id, Report_Status__c, LostType__c, Opportunity__c from Lost_Cancel_Report__c where Opportunity__c in :opps and Report_Status__c='批准' and LostType__c = '失单']; |
| | | if(oppreps.Size() > 0){ |
| | | for(Lost_Cancel_Report__c lcp : oppreps){ |
| | | oppSet.add(lcp.Opportunity__c); |
| | | } |
| | | } |
| | | if (opps.size() > 0) { |
| | | for (Opportunity opp : opps) { |
| | | opp.StageName = '引合'; |
| | | opp.Final_Contract_Proceeded_Date__c = null; |
| | | opp.Lost_Opportunity_Date__c = null; |
| | | if(oppSet.size() > 0 && oppSet.contains(opp.Id)){ |
| | | continue; |
| | | }else{ |
| | | opp.StageName = '引合'; |
| | | opp.Final_Contract_Proceeded_Date__c = null; |
| | | opp.Lost_Opportunity_Date__c = null; |
| | | } |
| | | |
| | | // if(opp.Lost_Cancel_Report__c == null || (opp.Lost_Cancel_Report__c != null && (opp.Lost_Cancel_Report__r.Report_Status__c != '批准' || opp.Lost_Cancel_Report__r.LostType__c != '失单'))){ |
| | | |
| | | // } |
| | | //DB202303237846 lt 20230316 end |
| | | } |
| | | update opps; |
| | | } |
| | |
| | | // NFM103Controller.callout(iflog.Id, rprIds); |
| | | String uid = UserInfo.getUserId(); |
| | | String BUid = System.Label.Batch_User_Id; |
| | | String OLYid = System.Label.OlympusSystem_ID; |
| | | System.debug('zheli'); |
| | | if (uid.substring(0,15) == BUid.substring(0,15)) { |
| | | NFM103Controller.calloutNotfuture(iflog.Id, rprIds, null); |
| | | if (uid.substring(0,15) == BUid.substring(0,15) || uid.substring(0,15) == OLYid.substring(0,15)) { |
| | | NFM103Controller.calloutNotfuture(iflog.Id, rprIds); |
| | | }else{ |
| | | NFM103Controller.callout(iflog.Id, rprIds, null); |
| | | NFM103Controller.callout(iflog.Id, rprIds); |
| | | } |
| | | // 20220902 ljh XLIU-CHSD8G update end |
| | | } |
| | |
| | | * @param repairIds 送信対象修理 |
| | | */ |
| | | @future (callout = true) |
| | | public static void callout(String iflog_Id, List<Id> repairIds, String flag) { |
| | | calloutNotfuture(iflog_Id, repairIds, flag); |
| | | public static void callout(String iflog_Id, List<Id> repairIds) { |
| | | calloutNotfuture(iflog_Id, repairIds); |
| | | } |
| | | //20220902 ljh 新增(复制)方法 XLIU-CHSD8G |
| | | public static void calloutNotfuture(String iflog_Id, List<Id> repairIds,String flag) { |
| | | public static void calloutNotfuture(String iflog_Id, List<Id> repairIds) { |
| | | |
| | | if (repairIds == null || repairIds.size() == 0) { |
| | | return; |
| | |
| | | rprId = rpr.Id; //2022-07-14 zyh add |
| | | |
| | | //再注册分析 需求 新增字段 20220811 sx start |
| | | element.Reanalysis = flag; |
| | | |
| | | if(flag != null){ |
| | | element.UpdateStatus = 'X'; |
| | | } |
| | | element.Reanalysis = null; |
| | | //再注册分析 需求 新增字段 20220811 sx end |
| | | } |
| | | |
| | |
| | | // エラーが発生した場合 |
| | | System.debug(Logginglevel.ERROR, 'NFM103_' + iflog.Name + ':' + ex.getMessage()); |
| | | System.debug(Logginglevel.ERROR, 'NFM103_' + iflog.Name + ':' + ex.getStackTraceString()); |
| | | logstr += ex.getMessage(); |
| | | iflog.ErrorLog__c += ex.getMessage() + '\n'; |
| | | iflog.ErrorLog__c += ex.getStackTraceString() + '\n'; |
| | | //NFM105触发103接口 20230303 LY start |
| | | // Callout from triggers are currently not supported. |
| | | System.debug('NFM201jiekou'+ex.getMessage()); |
| | | if (!String.valueOf(ex.getMessage()).contains('Callout from triggers')) { |
| | | |
| | | logstr += ex.getMessage(); |
| | | iflog.ErrorLog__c += ex.getMessage() + '\n'; |
| | | iflog.ErrorLog__c += ex.getStackTraceString() + '\n'; |
| | | } |
| | | System.debug('标记0--------------------1:' + rowData.retry_cnt__c); |
| | | |
| | | //NFM105触发103接口 20230303 LY end |
| | | //---Gaozw---add |
| | | if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0; |
| | | if (rowData.retry_cnt__c < batch_retry_max_cnt) { |
| | |
| | | else if (di.DiscountType == '运输索赔') { |
| | | rq.Delivery_compensation__c = String.isBlank(di.DiscountAmount) ? null : Decimal.valueOf(di.DiscountAmount); |
| | | } |
| | | //DB202303075842 LY 2023/3/6 add |
| | | else if (di.DiscountType == '上限合同'){ |
| | | rq.LimitPrice_contract_discount_amount__c = String.isBlank(di.DiscountAmount) ? null : Decimal.valueOf(di.DiscountAmount); |
| | | } |
| | | // |
| | | else if (di.DiscountType == '其他') { |
| | | rq.Other_discount__c = String.isBlank(di.DiscountAmount) ? null : Decimal.valueOf(di.DiscountAmount); |
| | |
| | | |
| | | BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM105', ges.RepairStatusUpdate.GeneralData); |
| | | if (String.isBlank(rowData.Log__c) == false) { |
| | | executefuture(rowData.Id); |
| | | //上限合同 LY 20230209 start |
| | | //executefuture(rowData.Id); |
| | | main(rowData.Id); |
| | | //上限合同 LY 20230209 end |
| | | } |
| | | |
| | | // JSONを戻す |
| | |
| | | for (Repair__c rc : rprList) { |
| | | if (rc.Limit_Price__c) { |
| | | //B95-报价同意确认、B99-报价同意确认取消、A95-取消修理受理、A96-取消修理、A99-修理单关闭 更新合同期间修理金额 |
| | | if (rc.RepairOrderStatusCode__c =='B95' || rc.RepairOrderStatusCode__c =='B99' || rc.RepairOrderStatusCode__c =='A99' || rc.RepairOrderStatusCode__c =='A95' || rc.RepairOrderStatusCode__c =='A96'){ |
| | | //if (rc.RepairOrderStatusCode__c =='B95' || rc.RepairOrderStatusCode__c =='B99' || rc.RepairOrderStatusCode__c =='A99' || rc.RepairOrderStatusCode__c =='A95' || rc.RepairOrderStatusCode__c =='A96'){ |
| | | if (rc.Agreed_Date__c != null){ |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (!updateMC.contains(rc.Maintenance_Contract__c)) { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | |
| | | List<Opportunity> oppList = [Select Id, Purchase_Type__c, Opportunity_No__c, Strategic_department_Class_Name__c, |
| | | Sales_Root__c, SAP_Province__c, Trade__c, Agency1__c, Agency1__r.Name, |
| | | Agency1__r.OCM_man_province_txt__c, Opportunity_Category__c |
| | | // ,SAP_Province__c //20230323 lt DB202303088261 两票制 add |
| | | From Opportunity Where Opportunity_No__c IN :inquiryNoList]; |
| | | // update by gzw 2020-04-27 start |
| | | Map<String, Opportunity> oppMap = new Map<String, Opportunity>(); |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | netProviston : netProviston * Decimal.valueOf(Label.Account_Exc); |
| | | } |
| | | // 20210108 gzw add 虚拟合同号追加 end |
| | | |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | // if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | // delAst.OSHFLG__c = true ; |
| | | // } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | |
| | | // CHAN-BGYE7C end |
| | | // CHAN-BJX9EQ Start |
| | | delAst.NMPA_Approbation_No__c = dnInfo.NMPA_NO; |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | // update by vivek srart 2020-02-13 |
| | | // orderdetInfo.Account_province_txt__c = accsMap.get(infoH.EndUserNo).OCM_man_province_txt__c; |
| | | // update by vivek end 2020-02-13 |
| | | orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | orderdetInfo.Sterilization_limit__c = null; |
| | | }else{ |
| | | orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // orderdetInfo.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | //orderdetInfo.Bar_Code__c = dnInfo.Barcode; |
| | | orderdetInfo.DeliveryNote__c = infoH.DeliveryNote; |
| | | // update by Gaozw start 20200514 |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | |
| | | rac.Asset_Model_No__c = prdSearch.Asset_Model_No__c; |
| | | rac.Consumable_order_minor__c = order.Id; |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = accsMap.get(infoH.EndUserNo).Id; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | | } else { |
| | |
| | | } |
| | | rac.Asset_Model_No__c = prdSearch.Asset_Model_No__c; |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = accsMap.get(infoH.EndUserNo).Id; |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | ) { |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | /* 原代码 |
| | | iflog.ErrorLog__c += 'Warning! Asset' + '[' + dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '] Exist. This asset is skipped.\n'; |
| | |
| | | rac.Deliver_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c); |
| | |
| | | } |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | //astUpdateMap.put(ast.Product_Serial_No__c, ast); |
| | | logstr += dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')' + ' '; |
| | |
| | | ) { |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | |
| | | //原代码: |
| | |
| | | // rac.Arrive_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | // rac.Used_date__c = NFMUtil.parseStr2Date(infoH.DeliveryDate); |
| | | // 自动修改最终用户 update by vivek end |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 start |
| | | if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8 |
| | | && Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) { |
| | | rac.Sterilization_limit__c = null; |
| | | }else{ |
| | | rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | } |
| | | // rac.Sterilization_limit__c = NFMUtil.parseStr2Date(dnInfo.ValidTo); |
| | | // gzw DB202301244151 保修期限验证日期可行性调整 end |
| | | rac.Consumable_product__c = prdSearch.Id; |
| | | rac.Bar_Code__c = dnInfo.Barcode; |
| | | rac.Used_account__c = oppMap.get(InquiryNoStr).Agency1__c; |
| | |
| | | |
| | | if (astsMap.get(ast.Product_Serial_No__c ) == null) { |
| | | ast = new Asset(); |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | logstr += dnInfo.SorLMark == 'S' ? dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo : dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')'; |
| | | } else { |
| | |
| | | iflog.ErrorLog__c += 'Warning! Asset' + '[' + errMes + '] Exist. This asset is skipped.\n'; |
| | | continue; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 Start |
| | | if(oppMap.get(InquiryNoStr).SAP_Province__c == 'OSH-安徽省'){ |
| | | ast.OSHFLG__c = true ; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 End |
| | | astList.add(ast); |
| | | // CHAN-BUY3GV end |
| | | // 原代码 |
| | |
| | | quotation.SFDC_DataID = opp.ID; |
| | | quotation.TransType = transTypeMap.get(opp.id); // 询价区分 |
| | | quotation.InquiryCode = opp.Opportunity_No__c; // 询价编码 |
| | | quotation.Quote_Code = opp.Estimation_No__c; // 报价编码 |
| | | quotation.SalesPoint = opp.SAP_Province__c; // SAP上传省 |
| | | quotation.Quote_Code = opp.Estimation_No__c; // 报价编码 |
| | | //20230322 lt DB202303088261 两票制 SAP上传省增加 OSH-安徽省,但传给SPO “安徽省” start |
| | | if(opp.SAP_Province__c == 'OSH-安徽省'){ |
| | | quotation.SalesPoint = '安徽省'; |
| | | }else{ |
| | | quotation.SalesPoint = opp.SAP_Province__c; // SAP上传省 |
| | | } |
| | | // quotation.SalesPoint = opp.SAP_Province__c; // SAP上传省 |
| | | //20230322 lt DB202303088261 两票制 SAP上传省增加 OSH-安徽省,但传给SPO “安徽省” end |
| | | quotation.Province = opp.State__c; // 省份 |
| | | quotation.City = opp.City__c; // 市/地区 |
| | | quotation.HPCode = opp.HP_Management_Code__c; // 医院代码 |
| | |
| | | public String TermSix_Eight {get; private set;} |
| | | public String TermSix_Nine {get; private set;} |
| | | public String TermSix_Ten {get; private set;} |
| | | // 服务合同文本改造20230411 start |
| | | public String TermSix_Eleven {get; private set;} |
| | | // 服务合同文本改造20230411 end |
| | | // public String TermSeven_Title {get; private set;} |
| | | // public String TermSeven_One {get; private set;} |
| | | // public String TermSeven_Two {get; private set;} |
| | |
| | | this.TermSix_Eight = '8、 甲方应积极配合乙方履行合同义务,及时提供各种材料,对于乙方提供的服务方案等,甲方有义务及时确认或反馈意见。'; |
| | | this.TermSix_Nine = '9、 甲方未经乙方事先书面同意,不得将本合同当事人的地位以及依本合同产生的任何权利义务转让给第三人或提供担保。'; |
| | | this.TermSix_Ten = '10、 甲方应保守乙方的商业机密,不得向任何第三方泄露任何或全部包括乙方的销售、市场、技术、维修以及任何其它被告知或从另一方取得乙方的信息;无论此信息在本合同中是否标明或界定为机密。同时不得将该信息用于非本合同所述的目的。本条规定的保密期限在本合同期满或终止后继续有效。'; |
| | | // 服务合同文本改造20230411 start |
| | | this.TermSix_Eleven = '11、 甲方了解并同意,在履行本合同过程中由乙方所替换下的旧零部件不予返还。甲方要求返还的,应当于本合同签署后7日内书面告知乙方,且允许乙方返还时对旧零部件功能进行一定的破坏。'; |
| | | // 服务合同文本改造20230411 end |
| | | |
| | | // this.TermSeven_Title = '七、 甲乙双方同意本合同进行续签时,继续参加合同的参保设备的续签金额由该设备在本合同中的参保价格与本合同的合同消费率计算,公式:续签金额=本合同参保价格*(1+调整比例%)。 '; |
| | | // this.TermSeven_One = '(注:合同消费率=本合同委托期限内所有参保设备发生的维修报价金额之和/合同金额*100%。委托期限届满前由乙方负责对合同消费率进行预估,双方认可后可以按此作为制定续签金额的依据。)”'; |
| | |
| | | public String TermSix_Eight {get; private set;} |
| | | public String TermSix_Nine {get; private set;} |
| | | public String TermSix_Ten {get; private set;} |
| | | // 服务合同文本更新 20230411 start |
| | | public String TermSix_Eleven {get; private set;} |
| | | // 服务合同文本更新 20230411 end |
| | | public String TermSeven_Title {get; private set;} |
| | | public String TermSeven_One {get; private set;} |
| | | public String TermSeven_Two {get; private set;} |
| | |
| | | this.TermSix_Eight = '8、 甲方应积极配合乙方履行合同义务,及时提供各种材料,对于乙方提供的服务方案等,甲方有义务及时确认或反馈意见。'; |
| | | this.TermSix_Nine = '9、 甲方未经乙方事先书面同意,不得将本合同当事人的地位以及依本合同产生的任何权利义务转让给第三人或提供担保。'; |
| | | this.TermSix_Ten = '10、 甲方应保守乙方的商业机密,不得向任何第三方泄露任何或全部包括乙方的销售、市场、技术、维修以及任何其它被告知或从另一方取得乙方的信息;无论此信息在本合同中是否标明或界定为机密。同时不得将该信息用于非本合同所述的目的。本条规定的保密期限在本合同期满或终止后继续有效。'; |
| | | //服务合同文本更新 20230411 start |
| | | this.TermSix_Eleven = '11、 甲方确保丙方了解并同意,在履行本合同过程中由乙方所替换下的旧零部件不予返还。若丙方要求返还的,甲方应当于本合同签署后7日内书面告知乙方,且确保丙方允许乙方返还时对旧零部件功能进行一定的破坏。'; |
| | | //服务合同文本更新 20230411 end |
| | | |
| | | this.TermSeven_Title = '七、 甲乙双方同意本合同进行续签时,继续参加合同的参保设备的续签金额由该设备在本合同中的参保价格与本合同的合同消费率计算,公式:续签金额=本合同参保价格*(1+调整比例%)。 '; |
| | | this.TermSeven_One = '(注:合同消费率=本合同委托期限内所有参保设备发生的维修报价金额之和/合同金额*100%。委托期限届满前由乙方负责对合同消费率进行预估,双方认可后可以按此作为制定续签金额的依据。)”'; |
| | |
| | | public String Total_Contract_Amount_In_Words {get; private set;} |
| | | |
| | | public integer Total_Payment_Time {get; private set;} |
| | | public Decimal Limit_Price_Amount {get; private set;} |
| | | public String Limit_Price_Amount {get; private set;} |
| | | public String Limit_Price_Amount_in_Word {get; private set;} |
| | | public String TermZero_One {get; private set;} |
| | | public String TermZero_Two {get; private set;} |
| | |
| | | this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | } |
| | | if(MC.Limit_Price_Amount__c != null){ |
| | | this.Limit_Price_Amount = MC.Limit_Price_Amount__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | } |
| | | // if(MC.Limit_Price_Amount__c != null){ |
| | | // this.Limit_Price_Amount = MC.Limit_Price_Amount__c; |
| | | // // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | // } |
| | | if(MC.Limit_Price_Amount_in_Word__c != null){ |
| | | this.Limit_Price_Amount_in_Word = MC.Limit_Price_Amount_in_Word__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | |
| | | if(MC.Contract_Amount__c != null ){ |
| | | this.Contract_Amount = String.format(MC.Contract_Amount__c.format(), args); |
| | | } |
| | | if(MC.Limit_Price_Amount__c != null ){ |
| | | this.Limit_Price_Amount = String.format(MC.Limit_Price_Amount__c.format(), args); |
| | | } |
| | | |
| | | |
| | | this.FirstPartyAbbreviation = '(以下简称“甲方”)'; |
| | |
| | | public String TermSix_Six {get; private set;} |
| | | public String TermSix_Seven {get; private set;} |
| | | public String TermSix_Eight {get; private set;} |
| | | // 服务合同文本改造20230411 start |
| | | public String TermSix_Nine {get; private set;} |
| | | // 服务合同文本改造20230411 end |
| | | // public String TermSeven_Title {get; private set;} |
| | | // public String TermSeven_One {get; private set;} |
| | | // public String TermSeven_Two {get; private set;} |
| | |
| | | this.TermSix_Six = '6、甲方应该主动积极配合乙方管理设备,降低因为人为原因造成的损坏。'; |
| | | this.TermSix_Seven = '7、甲方未经乙方事先书面同意,不得将本合同当事人的地位以及依本合同产生的任何权利义务转让给第三人或提供担保。'; |
| | | this.TermSix_Eight = '8、甲方应保守乙方的商业机密,不得向任何第三方泄露任何或全部包括乙方的销售、市场、技术、维修以及任何其它被告知或从另一方取得乙方的信息;无论此信息在本合同中是否标明或界定为机密。同时不得将该信息用于非本合同所述的目的。本条规定的保密期限在本合同期满或终止后继续有效。'; |
| | | |
| | | // 服务合同文本改造20230411 start |
| | | this.TermSix_Nine = '9、甲方了解并同意,在履行本合同过程中由乙方所替换下的旧零部件不予返还。甲方要求返还的,应当于本合同签署后7日内书面告知乙方,且允许乙方返还时对旧零部件功能进行一定的破坏。'; |
| | | // 服务合同文本改造20230411 end |
| | | // this.TermSeven_Title = '八、 甲乙双方同意本合同进行续签时,继续参加合同的参保设备的续签金额由该设备在本合同中的参保价格与本合同的合同消费率计算,公式:续签金额=本合同参保价格*(1+调整比例%)。 '; |
| | | // this.TermSeven_One = '(注:合同消费率=本合同委托期限内所有参保设备发生的维修报价金额之和/合同金额*100%。委托期限届满前由乙方负责对合同消费率进行预估,双方认可后可以按此作为制定续签金额的依据。)”'; |
| | | // this.TermSeven_Table11 = 'X<50%'; |
| | |
| | | public String TermSix_Six {get; private set;} |
| | | public String TermSix_Seven {get; private set;} |
| | | public String TermSix_Eight {get; private set;} |
| | | public String TermSix_Nine {get; private set;} |
| | | public String TermSeven_Title {get; private set;} |
| | | public String TermSeven_One {get; private set;} |
| | | public String TermSeven_Two {get; private set;} |
| | |
| | | this.TermSix_Six = '6、 甲方应该主动积极配合乙方管理设备,降低因为人为原因造成的损坏。'; |
| | | this.TermSix_Seven = '7、 甲方未经乙方事先书面同意,不得将本合同当事人的地位以及依本合同产生的任何权利义务转让给第三人或提供担保。'; |
| | | this.TermSix_Eight = '8、 甲方应保守乙方的商业机密,不得向任何第三方泄露任何或全部包括乙方的销售、市场、技术、维修以及任何其它被告知或从另一方取得乙方的信息;无论此信息在本合同中是否标明或界定为机密。同时不得将该信息用于非本合同所述的目的。本条规定的保密期限在本合同期满或终止后继续有效。'; |
| | | |
| | | // 服务合同文本更新 20230411 start |
| | | this.TermSix_Nine = '9、 甲方了解并同意,在履行本合同过程中由乙方所替换下的旧零部件不予返还。甲方要求返还的,应当于本合同签署后7日内书面告知乙方,且允许乙方返还时对旧零部件功能进行一定的破坏'; |
| | | // 服务合同文本更新 20230411 end |
| | | this.TermSeven_Title = '七、 甲乙双方同意本合同进行续签时,继续参加合同的参保设备的续签金额由该设备在本合同中的参保价格与本合同的合同消费率计算,公式:续签金额=本合同参保价格*(1+调整比例%)。 '; |
| | | this.TermSeven_One = '(注:合同消费率=本合同委托期限内所有参保设备发生的维修报价金额之和/合同金额*100%。委托期限届满前由乙方负责对合同消费率进行预估,双方认可后可以按此作为制定续签金额的依据。)”'; |
| | | this.TermSeven_Table11 = 'X<50%'; |
| | |
| | | public String Payment_Plan_Sum_Fifth_in_Word {get; private set;} |
| | | public String Payment_Plan_Sum_Sixth_in_Word {get; private set;} |
| | | public String Total_Contract_Amount_In_Words {get; private set;} |
| | | public Decimal Limit_Price_Amount {get; private set;} |
| | | public String Limit_Price_Amount {get; private set;} |
| | | public String Limit_Price_Amount_in_Word {get; private set;} |
| | | |
| | | |
| | |
| | | this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | } |
| | | if(MC.Limit_Price_Amount__c != null){ |
| | | this.Limit_Price_Amount = MC.Limit_Price_Amount__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | } |
| | | // if(MC.Limit_Price_Amount__c != null){ |
| | | // this.Limit_Price_Amount = MC.Limit_Price_Amount__c; |
| | | // // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | | // } |
| | | if(MC.Limit_Price_Amount_in_Word__c != null){ |
| | | this.Limit_Price_Amount_in_Word = MC.Limit_Price_Amount_in_Word__c; |
| | | // this.Total_Contract_Amount_In_Words = MC.Total_Contract_Amount_In_Words__c.substring(0,MC.Total_Contract_Amount_In_Words__c.length()-2); |
| | |
| | | if(MC.Contract_Amount__c != null ){ |
| | | this.Contract_Amount = String.format(MC.Contract_Amount__c.format(), args); |
| | | } |
| | | if(MC.Limit_Price_Amount__c != null ){ |
| | | this.Limit_Price_Amount = String.format(MC.Limit_Price_Amount__c.format(), args); |
| | | } |
| | | this.Amount_Warranty_Coverage = MC.Amount_Warranty_Coverage__c; |
| | | this.Amount_Warranty_Coverage_In_Word = MC.Amount_Warranty_Coverage_In_Word__c; |
| | | this.TermZero_One = '甲、乙双方经过共同协商,就甲方共'; |
| | |
| | | } |
| | | |
| | | protected override void afterUpdate() { |
| | | UpsertUser(); |
| | | //20230317 you 增加hr信息同步user 开关 |
| | | if (System.label.HrODSTOUser.equals('true')) { |
| | | UpsertUser(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | ,Dealer_Final_Price__c |
| | | ,HospitalTransactionAmount__c |
| | | //20230222 DB202302339407 you end |
| | | //20230327 DB202303372329 you start |
| | | ,OP_ThousandY_Order__c |
| | | ,OrderThisYearQY__c |
| | | ,Opportunity__c |
| | | //20230327 DB202303372329 you end |
| | | from Account2__c |
| | | where Account_Org__c = :dcList]; |
| | | |
| | |
| | | accTar.Opportunity_ThousandY__c = acc2.Opportunity_ThousandY__c; |
| | | accTar.Amount_Without_Tax_Thousand__c = acc2.Amount_Without_Tax_Thousand__c; |
| | | |
| | | //20230327 DB202303372329 you start |
| | | accTar.OP_ThousandY_Order__c = acc2.OP_ThousandY_Order__c; |
| | | accTar.OrderThisYearQY__c = acc2.OrderThisYearQY__c; |
| | | accTar.Opportunity__c = acc2.Opportunity__c; |
| | | //20230327 DB202303372329 you end |
| | | |
| | | //20220111 SWAG-C8MBB6 加7.询价 lt start |
| | | accTar.AllOP_ThousandY__c = acc2.AllOP_ThousandY__c; |
| | | //20220111 SWAG-C8MBB6 加7.询价 lt end |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //DB202304056706 you 20230406 清空 打标识,重新执行batch |
| | | if(String.isBlank(op.ConfirmationofAward__c) && op.ConfirmationofAward__c!=oldopp.ConfirmationofAward__c){ |
| | | for (Tender_Opportunity_Link__c link : links) { |
| | | if (link.Opportunity__c == op.Id) { |
| | | Tender_information__c temptender = new Tender_information__c(); |
| | | temptender.Id = link.Tender_information__c; |
| | | temptender.IsReactionOpp__c = true; |
| | | tenderMap.put(temptender.id ,temptender); |
| | | } |
| | | } |
| | | } |
| | | //20221017 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | System.debug('lt123 oly主机'+op.OlyNumberHosts__c); |
| | | System.debug('lt123 老oly主机'+oldopp.OlyNumberHosts__c); |
| | | System.debug('lt123 对手主机'+op.RivalHostsNumber__c); |
| | | System.debug('lt123 老对手主机'+oldopp.RivalHostsNumber__c); |
| | | // System.debug('lt123 oly主机'+op.OlyNumberHosts__c); |
| | | // System.debug('lt123 老oly主机'+oldopp.OlyNumberHosts__c); |
| | | // System.debug('lt123 对手主机'+op.RivalHostsNumber__c); |
| | | // System.debug('lt123 老对手主机'+oldopp.RivalHostsNumber__c); |
| | | |
| | | if(op.OlyNumberHosts__c != oldopp.OlyNumberHosts__c || op.RivalHostsNumber__c != oldopp.RivalHostsNumber__c){ |
| | | for (Tender_Opportunity_Link__c link : links){ |
| | |
| | | public integer secondNum {get; set;} |
| | | // add tcm 20211122 end |
| | | |
| | | public Decimal InclusionUltrasound {get; set;} //20230506 lt DB202304618804 包含超声 add |
| | | |
| | | |
| | | // 竞争对手对照关系表,key是品牌名字,value是ID |
| | | public map<string,id> CompetitionMap; |
| | |
| | | Lost_Reason_Sub__c,Lost_By_Company__c, |
| | | LostTotalAmount__c,LostType__c, |
| | | TotalAmountLost__c, //20230215 lt DB202302247719 |
| | | InclusionUltrasound__c, //20230506 lt DB202304618804 包含超声 |
| | | Report_Status__c,Sales_assistant__c, |
| | | Opportunity__c, Opportunity__r.Sales_assistant_ID__c, |
| | | Opportunity__r.Sales_manager_departmentID__c, |
| | |
| | | pageStatus = null; |
| | | return; |
| | | } |
| | | |
| | | InclusionUltrasound = lostReportList[0].InclusionUltrasound__c; //20230506 lt DB202304618804 包含超声 |
| | | |
| | | lostReportList[0].Sales_assistant__c = |
| | | lostReportList[0].Opportunity__r.Sales_assistant_ID__c; |
| | | lostReportList[0].Manager_sales__c = |
| | |
| | | system.debug('check products:'+ (templostBrand.PCLLostBrandProduct__r != null) + '|' + (templostBrand.PCLLostBrandProduct__r.size() > 0)); |
| | | if (templostBrand.PCLLostBrandProduct__r != null && templostBrand.PCLLostBrandProduct__r.size() > 0) { |
| | | for( PCLLostProduct__c tempProduct: templostBrand.PCLLostBrandProduct__r) { |
| | | |
| | | tempProductList.add(new PCLLostProducts(productCount,tempProduct)); |
| | | productCount++; |
| | | } |
| | |
| | | } |
| | | // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 end |
| | | // update tcm 20211123 end |
| | | // 20230418 ljh DB202304320022 start |
| | | String LostBrandNameS = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c; |
| | | String LostBrandName = temlostProduct.LostProductss.LostBrandName__c; |
| | | if(LostBrandNameS != LostBrandName){ |
| | | temlostProduct.LostProductss.LostBrandName__c.addError('失单品牌名不一致,请确认'); |
| | | dataCheck = false; |
| | | } |
| | | // 20230418 ljh DB202304320022 end |
| | | |
| | | } |
| | | // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 start |
| | | if (productCount == 0 && tempLostBrand.LostProducts != null && tempLostBrand.LostProducts.size() > 0) { |
| | |
| | | //20230215 lt DB202302247719 start |
| | | Decimal med = tempLostBrand.lostBrand.LostPrice__c/1.13/1000; |
| | | Decimal med1 = med.setScale(2); |
| | | System.debug('---lt123不含税数值(人工)Decimal---'+med); |
| | | System.debug('---lt123不含税数值(人工)Decimal两位小数---'+med1); |
| | | // System.debug('---lt123不含税数值(人工)Decimal---'+med); |
| | | // System.debug('---lt123不含税数值(人工)Decimal两位小数---'+med1); |
| | | LostReport.lostReport.TotalAmountLost__c += med1; |
| | | //LostReport.lostReport.TotalAmountLost__c += tempLostBrand.lostBrand.LostPrices_ThousandY__c; //20230215 lt DB202302247719 |
| | | // LostReport.lostReport.TotalAmountLost__c += tempLostBrand.lostBrand.LostPrice__c/1.13/1000; //20230215 lt DB202302247719 |
| | |
| | | system.debug('brandNo:'+brandNo); |
| | | LostBrand tempLostBrand = LostReport.LostBrands.get(brandNo); |
| | | // PCLLostProduct__c plp = new PCLLostProduct__c(Competitor__c=CompetitionMap.get(LostReport.LostBrands[brandNo].lostBrand.Lost_By_Company__c)); |
| | | string brandName = tempLostBrand.lostBrand.Lost_By_Company__c; |
| | | // 20230418 ljh DB202304320022 start |
| | | // string brandName = tempLostBrand.lostBrand.Lost_By_Company__c; |
| | | string brandName = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c; |
| | | // 20230418 ljh DB202304320022 end |
| | | PCLLostProduct__c plp = new PCLLostProduct__c(); |
| | | plp.LostBrandName__c = brandName; |
| | | tempLostBrand.LostProducts.add(new PCLLostProducts(tempLostBrand.LostProducts.size(),plp)); |
| | |
| | | Order_ForHospital__c,Deliver_date__c,Order_Reason__c, |
| | | Order_date__c,Total_amount__c,Order_ProType__c, |
| | | Offers_Price__c,Order_effective_contact__r.Business_Assistant__r.Province_Text__c |
| | | ,Order_effective_contact__r.OSH_Dealer__c //20230323 lt DB202303088261 两票制 add |
| | | From Consumable_order__c |
| | | Where Id =:ESetId]; |
| | | if (qs.size()>0){ |
| | |
| | | '河南省' => '奥林巴斯(北京)销售服务有限公司', |
| | | '浙江省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '安徽省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | 'OSH-安徽省' => '奥林巴斯贸易(上海)有限公司', //20230323 lt DB202303088261 两票制 add |
| | | '江西省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '福建省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '江苏省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | |
| | | //CHAN-B42D6F 安徽ET特约经销商来的询价 SAP上传省 紧急对应为北京 以后会修改 TODO |
| | | //CHAN-BTF64C 安徽ENG经销商的询价默认SAP上传省修改 update by rentongxiao 2020-09-14 start |
| | | // String province = coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c == '安徽省' ? '北京市' : coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c; |
| | | String province = coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c == '安徽省' && coc.Order_ProType__c == 'ET' ? '北京市' : coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c; |
| | | //20230323 lt DB202303088261 两票制 start |
| | | String province = ''; |
| | | if(coc.Order_effective_contact__r.OSH_Dealer__c == TRUE){ |
| | | province = 'OSH-安徽省'; |
| | | }else if(coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c == '安徽省' && coc.Order_ProType__c == 'ET'){ |
| | | province = '北京市'; |
| | | }else{ |
| | | province = coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c; |
| | | } |
| | | // String province = coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c == '安徽省' && coc.Order_ProType__c == 'ET' ? '北京市' : coc.Order_effective_contact__r.Business_Assistant__r.Province_Text__c; |
| | | //20230323 lt DB202303088261 两票制 end |
| | | //CHAN-BTF64C 安徽ENG经销商的询价默认SAP上传省修改 update by rentongxiao 2020-09-14 end |
| | | |
| | | |
| | |
| | | //SFDC停止预警 lt 20210922 add start |
| | | protected override void afterUpdate(){ |
| | | Calculate_AverageMonthSales(this.newList, this.oldMap); |
| | | AssignmentUltrasonic(this.newList, this.oldMap); //20230506 lt DB202304618804 包含超声 add |
| | | } |
| | | //SFDC停止预警 lt 20210922 add end |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //20230506 lt DB202304618804 包含超声 start |
| | | private static void AssignmentUltrasonic(List<Product2> newList,Map<Id, Product2> oldMap){ |
| | | List<String> proIdList = new List<String>(); |
| | | List<PCLLostProduct__c> updateplpList = new List<PCLLostProduct__c>(); |
| | | |
| | | for(Product2 pro : newList){ |
| | | if(pro.RecordTypeId == System.Label.Pro_RecordType && |
| | | (pro.Lost_Product_Differ__c != oldMap.get(pro.Id).Lost_Product_Differ__c || |
| | | pro.Lost_Product_Category__c != oldMap.get(pro.Id).Lost_Product_Category__c)){ |
| | | proIdList.add(pro.Id); |
| | | } |
| | | } |
| | | |
| | | List<PCLLostProduct__c> plpList = [Select Id, LostProduct__c, ProductClass__c, ProductCategory__c |
| | | From PCLLostProduct__c |
| | | Where LostProduct__c in: proIdList ]; |
| | | if(plpList.size() > 0 ){ |
| | | for(PCLLostProduct__c plp : plpList){ |
| | | plp.ProductClass__c = '主机'; |
| | | plp.ProductCategory__c = '超声主机'; |
| | | updateplpList.add(plp); |
| | | } |
| | | } |
| | | |
| | | update updateplpList; |
| | | |
| | | } |
| | | //20230506 lt DB202304618804 包含超声 end |
| | | |
| | | } |
| | |
| | | '河南省' => '奥林巴斯(北京)销售服务有限公司', |
| | | '浙江省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '安徽省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | 'OSH-安徽省' => '奥林巴斯贸易(上海)有限公司', //20230323 lt DB202303088261 两票制 add |
| | | '江西省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '福建省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | | '江苏省' => '奥林巴斯(北京)销售服务有限公司上海分公司', |
| | |
| | | public String address {get; set;} |
| | | public String postCode {get;set;} |
| | | public String addressName {get;set;} |
| | | |
| | | public String addressName1 {get;set;}//20230323 lt DB202303088261 两票制 start 报价单用 |
| | | |
| | | public String salesRoot {get;set;} |
| | | public Decimal newTotalPrice {get;set;} |
| | | //WLIG-BYRD37 【委托】询价 打印配置单 字段修改 精琢技术 wql 2021/03/08 start |
| | |
| | | //获取办事处地址 |
| | | private void getShipmentaddress(){ |
| | | String province = this.targetObj.Opportunity.SAP_Province__c; |
| | | |
| | | //20230323 lt DB202303088261 两票制 start |
| | | String province1 = this.targetObj.Opportunity.SAP_Province__c; |
| | | if(province == 'OSH-安徽省'){ |
| | | province = '安徽省'; |
| | | } |
| | | //20230323 lt DB202303088261 两票制 end |
| | | |
| | | List<Shipment_address__c> shipmentAddresses = [SELECT id, Address__c, Post_Code__c FROM Shipment_address__c WHERE Name=:province]; |
| | | // 見積を取得できない場合 |
| | | if ( shipmentAddresses.size() != 1) { |
| | |
| | | } |
| | | this.shipmentAddress = shipmentAddresses[0]; |
| | | |
| | | //20230323 lt DB202303088261 两票制 start |
| | | if(province1 == 'OSH-安徽省'){ |
| | | this.params.addressName1 = ' '; |
| | | if(addressNameApiMap.get(province1) != null){ |
| | | this.params.addressName = addressNameApiMap.get(province1); |
| | | }else{ |
| | | this.params.addressName = ' '; |
| | | } |
| | | }else |
| | | //20230323 lt DB202303088261 两票制 end |
| | | if(addressNameApiMap.get(province) != null){ |
| | | this.params.addressName = addressNameApiMap.get(province); |
| | | this.params.addressName1 = addressNameApiMap.get(province); //20230323 lt DB202303088261 两票制 add |
| | | }else{ |
| | | this.params.addressName = ' '; |
| | | this.params.addressName1 = ' '; //20230323 lt DB202303088261 两票制 add |
| | | } |
| | | |
| | | this.params.address = this.shipmentAddress.Address__c; |
| | |
| | | List<String> HospitalId = new List<String>(); |
| | | List<String> provinceList = new List<String>();//省 |
| | | List<String> cityList = new List<String>();//市 |
| | | List<String> inchargeStaff = new List<String>();//市 |
| | | for (Repair__c nObj : newList) { |
| | | //医院的CSM管理省(文本) 值不为空,并且收货地址不为空 |
| | | if(nObj.Hospital__c != null && nObj.address_Contacts__c == null && nObj.address_Telephone__c == null && nObj.address_Contacts_Name__c == null && nObj.address_City__c == null && nObj.Detailed_Address__c == null){ |
| | | HospitalId.add(nObj.Hospital__C); |
| | | } |
| | | inchargeStaff.add(nObj.Incharge_Staff__c); |
| | | } |
| | | // gzw DB202212270703 20230301 备品地址导入改造 start |
| | | Map<String,user> profileAndRoleMap = new Map<String,user>(); |
| | | for(user re :[select id,Profile.name,Branch__c,UserRole.name from user where id in :inchargeStaff]){ |
| | | profileAndRoleMap.put(re.id, re); |
| | | } |
| | | // gzw DB202212270703 20230301 备品地址导入改造 start |
| | | if(HospitalId != null && HospitalId.size() > 0){ |
| | | String HospitalSQl = 'SELECT id,OCM_man_province_txt__c,FieldCity_Master_Name__c from Account where id in :HospitalId'; |
| | | List<Account> accountList = Database.query(HospitalSQl); |
| | |
| | | for(Account ac : accountList){ |
| | | if(nObj.Hospital__c == ac.id){ |
| | | String provinceAndCity = ''; |
| | | if('山东' == ac.OCM_man_province_txt__c){ |
| | | if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | }else{ |
| | | provinceAndCity = matchupMap.get('山东,济南市'); |
| | | } |
| | | //DB202303246427 LY 20230329 start |
| | | // if('山东' == ac.OCM_man_province_txt__c){ |
| | | // if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | // || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | // provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | // }else{ |
| | | // provinceAndCity = matchupMap.get('山东,济南市'); |
| | | // } |
| | | if('青岛' == ac.OCM_man_province_txt__c){ |
| | | provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | }else if ('山东' == ac.OCM_man_province_txt__c) { |
| | | provinceAndCity = matchupMap.get('山东,济南市'); |
| | | //DB202303246427 LY 20230329 end |
| | | }else{ |
| | | provinceAndCity = matchupMap.get(ac.OCM_man_province_txt__c); |
| | | } |
| | |
| | | system.debug('cityList='+cityList); |
| | | system.debug('provinceList='+provinceList); |
| | | if(falg && provinceList != null && cityList != null && provinceList.size() > 0 && cityList.size() > 0){ |
| | | String addressSQl = 'SELECT ID,Customer__c,Customer_Name__c,Contacts__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c' |
| | | //+ ',Contacts__r.LastName_Encrypted__c,ZipCode_Encrypted__c,Detailed_Address_Encrypted__c,Telephone_Encrypted__c' // PI改造 By Bright 20220407 zhj MEBG新方案改造 2022-11-29 |
| | | // gzw DB202212270703 20230301 备品地址导入改造 start |
| | | // String addressSQl = 'SELECT ID,Customer__c,Customer_Name__c,Contacts__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c' |
| | | // //+ ',Contacts__r.LastName_Encrypted__c,ZipCode_Encrypted__c,Detailed_Address_Encrypted__c,Telephone_Encrypted__c' // PI改造 By Bright 20220407 zhj MEBG新方案改造 2022-11-29 |
| | | // + ' from Address__c ' |
| | | // + ' where Address_Classification__c = \'办事处\' and Province_Name__c in :provinceList and City_Name__c in :cityList ' |
| | | // + ' order by Using_Datetime__c desc NULLS LAST '; |
| | | |
| | | |
| | | String addressSQl = 'SELECT ID,Customer__c,Customer_Name__c,Contacts__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c ' |
| | | + ' ,Address_Classification__c,Beipin_Center__c ' |
| | | //+ ',Contacts__r.LastName_Encrypted__c,ZipCode_Encrypted__c,Detailed_Address_Encrypted__c,Telephone_Encrypted__c' // PI改造 By Bright 20220407 zhj MEBG新方案改造 2022-11-29 |
| | | + ' from Address__c ' |
| | | + ' where Address_Classification__c = \'办事处\' and Province_Name__c in :provinceList and City_Name__c in :cityList ' |
| | | + ' where ( Address_Classification__c = \'办事处\' and Province_Name__c in :provinceList and City_Name__c in :cityList )' |
| | | + ' or Address_Classification__c = \'备品\'' |
| | | + ' order by Using_Datetime__c desc NULLS LAST '; |
| | | |
| | | // gzw DB202212270703 20230301 备品地址导入改造 end |
| | | system.debug('addressSQl='+addressSQl); |
| | | List<Address__c> addressList = Database.query(addressSQl); |
| | | |
| | | if(addressList != null && addressList.size() > 0){ |
| | | system.debug(addressList[0]); |
| | | List<Address__c> addressList = new List<Address__c>(); |
| | | Map<String,Address__c> beipinMap = new Map<String,Address__c>(); |
| | | List<Address__c> addressTempList = Database.query(addressSQl); |
| | | for (Address__c ad :addressTempList) { |
| | | if (ad.Address_Classification__c == '备品') { |
| | | beipinMap.put(ad.Beipin_Center__c,ad); |
| | | }else{ |
| | | addressList.add(ad); |
| | | } |
| | | } |
| | | //List<Address__c> addressList = Database.query(addressSQl); |
| | | |
| | | System.debug('进入备品+++++addressTempList ' + addressTempList.size()); |
| | | // if(addressList != null && addressList.size() > 0){ |
| | | if(addressTempList != null && addressTempList.size() > 0){ |
| | | for (Repair__c nObj : newList) { |
| | | if(nObj.Hospital__c != null && nObj.address_Contacts__c == null && nObj.address_Telephone__c == null && nObj.address_Contacts_Name__c == null && nObj.address_City__c == null && nObj.Detailed_Address__c == null){ |
| | | //由于为了减少select ,所以获取我们配置好的map,根据保有设备上医院的 OCSM管理省(文本) 的值,获取对应的地址上的省和市 |
| | | for(Account ac : accountList){ |
| | | if(nObj.Hospital__c == ac.id){ |
| | | String provinceAndCity = ''; |
| | | matchupMap.get(ac.OCM_man_province_txt__c); |
| | | if('山东' == ac.OCM_man_province_txt__c){ |
| | | if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | System.debug('进入备品+++++ '); |
| | | if (nObj.Returns_Product_way__c == '备品中心') { |
| | | user re = profileAndRoleMap.get(nObj.Incharge_Staff__c); |
| | | if (re == null) return; |
| | | String beipCenter = ''; |
| | | if (re.Profile.name.startsWith('2B3')) { |
| | | beipCenter = '北京备品中心'; |
| | | }else if (re.Profile.name.startsWith('2B2')) { |
| | | if (re.Branch__c == '北京') { |
| | | beipCenter = '北京备品中心'; |
| | | }else if (re.Branch__c == '上海') { |
| | | beipCenter = '华东备品中心'; |
| | | }else if (re.Branch__c == '广州') { |
| | | beipCenter = '广州备品中心'; |
| | | } |
| | | }else if (re.UserRole.name == 'CTEC教育本部') { |
| | | if (re.Branch__c == '北京') { |
| | | beipCenter = '北京C-TEC'; |
| | | }else if (re.Branch__c == '上海') { |
| | | beipCenter = '上海C-TEC'; |
| | | }else if (re.Branch__c == '广州') { |
| | | beipCenter = '广州C-TEC'; |
| | | } |
| | | } |
| | | System.debug('进入备品+++++ beipCenter' + beipCenter); |
| | | |
| | | if(String.isNotBlank(beipCenter)){ |
| | | Address__c addressbeip = beipinMap.get(beipCenter); |
| | | System.debug('进入备品+++++ addressbeip' + addressbeip.id); |
| | | //联系人 |
| | | String contactsName = ''; |
| | | String contactsNameEncrypt = ''; |
| | | if(!String.isBlank(addressbeip.Contacts__c)){ |
| | | contactsName = addressbeip.Contacts_Name__c; |
| | | } |
| | | //省+市 |
| | | String address = addressbeip.Detailed_Address__c.trim(); |
| | | String cityName = addressbeip.City_Name__c.trim(); |
| | | String ProvinceCity = addressbeip.Province_Name__c.trim()+cityName; |
| | | //防止详细地址里面带着省份和市 |
| | | if(!address.contains(ProvinceCity)){ |
| | | address = ProvinceCity + address; |
| | | } |
| | | //联系人 |
| | | String ContactPerson = ''; |
| | | if(!String.isBlank(addressbeip.Customer__c)){ |
| | | ContactPerson = addressbeip.Customer_Name__c; |
| | | } |
| | | nObj.address_Contacts__c=contactsName; |
| | | nObj.address_ZipCode__c = addressbeip.ZipCode__c; |
| | | nObj.address_City__c = cityName; |
| | | nObj.address_Contacts_Name__c = ContactPerson; |
| | | nObj.address_Telephone__c=addressbeip.Telephone__c; |
| | | nObj.Detailed_Address__c=address; |
| | | nObj.Encrypt_Update_Flag__c=true; |
| | | system.debug('nObj assign and Encrypt_Update_Flag__c set true'); |
| | | |
| | | } |
| | | }else{ |
| | | if(nObj.Hospital__c != null && nObj.address_Contacts__c == null && nObj.address_Telephone__c == null && nObj.address_Contacts_Name__c == null && nObj.address_City__c == null && nObj.Detailed_Address__c == null){ |
| | | //由于为了减少select ,所以获取我们配置好的map,根据保有设备上医院的 OCSM管理省(文本) 的值,获取对应的地址上的省和市 |
| | | for(Account ac : accountList){ |
| | | if(nObj.Hospital__c == ac.id){ |
| | | String provinceAndCity = ''; |
| | | matchupMap.get(ac.OCM_man_province_txt__c); |
| | | //DB202303246427 LY 20230329 start |
| | | // if('山东' == ac.OCM_man_province_txt__c){ |
| | | // if('烟台市' == ac.FieldCity_Master_Name__c || '威海市' == ac.FieldCity_Master_Name__c || '日照市' == ac.FieldCity_Master_Name__c |
| | | // || '青岛市' == ac.FieldCity_Master_Name__c || '潍坊市' == ac.FieldCity_Master_Name__c){ |
| | | // provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | // }else{ |
| | | // provinceAndCity = matchupMap.get('山东,济南市'); |
| | | // } |
| | | if ('青岛' == ac.OCM_man_province_txt__c) { |
| | | provinceAndCity = matchupMap.get('山东,青岛市'); |
| | | }else{ |
| | | }else if ('山东' == ac.OCM_man_province_txt__c) { |
| | | provinceAndCity = matchupMap.get('山东,济南市'); |
| | | //DB202303246427 LY 20230329 end |
| | | }else{ |
| | | provinceAndCity = matchupMap.get(ac.OCM_man_province_txt__c); |
| | | } |
| | | }else{ |
| | | provinceAndCity = matchupMap.get(ac.OCM_man_province_txt__c); |
| | | } |
| | | system.debug('provinceAndCity='+provinceAndCity); |
| | | if(provinceAndCity != null){//不能为空 |
| | | //地址表上省和市不能为空 |
| | | if(addressList[0].Province_Name__c != null && addressList[0].City_Name__c!= null){ |
| | | //拼接一个字符串方便对比 |
| | | String pAc = addressList[0].Province_Name__c + ',' + addressList[0].City_Name__c; |
| | | if(provinceAndCity.equals(pAc)){ |
| | | //联系人 |
| | | String contactsName = ''; |
| | | String contactsNameEncrypt = '';// 20220407 PI改造 By Bright |
| | | if(!String.isBlank(addressList[0].Contacts__c)){ |
| | | contactsName = addressList[0].Contacts_Name__c; |
| | | //contactsNameEncrypt = addressList[0].Contacts__r.LastName_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | system.debug('provinceAndCity='+provinceAndCity); |
| | | if(provinceAndCity != null){//不能为空 |
| | | //地址表上省和市不能为空 |
| | | if(addressList[0].Province_Name__c != null && addressList[0].City_Name__c!= null){ |
| | | //拼接一个字符串方便对比 |
| | | String pAc = addressList[0].Province_Name__c + ',' + addressList[0].City_Name__c; |
| | | if(provinceAndCity.equals(pAc)){ |
| | | //联系人 |
| | | String contactsName = ''; |
| | | String contactsNameEncrypt = '';// 20220407 PI改造 By Bright |
| | | if(!String.isBlank(addressList[0].Contacts__c)){ |
| | | contactsName = addressList[0].Contacts_Name__c; |
| | | //contactsNameEncrypt = addressList[0].Contacts__r.LastName_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | } |
| | | //省+市 |
| | | String address = addressList[0].Detailed_Address__c.trim(); |
| | | //String addressEncrypt = addressList[0].Detailed_Address_Encrypted__c; zhj MEBG新方案改造 2022-11-29 |
| | | String cityName = addressList[0].City_Name__c.trim(); |
| | | String ProvinceCity = addressList[0].Province_Name__c.trim()+cityName; |
| | | //防止详细地址里面带着省份和市 |
| | | if(!address.contains(ProvinceCity)){ |
| | | address = ProvinceCity + address; |
| | | } |
| | | //联系人 |
| | | String ContactPerson = ''; |
| | | if(!String.isBlank(addressList[0].Customer__c)){ |
| | | ContactPerson = addressList[0].Customer_Name__c; |
| | | } |
| | | nObj.address_Contacts__c=contactsName; |
| | | //nObj.address_Contacts_Encrypt__c=contactsNameEncrypt;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.address_ZipCode__c = addressList[0].ZipCode__c; |
| | | //nObj.address_ZipCode_Encrypt__c = addressList[0].ZipCode_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.address_City__c = cityName; |
| | | nObj.address_Contacts_Name__c = ContactPerson; |
| | | nObj.address_Telephone__c=addressList[0].Telephone__c; |
| | | //nObj.address_Telephone_Encrypt__c=addressList[0].Telephone_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.Detailed_Address__c=address; |
| | | //nObj.Detailed_Address_Encrypt__c=addressEncrypt;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.Encrypt_Update_Flag__c=true;// 20220411 PI改造 By Bright |
| | | system.debug('nObj assign and Encrypt_Update_Flag__c set true'); |
| | | } |
| | | //省+市 |
| | | String address = addressList[0].Detailed_Address__c.trim(); |
| | | //String addressEncrypt = addressList[0].Detailed_Address_Encrypted__c; zhj MEBG新方案改造 2022-11-29 |
| | | String cityName = addressList[0].City_Name__c.trim(); |
| | | String ProvinceCity = addressList[0].Province_Name__c.trim()+cityName; |
| | | //防止详细地址里面带着省份和市 |
| | | if(!address.contains(ProvinceCity)){ |
| | | address = ProvinceCity + address; |
| | | } |
| | | //联系人 |
| | | String ContactPerson = ''; |
| | | if(!String.isBlank(addressList[0].Customer__c)){ |
| | | ContactPerson = addressList[0].Customer_Name__c; |
| | | } |
| | | nObj.address_Contacts__c=contactsName; |
| | | //nObj.address_Contacts_Encrypt__c=contactsNameEncrypt;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.address_ZipCode__c = addressList[0].ZipCode__c; |
| | | //nObj.address_ZipCode_Encrypt__c = addressList[0].ZipCode_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.address_City__c = cityName; |
| | | nObj.address_Contacts_Name__c = ContactPerson; |
| | | nObj.address_Telephone__c=addressList[0].Telephone__c; |
| | | //nObj.address_Telephone_Encrypt__c=addressList[0].Telephone_Encrypted__c;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.Detailed_Address__c=address; |
| | | //nObj.Detailed_Address_Encrypt__c=addressEncrypt;// 20220407 PI改造 By Bright zhj MEBG新方案改造 2022-11-29 |
| | | nObj.Encrypt_Update_Flag__c=true;// 20220411 PI改造 By Bright |
| | | system.debug('nObj assign and Encrypt_Update_Flag__c set true'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }else if(repair.On_site_repair__c == '办事处修理' || repair.On_site_repair__c== '现场修理'){ |
| | | if(repair.Sales_Branch__c == '上海分公司'){ |
| | | /** 20230313 you DB202303171085 |
| | | if(repair.Sales_Branch__c == '上海分公司'){ |
| | | if (hzProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '杭州共通办事处'; |
| | | leakDefaultFlag = false; |
| | | } |
| | | } else if(repair.Sales_Branch__c == '广州分公司'){ |
| | | } else **/ |
| | | if(repair.Sales_Branch__c == '广州分公司'){ |
| | | if (cdProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '成都共通办事处'; |
| | | leakDefaultFlag = false; |
| | |
| | | leakDefaultFlag = false; |
| | | } |
| | | }else if(repair.On_site_repair__c == '办事处修理' || repair.On_site_repair__c== '现场修理'){ |
| | | /** 20230313 you DB202303171085 |
| | | if(repair.Contract_Principal_Office__c == '上海RC'){ |
| | | if (hzProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '杭州共通办事处'; |
| | | leakDefaultFlag = false; |
| | | } |
| | | } else if(repair.Contract_Principal_Office__c == '广州RC'){ |
| | | } else **/ |
| | | if(repair.Contract_Principal_Office__c == '广州RC'){ |
| | | if (cdProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '成都共通办事处'; |
| | | leakDefaultFlag = false; |
| | |
| | | } |
| | | } |
| | | }else if(repair.On_site_repair__c == '办事处修理' || repair.On_site_repair__c== '现场修理'){ |
| | | /** 20230313 you DB202303171085 |
| | | if(repair.Sales_Branch__c == '上海分公司'){ |
| | | //根据修理品返送地为非北京 |
| | | if (hzProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '杭州共通办事处'; |
| | | leakDefaultFlag = false; |
| | | } |
| | | } else if(repair.Sales_Branch__c == '广州分公司'){ |
| | | } else **/ |
| | | if(repair.Sales_Branch__c == '广州分公司'){ |
| | | //根据修理品返送地为非北京 |
| | | if (cdProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '成都共通办事处'; |
| | |
| | | leakDefaultFlag = false; |
| | | } |
| | | }else if(repair.On_site_repair__c == '办事处修理' || repair.On_site_repair__c== '现场修理'){ |
| | | /** 20230313 you DB202303171085 |
| | | if(middleTable.Maintenance_Contract__r.SalesOfficeCode_selection__c == '上海RC'){ |
| | | if (hzProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '杭州共通办事处'; |
| | | leakDefaultFlag = false; |
| | | } |
| | | } else if(middleTable.Maintenance_Contract__r.SalesOfficeCode_selection__c == '广州RC'){ |
| | | } else**/ |
| | | if(middleTable.Maintenance_Contract__r.SalesOfficeCode_selection__c == '广州RC'){ |
| | | if (cdProvince.contains(repair.SalesOfficeCode_selection__c)) { |
| | | repair.work_location_select__c = '成都共通办事处'; |
| | | leakDefaultFlag = false; |
| | |
| | | ,order_Date_For_Report__c |
| | | ,StageName__c |
| | | //20230222 DB202302339407 you end |
| | | //20230327 DB202303372329 you start |
| | | ,OP_ThousandY_Order__c |
| | | ,OrderThisYearQY__c |
| | | ,Opportunity__c |
| | | //20230327 DB202303372329 you end |
| | | from Opportunity |
| | | where Hospital__c in :hpList |
| | | ]) { |
| | |
| | | o10 = o8 + o9; |
| | | } |
| | | //20230222 you end |
| | | setOppAmount(hpacc, o1, o2, o3, o4, o5, o6, o7,o8,o9,o10); |
| | | setOppAmount(dcacc, o1, o2, o3, o4, o5, o6, o7,o8,o9,o10); |
| | | //20230327 DB202303372329 you start |
| | | Decimal o11 = opp.OP_ThousandY_Order__c == null ? 0 : opp.OP_ThousandY_Order__c; |
| | | Decimal o12 = opp.OrderThisYearQY__c == null ? 0 : opp.OrderThisYearQY__c; |
| | | Decimal o13 = opp.Opportunity__c == null ? 0 : opp.Opportunity__c; |
| | | |
| | | //20230327 DB202303372329 you end |
| | | setOppAmount(hpacc, o1, o2, o3, o4, o5, o6, o7,o8,o9,o10,o11,o12,o13); |
| | | setOppAmount(dcacc, o1, o2, o3, o4, o5, o6, o7,o8,o9,o10,o11,o12,o13); |
| | | |
| | | } |
| | | |
| | |
| | | acc.Opportunity_ThousandY__c = 0; |
| | | acc.Amount_Without_Tax_Thousand__c = 0; |
| | | |
| | | //20230327 DB202303372329 you start |
| | | acc.OP_ThousandY_Order__c = 0; |
| | | acc.OrderThisYearQY__c =0; |
| | | acc.Opportunity__c =0; |
| | | //20230327 DB202303372329 you end |
| | | |
| | | //20220111 SWAG-C8MBB6 加7.询价 lt start |
| | | acc.AllOP_ThousandY__c = 0; |
| | | //20220111 SWAG-C8MBB6 加7.询价 lt end |
| | |
| | | acc.ShippedAmount_HP__c += sa; |
| | | } |
| | | |
| | | private void setOppAmount(Account2__c acc, Decimal o1, Decimal o2, Decimal o3, Decimal o4, Decimal o5, Decimal o6, Decimal o7,Decimal o8,Decimal o9,Decimal o10) { |
| | | private void setOppAmount(Account2__c acc, Decimal o1, Decimal o2, Decimal o3, Decimal o4, Decimal o5, Decimal o6, Decimal o7,Decimal o8,Decimal o9,Decimal o10,Decimal o11,Decimal o12,Decimal o13) { |
| | | acc.Opp_Actual_ThousandY__c += o1; |
| | | acc.BO_Forecast_ThousandY__c += o2; |
| | | acc.OP_ThousandY__c += o3; |
| | |
| | | acc.HospitalTransactionAmount__c += o10; |
| | | |
| | | //20230222 you end |
| | | //20230327 DB202303372329 you start |
| | | acc.OP_ThousandY_Order__c += o11; |
| | | acc.OrderThisYearQY__c += o12; |
| | | acc.Opportunity__c += o13; |
| | | //20230327 DB202303372329 you end |
| | | } |
| | | |
| | | private void setOpdIproductCount(Account2__c acc, Decimal decIP1, Decimal decIP2, Decimal decIP3, Decimal decIP4, Decimal decIP5, Decimal decIP6, Decimal decIP7, Decimal decIP8, Decimal decIP9, Decimal decIP10, |
| | |
| | | countImportantProduct(acc,nameType,tmpCnt,tmpKey,allList,departmentE,depToOtherDepAcc2Map, updateAccount, OldAccount2); |
| | | |
| | | } |
| | | @TestVisible private static void test() { |
| | | Integer i = 0; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | } |
| | | |
| | | } |
| | |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | //global class RollupToMaintenanceContractBatch implements Database.Batchable<AggregateResult> { |
| | | global class RollupToMaintenanceContractBatch implements Database.Batchable<SObject> , Database.Stateful { |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | global Integer totalCount = 0; // 总件数 |
| | | global Integer failedCount = 0; |
| | | global List<String> emailMessages = new List<String>(); |
| | | public List<Id> ConId; |
| | | |
| | | global RollupToMaintenanceContractBatch(List<Id> conID) { |
| | | this.ConId = conID; |
| | | } |
| | | global class RollupToMaintenanceContractBatch implements Database.Batchable<SObject> , Database.Stateful { |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | /** |
| | | * コンスタント |
| | | */ |
| | | global RollupToMaintenanceContractBatch() { |
| | | } |
| | | |
| | | /** |
| | | * startには、queryを実行、维修合同を検索 |
| | | */ |
| | | //global Iterable<AggregateResult> start(Database.batchableContext BC){ |
| | | global Database.QueryLocator start(Database.batchableContext BC){ |
| | | //return new AggregateResultIterable(); |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start |
| | | return Database.getQueryLocator( |
| | | [select Id from User where Id = :UserInfo.getUserId()] |
| | | ); |
| | | CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end |
| | | */ |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | //return Database.getQueryLocator( |
| | | // [select Id from Maintenance_Contract__c] |
| | | //); |
| | | |
| | | |
| | | if(ConId != null && ConId.size() > 0) { |
| | | return Database.getQueryLocator([select Id from Maintenance_Contract__c where Id in :ConId]); |
| | | } else { |
| | | // 20221117 ljh DB202211258553 start |
| | | // return Database.getQueryLocator([select Id from Maintenance_Contract__c]); |
| | | return Database.getQueryLocator([select Id from Maintenance_Contract__c where Status__c = '契約' OR (Status__c = '契約満了' and Contract_End_Date__c >= :Date.today().addMonths(-6))]); |
| | | // 20221117 ljh DB202211258553 end |
| | | } |
| | | |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | // if(ConId != null && ConId.size() > 0) { |
| | | // return Database.getQueryLocator() |
| | | // } |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, List<SObject> mcList) { |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | Savepoint sp = Database.setSavepoint(); |
| | | totalCount += 1; |
| | | |
| | | try { |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | // 维修合同更新 |
| | | Map<Id, Maintenance_Contract__c> updateMC = new Map<Id, Maintenance_Contract__c>(); |
| | | /******************************* HWAG-AV2C67 2018/1/17 START ******************************/ |
| | | //List<Id> mcids = new List<Id>(); |
| | | |
| | | // 已经SAP的循环汇总 |
| | | List<Repair__c> sapRepairList = |
| | | [select Repair_List_Price_formula__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__r.LatestQuotationDate__c, |
| | | Repair_Quotation_Id__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c != null |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start */ |
| | | and Maintenance_Contract__c in: mcList |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end */ |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | and Repair_Quotation_Id__c !=null |
| | | and (CutPrice_Reason__c='维修合同' |
| | | or CutPrice_Reason__c='套餐折扣,维修合同' |
| | | or CutPrice_Reason__c='营业对应,维修合同') |
| | | order by Maintenance_Contract__c]; |
| | | |
| | | if (sapRepairList != null && sapRepairList.size() > 0) { |
| | | for (Repair__c rc : sapRepairList) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price__c=0.0; |
| | | mc.Repair_Cost_Sum__c =0.0; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | mc.Sum_repair_price__c += rc.Repair_List_Price_formula__c == null ? 0 : rc.Repair_List_Price_formula__c; |
| | | mc.Repair_Cost_Sum__c += rc.Repair_cost__c == null ? 0 : rc.Repair_cost__c; |
| | | } |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | } |
| | | |
| | | // 没有SAP的循环汇总 |
| | | List<Repair__c> noSapRepairList = |
| | | [select Repair_List_Price_formula__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c != null |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start */ |
| | | and Maintenance_Contract__c in: mcList |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end */ |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | and Repair_Quotation_Id__c=null |
| | | order by Maintenance_Contract__c]; |
| | | if (noSapRepairList != null && noSapRepairList.size() > 0) { |
| | | for (Repair__c rc : noSapRepairList) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price__c=0.0; |
| | | mc.Repair_Cost_Sum__c =0.0; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | mc.Sum_repair_price__c += rc.Repair_List_Price_formula__c == null ? 0 : rc.Repair_List_Price_formula__c; |
| | | mc.Repair_Cost_Sum__c += rc.Repair_cost__c == null ? 0 : rc.Repair_cost__c; |
| | | } |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | } |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | |
| | | List<Repair__c> newRepairList = |
| | | [select Id,Usage_Ratio_Price__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__c, |
| | | EquipmentGuaranteeFlg_Asset__c, |
| | | if_Rental_Apply__c, |
| | | Offer_Rental_New__c, |
| | | Usage_Ratio_Price_Guarantee__c, |
| | | VM_Maintenance_Contract__c, |
| | | VM_Maintenance_Contract__r.RecordType_DeveloperName__c, |
| | | Maintenance_Contract__r.RecordType_DeveloperName__c, |
| | | VM_Maintenance_Contract__r.startDateGurantee__c, |
| | | VM_Maintenance_Contract__r.endDateGurantee__c |
| | | ,Agreed_Date__c //用户同意日 上限合同 LY 20230210 add |
| | | ,Limit_Price__c //上限修理 上限合同 LY 20230210 add |
| | | from Repair__c |
| | | where (Maintenance_Contract__c != null or VM_Maintenance_Contract__c != null) |
| | | and (Maintenance_Contract__c in: mcList or VM_Maintenance_Contract__c in: mcList) |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | order by Maintenance_Contract__c |
| | | ]; |
| | | |
| | | if (newRepairList != null && newRepairList.size() > 0) { |
| | | |
| | | for (Repair__c rc : newRepairList) { |
| | | if (rc.Maintenance_Contract__c != null) { |
| | | |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price_new__c=0.00; |
| | | global Integer totalCount = 0; // 总件数 |
| | | global Integer failedCount = 0; |
| | | global List<String> emailMessages = new List<String>(); |
| | | public List<Id> ConId; |
| | | |
| | | global RollupToMaintenanceContractBatch(List<Id> conID) { |
| | | this.ConId = conID; |
| | | } |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | /** |
| | | * コンスタント |
| | | */ |
| | | global RollupToMaintenanceContractBatch() { |
| | | } |
| | | |
| | | /** |
| | | * startには、queryを実行、维修合同を検索 |
| | | */ |
| | | //global Iterable<AggregateResult> start(Database.batchableContext BC){ |
| | | global Database.QueryLocator start(Database.batchableContext BC){ |
| | | //return new AggregateResultIterable(); |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start |
| | | return Database.getQueryLocator( |
| | | [select Id from User where Id = :UserInfo.getUserId()] |
| | | ); |
| | | CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end |
| | | */ |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | //return Database.getQueryLocator( |
| | | // [select Id from Maintenance_Contract__c] |
| | | //); |
| | | |
| | | |
| | | if(ConId != null && ConId.size() > 0) { |
| | | return Database.getQueryLocator([select Id from Maintenance_Contract__c where Id in :ConId]); |
| | | } else { |
| | | // 20221117 ljh DB202211258553 start |
| | | // return Database.getQueryLocator([select Id from Maintenance_Contract__c]); |
| | | return Database.getQueryLocator([select Id from Maintenance_Contract__c where Status__c = '契約' OR (Status__c = '契約満了' and Contract_End_Date__c >= :Date.today().addMonths(-6))]); |
| | | // 20221117 ljh DB202211258553 end |
| | | } |
| | | |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | // if(ConId != null && ConId.size() > 0) { |
| | | // return Database.getQueryLocator() |
| | | // } |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, List<SObject> mcList) { |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | Savepoint sp = Database.setSavepoint(); |
| | | totalCount += 1; |
| | | |
| | | try { |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | // 维修合同更新 |
| | | Map<Id, Maintenance_Contract__c> updateMC = new Map<Id, Maintenance_Contract__c>(); |
| | | /******************************* HWAG-AV2C67 2018/1/17 START ******************************/ |
| | | //List<Id> mcids = new List<Id>(); |
| | | |
| | | // 已经SAP的循环汇总 |
| | | List<Repair__c> sapRepairList = |
| | | [select Repair_List_Price_formula__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__r.LatestQuotationDate__c, |
| | | Repair_Quotation_Id__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c != null |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start */ |
| | | and Maintenance_Contract__c in: mcList |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end */ |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | and Repair_Quotation_Id__c !=null |
| | | and (CutPrice_Reason__c='维修合同' |
| | | or CutPrice_Reason__c='套餐折扣,维修合同' |
| | | or CutPrice_Reason__c='营业对应,维修合同') |
| | | order by Maintenance_Contract__c]; |
| | | |
| | | if (sapRepairList != null && sapRepairList.size() > 0) { |
| | | for (Repair__c rc : sapRepairList) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price__c=0.0; |
| | | mc.Repair_Cost_Sum__c =0.0; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | mc.Sum_repair_price__c += rc.Repair_List_Price_formula__c == null ? 0 : rc.Repair_List_Price_formula__c; |
| | | mc.Repair_Cost_Sum__c += rc.Repair_cost__c == null ? 0 : rc.Repair_cost__c; |
| | | } |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (mc.Sum_repair_price_new__c == null) { |
| | | mc.Sum_repair_price_new__c = 0.00; |
| | | } |
| | | |
| | | // 没有SAP的循环汇总 |
| | | List<Repair__c> noSapRepairList = |
| | | [select Repair_List_Price_formula__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c != null |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 start */ |
| | | and Maintenance_Contract__c in: mcList |
| | | /* CHAN-B7J5EK 2018/12/18 按照维修合同划分进行检索 end */ |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | and Repair_Quotation_Id__c=null |
| | | order by Maintenance_Contract__c]; |
| | | if (noSapRepairList != null && noSapRepairList.size() > 0) { |
| | | for (Repair__c rc : noSapRepairList) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price__c=0.0; |
| | | mc.Repair_Cost_Sum__c =0.0; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | mc.Sum_repair_price__c += rc.Repair_List_Price_formula__c == null ? 0 : rc.Repair_List_Price_formula__c; |
| | | mc.Repair_Cost_Sum__c += rc.Repair_cost__c == null ? 0 : rc.Repair_cost__c; |
| | | } |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | //上限合同 LY 20230210 start |
| | | if (rc.Limit_Price__c == true) { |
| | | if (rc.Agreed_Date__c!=null) {//报价同意后 修理的【计入合同消费率的修理金额】记入到维修合同的合同期间修理金额】 上限合同 LY add 20230210 |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | } |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | |
| | | List<Repair__c> newRepairList = |
| | | [select Id,Usage_Ratio_Price__c, |
| | | Repair_cost__c, |
| | | Maintenance_Contract__c, |
| | | Maintenance_Contract__r.Contract_Start_Date__c, |
| | | Maintenance_Contract__r.Contract_End_Date__c, |
| | | Failure_Occurrence_Date__c, |
| | | Repair_Quotation_Id__c, |
| | | EquipmentGuaranteeFlg_Asset__c, |
| | | if_Rental_Apply__c, |
| | | Offer_Rental_New__c, |
| | | Usage_Ratio_Price_Guarantee__c, |
| | | VM_Maintenance_Contract__c, |
| | | VM_Maintenance_Contract__r.RecordType_DeveloperName__c, |
| | | Maintenance_Contract__r.RecordType_DeveloperName__c, |
| | | VM_Maintenance_Contract__r.startDateGurantee__c, |
| | | VM_Maintenance_Contract__r.endDateGurantee__c |
| | | ,Agreed_Date__c //用户同意日 上限合同 LY 20230210 add |
| | | ,Limit_Price__c //上限修理 上限合同 LY 20230210 add |
| | | from Repair__c |
| | | where (Maintenance_Contract__c != null or VM_Maintenance_Contract__c != null) |
| | | and (Maintenance_Contract__c in: mcList or VM_Maintenance_Contract__c in: mcList) |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | order by Maintenance_Contract__c |
| | | ]; |
| | | |
| | | if (newRepairList != null && newRepairList.size() > 0) { |
| | | |
| | | for (Repair__c rc : newRepairList) { |
| | | if (rc.Maintenance_Contract__c != null) { |
| | | |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.Maintenance_Contract__c; |
| | | mc.Sum_repair_price_new__c=0.00; |
| | | } |
| | | }else{ |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.Maintenance_Contract__r.Contract_Start_Date__c; |
| | | Date dEDate = rc.Maintenance_Contract__r.Contract_End_Date__c; |
| | | |
| | | if (mc.Sum_repair_price_new__c == null) { |
| | | mc.Sum_repair_price_new__c = 0.00; |
| | | } |
| | | if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | //上限合同 LY 20230210 start |
| | | if (rc.Limit_Price__c == true) { |
| | | if (rc.Agreed_Date__c!=null) {//报价同意后 修理的【计入合同消费率的修理金额】记入到维修合同的合同期间修理金额】 上限合同 LY add 20230210 |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | } |
| | | }else{ |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | } |
| | | //上限合同 LY 20230210 end |
| | | } |
| | | System.debug('修理金额结束'+mc.Sum_repair_price_new__c); |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | //上限合同 LY 20230210 end |
| | | } |
| | | System.debug('修理金额结束'+mc.Sum_repair_price_new__c); |
| | | updateMC.put(rc.Maintenance_Contract__c, mc); |
| | | } |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 start |
| | | if (rc.VM_Maintenance_Contract__c != null) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.VM_Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.VM_Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.VM_Maintenance_Contract__c; |
| | | mc.Sum_repair_price_new__c=0.00; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.VM_Maintenance_Contract__r.startDateGurantee__c; |
| | | Date dEDate = rc.VM_Maintenance_Contract__r.endDateGurantee__c; |
| | | |
| | | if (mc.Sum_repair_price_new__c == null) { |
| | | mc.Sum_repair_price_new__c = 0.00; |
| | | } |
| | | // gzw LJPH-BZDA84 多年保合同修理价格不根据开始结束日算 start |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 start |
| | | // mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | if ('VM_Contract'.equals(rc.VM_Maintenance_Contract__r.RecordType_DeveloperName__c)) { |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price_Guarantee__c == null ? 0 : rc.Usage_Ratio_Price_Guarantee__c; |
| | | if (rc.VM_Maintenance_Contract__c != null) { |
| | | Maintenance_Contract__c mc = new Maintenance_Contract__c(); |
| | | if (updateMC.containsKey(rc.VM_Maintenance_Contract__c)) { |
| | | mc = updateMC.get(rc.VM_Maintenance_Contract__c); |
| | | } else { |
| | | mc.Id = rc.VM_Maintenance_Contract__c; |
| | | mc.Sum_repair_price_new__c=0.00; |
| | | } |
| | | Date dTDate = rc.Failure_Occurrence_Date__c; |
| | | Date dSDate = rc.VM_Maintenance_Contract__r.startDateGurantee__c; |
| | | Date dEDate = rc.VM_Maintenance_Contract__r.endDateGurantee__c; |
| | | |
| | | if (mc.Sum_repair_price_new__c == null) { |
| | | mc.Sum_repair_price_new__c = 0.00; |
| | | } |
| | | // gzw LJPH-BZDA84 多年保合同修理价格不根据开始结束日算 start |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 start |
| | | // mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price__c == null ? 0 : rc.Usage_Ratio_Price__c; |
| | | if ('VM_Contract'.equals(rc.VM_Maintenance_Contract__r.RecordType_DeveloperName__c)) { |
| | | mc.Sum_repair_price_new__c += rc.Usage_Ratio_Price_Guarantee__c == null ? 0 : rc.Usage_Ratio_Price_Guarantee__c; |
| | | } |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 end |
| | | // } |
| | | // // gzw LJPH-BZDA84 多年保合同修理价格不根据开始结束日算 end |
| | | updateMC.put(rc.VM_Maintenance_Contract__c, mc); |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 end |
| | | } |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 end |
| | | // } |
| | | // // gzw LJPH-BZDA84 多年保合同修理价格不根据开始结束日算 end |
| | | updateMC.put(rc.VM_Maintenance_Contract__c, mc); |
| | | //20210106 zh LJPH-BWM5HM 多年保修【合同期间修理金额】逻辑修改 end |
| | | } |
| | | } |
| | | |
| | | // LD 20200721 备品出借可视化管理 Start |
| | | |
| | | |
| | | //根据维修合同ID查询所有对应维修合同 |
| | | List<Maintenance_Contract__c> conList = [SELECT Id,Name, |
| | | RentalRelatedCnt__c, |
| | | NoRentalRelatedCnt__c, |
| | | RentalRelatedRepairCnt__c, |
| | | RentalRelatedApplyCnt__c, |
| | | RentalRelatedSupplyCnt__c, |
| | | NoRentalRelatedRepairCnt__c, |
| | | NoRentalRelatedApplyCnt__c, |
| | | NoRentalRelatedSupplyCnt__c |
| | | FROM Maintenance_Contract__c |
| | | WHERE |
| | | Id IN :mcList]; |
| | | |
| | | //根据维修合同ID查询对应维修保有设备 |
| | | List<Maintenance_Contract_Asset__c> assList = |
| | | [SELECT Id, |
| | | Asset__r.EGFlg_fromContract_asset__c |
| | | , Maintenance_Contract__c |
| | | FROM Maintenance_Contract_Asset__c |
| | | WHERE Maintenance_Contract__c = :mcList]; |
| | | newRepairList = [ |
| | | select id, EquipmentGuaranteeFlg_Asset__c, |
| | | if_Rental_Apply__c, Offer_Rental_New__c,Maintenance_Contract__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c in: mcList |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | order by Maintenance_Contract__c |
| | | |
| | | ]; |
| | | |
| | | |
| | | //维修合同 |
| | | if (conList != null && conList.size() > 0) { |
| | | for (Maintenance_Contract__c con : conList) { |
| | | |
| | | if(updateMc.containsKey(con.Id)){ |
| | | con = updateMc.get(con.Id); |
| | | } |
| | | |
| | | con.RentalRelatedCnt__c = 0; |
| | | con.NoRentalRelatedCnt__c = 0; |
| | | con.RentalRelatedRepairCnt__c = 0; |
| | | con.RentalRelatedApplyCnt__c = 0; |
| | | con.RentalRelatedSupplyCnt__c = 0; |
| | | con.NoRentalRelatedRepairCnt__c = 0; |
| | | con.NoRentalRelatedApplyCnt__c = 0; |
| | | con.NoRentalRelatedSupplyCnt__c = 0; |
| | | |
| | | if (assList != null && assList.size() > 0) { |
| | | for (Maintenance_Contract_Asset__c ass : assList) { |
| | | System.debug(ass.Maintenance_Contract__c+'====ass.CurrentContract__c'); |
| | | System.debug(con.Id+'====con.Id'); |
| | | if(ass.Maintenance_Contract__c == con.Id){ |
| | | if (ass.Asset__r.EGFlg_fromContract_asset__c == true) { |
| | | con.RentalRelatedCnt__c = con.RentalRelatedCnt__c + 1; |
| | | }else{ |
| | | con.NoRentalRelatedCnt__c = con.NoRentalRelatedCnt__c + 1; |
| | | } |
| | | updateMC.put(con.Id,con); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (newRepairList != null && newRepairList.size() > 0) { |
| | | for (Repair__c repc : newRepairList) { |
| | | if( con.Id == repc.Maintenance_Contract__c){ |
| | | //备品确保提供选框为True |
| | | if(repc.EquipmentGuaranteeFlg_Asset__c == true){ |
| | | con.RentalRelatedRepairCnt__c = con.RentalRelatedRepairCnt__c + 1; |
| | | //是否申请备品选框为True |
| | | if(repc.if_Rental_Apply__c == true){ |
| | | con.RentalRelatedApplyCnt__c = con.RentalRelatedApplyCnt__c + 1; |
| | | } |
| | | //是否提供备品选框为True |
| | | if(repc.Offer_Rental_New__c == true){ |
| | | con.RentalRelatedSupplyCnt__c = con.RentalRelatedSupplyCnt__c + 1; |
| | | } |
| | | } |
| | | //备品确保提供对象为False |
| | | if(repc.EquipmentGuaranteeFlg_Asset__c == false){ |
| | | con.NoRentalRelatedRepairCnt__c = con.NoRentalRelatedRepairCnt__c + 1; |
| | | //是否申请备品选框为True |
| | | if(repc.if_Rental_Apply__c == true){ |
| | | con.NoRentalRelatedApplyCnt__c = con.NoRentalRelatedApplyCnt__c + 1; |
| | | } |
| | | //是否提供备品选框为True |
| | | if(repc.Offer_Rental_New__c == true){ |
| | | con.NoRentalRelatedSupplyCnt__c = con.NoRentalRelatedSupplyCnt__c + 1; |
| | | } |
| | | } |
| | | updateMC.put(con.Id,con); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LD 20200721 备品出借可视化管理 End |
| | | if (updateMC.size() > 0) { |
| | | update updateMC.values(); |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | emailMessages.add(e.getMessage()); |
| | | System.debug(emailMessages); |
| | | failedCount += mcList.size(); |
| | | System.debug(failedCount); |
| | | } |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | |
| | | |
| | | |
| | | //for (SObject sobj : mcList) { |
| | | // Maintenance_Contract__c mc = new Maintenance_Contract__c(Id=String.valueOf(sobj.get('Maintenance_Contract__c'))); |
| | | // initMC(mc); |
| | | // updateMC.put(mc.Id, mc); |
| | | // mcids.add(String.valueOf(sobj.get('Maintenance_Contract__c'))); |
| | | //} |
| | | //筛选出需要更新的数据 |
| | | //List<Maintenance_Contract__c> NeedUpdate = new List<Maintenance_Contract__c>(); |
| | | // 修理 修理金额 |
| | | // 要判断是否SAP |
| | | //已经SAP的循环汇总 |
| | | //for (AggregateResult aggAst : [ |
| | | // select SUM(Repair_List_Price_formula__c) sum_Price, |
| | | // SUM(Repair_cost__c) sum_PricePr, |
| | | // Maintenance_Contract__c, |
| | | // Maintenance_Contract__r.Contract_Start_Date__c, |
| | | // Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c, |
| | | // Repair_Quotation_Id__r.LatestQuotationDate__c, |
| | | // Repair_Quotation_Id__c |
| | | // from Repair__c |
| | | // where Maintenance_Contract__c != null |
| | | // and Status2__c !='00.删除' |
| | | // and Repair_Quotation_Id__c !=null |
| | | // and (CutPrice_Reason__c='维修合同' or CutPrice_Reason__c='套餐折扣,维修合同'or CutPrice_Reason__c='营业对应,维修合同') |
| | | // group by Maintenance_Contract__c,Maintenance_Contract__r.Contract_Start_Date__c,Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c,Repair_Quotation_Id__r.LatestQuotationDate__c,Repair_Quotation_Id__c |
| | | // ]) { |
| | | // Id mcid = (Id) aggAst.get('Maintenance_Contract__c'); |
| | | // Maintenance_Contract__c mc = updateMC.get(mcid); |
| | | // Date dRDate = Date.valueOf(aggAst.get('LatestQuotationDate__c')); |
| | | // Date dTDate = Date.valueOf(aggAst.get('Failure_Occurrence_Date__c')); |
| | | // Date dSDate = Date.valueOf(aggAst.get('Contract_Start_Date__c')); |
| | | // Date dEDate = Date.valueOf(aggAst.get('Contract_End_Date__c')); |
| | | // id RqcID = (id) aggAst.get('Repair_Quotation_Id__c'); |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | |
| | | // mc.Sum_repair_price__c += aggAst.get('sum_Price') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_Price'))); |
| | | // mc.Repair_Cost_Sum__c += aggAst.get('sum_PricePr') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_PricePr'))); |
| | | // } |
| | | // } |
| | | |
| | | //没有SAP的循环汇总 |
| | | //for (AggregateResult aggAst : [ |
| | | // select SUM(Repair_List_Price_formula__c) sum_Price, |
| | | // SUM(Repair_cost__c) sum_PricePr, |
| | | // Maintenance_Contract__c, |
| | | // Maintenance_Contract__r.Contract_Start_Date__c, |
| | | // Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c, |
| | | // Repair_Quotation_Id__c |
| | | // from Repair__c |
| | | // where Maintenance_Contract__c != null |
| | | // and Status2__c !='00.删除' |
| | | // and Repair_Quotation_Id__c=null |
| | | // group by Maintenance_Contract__c,Maintenance_Contract__r.Contract_Start_Date__c,Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c,Repair_Quotation_Id__c |
| | | //]) { |
| | | // Id mcid = (Id) aggAst.get('Maintenance_Contract__c'); |
| | | // Maintenance_Contract__c mc = updateMC.get(mcid); |
| | | // Date dTDate = Date.valueOf(aggAst.get('Failure_Occurrence_Date__c')); |
| | | // Date dSDate = Date.valueOf(aggAst.get('Contract_Start_Date__c')); |
| | | // Date dEDate = Date.valueOf(aggAst.get('Contract_End_Date__c')); |
| | | // id RqcID = (id) aggAst.get('Repair_Quotation_Id__c'); |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | |
| | | // mc.Sum_repair_price__c += aggAst.get('sum_Price') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_Price'))); |
| | | // mc.Repair_Cost_Sum__c += aggAst.get('sum_PricePr') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_PricePr'))); |
| | | // } |
| | | //} |
| | | /******************************* HWAG-AV2C67 2018/1/17 END ******************************/ |
| | | |
| | | |
| | | } |
| | | //and (CutPrice_Reason__c='维修合同' or CutPrice_Reason__c='维修合同,套餐折扣'or CutPrice_Reason__c='营业对应,维修合同') |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | global void finish(Database.BatchableContext BC) { |
| | | // 今回はやることないです |
| | | sendFieldEmail(); |
| | | } |
| | | |
| | | private void sendFieldEmail() { |
| | | PretechBatchEmailUtil be = new PretechBatchEmailUtil(); |
| | | String[] toList = new String[] {UserInfo.getUserEmail()}; |
| | | String title = '维修合同更新失败'; |
| | | String[] ccList = new String[] {}; |
| | | if(System.Test.isRunningTest()){ |
| | | be.successMail('', 1); |
| | | } |
| | | if (emailMessages.size() > 0) { |
| | | be.failedMail(toList, ccList, title, |
| | | String.join(this.emailMessages, '\n'), |
| | | totalCount, totalCount - failedCount, failedCount,'',false); |
| | | be.send(); |
| | | } |
| | | } |
| | | |
| | | // LD 20200721 备品出借可视化管理 Start |
| | | |
| | | |
| | | //根据维修合同ID查询所有对应维修合同 |
| | | List<Maintenance_Contract__c> conList = [SELECT Id,Name, |
| | | RentalRelatedCnt__c, |
| | | NoRentalRelatedCnt__c, |
| | | RentalRelatedRepairCnt__c, |
| | | RentalRelatedApplyCnt__c, |
| | | RentalRelatedSupplyCnt__c, |
| | | NoRentalRelatedRepairCnt__c, |
| | | NoRentalRelatedApplyCnt__c, |
| | | NoRentalRelatedSupplyCnt__c |
| | | FROM Maintenance_Contract__c |
| | | WHERE |
| | | Id IN :mcList]; |
| | | |
| | | //根据维修合同ID查询对应维修保有设备 |
| | | List<Maintenance_Contract_Asset__c> assList = |
| | | [SELECT Id, |
| | | Asset__r.EGFlg_fromContract_asset__c |
| | | , Maintenance_Contract__c |
| | | FROM Maintenance_Contract_Asset__c |
| | | WHERE Maintenance_Contract__c = :mcList]; |
| | | newRepairList = [ |
| | | select id, EquipmentGuaranteeFlg_Asset__c, |
| | | if_Rental_Apply__c, Offer_Rental_New__c,Maintenance_Contract__c |
| | | from Repair__c |
| | | where Maintenance_Contract__c in: mcList |
| | | and Status2__c !='00.删除' |
| | | and Status2__c !='00.取消' |
| | | order by Maintenance_Contract__c |
| | | |
| | | ]; |
| | | |
| | | |
| | | //维修合同 |
| | | if (conList != null && conList.size() > 0) { |
| | | for (Maintenance_Contract__c con : conList) { |
| | | |
| | | if(updateMc.containsKey(con.Id)){ |
| | | con = updateMc.get(con.Id); |
| | | } |
| | | |
| | | con.RentalRelatedCnt__c = 0; |
| | | con.NoRentalRelatedCnt__c = 0; |
| | | con.RentalRelatedRepairCnt__c = 0; |
| | | con.RentalRelatedApplyCnt__c = 0; |
| | | con.RentalRelatedSupplyCnt__c = 0; |
| | | con.NoRentalRelatedRepairCnt__c = 0; |
| | | con.NoRentalRelatedApplyCnt__c = 0; |
| | | con.NoRentalRelatedSupplyCnt__c = 0; |
| | | |
| | | if (assList != null && assList.size() > 0) { |
| | | for (Maintenance_Contract_Asset__c ass : assList) { |
| | | System.debug(ass.Maintenance_Contract__c+'====ass.CurrentContract__c'); |
| | | System.debug(con.Id+'====con.Id'); |
| | | if(ass.Maintenance_Contract__c == con.Id){ |
| | | if (ass.Asset__r.EGFlg_fromContract_asset__c == true) { |
| | | con.RentalRelatedCnt__c = con.RentalRelatedCnt__c + 1; |
| | | }else{ |
| | | con.NoRentalRelatedCnt__c = con.NoRentalRelatedCnt__c + 1; |
| | | } |
| | | updateMC.put(con.Id,con); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (newRepairList != null && newRepairList.size() > 0) { |
| | | for (Repair__c repc : newRepairList) { |
| | | if( con.Id == repc.Maintenance_Contract__c){ |
| | | //备品确保提供选框为True |
| | | if(repc.EquipmentGuaranteeFlg_Asset__c == true){ |
| | | con.RentalRelatedRepairCnt__c = con.RentalRelatedRepairCnt__c + 1; |
| | | //是否申请备品选框为True |
| | | if(repc.if_Rental_Apply__c == true){ |
| | | con.RentalRelatedApplyCnt__c = con.RentalRelatedApplyCnt__c + 1; |
| | | } |
| | | //是否提供备品选框为True |
| | | if(repc.Offer_Rental_New__c == true){ |
| | | con.RentalRelatedSupplyCnt__c = con.RentalRelatedSupplyCnt__c + 1; |
| | | } |
| | | } |
| | | //备品确保提供对象为False |
| | | if(repc.EquipmentGuaranteeFlg_Asset__c == false){ |
| | | con.NoRentalRelatedRepairCnt__c = con.NoRentalRelatedRepairCnt__c + 1; |
| | | //是否申请备品选框为True |
| | | if(repc.if_Rental_Apply__c == true){ |
| | | con.NoRentalRelatedApplyCnt__c = con.NoRentalRelatedApplyCnt__c + 1; |
| | | } |
| | | //是否提供备品选框为True |
| | | if(repc.Offer_Rental_New__c == true){ |
| | | con.NoRentalRelatedSupplyCnt__c = con.NoRentalRelatedSupplyCnt__c + 1; |
| | | } |
| | | } |
| | | updateMC.put(con.Id,con); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LD 20200721 备品出借可视化管理 End |
| | | if (updateMC.size() > 0) { |
| | | update updateMC.values(); |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | emailMessages.add(e.getMessage()); |
| | | System.debug(emailMessages); |
| | | failedCount += mcList.size(); |
| | | System.debug(failedCount); |
| | | } |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | |
| | | |
| | | |
| | | |
| | | //for (SObject sobj : mcList) { |
| | | // Maintenance_Contract__c mc = new Maintenance_Contract__c(Id=String.valueOf(sobj.get('Maintenance_Contract__c'))); |
| | | // initMC(mc); |
| | | // updateMC.put(mc.Id, mc); |
| | | // mcids.add(String.valueOf(sobj.get('Maintenance_Contract__c'))); |
| | | //} |
| | | //筛选出需要更新的数据 |
| | | //List<Maintenance_Contract__c> NeedUpdate = new List<Maintenance_Contract__c>(); |
| | | // 修理 修理金额 |
| | | // 要判断是否SAP |
| | | //已经SAP的循环汇总 |
| | | //for (AggregateResult aggAst : [ |
| | | // select SUM(Repair_List_Price_formula__c) sum_Price, |
| | | // SUM(Repair_cost__c) sum_PricePr, |
| | | // Maintenance_Contract__c, |
| | | // Maintenance_Contract__r.Contract_Start_Date__c, |
| | | // Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c, |
| | | // Repair_Quotation_Id__r.LatestQuotationDate__c, |
| | | // Repair_Quotation_Id__c |
| | | // from Repair__c |
| | | // where Maintenance_Contract__c != null |
| | | // and Status2__c !='00.删除' |
| | | // and Repair_Quotation_Id__c !=null |
| | | // and (CutPrice_Reason__c='维修合同' or CutPrice_Reason__c='套餐折扣,维修合同'or CutPrice_Reason__c='营业对应,维修合同') |
| | | // group by Maintenance_Contract__c,Maintenance_Contract__r.Contract_Start_Date__c,Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c,Repair_Quotation_Id__r.LatestQuotationDate__c,Repair_Quotation_Id__c |
| | | // ]) { |
| | | // Id mcid = (Id) aggAst.get('Maintenance_Contract__c'); |
| | | // Maintenance_Contract__c mc = updateMC.get(mcid); |
| | | // Date dRDate = Date.valueOf(aggAst.get('LatestQuotationDate__c')); |
| | | // Date dTDate = Date.valueOf(aggAst.get('Failure_Occurrence_Date__c')); |
| | | // Date dSDate = Date.valueOf(aggAst.get('Contract_Start_Date__c')); |
| | | // Date dEDate = Date.valueOf(aggAst.get('Contract_End_Date__c')); |
| | | // id RqcID = (id) aggAst.get('Repair_Quotation_Id__c'); |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | |
| | | // mc.Sum_repair_price__c += aggAst.get('sum_Price') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_Price'))); |
| | | // mc.Repair_Cost_Sum__c += aggAst.get('sum_PricePr') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_PricePr'))); |
| | | // } |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | /******************************* HWAG-AV2C67 2018/1/17 START ******************************/ |
| | | // private void initMC(Maintenance_Contract__c mc) { |
| | | // mc.Sum_repair_price__c = 0.0; |
| | | // mc.Repair_Cost_Sum__c =0.0; |
| | | // } |
| | | |
| | | //没有SAP的循环汇总 |
| | | //for (AggregateResult aggAst : [ |
| | | // select SUM(Repair_List_Price_formula__c) sum_Price, |
| | | // SUM(Repair_cost__c) sum_PricePr, |
| | | // Maintenance_Contract__c, |
| | | // Maintenance_Contract__r.Contract_Start_Date__c, |
| | | // Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c, |
| | | // Repair_Quotation_Id__c |
| | | // from Repair__c |
| | | // where Maintenance_Contract__c != null |
| | | // and Status2__c !='00.删除' |
| | | // and Repair_Quotation_Id__c=null |
| | | // group by Maintenance_Contract__c,Maintenance_Contract__r.Contract_Start_Date__c,Maintenance_Contract__r.Contract_End_Date__c, |
| | | // Failure_Occurrence_Date__c,Repair_Quotation_Id__c |
| | | //]) { |
| | | // Id mcid = (Id) aggAst.get('Maintenance_Contract__c'); |
| | | // Maintenance_Contract__c mc = updateMC.get(mcid); |
| | | // Date dTDate = Date.valueOf(aggAst.get('Failure_Occurrence_Date__c')); |
| | | // Date dSDate = Date.valueOf(aggAst.get('Contract_Start_Date__c')); |
| | | // Date dEDate = Date.valueOf(aggAst.get('Contract_End_Date__c')); |
| | | // id RqcID = (id) aggAst.get('Repair_Quotation_Id__c'); |
| | | // if (dTDate >= dSDate && dTDate <= dEDate) { |
| | | |
| | | // mc.Sum_repair_price__c += aggAst.get('sum_Price') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_Price'))); |
| | | // mc.Repair_Cost_Sum__c += aggAst.get('sum_PricePr') == null ? 0 : Decimal.valueOf(String.valueOf(aggAst.get('sum_PricePr'))); |
| | | // } |
| | | //} |
| | | /******************************* HWAG-AV2C67 2018/1/17 END ******************************/ |
| | | |
| | | |
| | | } |
| | | //and (CutPrice_Reason__c='维修合同' or CutPrice_Reason__c='维修合同,套餐折扣'or CutPrice_Reason__c='营业对应,维修合同') |
| | | // public class AggregateResultIterator implements Iterator<AggregateResult> { |
| | | // AggregateResult [] results {get;set;} |
| | | // // tracks which result item is returned |
| | | // Integer index {get; set;} |
| | | |
| | | // public AggregateResultIterator() { |
| | | // index = 0; |
| | | // // Fire query here to load the results |
| | | // Date tdate = Date.today(); |
| | | // Date before2day = tdate.addDays(-2); |
| | | // Date sdate = tdate.addDays(-30); |
| | | // Datetime before2dayTime = Datetime.newInstance(before2day, Time.newInstance(0, 0, 0, 0)); |
| | | // results = [ |
| | | // Select Maintenance_Contract__c |
| | | // From Repair__c |
| | | // Where Maintenance_Contract__c != null |
| | | |
| | | // GROUP BY Maintenance_Contract__c |
| | | |
| | | // LHJ 20190712 HWAG-BDH9V5 Start |
| | | global void finish(Database.BatchableContext BC) { |
| | | // 今回はやることないです |
| | | sendFieldEmail(); |
| | | } |
| | | |
| | | private void sendFieldEmail() { |
| | | PretechBatchEmailUtil be = new PretechBatchEmailUtil(); |
| | | String[] toList = new String[] {UserInfo.getUserEmail()}; |
| | | String title = '维修合同更新失败'; |
| | | String[] ccList = new String[] {}; |
| | | if(System.Test.isRunningTest()){ |
| | | be.successMail('', 1); |
| | | } |
| | | if (emailMessages.size() > 0) { |
| | | be.failedMail(toList, ccList, title, |
| | | String.join(this.emailMessages, '\n'), |
| | | totalCount, totalCount - failedCount, failedCount,'',false); |
| | | be.send(); |
| | | } |
| | | } |
| | | // LHJ 20190712 HWAG-BDH9V5 End |
| | | /******************************* HWAG-AV2C67 2018/1/17 START ******************************/ |
| | | // private void initMC(Maintenance_Contract__c mc) { |
| | | // mc.Sum_repair_price__c = 0.0; |
| | | // mc.Repair_Cost_Sum__c =0.0; |
| | | // } |
| | | |
| | | // public class AggregateResultIterator implements Iterator<AggregateResult> { |
| | | // AggregateResult [] results {get;set;} |
| | | // // tracks which result item is returned |
| | | // Integer index {get; set;} |
| | | |
| | | // public AggregateResultIterator() { |
| | | // index = 0; |
| | | // // Fire query here to load the results |
| | | // Date tdate = Date.today(); |
| | | // Date before2day = tdate.addDays(-2); |
| | | // Date sdate = tdate.addDays(-30); |
| | | // Datetime before2dayTime = Datetime.newInstance(before2day, Time.newInstance(0, 0, 0, 0)); |
| | | // results = [ |
| | | // Select Maintenance_Contract__c |
| | | // From Repair__c |
| | | // Where Maintenance_Contract__c != null |
| | | |
| | | // GROUP BY Maintenance_Contract__c |
| | | |
| | | // ]; |
| | | // } |
| | | // ]; |
| | | // } |
| | | |
| | | // public boolean hasNext(){ |
| | | // return results != null && !results.isEmpty() && index < results.size(); |
| | | // } |
| | | |
| | | // public AggregateResult next(){ |
| | | // return results[index++]; |
| | | // } |
| | | //} |
| | | |
| | | // public boolean hasNext(){ |
| | | // return results != null && !results.isEmpty() && index < results.size(); |
| | | // } |
| | | |
| | | // public AggregateResult next(){ |
| | | // return results[index++]; |
| | | // } |
| | | //} |
| | | |
| | | //public class AggregateResultIterable implements Iterable<AggregateResult> { |
| | | // public Iterator<AggregateResult> Iterator(){ |
| | | // return new AggregateResultIterator(); |
| | | // } |
| | | //} |
| | | /******************************* HWAG-AV2C67 2018/1/17 END ******************************/ |
| | | } |
| | | //public class AggregateResultIterable implements Iterable<AggregateResult> { |
| | | // public Iterator<AggregateResult> Iterator(){ |
| | | // return new AggregateResultIterator(); |
| | | // } |
| | | //} |
| | | /******************************* HWAG-AV2C67 2018/1/17 END ******************************/ |
| | | } |
| force-app/main/default/classes/SaleOrderController.cls
force-app/main/default/classes/SelectAssetEstimateVMController.cls
force-app/main/default/classes/SendConsumableordertosap.cls
force-app/main/default/classes/SendConsumableordertosapTest.cls
force-app/main/default/classes/SetProvinceTargetBatch.cls
force-app/main/default/classes/SetProvinceTargetController.cls
force-app/main/default/classes/SetProvinceTargetControllerTest.cls
force-app/main/default/classes/StartTradingController.cls
force-app/main/default/classes/SummaryConsumptionRateBatch.cls
force-app/main/default/classes/SummaryConsumptionRateBatch.cls-meta.xml
force-app/main/default/classes/SummaryConsumptionRateBatchTest.cls
force-app/main/default/classes/SummaryConsumptionRateBatchTest.cls-meta.xml
force-app/main/default/classes/TenderInformationHandler.cls
force-app/main/default/classes/TenderLostController.cls
force-app/main/default/classes/TenderOpportunityLinkHandler.cls
force-app/main/default/classes/TenderResultConfirmTaskBatch.cls
force-app/main/default/classes/TerminateController.cls
force-app/main/default/classes/TerminateControllerTest.cls
force-app/main/default/classes/UpdateTenderInformationBatch.cls
force-app/main/default/classes/UpdateUserTextColBatch.cls
force-app/main/default/classes/lexSearchAgencyHospitalController.cls
force-app/main/default/classes/lexSearchAgencyHospitalController.cls-meta.xml
force-app/main/default/classes/searchContractController.cls
force-app/main/default/classes/searchContractControllerTest.cls
force-app/main/default/dashboards/Consumable_Dashboard/ezyQWhsDlQfrUPdIMqUmGsdMeWiYAH.dashboard-meta.xml
force-app/main/default/dashboards/LEX.dashboardFolder-meta.xml
force-app/main/default/experiences/Consumable1.site-meta.xml
force-app/main/default/experiences/Consumable1/brandingSets/partnerCentral.json
force-app/main/default/experiences/Consumable1/config/consumable系统.json
force-app/main/default/experiences/Consumable1/config/languages.json
force-app/main/default/experiences/Consumable1/config/loginAppPage.json
force-app/main/default/experiences/Consumable1/config/mainAppPage.json
force-app/main/default/experiences/Consumable1/routes/accountManagement.json
force-app/main/default/experiences/Consumable1/routes/cICリスト.json
force-app/main/default/experiences/Consumable1/routes/cIC関連リスト.json
force-app/main/default/experiences/Consumable1/routes/campaignList.json
force-app/main/default/experiences/Consumable1/routes/caseDetail.json
force-app/main/default/experiences/Consumable1/routes/checkPassword.json
force-app/main/default/experiences/Consumable1/routes/contactSupport.json
force-app/main/default/experiences/Consumable1/routes/createRecord.json
force-app/main/default/experiences/Consumable1/routes/dashboardDetail.json
force-app/main/default/experiences/Consumable1/routes/dashboardList.json
force-app/main/default/experiences/Consumable1/routes/error.json
force-app/main/default/experiences/Consumable1/routes/feedDetail.json
force-app/main/default/experiences/Consumable1/routes/fileDetail.json
force-app/main/default/experiences/Consumable1/routes/fileList.json
force-app/main/default/experiences/Consumable1/routes/flow.json
force-app/main/default/experiences/Consumable1/routes/forgotPassword.json
force-app/main/default/experiences/Consumable1/routes/groupDetail.json
force-app/main/default/experiences/Consumable1/routes/groupList.json
force-app/main/default/experiences/Consumable1/routes/home.json
force-app/main/default/experiences/Consumable1/routes/lexAgencyInfo.json
force-app/main/default/experiences/Consumable1/routes/lexArriveGoods.json
force-app/main/default/experiences/Consumable1/routes/lexArriveGoodsMain.json
force-app/main/default/experiences/Consumable1/routes/lexArriveGsDetails.json
force-app/main/default/experiences/Consumable1/routes/lexCancelRemoveBox.json
force-app/main/default/experiences/Consumable1/routes/lexConInvoiceView.json
force-app/main/default/experiences/Consumable1/routes/lexConsumable.json
force-app/main/default/experiences/Consumable1/routes/lexConsumableAccount.json
force-app/main/default/experiences/Consumable1/routes/lexConsumableAccountInfoPrint.json
force-app/main/default/experiences/Consumable1/routes/lexConsumableOrderManage.json
force-app/main/default/experiences/Consumable1/routes/lexInventory.json
force-app/main/default/experiences/Consumable1/routes/lexInventoryView.json
force-app/main/default/experiences/Consumable1/routes/lexOutboundorderImport.json
force-app/main/default/experiences/Consumable1/routes/lexOverdueStock.json
force-app/main/default/experiences/Consumable1/routes/lexProductLimitEdit.json
force-app/main/default/experiences/Consumable1/routes/lexRemoveBox.json
force-app/main/default/experiences/Consumable1/routes/lexSaleAndDelivery.json
force-app/main/default/experiences/Consumable1/routes/lexSummonsCreat.json
force-app/main/default/experiences/Consumable1/routes/lexTopPage.json
force-app/main/default/experiences/Consumable1/routes/login.json
force-app/main/default/experiences/Consumable1/routes/loginError.json
force-app/main/default/experiences/Consumable1/routes/mDFAndCoop.json
force-app/main/default/experiences/Consumable1/routes/messages.json
force-app/main/default/experiences/Consumable1/routes/myAccount.json
force-app/main/default/experiences/Consumable1/routes/questionDetail.json
force-app/main/default/experiences/Consumable1/routes/quipDocsRelatedList.json
force-app/main/default/experiences/Consumable1/routes/recordDetail.json
force-app/main/default/experiences/Consumable1/routes/recordList.json
force-app/main/default/experiences/Consumable1/routes/register.json
force-app/main/default/experiences/Consumable1/routes/relatedRecordList.json
force-app/main/default/experiences/Consumable1/routes/reportBuilder.json
force-app/main/default/experiences/Consumable1/routes/reportDetail.json
force-app/main/default/experiences/Consumable1/routes/reportList.json
force-app/main/default/experiences/Consumable1/routes/resources.json
force-app/main/default/experiences/Consumable1/routes/search.json
force-app/main/default/experiences/Consumable1/routes/streamDetail.json
force-app/main/default/experiences/Consumable1/routes/streamList.json
force-app/main/default/experiences/Consumable1/routes/topicCatalog.json
force-app/main/default/experiences/Consumable1/routes/topicDetail.json
force-app/main/default/experiences/Consumable1/routes/userProfile.json
force-app/main/default/experiences/Consumable1/routes/userSettings.json
force-app/main/default/experiences/Consumable1/routes/仪表板関連リスト.json
force-app/main/default/experiences/Consumable1/routes/学会・培训詳細.json
force-app/main/default/experiences/Consumable1/routes/学会・培训関連リスト.json
force-app/main/default/experiences/Consumable1/routes/小组関連リスト.json
force-app/main/default/experiences/Consumable1/routes/报表関連リスト.json
force-app/main/default/experiences/Consumable1/routes/文件関連リスト.json
force-app/main/default/experiences/Consumable1/routes/流関連リスト.json
force-app/main/default/experiences/Consumable1/routes/消耗品订单列表.json
force-app/main/default/experiences/Consumable1/routes/消耗品订单相关列表.json
force-app/main/default/experiences/Consumable1/routes/消耗品订单详细信息.json
force-app/main/default/experiences/Consumable1/routes/用户リスト.json
force-app/main/default/experiences/Consumable1/routes/用户関連リスト.json
force-app/main/default/experiences/Consumable1/themes/partnerCentral.json
force-app/main/default/experiences/Consumable1/variations/defaultCustomComponentPropertiesComponentProperties.json
force-app/main/default/experiences/Consumable1/views/accountManagement.json
force-app/main/default/experiences/Consumable1/views/cICリスト.json
force-app/main/default/experiences/Consumable1/views/cIC関連リスト.json
force-app/main/default/experiences/Consumable1/views/campaignList.json
force-app/main/default/experiences/Consumable1/views/caseDetail.json
force-app/main/default/experiences/Consumable1/views/checkPassword.json
force-app/main/default/experiences/Consumable1/views/consumableDetailFix.json
force-app/main/default/experiences/Consumable1/views/contactSupport.json
force-app/main/default/experiences/Consumable1/views/createRecord.json
force-app/main/default/experiences/Consumable1/views/dashboardDetail.json
force-app/main/default/experiences/Consumable1/views/dashboardList.json
force-app/main/default/experiences/Consumable1/views/error.json
force-app/main/default/experiences/Consumable1/views/feedDetail.json
force-app/main/default/experiences/Consumable1/views/fileDetail.json
force-app/main/default/experiences/Consumable1/views/fileList.json
force-app/main/default/experiences/Consumable1/views/flow.json
force-app/main/default/experiences/Consumable1/views/forgotPassword.json
force-app/main/default/experiences/Consumable1/views/groupDetail.json
force-app/main/default/experiences/Consumable1/views/groupList.json
force-app/main/default/experiences/Consumable1/views/home.json
force-app/main/default/experiences/Consumable1/views/homeFlexible.json
force-app/main/default/experiences/Consumable1/views/lexAgencyInfo.json
force-app/main/default/experiences/Consumable1/views/lexArriveGoods.json
force-app/main/default/experiences/Consumable1/views/lexArriveGoodsMain.json
force-app/main/default/experiences/Consumable1/views/lexArriveGsDetails.json
force-app/main/default/experiences/Consumable1/views/lexCancelRemoveBox.json
force-app/main/default/experiences/Consumable1/views/lexConInvoiceView.json
force-app/main/default/experiences/Consumable1/views/lexConsumable.json
force-app/main/default/experiences/Consumable1/views/lexConsumableAccount.json
force-app/main/default/experiences/Consumable1/views/lexConsumableAccountInfoPrint.json
force-app/main/default/experiences/Consumable1/views/lexConsumableOrderManage.json
force-app/main/default/experiences/Consumable1/views/lexInventory.json
force-app/main/default/experiences/Consumable1/views/lexInventoryView.json
force-app/main/default/experiences/Consumable1/views/lexOutboundorderImport.json
force-app/main/default/experiences/Consumable1/views/lexOverdueStock.json
force-app/main/default/experiences/Consumable1/views/lexProductLimitEdit.json
force-app/main/default/experiences/Consumable1/views/lexRemoveBox.json
force-app/main/default/experiences/Consumable1/views/lexSaleAndDelivery.json
force-app/main/default/experiences/Consumable1/views/lexSummonsCreat.json
force-app/main/default/experiences/Consumable1/views/lexTopPage.json
force-app/main/default/experiences/Consumable1/views/login.json
force-app/main/default/experiences/Consumable1/views/loginError.json
force-app/main/default/experiences/Consumable1/views/mDFAndCoop.json
force-app/main/default/experiences/Consumable1/views/messages.json
force-app/main/default/experiences/Consumable1/views/myAccount.json
force-app/main/default/experiences/Consumable1/views/questionDetail.json
force-app/main/default/experiences/Consumable1/views/quipDocsRelatedList.json
force-app/main/default/experiences/Consumable1/views/recordDetail.json
force-app/main/default/experiences/Consumable1/views/recordList.json
force-app/main/default/experiences/Consumable1/views/register.json
force-app/main/default/experiences/Consumable1/views/relatedRecordList.json
force-app/main/default/experiences/Consumable1/views/reportBuilder.json
force-app/main/default/experiences/Consumable1/views/reportDetail.json
force-app/main/default/experiences/Consumable1/views/reportList.json
force-app/main/default/experiences/Consumable1/views/resources.json
force-app/main/default/experiences/Consumable1/views/search.json
force-app/main/default/experiences/Consumable1/views/streamDetail.json
force-app/main/default/experiences/Consumable1/views/streamList.json
force-app/main/default/experiences/Consumable1/views/topicCatalog.json
force-app/main/default/experiences/Consumable1/views/topicDetail.json
force-app/main/default/experiences/Consumable1/views/userProfile.json
force-app/main/default/experiences/Consumable1/views/userSettings.json
force-app/main/default/experiences/Consumable1/views/仪表板関連リスト.json
force-app/main/default/experiences/Consumable1/views/学会・培训詳細.json
force-app/main/default/experiences/Consumable1/views/学会・培训関連リスト.json
force-app/main/default/experiences/Consumable1/views/小组関連リスト.json
force-app/main/default/experiences/Consumable1/views/报表関連リスト.json
force-app/main/default/experiences/Consumable1/views/文件関連リスト.json
force-app/main/default/experiences/Consumable1/views/流関連リスト.json
force-app/main/default/experiences/Consumable1/views/消耗品订单列表.json
force-app/main/default/experiences/Consumable1/views/消耗品订单相关列表.json
force-app/main/default/experiences/Consumable1/views/消耗品订单详细信息.json
force-app/main/default/experiences/Consumable1/views/用户リスト.json
force-app/main/default/experiences/Consumable1/views/用户関連リスト.json
force-app/main/default/labels/CustomLabels.labels-meta.xml
force-app/main/default/lwc/commonToast/commonToast.html
force-app/main/default/lwc/commonToast/commonToast.js
force-app/main/default/lwc/commonToast/commonToast.js-meta.xml
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js-meta.xml
force-app/main/default/lwc/customOutputGood/customOutputGood.html
force-app/main/default/lwc/customOutputGood/customOutputGood.js
force-app/main/default/lwc/customOutputGood/customOutputGood.js-meta.xml
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html
force-app/main/default/lwc/customUnitComp/customUnitComp.css
force-app/main/default/lwc/customUnitComp/customUnitComp.html
force-app/main/default/lwc/customUnitComp/customUnitComp.js
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js-meta.xml
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js-meta.xml
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js-meta.xml
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.css
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js-meta.xml
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.css
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.css
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js-meta.xml
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.css
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
force-app/main/default/lwc/lexConsumable/lexConsumable.css
force-app/main/default/lwc/lexConsumable/lexConsumable.html
force-app/main/default/lwc/lexConsumable/lexConsumable.js
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css
force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml
force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html
force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml
force-app/main/default/lwc/lexInventory/lexInventory.css
force-app/main/default/lwc/lexInventory/lexInventory.html
force-app/main/default/lwc/lexInventory/lexInventory.js
force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml
force-app/main/default/lwc/lexLookup/lexLookup.js
force-app/main/default/lwc/lexNewOrder/lexNewOrder.html
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml
force-app/main/default/lwc/lexTopPage/lexTopPage.css
force-app/main/default/lwc/lexTopPage/lexTopPage.html
force-app/main/default/lwc/lexTopPage/lexTopPage.js
force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
force-app/main/default/networks/Consumable系统.network-meta.xml
force-app/main/default/objects/LicenceReminderDate__c/LicenceReminderDate__c.object-meta.xml
force-app/main/default/objects/LicenceReminderDate__c/fields/ReminderDays__c.field-meta.xml
force-app/main/default/objects/NoteStay__c/NoteStay__c.object-meta.xml
force-app/main/default/objects/NoteStay__c/fields/IsStay__c.field-meta.xml
force-app/main/default/pages/AccountTargetTab.page
force-app/main/default/pages/Consumable.page
force-app/main/default/pages/NewMCAgentPDF.page
force-app/main/default/pages/NewMCAgentPDFLimit.page
force-app/main/default/pages/NewMCHPDF.page
force-app/main/default/pages/NewMCHPDFLimit.page
force-app/main/default/pages/NewPaymentPlanLoad.page
force-app/main/default/pages/PCLLostReportPage.page
force-app/main/default/pages/PrintConsumblePDF.page
force-app/main/default/pages/QuotePDF.page
force-app/main/default/pages/SelectAssetEstimateVM.page
force-app/main/default/pages/SetProvinceTarget.page
force-app/main/default/pages/Terminate.page
force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml
force-app/main/default/reports/Consumable_KC/CurrentMonthSalesRankByAccount.report-meta.xml
force-app/main/default/reports/Consumable_KC/CurrentMonthSalesRankByProduct.report-meta.xml
force-app/main/default/reports/Consumable_KC/LastMonthSalesByAccount1.report-meta.xml
force-app/main/default/reports/Consumable_KC/LastMonthSalesByProduct.report-meta.xml
force-app/main/default/reports/Consumable_KC/WeeklyReportForAgency.report-meta.xml
force-app/main/default/reports/Store_Custom_ReportLink/Consumable_Outstock_Invoice_Lex.report-meta.xml
force-app/main/default/reports/Store_Custom_ReportLink/Report_Outbound_Lex.report-meta.xml
force-app/main/default/sites/Consumable.site-meta.xml
force-app/main/default/staticresources/AccountGif.gif
force-app/main/default/staticresources/AccountGif.resource-meta.xml
force-app/main/default/staticresources/LexCustomDataTable.css
force-app/main/default/staticresources/LexCustomDataTable.resource-meta.xml
force-app/main/default/staticresources/Olympus_Logo.png
force-app/main/default/staticresources/Olympus_Logo.resource-meta.xml
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN.resource-meta.xml
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/css/fonts-and-custom.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/fonts/webfonts/SalesforceSans-Bold.woff2
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/fonts/webfonts/SalesforceSans-Light.woff2
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/fonts/webfonts/SalesforceSans-Regular.woff2
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/einstein-headers/einstein-figure.svg
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/einstein-headers/einstein-header-background.svg
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/group_avatar_160.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/group_avatar_200.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/group_avatar_96.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/logo-noname.svg
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/popovers/popover-action.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/popovers/popover-header.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/profile_avatar_160.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/profile_avatar_200.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/profile_avatar_96.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/serviceNotAvailable/serviceNotAvailable.svg
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/themes/oneSalesforce/banner-brand-default.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/themes/oneSalesforce/banner-group-public-default.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/themes/oneSalesforce/banner-user-default.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/tooManyRequests/tooManyRequests.svg
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/images/welcome-mat/bg-info@2x.png
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/dxp-site-spacing-styling-hooks.min.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/dxp-slds-extensions.min.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/dxp-styling-hooks.min.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/overrides.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/salesforce-lightning-design-system.min.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/assets/styles/styles.css
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/maintenance.html
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/toomanyrequests.html
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/23e2eae4b4/prod/lwr_app
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/742e91b1f6/prod/events-out
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/98698c76aa/prod/browsercheck
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/af5a5d856d/prod/lwr_lwc
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/bc00fb7571/prod/lwr_bootstrap
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/c87ab0b57c/prod/localeredirect
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/ca37d29c6e/prod/lwr_mobile
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/eb908c3442/prod/lwr_loader
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/f72e190258/prod/oasis
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/framework/fabbc63ed6/prod/lwr_bootstrap_locker
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/template_html/166206b3ed/prod/index
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/view/1caf97ec72/prod/zh_CN/serviceNotAvailable
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/view/7cfd898557/prod/zh_CN/too_Many_Requests
force-app/main/default/staticresources/SNA_Demo1_sf_default_cdn_PqhAN/webruntime/view/967f56cf2c/prod/zh_CN/service_Not_Available
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ.resource-meta.xml
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/css/fonts-and-custom.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/fonts/webfonts/SalesforceSans-Bold.woff2
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/fonts/webfonts/SalesforceSans-Light.woff2
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/fonts/webfonts/SalesforceSans-Regular.woff2
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/einstein-headers/einstein-figure.svg
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/einstein-headers/einstein-header-background.svg
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/group_avatar_160.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/group_avatar_200.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/group_avatar_96.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/logo-noname.svg
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/popovers/popover-action.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/popovers/popover-header.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/profile_avatar_160.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/profile_avatar_200.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/profile_avatar_96.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/serviceNotAvailable/serviceNotAvailable.svg
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/themes/oneSalesforce/banner-brand-default.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/themes/oneSalesforce/banner-group-public-default.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/themes/oneSalesforce/banner-user-default.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/tooManyRequests/tooManyRequests.svg
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/images/welcome-mat/bg-info@2x.png
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/dxp-site-spacing-styling-hooks.min.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/dxp-slds-extensions.min.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/dxp-styling-hooks.min.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/overrides.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/salesforce-lightning-design-system.min.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/assets/styles/styles.css
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/maintenance.html
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/toomanyrequests.html
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/23e2eae4b4/prod/lwr_app
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/742e91b1f6/prod/events-out
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/98698c76aa/prod/browsercheck
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/af5a5d856d/prod/lwr_lwc
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/bc00fb7571/prod/lwr_bootstrap
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/c87ab0b57c/prod/localeredirect
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/ca37d29c6e/prod/lwr_mobile
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/eb908c3442/prod/lwr_loader
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/f72e190258/prod/oasis
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/framework/fabbc63ed6/prod/lwr_bootstrap_locker
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/template_html/166206b3ed/prod/index
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/view/1caf97ec72/prod/zh_CN/serviceNotAvailable
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/view/2b61a4877d/prod/zh_CN/service_Not_Available
force-app/main/default/staticresources/SNA_Partner_Sales1_sf_default_cdn_JaBaQ/webruntime/view/9a218fe602/prod/zh_CN/too_Many_Requests
force-app/main/default/staticresources/lexdatatable.css
force-app/main/default/staticresources/lexdatatable.resource-meta.xml
force-app/main/default/triggers/ContentDocumentLink.trigger
force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml
force-app/main/default/triggers/ContentDocumentTrigger.trigger
force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
force-app/main/default/triggers/ContentVersionTrigger.trigger
force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml
force-app/main/default/triggers/Repair.trigger
force-app/main/default/triggers/UserToContact.trigger
manifest/LEXC00basecmp.xml
manifest/LEXC01packagelexcommunitynew.xml
manifest/LEXC02packagelexcommunityupdate.xml
manifest/LEXC03reportanddashboard.xml
manifest/LEXC04packagecommdeploy.xml
manifest/PIPL00packageForPIPL.xml
manifest/PIPL01packageForPIPLPage.xml
manifest/PIPL02packageForCloneButton.xml |