From 44f866419cde0ff12a91d9c1d92daf9e36b063e1 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期四, 20 四月 2023 13:22:38 +0800
Subject: [PATCH] backup0420
---
force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml | 9
force-app/main/default/lwc/createCaseTest/__tests__/createCaseTest.test.js | 25
force-app/main/default/aura/TestCaseClick/TestCaseClick.design | 3
force-app/main/default/lwc/lexConsumable/lexConsumable.css | 3
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml | 9
force-app/main/default/lwc/childComponentTest/childComponentTest.js-meta.xml | 5
force-app/main/default/aura/TestCaseClick/TestCaseClick.svg | 7
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js | 178 ++
force-app/main/default/aura/TestCaseClick/TestCaseClick.auradoc | 6
force-app/main/default/lwc/createCaseTest/createCaseTest.js | 11
manifest/packageForLex.xml | 6
force-app/main/default/lwc/childComponentTest/__tests__/childComponentTest.test.js | 25
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html | 9
force-app/main/default/aura/TestCaseClick/TestCaseClickRenderer.js | 5
force-app/main/default/lwc/parentComponentTest/parentComponentTest.html | 44
force-app/main/default/classes/LexConsumableController.cls-meta.xml | 5
force-app/main/default/aura/TestCaseClick/TestCaseClickController.js | 5
force-app/main/default/lwc/childComponentTest/childComponentTest.html | 8
force-app/main/default/lwc/parentComponentTest/parentComponentTest.js-meta.xml | 9
force-app/main/default/lwc/parentComponentTest/parentComponentTest.js | 62
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | 81
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html | 66
force-app/main/default/lwc/lexConsumable/lexConsumable.js | 935 ++++++++++++
force-app/main/default/classes/LexConsumableController.cls | 2433 ++++++++++++++++++++++++++++++++
force-app/main/default/lwc/lexConsumable/lexConsumable.html | 507 ++++++
force-app/main/default/lwc/parentComponentTest/__tests__/parentComponentTest.test.js | 25
force-app/main/default/lwc/createCaseTest/createCaseTest.js-meta.xml | 5
force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp-meta.xml | 5
force-app/main/default/aura/TestCaseClick/TestCaseClickHelper.js | 5
force-app/main/default/lwc/childComponentTest/childComponentTest.js | 18
force-app/main/default/lwc/createCaseTest/createCaseTest.html | 14
force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp | 3
force-app/main/default/aura/TestCaseClick/TestCaseClick.css | 2
33 files changed, 4,498 insertions(+), 35 deletions(-)
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.auradoc b/force-app/main/default/aura/TestCaseClick/TestCaseClick.auradoc
new file mode 100644
index 0000000..d0d6eb5
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.auradoc
@@ -0,0 +1,6 @@
+<aura:documentation>
+ <aura:description>Documentation</aura:description>
+ <aura:example name="ExampleName" ref="exampleComponentName" label="Label">
+ Example Description
+ </aura:example>
+</aura:documentation>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp b/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp
new file mode 100644
index 0000000..3bdbd0c
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp
@@ -0,0 +1,3 @@
+<aura:component implements = "force:lightningQuickAction, force:hasRecordId" >
+ <c:createCaseTest recordId="{!v.recordId}" onclose="{!c.closeQA}"/>
+</aura:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp-meta.xml b/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp-meta.xml
new file mode 100644
index 0000000..30fe9d1
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.cmp-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <description>A Lightning Component Bundle</description>
+</AuraDefinitionBundle>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.css b/force-app/main/default/aura/TestCaseClick/TestCaseClick.css
new file mode 100644
index 0000000..f407185
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.css
@@ -0,0 +1,2 @@
+.THIS {
+}
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.design b/force-app/main/default/aura/TestCaseClick/TestCaseClick.design
new file mode 100644
index 0000000..d247163
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.design
@@ -0,0 +1,3 @@
+<design:component >
+
+</design:component>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClick.svg b/force-app/main/default/aura/TestCaseClick/TestCaseClick.svg
new file mode 100644
index 0000000..e201ae9
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClick.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E" />
+ <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF" />
+ </g>
+</svg>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClickController.js b/force-app/main/default/aura/TestCaseClick/TestCaseClickController.js
new file mode 100644
index 0000000..691b3ae
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClickController.js
@@ -0,0 +1,5 @@
+({
+ closeQA : function(component, event, helper) {
+ $A.get("e.force:closeQuickAction").fire();
+ }
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClickHelper.js b/force-app/main/default/aura/TestCaseClick/TestCaseClickHelper.js
new file mode 100644
index 0000000..f8a77e3
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClickHelper.js
@@ -0,0 +1,5 @@
+({
+ helperMethod : function() {
+
+ }
+})
diff --git a/force-app/main/default/aura/TestCaseClick/TestCaseClickRenderer.js b/force-app/main/default/aura/TestCaseClick/TestCaseClickRenderer.js
new file mode 100644
index 0000000..3a11ff5
--- /dev/null
+++ b/force-app/main/default/aura/TestCaseClick/TestCaseClickRenderer.js
@@ -0,0 +1,5 @@
+({
+
+// Your renderer method overrides go here
+
+})
diff --git a/force-app/main/default/classes/LexConsumableController.cls b/force-app/main/default/classes/LexConsumableController.cls
new file mode 100644
index 0000000..4e69309
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableController.cls
@@ -0,0 +1,2433 @@
+public without sharing class LexConsumableController {
+ /*****************妞滅储鐢�******************/
+ public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c 銇偆銉炽偣銈裤兂銈广�乻ql澶氥仚銇�
+ public static String category1 { get; set; }
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static String category_Goods { get; set; }
+ public static Boolean specialCampaign { get; set; }
+ public static Boolean cansee { get; set; }
+ //缁忛攢鍟嗗悎鍚屽悕绉�
+ public static String contractName { get; set; }
+ //缁忛攢鍟嗗悎鍚孖D
+ public static String contractId { get; set; }
+ //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
+ public static Boolean dealerPricesee { get; set; }
+ /*****************鐢婚潰鍒濆鍖栫敤********************************/
+ /******20160313_add**************/
+ //public String idCheck {get;set;}
+ public static Boolean editAble { get; set; }
+ public static Boolean edoffersPrice { get; set; }
+ public static String statusEdit { get; set; }
+ public static Boolean returnOrder { get; set; }
+ public static String searchDone { get; set; }
+ //鏆傜敤20160323
+ public static Decimal disCount = 0;
+ //鎬讳环鏍艰绠楃粨鏋�
+ public static Decimal sumPrice { get; set; }
+ //鑷畾涔夌壒浠烽噾棰�
+ public static Decimal bargainPrice { get; set; }
+ //浜у搧涓婁笅闄�
+ public static String[] proLimitAndDate = new List<String>{};
+ /*****************鐢婚潰琛ㄧずBean******************/
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; }
+ public static Integer ConsumableorderdetailsCount {
+ get {
+ return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
+ }
+ }
+ public static Integer ConsumableorderdetailsviewCount {
+ get {
+ return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size();
+ }
+ }
+ public static List<String> lower = new List<String>();
+ //闄勪欢
+ public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
+ public static List<String> DealerProductId { get; set; }
+ public static Boolean editDelCommitBtnDisabled { get; private set; }
+ public static Boolean saveBtnDisabled { get; private set; }
+ public static Boolean sorderBtnDisabled { get; private set; }
+ public static String decisionCode { get; set; }
+ // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
+ public static String baseUrl { get; private set; }
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; private set; }
+ public static Boolean sortOrderAsc { get; private set; }
+ public static String[] sortOrder { get; private set; }
+ private static List<String> contactDealer = new List<String>();
+ private static String[] columus = new List<String>{
+ 'Consumable_Product__r.Name',
+ 'Consumable_Product__r.Asset_Model_No__c',
+ 'Consumable_Product__r.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Consumable_Product__r.Category3__c',
+ 'Consumable_Product__r.Category4__c',
+ 'Consumable_Product__r.Category5__c'
+ };
+ private static String[] columus_no = new List<String>{
+ 'Product2__c.Name',
+ 'Product2__c.Asset_Model_No__c',
+ 'Product2__c.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Category3__c',
+ 'Category4__c',
+ 'Category5__c'
+ };
+ // 宸查�夋嫨浜у搧鏄庣粏
+ private static List<Attachment> attachmentinfo = new List<Attachment>();
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ private static String cate1ForSort = null;
+ private static String accountid = null;
+ private static String accountName = null;
+ // 浜у搧 ID
+ public static String ESetId { get; set; }
+ private static String userId = '';
+ //private String[] ProidListAll = new String[]{};
+ public static List<SelectOption> categoryOptionList { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ public static List<CusOption> category3Option { get; set; }
+ public static List<CusOption> category4Option { get; set; }
+ public static List<CusOption> category5Option { get; set; }
+ private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>();
+ public static List<String> orderzaikuId = new List<String>();
+ //鍒嗛〉鍔熻兘
+ public static Integer size { get; set; }
+ public static Integer pageLimit { get; set; }
+ public static Integer noOfRecords { get; set; }
+ public static ApexPages.StandardSetController con { get; set; }
+ public static String soql { get; set; }
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ public static String agencyProType { get; set; }
+ public static String 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();
+ 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>();
+ 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';
+ }
+ //閿欒淇℃伅鎻愮ず
+ 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 :agencyProType
+ AND Agent_Ref__c = :accountid
+ ];
+ 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 :agencyProType
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ ];
+ if (contract.size() == 1) {
+ contractName = contract[0].Name;
+ contractId = contract[0].Id;
+ }
+ editDelCommitBtnDisabled = true;
+ List<String> DealerProductId = new List<String>();
+ soql = makeSoql('', '', '', '', '', false, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ product2Selected = Database.query(soql);
+
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //鍙湁鍦ㄥ崗璁璐ф椂浼氳蛋杩欎釜for寰幆 鍏朵粬涓ょ璁㈣揣妯″紡閮借蛋鐨剆earchorderdetails鏂规硶
+ if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //缁忛攢鍟嗗畾浠� 璁$畻
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ consumableorderdetailsRecords.sort();
+ if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) {
+ searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble);
+ isfirst = true;
+ }
+ getPageInfo();
+ } else {
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ List<Consumable_order__c> oclist = [
+ SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name
+ FROM Consumable_order__c
+ WHERE id = :ESetid
+ ];
+ if (oclist.get(0).orderPattern__c.equals('hospitalorder')) {
+ hospitalName = oclist.get(0).Order_ForHospital__r.Name;
+ hospitalId = oclist.get(0).Order_ForHospital__c;
+ }
+ }
+ List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
+ //淇敼
+ List<Consumable_order__c> qs = new List<Consumable_order__c>();
+ qs = [
+ SELECT
+ Id,
+ Name,
+ Order_status__c,
+ Consumable_pdf_insert_day__c,
+ Dealer_Info__c,
+ Deliver_date__c,
+ Order_Reason__c,
+ Order_date__c,
+ Contract_application_decision__c,
+ Total_amount__c,
+ Offers_Price__c,
+ Order_effective_contact__c,
+ Order_effective_contact__r.Name
+ FROM Consumable_order__c
+ WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ];
+ if (qs.size() > 0) {
+ coc = qs[0];
+ decisionCode = coc.Contract_application_decision__c;
+ contractName = coc.Order_effective_contact__r.Name;
+ contractId = coc.Order_effective_contact__r.Id;
+ }
+ if (qs[0].Order_status__c == '宸叉彁浜�' || qs[0].Order_status__c == '鎵瑰噯' || qs[0].Order_status__c == '闄勪欢涓婁紶瀹屾垚') {
+ saveBtnDisabled = true;
+ sorderBtnDisabled = true;
+ editDelCommitBtnDisabled = false;
+ }
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ ConsumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Count__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sum_of_money__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Product2__r.Packing_list_manual__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_Orderdetails__c
+ WHERE
+ recordtypeid = :System.Label.RT_ConOrderDetail1_Order
+ AND Consumable_order__c = :ESetId
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Consumable_order__r.Dealer_Info__c = :accountid
+ ];
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
+ soql = makeSoqlorderdet();
+ size = orderzaikuId.size();
+ initStandardController();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (
+ String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))
+ ) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ sumPrice += cdc1.Sum_of_money__c;
+ if (ass.prod.Id == cdc1.Consumable_Product__c) {
+ ass.check = true;
+ ass.esd = cdc1;
+ }
+ }
+ }
+ //闄勪欢
+ attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId];
+ if (attachmentinfo.size() > 0) {
+ for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
+ }
+ }
+ 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 + 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
+ 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.userWorkLocation = userWorkLocation;
+ results.accountName = accountName;
+ results.category_Goods = category_Goods;
+ results.specialCampaign = specialCampaign;
+ results.dealerProductId = DealerProductId;
+ results.accountid = accountid;
+ results.hospitalId = hospitalId;
+ results.contractId = contractId;
+ results.contactDealer = contactDealer;
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ results.methodType = methodType;
+ results.proLimitAndDate = proLimitAndDate;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryAllload(String agencyProTypeStr, String category3Str){
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str){
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ category4 = category4Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c = :category4
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ public static void lowerRecord() {
+ List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>();
+ //搴撳瓨鏄庣粏鍙栧緱
+ Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>();
+ List<Product2__c> product2Selected = [
+ SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c
+ FROM Product2__c
+ WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '鈼�'
+ ];
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ //鍏堟妸ConsumableorderdetailsRecords 鍋氭垚map
+ midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ lowerRecord = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : midMaprecord.values()) {
+ lowerRecord.add(bss);
+ }
+ allProductLimt(lowerRecord);
+ for (ConsumableorderdetailsInfo bss : lowerRecord) {
+ if (bss.allnumber < bss.lowerlimit) {
+ lower.add(bss.Prod.Name__c);
+ }
+ }
+ }
+
+ //搴撳瓨鎺掑簭
+ public static void SortStore() {
+ if (sortKey == preSortKey) {
+ // 鏂瑰悜銇屽銈忋倠銇伩
+ sortOrderAsc = !sortOrderAsc;
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ } else {
+ sortOrderAsc = true;
+ sortOrder[Integer.valueOf(preSortKey)] = ' ';
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ preSortKey = sortKey;
+ List<ConsumableorderdetailsInfo> selectedSort = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> noselectedSort = new List<ConsumableorderdetailsInfo>();
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ ass.sortBy = sortOrderAsc;
+ if (ass.check == true) {
+ selectedSort.add(ass);
+ } else {
+ noselectedSort.add(ass);
+ }
+ }
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (selectedSort.size() > 0) {
+ if (searchDone != 'searchDone') {
+ selectedSort.sort();
+ }
+ consumableorderdetailsRecordsview.addAll(selectedSort);
+ }
+ if (noselectedSort.size() > 0) {
+ noselectedSort.sort();
+ consumableorderdetailsRecordsview.addAll(noselectedSort);
+ }
+ }
+
+ //闄愬埗鎬ф帓搴�
+ public static void SortLimited() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ if (sortKey == preSortKey) {
+ // 鏂瑰悜銇屽銈忋倠銇伩
+ sortOrderAsc = !sortOrderAsc;
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ } else {
+ sortOrderAsc = true;
+ sortOrder[Integer.valueOf(preSortKey)] = ' ';
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ preSortKey = sortKey;
+ // 鎵�鏈変骇鍝佸彇寰�
+ if (
+ (EsetId == null || ESetId == '') || (EsetId != null && ESetId != '' && statusEdit == 'Redirect' && searchDone == 'searchDone')
+ ) {
+ String strProd = null;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (strProd == null || strProd.length() == 0) {
+ strProd = '\'' + String.valueOf(ass.prod.Id) + '\'';
+ } else {
+ strProd += ',\'' + String.valueOf(ass.prod.Id) + '\'';
+ }
+ }
+ String soqll = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ //update by rentx 2020-12-31 start
+ if (agencyProType == 'ET') {
+ soqll += ' AND Pro2_Dealer_Object__c = true';
+ }
+ if (agencyProType == 'ENG') {
+ soqll += ' AND Pro2_Dealer_ENG__c = true';
+ }
+ soqll += ' AND Intra_Trade_List_RMB__c > 0 ';
+ //update by rentx 2020-12-31 end
+ soqll += ' AND Id IN (' + strProd + ')';
+ soqll +=
+ ' order by ' +
+ columus_no[Integer.valueOf(sortKey)] +
+ ' ' +
+ (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
+ List<Product2__c> queryList = Database.query(soqll);
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (ass.check == true) {
+ selectedIdMap.put(ass.Prod.id, ass.Prod.id);
+ reSet.add(ass);
+ }
+ }
+ for (Integer i = 0; i < queryList.size(); i++) {
+ if (selectedIdMap.containsKey(queryList[i].Id)) {
+ // 璺宠繃宸茬粡閫夋嫨鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ // 鏈�夋嫨鐨勬秷鑰楀搧鏄庣粏
+ MidMap.put(queryList[i].Id, new ConsumableorderdetailsInfo(queryList[i]));
+ }
+ }
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = reSet;
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鎶妋ap閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.Id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+
+ consumableorderdetailsRecordsview.add(bss);
+ }
+ }
+ } else if (searchDone != 'searchDone') {
+ String strProd = null;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (strProd == null || strProd.length() == 0) {
+ strProd = '\'' + String.valueOf(ass.prod.Id) + '\'';
+ } else {
+ strProd += ',\'' + String.valueOf(ass.prod.Id) + '\'';
+ }
+ }
+ String SqlOrder = 'SELECT Id, Name, Consumable_order__c, Consumable_Product__r.Name__c,';
+ SqlOrder += ' Consumable_Product__c,Consumable_Product__r.Name,';
+ SqlOrder += 'Consumable_Count__c,Consumable_Product__r.Intra_Trade_List_RMB__c,';
+ SqlOrder += 'Consumable_Product__r.Asset_Model_No__c,Sum_of_money__c, ';
+ SqlOrder += 'Consumable_Product__r.SFDA_Status__c,Consumable_Product__r.Product2__r.Packing_list_manual__c,Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,';
+ SqlOrder += 'Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,Consumable_Product__r.Category3__c,Consumable_Product__r.Category4__c,Consumable_Product__r.Category5__c ';
+ SqlOrder +=
+ 'FROM Consumable_orderdetails__c WHERE recordtypeid != \'' +
+ System.Label.RT_ConOrderDetail1_Sale +
+ '\' AND Consumable_order__c = \'' +
+ ESetId +
+ '\'';
+ SqlOrder += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ SqlOrder += ' AND Consumable_Product__c IN (' + strProd + ')';
+ SqlOrder +=
+ ' order by ' +
+ columus[Integer.valueOf(sortKey)] +
+ ' ' +
+ (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
+ List<Consumable_Orderdetails__c> queryList = Database.query(SqlOrder);
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ for (Integer i = 0; i < queryList.size(); i++) {
+ // 鏈�夋嫨鐨勬秷鑰楀搧鏄庣粏
+ MidMap.put(queryList[i].Consumable_Product__c, new ConsumableorderdetailsInfo(queryList[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ //鎶妋ap閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecordsview.add(bss);
+ }
+ }
+ productLimtAndDateView();
+ }
+
+ //搴撳瓨涓婁笅闄�
+ public static void productLimtAndDateView() {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
+ }
+ }
+ }
+
+ //搴撳瓨涓婁笅闄�
+ public static void productLimtAndDate() {
+ String nowName = null, nowRightAsstModelNo = null;
+ 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
+ ){
+ 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;
+ dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class);
+ consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ searchDone = 'searchDone';
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ //add by rentx 2020-12-09
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ //add by rentx 2020-12-09
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ System.debug('soql:'+soql);
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfo();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ // makeMessage();
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ if(consumableorderdetailsRecordsview.size() > 0){
+ results.result = 'Success';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '鎼滅储鍒�' + consumableorderdetailsRecordsview.size() + '浠朵骇鍝�';
+ }else {
+ results.result = 'Fail';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍖婚櫌--妫�绱�
+ @AuraEnabled
+ public static Results searchorderdetails(
+ String methodTypeStr,
+ String accountIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String userWorkLocationStr,
+ String accountNameStr,
+ List<String> proLimitAndDateList,
+ Boolean editAbleStr
+ ){
+ Results results = new Results();
+ methodType = methodTypeStr;
+ accountId = accountIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ userWorkLocation = userWorkLocationStr;
+ accountName = accountNameStr;
+ proLimitAndDate = proLimitAndDateList;
+ editAble = editAbleStr;
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ if (methodType.equals('hospitalorder')) {
+ //鍖婚櫌id 鏈夊��
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ List<String> hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ } else if (methodType.equals('promotionorder')) {
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ if (dpclist != null && dpclist.size() > 0) {
+ String ids = '(';
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ ids += '\'' + hc.Dealer_Product2__c + '\',';
+ }
+ ids = ids.substring(0, ids.length() - 1) + ')';
+ if (hpids != null && hpids.size() > 0) {
+ // soql += ' AND Id in : hpids ';
+ soql += ' AND Id in ' + ids;
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ }
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfoForHos();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ noOfRecords = consumableorderdetailsRecords.size();
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ if(consumableorderdetailsRecordsview.size() > 0){
+ results.result = 'Success';
+ results.errorMsg = '鍏辨悳绱㈠埌'+consumableorderdetailsRecordsview.size()+'鏉℃暟鎹�';
+ }else {
+ results.result = 'Fail';
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鐢ㄦ埛鍒囨崲鍖婚櫌鏃跺彇娑堥�変腑鐨勪骇鍝�
+ private static List<ConsumableorderdetailsInfo> getPageInfoForHos() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (editAble) {
+ consumableorderdetailsRecordsview = reSet;
+ }
+ Integer pagestartNo = (con.getPageNumber() * size) - size;
+ Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
+ Integer addNo = 0;
+ for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
+ addNo++;
+ //continue;
+ } else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
+ break;
+ } else {
+ if (consumableorderdetailsRecords[i].check == false) {
+ consumableorderdetailsRecords[i].esd = orderdetails1;
+ }
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
+ addNo++;
+ }
+ if (addNo >= size){
+ break;
+ }
+ }
+ return consumableorderdetailsRecordsview;
+ }
+ //add by rentx 2020-12-03 end =====================================================================================================================
+ //鐗逛环
+ public static void OffersPrice() {
+ edoffersPrice = true;
+ }
+
+ //寰楀埌淇冮攢浜у搧Id
+ private static List<String> getDealerProductId() {
+ List<String> ProductId = new List<String>();
+ Map<String, String> DealerProductIdMap = new Map<String, String>();
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND Special_Campaign_Price__c != NULL
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) {
+ continue;
+ } else {
+ ProductId.add(dealerProduct.Dealer_Product2__c);
+ DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c);
+ }
+ }
+ return ProductId;
+ }
+
+ private static String makeSoql(
+ String CateName,
+ String CateCode,
+ String Category3,
+ String Category4,
+ String Category5,
+ Boolean specialCampaign,
+ List<String> DealerProductId
+ ) {
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ // add begin ================================================================================================
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ //濡傛灉鏄尰闄㈢壒浠�
+ //1.鍒ゆ柇 鍖婚櫌id鏄惁鏈夊�� 濡傛灉鏈夊�� 鍒欐牴鎹尰闄d鍘� 鍖婚櫌鐗逛环琛ㄤ腑鑾峰彇浜у搧id
+ //鍖婚櫌id 鏈夊��
+ if (hospitalId == null || hospitalId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍖婚櫌'));
+ warningMsgList.add('璇烽�夋嫨鍖婚櫌');
+ } else {
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //淇冮攢璁㈣揣
+ if (methodType != null && methodType.equals('promotionorder')) {
+ if (contractId == null || contractId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍚堝悓'));
+ warningMsgList.add('璇烽�夋嫨鍚堝悓');
+ } else {
+ //1.鏌ヨ鎵�鏈夌粡閿�鍟嗕骇鍝�
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+
+ if (dpclist != null && dpclist.size() > 0) {
+ hpids = new List<String>();
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //add end ===================================================================================================
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ if (agencyProType == 'ET') {
+ soql += ' AND Pro2_Dealer_Object__c = true';
+ }
+ if (agencyProType == 'ENG') {
+ soql += ' AND Pro2_Dealer_ENG__c = true';
+ }
+ soql += ' AND Intra_Trade_List_RMB__c > 0 ';
+ System.debug('soql +++++++++++ ' + soql);
+ return soql;
+ }
+
+ private static String makeSoqlorderdet() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderzaikuId.size(); i++) {
+ if (i < orderzaikuId.size() - 1) {
+ sqlTail += orderzaikuId[i] + '\',\'';
+ } else {
+ sqlTail += orderzaikuId[i] + '\')';
+ }
+ }
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ 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');
+ Blob contentBlob = EncodingUtil.base64Decode(base64Data);
+ Attachment att = new Attachment();
+ att.ParentId = pId;
+ att.Name = fileName;
+ att.Body = contentBlob;
+ insert att;
+ 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
+ ) {
+ ESetId = '';
+ return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodType,ESetId,hospitalIdStr);
+ }
+
+ //淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static Results save(
+ String contractNameStr,
+ String cocStr,
+ String agencyProTypeStr,
+ String accountidStr,
+ String consumableorderdetailsRecordsviewStr,
+ String contactDealerStr,
+ String methodTypeStr,
+ String eSetIdStr,
+ String hospitalIdStr
+ ){
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ contractName = contractNameStr;
+ agencyProType = agencyProTypeStr;
+ accountid = accountidStr;
+ methodType = methodTypeStr;
+ ESetId = eSetIdStr;
+ hospitalId = hospitalIdStr;
+ 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 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
+ ];
+ if (contract.size() <= 0) {
+ // coc.Order_effective_contact__c.addError('涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�';
+ return results;
+ } else {
+ if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) {
+ // coc.Order_effective_contact__c.addError('鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�';
+ return results;
+ }
+ }
+ Integer FLG = 0;
+ Integer Count = 0;
+ //add by rentx 2020-11-25
+ List<String> tpids = new List<String>();
+ //add by rentx 2020-11-25
+ for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) {
+ FLG = FLG + 1;
+ if (CheckCount.check == false) {
+ Count = Count + 1;
+ }
+ if (CheckCount.check == true) {
+ //add by rentx 2020-11-25
+ tpids.add(CheckCount.Prod.Id);
+ //add by rentx 2020-11-25
+ if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ }
+ if (
+ CheckCount.orderGoods_Limit > 0 &&
+ math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0
+ ) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟';
+ return results;
+ }
+ }
+ }
+ if (Count == FLG) {
+ results.result = 'Fail';
+ results.errorMsg = '璇烽�夋嫨鎵�闇�娑堣�楀搧';
+ return results;
+ }
+ //=======================================鍖婚櫌鐗逛环,鏈夐噾棰濈殑璇濆彇閲戦
+ Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>();
+ List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c
+ from hospitalprice__c
+ where product__c in :tpids and mPrice__c <> null and account__c=:accountid
+ ];
+ for (hospitalprice__c dealerProduct : hplist) {
+ if (dealerProduct.mPrice__c != null) {
+ dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c);
+ }
+ }
+ //淇冮攢璁㈣揣 鏍规嵁缁忛攢鍟嗕骇鍝佷腑鐨勬暟鎹绠楅噾棰�
+ //=======================================浜у搧鐗规畩鎶樻墸
+ Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>();
+ Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>();
+ //1.鑾峰彇鏈夊紑濮嬬粨鏉熸棩鐨勪骇鍝�
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> haveDateList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c,
+ Special_Discount__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND (Special_Discount__c != NULL
+ OR Special_Campaign_Price__c != NULL)
+ ];
+ //2.鑾峰彇娌℃湁寮�濮嬬粨鏉熸棩鐨勪骇鍝�
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ Special_Discount__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ //濡傛灉淇冮攢浠锋牸涓簄ull 鍒欒缃壒娈婃姌鎵�(鐧惧垎姣�)鍒伴泦鍚�
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ }
+ }
+ //杩欐牱鍋氭槸涓轰簡璁$畻淇冮攢浠锋牸鏃� 浼樺厛璁$畻淇冮攢寮�濮嬬粨鏉熸棩涓嶄负绌虹殑浜у搧
+ //濡傛灉璇ラ泦鍚堟湁鍊� 鍒欒鏄庨渶瑕佹牴鎹綋鍓嶇殑閲戦鎴栬�呮姌鎵f潵璁$畻
+ if (haveDateList != null && haveDateList.size() > 0) {
+ for (Dealer_Product__c dealerProduct : haveDateList) {
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ }
+ }
+ }
+ //=======================================缁忛攢鍟嗗悎鍚屾姌鎵�
+ List<Account> at = [
+ SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c
+ FROM Account
+ WHERE
+ Name = :contractName
+ AND Contact_Type__c LIKE :agencyProType
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ ];
+ 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;
+ }
+
+ 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 Attachment 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; }
+
+ // 宸插瓨浜у搧鏄庣粏
+ 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(Attachment 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;
+ }
+
+ public class CusOption {
+ CusOption(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableController.cls-meta.xml b/force-app/main/default/classes/LexConsumableController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/lwc/childComponentTest/__tests__/childComponentTest.test.js b/force-app/main/default/lwc/childComponentTest/__tests__/childComponentTest.test.js
new file mode 100644
index 0000000..f67316d
--- /dev/null
+++ b/force-app/main/default/lwc/childComponentTest/__tests__/childComponentTest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import ChildComponentTest from 'c/childComponentTest';
+
+describe('c-child-component-test', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-child-component-test', {
+ is: ChildComponentTest
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/childComponentTest/childComponentTest.html b/force-app/main/default/lwc/childComponentTest/childComponentTest.html
new file mode 100644
index 0000000..21fcf06
--- /dev/null
+++ b/force-app/main/default/lwc/childComponentTest/childComponentTest.html
@@ -0,0 +1,8 @@
+<template>
+ <p class="slds-text-align_center slds-var-m-vertical_medium">
+ Prior Count:
+ <lightning-formatted-number
+ value={priorCount}
+ ></lightning-formatted-number>
+ </p>
+</template>
diff --git a/force-app/main/default/lwc/childComponentTest/childComponentTest.js b/force-app/main/default/lwc/childComponentTest/childComponentTest.js
new file mode 100644
index 0000000..901277d
--- /dev/null
+++ b/force-app/main/default/lwc/childComponentTest/childComponentTest.js
@@ -0,0 +1,18 @@
+import { LightningElement,api } from 'lwc';
+
+export default class ChildComponentTest extends LightningElement {
+ _currentCount = 0;
+ priorCount = 0;
+ @api counter = 0;
+ get counter() {
+ return this._currentCount;
+ }
+ set counter(value) {
+ this.priorCount = this._currentCount;
+ this._currentCount = value;
+ }
+ @api
+ maximizeCounter() 12
+ this.counter += 1000000;
+ }
+}
diff --git a/force-app/main/default/lwc/childComponentTest/childComponentTest.js-meta.xml b/force-app/main/default/lwc/childComponentTest/childComponentTest.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/childComponentTest/childComponentTest.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/createCaseTest/__tests__/createCaseTest.test.js b/force-app/main/default/lwc/createCaseTest/__tests__/createCaseTest.test.js
new file mode 100644
index 0000000..e408196
--- /dev/null
+++ b/force-app/main/default/lwc/createCaseTest/__tests__/createCaseTest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import CreateCaseTest from 'c/createCaseTest';
+
+describe('c-create-case-test', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-create-case-test', {
+ is: CreateCaseTest
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/createCaseTest/createCaseTest.html b/force-app/main/default/lwc/createCaseTest/createCaseTest.html
new file mode 100644
index 0000000..5b1b514
--- /dev/null
+++ b/force-app/main/default/lwc/createCaseTest/createCaseTest.html
@@ -0,0 +1,14 @@
+<template>
+ <lightning-card>
+ <h3 slot="title">
+ <lightning-icon icon-name="utility:connected_apps" size="small"></lightning-icon>
+ Close Quick Action From Lightning Web Components
+ </h3>
+ <div slot="footer">
+
+ </div>
+ Record Id from Parent Component: {recordId}
+ <br/>
+ <lightning-button label="Close Quick Action" onclick={closeQuickAction}></lightning-button>
+ </lightning-card>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/createCaseTest/createCaseTest.js b/force-app/main/default/lwc/createCaseTest/createCaseTest.js
new file mode 100644
index 0000000..6d7e49e
--- /dev/null
+++ b/force-app/main/default/lwc/createCaseTest/createCaseTest.js
@@ -0,0 +1,11 @@
+import { LightningElement, api } from 'lwc';
+
+export default class CreateCaseTest extends LightningElement {
+
+ @api recordId;
+ closeQuickAction() {
+ const closeQA = new CustomEvent('close');
+ // Dispatches the event.
+ this.dispatchEvent(closeQA);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/createCaseTest/createCaseTest.js-meta.xml b/force-app/main/default/lwc/createCaseTest/createCaseTest.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/createCaseTest/createCaseTest.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.css b/force-app/main/default/lwc/lexConsumable/lexConsumable.css
new file mode 100644
index 0000000..9f20f92
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.css
@@ -0,0 +1,3 @@
+.myTable table>thead .slds-cell-fixed.slds-has-button-menu, .myTable table>thead .slds-cell-fixed.slds-has-button-menu:hover{
+ background: #EEEE00;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.html b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
new file mode 100644
index 0000000..e10ce43
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
@@ -0,0 +1,507 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <template if:true={showEditBtn}>
+ <lightning-button style="margin: 5px;" label="缂栬緫" disabled={disabledEditBtn} onclick={editOrder}></lightning-button>
+ </template>
+ <template if:true={showPrintSheetBtn}>
+ <lightning-button style="margin: 5px;" label="鎵撳嵃閰嶇疆鍗�" onclick={printOrder}></lightning-button>
+ </template>
+ <template if:true={showUploadSheetBtn}>
+ <lightning-button style="margin: 5px;" label="涓婁紶閰嶇疆鍗�" disabled={disabledUploadSheetBtn} onclick={uploadOrder}></lightning-button>
+ </template>
+ <template if:true={showSubOrderbtn}>
+ <lightning-button style="margin: 5px;" label="鎻愪氦璁㈠崟" disabled={disabledSubOrderbtn} onclick={submitOrder}></lightning-button>
+ </template>
+ <template if:true={showSaveOrderbtn1}>
+ <lightning-button style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={saveOrder}></lightning-button>
+ </template>
+ <template if:true={showSaveOrderbtn2}>
+ <lightning-button style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={orderCopy}></lightning-button>
+ </template>
+ <template if:true={showDeleteBtn}>
+ <lightning-button style="margin: 5px;" label="鍒犻櫎" disabled={disabledDeleteBtn} onclick={deleteOrder}></lightning-button>
+ </template>
+ <template if:true={showOfferPriceInputBtn}>
+ <lightning-button style="margin: 5px;" label="鐗逛环閲戦褰曞叆" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
+ </template>
+ <template if:true={showReapplyBtn}>
+ <lightning-button style="margin: 5px;" label="鍐嶇敵璇�" onclick={reapplyOrder}></lightning-button>
+ </template>
+ <p style="height: 10px;"></p>
+ <!-- <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ </div>
+ <div style="padding:10px;">
+ </div>
+ </div> -->
+ <!-- 璁㈠崟淇℃伅 -->
+ <template if:false={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>璁㈠崟淇℃伅</strong></p>
+ </div>
+ <div style="padding:10px;">
+ <lightning-record-view-form record-id={cocId} object-api-name="Consumable_order__c">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 10%"></td>
+ <td style="width: 40%;"><lightning-output-field field-name="Name"></lightning-output-field></td>
+ <td style="width: 40%;"><lightning-output-field field-name="Order_status__c"></lightning-output-field></td>
+ <td style="width: 10%"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:false={editAble}>
+ <lightning-output-field field-name="Total_amount__c"></lightning-output-field>
+ </template>
+ </td>
+ <td>
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label"><lightning-formatted-text value={contractLabel}></lightning-formatted-text> </div>
+ <lightning-formatted-text value={contractName}></lightning-formatted-text>
+ </div>
+ <!-- <lightning-output-field field-name="Order_effective_contact__c"></lightning-output-field> -->
+ </td>
+ <!-- <td>鍚堝悓锛�<lightning-formatted-text value={coc.Order_effective_contact__r.Name}></lightning-formatted-text></td> -->
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:false={edoffersPrice}>
+ <lightning-output-field id="sumPrice_buttom1" field-name="Offers_Price__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={edoffersPrice}>
+ <lightning-input label="鐗逛环鎬婚噾棰�" variant="label-inline" id="sumPrice_buttom2" value={coc.Offers_Price__c} onchange={offerPriceChange}></lightning-input>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={showAttUploadDate}>
+ <lightning-output-field field-name="Consumable_pdf_insert_day__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={showOrderDate}>
+ <lightning-output-field field-name="Order_date__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </lightning-record-view-form>
+ </div>
+ </div>
+ </template>
+ <!-- searchBlock -->
+ <template if:true={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="padding:10px;">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 6%;">
+ <template if:true={showHospital}>
+ <div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;"><span style="color: red;">* </span>鍖婚櫌</div>
+ </template>
+ </td>
+ <td style="width:20%;padding-bottom:5px;padding-top:5px;">
+ <template if:true={showHospital}>
+ <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
+ <lightning-input variant="label-hidden" label="鍖婚櫌" placeholder="璇烽�夋嫨鍖婚櫌" value={hospitalName} onclick={showSearchHos}></lightning-input>
+ </div>
+ </template>
+ </td>
+ <td style="width: 6%;"></td>
+ <td style="width:14%;"></td>
+ <td style="width: 6%;"></td>
+ <td style="width:14%;"></td>
+ <td style="width: 6%;"></td>
+ <td style="width:14%;"></td>
+ <td style="width:16%;"></td>
+ </tr>
+ <tr>
+ <td>
+ <div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;">娑堣�楀搧鍚嶇О</div>
+ </td>
+ <td>
+ <lightning-input variant="label-hidden" label="娑堣�楀搧鍚嶇О" value={category1} onchange={category1Change}></lightning-input>
+ </td>
+ <td>
+ <div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;">绗�3鍒嗙被</div>
+ </td>
+ <td>
+ <lightning-combobox variant="label-hidden" label="绗�3鍒嗙被" value={category3} options={category3Option} onchange={category3Change}></lightning-combobox>
+ </td>
+ <td>
+ <div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;">绗�4鍒嗙被</div></td>
+ <td>
+ <lightning-combobox variant="label-hidden" label="绗�4鍒嗙被" value={category4} options={category4Option} onchange={category4Change}></lightning-combobox>
+ </td>
+ <td>
+ <div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;">绗�5鍒嗙被</div></td>
+ <td>
+ <lightning-combobox variant="label-hidden" label="绗�5鍒嗙被" value={category5} options={category5Option} onchange={category5Change}></lightning-combobox>
+ </td>
+ <td>
+ <lightning-button style="margin-right: 10px;margin-left: 15px;" label="娑堣�楀搧鎼滅储" onclick={searchProduct}></lightning-button>
+ <lightning-button label="娓呯┖" onclick={clear}></lightning-button>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td><div style="color:#696969;font-size:12px;text-align: right;padding-right:7px;"><span style="color: red;">* </span>鍚堝悓</div></td>
+ <td colspan="2" style="padding-bottom:5px;padding-top:5px;">
+ <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
+ <lightning-input variant="label-hidden" label="鍚堝悓" placeholder="璇烽�夋嫨鍚堝悓" value={contractName} onclick={showSearchCon} required="true"></lightning-input>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </template>
+ <!-- 璀﹀憡鎻愰啋 -->
+ <template if:true={hasWarning}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:#ff6a00;font-size:17px;">
+ <lightning-button-icon icon-name="utility:warning"></lightning-button-icon>
+ <strong> 璀﹀憡</strong>
+ </div>
+ <template for:each={warningMsgs} for:item="msg">
+ <p key={msg} style="color:#ff6a00;padding-left:7px;font-size:14px;"> 銉� {msg}</p>
+ </template>
+ </div>
+ </template>
+ <!-- 鎶ラ敊鎻愰啋 -->
+ <template if:true={hasError}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:red;font-size:17px;">
+ <lightning-button-icon icon-name="utility:error"></lightning-button-icon>
+ <strong> 閿欒</strong>
+ </div>
+ <template for:each={errorMsgs} for:item="msg">
+ <p key={msg} style="color:red;padding-left:7px;font-size:14px;"> 銉� {msg}</p>
+ </template>
+ </div>
+ </template>
+ <!-- 娑堣�楀搧鏄庣粏 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>娑堣�楀搧鏄庣粏</strong></p>
+ </div>
+ <div style="padding:10px;">
+ <table style="width: 100%;">
+ <thead>
+ <tr>
+ <template if:true={editAble}>
+ <th><lightning-input type="checkbox" onchange={checkAll} name="checkAll"></lightning-input></th>
+ </template>
+ <th style="width: 20%;">娑堣�楀搧鍚嶇О</th>
+ <th>瑙勬牸</th>
+ <th>CFDA鐘舵��</th>
+ <th>娉ㄥ唽璇佺紪鐮佸彿</th>
+ <th>娉ㄥ唽璇佹晥鏈�</th>
+ <th>绗�3鍒嗙被</th>
+ <th>绗�4鍒嗙被</th>
+ <th>绗�5鍒嗙被</th>
+ <template if:true={cansee}>
+ <th>鏍囧噯鍗曚环(鍏�)</th>
+ </template>
+ <th style="width: 5%;">閲囪喘鏁伴噺</th>
+ <th>鍦ㄥ簱鏁颁笅闄�</th>
+ <th>鍦ㄥ簱鏁颁笂闄�</th>
+ <th>鏈夋晥鏈熷簱瀛�(鐩�)</th>
+ <th>鏈夋晥鏈熷簱瀛�(涓�)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <template for:each={consumableorderdetailsRecordsview} for:item="record" for:index="index">
+ <tr key={record.Prod.Name}>
+ <template if:true={editAble}>
+ <td>
+ <lightning-input data-index={index} type="checkbox" checked={record.check} onchange={check} name="check"></lightning-input>
+ <lightning-input data-index={index} type="checkbox" checked={record.oldCheck} onchange={check} name="check" style="display:none;"></lightning-input>
+ </td>
+ </template>
+ <td>
+ {record.Prod.Name__c}
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.packing_list}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.Prod.SFDA_Status__c}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.approbation_No}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.expiration_Date}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.Prod.Category3__c}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.Prod.Category4__c}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.Prod.Category5__c}</div>
+ </td>
+ <template if:true={cansee}>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.Prod.Intra_Trade_List_RMB__c}</div>
+ </td>
+ </template>
+ <td>
+ <template if:true={editAble}>
+ <lightning-input data-index={index} value={record.esd.Consumable_count__c} onchange={consumableCountChange}></lightning-input>
+ </template>
+ <template if:false={editAble}>
+ <div class="slds-truncate" title="Value Proposition">{record.esd.Consumable_count__c}</div>
+ </template>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.lowerlimit}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.upperlimit}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.allnumber}</div>
+ </td>
+ <td>
+ <div class="slds-truncate" title="Value Proposition">{record.allnumber_piece}</div>
+ </td>
+ </tr>
+ </template>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 闄勪欢 -->
+ <template if:false={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-top:10px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>闄勪欢</strong></p>
+ </div>
+ <div style="padding:10px;">
+ <table>
+ <thead>
+ <th style="width: 33%;">鏍囬</th>
+ <th>鍒涘缓浜�</th>
+ </thead>
+ <tbody>
+ <template for:each={attachmentRecoeds} for:item="att" for:index="index">
+ <tr key={att.Concc.Id}>
+ <td>
+ <a data-name={att.Concc.Id} onclick={attClick2}>{att.Concc.Name}</a>
+ </td>
+ <td>
+ <a data-name={att.Concc.OwnerId} onclick={attClick1}>{att.Concc.Owner.Name}</a>
+ </td>
+ </tr>
+ </template>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </template>
+ <!-- 涓婁紶闄勪欢寮圭獥 -->
+ <template if:true={showAttPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">涓婁紶閰嶇疆鍗�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
+ <div class="slds-m-top_medium slds-m-bottom_x-large">
+ <div class="slds-p-around_medium lgc-bg">
+ <lightning-input type="file" label="闄勪欢涓婁紶" accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf" onchange={attChange}></lightning-input>
+ </div>
+ <p>宸查�夋嫨鏂囦欢锛歿fileName}
+ <template if:true={attDelBtn}>
+ <a onclick={removeAtt}>绉婚櫎</a>
+ </template>
+ </p>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closePop}></lightning-button>
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="涓婁紶" onclick={uploadAtt}></lightning-button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ <!-- 鎼滅储鍖婚櫌 -->
+ <template if:true={showAttHosPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeHospitalPop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">缁忛攢鍟嗗尰闄㈡绱�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 60px;"><div style="color:#696969;font-size:13px;text-align: left;">鍖婚櫌鍚嶇О</div></td>
+ <td style="width: 60%;"><lightning-input label="鍖婚櫌鍚嶇О" variant="label-hidden" placeholder="璇疯緭鍏ュ尰闄㈠悕绉�" value={searchNameHos} onchange={searchNameHosChange}></lightning-input></td>
+ <td style="width: 10px;"></td>
+ <td><lightning-button label="鎼滅储" onclick={searchHos}></lightning-button></td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="height: 20px;"></p>
+ <!-- <p>宸查�夋嫨鍖婚櫌锛歿chooseHospital}</p> -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>鎼滅储缁撴灉</strong></p>
+ </div>
+ <div class="myTable" style="padding:10px;">
+ <!-- <table>
+ <thead>
+ <th style="width: 50%;">鍖婚櫌鍚嶇О</th>
+ <th style="width: 10%;">鐪佷唤</th>
+ <th style="width: 40%;">鍦板潃</th>
+ </thead>
+ <tbody>
+ <template for:each={hospitalList} for:item="hos" for:index="index">
+ <tr key={hos.Id}>
+ <td><a data-hosid={hos.Id} data-name={hos.Name} onclick={chooseHos}>{hos.Name}</a></td>
+ <td>{hos.StateMaster}</td>
+ <td>{hos.Address__c}</td>
+ </tr>
+ </template>
+ <tr></tr>
+ </tbody>
+ </table> -->
+ <lightning-datatable key-field="id" hide-checkbox-column="true" data={hospitalList} columns={hosCols} onrowaction={chooseHos}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closeHospitalPop}></lightning-button>
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="纭" onclick={confirmHospital}></lightning-button> -->
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ <!-- 鎼滅储鍚堝悓 -->
+ <template if:true={showConPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeContractPop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-03" class="slds-text-heading_medium slds-hyphenate">鍚堝悓妫�绱�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3" style="border: 1px solid #F3F3F3;">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 60px;"><div style="color:#696969;font-size:13px;text-align: left;">鍚堝悓鍚嶇О</div></td>
+ <td style="width: 60%;"><lightning-input label="鍚堝悓鍚嶇О" variant="label-hidden" placeholder="璇疯緭鍏ュ悎鍚屽悕绉�" value={searchNameCon} onchange={searchNameConChange}></lightning-input></td>
+ <td style="width: 10px;"></td>
+ <td><lightning-button label="鎼滅储" onclick={searchCon}></lightning-button></td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="height: 10px;"></p>
+ <!-- <p>宸查�夋嫨鍚堝悓锛歿chooseContract}</p> -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>鎼滅储缁撴灉</strong></p>
+ </div>
+ <div style="padding:20px;">
+ <!-- <table>
+ <thead>
+ <th style="width: 30%;">鍚堝悓鍚嶇О</th>
+ <th style="width: 10%;">鐪佷唤</th>
+ <th style="width: 20%;">鐢宠閿�鍞</th>
+ <th style="width: 20%;">鍏佽鎶ヤ环鏈熼棿(寮�濮嬫棩)</th>
+ <th style="width: 20%;">鍏佽鎶ヤ环鏈熼棿(缁撴潫鏃�)</th>
+ </thead>
+ <tbody>
+ <template for:each={contractList} for:item="con" for:index="index">
+ <tr key={con.Id}>
+ <td><a data-hosid={con.Id} data-name={con.Name} onclick={chooseCon}>{con.Name}</a></td>
+ <td>{con.StateMaster}</td>
+ <td>{con.Sales_Section__c}</td>
+ <td>{con.Contract_Decide_Start_Date__c}</td>
+ <td>{con.Contract_Decide_End_Date__c}</td>
+ </tr>
+ </template>
+ <tr></tr>
+ </tbody>
+ </table> -->
+ <lightning-datatable key-field="id" hide-checkbox-column="true" data={contractList} columns={conCols} onrowaction={chooseCon}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closeContractPop}></lightning-button>
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="纭" onclick={confirmContract}></lightning-button> -->
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
new file mode 100644
index 0000000..d252d5b
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -0,0 +1,935 @@
+import { LightningElement,wire,api,track } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexConsumableController.init';
+import categoryAllload from '@salesforce/apex/LexConsumableController.categoryAllload';
+import categoryload from '@salesforce/apex/LexConsumableController.categoryload';
+import searchConsumableorderdetails from '@salesforce/apex/LexConsumableController.searchConsumableorderdetails';
+import searchorderdetails from '@salesforce/apex/LexConsumableController.searchorderdetails';
+import save from '@salesforce/apex/LexConsumableController.save';
+import ordrCopy from '@salesforce/apex/LexConsumableController.ordrCopy';
+import setEditAble from '@salesforce/apex/LexConsumableController.setEditAble';
+import backOrder from '@salesforce/apex/LexConsumableController.backOrder';
+import delConsumable from '@salesforce/apex/LexConsumableController.delConsumable';
+import sorder from '@salesforce/apex/LexConsumableController.sorder';
+import filesUpload from '@salesforce/apex/LexConsumableController.filesUpload';
+import initHospital from '@salesforce/apex/LexSearchHospitalController.init';
+import searchHospital from '@salesforce/apex/LexSearchHospitalController.searchHospital';
+import initContract from '@salesforce/apex/LexSearchContractController.init';
+import searchContract from '@salesforce/apex/LexSearchContractController.searchContract';
+
+export default class LexConsumable extends NavigationMixin(LightningElement) {
+
+ //椤甸潰鍩虹鏁版嵁
+ @track editAble;
+ @track pageType;
+ @track esetId;
+ @track keyWords;
+ @track coc;
+ @track cocId;
+ @track userWorkLocation;
+ @track accountName;
+ @track accountid;
+ @track specialCampaign = false;
+ @track dealerProductId = [];
+ @track category1;
+ @track category3 = '';
+ @track category4 = '';
+ @track category5 = '';
+ @track category_Goods;
+ @track category3Option = [];
+ @track category4Option = [];
+ @track category5Option = [];
+ @track consumableorderdetailsRecordsview = [];
+ @track attachmentRecoeds = [];
+ @track contactDealer = [];
+ @track proLimitAndDate = [];
+ @track agencyProType;
+ @track bargainPrice;
+ @track showOrderDate = false;
+ @track showAttUploadDate = false;
+ @track edoffersPrice = false;
+ @track editDelCommitBtnDisabled = false;
+ @track showEditBtn = false;
+ @track disabledEditBtn = false;
+ @track showPrintSheetBtn = false;
+ @track showUploadSheetBtn = false;
+ @track disabledUploadSheetBtn = false;
+ @track showSubOrderbtn = false;
+ @track disabledSubOrderbtn = false;
+ @track showSaveOrderbtn1 = false;
+ @track showSaveOrderbtn2 = false;
+ @track showDeleteBtn = false;
+ @track disabledDeleteBtn = false;
+ @track showOfferPriceInputBtn = false;
+ @track disabledOfferPriceInputBtn = false;
+ @track showReapplyBtn = false;
+ @track showHospital = false;
+ @track showSpinner = true;
+ @track showPage = false;
+ @track cansee = false;
+ //鎶ラ敊鎻愰啋
+ // @track hasError = false;
+ @track errorMsgs = [];
+ // @track hasWarning = false;
+ @track warningMsgs = [];
+ //闄勪欢涓婁紶
+ @track showAttPop = false;
+ @track filesUploaded = [];
+ @track fileName;
+ file;
+ fileContents;
+ fileReader;
+ content;
+ //鍖婚櫌鎼滅储
+ @track showAttHosPop = false;
+ @track hospitalList = [];
+ @track searchNameHos;
+ @track chooseHospital;
+ @track chooseHospitalId;
+ @track hospitalId;
+ @track hospitalName;
+ @track tempidHp;
+ @track hosCols = [
+ // {label:'鍖婚櫌鍚嶇О',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
+ {label:'',type:'button',typeAttributes:{label:'閫夋嫨'},initialWidth:80,hideDefaultActions: true},
+ {label:'鍖婚櫌鍚嶇О',fieldName:'Name',initialWidth:380,wrapText:true,hideDefaultActions: true},
+ {label:'鐪佷唤',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true},
+ {label:'鍦板潃',fieldName:'Address__c',hideDefaultActions: true}
+ ];
+ //鍚堝悓鎼滅储
+ @track contractLabel;
+ @track showConPop = false;
+ @track contractList = [];
+ @track searchNameCon;
+ @track chooseContract;
+ @track chooseContractId;
+ @track contractId;
+ @track contractName;
+ @track tempidPp;
+ @track conCols = [
+ {label:'',type:'button',typeAttributes:{label:'閫夋嫨'},initialWidth:80,hideDefaultActions: true},
+ {label:'鍚堝悓鍚嶇О',fieldName:'Name',wrapText:true,hideDefaultActions: true},
+ {label:'鐪佷唤',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true},
+ {label:'鐢宠閿�鍞',fieldName:'Sales_Section__c',initialWidth:200,hideDefaultActions: true},
+ {label:'鍏佽鎶ヤ环鏈熼棿(寮�濮嬫棩)',fieldName:'Contract_Decide_Start_Date__c',initialWidth:200,hideDefaultActions: true},
+ {label:'鍏佽鎶ヤ环鏈熼棿(缁撴潫鏃�)',fieldName:'Contract_Decide_End_Date__c',initialWidth:200,hideDefaultActions: true}
+ ];
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log('CurrentPageReference');
+ if (currentPageReference) {
+ this.pageType = currentPageReference.state?.type;
+ this.esetId = currentPageReference.state?.ESetid;
+ this.keyWords = currentPageReference.state?.KeyWords;
+ console.log('type:'+this.pageType);
+ console.log('esetId:'+this.esetId);
+ console.log('keyWords:'+this.keyWords);
+ }
+ }
+
+ connectedCallback(){
+ this.showSpinner = true;
+ initPage({type:this.pageType, esetId:this.esetId, keywordStr:this.keyWords})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.editAble = result.editAble;
+ this.edoffersPrice = result.edoffersPrice;
+ this.cansee = result.cansee;
+ this.editDelCommitBtnDisabled = result.editDelCommitBtnDisabled;
+ this.category3Option = result.category3Option;
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.agencyProType = result.agencyProType;
+ this.hospitalName = result.hospitalName;
+ this.contractName = result.contractName;
+ this.contractLabel = '缁忛攢鍟嗘湁鏁堝悎鍚�';
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.attachmentRecoeds = result.attachmentRecoeds;
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ // this.hasError = result.hasError;
+ // this.hasWarning = result.hasWarning;
+ this.userWorkLocation = result.userWorkLocation;
+ this.accountName = result.accountName;
+ this.accountid = result.accountid;
+ this.hospitalId = result.hospitalId;
+ this.contractId = result.contractId;
+ this.category_Goods = result.category_Goods;
+ this.specialCampaign = result.specialCampaign;
+ this.dealerProductId = result.dealerProductId;
+ this.contactDealer = result.contactDealer;
+ this.pageType = result.methodType;
+ this.proLimitAndDate = result.proLimitAndDate;
+ this.coc = result.coc;
+ this.cocId = this.coc.Id;
+ if(this.pageType == 'hospitalorder' && this.agencyProType != 'ET'){
+ this.showHospital = true;
+ }
+ if(this.coc.Order_status__c == "宸叉彁浜�" || this.coc.Order_status__c == "鎵瑰噯"){
+ this.showOrderDate = true;
+ }
+ if(this.coc.Consumable_pdf_insert_day__c != null){
+ this.showAttUploadDate = true;
+ }
+ if(!(this.editAble || this.edoffersPrice)){
+ this.showEditBtn = true;
+ this.showOfferPriceInputBtn = true;
+ }
+ if(this.coc.Order_status__c == "宸叉彁浜�" || this.coc.Order_status__c == "鎵瑰噯" || this.coc.Order_status__c == "椹冲洖"){
+ this.disabledEditBtn = true;
+ this.disabledUploadSheetBtn = true;
+ this.disabledSubOrderbtn = true;
+ this.disabledDeleteBtn = true;
+ this.disabledOfferPriceInputBtn = true;
+ }
+ if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
+ this.showPrintSheetBtn = true;
+ this.showUploadSheetBtn = true;
+ this.showSubOrderbtn = true;
+ this.showDeleteBtn = true;
+ }
+ if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "椹冲洖"){
+ this.showSaveOrderbtn1 = true;
+ }
+ if(this.coc.Order_status__c == "椹冲洖" && this.editAble){
+ this.showSaveOrderbtn2 = true;
+ }
+ if(this.coc.Order_status__c == "椹冲洖" && !this.editAble){
+ this.showReapplyBtn = true;
+ }
+ this.showSpinner = false;
+ this.showPage = true;
+ // this.warningMsgs.push('warning1');
+ // this.warningMsgs.push('warning2');
+ // this.warningMsgs.push('warning3');
+ // this.warningMsgs.push('warning4');
+ // this.errorMsgs.push('error1');
+ // this.errorMsgs.push('error2');
+ // this.errorMsgs.push('error3');
+ // this.errorMsgs.push('error4');
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+
+ get hasWarning(){
+ if(this.warningMsgs.length > 0){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ get hasError(){
+ if(this.errorMsgs.length > 0){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ offerPriceChange(event){
+ this.coc.Offers_Price__c = event.detail.value;
+ }
+
+ category1Change(event){
+ this.category1 = event.detail.value;
+ }
+
+ category3Change(event){
+ this.showSpinner = true;
+ this.category3 = event.detail.value;
+ this.category4 = '';
+ this.category5 = '';
+ categoryAllload({agencyProTypeStr:this.agencyProType, category3Str:this.category3})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.showSpinner = false;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍔犺浇鍒嗙被澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ category4Change(event){
+ this.showSpinner = true;
+ this.category4 = event.detail.value;
+ this.category5 = '';
+ categoryload({agencyProTypeStr:this.agencyProType, category3Str:this.category3, category4Str:this.category4})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.showSpinner = false;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍔犺浇鍒嗙被澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ category5Change(event){
+ this.category5 = event.detail.value;
+ }
+
+ searchProduct(event){
+ this.showSpinner = true;
+ searchConsumableorderdetails({userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType,
+ accountNameStr:this.accountName,
+ accountIdStr:this.accountid,
+ contractIdStr:this.contractId,
+ hospitalIdStr:this.hospitalId,
+ category1Str:this.category1,
+ category3Str:this.category3,
+ category4Str:this.category4,
+ category5Str:this.category5,
+ category_GoodStr:this.category_Goods,
+ specialCampaignStr:this.specialCampaign,
+ dealerProductIdStr:JSON.stringify(this.dealerProductId),
+ methodTypeStr:this.pageType,
+ editAbleStr:this.editAble,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview)})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.showSpinner = false;
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ // this.hasError = result.hasError;
+ // this.hasWarning = result.hasWarning;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ })
+ }
+
+ clear(event){
+ this.category1 = '';
+ this.category3 = '';
+ this.category4 = '';
+ this.category5 = '';
+ this.showSpinner = true;
+ searchConsumableorderdetails({
+ userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType,
+ accountNameStr:this.accountName,
+ accountIdStr:this.accountid,
+ contractIdStr:this.contractId,
+ hospitalIdStr:this.hospitalId,
+ category1Str:this.category1,
+ category3Str:this.category3,
+ category4Str:this.category4,
+ category5Str:this.category5,
+ category_GoodStr:this.category_Goods,
+ specialCampaignStr:this.specialCampaign,
+ dealerProductIdStr:JSON.stringify(this.dealerProductId),
+ methodTypeStr:this.pageType,
+ editAbleStr:this.editAble,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview)
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ }
+
+ attClick1(event){
+ var id = event.currentTarget.dataset.name;
+ console.log('id:'+id);
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/detail/'+id,
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ attClick2(event){
+ var id = event.currentTarget.dataset.name;
+ var site = window.location.origin;
+ console.log('id:'+id);
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: site+'/consumable/servlet/servlet.FileDownload?file='+id,
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ checkAll(event){
+ for(let i=0, len=this.consumableorderdetailsRecordsview.length; i < len ;i++){
+ this.consumableorderdetailsRecordsview[i].check = event.target.checked;
+ }
+ }
+
+ check(event){
+ let index = event.target.getAttribute("data-index");
+ this.consumableorderdetailsRecordsview[index].check = event.target.checked;
+ }
+
+ consumableCountChange(event){
+ let index = event.target.getAttribute("data-index");
+ var value = event.target.value;
+ this.consumableorderdetailsRecordsview[index].esd.Consumable_count__c = value;
+ if(isNaN(value)){
+ value=0.00;
+ }
+ if(value != null && value !=0 && value!=''){
+ this.consumableorderdetailsRecordsview[index].check = true;
+ }else{
+ this.consumableorderdetailsRecordsview[index].check = false;
+ }
+ }
+
+ //淇濆瓨璁㈠崟
+ saveOrder(event){
+ this.showSpinner = true;
+ console.log('start save');
+ save({
+ contractNameStr:this.contractName,
+ cocStr:JSON.stringify(this.coc),
+ agencyProTypeStr:this.agencyProType,
+ accountidStr:this.accountid,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ contactDealerStr:JSON.stringify(this.contactDealer),
+ methodTypeStr:this.pageType,
+ eSetIdStr:this.esetId,
+ hospitalIdStr : this.hospitalId
+ }).then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.esetId = result.eSetId;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('淇濆瓨澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //淇濆瓨璁㈠崟锛堥┏鍥烇級
+ orderCopy(event){
+ this.showSpinner = true;
+ ordrCopy({
+ contractNameStr:this.contractName,
+ cocStr:JSON.stringify(this.coc),
+ agencyProTypeStr:this.agencyProType,
+ accountidStr:this.accountid,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ contactDealerStr:JSON.stringify(this.contactDealer),
+ methodTypeStr:this.pageType
+ }).then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.esetId = result.esetId;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('淇濆瓨澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //缂栬緫
+ editOrder(event){
+ setEditAble({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('缂栬緫澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鎵撳嵃閰嶇疆鍗�
+ printOrder(event){
+ var site = window.location.origin;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: site+'/consumable/PrintConsumblePDF?ESetid='+this.esetId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //涓婁紶閰嶇疆鍗�
+ uploadOrder(event){
+ this.showAttPop = true;
+ }
+
+ //鎻愪氦璁㈠崟
+ submitOrder(event){
+ sorder({eSetidStr:this.esetId,accountidStr:this.accountid})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ // this.hasError = result.hasError;
+ // this.hasWarning = result.hasWarning;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg.indexOf("璇蜂笂浼犺璐ч厤缃崟闄勪欢") != -1){
+ result.errorMsg = '璇蜂笂浼犺璐ч厤缃崟闄勪欢';
+ }
+ this.showMyToast('鎻愪氦澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ })
+ }
+
+ //鍒犻櫎璁㈠崟
+ deleteOrder(event){
+ if(!window.confirm('鍒犻櫎鏄笉鍙仮澶嶇殑锛屼綘纭瑕佸垹闄ゅ悧锛�')){
+ return;
+ }
+ delConsumable({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒犻櫎澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鐗逛环閲戦褰曞叆
+ inputOfferPrice(event){
+ this.edoffersPrice = true;
+ if(!(this.editAble || this.edoffersPrice)){
+ this.showEditBtn = true;
+ this.showOfferPriceInputBtn = true;
+ }else{
+ this.showEditBtn = false;
+ this.showOfferPriceInputBtn = false;
+ }
+ if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
+ this.showPrintSheetBtn = true;
+ this.showUploadSheetBtn = true;
+ this.showSubOrderbtn = true;
+ this.showDeleteBtn = true;
+ }else{
+ this.showPrintSheetBtn = false;
+ this.showUploadSheetBtn = false;
+ this.showSubOrderbtn = false;
+ this.showDeleteBtn = false;
+ }
+ if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "椹冲洖"){
+ this.showSaveOrderbtn1 = true;
+ }else{
+ this.showSaveOrderbtn1 = false;
+ }
+ }
+
+ //鍐嶇敵璇�
+ reapplyOrder(event){
+ backOrder({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍐嶇敵璇峰け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+
+ attChange(event){
+ if(event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ console.log('this.fileName:'+this.fileName);
+ }
+ }
+
+ get attDelBtn(){
+ if(this.fileName != '' && this.fileName != null && this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�'){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ closePop(){
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ }
+
+ removeAtt(){
+ this.filesUploaded = [];
+ this.fileName = '';
+ }
+
+ uploadAtt(event){
+ if(this.filesUploaded.length > 0) {
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ window.console.log('鏂囦欢杩囧ぇ');
+ return ;
+ }
+ this.fileReader= new FileReader();
+
+ this.fileReader.onloadend = (() => {
+ this.fileContents = this.fileReader.result;
+ let base64 = 'base64,';
+ this.content = this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ this.saveToFile();
+ });
+ this.fileReader.readAsDataURL(this.file);
+ }
+ else {
+ this.fileName = '璇烽�夋嫨涓�涓枃浠朵笂浼�';
+ }
+ }
+
+ saveToFile() {
+ // this.showSpinner = true;
+ filesUpload({pId:this.esetId, fileName: this.file.name, base64Data: encodeURIComponent(this.fileContents)})
+ .then(result => {
+ // this.showSpinner = false;
+ if(result.result == 'Success'){
+ // this.showMyToast('涓婁紶鎴愬姛','','success');
+ this.closePop();
+ window.location.reload();
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('涓婁紶澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error => {
+ this.showSpinner = false;
+ this.showMyToast('涓婁紶澶辫触',error,'error');
+ });
+ }
+
+ //鎵撳紑鎼滅储寮圭獥锛屽苟鍒濆鍖栧脊绐�
+ showSearchHos(event){
+ initHospital()
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.showAttHosPop = true;
+ this.hospitalList = result.attList;
+ for(var i in this.hospitalList){
+ if(this.hospitalList[i].State_Master__c){
+ this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栨绱㈠尰闄㈤〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鍒濆鍖栨绱㈠尰闄㈤〉闈㈠け璐�',error,'error');
+ })
+ }
+
+ //妫�绱㈠尰闄�
+ searchHos(event){
+ searchHospital({searchName:this.searchNameHos, accountId:this.accountid})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.hospitalList = result.attList;
+ for(var i in this.hospitalList){
+ if(this.hospitalList[i].State_Master__c){
+ this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储澶辫触',error,'error');
+ })
+ }
+
+ searchNameHosChange(event){
+ this.searchNameHos = event.detail.value;
+ }
+
+ //鍏抽棴寮圭獥
+ closeHospitalPop(){
+ this.showAttHosPop = false;
+ this.chooseHospital = '';
+ this.chooseHospitalId = '';
+ }
+
+ // //閫夋嫨鍖婚櫌
+ // chooseHos(event){
+ // var hosName = event.target.getAttribute("data-name");
+ // var hosid = event.target.getAttribute("data-hosid");
+ // console.log('hos:'+hosName+'---'+hosid);
+ // this.chooseHospital = hosName;
+ // this.chooseHospitalId = hosid;
+ // }
+
+ chooseHos(event){
+ const row = event.detail.row;
+ this.chooseHospitalId = row.Id;
+ this.chooseHospital = row.Name;
+ console.log('row.Id:'+row.Id);
+ console.log('row.Name:'+row.Name);
+ this.confirmHospital();
+ }
+
+ //纭閫夋嫨鍖婚櫌
+ confirmHospital(){
+ if(this.chooseHospital != '' && this.chooseHospital != null){
+ this.hospitalId = this.chooseHospitalId;
+ this.tempidHp = this.chooseHospitalId;
+ this.hospitalName = this.chooseHospital;
+ this.closeHospitalPop();
+ //娑堥櫎璀﹀憡
+ var arr = [];
+ for(var i in this.warningMsgs){
+ if(this.warningMsgs[i] != '璇烽�夋嫨鍖婚櫌'){
+ arr.push(this.warningMsgs[i]);
+ }
+ }
+ this.warningMsgs = arr;
+ if(this.tempidHp != 'tempId' && this.tempidHp != ''){
+ searchorderdetails({
+ methodTypeStr : this.pageType,
+ accountIdStr : this.accountid,
+ hospitalIdStr : this.hospitalId,
+ contractIdStr : this.contractId,
+ userWorkLocationStr : this.userWorkLocation,
+ accountNameStr : this.accountName,
+ proLimitAndDateList : this.proLimitAndDate,
+ editAbleStr : this.editAble
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储浜у搧澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储浜у搧澶辫触',error,'error');
+ })
+ this.tempidHp = 'tempId';
+ }
+ }else{
+ this.showMyToast('璇烽�夋嫨鍖婚櫌','','error');
+ }
+ }
+
+ //鎵撳紑鍚堝悓妫�绱㈠脊绐楀苟鍒濆鍖�
+ showSearchCon(){
+ initContract({ctype:this.agencyProType})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.showConPop = true;
+ this.contractList = result.attList;
+ for(var i in this.contractList){
+ if(this.contractList[i].State_Master__c){
+ this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栨绱㈠悎鍚岄〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鍒濆鍖栨绱㈠悎鍚岄〉闈㈠け璐�',error,'error');
+ })
+ }
+
+ //妫�绱㈠悎鍚�
+ searchCon(){
+ searchContract({searchName:this.searchNameCon, accountId:this.accountid, ctype:this.agencyProType})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.contractList = result.attList;
+ for(var i in this.contractList){
+ if(this.contractList[i].State_Master__c){
+ this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储澶辫触',error,'error');
+ })
+ }
+
+ searchNameConChange(event){
+ this.searchNameCon = event.detail.value;
+ }
+
+ //鍏抽棴寮圭獥
+ closeContractPop(){
+ this.showConPop = false;
+ this.chooseContract = '';
+ this.chooseContractId = '';
+ }
+
+ //閫夋嫨鍚堝悓
+ // chooseCon(event){
+ // var conName = event.target.getAttribute("data-name");
+ // var conid = event.target.getAttribute("data-hosid");
+ // console.log('hos:'+conName+'---'+conid);
+ // this.chooseContract = conName;
+ // this.chooseContractId = conid;
+ // }
+
+ chooseCon(event){
+ const row = event.detail.row;
+ this.chooseContractId = row.Id;
+ this.chooseContract = row.Name;
+ console.log('row.Id:'+row.Id);
+ console.log('row.Name:'+row.Name);
+ this.confirmContract();
+ }
+
+ //纭閫夋嫨鍚堝悓
+ confirmContract(){
+ if(this.chooseContract != '' && this.chooseContract != null){
+ this.contractId = this.chooseContractId;
+ this.tempidPp = this.chooseContractId;
+ this.contractName = this.chooseContract;
+ this.closeContractPop();
+ if(this.tempidPp != 'tempId' && this.tempidPp != '' && this.contractId != '' && this.pageType == 'promotionorder'){
+ searchorderdetails({
+ methodTypeStr : this.pageType,
+ accountIdStr : this.accountid,
+ hospitalIdStr : this.hospitalId,
+ contractIdStr : this.contractId,
+ userWorkLocationStr : this.userWorkLocation,
+ accountNameStr : this.accountName,
+ proLimitAndDateList : this.proLimitAndDate,
+ editAbleStr : this.editAble
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储浜у搧澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储浜у搧澶辫触',error,'error');
+ })
+ this.tempidPp = 'tempId';
+ }
+ }else{
+ this.showMyToast('璇烽�夋嫨鍚堝悓','','error');
+ }
+ }
+
+ showMyToast(title,message,variant){
+ const evt = new ShowToastEvent({
+ title : title,
+ message: message,
+ variant: variant
+ });
+ this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml b/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
new file mode 100644
index 0000000..028a891
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
@@ -0,0 +1,66 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <lightning-button style="margin: 5px;" label="鍗忚璁㈣揣" onclick={agreementorder}></lightning-button>
+ <template if:true={showHop}>
+ <lightning-button style="margin: 5px;" label="鍖婚櫌鐗逛环" onclick={hospitalorder}></lightning-button>
+ </template>
+ <template if:true={hasSpecial}>
+ <lightning-button style="margin: 5px;" label="淇冮攢璁㈣揣" onclick={promotionorder}></lightning-button>
+ </template>
+ <p style="height: 10px;"></p>
+ <!-- 鎼滅储 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>妫�绱㈡潯浠�</strong></p>
+ </div>
+ <div style="padding:10px;">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width: 9%;text-align: right;padding-right:7px;">
+ <div style="color:#696969;font-size:12px;">娑堣�楀搧璁㈠崟鍚嶇О</div>
+ </td>
+ <td style="width: 22%;">
+ <lightning-input type="text" label="娑堣�楀搧璁㈠崟鍚嶇О" value={category1} variant="label-hidden" onchange={category1Change}></lightning-input>
+ </td>
+ <td style="width: 8%;text-align: right;padding-right:7px;">
+ <div style="color:#696969;font-size:12px;">璁㈠崟鏃ユ湡</div>
+ </td>
+ <td style="width: 19%;">
+ <lightning-input type="date" name="orderDate" value={orderDate} label="璁㈠崟鏃ユ湡" variant="label-hidden" onchange={orderDateChange}></lightning-input>
+ </td>
+ <td style="width: 8%;text-align: right;padding-right:7px;">
+ <div style="color:#696969;font-size:12px;">璁㈠崟鐘舵��</div>
+ </td>
+ <td style="width: 19%;">
+ <lightning-combobox name="orderStatus" label="璁㈠崟鐘舵��" value={orderStatus} placeholder="璇烽�夋嫨..." options={provinceOpts} variant="label-hidden" onchange={orderStatusChange}></lightning-combobox>
+ </td>
+ <td style="width: 2%;"></td>
+ <td style="width: 14%;">
+ <lightning-button style="margin: 5px;" label="鎼滅储" onclick={searchProduct}></lightning-button>
+ <lightning-button style="margin: 5px;" label="娓呯┖" onclick={clear}></lightning-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 璁㈣揣鏄庣粏 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <p style="font-size: 16px;"><strong>璁㈣揣鏄庣粏</strong></p>
+ </div>
+ <div style="padding:10px;">
+ <lightning-datatable key-field="id" hide-checkbox-column="true" data={raesList} columns={cols}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
new file mode 100644
index 0000000..f145e4c
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
@@ -0,0 +1,178 @@
+import { LightningElement,wire,api,track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexConsumableOrderManageController.init1';
+import searchConsumableorderdetails from '@salesforce/apex/LexConsumableOrderManageController.searchConsumableorderdetails';
+
+export default class LexConsumableOrderManage extends NavigationMixin(LightningElement) {
+ @track category1;
+ @track orderDate;
+ @track orderStatus = '';
+ @track provinceOpts = [];
+ @track raesList = [];
+ @track title = [];
+ @track agencyProType;
+ @track accountid;
+ @track userWorkLocation;
+ @track hasHop = false;
+ @track showHop = false;
+ @track hasSpecial = false;
+ @track cols = [];
+ @track showSpinner = false;
+ @track showPage = false;
+
+ connectedCallback(){
+ this.showSpinner = true;
+ initPage()
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.provinceOpts = result.provinceOpts;
+ this.title = result.title;
+ this.raesList = result.raesList;
+ this.agencyProType = result.agencyProType;
+ this.accountid = result.accountid;
+ this.userWorkLocation = result.userWorkLocation;
+ this.hasHop = result.hasHop;
+ this.hasSpecial = result.hasSpecial;
+ this.cols = result.cols;
+ if(this.hasHop == true && this.agencyProType == 'ENG'){
+ this.showHop = true;
+ }
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showSpinner = false;
+ this.showPage = true;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ const evt = new ShowToastEvent({
+ title : '鍒濆鍖栭〉闈㈠け璐�',
+ message: result.errorMsg,
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ }
+ })
+ .catch(error=>{
+ this.showSpinner = false;
+ console.log("Error:"+error);
+ })
+ }
+
+ category1Change(event){
+ this.category1 = event.detail.value;
+ console.log('category1:'+this.category1);
+ }
+
+ orderDateChange(event){
+ this.orderDate = event.detail.value;
+ console.log('orderDate:'+this.orderDate);
+ }
+
+ orderStatusChange(event){
+ this.orderStatus = event.detail.value;
+ console.log('orderStatus:'+this.orderStatus);
+ }
+
+ agreementorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=agreementorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ hospitalorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=hospitalorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ promotionorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=promotionorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ searchProduct(event){
+ this.showSpinner = true;
+ searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ this.raesList = result.raesList;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ this.dispatchEvent(evt);
+ }
+ })
+ }
+
+ clear(event){
+ this.category1 = '';
+ this.orderDate = null;
+ this.orderStatus = '';
+ searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.raesList = result.raesList;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ this.dispatchEvent(evt);
+ }
+ })
+ }
+
+ showMyToast(title,message,variant){
+ const evt = new ShowToastEvent({
+ title : title,
+ message: message,
+ variant: variant
+ });
+ this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
index ae1f345..7c503c5 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
@@ -29,7 +29,7 @@
<td><lightning-button label="搴撳瓨鐩樼偣" title="搴撳瓨鐩樼偣" onclick={inventoryCount} ></lightning-button></td>
<td></td>
<td></td>
- <td style="width:100px;"><lightning-button label="杩囨湡搴撳瓨閿�瀛�" title="杩囨湡搴撳瓨閿�瀛�" onclick={handleClick} ></lightning-button></td>
+ <td style="width:100px;"><lightning-button label="杩囨湡搴撳瓨閿�瀛�" title="杩囨湡搴撳瓨閿�瀛�" onclick={handleExpired} ></lightning-button></td>
<td></td>
<td></td>
<td style="width:100px;"><lightning-button label="鎷嗙洅" title="鎷嗙洅" onclick={handleClick} ></lightning-button></td>
@@ -70,13 +70,13 @@
<lightning-input type="text" name="Name" label="娑堣�楀搧鍚嶇О" value={Name} variant="label-inline" onchange={handleChange} data-field ="Name" ></lightning-input>
</td>
<td style="width: 21%;">
- <lightning-combobox name="CategoryThree" label="绗�3鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={optionscatone} variant="label-inline" onchange={handleChange}></lightning-combobox>
+ <lightning-combobox name="CategoryThree" label="绗�3鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={options1} variant="label-inline" data-field ="CategoryThree" onchange={handleChange}></lightning-combobox>
</td>
<td style="width: 21%;">
- <lightning-combobox name="CategoryFour" label="绗�4鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={options2} variant="label-inline" onchange={handleChange}></lightning-combobox>
+ <lightning-combobox name="CategoryFour" label="绗�4鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={options2} variant="label-inline" data-field ="CategoryFour" onchange={handleChange}></lightning-combobox>
</td>
<td style="width: 21%;">
- <lightning-combobox name="CategoryFive" label="绗�5鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={options3} variant="label-inline" onchange={handleChange}></lightning-combobox>
+ <lightning-combobox name="CategoryFive" label="绗�5鍒嗙被" value={value} placeholder="璇烽�夋嫨..." options={options3} variant="label-inline" data-field ="CategoryFive" onchange={handleChange}></lightning-combobox>
</td>
<td style="width: 3%;"></td>
<td style="width: 8%;">
@@ -97,6 +97,7 @@
<div style="padding:10px;">
<template if:true={showTable}>
<c-lwc-datatable-utility
+ hidecheckboxcolumn = {hidecheckboxcolumn}
records={data}
total-records={data.length}
columns = {columns}
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
index ac4f146..b24100b 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -9,43 +9,45 @@
fieldName: 'Name__c',
type: 'Name',
sortable: true,
+ initialWidth: 250,
cellAttributes: { alignment: 'left' }
},
{
label: '绗笁鍒嗙被',
fieldName: 'Category3__c',
hideDefaultActions: true,
- sortable: true
+ sortable: true,
+ initialWidth: 90
},
{
label: '绗洓鍒嗙被',
fieldName: 'Category4__c',
hideDefaultActions: true,
- sortable: true
+ sortable: true,
+ initialWidth: 90
},
{
label: '绗簲鍒嗙被',
fieldName: 'Category5__c',
- hideDefaultActions: true
+ hideDefaultActions: true,
+ initialWidth: 90
},
{
label: '瑙勬牸',
fieldName: 'packing_list',
- hideDefaultActions: true,
- initialWidth: 100
+ hideDefaultActions: true
},
{
label: '鍗曚綅',
fieldName: 'BoxPiece',
- hideDefaultActions: true,
- initialWidth: 100
+ hideDefaultActions: true
},
{
label: '娉ㄥ唽璇佺紪鐮佸彿',
fieldName: 'approbation_No',
- hideDefaultActions: true,
- initialWidth: 100
+ initialWidth: 180,
+ hideDefaultActions: true
},
{
label: '娉ㄥ唽鏈夋晥鏈�',
@@ -56,27 +58,33 @@
{
label: 'CFDA鐘舵��',
fieldName: 'SFDA_Status__c',
- hideDefaultActions: true
+ hideDefaultActions: true,
+ initialWidth: 100
},
{
label: '浣跨敤鏈熼檺',
fieldName: 'guaranteeperiod',
- hideDefaultActions: true
+ hideDefaultActions: true,
+ initialWidth: 100
},
{
label: '鏈夋晥鏈熷唴搴撳瓨',
fieldName: 'limitCount',
hideDefaultActions: true,
- sortable: true
+ sortable: true,
+ initialWidth: 100
},
{
label: '杩囨湡搴撳瓨',
fieldName: 'overlimitCount',
- hideDefaultActions: true
+ hideDefaultActions: true,
+ initialWidth: 100
}
];
-export default class LexinventoryViewLWC extends LightningElement {
+export default class LexinventoryViewLWC extends NavigationMixin(
+ LightningElement
+) {
@track pageRecords = [];
@track data = [];
@track message = '';
@@ -90,9 +98,11 @@
@track userWorkLocation;
@track value = '';
@track showTable = false;
- @track optionscatone = [];
- @track options2 = [];
- @track options3 = [];
+ @track hidecheckboxcolumn = true;
+ @track check = false;
+ // @track options1 = [];
+ // @track options2 = [];
+ // @track options3 = [];
columns = columns;
defaultSortDirection = 'asc';
@@ -150,7 +160,7 @@
object['value'] = key;
option1ValueTemp.push(object);
}
- this.optionscatone = option1ValueTemp;
+ this.options1 = option1ValueTemp;
console.log(
' this.optionscatone===>' +
JSON.stringify(this.optionscatone)
@@ -163,12 +173,14 @@
option2ValueTemp.push(object);
}
this.options2 = option2ValueTemp;
+ let option3ValueTemp = [];
for (var key in result.entity.category5OptionMap) {
let object = {};
object['label'] = result.entity.category5OptionMap[key];
object['value'] = key;
- this.options3.push(object);
+ option3ValueTemp.push(object);
}
+ this.options3 = option3ValueTemp;
console.log(' this.data=====>' + this.data);
@@ -196,13 +208,6 @@
.catch((error) => {
console.log('error = ' + JSON.stringify(error));
});
- }
-
- get options2() {
- return this.options2;
- }
- get options3() {
- return this.options3;
}
sortBy(field, reverse, primer) {
const key = primer
@@ -266,12 +271,13 @@
this.showTable = false;
console.log('杩涘叆鎼滅储11111111111111');
console.log('杩涘叆鎼滅储');
- console.log('this.Name = ' + this.Name);
+ console.log('this.CategoryThree = ' + this.CategoryThree);
+ console.log('this.CategoryFive = ' + this.CategoryFive);
searchOrder({
category1: this.Name,
Category3: this.CategoryThree,
- Category4: '',
- Category5: '',
+ Category4: this.CategoryFour,
+ Category5: this.CategoryFive,
orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
accountName: this.accountName,
agencyProType: this.agencyProType,
@@ -280,6 +286,10 @@
.then((result) => {
result = JSON.parse(JSON.stringify(result));
console.log('result鎼滅储 = ' + JSON.stringify(result));
+ console.log(
+ 'result鎼滅储鍒楄〃= ' +
+ JSON.stringify(result.entity.pageRecords)
+ );
if (result.status == 'Success') {
const evt = new ShowToastEvent({
title: '鎼滅储鎴愬姛',
@@ -287,7 +297,7 @@
variant: 'Success'
});
this.dispatchEvent(evt);
- this.pageRecords = result.entity.pageRecords;
+ this.data = result.entity.pageRecords;
this.showTable = true;
} else {
const evt = new ShowToastEvent({
@@ -304,6 +314,7 @@
console.log('error = ' + JSON.stringify(error));
});
}
+
inventoryCount() {
console.log('111搴撳瓨鐩樼偣');
this[NavigationMixin.Navigate]({
@@ -313,6 +324,16 @@
}
});
}
+
+ handleExpired() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexOverdueStock'
+ }
+ });
+ }
+
clearAll() {
this.Name = '';
this.value = '鏃�';
diff --git a/force-app/main/default/lwc/parentComponentTest/__tests__/parentComponentTest.test.js b/force-app/main/default/lwc/parentComponentTest/__tests__/parentComponentTest.test.js
new file mode 100644
index 0000000..8f6e775
--- /dev/null
+++ b/force-app/main/default/lwc/parentComponentTest/__tests__/parentComponentTest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import ParentComponentTest from 'c/parentComponentTest';
+
+describe('c-parent-component-test', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-parent-component-test', {
+ is: ParentComponentTest
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/parentComponentTest/parentComponentTest.html b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.html
new file mode 100644
index 0000000..7ed80b6
--- /dev/null
+++ b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.html
@@ -0,0 +1,44 @@
+<template>
+ <lightning-card title="Augmentor" icon-name="action:download">
+ <lightning-layout>
+ <lightning-layout-item flexibility="auto" padding="around-small">
+ <lightning-input
+ label="Set Starting Counter"
+ type="number"
+ min="0"
+ max="1000000"
+ value={startCounter}
+ onchange={handleStartChange}
+ >
+ </lightning-input>
+ <lightning-button
+ class="slds-var-p-vertical_xx-small"
+ label="Add 1m To Counter"
+ onclick={handleMaximizeCounter}
+ >
+ </lightning-button>
+ </lightning-layout-item>
+ </lightning-layout>
+ <c-child-component-test
+ class="slds-show slds-is-relative"
+ counter={startCounter}
+ >
+ </c-child-component-test>
+ <lightning-vertical-navigation selected-item={newPageId}>
+ <lightning-vertical-navigation-section
+ label="Navigation"
+ selected-item={newPageId}
+ >
+ <template for:each={navigationItems} for:item="navigationItem">
+ <lightning-vertical-navigation-item
+ key={navigationItem.pageId}
+ label={navigationItem.label}
+ name={navigationItem.pageId}
+ onclick={handleNavigate}
+ ></lightning-vertical-navigation-item>
+ </template>
+ </lightning-vertical-navigation-section>
+ </lightning-vertical-navigation>
+ <p>Current Page is <strong>{newPageId}</strong></p>
+ </lightning-card>
+</template>
diff --git a/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js
new file mode 100644
index 0000000..3fd8c41
--- /dev/null
+++ b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js
@@ -0,0 +1,62 @@
+import { LightningElement,wire } from 'lwc';
+import { CurrentPageReference, NavigationMixin } from 'lightning/navigation';
+
+const NAVIGATION_ITEMS = [
+ { label: 'Home', pageId: 'home', isCurrentPage: false },
+ { label: 'PageA', pageId: 'pageA', isCurrentPage: false },
+ { label: 'PageB', pageId: 'pageB', isCurrentPage: false },
+ { label: 'PageC', pageId: 'pageC', isCurrentPage: false },
+];
+
+export default class ParentComponentTest extends NavigationMixin(LightningElement) {
+ startCounter = 0;
+ handleStartChange(event) {
+ this.startCounter = parseInt(event.target.value);
+ }
+ handleMaximizeCounter() {
+ this.template.querySelector('c-child-component-test').maximizeCounter();
+ }
+
+ //Navigation Start
+ currentPageReference;
+ selectedPageId;
+ newPageId = 'home';
+ navigationItems = NAVIGATION_ITEMS;
+
+ get newPageReferenceUrlParams() {
+ return {
+ c__ids: this.selectedPageId
+ };
+ }
+
+ get newPageReference() {
+ return Object.assign({}, this.currentPageReference, {
+ state: Object.assign({}, this.currentPageReference.state, this.newPageReferenceUrlParams)
+ });
+ }
+
+ navigateToNewPage() {
+ this[NavigationMixin.Navigate](
+ this.newPageReference,
+ false // if true js history is replaced without pushing a new history entry onto the browser history stack
+ ); // if false new js history entry is created. User will be able to click browser back/forward buttons
+ }
+
+ handleNavigate(event) {
+ this.selectedPageId = event.target.name;
+ this.navigateToNewPage();
+ }
+
+ @wire(CurrentPageReference)
+ setCurrentPageReference(currentPageReference) {
+ if (currentPageReference) {
+ this.currentPageReference = currentPageReference;
+ this.setCurrentPageIdBasedOnUrl();
+ }
+ }
+
+ setCurrentPageIdBasedOnUrl() {
+ this.newPageId = this.currentPageReference.state.c__ids;
+ }
+ ////Navigation End
+}
diff --git a/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js-meta.xml b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js-meta.xml
new file mode 100644
index 0000000..bf0508f
--- /dev/null
+++ b/force-app/main/default/lwc/parentComponentTest/parentComponentTest.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__Tab</target>
+ </targets>
+</LightningComponentBundle>
diff --git a/manifest/packageForLex.xml b/manifest/packageForLex.xml
index 25a1a2e..b3315a7 100644
--- a/manifest/packageForLex.xml
+++ b/manifest/packageForLex.xml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
- <members>*</members>
+ <members>lexConsumable</members>
<name>LightningComponentBundle</name>
</types>
+ <types>
+ <members>LexConsumableController</members>
+ <name>ApexClass</name>
+ </types>
<version>52.0</version>
</Package>
--
Gitblit v1.9.1