Merge branch 'master' into LightningUpgradeProject
3个文件已删除
70个文件已修改
552个文件已添加
| New file |
| | |
| | | { |
| | | "target-org": "OlympusStageEnv" |
| | | } |
| | |
| | | <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; |
| | | |
| New file |
| | |
| | | public without sharing class LexArriveGoodsController { |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static Results init(String arrType, String eSetId) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | try { |
| | | ArriveGoodsController arrController = new ArriveGoodsController( |
| | | eSetId, |
| | | arrType |
| | | ); |
| | | arrController.isLwc = true; |
| | | arrController.init(); |
| | | results.arrGoodCon = JSON.serialize(arrController); |
| | | results.coc = arrController.coc; |
| | | results.saveFLGbln = arrController.saveFLGbln; |
| | | results.returnFLGbln = arrController.ReturnFLGbln; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //搜索产品 |
| | | @AuraEnabled |
| | | public static Results searchProduct(String barcode, String arrControllerStr) { |
| | | Results results = new Results(); |
| | | try { |
| | | System.debug('arrControllerStr:' + arrControllerStr); |
| | | ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize( |
| | | arrControllerStr, |
| | | ArriveGoodsController.class |
| | | ); |
| | | arrController.barcode = barcode; |
| | | arrController.returnError = null; |
| | | arrController.warningList = new List<String>(); |
| | | arrController.errorList = new List<String>(); |
| | | arrController.SearchPro(); |
| | | results.arrGoodCon = JSON.serialize(arrController); |
| | | if ( |
| | | arrController.returnError != null && |
| | | arrController.returnError != '' |
| | | ) { |
| | | results.result = 'Fail'; |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.errorMsg = arrController.returnError; |
| | | } else { |
| | | results.coc = arrController.coc; |
| | | results.saveFLGbln = arrController.saveFLGbln; |
| | | results.returnFLGbln = arrController.ReturnFLGbln; |
| | | results.detailsSummary = changeType1(arrController.detailsSummary); |
| | | results.consumableorderdetailsRecords = changeType1( |
| | | arrController.ConsumableorderdetailsRecords |
| | | ); |
| | | results.showGoodsofReturnList = changeType1( |
| | | arrController.ShowGoodsofReturnList |
| | | ); |
| | | results.consumableInventory = changeType1( |
| | | arrController.consumableInventory |
| | | ); |
| | | results.consumableorderdetailsRecordserror = changeType1( |
| | | arrController.ConsumableorderdetailsRecordserror |
| | | ); |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.result = 'Success'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = |
| | | e.getLineNumber() + |
| | | '---' + |
| | | e.getMessage() + |
| | | '---' + |
| | | e.getStackTraceString(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //到货确认 |
| | | @AuraEnabled |
| | | public static Results arriveGoodsConfim(String arrControllerStr) { |
| | | Results results = new Results(); |
| | | try { |
| | | ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize( |
| | | arrControllerStr, |
| | | ArriveGoodsController.class |
| | | ); |
| | | arrController.returnError = null; |
| | | arrController.warningList = new List<String>(); |
| | | arrController.errorList = new List<String>(); |
| | | Pagereference page = arrController.ArriveGoodsConfim(); |
| | | results.arrGoodCon = JSON.serialize(arrController); |
| | | if ( |
| | | arrController.returnError != null && |
| | | arrController.returnError != '' |
| | | ) { |
| | | results.result = 'Fail'; |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.errorMsg = arrController.returnError; |
| | | } else { |
| | | if (arrController.urlType == 'UnabletoEdit') { |
| | | results.url = '/lexarrivegsdetails?EsetId=' + arrController.arriveId; |
| | | } |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.result = 'Success'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //登录返品 |
| | | @AuraEnabled |
| | | public static Results updateGoodsOfReturn( |
| | | String arrControllerStr, |
| | | String showGoodsofReturnListStr |
| | | ) { |
| | | Results results = new Results(); |
| | | try { |
| | | List<ConsumableorderdetailsInfo> showGoodsofReturnList = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | showGoodsofReturnListStr, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize( |
| | | arrControllerStr, |
| | | ArriveGoodsController.class |
| | | ); |
| | | arrController.ShowGoodsofReturnList = changeType2(showGoodsofReturnList); |
| | | arrController.returnError = null; |
| | | arrController.warningList = new List<String>(); |
| | | arrController.errorList = new List<String>(); |
| | | Pagereference page = arrController.UpdateGoodsOfReturn(); |
| | | results.arrGoodCon = JSON.serialize(arrController); |
| | | if ( |
| | | arrController.returnError != null && |
| | | arrController.returnError != '' |
| | | ) { |
| | | results.result = 'Fail'; |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.errorMsg = arrController.returnError; |
| | | } else { |
| | | if (arrController.urlType == 'ToReturnGoodsPage') { |
| | | results.url = '/detail/' + arrController.return_Order_id; |
| | | } |
| | | if (arrController.urlType == 'ToInventoryGoodsPage') { |
| | | results.url = '/detail/' + arrController.inventory_Order_id; |
| | | } |
| | | results.errorMsgList = arrController.errorList; |
| | | results.warningMsgList = arrController.warningList; |
| | | results.result = 'Success'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> changeType1( |
| | | List<ArriveGoodsController.ConsumableorderdetailsInfo> conList |
| | | ) { |
| | | List<ConsumableorderdetailsInfo> conList1 = new List<ConsumableorderdetailsInfo>(); |
| | | if (conList != null) { |
| | | for (ArriveGoodsController.ConsumableorderdetailsInfo con : conList) { |
| | | ConsumableorderdetailsInfo con1 = new ConsumableorderdetailsInfo(); |
| | | con1.esd = con.esd; |
| | | con1.Prod = con.Prod; |
| | | con1.ProductName = con.ProductName; |
| | | con1.barCodeNo = con.barCodeNo; |
| | | con1.sterilizationlimitDate = con.sterilizationlimitDate; |
| | | con1.serialNoorLotNo = con.serialNoorLotNo; |
| | | con1.tracingCodeNo = con.tracingCodeNo; |
| | | con1.ReturnReason = con.ReturnReason; |
| | | con1.oldConsumableCount = con.oldConsumableCount; |
| | | con1.ErrorReason = con.ErrorReason; |
| | | con1.canEdit = con.canEdit; |
| | | con1.intMark = con.intMark; |
| | | con1.arriveAmount = con.arriveAmount; |
| | | con1.arrivedCount = con.arrivedCount; |
| | | con1.ReportProductExpirationDate = con.ReportProductExpirationDate; |
| | | conList1.add(con1); |
| | | } |
| | | } |
| | | return conList1; |
| | | } |
| | | |
| | | public static List<ArriveGoodsController.ConsumableorderdetailsInfo> changeType2( |
| | | List<ConsumableorderdetailsInfo> conList |
| | | ) { |
| | | List<ArriveGoodsController.ConsumableorderdetailsInfo> conList1 = new List<ArriveGoodsController.ConsumableorderdetailsInfo>(); |
| | | if (conList != null) { |
| | | for (ConsumableorderdetailsInfo con : conList) { |
| | | ArriveGoodsController.ConsumableorderdetailsInfo con1 = new ArriveGoodsController.ConsumableorderdetailsInfo(); |
| | | con1.esd = con.esd; |
| | | con1.Prod = con.Prod; |
| | | con1.ProductName = con.ProductName; |
| | | con1.barCodeNo = con.barCodeNo; |
| | | con1.sterilizationlimitDate = con.sterilizationlimitDate; |
| | | con1.serialNoorLotNo = con.serialNoorLotNo; |
| | | con1.tracingCodeNo = con.tracingCodeNo; |
| | | con1.ReturnReason = con.ReturnReason; |
| | | con1.oldConsumableCount = con.oldConsumableCount; |
| | | con1.ErrorReason = con.ErrorReason; |
| | | con1.canEdit = con.canEdit; |
| | | con1.intMark = con.intMark; |
| | | con1.arriveAmount = con.arriveAmount; |
| | | con1.arrivedCount = con.arrivedCount; |
| | | con1.ReportProductExpirationDate = con.ReportProductExpirationDate; |
| | | conList1.add(con1); |
| | | } |
| | | } |
| | | return conList1; |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String url; |
| | | @AuraEnabled |
| | | public String arrGoodCon; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public Boolean returnFLGbln; |
| | | @AuraEnabled |
| | | public Boolean saveFLGbln; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> detailsSummary; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> showGoodsofReturnList; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableInventory; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror; |
| | | @AuraEnabled |
| | | public List<String> errorMsgList; |
| | | @AuraEnabled |
| | | public List<String> warningMsgList; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | } |
| | | |
| | | 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; } |
| | | @AuraEnabled |
| | | public String ReportProductExpirationDate { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo() { |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo( |
| | | Consumable_order_details2__c e, |
| | | string str |
| | | ) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | ErrorReason = str; |
| | | intMark = 1; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | canEdit = false; |
| | | if (e.Box_Piece__c == '盒') { |
| | | e.Rrturn_count__c = 1; |
| | | canEdit = true; |
| | | } |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.name; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e, List<String> barinfoL) { |
| | | esd = new Consumable_order_details2__c(); |
| | | ProductName = e.Name__c; |
| | | Prod = e; |
| | | barCodeNo = barinfoL[0]; |
| | | if (String.isNotBlank(barinfoL[1])) { |
| | | sterilizationlimitDate = Date.valueOf(barinfoL[1]); |
| | | } |
| | | serialNoorLotNo = barinfoL[2]; |
| | | tracingCodeNo = barinfoL[3]; |
| | | ReturnReason = ''; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo( |
| | | Consumable_order_details2__c e, |
| | | List<String> barinfoL |
| | | ) { |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | barCodeNo = barinfoL[0]; |
| | | if (String.isNotBlank(barinfoL[1])) { |
| | | sterilizationlimitDate = Date.valueOf(barinfoL[1]); |
| | | } |
| | | serialNoorLotNo = barinfoL[2]; |
| | | tracingCodeNo = barinfoL[3]; |
| | | if (e.Report_Product_Expiration__c != null) { |
| | | ReportProductExpirationDate = e.Report_Product_Expiration__c.format(); |
| | | } |
| | | } |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | Prod = e; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| 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 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> |
| New file |
| | |
| | | public without sharing class LexConsumableController { |
| | | /*****************検索用******************/ |
| | | public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c のインスタンス、sql多すぎ |
| | | public static String category1 { get; set; } |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static String category_Goods { get; set; } |
| | | public static Boolean specialCampaign { get; set; } |
| | | public static Boolean cansee { get; set; } |
| | | //经销商合同名称 |
| | | public static String contractName { get; set; } |
| | | //经销商合同ID |
| | | public static String contractId { get; set; } |
| | | //经销商定价查看权限 |
| | | public static Boolean dealerPricesee { get; set; } |
| | | /*****************画面初始化用********************************/ |
| | | /******20160313_add**************/ |
| | | //public String idCheck {get;set;} |
| | | public static Boolean editAble { get; set; } |
| | | public static Boolean edoffersPrice { get; set; } |
| | | public static String statusEdit { get; set; } |
| | | public static Boolean returnOrder { get; set; } |
| | | public static String searchDone { get; set; } |
| | | //暂用20160323 |
| | | public static Decimal disCount = 0; |
| | | //总价格计算结果 |
| | | public static Decimal sumPrice { get; set; } |
| | | //自定义特价金额 |
| | | public static Decimal bargainPrice { get; set; } |
| | | //产品上下限 |
| | | public static String[] proLimitAndDate = new List<String>{}; |
| | | /*****************画面表示Bean******************/ |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; } |
| | | public static Integer ConsumableorderdetailsCount { |
| | | get { |
| | | return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size(); |
| | | } |
| | | } |
| | | public static Integer ConsumableorderdetailsviewCount { |
| | | get { |
| | | return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size(); |
| | | } |
| | | } |
| | | public static List<String> lower = new List<String>(); |
| | | //附件 |
| | | public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; } |
| | | public static List<String> DealerProductId { get; set; } |
| | | public static Boolean editDelCommitBtnDisabled { get; private set; } |
| | | public static Boolean saveBtnDisabled { get; private set; } |
| | | public static Boolean sorderBtnDisabled { get; private set; } |
| | | public static String decisionCode { get; set; } |
| | | // 保存后动作: 1.检索 2.排序 |
| | | public static String baseUrl { get; private set; } |
| | | public static String sortKey { get; set; } |
| | | public static String preSortKey { get; private set; } |
| | | public static Boolean sortOrderAsc { get; private set; } |
| | | public static String[] sortOrder { get; private set; } |
| | | private static List<String> contactDealer = new List<String>(); |
| | | private static String[] columus = new List<String>{ |
| | | 'Consumable_Product__r.Name', |
| | | 'Consumable_Product__r.Asset_Model_No__c', |
| | | 'Consumable_Product__r.Intra_Trade_List_RMB__c', |
| | | '', |
| | | '', |
| | | 'Consumable_Product__r.Category3__c', |
| | | 'Consumable_Product__r.Category4__c', |
| | | 'Consumable_Product__r.Category5__c' |
| | | }; |
| | | private static String[] columus_no = new List<String>{ |
| | | 'Product2__c.Name', |
| | | 'Product2__c.Asset_Model_No__c', |
| | | 'Product2__c.Intra_Trade_List_RMB__c', |
| | | '', |
| | | '', |
| | | 'Category3__c', |
| | | 'Category4__c', |
| | | 'Category5__c' |
| | | }; |
| | | // 已选择产品明细 |
| | | private static List<Attachment> attachmentinfo = new List<Attachment>(); |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | private static String cate1ForSort = null; |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | // 产品 ID |
| | | public static String ESetId { get; set; } |
| | | private static String userId = ''; |
| | | //private String[] ProidListAll = new String[]{}; |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | public static List<CusOption> category3Option { get; set; } |
| | | public static List<CusOption> category4Option { get; set; } |
| | | public static List<CusOption> category5Option { get; set; } |
| | | private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>(); |
| | | public static List<String> orderzaikuId = new List<String>(); |
| | | //分页功能 |
| | | public static Integer size { get; set; } |
| | | public static Integer pageLimit { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | public static ApexPages.StandardSetController con { get; set; } |
| | | public static String soql { get; set; } |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | public static String agencyProType { get; set; } |
| | | public static String agencyProType1 {get;set;} //lt 20230526 安徽两票制 add |
| | | private static Boolean OSHFLG;//lt 20230517 安徽两票制 add |
| | | public static String methodType { get; set; } |
| | | public static String hospitalName { get; set; } |
| | | public static String hospitalId { get; set; } |
| | | public static String tempidHp { get; set; } |
| | | public static String tempidPp { get; set; } |
| | | private static List<String> hpids = new List<String>(); |
| | | private static Boolean isfirst = false; |
| | | //报错和警告信息 |
| | | public static List<String> errorMsgList = new List<String>(); |
| | | public static List<String> warningMsgList = new List<String>(); |
| | | //构造方法 |
| | | public LexConsumableController() { |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | DealerProductId = new List<String>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | editAble = false; |
| | | edoffersPrice = false; |
| | | returnOrder = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | } |
| | | |
| | | private static void initStandardController() { |
| | | con = new ApexPages.StandardSetController(Database.getQueryLocator(soql)); |
| | | con.setPageSize(size); |
| | | noOfRecords = con.getResultSize(); |
| | | } |
| | | |
| | | public static List<Product2__c> product2s() { |
| | | return (List<Product2__c>) con.getRecords(); |
| | | } |
| | | |
| | | private static List<ConsumableorderdetailsInfo> getPageInfo() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | selectedIdMap.put(ass.Prod.id, ass.Prod.id); |
| | | reSet.add(ass); |
| | | } |
| | | } |
| | | |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble) { |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | | //consumableorderdetailsRecords[i].esd.Dealer_Custom_Price__c = consumableorderdetailsRecords[i].Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | // if (addNo >= size) |
| | | // break; |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init(String type, String esetId, String keywordStr) { |
| | | Results results = new Results(); |
| | | results.isNoteStay = LexUtility.getIsNoteStay(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | DealerProductId = new List<String>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | editAble = false; |
| | | edoffersPrice = false; |
| | | returnOrder = false; |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | ESetId = esetId; |
| | | methodType = type; |
| | | if(String.isBlank(methodType) && String.isNotBlank(ESetId)){ |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | methodType = oclist.get(0).orderPattern__c; |
| | | } |
| | | statusEdit = keywordStr; |
| | | System.debug('Param:'+ESetId+'---'+methodType+'---'+statusEdit); |
| | | try { |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[8]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | cate1ForSort = ''; |
| | | decisionCode = ''; |
| | | sumPrice = 0; |
| | | specialCampaign = false; |
| | | if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) { |
| | | editAble = false; |
| | | } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | | agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 安徽两票制 add |
| | | //lt 20230526 安徽两票制 start |
| | | OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add |
| | | if(OSHFLG){ |
| | | agencyProType1 = 'OSH'; |
| | | } |
| | | else if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | agencyProType1 = 'ET'; |
| | | } |
| | | //lt 20230526 安徽两票制 end |
| | | if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | //错误信息提示 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您没有订货医院特价产品的权限!')); |
| | | errorMsgList.add('您没有订货医院特价产品的权限!'); |
| | | } |
| | | contactDealer = new List<String>(); |
| | | Date dateToday = Date.today(); |
| | | //查该经销商下所有有效合同 |
| | | List<Account> contractList = [ |
| | | SELECT Id, Name, RecordType.DeveloperName |
| | | FROM Account |
| | | WHERE |
| | | RecordType.DeveloperName = 'AgencyContract' |
| | | AND Contract_Decide_Start_Date__c <= :dateToday |
| | | AND Contract_Decide_End_Date__c >= :dateToday |
| | | and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | for (Account contract : contractList) { |
| | | contactDealer.add(contract.Id); |
| | | } |
| | | DealerProductMap = new Map<Id, Dealer_Product__c>(); |
| | | DealerProductId = getDealerProductId(); |
| | | Account accountInfo = [ |
| | | SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c |
| | | FROM account |
| | | WHERE id = :accountid |
| | | ]; |
| | | accountName = accountInfo.Name; |
| | | String product_Limit; |
| | | if (agencyProType == 'ET') { |
| | | product_Limit = accountInfo.Product_Limit_Date__c; |
| | | } else { |
| | | product_Limit = accountInfo.Product_Limit_DateENG__c; |
| | | } |
| | | if (product_Limit != null && product_Limit != '') { |
| | | proLimitAndDate = product_Limit.split(','); |
| | | } |
| | | saveBtnDisabled = false; |
| | | sorderBtnDisabled = false; |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | if (String.isBlank(agencyProType)) { |
| | | //return ; |
| | | } |
| | | List<Product2__c> Product2Selected = new List<Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //经销商在库数据 |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | if (ESetId == null || ESetId == '') { |
| | | //获取经销商默认的一个合同 |
| | | List<Account> contract = [ |
| | | SELECT id, Name, State_Master__c, State_Master__r.Name |
| | | FROM Account |
| | | WHERE |
| | | ParentId = :accountid |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() == 1) { |
| | | contractName = contract[0].Name; |
| | | contractId = contract[0].Id; |
| | | } |
| | | editDelCommitBtnDisabled = true; |
| | | List<String> DealerProductId = new List<String>(); |
| | | soql = makeSoql('', '', '', '', '', false, DealerProductId); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //只有在协议订货时会走这个for循环 其他两种订货模式都走的searchorderdetails方法 |
| | | if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //经销商定价 计算 |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) { |
| | | searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble); |
| | | isfirst = true; |
| | | } |
| | | getPageInfo(); |
| | | } else { |
| | | if (methodType != null && methodType.equals('hospitalorder')) { |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | | if (oclist.get(0).orderPattern__c.equals('hospitalorder')) { |
| | | hospitalName = oclist.get(0).Order_ForHospital__r.Name; |
| | | hospitalId = oclist.get(0).Order_ForHospital__c; |
| | | } |
| | | } |
| | | List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>(); |
| | | //修改 |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | qs = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Order_status__c, |
| | | Consumable_pdf_insert_day__c, |
| | | Dealer_Info__c, |
| | | Deliver_date__c, |
| | | Order_Reason__c, |
| | | Order_date__c, |
| | | Contract_application_decision__c, |
| | | Total_amount__c, |
| | | Offers_Price__c, |
| | | Order_effective_contact__c, |
| | | Order_effective_contact__r.Name |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | coc = qs[0]; |
| | | decisionCode = coc.Contract_application_decision__c; |
| | | contractName = coc.Order_effective_contact__r.Name; |
| | | contractId = coc.Order_effective_contact__r.Id; |
| | | } |
| | | if (qs[0].Order_status__c == '已提交' || qs[0].Order_status__c == '批准' || qs[0].Order_status__c == '附件上传完成') { |
| | | saveBtnDisabled = true; |
| | | sorderBtnDisabled = true; |
| | | editDelCommitBtnDisabled = false; |
| | | } |
| | | // 選択済みの明细を取得 |
| | | ConsumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Count__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Sum_of_money__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Product2__r.Packing_list_manual__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | recordtypeid = :System.Label.RT_ConOrderDetail1_Order |
| | | AND Consumable_order__c = :ESetId |
| | | AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | if(cdc1.Consumable_Product__c != null){ |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | } |
| | | } |
| | | soql = makeSoqlorderdet(); |
| | | System.debug('soql:'+soql); |
| | | size = orderzaikuId.size(); |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //add by rentx 2020-12-09 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Sum_of_money__c; |
| | | if (ass.prod.Id == cdc1.Consumable_Product__c) { |
| | | ass.check = true; |
| | | ass.esd = cdc1; |
| | | } |
| | | } |
| | | } |
| | | //附件 |
| | | // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId]; |
| | | // if (attachmentinfo.size() > 0) { |
| | | // for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<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(); |
| | | } |
| | | //计算库存上、下限 |
| | | productLimtAndDate(); |
| | | lowerRecord(); |
| | | //明细排序 |
| | | List<String> upper = new List<String>(); |
| | | if (String.isNotBlank(ESetid)) { |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if(bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null){ |
| | | if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) { |
| | | upper.add(bss.esd.Consumable_Product__r.Name__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (upper.size() > 0) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '存在以下产品订货数量超出库存上限!')); |
| | | warningMsgList.add('存在以下产品订货数量超出库存上限!'); |
| | | for (Integer i = 0; i < upper.size(); i++) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, upper[i])); |
| | | warningMsgList.add(upper[i]); |
| | | } |
| | | } |
| | | if (lower.size() > 0) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '存在以下产品订货数量低于库存下限!')); |
| | | warningMsgList.add('存在以下产品订货数量低于库存下限!'); |
| | | for (Integer i = 0; i < lower.size(); i++) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, lower[i])); |
| | | warningMsgList.add(lower[i]); |
| | | } |
| | | } |
| | | //价格查看权限 |
| | | Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe(); |
| | | cansee = dfr.isAccessible(); |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | //categoty3 |
| | | // categoryOptionList = new List<SelectOption>(); |
| | | category3Option = new List<CusOption>(); |
| | | // categoryOptionList.add(new SelectOption('', '-无-')); |
| | | category3Option.add(new CusOption('-无-','')); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | category3Option.add(new CusOption(deliverycnt,deliverycnt)); |
| | | } |
| | | //categoty4 |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-','')); |
| | | //categoty5 |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-','')); |
| | | //return msg |
| | | consumableorderdetailsRecordsview = consumableorderdetailsRecords; |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.coc = coc; |
| | | results.editAble = editAble; |
| | | results.edoffersPrice = edoffersPrice; |
| | | results.editDelCommitBtnDisabled = EditDelCommitBtnDisabled; |
| | | results.category3Option = category3Option; |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.hospitalName = hospitalName; |
| | | results.contractName = contractName; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.attachmentRecoeds = attachmentRecoeds; |
| | | results.cansee = cansee; |
| | | results.agencyProType = agencyProType; |
| | | results.agencyProType1 = agencyProType1; |
| | | results.OSHFLG = OSHFLG; |
| | | results.userWorkLocation = userWorkLocation; |
| | | results.accountName = accountName; |
| | | results.category_Goods = category_Goods; |
| | | results.specialCampaign = specialCampaign; |
| | | results.dealerProductId = DealerProductId; |
| | | results.accountid = accountid; |
| | | results.hospitalId = hospitalId; |
| | | results.contractId = contractId; |
| | | results.contactDealer = contactDealer; |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | results.methodType = methodType; |
| | | results.proLimitAndDate = proLimitAndDate; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryAllload(String agencyProTypeStr, String category3Str){ |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | | try { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4Option.add(new CusOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5Option.add(new CusOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str){ |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | | category4 = category4Str; |
| | | try { |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c != NULL |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | // category4OptionList = new List<SelectOption>(); |
| | | category4Option = new List<CusOption>(); |
| | | // category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4Option.add(new CusOption(deliverycnt4, deliverycnt4)); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c = :category3 |
| | | AND Category4_text__c = :category4 |
| | | AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | // category5OptionList = new List<SelectOption>(); |
| | | category5Option = new List<CusOption>(); |
| | | // category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5Option.add(new CusOption('-无-', '')); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5Option.add(new CusOption(deliverycnt5, deliverycnt5)); |
| | | } |
| | | results.category4Option = category4Option; |
| | | results.category5Option = category5Option; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | public static void lowerRecord() { |
| | | List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>(); |
| | | //库存明细取得 |
| | | Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>(); |
| | | List<Product2__c> product2Selected = [ |
| | | SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c |
| | | FROM Product2__c |
| | | WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '○' |
| | | ]; |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | //先把ConsumableorderdetailsRecords 做成map |
| | | midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Guarantee_period_for_products__c, |
| | | Isoverdue__c, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | //AND Consumable_order_minor__r.Dealer_Info__c = :accountid |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //add by rentx 2020-12-09 |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | lowerRecord = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : midMaprecord.values()) { |
| | | lowerRecord.add(bss); |
| | | } |
| | | allProductLimt(lowerRecord); |
| | | for (ConsumableorderdetailsInfo bss : lowerRecord) { |
| | | if (bss.allnumber < bss.lowerlimit) { |
| | | lower.add(bss.Prod.Name__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //库存上下限 |
| | | public static void productLimtAndDate() { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //全部库存上下限 |
| | | private static void allProductLimt(List<ConsumableorderdetailsInfo> lowerRecord) { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | | nowName = proLimitAndDate[i]; |
| | | if (nowName.indexOf('|') >= 0) { |
| | | nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|')); |
| | | nowName = nowName.subString(nowName.indexOf('|') + 1); |
| | | } |
| | | productLimt.put(nowRightAsstModelNo, nowName); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : lowerRecord) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results searchConsumableorderdetails( |
| | | String userWorkLocationStr, |
| | | String agencyProTypeStr, |
| | | String accountNameStr, |
| | | String accountIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String category1Str, |
| | | String category3Str, |
| | | String category4Str, |
| | | String category5Str, |
| | | String category_GoodStr, |
| | | Boolean specialCampaignStr, |
| | | String dealerProductIdStr, |
| | | String methodTypeStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | Boolean editAbleStr, |
| | | List<String> proLimitAndDateList |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | userWorkLocation = userWorkLocationStr; |
| | | agencyProType = agencyProTypeStr; |
| | | accountName = accountNameStr; |
| | | accountid = accountIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | category1 = category1Str; |
| | | category3 = category3Str; |
| | | category4 = category4Str; |
| | | category5 = category5Str; |
| | | category_Goods = category_GoodStr; |
| | | specialCampaign = specialCampaignStr; |
| | | methodType = methodTypeStr; |
| | | editAble = editAbleStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | try { |
| | | searchDone = 'searchDone'; |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | //add by rentx 2020-12-09 |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | //add by rentx 2020-12-09 |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | System.debug('soql:'+soql); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | | Jstage.allnumber_piece = Jstage.allnumber_piece + 1; |
| | | } |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecordsa0l0l0000000byXAAQ |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | productLimtAndDate(); |
| | | getPageInfo(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', '', '', '', '', '' }; |
| | | cate1ForSort = category1; |
| | | // 显示数据条数信息 |
| | | // makeMessage(); |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | if(consumableorderdetailsRecords.size() > 0){ |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品'; |
| | | }else { |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Fail'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //医院--检索 |
| | | @AuraEnabled |
| | | public static Results searchorderdetails( |
| | | String methodTypeStr, |
| | | String accountIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String userWorkLocationStr, |
| | | String accountNameStr, |
| | | List<String> proLimitAndDateList, |
| | | Boolean editAbleStr |
| | | ){ |
| | | Results results = new Results(); |
| | | methodType = methodTypeStr; |
| | | accountId = accountIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | userWorkLocation = userWorkLocationStr; |
| | | accountName = accountNameStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | editAble = editAbleStr; |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | try { |
| | | soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | if (methodType.equals('hospitalorder')) { |
| | | //医院id 有值 |
| | | List<hospitalprice__c> hplist = [ |
| | | SELECT id, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid AND hospital__c = :hospitalId |
| | | ]; |
| | | if (hplist != null && hplist.size() > 0) { |
| | | List<String> hpids = new List<String>(); |
| | | for (hospitalprice__c hc : hplist) { |
| | | hpids.add(hc.product__c); |
| | | } |
| | | |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该医院下没有符合医院特价的产品 |
| | | soql += ' AND Id = null '; |
| | | } |
| | | } else if (methodType.equals('promotionorder')) { |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | | String ids = '('; |
| | | for (Dealer_Product__c hc : dpclist) { |
| | | hpids.add(hc.Dealer_Product2__c); |
| | | ids += '\'' + hc.Dealer_Product2__c + '\','; |
| | | } |
| | | ids = ids.substring(0, ids.length() - 1) + ')'; |
| | | if (hpids != null && hpids.size() > 0) { |
| | | // soql += ' AND Id in : hpids '; |
| | | soql += ' AND Id in ' + ids; |
| | | } |
| | | } else { |
| | | //该经销商下没有促销价格的产品 |
| | | soql += ' AND Id = null '; |
| | | } |
| | | } |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | hospitalSpecialOffer__c, |
| | | promotionorder__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | //AND Consumable_order_minor__r.Dealer_Info__c = :accountid |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if (methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改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; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if (methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | //然后循环CountDel去修改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; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecordsa0l0l0000000byXAAQ |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | productLimtAndDate(); |
| | | getPageInfoForHos(); |
| | | sortKey = '1'; |
| | | preSortKey = '1'; |
| | | sortOrderAsc = false; |
| | | sortOrder = new String[7]; |
| | | sortOrder = new List<String>{ ' ', ' ', ' ', '', '', '', '', '' }; |
| | | cate1ForSort = category1; |
| | | // 显示数据条数信息 |
| | | noOfRecords = consumableorderdetailsRecords.size(); |
| | | getConsumableShowTableFieldValue(); |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | if(consumableorderdetailsRecordsview.size() > 0){ |
| | | results.result = 'Success'; |
| | | results.errorMsg = '共搜索到'+consumableorderdetailsRecordsview.size()+'条数据'; |
| | | }else { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | | } |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //用户切换医院时取消选中的产品 |
| | | private static List<ConsumableorderdetailsInfo> getPageInfoForHos() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble) { |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | | //continue; |
| | | } |
| | | // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) { |
| | | // break; |
| | | // } |
| | | else { |
| | | if (consumableorderdetailsRecords[i].check == false) { |
| | | consumableorderdetailsRecords[i].esd = orderdetails1; |
| | | } |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]); |
| | | addNo++; |
| | | } |
| | | // if (addNo >= size){ |
| | | // break; |
| | | // } |
| | | } |
| | | return consumableorderdetailsRecordsview; |
| | | } |
| | | //add by rentx 2020-12-03 end ===================================================================================================================== |
| | | //特价 |
| | | public static void OffersPrice() { |
| | | edoffersPrice = true; |
| | | } |
| | | |
| | | //得到促销产品Id |
| | | private static List<String> getDealerProductId() { |
| | | List<String> ProductId = new List<String>(); |
| | | Map<String, String> DealerProductIdMap = new Map<String, String>(); |
| | | Date dateToday = Date.today(); |
| | | List<Dealer_Product__c> DealerProductList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | OrderGoods_Limit__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c IN :contactDealer |
| | | AND Campaign_StartDate__c <= :dateToday |
| | | AND Campaign_EndDate__c >= :dateToday |
| | | AND Special_Campaign_Price__c != NULL |
| | | ]; |
| | | for (Dealer_Product__c dealerProduct : DealerProductList) { |
| | | if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) { |
| | | continue; |
| | | } else { |
| | | ProductId.add(dealerProduct.Dealer_Product2__c); |
| | | DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | return ProductId; |
| | | } |
| | | |
| | | private static String makeSoql( |
| | | String CateName, |
| | | String CateCode, |
| | | String Category3, |
| | | String Category4, |
| | | String Category5, |
| | | Boolean specialCampaign, |
| | | List<String> DealerProductId |
| | | ) { |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | // add begin ================================================================================================ |
| | | if (methodType != null && methodType.equals('hospitalorder')) { |
| | | //如果是医院特价 |
| | | //1.判断 医院id是否有值 如果有值 则根据医院id去 医院特价表中获取产品id |
| | | //医院id 有值 |
| | | if (hospitalId == null || hospitalId == '') { |
| | | soql += ' and id = null '; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '请选择医院')); |
| | | warningMsgList.add('请选择医院'); |
| | | } else { |
| | | List<hospitalprice__c> hplist = [ |
| | | SELECT id, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid AND hospital__c = :hospitalId |
| | | ]; |
| | | if (hplist != null && hplist.size() > 0) { |
| | | hpids = new List<String>(); |
| | | for (hospitalprice__c hc : hplist) { |
| | | hpids.add(hc.product__c); |
| | | } |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该医院下没有符合医院特价的产品 |
| | | soql += ' AND Id = null '; |
| | | return soql; |
| | | } |
| | | } |
| | | } |
| | | //促销订货 |
| | | if (methodType != null && methodType.equals('promotionorder')) { |
| | | if (contractId == null || contractId == '') { |
| | | soql += ' and id = null '; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '请选择合同')); |
| | | warningMsgList.add('请选择合同'); |
| | | } else { |
| | | //1.查询所有经销商产品 |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | | hpids = new List<String>(); |
| | | for (Dealer_Product__c hc : dpclist) { |
| | | hpids.add(hc.Dealer_Product2__c); |
| | | } |
| | | if (hpids != null && hpids.size() > 0) { |
| | | soql += ' AND Id in : hpids '; |
| | | } |
| | | } else { |
| | | //该经销商下没有促销价格的产品 |
| | | soql += ' AND Id = null '; |
| | | return soql; |
| | | } |
| | | } |
| | | } |
| | | //add end =================================================================================================== |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | if (agencyProType == 'ET') { |
| | | soql += ' AND Pro2_Dealer_Object__c = true'; |
| | | } |
| | | if (agencyProType == 'ENG') { |
| | | soql += ' AND Pro2_Dealer_ENG__c = true'; |
| | | } |
| | | soql += ' AND Intra_Trade_List_RMB__c > 0 '; |
| | | System.debug('soql +++++++++++ ' + soql); |
| | | return soql; |
| | | } |
| | | |
| | | private static String makeSoqlorderdet() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderzaikuId.size(); i++) { |
| | | if (i < orderzaikuId.size() - 1) { |
| | | sqlTail += orderzaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderzaikuId[i] + '\')'; |
| | | } |
| | | } |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' '; |
| | | System.debug('sqlTail:'+sqlTail); |
| | | System.debug('orderzaikuId:'+orderzaikuId); |
| | | if (orderzaikuId.size() > 0) { |
| | | soql += ' AND Id in' + sqlTail; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | // 编辑按钮 |
| | | @AuraEnabled |
| | | public static Results setEditAble(String eSetidStr){ |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 再申请 |
| | | @AuraEnabled |
| | | public static Results backOrder(String eSetidStr) { |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | statusEdit = 'Redirect'; |
| | | returnOrder = true; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //上传附件 |
| | | @AuraEnabled |
| | | public static Results filesUpload(String pId, String fileName, String base64Data) { |
| | | Results results = new Results(); |
| | | try { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = pId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId]; |
| | | c.Consumable_pdf_insert_day__c = Date.today(); |
| | | update c; |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //删除按钮 |
| | | @AuraEnabled |
| | | public static Results delConsumable(String eSetidStr){ |
| | | Results results = new Results(); |
| | | ESetId = eSetidStr; |
| | | try { |
| | | Consumable_order__c cord = new Consumable_order__c(Id = ESetId); |
| | | List<Consumable_Orderdetails__c> orderdetails1 = [ |
| | | SELECT Id |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :EsetId |
| | | ]; |
| | | delete orderdetails1; |
| | | delete cord; |
| | | results.result = 'Success'; |
| | | results.url = '/lexconsumableordermanage'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 提交按钮 |
| | | @AuraEnabled |
| | | public static Results sorder(String eSetidStr,String accountidStr){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | ESetId = eSetidStr; |
| | | accountid = accountidStr; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | Map<Id, String> prodMap = new Map<Id, String>(); |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | P = new Consumable_order__c(); |
| | | p.Id = ESetId; |
| | | p.Order_date__c = Date.today(); |
| | | p.Order_status__c = '附件上传完成'; |
| | | for (Consumable_Orderdetails__c cod1 : [ |
| | | SELECT Consumable_product__r.Product2__c, Consumable_product__r.Name__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]) { |
| | | prodMap.put(cod1.Consumable_product__r.Product2__c, cod1.Consumable_product__r.Name__c); |
| | | } |
| | | // GZW 提交产品无效 出错误消息 |
| | | System.debug(prodMap); |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, ''); |
| | | System.debug(chkMap); |
| | | if (chkMap.size() > 0) { |
| | | if (chkMap.containsKey('agency')) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '第一经销商没有有效的医疗器械经营许可证。')); |
| | | errorMsgList.add('第一经销商没有有效的医疗器械经营许可证。'); |
| | | } |
| | | for (String proId : prodMap.keySet()) { |
| | | if (chkMap.containsKey(proId)) { |
| | | if (chkMap.get(proId) == '1') { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 没有有效的注册证。') |
| | | // ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 没有有效的注册证。'); |
| | | } else if (chkMap.get(proId) == '2') { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。') |
| | | // ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。'); |
| | | } |
| | | } |
| | | } |
| | | results.result = 'Fail'; |
| | | results.errorMsg = ''; |
| | | results.errorMsgList = errorMsgList; |
| | | results.warningMsgList = warningMsgList; |
| | | return results; |
| | | } |
| | | update p; |
| | | Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); |
| | | psr.setObjectId(ESetId); |
| | | Approval.ProcessResult submitResult = Approval.process(psr); |
| | | results.result = 'Success'; |
| | | results.url = '/lexconsumableordermanage'; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | // 驳回订单copy |
| | | @AuraEnabled |
| | | public static Results ordrCopy( |
| | | String contractNameStr, |
| | | String cocStr, |
| | | String agencyProTypeStr, |
| | | String accountidStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ) { |
| | | ESetId = ''; |
| | | return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr); |
| | | } |
| | | |
| | | //保存按钮 |
| | | @AuraEnabled |
| | | public static Results save( |
| | | String contractNameStr, |
| | | String cocStr, |
| | | String agencyProTypeStr, |
| | | String accountidStr, |
| | | String consumableorderdetailsRecordsviewStr, |
| | | String contactDealerStr, |
| | | String methodTypeStr, |
| | | String eSetIdStr, |
| | | String hospitalIdStr, |
| | | String contractIdStr, |
| | | String agencyProType1Str, |
| | | Boolean OSHFLGStr |
| | | ){ |
| | | Results results = new Results(); |
| | | errorMsgList = new List<String>(); |
| | | warningMsgList = new List<String>(); |
| | | contractName = contractNameStr; |
| | | agencyProType = agencyProTypeStr; |
| | | accountid = accountidStr; |
| | | methodType = methodTypeStr; |
| | | ESetId = eSetIdStr; |
| | | hospitalId = hospitalIdStr; |
| | | contractId = contractIdStr; |
| | | agencyProType1 = agencyProType1Str; |
| | | OSHFLG = OSHFLGStr; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | if(coc.Offers_Price__c != null){ |
| | | String offerStr = String.valueOf(coc.Offers_Price__c); |
| | | bargainPrice = Decimal.valueOf(offerStr.replace(',','')); |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | if (String.isEmpty(contractName)) { |
| | | // coc.Order_effective_contact__c.addError('请选择合同'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请选择合同'; |
| | | return results; |
| | | } |
| | | List<Account> contract = [ |
| | | SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c |
| | | FROM account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Agent_Ref__c =:accountid |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (contract.size() <= 0) { |
| | | // coc.Order_effective_contact__c.addError('不存在的合同,请重新确认。'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '不存在的合同,请重新确认。'; |
| | | return results; |
| | | } else { |
| | | if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) { |
| | | // coc.Order_effective_contact__c.addError('合同无效,请重新确认。'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '合同无效,请重新确认。'; |
| | | return results; |
| | | } |
| | | } |
| | | Integer FLG = 0; |
| | | Integer Count = 0; |
| | | //add by rentx 2020-11-25 |
| | | List<String> tpids = new List<String>(); |
| | | //add by rentx 2020-11-25 |
| | | for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) { |
| | | FLG = FLG + 1; |
| | | if (CheckCount.check == false) { |
| | | Count = Count + 1; |
| | | } |
| | | if (CheckCount.check == true) { |
| | | //add by rentx 2020-11-25 |
| | | tpids.add(CheckCount.Prod.Id); |
| | | //add by rentx 2020-11-25 |
| | | if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } |
| | | if ( |
| | | CheckCount.orderGoods_Limit > 0 && |
| | | math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0 |
| | | ) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入促销数量的倍数'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入促销数量的倍数'; |
| | | return results; |
| | | } |
| | | } |
| | | } |
| | | if (Count == FLG) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请选择所需消耗品'; |
| | | return results; |
| | | } |
| | | //=======================================医院特价,有金额的话取金额 |
| | | Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>(); |
| | | List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c |
| | | from hospitalprice__c |
| | | where product__c in :tpids and mPrice__c <> null and account__c=:accountid |
| | | ]; |
| | | for (hospitalprice__c dealerProduct : hplist) { |
| | | if (dealerProduct.mPrice__c != null) { |
| | | dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c); |
| | | } |
| | | } |
| | | //促销订货 根据经销商产品中的数据计算金额 |
| | | //=======================================产品特殊折扣 |
| | | Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>(); |
| | | Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>(); |
| | | //1.获取有开始结束日的产品 |
| | | Date dateToday = Date.today(); |
| | | List<Dealer_Product__c> haveDateList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | OrderGoods_Limit__c, |
| | | Special_Discount__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c IN :contactDealer |
| | | AND Campaign_StartDate__c <= :dateToday |
| | | AND Campaign_EndDate__c >= :dateToday |
| | | AND (Special_Discount__c != NULL |
| | | OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | //2.获取没有开始结束日的产品 |
| | | List<Dealer_Product__c> DealerProductList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Dealer_Product2__c, |
| | | Special_Campaign_Price__c, |
| | | Campaign_StartDate__c, |
| | | Campaign_EndDate__c, |
| | | Dealer_Contact__c, |
| | | Special_Discount__c, |
| | | OrderGoods_Limit__c |
| | | FROM Dealer_Product__c |
| | | WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | for (Dealer_Product__c dealerProduct : DealerProductList) { |
| | | //如果促销价格为null 则设置特殊折扣(百分比)到集合 |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | } |
| | | } |
| | | //这样做是为了计算促销价格时 优先计算促销开始结束日不为空的产品 |
| | | //如果该集合有值 则说明需要根据当前的金额或者折扣来计算 |
| | | if (haveDateList != null && haveDateList.size() > 0) { |
| | | for (Dealer_Product__c dealerProduct : haveDateList) { |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | } |
| | | //=======================================经销商合同折扣 |
| | | List<Account> at = [ |
| | | SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c |
| | | FROM Account |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | if (at.size() > 0 && at[0].Dealer_discount__c != null) { |
| | | disCount = at[0].Dealer_discount__c; |
| | | } else { |
| | | disCount = 100; |
| | | } |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_Orderdetails__c> Ins = new List<Consumable_Orderdetails__c>(); |
| | | //新建订单时 |
| | | if (String.isBlank(ESetId)) { |
| | | Integer i = 1; |
| | | Integer Roll = 0; |
| | | p.Name = '*'; |
| | | p.Order_status__c = '草案中'; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | p.Offers_Price__c = coc.Offers_Price__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.Order_effective_contact__c = contract[0].Id; |
| | | p.Order_Reason__c = coc.Order_Reason__c; |
| | | p.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | p.Overrule_order__c = coc.Id; |
| | | if (String.isNotBlank(methodType)) { |
| | | p.orderPattern__c = methodType; |
| | | } |
| | | insert p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | Roll = Roll + 1; |
| | | if (ass.check == true) { |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } else { |
| | | Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c(); |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = Consumable_order[0].Name + '-' + str; |
| | | InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c; |
| | | InsAfterDel.Consumable_order__c = p.id; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Box_Piece__c = '盒'; |
| | | //协议订货 |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | //=====================================================================================update by rentx 2020-11-25 |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | //如果促销价格不为null 则直接使用促销价格来计算金额 |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | | 100; |
| | | system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | } |
| | | //=====================================================================================update by rentx 2020-11-25 |
| | | } else if (methodType.equals('hospitalorder')) { |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | ESetId = p.id; |
| | | if (Consumable_order.size() > 0) { |
| | | update Consumable_order; |
| | | } |
| | | } |
| | | //修改之后 保存订单 |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } else { |
| | | //修改,获取消耗品订单 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT Id, Name, Order_status__c, Dealer_Info__c, Deliver_date__c, Order_Reason__c, Offers_Price__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.Name = coc.Name; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.Order_effective_contact__c = contract[0].Id; |
| | | p.Order_Reason__c = coc.Order_Reason__c; |
| | | if (bargainPrice != null) { |
| | | p.Offers_Price__c = bargainPrice; |
| | | } |
| | | update p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>(); |
| | | qs = [ |
| | | SELECT Id |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c(); |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | | return results; |
| | | } else { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = Consumable_order[0].Name + '-' + str; |
| | | InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c; |
| | | InsAfterDel.Consumable_order__c = ESetId; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Box_Piece__c = '盒'; |
| | | //协议订货 |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | | 100; |
| | | } |
| | | } else if (methodType.equals('hospitalorder')) { |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | // ==================================================之前的促销订货的逻辑 |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | } |
| | | results.result = 'Success'; |
| | | results.eSetId = ESetId; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber() + '---' + e.getMessage(); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | //删除附件 |
| | | @AuraEnabled |
| | | public static Results deleteAtt(String contentVersionId){ |
| | | 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 oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c esd { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Integer packing_list { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber_piece { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public ContentVersion Concc { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Decimal upperlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal lowerlimit { get; set; } |
| | | @AuraEnabled |
| | | public Decimal SpecialCampaignPrice { get; set; } |
| | | @AuraEnabled |
| | | public Decimal orderGoods_Limit { get; set; } |
| | | @AuraEnabled |
| | | public Date Campaign_EndDate { get; set; } |
| | | @AuraEnabled |
| | | public String recordId { get; set; } |
| | | @AuraEnabled |
| | | public String prodName { get; set; } |
| | | @AuraEnabled |
| | | public String prodSFDAStatus { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory3 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory4 { get; set; } |
| | | @AuraEnabled |
| | | public String prodCategory5 { get; set; } |
| | | @AuraEnabled |
| | | public Decimal prodIntraTradeList { get; set; } |
| | | @AuraEnabled |
| | | public Decimal consumableCount { get; set; } |
| | | |
| | | |
| | | // 已存产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | esd = e; |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.Consumable_Count__c; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | allnumber_piece = 0; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | esd = new Consumable_Orderdetails__c(); |
| | | Prod = e; |
| | | oldConsumableCount = null; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | allnumber_piece = 0; |
| | | } |
| | | //附件 |
| | | public ConsumableorderdetailsInfo(ContentVersion e) { |
| | | Concc = e; |
| | | } |
| | | // 排序Consumable_order__c |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (check == true) { |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } else { |
| | | if (sortBy == false) { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (allnumber > compareToesd.allnumber) { |
| | | returnValue = 1; |
| | | } else if (allnumber < compareToesd.allnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class Results { |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | @AuraEnabled |
| | | public String eSetId; |
| | | @AuraEnabled |
| | | public String agencyProType; |
| | | @AuraEnabled |
| | | public String userWorkLocation; |
| | | @AuraEnabled |
| | | public String accountName; |
| | | @AuraEnabled |
| | | public String accountid; |
| | | @AuraEnabled |
| | | public String hospitalId; |
| | | @AuraEnabled |
| | | public String contractId; |
| | | @AuraEnabled |
| | | public String category_Goods; |
| | | @AuraEnabled |
| | | public Consumable_order__c coc; |
| | | @AuraEnabled |
| | | public Boolean edoffersPrice; |
| | | @AuraEnabled |
| | | public Boolean editDelCommitBtnDisabled; |
| | | @AuraEnabled |
| | | public Boolean editAble; |
| | | @AuraEnabled |
| | | public String hospitalName; |
| | | @AuraEnabled |
| | | public String contractName; |
| | | @AuraEnabled |
| | | public List<CusOption> category3Option; |
| | | @AuraEnabled |
| | | public List<CusOption> category4Option; |
| | | @AuraEnabled |
| | | public List<CusOption> category5Option; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview; |
| | | @AuraEnabled |
| | | public List<ConsumableorderdetailsInfo> attachmentRecoeds; |
| | | @AuraEnabled |
| | | public Boolean cansee; |
| | | @AuraEnabled |
| | | public List<String> errorMsgList; |
| | | @AuraEnabled |
| | | public List<String> warningMsgList; |
| | | @AuraEnabled |
| | | public Boolean hasWarning; |
| | | @AuraEnabled |
| | | public Boolean hasError; |
| | | @AuraEnabled |
| | | public Boolean specialCampaign; |
| | | @AuraEnabled |
| | | public List<String> dealerProductId; |
| | | @AuraEnabled |
| | | public List<String> contactDealer; |
| | | @AuraEnabled |
| | | public String url; |
| | | @AuraEnabled |
| | | public String methodType; |
| | | @AuraEnabled |
| | | public List<String> proLimitAndDate; |
| | | @AuraEnabled |
| | | public Boolean isNoteStay; |
| | | @AuraEnabled |
| | | public Boolean OSHFLG; |
| | | @AuraEnabled |
| | | public String agencyProType1; |
| | | } |
| | | |
| | | public class CusOption { |
| | | CusOption(String label, String value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | } |
| 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 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> |
| New file |
| | |
| | | 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 Integer noOfRecords{get; set;} |
| | | public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 丢失和巡回的,画面显示用 |
| | | public static ApexPages.StandardSetController setCon { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_order_details2__c> setConDetails2 { get; set; } |
| | | public static Map<Id,String> pandiandetailsMap = new Map<Id,String>(); |
| | | /*****************検索用******************/ |
| | | public static String barcode { get; set; } |
| | | public static Boolean done { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | //页面主数据显示用 |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords; |
| | | //盘点到的产品 |
| | | public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>(); |
| | | public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>(); |
| | | |
| | | //public List<Consumable_order_details2__c> pandiandetailsList { get; set; } |
| | | public static List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; } |
| | | //寻回明细 |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 丢失和巡回的,实际炒作用 |
| | | @AuraEnabled |
| | | public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 产品单位的List |
| | | public static List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>(); |
| | | |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords; |
| | | |
| | | public static Integer consumableorderdetailsCount { |
| | | get { |
| | | return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size(); |
| | | } |
| | | } |
| | | //list<String> notexitlist = new list<String>(); |
| | | public static Map<String,String> reFindProduct = new Map<String,String>(); |
| | | //排序用 |
| | | // public static String sortKey; |
| | | // public static String preSortKey; |
| | | // public static Boolean sortOrderAsc; |
| | | // public static String[] sortOrder; |
| | | //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 有,BarCodeListP 没有 |
| | | /*****************经销商ID******************/ |
| | | private static String accountid = null; |
| | | private static String accountName = null; |
| | | // 盘点 ID |
| | | private static String eSetId = ''; |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | //经销商用户产品分类(ET、ENG) |
| | | public static String agencyProType {get;set;} |
| | | public static String sqlagencyProType; |
| | | //判断操作人员是否盘点 |
| | | public static Boolean iSinventory = false; |
| | | |
| | | public LexInventoryController(){ |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | done = false; |
| | | |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //codPageRecordsShow = new List<ConsumableorderdetailsInfo>(); |
| | | } |
| | | |
| | | private static void initStandardController(){ |
| | | // init standard controller |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name desc]; |
| | | setConDetails2 = showcod2; |
| | | System.debug('setConDetails2===>'+setConDetails2); |
| | | // setCon = new ApexPages.StandardSetController(showcod2); |
| | | // // sets the number of records in each page set |
| | | // setCon.setPageSize(size); |
| | | // noOfRecords = setCon.getResultSize(); |
| | | } |
| | | |
| | | public static List<Consumable_order_details2__c> cod2s() { |
| | | return setConDetails2; |
| | | } |
| | | //Changes the size of pagination |
| | | public static PageReference refreshPageSize() { |
| | | setCon.setPageSize(size); |
| | | //showcod2nid = cod2s(); |
| | | makepagerecords(); |
| | | return null; |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecords() { |
| | | showcod2nid = cod2s(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | System.debug('===>codPageRecords1'+codPageRecords); |
| | | return codPageRecords; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); |
| | | setConDetails2 = new List<Consumable_order_details2__c>(); |
| | | String url = '在库调整一览'; |
| | | fileName = EncodingUtil.urlEncode(url, 'UTF-8'); |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | System.debug('pandiandetailsMap====>'+pandiandetailsMap); |
| | | initStandardController(); |
| | | makepagerecords(); |
| | | // sortKey = '1'; |
| | | // preSortKey = '1'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new String[1]; |
| | | // sortOrder = new String[]{' ',' ','↓'}; |
| | | |
| | | String userId = UserInfo.getUserId(); |
| | | //String userId = '00510000006k82X'; |
| | | //String userId = '00510000005QO75'; |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId]; |
| | | accountid = Useracc.Accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | Account accountInfo = [SELECT Name,Dealer_discount__c FROM account WHERE id =:accountid]; |
| | | accountName = accountInfo.Name; |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,Product2__c> midMap = new Map<String,Product2__c>(); |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start |
| | | //开始制作表头数据 |
| | | // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c, |
| | | // SFDA_Status__c,Packing_list_manual__c, |
| | | // Asset_Model_No__c |
| | | // from Product2__c |
| | | // //where Estimation_Entry_Possibility__c = '○' |
| | | // where Product_Type__c like : sqlagencyProType |
| | | // ]; |
| | | // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){ |
| | | // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]); |
| | | // } |
| | | //查询库存 追加返品库存 |
| | | List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName]; |
| | | //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 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 == '盒'){ |
| | | |
| | | if(newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone(); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c)); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | } |
| | | }else if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '个'){ |
| | | if(newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone(); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c)); |
| | | Jstage.countid = Jstage.countid+1 ; |
| | | if(ProductCount_Res[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = Jstage.limitCount + 1; |
| | | } |
| | | Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c; |
| | | newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | //newMidPieceMap移除已经添加的Piece |
| | | newMidPieceMap.remove(bss.Prod.Id + '个'); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | } |
| | | //consumableorderdetailsCount = consumableorderdetailsRecords.size(); |
| | | listCut(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('accountName',accountName); |
| | | data.put('accountid',accountid); |
| | | |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static void listCut(){ |
| | | //拆分暂用list |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsInfo c = null; |
| | | ConsumableorderdetailsRecordsbreak.clear(); |
| | | ConsumableorderdetailsRecordsbreakover.clear(); |
| | | consumableorderdetailsRecordsview.clear(); |
| | | //选择产品view |
| | | ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>(); |
| | | ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>(); |
| | | if(consumableorderdetailsRecords.size() > 1000){ |
| | | for(Integer i = 0; i < consumableorderdetailsRecords.size(); i++){ |
| | | if(i < 1000){ |
| | | c = consumableorderdetailsRecords.get(i); |
| | | ConsumableorderdetailsRecordsbreak.add(c); |
| | | }else{ |
| | | c = consumableorderdetailsRecords.get(i); |
| | | ConsumableorderdetailsRecordsbreakover.add(c); |
| | | } |
| | | } |
| | | consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak); |
| | | consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover); |
| | | }else{ |
| | | consumableorderdetailsRecordsview.add(consumableorderdetailsRecords); |
| | | } |
| | | } |
| | | //========20160311======ADD_Start================================ |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | //========20160311======ADD_Start================================ |
| | | 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){ |
| | | A = A.trim().toUpperCase(); |
| | | if(barcodeCountMap.containsKey(A)){ |
| | | barcodeCountMap.put(A,barcodeCountMap.get(A) + 1); |
| | | }else{ |
| | | barcodeCountMap.put(A,1); |
| | | } |
| | | Buff.add(A + barcodeCountMap.get(A)); |
| | | } |
| | | return Buff; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //test |
| | | |
| | | // @AuraEnabled |
| | | // public static ResponseBodyLWC searchConsumableorderdetails(String sqlagencyProType,String userWorkLocation,String accountName,String barcode,List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsLWC){ |
| | | // return new ResponseBodyLWC('Error',500, 'test', ''); |
| | | // } |
| | | //========20160311======ADD_End================================== |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){ |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | sortField = sortFieldLWC; |
| | | sortOrder = sortOrderLWC; |
| | | |
| | | System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC); |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | system.debug('=====>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String,object> data = new Map<String,object>(); |
| | | res.entity = data; |
| | | |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | |
| | | |
| | | |
| | | |
| | | /* BarCodelist做成 */ |
| | | //FIXME barcodeSet 做成,ProductCount_ResSet 做成 |
| | | List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>(); |
| | | pandiandetailsListShow = new List<List<Consumable_order_details2__c>>(); |
| | | done = false; |
| | | List<String> BarCodeListP = ParseBarCode( barcode ); |
| | | //查询库存 追加返品库存 |
| | | List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName ]; |
| | | reFindProduct.clear(); |
| | | Map<String,ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | //barCodeListLoseMap.clear(); |
| | | Set<String> carCodeListLose = new Set<String>(); |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,String> proIdNotinpage = new Map<String,String>(); |
| | | List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>(); |
| | | codPageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>(); |
| | | List<ConsumableorderdetailsInfo> reFindProductaddtopage = new List<ConsumableorderdetailsInfo>(); |
| | | pandiandetailsMap.clear(); |
| | | reSet = new List<Consumable_order_details2__c>(); |
| | | /* 判断BarCode是否为空 */ |
| | | if (barcode == null || barcode == ''){ |
| | | //先取出所有丢失产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | // 20200509 gzw add 盘点数量初始化 |
| | | ass.Pandian = 0; |
| | | // 20200509 gzw add 盘点数量初始化 |
| | | if(ass.check==true){ |
| | | //ass.Diff = ass.countid - ass.Pandian; |
| | | for(integer i = 0 ; i < ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){ |
| | | continue; |
| | | }else{ |
| | | |
| | | //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i])); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //已经出库的产品 |
| | | List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND (Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c in :carCodeListLose |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | needreturnMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | |
| | | // 经销商之间或者同一经销商不同工作地调货 |
| | | reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c= FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c in :carCodeListLose |
| | | AND (Dealer_Info_text__c != :accountName |
| | | OR (Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | ) |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | carCodeListLose.clear(); |
| | | |
| | | |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check==true){ |
| | | ass.Diff = ass.countid - ass.Pandian; |
| | | for(integer i = 0 ; i < ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)){ |
| | | continue; |
| | | }else{ |
| | | if(needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品未返品')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品未返品'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | continue; |
| | | |
| | | } |
| | | if(otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | continue; |
| | | |
| | | } |
| | | if (ProductCount_Res[i].Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | ass.Diff--; |
| | | continue; |
| | | } |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | ass.Pandian = 0; |
| | | ass.Diff = 0; |
| | | } |
| | | } |
| | | List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>(); |
| | | if (pandiandetailsMap.keySet().size() > 0) { |
| | | showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | } |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | |
| | | iSinventory = true; |
| | | if(codPageRecords.size() > 0) done = true; |
| | | consumableorderdetailsRecordserrordummy.clear(); |
| | | |
| | | //pandiandetailsList = new list<Consumable_order_details2__c>(); |
| | | pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Lose_reason__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c codDet : pandiandetailsList){ |
| | | codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id); |
| | | } |
| | | List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 : pandiandetailsList){ |
| | | pandiandetailsListMid.add(cod2); |
| | | if(pandiandetailsListMid.size() == 1000){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | } |
| | | } |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | System.debug('codPageRecords===>'+codPageRecords); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | data.put('reSet1',reSet1); |
| | | System.debug('reSet1===>'+reSet1); |
| | | res.code = 200; |
| | | res.status = 'Success1'; |
| | | |
| | | return res; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //CHAN-B7J4NB 只有一个时,盘点不到 |
| | | //init(); |
| | | //CHAN-B7J4NB |
| | | Map<String,String> showproductIdMap = new Map<String,String>(); |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece); |
| | | } |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP)); |
| | | /***************************************************************************/ |
| | | // BarCode的检索 所有在库 |
| | | reSet = [select Id,Consumable_Product__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Bar_Code_search__c,Isoverdue__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Dealer_Returned__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Cancellation_Date__c = null |
| | | and Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | order by Name]; |
| | | System.debug('reSet===>'+reSet); |
| | | Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | | // 20200509 add gzw 记录需要销存数量 |
| | | Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 単位 |
| | | // 20200509 add gzw 记录需要销存数量 |
| | | Map<String,ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String,ConsumableorderdetailsInfo>(); // 明細バーコード 単位 |
| | | //盘点到的明细 |
| | | for(Consumable_order_details2__c rs : reSet){ |
| | | //BarCodeListPandian.add(rs.Bar_Code_search__c); |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | |
| | | barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs)); |
| | | if (rs.Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(rs.Id, '该产品已经过有效期,请销存。'); |
| | | if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) { |
| | | pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1); |
| | | } else { |
| | | pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1); |
| | | } |
| | | continue; |
| | | } |
| | | if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) { |
| | | pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1); |
| | | } else { |
| | | pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1); |
| | | } |
| | | } |
| | | |
| | | // 经销商之间或者同一经销商不同工作地调货 |
| | | List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE (Dealer_Arrive__c = TRUE |
| | | or Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code_search__c in :BarCodeListP |
| | | AND (Dealer_Info_text__c != :accountName |
| | | OR (Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | ) |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet1){ |
| | | otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | // 需要入库的产品 |
| | | for(Consumable_order_details2__c cod2 : reSet1){ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | if(!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)){ |
| | | reFindProductList.add(cod2); |
| | | proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c); |
| | | } |
| | | if(!barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) |
| | | && otherAgProMap.containsKey(cod2.Bar_Code__c) |
| | | && (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true |
| | | || otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true) ){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'无此产品的库存,请入库。')); |
| | | pandiandetailsMap.put(cod2.Id, '无此产品的库存,请入库。'); |
| | | } |
| | | } |
| | | //寻回明细 |
| | | List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>(); |
| | | productAdjust = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Lose_reason__c, |
| | | Asset_Model_No__c,Box_Piece__c,Bar_Code_search__c,Isoverdue__c |
| | | from Consumable_order_details2__c |
| | | where Bar_Code_search__c in :BarCodeListP |
| | | and Bar_Code__c !=null |
| | | and Lose_Flag__c = true |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c =: userWorkLocation |
| | | order by Name]; |
| | | |
| | | |
| | | for (Consumable_order_details2__c rs : productAdjust){ |
| | | // 过期库存销存 20200427 gzw add srart |
| | | if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '过期库存销存' ) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'过期或者销存产品,无法寻回入库')); |
| | | pandiandetailsMap.put(rs.Id, '过期或者销存产品,无法寻回入库'); |
| | | carCodeListLose.add(rs.Bar_Code_search__c); |
| | | continue; |
| | | } |
| | | // 过期库存销存 20200427 gzw add end |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){ |
| | | ass.check = true; |
| | | } |
| | | } |
| | | if(!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)){ |
| | | reFindProductList.add(rs); |
| | | proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c); |
| | | } |
| | | if(barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)){ |
| | | continue; |
| | | }else{ |
| | | barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs)); |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'寻回')); |
| | | pandiandetailsMap.put(rs.Id, '寻回'); |
| | | consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs)); |
| | | } |
| | | } |
| | | if(reFindProductList.size() > 0){ |
| | | Map<String,Product2__c> midMap = new Map<String,Product2__c>(); |
| | | List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>(); |
| | | List<Product2__c> product_Refind = [select Id, Name,Name__c,SFDA_Status__c,Packing_list_manual__c,Asset_Model_No__c |
| | | from Product2__c |
| | | WHERE Id in :proIdNotinpage.keySet()]; |
| | | for(Product2__c pro : product_Refind){ |
| | | midMap.put(pro.Id, pro); |
| | | } |
| | | for(Integer i = 0 ; i< reFindProductList.size();i++){ |
| | | //然后循环CountDel做Box和piece2个map |
| | | if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '盒'){ |
| | | |
| | | if(newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c).clone(); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c)); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | } |
| | | }else if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '个'){ |
| | | if(newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){ |
| | | ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(reFindProductList[i].Consumable_product__c+reFindProductList[i].Box_Piece__c).clone(); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | }else{ |
| | | ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c)); |
| | | Jstage.countid = 0 ; |
| | | if(reFindProductList[i].Isoverdue__c == 1){ |
| | | Jstage.limitCount = 0; |
| | | } |
| | | Jstage.boxPiece = reFindProductList[i].Box_Piece__c; |
| | | newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage); |
| | | } |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){ |
| | | bss.check = true; |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | boxRecords.add(bss); |
| | | } |
| | | boxRecords.sort(); |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | bss.check = true; |
| | | bss.overlimitCount = bss.countid - bss.limitCount; |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : boxRecords){ |
| | | consumableorderdetailsRecords.add(bss); |
| | | if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | //newMidPieceMap移除已经添加的Piece |
| | | newMidPieceMap.remove(bss.Prod.Id + '个'); |
| | | } |
| | | } |
| | | for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){ |
| | | consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个')); |
| | | } |
| | | } |
| | | |
| | | //先取出未盘点到的产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | for(integer i = 0 ; i<ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null){ |
| | | continue; |
| | | }else{ |
| | | carCodeListLose.add(ProductCount_Res[i].Bar_Code__c); |
| | | ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i])); |
| | | //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //已经出库的产品 |
| | | List<Consumable_order_details2__c> reSet2 = [SELECT Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c,Dealer_Info_text__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = TRUE |
| | | AND (Dealer_Shipment__c= TRUE |
| | | or Dealer_Saled__c = TRUE) |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code_search__c in :BarCodeListP |
| | | AND Dealer_Info_text__c = :accountName |
| | | ORDER BY Name ]; |
| | | Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 :reSet2){ |
| | | needreturnMap.put(cod2.Bar_Code__c,cod2); |
| | | } |
| | | //// 经销商之间或者同一经销商不同工作地调货 |
| | | //List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c, |
| | | // Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c, |
| | | // Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c, |
| | | // Bar_Code_search__c,Dealer_Info_text__c |
| | | // FROM Consumable_order_details2__c |
| | | // WHERE (Dealer_Arrive__c = TRUE |
| | | // or Dealer_Shipment__c= TRUE |
| | | // or Dealer_Saled__c = TRUE) |
| | | // AND Dealer_Returned__c = FALSE |
| | | // AND Cancellation_Flag__c = FALSE |
| | | // AND Bar_Code_search__c in :BarCodeListP |
| | | // AND (Dealer_Info_text__c != :accountName |
| | | // OR (Dealer_Info_text__c = :accountName |
| | | // AND Arrive_Owner_Work_Location__c != :userWorkLocation) |
| | | // ) |
| | | // ORDER BY Name ]; |
| | | //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>(); |
| | | //for(Consumable_order_details2__c cod2 :reSet1){ |
| | | // otherAgProMap.put(cod2.Bar_Code__c,cod2); |
| | | //} |
| | | carCodeListLose.clear(); |
| | | //未盘点到的产品 |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | for(integer i = 0 ; i<ProductCount_Res.size();i++){ |
| | | if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){ |
| | | if(barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)){ |
| | | continue; |
| | | } |
| | | if (ProductCount_Res[i].Isoverdue__c == 0) { |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。'); |
| | | if (pandianoverdueCountMap.containsKey(ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c) == false) { |
| | | pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1); |
| | | } else { |
| | | pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, pandianoverdueCountMap.get(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c) + 1); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失')); |
| | | pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失'); |
| | | } |
| | | } |
| | | // 同时存在其他经销商库存产品 |
| | | for(Consumable_order_details2__c cod2 : reSet1){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){ |
| | | if(barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) |
| | | && otherAgProMap.containsKey(cod2.Bar_Code__c) |
| | | && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false |
| | | && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false ){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。')); |
| | | pandiandetailsMap.put(cod2.Id, '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | // 需要返品的产品 |
| | | for(Consumable_order_details2__c cod2 : reSet2){ |
| | | if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){ |
| | | if(needreturnMap.containsKey(cod2.Bar_Code__c)){ |
| | | consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品目前出库状态,请返品。')); |
| | | pandiandetailsMap.put(cod2.Id, '该产品目前出库状态,请返品。'); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //更新主明细单 |
| | | if(barCodeListPandianMap.size() > 0){ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | integer countSum = 0; |
| | | if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | integer overdueSum = 0; |
| | | if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | ass.Pandian = countSum; |
| | | ass.Diff = ass.countid - countSum - overdueSum; |
| | | ass.refind = 0; |
| | | } |
| | | } |
| | | }else{ |
| | | for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){ |
| | | if(ass.check == true){ |
| | | integer overdueSum = 0; |
| | | if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) { |
| | | overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece); |
| | | } |
| | | ass.Diff = ass.countid - ass.Pandian - overdueSum; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //寻回做成 |
| | | for(ConsumableorderdetailsInfo ass :consumableorderdetailsRecords){ |
| | | for(ConsumableorderdetailsInfo adjust :consumableorderdetailsRecordsAdjust){ |
| | | if(ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c){ |
| | | if(reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)){ |
| | | continue; |
| | | }else { |
| | | ass.Pandian ++; |
| | | ass.refind ++; |
| | | reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c,adjust.orderdetails2.Bar_Code_search__c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (pandiandetailsMap.keySet().size() > 0) { |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | initStandardController(); |
| | | showcod2nid = cod2s(); |
| | | |
| | | } |
| | | for (Consumable_order_details2__c cod2 : showcod2nid) { |
| | | codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id))); |
| | | } |
| | | if(codPageRecords.size() > 0) done = true; |
| | | iSinventory = true; |
| | | consumableorderdetailsRecordserrordummy.clear(); |
| | | pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Box_Piece__c,Lose_reason__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c codDet : pandiandetailsList){ |
| | | codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id); |
| | | } |
| | | List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | for(Consumable_order_details2__c cod2 : pandiandetailsList){ |
| | | pandiandetailsListMid.add(cod2); |
| | | if(pandiandetailsListMid.size() == 1000){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | pandiandetailsListMid = new List<Consumable_order_details2__c>(); |
| | | } |
| | | } |
| | | if(pandiandetailsListMid.size() > 0){ |
| | | pandiandetailsListShow.add(pandiandetailsListMid); |
| | | } |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = codPageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > codPageRecords.size()) { |
| | | endIdx = codPageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageCodeRecords.add(codPageRecords.get(i)); |
| | | } |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageCodeRecords', pageCodeRecords); |
| | | |
| | | //end |
| | | |
| | | System.debug('=====>codPageRecords2'+codPageRecords); |
| | | System.debug('=====>consumableorderdetailsRecords'+consumableorderdetailsRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords)); |
| | | System.debug('iSinventory===>'+iSinventory); |
| | | data.put('iSinventory',JSON.serialize(iSinventory)); |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | data.put('pandiandetailsMap',pandiandetailsMap); |
| | | data.put('reSet',reSet); |
| | | data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview)); |
| | | System.debug('=====>consumableorderdetailsRecordsview'+consumableorderdetailsRecordsview); |
| | | res.code = 200; |
| | | res.status = 'Sucess'; |
| | | return res; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) { |
| | | List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class); |
| | | agencyProType = agencyProType; |
| | | accountid =accountid; |
| | | pandiandetailsMap = pandiandetailsMap; |
| | | reSet =reSet; |
| | | System.debug('pandiandetailsMap===>'+pandiandetailsMap); |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | // return null; |
| | | } |
| | | integer Lo = 0; |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | Lo++; |
| | | } |
| | | } |
| | | if(Lo == 0){ |
| | | iSinventory = false; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要盘点的明细')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error',500, '请选择要盘点的明细', ''); |
| | | } |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + ' '+header.prod.Name__c)); |
| | | //return null; |
| | | if((header.DiffReason == ''||header.DiffReason ==null)&&header.Diff>0){ |
| | | return new ResponseBodyLWC('Error',500, header.prod.Name__c + '请输入差异原因', ''); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '请输入差异原因')); |
| | | // return null; |
| | | }else if ((header.DiffReason != ''&&header.DiffReason !=null)&&header.Diff==0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无丢失产品,不需要填写差异原因')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error',500, header.prod.Name__c + '无丢失产品,不需要填写差异原因', ''); |
| | | } |
| | | } |
| | | } |
| | | Integer orderDetNo = 1; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Consumable_order__c Po = new Consumable_order__c(); |
| | | Po.Name ='*'; |
| | | Po.Order_status__c = '批准'; |
| | | Po.Inventory_date__c = Date.today(); |
| | | Po.Order_type__c = '盘点'; |
| | | Po.Dealer_Info__c = accountid; |
| | | Po.Order_ProType__c = agencyProType; |
| | | Po.RecordTypeid = System.Label.RT_ConOrder_Inventory; |
| | | try{ |
| | | insert Po; |
| | | eSetId = Po.id; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:Po.id]; |
| | | List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>(); |
| | | List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>(); |
| | | List<Consumable_order_details2__c> updListAdjust = New List<Consumable_order_details2__c>(); |
| | | Map<String,String> ErrorName = new Map<String,String>(); |
| | | Map<String,Boolean> CheckTF = new Map<String,Boolean>(); |
| | | for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){ |
| | | if(header.check==true){ |
| | | Consumable_orderdetails__c insPan = new Consumable_orderdetails__c(); |
| | | insPan = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(orderDetNo); |
| | | if(str.length() == 1){ |
| | | str = '0' + str; |
| | | } |
| | | insPan.Name = Consumable_order[0].Name + '-'+ str; |
| | | insPan.Consumable_Product__c = header.ProdId; |
| | | ErrorName.put(insPan.Consumable_Product__c,header.DiffReason); |
| | | CheckTF.put(insPan.Consumable_product__c,true); |
| | | insPan.Consumable_order__c = Po.Id; |
| | | insPan.Lose_reason__c = header.DiffReason; |
| | | insPan.Diff__c = header.Diff; |
| | | insPan.Product_Refind__c = header.refind; |
| | | insPan.inventory_sum__c = header.Pandian; |
| | | insPan.Count_Sum__c = header.countid; |
| | | insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory; |
| | | orderDetNo ++; |
| | | InsList.add(insPan); |
| | | } |
| | | } |
| | | if(InsList.size()>0){ |
| | | insert InsList; |
| | | } |
| | | List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Id in :pandiandetailsMap.keySet() |
| | | order by Name]; |
| | | for(Consumable_order_details2__c cod : showcod2){ |
| | | Consumable_order_details2__c InsDetail = new Consumable_order_details2__c(); |
| | | InsDetail.Id =cod.Id; |
| | | InsDetail.Consumable_Inventory_order__c = po.Id; |
| | | InsDetail.Inventory_date__c = Date.today(); |
| | | // 20210224 gzw CHAN-BXF3PG start |
| | | // if(pandiandetailsMap.get(cod.Id) == '丢失' ){ |
| | | if(pandiandetailsMap.get(cod.Id) == '丢失' && CheckTF.containsKey(cod.Consumable_product__c)){ |
| | | // 20210224 gzw CHAN-BXF3PG end |
| | | InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c); |
| | | InsDetail.Lose_Flag__c = true; |
| | | }else if(pandiandetailsMap.get(cod.Id) == '寻回' ){ |
| | | InsDetail.Lose_reason__c = ''; |
| | | InsDetail.Lose_Flag__c = false; |
| | | }else{ |
| | | continue; |
| | | } |
| | | InsListUp.add(InsDetail); |
| | | } |
| | | for(Consumable_order_details2__c rs : reSet){ |
| | | rs.Inventory_date__c = Date.today(); |
| | | } |
| | | if(reSet.size() > 0){ |
| | | update reSet; |
| | | } |
| | | if(InsListUp.size()>0){ |
| | | ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407 |
| | | } |
| | | |
| | | }catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // ApexPages.addMessages(ex); |
| | | return new ResponseBodyLWC('Error',500, e.getMessage()+e.getLineNumber(), ''); |
| | | // return null; |
| | | } |
| | | // FIXME impliment BarCodeListAdjust |
| | | /************************************************************************************************/ |
| | | // return ProS(); |
| | | data.put('eSetId',eSetId); |
| | | data.put('InsListUp',InsListUp); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //盘点一览 |
| | | public PageReference ProS() { |
| | | // 返回盘点一览 |
| | | PageReference ref = new Pagereference('/apex/InventoryList?eSetId=' + eSetId); |
| | | ref.setRedirect(true); |
| | | return ref; |
| | | } |
| | | //CSV出力 |
| | | public PageReference doClick() { |
| | | Pagereference pr = page.InventoryCSV; |
| | | return pr; |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | // 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) { |
| | | |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | //e.Lose_reason__c = str; |
| | | DiffReason = str; |
| | | } |
| | | |
| | | // 已存在消耗品明细用 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | check = false; |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | canSelect = true; |
| | | } |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | //orderdetails1 = new Consumable_orderdetails__c(); |
| | | Prod = e; |
| | | canSelect = true; |
| | | ProdId = string.valueOf(e.id); |
| | | countid =0; |
| | | Pandian = 0; |
| | | refind = 0; |
| | | Diff = 0; |
| | | limitCount = 0; |
| | | overlimitCount = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo; |
| | | Integer returnValue = 0; |
| | | if (countid > compareToesd.countid ) { |
| | | returnValue = -1; |
| | | } else if (countid < compareToesd.countid ) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| 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 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> |
| New file |
| | |
| | | public with sharing class LexOverdueStockController { |
| | | |
| | | /*****************検索用******************/ |
| | | public static String barcode { get; set; } |
| | | |
| | | // 过期和销存,画面显示用 |
| | | public static List<orderBean> codPageRecords { get; set; } |
| | | |
| | | // 过期和销存,画面显示用 |
| | | public static List<orderBean> overduePageRecords { get; set; } |
| | | |
| | | // 登录者工作地 |
| | | private static String userWorkLocation; |
| | | //经销商用户产品分类(ET、ENG) |
| | | private static String agencyProType; |
| | | private static String sqlagencyProType; |
| | | // 经销商信息 |
| | | 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 { |
| | | get { |
| | | return codPageRecords == null ? 0 : codPageRecords.size(); |
| | | } |
| | | } |
| | | |
| | | public LexOverdueStockController() { |
| | | |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | codPageRecords = new List<orderBean>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if(String.isBlank(Useracc.UserPro_Type__c)){ |
| | | agencyProType = 'ET'; |
| | | } |
| | | sqlagencyProType = '%' + agencyProType + '%'; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | // 过期库存汇总信息 |
| | | List<AggregateResult> orderDetZaiku = [SELECT count(Id) countsum, |
| | | Consumable_Product__c prodid, |
| | | Consumable_Product__r.Name_Text__c prodname, |
| | | Box_Piece__c boxPiece |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c]; |
| | | |
| | | for(AggregateResult overdue : orderDetZaiku){ |
| | | codPageRecords.add(new orderBean(overdue)); |
| | | } |
| | | |
| | | system.debug('codPageRecords====>'+codPageRecords); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('userWorkLocation',userWorkLocation); |
| | | data.put('accountName',accountInfo.Name); |
| | | data.put('agencyProType',agencyProType); |
| | | data.put('orderDetZaiku',JSON.serialize(orderDetZaiku)); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | |
| | | } |
| | | |
| | | // BarCode录入 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){ |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(codPageRecordsLWC,List<orderBean>.class); |
| | | sqlagencyProType = '%' + agencyProTypeLWC + '%'; |
| | | system.debug('sqlagencyProType==>'+ sqlagencyProType); |
| | | barcode = barcodeLWC; |
| | | system.debug('barcode==>'+ barcode); |
| | | userWorkLocation = userWorkLocationLWC; |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | |
| | | iSinventory = true; |
| | | Set<String> barCodeoverdue = new Set<String>(); |
| | | overduePageRecords = new List<orderBean>(); |
| | | List<String> barCodeListP = ParseBarCode( barcode ); |
| | | // 页面显示数据初始化 |
| | | for (orderBean codPage : codPageRecords) { |
| | | codPage.pandian = 0; |
| | | } |
| | | // 查询所有过期库存 |
| | | List<Consumable_order_details2__c> orderDetZaiku = [select Id, Name,Consumable_Product__c, |
| | | Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c, |
| | | Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c, |
| | | Bar_Code_search__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Isoverdue__c = 0 |
| | | AND Dealer_Returned__c = false |
| | | AND Cancellation_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Product_Type__c like : sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountInfo.Name |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation]; |
| | | // 没有输入条码时,循环页面,所有打钩产品全部销存 |
| | | // 取得所有 |
| | | overdueList = new List<Consumable_order_details2__c>(); |
| | | if (String.isBlank(barcode)) { |
| | | System.debug('barcode空'); |
| | | for(orderBean codPage : codPageRecords){ |
| | | if (codPage.check) { |
| | | for(Consumable_order_details2__c cod2 : orderDetZaiku){ |
| | | if(cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | } |
| | | } |
| | | codPage.pandian = codPage.overlimitCount; |
| | | } |
| | | } |
| | | // return; |
| | | 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]; |
| | | |
| | | 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 (orderBean codPage : codPageRecords) { |
| | | if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){ |
| | | overduePageRecords.add(new orderBean(cod2,'过期库存销存')); |
| | | overdueList.add(cod2); |
| | | codPage.pandian ++; |
| | | codPage.check = true; |
| | | } |
| | | } |
| | | }else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) { |
| | | overduePageRecords.add(new orderBean(cod2,'产品已经出库')); |
| | | }else{ |
| | | overduePageRecords.add(new orderBean(cod2,'不是过期库存')); |
| | | } |
| | | } |
| | | System.debug('overduePageRecords = ' + overduePageRecords); |
| | | data.put('overduePageRecords',JSON.serialize(overduePageRecords)); |
| | | data.put('codPageRecords',JSON.serialize(codPageRecords)); |
| | | data.put('iSinventory',iSinventory); |
| | | data.put('overdueList',overdueList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | system.debug('saveCodPageRecords=============>'+saveCodPageRecords); |
| | | system.debug('saveoverdueList'+saveoverdueList); |
| | | overdueList = saveoverdueList; |
| | | // if(saveoverdueList==null){ |
| | | // return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | |
| | | // } |
| | | |
| | | List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(saveCodPageRecords,List<orderBean>.class); |
| | | // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class); |
| | | // add by Wang Xueqin 2023/04/12 |
| | | // 获取用户和经销商信息 |
| | | user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()]; |
| | | accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid]; |
| | | |
| | | // 跳过明细2不必要更新 |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | if(!iSinventory){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】')); |
| | | return new ResponseBodyLWC('Error',500, '请先录入BarCode', ''); |
| | | // return null; |
| | | } |
| | | integer Lo = 0; |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Lo++; |
| | | } |
| | | } |
| | | if(Lo == 0){ |
| | | iSinventory = false; |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要销存的明细。')); |
| | | return new ResponseBodyLWC('Error',500, '请选择要销存的明细', ''); |
| | | // return null; |
| | | } |
| | | Integer orderDetNo = 1; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Consumable_order__c po = new Consumable_order__c(); |
| | | po.Name ='*'; |
| | | po.Order_status__c = '批准'; |
| | | po.Inventory_date__c = Date.today(); |
| | | po.Order_type__c = '销存'; |
| | | po.Dealer_Info__c = accountInfo.Id; |
| | | po.Order_ProType__c = agencyProType; |
| | | po.RecordTypeid = System.Label.RT_ConOrder_Overdue; |
| | | try{ |
| | | insert po; |
| | | Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id]; |
| | | List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>(); |
| | | for(orderBean header : codPageRecords){ |
| | | if(header.check==true){ |
| | | Consumable_orderdetails__c insPan = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(orderDetNo); |
| | | if(str.length() == 1){ |
| | | str = '0' + str; |
| | | } |
| | | insPan.Name = order.Name + '-'+ str; |
| | | insPan.Consumable_Product__c = header.prodId; |
| | | insPan.Consumable_order__c = po.Id; |
| | | insPan.Lose_reason__c = '过期库存销存'; |
| | | insPan.Overdue_count__c = header.pandian; |
| | | insPan.Overdue_SUM__c = header.overlimitCount; |
| | | insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory; |
| | | orderDetNo ++; |
| | | InsList.add(insPan); |
| | | } |
| | | } |
| | | // 生成明细1 |
| | | if(InsList.size()>0){ |
| | | insert InsList; |
| | | } |
| | | |
| | | for(Consumable_order_details2__c cod : overdueList){ |
| | | cod.Consumable_Inventory_order__c = po.Id; |
| | | cod.Inventory_date__c = Date.today(); |
| | | cod.Lose_reason__c = '过期库存销存'; |
| | | cod.Lose_Flag__c = true; |
| | | |
| | | } |
| | | if(overdueList.size()>0){ |
| | | ControllerUtil.updateOrderDetailsSatus(overdueList); |
| | | } |
| | | |
| | | }catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | ApexPages.addMessages(ex); |
| | | return null; |
| | | } |
| | | // return new Pagereference('/' + po.Id); |
| | | data.put('Id',po.Id); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 将页面或取得BarCode去掉重复的,转换成List |
| | | 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){ |
| | | A = A.trim().toUpperCase(); |
| | | if(barcodeCountMap.containsKey(A)){ |
| | | barcodeCountMap.put(A,barcodeCountMap.get(A) + 1); |
| | | }else{ |
| | | barcodeCountMap.put(A,1); |
| | | } |
| | | Buff.add(A + barcodeCountMap.get(A)); |
| | | } |
| | | return Buff; |
| | | } |
| | | |
| | | // Data Bean |
| | | class orderBean implements Comparable { |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | |
| | | // 过期库存 |
| | | @AuraEnabled |
| | | public Integer overlimitCount { get; set; } |
| | | // 销存数量 |
| | | @AuraEnabled |
| | | public Integer pandian { get; set; } |
| | | // 销存原因 |
| | | @AuraEnabled |
| | | public String diffReason { get; set; } |
| | | // 单位 |
| | | @AuraEnabled |
| | | public String boxPiece { get; set; } |
| | | @AuraEnabled |
| | | public String prodname { get; set; } |
| | | @AuraEnabled |
| | | public String prodid { get; set; } |
| | | orderBean(Consumable_order_details2__c e,string str) { |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | DiffReason = str; |
| | | } |
| | | public orderBean(AggregateResult e) { |
| | | check = false; |
| | | overlimitCount = Integer.valueOf(e.get('countsum')); |
| | | prodname = String.valueOf(e.get('prodname')); |
| | | prodid = String.valueOf(e.get('prodid')); |
| | | boxPiece = String.valueOf(e.get('BoxPiece')); |
| | | pandian = 0; |
| | | } |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | orderBean compareToesd =(orderBean)compareTo; |
| | | Integer returnValue = 0; |
| | | if (overlimitCount > compareToesd.overlimitCount ) { |
| | | returnValue = -1; |
| | | } else if (overlimitCount < compareToesd.overlimitCount ) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| 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 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> |
| New file |
| | |
| | | public with sharing class LexSaleAndDeliveryController { |
| | | // 显示数据条数限制 |
| | | private static Integer Select_Limit = 100; |
| | | |
| | | //初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init() { |
| | | try { |
| | | System.debug('init'); |
| | | //经销商id |
| | | String accountid = ''; |
| | | //经销商产品分类 |
| | | String agencyProType = ''; |
| | | //登录用户 ID |
| | | String userinfoId = ''; |
| | | //登录者工作地 |
| | | String userWorkLocation = ''; |
| | | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | 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]; |
| | | 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; |
| | | data.put('userinfoId', userinfoId); |
| | | data.put('accountid', accountid); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | System.debug( |
| | | 'userinfoId = ' + |
| | | userinfoId + |
| | | ' accountid = ' + |
| | | accountid + |
| | | ' agencyProType = ' + |
| | | agencyProType + |
| | | ' userWorkLocation = ' + |
| | | userWorkLocation |
| | | ); |
| | | //默认检索显示未完成的指示单 |
| | | 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); |
| | | System.debug('raesList = ' + raesList); |
| | | data.put('raesList', raesList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | res.msg = ''; |
| | | return res; |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | } |
| | | |
| | | // 已出库未开票的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchOrderInstatus( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | // 获得订单一览 |
| | | 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 Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Outbound_Date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Outbound_Date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsForDirction__c != \'' + '互相调货' + '\' '; |
| | | soql += 'and SummonsStatus_c__c = \'' + '已完成' + '\' '; |
| | | soql += 'and Billed_Status__c != \'' + '全部开票' + '\' '; |
| | | soql += 'order by CreatedDate desc limit ' + Select_Limit; |
| | | 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(), ''); |
| | | } |
| | | } |
| | | |
| | | //还没出库的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | 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'; |
| | | soql += ' WHERE Order_type__c = \'' + '传票' + '\' '; |
| | | soql += ' and Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Order_date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Order_date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' '; |
| | | soql += 'order by SummonsStatus_c__c limit ' + Select_Limit; |
| | | 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(), ''); |
| | | } |
| | | } |
| | | |
| | | // 已出库已开票的出库单 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorFinish( |
| | | String orderDate, |
| | | String deliverDate, |
| | | String accountid, |
| | | String agencyProType, |
| | | String userWorkLocation, |
| | | String category1, |
| | | String category2 |
| | | ) { |
| | | try { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-')); |
| | | Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-')); |
| | | 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 Dealer_Info__c =\'' + accountid + '\' '; |
| | | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; |
| | | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; |
| | | if (!String.isBlank(category1)) { |
| | | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (!String.isBlank(category2)) { |
| | | soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' '; |
| | | } |
| | | if (cate2 != null) { |
| | | soql += ' and Outbound_Date__c >= :cate2 '; |
| | | } |
| | | if (cate3 != null) { |
| | | soql += ' and Outbound_Date__c <= :cate3 '; |
| | | } |
| | | soql += 'and SummonsStatus_c__c = \'' + '已完成' + '\' '; |
| | | soql += 'and Billed_Status__c = \'' + '全部开票' + '\' '; |
| | | soql += 'order by CreatedDate desc limit ' + Select_Limit; |
| | | 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(), ''); |
| | | } |
| | | } |
| | | |
| | | @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(), ''); |
| | | } |
| | | } |
| | | } |
| 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 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> |
| New file |
| | |
| | | public without sharing class LexSummonsCreatController { |
| | | public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); |
| | | |
| | | /*****************検索用******************/ |
| | | //经销商用户产品分类(ET、ENG) |
| | | @AuraEnabled |
| | | public static String agencyProType { get; set; } |
| | | public static Consumable_order__c coc { get; set; } // 画view用, 可能是 出库指示单, 也有可能是到货单, 也有可能 空instance |
| | | public static User localuser { get; set; } |
| | | public static String category1 { get; set; } |
| | | public static Integer noOfRecords { get; set; } |
| | | //public String category_Goods {get ; set;} |
| | | public static Boolean cansee { get; set; } |
| | | public static Integer size { get; set; } |
| | | //经销商定价查看权限 |
| | | //public static ApexPages.StandardSetController setCon { get; set; } |
| | | public static Boolean dealerPricesee { get; set; } |
| | | /*****************画面初始化用********************************/ |
| | | /******20160313_add**************/ |
| | | public static String IdCheck { get; set; } |
| | | public static Boolean editAble { get; set; } |
| | | public static String statusEdit { get; set; } |
| | | public static String alertMessage { get; set; } |
| | | public static String SearchDone { get; set; } |
| | | public static List<String> zaikuId = new List<String>(); |
| | | public static List<String> orderzaikuId = new List<String>(); |
| | | //附件 |
| | | public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; } |
| | | public static Boolean getExistarrive() { |
| | | return (coc.Arrive_Order__c != null); |
| | | } |
| | | //总价格计算结果 |
| | | @AuraEnabled |
| | | public static Decimal sumPrice { get; set; } |
| | | /******20160317_add**************/ |
| | | public static String SummonsFlag { get; set; } // 新規: hidden, 更新: visible |
| | | public static String category5 { get; set; } |
| | | public static String category4 { get; set; } |
| | | public static String category3 { get; set; } |
| | | public static List<SelectOption> categoryOptionList { get; set; } |
| | | public static List<SelectOption> category4OptionList { get; set; } |
| | | public static List<SelectOption> category5OptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> categoryOptionMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category4OptionMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> category5OptionMap { get; set; } |
| | | /*****************画面表示Bean******************/ |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //明细2 |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; } |
| | | //错误明细 |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; } |
| | | @AuraEnabled |
| | | public static List<ConsumableorderdetailsInfo> pageRecords { get; set; } |
| | | public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; } |
| | | //public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetails2Records { get; set; } |
| | | public static List<Consumable_order__c> consumableInvoiceRecords { get; set; } |
| | | private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | private static List<Attachment> attachmentinfo = new List<Attachment>(); |
| | | public static List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | @AuraEnabled |
| | | public static Map<String, String> orderpieceorboxMap { get; set; } |
| | | @AuraEnabled |
| | | public static List<Consumable_orderdetails__c> orderdetails { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderagencypriceMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderpriceMap { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, Decimal> orderdetCountMap { get; set; } |
| | | @AuraEnabled |
| | | public static Boolean hasSpecialHos { get; set; } |
| | | //选择产品size |
| | | public static Integer consumableorderdetailsCount { |
| | | get { |
| | | return pageRecords == null ? 0 : pageRecords.size(); |
| | | } |
| | | } |
| | | //消耗品明细2数量 |
| | | public static Integer consumableorderdetails2Count { |
| | | get { |
| | | return consumableorderdetails2Records == null ? 0 : consumableorderdetails2Records.size(); |
| | | } |
| | | } |
| | | //订货单号 |
| | | public static String consumableorderId { |
| | | get { |
| | | return (coc.Arrive_Order__c); |
| | | } |
| | | } |
| | | //选择框 |
| | | public static List<SelectOption> provinceOpts { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> provinceOptsMap { get; set; } |
| | | public static String SecondDealer { get; set; } |
| | | //public List<SelectOption> orderForHospitalOpts { get; set; } |
| | | public static String HospitalInfo { get; set; } |
| | | public static String HospitalName { get; set; } |
| | | |
| | | public static Boolean EditDelCommitBtnDisabled { get; private set; } |
| | | public static Boolean saveBtnDisabled { get; private set; } |
| | | public static Boolean SorderBtnDisabled { get; private set; } |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | //public static String sortField { get; set; } |
| | | //public static String sortOrder { get; set; } |
| | | public static Integer totalcount { get; set; } |
| | | public static Integer addSize { get; set; } |
| | | //List<ConsumableorderdetailsInfoLwc> reSetLwc |
| | | public static List<ConsumableorderdetailsInfo> addData { get; set; } |
| | | public static Map<String, String> skipData { get; set; } |
| | | // 保存后动作: 1.检索 2.排序 |
| | | // public static String sortKey { get; set; } |
| | | // public static String preSortKey { get; private set; } |
| | | // public static Boolean sortOrderAsc { get; private set; } |
| | | // public static String[] sortOrder { get; private set; } |
| | | // private static String[] columus = new List<String>{ |
| | | // 'Consumable_Product__r.Name', |
| | | // 'Consumable_Product__r.Asset_Model_No__c', |
| | | // 'Consumable_Product__r.Intra_Trade_List_RMB__c', |
| | | // '', |
| | | // '', |
| | | // 'Consumable_Product__r.Category3__c', |
| | | // 'Consumable_Product__r.Category4__c', |
| | | // 'Consumable_Product__r.Category5__c' |
| | | // }; |
| | | // private static String[] columus_no = new List<String>{ |
| | | // 'Product2__c.Name', |
| | | // 'Product2__c.Asset_Model_No__c', |
| | | // 'Product2__c.Intra_Trade_List_RMB__c', |
| | | // '', |
| | | // '', |
| | | // 'Category3__c', |
| | | // 'Category4__c', |
| | | // 'Category5__c' |
| | | // }; |
| | | |
| | | //到货单明细1 |
| | | private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>(); |
| | | //到货单明细2 |
| | | private static List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = new List<Consumable_order_details2__c>(); |
| | | |
| | | //出库单明细2 |
| | | private static List<Consumable_order_details2__c> consumableorderdetails2RecordsList = new List<Consumable_order_details2__c>(); |
| | | /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/ |
| | | //private String cate1ForSort = null; |
| | | private static String accountid = null; |
| | | @AuraEnabled |
| | | public static String accountName { get; set; } |
| | | |
| | | // 产品 ID |
| | | private static String ESetId = ''; |
| | | @AuraEnabled |
| | | public static String arriveorder { get; set; } |
| | | private static String userId = ''; |
| | | //private String[] ProidListAll = new String[]{}; |
| | | |
| | | // 登录者工作地 |
| | | @AuraEnabled |
| | | public static String userWorkLocation { get; set; } |
| | | |
| | | //add by rentx 2021-01-29 |
| | | public static List<SelectOption> outOutPatternOptionList { get; set; } |
| | | @AuraEnabled |
| | | public static Map<String, String> outOutPatternOptionMap { get; set; } |
| | | public static String outOutPattern { get; set; } |
| | | public static Boolean hasHos { get; set; } |
| | | @AuraEnabled |
| | | public static Boolean hasHosPro { get; set; } |
| | | |
| | | private static Map<String, String> HosProMap = new Map<String, String>(); |
| | | //add by rentx 2021-01-29 |
| | | |
| | | public LexSummonsCreatController() { |
| | | System.debug('LexSummonsCreatController'); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | // ESetId = ApexPages.currentPage().getParameters().get('esetId'); |
| | | // arriveorder = ApexPages.currentPage().getParameters().get('arriveorder'); |
| | | // statusEdit = ApexPages.currentPage().getParameters().get('KeyWords'); |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInvoiceRecords = new List<Consumable_order__c>(); |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | outOutPatternOptionMap = new Map<String, String>(); |
| | | outOutPatternOptionMap.put('', '-无-'); |
| | | outOutPatternOptionMap.put('ishos', '医院特价产品'); |
| | | outOutPatternOptionMap.put('nothos', '非医院特价产品'); |
| | | |
| | | outOutPatternOptionList.add(new SelectOption('', '-无-')); |
| | | outOutPatternOptionList.add(new SelectOption('ishos', '医院特价产品')); |
| | | outOutPatternOptionList.add(new SelectOption('nothos', '非医院特价产品')); |
| | | HospitalName = ''; |
| | | } |
| | | |
| | | public static void firstInit(String ESetidJs) { |
| | | System.debug('enter firstInit'); |
| | | ESetid = ESetidJs; |
| | | System.debug('ESetid = ' + ESetid); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | attachmentRecoeds = new List<ConsumableorderdetailsInfo>(); |
| | | consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>(); |
| | | consumableInvoiceRecords = new List<Consumable_order__c>(); |
| | | categoryOptionList = new List<SelectOption>(); |
| | | category4OptionList = new List<SelectOption>(); |
| | | category5OptionList = new List<SelectOption>(); |
| | | |
| | | categoryOptionMap = new Map<String, String>(); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category5OptionMap = new Map<String, String>(); |
| | | |
| | | outOutPatternOptionMap = new Map<String, String>(); |
| | | outOutPatternOptionMap.put('', '-无-'); |
| | | outOutPatternOptionMap.put('ishos', '医院特价产品'); |
| | | outOutPatternOptionMap.put('nothos', '非医院特价产品'); |
| | | |
| | | // outOutPatternOptionList.add(new SelectOption('', '-无-')); |
| | | // outOutPatternOptionList.add(new SelectOption('ishos', '医院特价产品')); |
| | | // outOutPatternOptionList.add(new SelectOption('nothos', '非医院特价产品')); |
| | | HospitalName = ''; |
| | | } |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) { |
| | | // try { |
| | | firstInit(ESetidJs); |
| | | statusEdit = statusEdit; |
| | | arriveorder = ''; |
| | | HospitalName = ''; |
| | | provinceOpts = new List<SelectOption>(); |
| | | provinceOptsMap = new Map<String, String>(); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | // public static Integer pagesize { get; set; } |
| | | // public static Integer pageToken { get; set; } |
| | | // public static String sortField { get; set; } |
| | | // public static String sortOrder { get; set; } |
| | | pagesize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | |
| | | // sortKey = '1'; |
| | | // preSortKey = '1'; |
| | | // sortOrderAsc = false; |
| | | // sortOrder = new List<String>(8); |
| | | // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' }; |
| | | //cate1ForSort = ''; |
| | | sumPrice = 0; |
| | | IdCheck = EsetId; |
| | | if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = false; |
| | | } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()]; |
| | | //userId = '00510000005QO75'; |
| | | user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | accountid = Useracc.accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | | if (String.isBlank(Useracc.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Account accountInfo = [SELECT Name FROM account WHERE id = :accountid]; |
| | | accountName = accountInfo.Name; |
| | | //coc.Order_date__c = Date.today(); |
| | | list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>(); |
| | | Dealerelationship = [ |
| | | SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name |
| | | FROM Dealer_elationship__c |
| | | WHERE Dealer_principal__c = :accountid |
| | | ]; |
| | | |
| | | List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>(); |
| | | AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid]; |
| | | |
| | | //add by rentx 2021-3-1 start |
| | | //判断当前经销商下是否有特价医院 |
| | | List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | if (hlist == null || hlist.size() == 0) { |
| | | hasHos = false; |
| | | } else { |
| | | for (hospitalprice__c hp : hlist) { |
| | | HosProMap.put(hp.product__c, ''); |
| | | } |
| | | hasHos = true; |
| | | } |
| | | //add by rentx 2021-3-1 end |
| | | |
| | | saveBtnDisabled = false; |
| | | SorderBtnDisabled = false; |
| | | String sqlagencyProType = '%' + agencyProType + '%'; |
| | | coc = new Consumable_order__c(); |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //add by rentx 2021-01-29 |
| | | Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //add by rentx 2021-01-29 |
| | | |
| | | List<AggregateResult> orderdetailCount = [ |
| | | SELECT count(id), Consumable_Product__c cpc, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountName |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | GROUP BY Consumable_Product__c, Box_Piece__c |
| | | ]; |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | | System.debug('sqlagencyProType = ' + sqlagencyProType); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug('accountName = ' + accountName); |
| | | List<Consumable_order_details2__c> CountDel = [ |
| | | SELECT |
| | | Id, |
| | | Bar_Code__c, |
| | | Name, |
| | | Inventory_date__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Recordtypeid, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx 2020-11-27 start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx 2020-11-27 end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Dealer_Returned__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocation |
| | | AND Dealer_Info_text__c = :accountName |
| | | ]; |
| | | // 新規 |
| | | if (ESetId == null || ESetId == '') { |
| | | SummonsFlag = 'hidden'; |
| | | String msoql = makeSoqlinventory(); |
| | | initStandardController(msoql); |
| | | System.debug('msoql = ' + msoql); |
| | | product2Selected = Database.query(msoql); |
| | | if (String.isBlank(arriveorder)) { |
| | | EditDelCommitBtnDisabled = true; |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | System.debug('MidMap2.size() = ' + MidMap2.size()); |
| | | /*//然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | }else{ |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage); |
| | | }*/ |
| | | } |
| | | |
| | | //update by rentx 2021-01-29 end |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | //if(bss.allnumber>0){ |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | //add by rentx 2021-3-10 |
| | | if (ass.hospitalSpecialOffer) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords1'); |
| | | makepagerecords(); |
| | | //listCut(); |
| | | } else { |
| | | if (statusEdit == '' || statusEdit == null) { |
| | | editAble = false; |
| | | } else if (statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | // upadte start by vivek 2019-7-15 |
| | | // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c, |
| | | // Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c, |
| | | // Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c, |
| | | // Order_status__c,Shipment_total_amount__c,Offers_Price__c, |
| | | // Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c |
| | | // FROM Consumable_order__c |
| | | // WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation |
| | | // AND recordtypeid = :System.Label.RT_ConOrder_Arrive]; |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Summons_Order_type__c, |
| | | NoConfirmedPrice__c, |
| | | SummonsStatus_c__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForDealerTextID__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Order_date__c, |
| | | Arrive_Order__c, |
| | | Order_status__c, |
| | | Shipment_total_amount__c, |
| | | Offers_Price__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | Order_ForCustomerText__c, |
| | | ConInvoice_Code__c, |
| | | Onchange_order__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE |
| | | Id = :arriveorder |
| | | AND Order_Owner_WorkLocal__c = :userWorkLocation |
| | | AND recordtypeid = :System.Label.RT_ConOrder_Arrive |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | //明细1获取 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Sum_of_money__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_count__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | InvoiceProNot_count__c, |
| | | //Unitprice_To_agency__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :coc.Arrive_Order__c |
| | | ORDER BY Name |
| | | ]; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | } |
| | | msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | /*for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | |
| | | }*/ |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size())); |
| | | //return; |
| | | |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | cdc1.Shipment_Count__c = cdc1.Consumable_count__c; |
| | | if (ass.prod.Id == cdc1.Consumable_Product__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | } |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords2'); |
| | | makepagerecords(); |
| | | consumablearriveproductdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Sterilization_limit__c, |
| | | Deliver_date__c, |
| | | Bar_Code__c, |
| | | Arrive_date__c, |
| | | Send_Date__c, |
| | | Consumable_order_minor__r.Name, |
| | | Consumable_order_minor__c, |
| | | Dealer_Arrive__c, |
| | | Delivery_List_RMB__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Consumable_order_minor__c = :coc.Arrive_Order__c |
| | | AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery |
| | | AND Dealer_Arrive__c = TRUE |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | if ( |
| | | consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c && |
| | | HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c) |
| | | ) { |
| | | coc.OutPattern__c = true; |
| | | } |
| | | consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } |
| | | } else { |
| | | // 更新、 |
| | | SummonsFlag = 'visible'; |
| | | // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select |
| | | consumableInvoiceRecords = [ |
| | | SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c |
| | | FROM Consumable_order__c |
| | | WHERE |
| | | Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId) |
| | | AND Invoice_status__c != '草案中' |
| | | ]; |
| | | |
| | | System.debug('coc ESetId = ' + ESetId); |
| | | System.debug('coc userWorkLocation = ' + userWorkLocation); |
| | | coc = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Summons_Order_type__c, |
| | | NoConfirmedPrice__c, |
| | | SummonsStatus_c__c, |
| | | Order_ForDealerText__c, |
| | | Dealer_Info__c, |
| | | Order_ForDealer__c, |
| | | Order_ForDealer__r.Name, |
| | | Order_ForDealerTextID__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Order_date__c, |
| | | Arrive_Order__c, |
| | | Order_status__c, |
| | | Shipment_total_amount__c, |
| | | Offers_Price__c, |
| | | Billed_Status__c, |
| | | ShipmentAccount__c, |
| | | Order_Dealer_Info__c, |
| | | Order_ForCustomerText__c, |
| | | ConInvoice_Code__c, |
| | | Onchange_order__c, |
| | | OutPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票' |
| | | ]; |
| | | // update start by vivek 2019-7-15 |
| | | if (getExistarrive()) { |
| | | arriveorder = coc.Arrive_Order__c; |
| | | } |
| | | // 到货订单来的时候 |
| | | if (getExistarrive()) { |
| | | if (editAble) { |
| | | alertMessage = '到货订单直接出库,出库单明细不可编辑'; |
| | | } |
| | | if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') { |
| | | system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c); |
| | | saveBtnDisabled = true; |
| | | SorderBtnDisabled = true; |
| | | EditDelCommitBtnDisabled = false; |
| | | } |
| | | //医院二级经销商分类 |
| | | Integer io = 0; |
| | | while (io < Dealerelationship.size()) { |
| | | if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) { |
| | | SecondDealer = Dealerelationship[io].Dealer_subordinate__c; |
| | | coc.Order_ForDealer__c = null; |
| | | io = io + Dealerelationship.size(); |
| | | } |
| | | io++; |
| | | } |
| | | |
| | | Integer ik = 0; |
| | | while (ik < AgencyHospitalLink.size()) { |
| | | if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) { |
| | | HospitalInfo = AgencyHospitalLink[ik].Hospital__c; |
| | | HospitalName = AgencyHospitalLink[ik].Hospital__r.Name; |
| | | coc.Order_ForHospital__c = null; |
| | | ik = ik + AgencyHospitalLink.size(); |
| | | } |
| | | ik++; |
| | | } |
| | | //出库单明细1取得 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Shipment_amount__c, |
| | | //Unitprice_To_agency__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | InvoiceProNot_count__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Shipment_amount__c; |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | //add by rentx 2021-2-26 |
| | | String tempId = cdc1.Consumable_product__c; |
| | | if (cdc1.isOutPattern__c) { |
| | | cocMap.put(tempId + 'ishos', cdc1); |
| | | } else { |
| | | cocMap.put(tempId + 'nothos', cdc1); |
| | | } |
| | | //add by rentx 2021-2-26 |
| | | } |
| | | String msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | /*for(Integer i = 0 ; i< CountDel.size();i++){ |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){ |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c); |
| | | Jstage.allnumber = Jstage.allnumber+1 ; |
| | | if(CountDel[i].Box_Piece__c == '盒'){ |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | }else if(CountDel[i].Box_Piece__c == '个'){ |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap.put(CountDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | }*/ |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | //update by rentx 2021-01-29 |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | |
| | | //if(bss.allnumber > 0){ |
| | | //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format(); |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | |
| | | //update by rentx 2021-2-26 start |
| | | if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | //update by rentx 2021-2-26 end |
| | | // consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | //update by rentx 2012-3-1 start |
| | | // if(ass.prod.Id == cdc1.Consumable_Product__c){ |
| | | // ass.check = true; |
| | | // ass.orderdetails1 = cdc1; |
| | | // } |
| | | if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | //update by rentx 2012-3-1 end |
| | | } |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords3'); |
| | | makepagerecords(); |
| | | //listCut(); |
| | | // 消耗品明细2を取得 |
| | | consumableorderdetails2RecordsList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SerialLotNo__c, |
| | | Consumable_Product__r.Name__c, |
| | | TracingCode__c, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Return_date__c, |
| | | Invoice_Date__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) { |
| | | consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i])); |
| | | } |
| | | //产品明细取得 |
| | | consumablearriveproductdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Name, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) { |
| | | consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i])); |
| | | } |
| | | } else { |
| | | // 不是到货订单来的时候 |
| | | if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') { |
| | | system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c); |
| | | saveBtnDisabled = true; |
| | | SorderBtnDisabled = true; |
| | | EditDelCommitBtnDisabled = false; |
| | | } |
| | | //医院二级经销商分类 |
| | | Integer io = 0; |
| | | while (io < Dealerelationship.size()) { |
| | | if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) { |
| | | SecondDealer = Dealerelationship[io].Dealer_subordinate__c; |
| | | coc.Order_ForDealer__c = null; |
| | | io = io + Dealerelationship.size(); |
| | | } |
| | | io++; |
| | | } |
| | | Integer ik = 0; |
| | | while (ik < AgencyHospitalLink.size()) { |
| | | if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) { |
| | | HospitalInfo = AgencyHospitalLink[ik].Hospital__c; |
| | | HospitalName = AgencyHospitalLink[ik].Hospital__r.Name; |
| | | coc.Order_ForHospital__c = null; |
| | | ik = ik + AgencyHospitalLink.size(); |
| | | } |
| | | ik++; |
| | | } |
| | | // 消耗品明细1を取得 |
| | | consumableorderdetailsSelected = [ |
| | | SELECT |
| | | Id, |
| | | Dealer_Custom_Price__c, |
| | | Delivery_List_RMB__c, |
| | | Consumable_Product__r.Name__c, |
| | | Consumable_Product__r.SFDA_Status__c, |
| | | Name, |
| | | Consumable_order__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Shipment_Count__c, |
| | | Consumable_Product__r.Intra_Trade_List_RMB__c, |
| | | Consumable_Product__r.Asset_Model_No__c, |
| | | Shipment_amount__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | Invoiced_Procount__c, |
| | | RrturnPro_count__c, |
| | | //Unitprice_To_agency__c, |
| | | InvoiceProNot_count__c, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Approbation_No__c, |
| | | Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c, |
| | | isOutPattern__c |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation |
| | | ORDER BY Name |
| | | ]; |
| | | //add by rentx 202-2-26 |
| | | Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>(); |
| | | |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Shipment_amount__c; |
| | | orderzaikuId.add(cdc1.Consumable_Product__c); |
| | | //add by rentx 2021-2-26 |
| | | String tempId = cdc1.Consumable_product__c; |
| | | if (cdc1.isOutPattern__c) { |
| | | cocMap.put(tempId + 'ishos', cdc1); |
| | | } else { |
| | | cocMap.put(tempId + 'nothos', cdc1); |
| | | } |
| | | //add by rentx 2021-2-26 |
| | | } |
| | | |
| | | String msoql = makeSoqlorderdet(); |
| | | product2Selected = Database.query(msoql); |
| | | size = product2Selected.size(); |
| | | initStandardController(msoql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | //update by rentx 2021-01-29 |
| | | // for(ConsumableorderdetailsInfo bss : MidMap.values()){ |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | //update by rentx 2021-01-29 |
| | | |
| | | //if(bss.allnumber>0){ |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | |
| | | //update by rentx 2021-2-26 start |
| | | if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) { |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | } |
| | | // consumableorderdetailsSelectRecords.add(bss); |
| | | //} |
| | | } |
| | | // return null; |
| | | Integer ishosnum = 0; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) { |
| | | //ass.sortBy = sortOrderAsc; |
| | | for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) { |
| | | //update by rentx 2012-3-1 start |
| | | // if(ass.prod.Id == cdc1.Consumable_Product__c){ |
| | | // ass.check = true; |
| | | // ass.orderdetails1 = cdc1; |
| | | // } |
| | | if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) { |
| | | ass.check = true; |
| | | ass.orderdetails1 = cdc1; |
| | | } |
| | | //update by rentx 2012-3-1 end |
| | | } |
| | | |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | //add by rentx |
| | | noOfRecords = consumableorderdetailsSelectRecords.size(); |
| | | //add by rentx |
| | | System.debug('makepagerecords4'); |
| | | makepagerecords(); |
| | | |
| | | // 消耗品明细2を取得 |
| | | consumableorderdetails2RecordsList = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SerialLotNo__c, |
| | | Consumable_Product__r.Name__c, |
| | | TracingCode__c, |
| | | Sterilization_limit__c, |
| | | Consumable_Product__c, |
| | | Consumable_Product__r.Name, |
| | | Consumable_Product__r.Category3__c, |
| | | Consumable_Product__r.Category4__c, |
| | | Consumable_Product__r.Category5__c, |
| | | Return_date__c, |
| | | Invoice_Date__c, |
| | | Box_Piece__c, |
| | | ProductPacking_list_manual__c, |
| | | //add by rentx start |
| | | hospitalSpecialOffer__c |
| | | //add by rentx end |
| | | |
| | | FROM Consumable_order_details2__c |
| | | WHERE Consumable_ZS_order__c = :ESetId |
| | | ORDER BY Name |
| | | ]; |
| | | for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) { |
| | | consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i])); |
| | | } |
| | | } |
| | | } |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer)); |
| | | if (SecondDealer == null || SecondDealer == '') { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } else { |
| | | provinceOpts.add(new SelectOption('', '-无-')); |
| | | provinceOptsMap.put('', '-无-'); |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < Dealerelationship.size(); i++) { |
| | | if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) { |
| | | provinceOpts.add( |
| | | new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name) |
| | | ); |
| | | provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe(); |
| | | cansee = dfr.isAccessible(); |
| | | Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe(); |
| | | dealerPricesee = dealerPrice.isAccessible(); |
| | | // 显示数据条数信息 |
| | | // makeMessage(); |
| | | //附件 |
| | | attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId]; |
| | | if (attachmentinfo.size() > 0) { |
| | | for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | } |
| | | } |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | |
| | | categoryOptionList = new List<SelectOption>(); |
| | | categoryOptionList.add(new SelectOption('', '-无-')); |
| | | categoryOptionMap = new Map<String, String>(); |
| | | categoryOptionMap.put('', '-无-'); |
| | | for (AggregateResult category3Search : categoryList) { |
| | | String deliverycnt = String.valueOf(category3Search.get('c3c')); |
| | | categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt)); |
| | | categoryOptionMap.put(deliverycnt, deliverycnt); |
| | | } |
| | | |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | /*for(AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4)); |
| | | }*/ |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = pageRecords.size(); |
| | | System.debug('pageToken = ' + pageToken); |
| | | System.debug('pageSize = ' + pageSize); |
| | | System.debug('totalCount = ' + totalCount); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken); |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>(); |
| | | if (endIdx > pageRecords.size()) { |
| | | endIdx = pageRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageRecordsTemp.add(pageRecords.get(i)); |
| | | } |
| | | |
| | | Boolean Existarrive = (coc.Arrive_Order__c != null); |
| | | String ConsumableOut_report = System.Label.ConsumableOut_report; |
| | | System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords); |
| | | |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('ConsumableOut_report', ConsumableOut_report); |
| | | data.put('accountid', accountid); |
| | | data.put('consumableproductdetailsRecords', consumableproductdetailsRecords); |
| | | data.put('agencyProType', agencyProType); |
| | | data.put('accountName', accountName); |
| | | data.put('userWorkLocation', userWorkLocation); |
| | | data.put('categoryOptionMap', categoryOptionMap); |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | data.put('outOutPatternOptionMap', outOutPatternOptionMap); |
| | | data.put('hasHosPro', hasHosPro); |
| | | data.put('Existarrive', Existarrive); |
| | | data.put('sumPrice', sumPrice); |
| | | data.put('HospitalName', HospitalName); |
| | | data.put('provinceOptsMap', provinceOptsMap); |
| | | data.put('SummonsFlag', SummonsFlag); |
| | | data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled); |
| | | data.put('EditAble', EditAble); |
| | | data.put('coc', coc); |
| | | data.put('pageRecords', pageRecordsTemp); |
| | | data.put('arriveorder', arriveorder); |
| | | data.put('consumableorderdetails2Count', consumableorderdetails2Count); |
| | | data.put('consumableorderdetails2Records', consumableorderdetails2Records); |
| | | data.put('HospitalInfo', HospitalInfo); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | // } catch (Exception e) { |
| | | // return new ResponseBodyLWC('Error',500, e.getMessage(), ''); |
| | | // } |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryAllload(String category3Lwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | category3 = category3Lwc; |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC categoryload(String category3Lwc, String category4Lwc) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | category3 = category3Lwc; |
| | | category4 = category4Lwc; |
| | | AggregateResult[] category4List = [ |
| | | SELECT Count(id), Category4_text__c c4c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | | category4OptionMap.put('', '-无-'); |
| | | for (AggregateResult category4Search : category4List) { |
| | | String deliverycnt4 = String.valueOf(category4Search.get('c4c')); |
| | | category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4)); |
| | | category4OptionMap.put(deliverycnt4, deliverycnt4); |
| | | } |
| | | |
| | | AggregateResult[] category5List = [ |
| | | SELECT Count(id), Category5_text__c c5c |
| | | FROM Product2__c |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c = :category4 AND Category5_text__c != NULL |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | | category5OptionMap.put('', '-无-'); |
| | | for (AggregateResult category5Search : category5List) { |
| | | String deliverycnt5 = String.valueOf(category5Search.get('c5c')); |
| | | category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5)); |
| | | category5OptionMap.put(deliverycnt5, deliverycnt5); |
| | | } |
| | | data.put('category4OptionMap', category4OptionMap); |
| | | data.put('category5OptionMap', category5OptionMap); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // 检索 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC searchConsumableorderdetails( |
| | | String agencyProTypeLwc, |
| | | String accountNameLwc, |
| | | String userWorkLocationLwc, |
| | | String outOutPattern, |
| | | String category1, |
| | | String category3, |
| | | String category4, |
| | | String category5, |
| | | Boolean editAbleLwc, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc, |
| | | List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc, |
| | | String arriveorderLwc, |
| | | Integer pageSizeLWC, |
| | | Integer pageTokenLWC |
| | | ) { |
| | | consumableproductdetailsRecords = consumableproductdetailsRecordsLwc; |
| | | pageRecordsLwc = pageRecordsLwcLwc; |
| | | System.debug('pageRecordsLwc = ' + pageRecordsLwc); |
| | | arriveorder = arriveorderLwc; |
| | | accountName = accountNameLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | product2Selected = new List<Product2__c>(); |
| | | pagesize = pageSizeLWC; |
| | | pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC; |
| | | addSize = 0; |
| | | addData = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('start addData = ' + addData); |
| | | System.debug('accountName = ' + accountName); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | String sqlagencyProType = '%' + agencyProTypeLwc + '%'; |
| | | List<AggregateResult> orderdetailCount = [ |
| | | SELECT count(id), Consumable_Product__c cpc, Box_Piece__c |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Cancellation_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Isoverdue__c = 1 |
| | | AND Product_Type__c LIKE :sqlagencyProType |
| | | AND Dealer_Info_text__c = :accountNameLwc |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc |
| | | GROUP BY Consumable_Product__c, Box_Piece__c |
| | | ]; |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | | editAble = editAbleLwc; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | SearchDone = 'SearchDone'; |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>(); |
| | | //update by rentx 2021-01-29 |
| | | Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>(); |
| | | String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Dealer_Shipment__c = false AND Dealer_Saled__c = false AND Dealer_Returned__c = false AND Lose_Flag__c = false AND Bar_Code__c != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c = :userWorkLocation AND Dealer_Info_text__c = :accountName '; |
| | | if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) { |
| | | countdelSoql += ' AND hospitalSpecialOffer__c = true'; |
| | | } else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) { |
| | | countdelSoql += ' AND hospitalSpecialOffer__c = false'; |
| | | } |
| | | System.debug('countdelSoql = ' + countdelSoql); |
| | | List<Consumable_order_details2__c> CountDel = Database.query(countdelSoql); |
| | | System.debug('CountDel = ' + CountDel); |
| | | //update by rentx 2021-01-29 |
| | | |
| | | consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //consumableorderdetailsSelectRecords = reSet; |
| | | String soql = makeSoql(category1, category3, category4, category5); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(soql); |
| | | System.debug('soql = ' + soql); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | str = 'isHos'; |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | System.debug('MidMap = ' + MidMap); |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | | if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } else { |
| | | //midmap2中没有对应的产品 |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone(); |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | if (CountDel[i].Box_Piece__c == '盒') { |
| | | Jstage.Boxnumber = Jstage.Boxnumber + 1; |
| | | } else if (CountDel[i].Box_Piece__c == '个') { |
| | | Jstage.Piecenumber = Jstage.Piecenumber + 1; |
| | | } |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | | Jstage.hospitalSpecialOffer = true; |
| | | } else { |
| | | Jstage.hospitalSpecialOffer = false; |
| | | } |
| | | if (HosProMap.containsKey(Jstage.Prod.Id)) { |
| | | Jstage.hosPro = true; |
| | | } |
| | | //Jstage.BoxPiece = CountDel[i].Box_Piece__c; |
| | | MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage); |
| | | } |
| | | } |
| | | } |
| | | Integer ishosnum = 0; |
| | | System.debug('MidMap2 = ' + MidMap2); |
| | | for (ConsumableorderdetailsInfo bss : MidMap2.values()) { |
| | | if (selectedIdMap.containsKey(bss.Prod.id)) { |
| | | continue; |
| | | } else { |
| | | bss.sortBy = false; |
| | | bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsSelectRecords.add(bss); |
| | | |
| | | if (bss.hospitalSpecialOffer == true) { |
| | | ishosnum = ishosnum + 1; |
| | | } |
| | | } |
| | | } |
| | | if (ishosnum > 0) { |
| | | hasHosPro = true; |
| | | } else { |
| | | hasHosPro = false; |
| | | } |
| | | |
| | | consumableorderdetailsSelectRecords.sort(); |
| | | makepagerecordsLwc(); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = pageRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | System.debug('addSize = ' + addSize); |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | startIdx = pageToken; |
| | | endIdx = pageToken + pageSize; |
| | | List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>(); |
| | | if (endIdx > pageRecords.size()) { |
| | | endIdx = pageRecords.size(); |
| | | } |
| | | |
| | | System.debug('addData.size() = ' + addData.size()); |
| | | for (ConsumableorderdetailsInfo ci : addData) { |
| | | pageRecordsTemp.add(ci); |
| | | } |
| | | System.debug('startIdx = ' + startIdx); |
| | | System.debug('endIdx = ' + endIdx); |
| | | System.debug('skipData = ' + skipData); |
| | | System.debug('pageRecords = ' + pageRecords.size()); |
| | | String hos = ''; |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | System.debug('skipData.get(pageRecords.get(i).Prod.Id) = ' + skipData.get(pageRecords.get(i).Prod.Id)); |
| | | if (pageRecords.get(i).hospitalSpecialOffer == true) { |
| | | hos = 'ishos'; |
| | | } else { |
| | | hos = 'nothos'; |
| | | } |
| | | if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) { |
| | | pageRecordsTemp.add(pageRecords.get(i)); |
| | | } |
| | | } |
| | | |
| | | System.debug('pageRecordsTemp = ' + pageRecordsTemp.size()); |
| | | data.put('paginatedAccounts', paginatedAccounts); |
| | | data.put('pageRecords', pageRecordsTemp); |
| | | data.put('SearchDone', SearchDone); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | private static String makeSoql(String CateName, String Category3, String Category4, String Category5) { |
| | | String sqlTail1 = '(\''; |
| | | for (Integer i = 0; i < zaikuId.size(); i++) { |
| | | if (zaikuId[i] != null) { |
| | | if (i < zaikuId.size() - 1) { |
| | | sqlTail1 += zaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail1 += zaikuId[i]; |
| | | } |
| | | } |
| | | } |
| | | sqlTail1 += '\')'; |
| | | String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | soql += ' WHERE Id in' + sqlTail1; |
| | | if (!String.isBlank(CateName)) { |
| | | soql += |
| | | ' AND (Name__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\' or Asset_Model_No__c like \'%' + |
| | | String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + |
| | | '%\')'; |
| | | } |
| | | if (!String.isBlank(Category3)) { |
| | | soql += ' AND Category3__c = \'' + Category3 + '\''; |
| | | } |
| | | if (!String.isBlank(Category4)) { |
| | | soql += ' AND Category4__c = \'' + Category4 + '\''; |
| | | } |
| | | if (!String.isBlank(Category5)) { |
| | | soql += ' AND Category5__c = \'' + Category5 + '\''; |
| | | } |
| | | return soql; |
| | | } |
| | | |
| | | public static String makeSoqlorderdet() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < orderzaikuId.size(); i++) { |
| | | if (i < orderzaikuId.size() - 1) { |
| | | sqlTail += orderzaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += orderzaikuId[i]; |
| | | } |
| | | } |
| | | sqlTail += '\')'; |
| | | String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | msoql += ' WHERE Id in' + sqlTail; |
| | | return msoql; |
| | | } |
| | | |
| | | public static String makeSoqlinventory() { |
| | | String sqlTail = '(\''; |
| | | for (Integer i = 0; i < zaikuId.size(); i++) { |
| | | if (zaikuId[i] != null) { |
| | | if (i < zaikuId.size() - 1) { |
| | | sqlTail += zaikuId[i] + '\',\''; |
| | | } else { |
| | | sqlTail += zaikuId[i]; |
| | | } |
| | | } |
| | | } |
| | | sqlTail += '\')'; |
| | | String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c '; |
| | | msoql += ' WHERE Id in' + sqlTail; |
| | | return msoql; |
| | | } |
| | | |
| | | public static void initStandardController(String soql) { |
| | | // init standard controller |
| | | System.debug('soql =' + soql); |
| | | System.debug('initStandardController star'); |
| | | //setCon = new ApexPages.StandardSetController(Database.getQueryLocator(soql)); |
| | | // sets the number of records in each page set |
| | | //setCon.setPageSize(size); |
| | | System.debug('initStandardController end'); |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecords() { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | System.debug('zhj1'); |
| | | //取出选择的产品 |
| | | if (pageRecords != null) { |
| | | System.debug('zhj2'); |
| | | for (ConsumableorderdetailsInfo ass : pageRecords) { |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | } else { |
| | | selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | } |
| | | reSet.add(ass); |
| | | } |
| | | } |
| | | } |
| | | System.debug('zhj3'); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('reSet.size() = ' + reSet.size()); |
| | | if (editAble && String.isBlank(arriveorder)) { |
| | | pageRecords = reSet; |
| | | } |
| | | //Integer pagestartNo = (setCon.getPageNumber() * size)-size; |
| | | //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1); |
| | | Integer addNo = 0; |
| | | //update by rentx 2021-2-26 start |
| | | System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size()); |
| | | for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if ( |
| | | (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) || |
| | | (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos')) |
| | | ) { |
| | | addNo++; |
| | | } else { |
| | | if (info.check == false) { |
| | | info.orderdetails1 = orderdetails1; |
| | | } |
| | | pageRecords.add(info); |
| | | addNo++; |
| | | } |
| | | } |
| | | System.debug('pageRecords 2 = ' + pageRecords); |
| | | System.debug('zhj5'); |
| | | System.debug('pageRecords = ' + pageRecords); |
| | | return pageRecords; |
| | | } |
| | | |
| | | public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() { |
| | | List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>(); |
| | | Map<String, String> selectedIdMap = new Map<String, String>(); |
| | | skipData = new Map<String, String>(); |
| | | System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc); |
| | | //取出选择的产品 |
| | | if (pageRecordsLwc != null) { |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | System.debug('ass.check = ' + ass.check); |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id); |
| | | } else { |
| | | selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id); |
| | | } |
| | | reSetLwc.add(ass); |
| | | } |
| | | } |
| | | } |
| | | System.debug('selectedIdMap = ' + selectedIdMap); |
| | | pageRecords = new List<ConsumableorderdetailsInfo>(); |
| | | if (editAble && String.isBlank(arriveorder)) { |
| | | List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>(); |
| | | System.debug('reSetLwc = ' + reSetLwc); |
| | | for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) { |
| | | ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo(); |
| | | ci.check = assLwc.check; |
| | | ci.oldCheck = assLwc.oldCheck; |
| | | ci.orderdetails1 = assLwc.orderdetails1; |
| | | ci.orderdetails2 = assLwc.orderdetails2; |
| | | ci.Prod = assLwc.Prod; |
| | | ci.Boxnumber = assLwc.Boxnumber; |
| | | ci.Piecenumber = assLwc.Piecenumber; |
| | | ci.allnumber = assLwc.allnumber; |
| | | ci.oldConsumableCount = assLwc.oldConsumableCount; |
| | | ci.canSelect = assLwc.canSelect; |
| | | ci.sortBy = assLwc.sortBy; |
| | | ci.packinglist = assLwc.packinglist; |
| | | ci.approbation_No = assLwc.approbation_No; |
| | | ci.expiration_Date = assLwc.expiration_Date; |
| | | ci.boxorpiecein = assLwc.boxorpiecein; |
| | | ci.boxorpiece = assLwc.boxorpiece; |
| | | ci.boxorpieceMap = assLwc.boxorpieceMap; |
| | | ci.concc = assLwc.concc; |
| | | ci.BoxPiece = assLwc.BoxPiece; |
| | | ci.hospitalSpecialOffer = assLwc.hospitalSpecialOffer; |
| | | ci.hosPro = assLwc.hosPro; |
| | | reSet.add(ci); |
| | | } |
| | | pageRecords = reSet; |
| | | System.debug('reSet = ' + reSet); |
| | | addData = reSet.clone(); |
| | | System.debug('addData = reSet = ' + addData); |
| | | } |
| | | //Integer pagestartNo = (setCon.getPageNumber() * size)-size; |
| | | //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1); |
| | | Integer addNo = 0; |
| | | //update by rentx 2021-2-26 start |
| | | System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size()); |
| | | for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if ( |
| | | (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) || |
| | | (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos')) |
| | | ) { |
| | | System.debug('去掉的id : ' + info.Prod.Id); |
| | | addNo++; |
| | | addSize++; |
| | | } else { |
| | | if (info.check == false) { |
| | | info.orderdetails1 = orderdetails1; |
| | | } |
| | | pageRecords.add(info); |
| | | addNo++; |
| | | } |
| | | } |
| | | System.debug('pageRecords.size() = ' + pageRecords.size()); |
| | | System.debug('end addData = ' + addData); |
| | | return pageRecords; |
| | | } |
| | | |
| | | // 保存按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC save( |
| | | Consumable_order__c cocLwc, |
| | | String hospitalInfoLwc, |
| | | String hospitalNameLwc, |
| | | String secondaryDistributorLwc, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwc, |
| | | String accountidLwc, |
| | | String ESetIdLwc, |
| | | List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc, |
| | | String agencyProTypeLwc, |
| | | String userWorkLocationLwc |
| | | ) { |
| | | coc = cocLwc; |
| | | HospitalInfo = hospitalInfoLwc; |
| | | HospitalName = hospitalNameLwc; |
| | | SecondDealer = secondaryDistributorLwc; |
| | | pageRecordsLwc = pageRecordsLwc; |
| | | accountid = accountidLwc; |
| | | consumableproductdetailsRecords = consumableproductdetailsRecordsLwc; |
| | | ESetId = ESetIdLwc; |
| | | agencyProType = agencyProTypeLwc; |
| | | userWorkLocation = userWorkLocationLwc; |
| | | |
| | | System.debug('coc = ' + coc); |
| | | System.debug('HospitalInfo = ' + HospitalInfo); |
| | | System.debug('HospitalName = ' + HospitalName); |
| | | System.debug('SecondDealer = ' + SecondDealer); |
| | | System.debug('pageRecordsLwc = ' + pageRecordsLwc); |
| | | System.debug('accountid = ' + accountid); |
| | | System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords); |
| | | System.debug('ESetId = ' + ESetId); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | //订单信息确认 |
| | | if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) { |
| | | // coc.SummonsForDirction__c.addError('请输入指示单目的'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入指示单目的', ''); |
| | | } else if (coc.SummonsForDirction__c == '直接销售给医院') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('不需要二级经销商和经销商(录入)信息' ); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要二级经销商和经销商(录入)信息', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '医院试用') { |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '销售给二级经销商') { |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) { |
| | | // coc.addError('请输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入医院', ''); |
| | | } |
| | | if (String.isBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('请输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入科室', ''); |
| | | } |
| | | } else if (coc.SummonsForDirction__c == '互相调货') { |
| | | if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) { |
| | | // coc.addError('不需要输入医院'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入医院', ''); |
| | | } |
| | | if (String.isNotBlank(coc.Order_ForCustomerText__c)) { |
| | | // coc.Order_ForCustomerText__c.addError('不需要输入科室'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '不需要输入科室', ''); |
| | | } |
| | | if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) { |
| | | // coc.addError('必须输入二级经销商或经销商(录入)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '必须输入二级经销商或经销商(录入)', ''); |
| | | } |
| | | } |
| | | |
| | | Integer isHos = 0; |
| | | |
| | | Integer FLG = 0; |
| | | Integer Count = 0; |
| | | for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) { |
| | | FLG = FLG + 1; |
| | | if (CheckCount.check == false) { |
| | | Count = Count + 1; |
| | | } else { |
| | | //add by rentx |
| | | if (CheckCount.hospitalSpecialOffer) { |
| | | isHos = isHos + 1; |
| | | } |
| | | //add by rentx |
| | | } |
| | | } |
| | | if (Count == FLG) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请选择所需消耗品')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请选择所需消耗品', ''); |
| | | } |
| | | // gzw 注释 判断提前 20210308 |
| | | //checkOutPattern(); |
| | | //根据用户选中的产品给 出库单上的是否医院特价出库字段赋值 |
| | | Integer isHosCheckOutPattern = 0; |
| | | for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) { |
| | | if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) { |
| | | isHosCheckOutPattern = isHosCheckOutPattern + 1; |
| | | } |
| | | } |
| | | if (isHosCheckOutPattern > 0) { |
| | | coc.OutPattern__c = true; |
| | | } else { |
| | | coc.OutPattern__c = false; |
| | | } |
| | | |
| | | // add by rentx 2021-3-10 start |
| | | //特价医院出库非本医院维护的特价商品时,报错 非特价医院出库维护在医院特价关系表的产品时 报错 |
| | | if (coc.SummonsForDirction__c != '互相调货') { |
| | | //非特价医院出库特价产品时 报错(当前经销商下没有特价医院除外) |
| | | List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | //经销商对应医院下的所有特价产品 |
| | | Map<String, String> proMap = new Map<String, String>(); |
| | | //经销商下的所有特价产品 |
| | | Map<String, String> allProMap = new Map<String, String>(); |
| | | |
| | | if (hopList != null && hopList.size() > 0) { |
| | | Boolean flag = false; |
| | | if (HospitalInfo != null && HospitalInfo != '') { |
| | | for (hospitalprice__c hp : hopList) { |
| | | allProMap.put(hp.product__c, ''); |
| | | //如果当前 医院特价关系中的医院对应出库单上出库的医院,则放产品id到map |
| | | if (hp.hospital__c == HospitalInfo) { |
| | | flag = true; |
| | | proMap.put(hp.product__c, ''); |
| | | } |
| | | } |
| | | } |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | //判断选中的医院特价产品 |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | //用户选中了当前医院下的特价产品 |
| | | if (proMap.containsKey(ass.Prod.Id)) { |
| | | continue; |
| | | //用户选中了没有维护特价医院的特价产品 |
| | | } else if (!allProMap.containsKey(ass.Prod.Id)) { |
| | | continue; |
| | | } else { |
| | | //用户选中非当前医院维护的特价产品 |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '当前医院没有维护 消耗品:'+ ass.Prod.Name__c +' 的特价')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '当前医院没有维护 消耗品:' + ass.Prod.Name__c + '的特价', ''); |
| | | } |
| | | } //非医院特价产品可以出库给任意医院,所以不需要判断 |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | //如果是互相调货,判断 经销商(录入) 是否维护了 当前选中的特价产品 |
| | | List<hospitalprice__c> hopList = [ |
| | | SELECT id, hospital__c, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :coc.Order_ForDealerTextID__c |
| | | ]; |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (hopList != null && hopList.size() > 0) { |
| | | for (hospitalprice__c hpc : hopList) { |
| | | proMap.put(hpc.product__c, ''); |
| | | } |
| | | |
| | | String proStr = ''; |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.hospitalSpecialOffer == true) { |
| | | if (!proMap.containsKey(ass.Prod.Id)) { |
| | | proStr += ass.Prod.Name__c + ','; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (proStr != '') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '经销商:'+coc.Order_ForDealerText__c +' 没有消耗品:'+proStr.substring(0,proStr.length()-1) + ' 的特价')); |
| | | // return null; |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '经销商:' + |
| | | coc.Order_ForDealerText__c + |
| | | ' 没有消耗品:' + |
| | | proStr.substring(0, proStr.length() - 1) + |
| | | ' 的特价', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // checkOutPattern(); |
| | | Consumable_order__c p = new Consumable_order__c(); |
| | | List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>(); |
| | | List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | // try { |
| | | //新建订单时 |
| | | if (String.isEmpty(ESetId)) { |
| | | p.Name = '*'; |
| | | p.Order_type__c = '传票'; |
| | | p.Order_ProType__c = agencyProType; |
| | | if (coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c)) |
| | | coc.SummonsStatus_c__c = '草案中'; |
| | | // update strat by vivek 2019-7-12 |
| | | p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c; |
| | | // update end by vivek 2019-7-12 |
| | | p.SummonsStatus_c__c = coc.SummonsStatus_c__c; |
| | | if (coc.Arrive_Order__c != null) { |
| | | p.Arrive_Order__c = coc.Arrive_Order__c; |
| | | } |
| | | p.Offers_Price__c = coc.Offers_Price__c; |
| | | p.Dealer_Info__c = accountid; |
| | | if (String.isBlank(SecondDealer)) { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | } else { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | p.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | P.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.SummonsForDirction__c = coc.SummonsForDirction__c; |
| | | p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder; |
| | | // update start by vivek 2019-7-15 |
| | | p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c; |
| | | // update end by vivek 2019-7-15 |
| | | //add by rentx |
| | | p.OutPattern__c = coc.OutPattern__c; |
| | | //add by rentx |
| | | //Map<String,String> ProductNewMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } |
| | | |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } else if (ass.orderdetails1.Box_Piece__c == '个') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | insert p; |
| | | ESetId = p.id; |
| | | List<Consumable_order__c> detailName = new List<Consumable_order__c>(); |
| | | detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId]; |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = detailName[0].name + '-' + str; |
| | | InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c; |
| | | InsAfterDel.Consumable_order__c = p.id; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; |
| | | InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c; |
| | | // TODO 默认 盒 ,需要修正 |
| | | InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c; |
| | | InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c; |
| | | //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c; |
| | | InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c; |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | //add by rentx 2021-2-26 start |
| | | InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer; |
| | | //add by rentx 2021-2-26 end |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | // 如果 出库单 和 OCM发货Header连 的话,发货的Detail2 Copy到 出库单的Detail2里 |
| | | if (getExistarrive()) { |
| | | for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) { |
| | | //BlockForP; |
| | | Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c(); |
| | | InsProductDet.Id = ass.orderdetails2.Id; |
| | | InsProductDet.Consumable_ZS_order__c = p.id; |
| | | i++; |
| | | InsProduct.add(InsProductDet); |
| | | } |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | if (InsProduct.size() > 0) { |
| | | //ControllerUtil.updateOrderDetailsSatus(InsProduct); |
| | | update InsProduct; |
| | | } |
| | | } else if (ESetId != null || ESetId.length() > 0) { |
| | | //修改之后 保存订单 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select |
| | | cocinfo = [ |
| | | SELECT Id, Name, SummonsStatus_c__c, NoConfirmedPrice__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.Name = coc.Name; |
| | | p.Dealer_Info__c = accountid; |
| | | p.Order_ProType__c = agencyProType; |
| | | if (String.isEmpty(SecondDealer)) { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | System.debug('SecondDealer = ' + SecondDealer); |
| | | p.Order_ForDealer__c = null; |
| | | } else { |
| | | p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null; |
| | | p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c; |
| | | p.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | P.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c; |
| | | p.Order_date__c = coc.Order_date__c; |
| | | p.SummonsForDirction__c = coc.SummonsForDirction__c; |
| | | //add by rentx |
| | | p.OutPattern__c = coc.OutPattern__c; |
| | | // update start by vivek 2019-7-15 |
| | | if (p.SummonsStatus_c__c == '价格未定') { |
| | | p.NoConfirmedPrice__c = false; |
| | | p.SummonsStatus_c__c = '已完成'; |
| | | } else { |
| | | p.SummonsStatus_c__c = '草案中'; |
| | | } |
| | | // p.SummonsStatus_c__c = '草案中'; |
| | | // update end by vivek 2019-7-15 |
| | | Integer i = 1; |
| | | //Map<String,String> ProductOldMap = new Map<String, String>(); |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | | if (ass.orderdetails1.Delivery_List_RMB__c < 0) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | | ass.orderdetails1.Delivery_List_RMB__c == 0 && |
| | | (coc.SummonsForDirction__c == '销售给二级经销商' || |
| | | coc.SummonsForDirction__c == '直接销售给医院') |
| | | ) { |
| | | // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') { |
| | | // ass.orderdetails1.Box_Piece__c.addError('请输入单位'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入单位', ''); |
| | | } |
| | | if (ass.orderdetails1.Box_Piece__c == '盒') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) { |
| | | //ass.orderdetails1.Shipment_Count__c.addError('库存不足'); |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } else if (ass.orderdetails1.Box_Piece__c == '个') { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) { |
| | | if (ass.oldCheck == false) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.Prod.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.Prod.Name__c + '库存不足', ''); |
| | | } else { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | '' |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) { |
| | | // ass.orderdetails1.Shipment_Count__c.addError('请输入出货数量'); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货数量', ''); |
| | | } else { |
| | | String str = string.valueOf(i); |
| | | if (str.length() == 1) { |
| | | str = '0' + str; |
| | | } |
| | | InsAfterDel.Name = p.name + '-' + str; |
| | | InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c; |
| | | InsAfterDel.Consumable_order__c = ESetId; |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; |
| | | InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c; |
| | | InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c; |
| | | InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c; |
| | | //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c; |
| | | InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c; |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | //add by rentx 2021-2-26 start |
| | | InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer; |
| | | //add by rentx 2021-2-26 end |
| | | i++; |
| | | Ins.add(InsAfterDel); |
| | | } |
| | | } |
| | | } |
| | | update p; |
| | | List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>(); |
| | | qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | | if (Ins.size() > 0) { |
| | | insert Ins; |
| | | } |
| | | } |
| | | // }catch (Exception ex) { |
| | | // Database.rollback(sp); |
| | | // // ApexPages.addMessages(ex); |
| | | // // return null; |
| | | // //return new ResponseBodyLWC('Error',500, ex.getMessage(), ''); |
| | | // return new ResponseBodyLWC('Error',500, JSON.serialize(ex), ''); |
| | | // } |
| | | data.put('ESetId', ESetId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | public static void checkOutPattern() { |
| | | //根据用户选中的产品给 出库单上的是否医院特价出库字段赋值 |
| | | Integer isHos = 0; |
| | | for (ConsumableorderdetailsInfo CheckCount : pageRecords) { |
| | | if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) { |
| | | ishos = ishos + 1; |
| | | } |
| | | } |
| | | if (isHos > 0) { |
| | | coc.OutPattern__c = true; |
| | | } else { |
| | | coc.OutPattern__c = false; |
| | | } |
| | | } |
| | | |
| | | //打印PDF |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc, String ESetId) { |
| | | System.debug('cocLwc = ' + cocLwc); |
| | | System.debug('ESetId = ' + ESetId); |
| | | coc = cocLwc; |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | if (coc.SummonsStatus_c__c == '批准') { |
| | | Consumable_order__c P = new Consumable_order__c(); |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | SummonsStatus_c__c, |
| | | NoConfirmedPrice__c, |
| | | Dealer_Info__c, |
| | | Order_ForHospital__c, |
| | | SummonsForDirction__c, |
| | | Billed_Status__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | | // update end by vivek 2019-7-15 |
| | | if (cocinfo.size() > 0) { |
| | | p = cocinfo[0]; |
| | | } |
| | | p.SummonsStatus_c__c = '出库单已打印'; |
| | | update p; |
| | | } |
| | | data.put('ESetId', ESetId); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //查找经销商 |
| | | @AuraEnabled(cacheable=true scope='global') |
| | | public static List<LookupSearchResult> search(String searchTerm) { |
| | | System.debug('searchTerm = ' + searchTerm); |
| | | String nameCondition = ''; |
| | | nameCondition += '%' + String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) + '%'; |
| | | List<Account> accs = new List<Account>(); |
| | | System.debug('nameCondition = ' + nameCondition); |
| | | //查询条件修改 |
| | | //筛选判断条件:当前财年的4/1 ~ 第二年的6/30 & ET or ENG类型 & 当前用户类型 |
| | | //1 and 2 |
| | | //1. Integer year 2022/4/1 ~ 2023/6/30 |
| | | //开始日期 + 结束日期 |
| | | //Contract_Decide_Start_Date__c>=开始日期 and Contract_Decide_End_Date__c<结束日期 |
| | | //2. 添加经销商允销类型: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 |
| | | WHERE |
| | | (Id IN :pids |
| | | OR (Name = '奥林巴斯(北京)销售服务有限公司' |
| | | AND Name LIKE :nameCondition)) |
| | | AND RecordType.DeveloperName = 'Agency' |
| | | ORDER BY Name |
| | | LIMIT 49 |
| | | ]; |
| | | |
| | | // accs = [ |
| | | // SELECT id, Parentid |
| | | // FROM Account |
| | | // WHERE |
| | | // Parent.Name LIKE :nameCondition |
| | | // AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | // AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | // ]; |
| | | |
| | | // 用于保存特约经销商匹配到的其父类的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) { |
| | | String subtitle = account.BillingCity == null ? 'Account' : 'Account • ' + account.BillingCity; |
| | | results.add(new LookupSearchResult(account.Id, 'Account', accountIcon, account.Name, subtitle)); |
| | | } |
| | | results.sort(); |
| | | System.debug('results = ' + results); |
| | | return results; |
| | | } |
| | | |
| | | //保存附件 |
| | | @AuraEnabled |
| | | public static String saveFile(Id recordId, String fileName, String base64Data) { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | | ContentVersion cv = new ContentVersion(); |
| | | cv.Title = fileName; |
| | | cv.PathOnClient = '/' + fileName; |
| | | cv.FirstPublishLocationId = recordId; |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | return cv.Id; |
| | | } |
| | | |
| | | //获取附件 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC getFiles(Id recordId) { |
| | | System.debug('getFiles recordId = ' + recordId); |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | List<ContentVersion> cvList = [ |
| | | SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :recordId |
| | | ]; |
| | | data.put('cvList', cvList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //跳转出货/销售 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC GoodsDelivery( |
| | | Consumable_order__c cocLwc, |
| | | String ESetId, |
| | | List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc |
| | | ) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | coc = cocLwc; |
| | | ESetId = ESetId; |
| | | pageRecordsLwc = pageRecordsLwcLwc; |
| | | if (coc.SummonsForDirction__c == '互相调货') { |
| | | List<Account> accList = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE Name = :coc.Order_ForDealerText__c AND RecordType.DeveloperName = 'Agency' |
| | | ]; |
| | | if (accList.size() < 1) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请输入二级经销商全称!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请输入二级经销商全称!', ''); |
| | | } |
| | | } |
| | | if (coc.SummonsStatus_c__c == '批准') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请先打印指示单!')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '请先打印指示单!', ''); |
| | | } |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '消耗品'+ ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足')); |
| | | // return null; |
| | | return new ResponseBodyLWC('Error', 500, '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', ''); |
| | | } |
| | | } |
| | | data.put('ESetid', ESetid); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | //删除按钮 |
| | | @AuraEnabled |
| | | public static ResponseBodyLWC DelConsumable(String ESetId) { |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | |
| | | ESetId = ESetId; |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>(); |
| | | Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId]; |
| | | if (Dqs.size() > 0 || qs.size() > 0) { |
| | | delete Dqs; |
| | | delete qs; |
| | | } |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | System.debug(e.getMessage() + e.getLineNumber()); |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage(), ''); |
| | | } |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } |
| | | |
| | | // Data Bean |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Boxnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Piecenumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Integer packinglist { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String boxorpiecein { get; set; } |
| | | |
| | | public List<SelectOption> boxorpiece { get; set; } |
| | | @AuraEnabled |
| | | public Map<String, String> boxorpieceMap { get; set; } |
| | | @AuraEnabled |
| | | public Attachment concc { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hosPro { get; set; } |
| | | |
| | | public ConsumableorderdetailsInfo() { |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | orderdetails1 = e; |
| | | orderdetails2 = new Consumable_order_details2__c(); |
| | | Prod = e.Consumable_Product__r; |
| | | oldConsumableCount = e.Shipment_Count__c; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | BoxPiece = e.Box_Piece__c; |
| | | boxorpiece = new List<SelectOption>(); |
| | | boxorpiece.add(new SelectOption('盒', '盒')); |
| | | boxorpiece.add(new SelectOption('个', '个')); |
| | | |
| | | boxorpieceMap = new Map<String, String>(); |
| | | boxorpieceMap.put('盒', '盒'); |
| | | boxorpieceMap.put('个', '个'); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | // 消耗品发货明细 |
| | | public ConsumableorderdetailsInfo(Consumable_order_details2__c e) { |
| | | check = true; |
| | | oldCheck = true; |
| | | orderdetails1 = new Consumable_Orderdetails__c(); |
| | | orderdetails2 = e; |
| | | Prod = e.Consumable_Product__r; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | //boxorpiece = new List<SelectOption>(); |
| | | //boxorpiece.add(new SelectOption('盒', '盒')); |
| | | //boxorpiece.add(new SelectOption('个', '个')); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | //附件 |
| | | public ConsumableorderdetailsInfo(Attachment e) { |
| | | concc = e; |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | public ConsumableorderdetailsInfo(Product2__c e) { |
| | | check = false; |
| | | oldCheck = false; |
| | | orderdetails1 = new Consumable_Orderdetails__c(); |
| | | orderdetails2 = new Consumable_order_details2__c(); |
| | | Prod = e; |
| | | //oldConsumableCount = null; |
| | | canSelect = true; |
| | | allnumber = 0; |
| | | Boxnumber = 0; |
| | | Piecenumber = 0; |
| | | orderdetails1.Box_Piece__c = '盒'; |
| | | boxorpiece = new List<SelectOption>(); |
| | | boxorpiece.add(new SelectOption('盒', '盒')); |
| | | boxorpiece.add(new SelectOption('个', '个')); |
| | | |
| | | boxorpieceMap = new Map<String, String>(); |
| | | boxorpieceMap.put('盒', '盒'); |
| | | boxorpieceMap.put('个', '个'); |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | |
| | | // 排序 |
| | | public Integer compareTo(Object compareTo) { |
| | | ConsumableorderdetailsInfo compareToorderdetails1 = (ConsumableorderdetailsInfo) compareTo; |
| | | Integer returnValue = 0; |
| | | if (sortBy == false) { |
| | | if (Boxnumber > compareToorderdetails1.Boxnumber) { |
| | | returnValue = -1; |
| | | } else if (Boxnumber < compareToorderdetails1.Boxnumber) { |
| | | returnValue = 1; |
| | | } |
| | | return returnValue; |
| | | } else { |
| | | if (Boxnumber > compareToorderdetails1.Boxnumber) { |
| | | returnValue = 1; |
| | | } else if (Boxnumber < compareToorderdetails1.Boxnumber) { |
| | | returnValue = -1; |
| | | } |
| | | return returnValue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfoLwc { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | | public Boolean oldCheck { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_Orderdetails__c orderdetails1 { get; set; } |
| | | @AuraEnabled |
| | | public Consumable_order_details2__c orderdetails2 { get; set; } |
| | | @AuraEnabled |
| | | public Product2__c Prod { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Boxnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal Piecenumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal allnumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal oldConsumableCount { get; set; } |
| | | @AuraEnabled |
| | | public Boolean canSelect { get; set; } |
| | | @AuraEnabled |
| | | public Boolean sortBy { get; set; } |
| | | @AuraEnabled |
| | | public Integer packinglist { get; set; } |
| | | @AuraEnabled |
| | | public String approbation_No { get; set; } |
| | | @AuraEnabled |
| | | public Date expiration_Date { get; set; } |
| | | @AuraEnabled |
| | | public String boxorpiecein { get; set; } |
| | | public List<SelectOption> boxorpiece { get; set; } |
| | | @AuraEnabled |
| | | public Map<String, String> boxorpieceMap { get; set; } |
| | | @AuraEnabled |
| | | public Attachment concc { get; set; } |
| | | @AuraEnabled |
| | | public String BoxPiece { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hospitalSpecialOffer { get; set; } |
| | | @AuraEnabled |
| | | public Boolean hosPro { get; set; } |
| | | @AuraEnabled |
| | | public List<Map<String, String>> unitOptions { get; set; } |
| | | @AuraEnabled |
| | | public String unitValue { get; set; } |
| | | @AuraEnabled |
| | | public Integer shipmentNumber { get; set; } |
| | | @AuraEnabled |
| | | public Decimal shippingUnitPrice { get; set; } |
| | | @AuraEnabled |
| | | public String recordId { get; set; } |
| | | @AuraEnabled |
| | | public String Id { get; set; } |
| | | @AuraEnabled |
| | | public String Name { get; set; } |
| | | @AuraEnabled |
| | | public String Category3 { get; set; } |
| | | @AuraEnabled |
| | | public String Category4 { get; set; } |
| | | @AuraEnabled |
| | | public String Category5 { get; set; } |
| | | } |
| | | |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | } |
| force-app/main/default/classes/LexSummonsCreatController.cls-meta.xml
force-app/main/default/classes/LexTopPageController.cls
force-app/main/default/classes/LexTopPageController.cls-meta.xml
force-app/main/default/classes/LexUpAccountProLimit.cls
force-app/main/default/classes/LexUpAccountProLimit.cls-meta.xml
force-app/main/default/classes/LexUtility.cls
force-app/main/default/classes/LexUtility.cls-meta.xml
force-app/main/default/classes/LookupSearchResult.cls
force-app/main/default/classes/LookupSearchResult.cls-meta.xml
force-app/main/default/classes/LostCancelReportHandler.cls
force-app/main/default/classes/NFM103Controller.cls
force-app/main/default/classes/NFM104Rest.cls
force-app/main/default/classes/NFM105Rest.cls
force-app/main/default/classes/NFM110Rest.cls
force-app/main/default/classes/NFM202Controller.cls
force-app/main/default/classes/NewMCAgentLimitPDFController.cls
force-app/main/default/classes/NewMCAgentPDFController.cls
force-app/main/default/classes/NewMCAgentUpperLimitPDFController.cls
force-app/main/default/classes/NewMCHLimitPDFController.cls
force-app/main/default/classes/NewMCHPDFController.cls
force-app/main/default/classes/NewMCHUpperLimitPDFController.cls
force-app/main/default/classes/OdsToUserHandler.cls
force-app/main/default/classes/OpdAmountBatch.cls
force-app/main/default/classes/OpportunityTrigger.cls
force-app/main/default/classes/PCLLostReportController.cls
force-app/main/default/classes/PrintConsumblePDFController.cls
force-app/main/default/classes/Product2Handler.cls
force-app/main/default/classes/QuotePDFExtensionController.cls
force-app/main/default/classes/RepairBeforeInsertHandler.cls
force-app/main/default/classes/RepairTrigger.cls
force-app/main/default/classes/RollupToHPBatch.cls
force-app/main/default/classes/RollupToMaintenanceContractBatch.cls
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/boxorpieceType/boxorpieceType.html
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js-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/customLightningDatatable/customLightningDatatable.html
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js-meta.xml
force-app/main/default/lwc/customLightningDatatable/templates/boxorpieceType.html
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/customShipmentAmountComp/customShipmentAmountComp.js
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js-meta.xml
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js-meta.xml
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js-meta.xml
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/customUnitComp/customUnitComp.js-meta.xml
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/datatableWithCustomTypes/datatableWithCustomTypes.html
force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js
force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js-meta.xml
force-app/main/default/lwc/datatableWithCustomTypes/navigateToRecordTemplate.html
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/lexArriveGoodsMain/lexArriveGoodsMain.js-meta.xml
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/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml
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/lexConInvoiceView/lexConInvoiceView.js-meta.xml
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/lexConsumable/lexConsumable.js-meta.xml
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/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css
force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml
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/customAttachmentType.html
force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html
force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html
force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html
force-app/main/default/lwc/lexCustomLightningDatatable/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.html
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml
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.css
force-app/main/default/lwc/lexLookup/lexLookup.html
force-app/main/default/lwc/lexLookup/lexLookup.js
force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml
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/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml
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/lexOverdueStock/lexOverdueStock.js-meta.xml
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/lexRemoveBox/lexRemoveBox.js-meta.xml
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/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml
force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html
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/lexSummonsCreat/lexSummonsCreat.js-meta.xml
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/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml
force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html
force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html
force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html
force-app/main/default/lwc/myCustomTypeDatatable/customName.html
force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html
force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html
force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html
force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml
force-app/main/default/lwc/navigateToRecord/navigateToRecord.html
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml
force-app/main/default/lwc/paginator/paginator.css
force-app/main/default/lwc/paginator/paginator.html
force-app/main/default/lwc/paginator/paginator.js
force-app/main/default/lwc/paginator/paginator.js-meta.xml
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
manifest/packageForCloneButton.xml (deleted)
manifest/packageForPIPL.xml (deleted)
manifest/packageForPIPLPage.xml (deleted) |