From f0bccccbb88d93ac05010c17d4b2e0cb22a2ce9a Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期四, 20 四月 2023 15:45:11 +0800 Subject: [PATCH] backup0420 --- force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js | 2028 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 1,414 insertions(+), 614 deletions(-) diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js index 6a4ab2e..861ade4 100644 --- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js +++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js @@ -1,267 +1,412 @@ -import { LightningElement, wire, api, track } from 'lwc'; -import init from '@salesforce/apex/LexSummonsCreatController.init'; -import { ShowToastEvent } from 'lightning/platformShowToastEvent'; -import searchConsumableorderdetails from '@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails'; -import PraseToPDF from '@salesforce/apex/LexSummonsCreatController.PraseToPDF'; -import apexSearch from '@salesforce/apex/SampleLookupController.search'; -import save from '@salesforce/apex/LexSummonsCreatController.save'; -import OPPORTUNITY_OBJECT from '@salesforce/schema/Consumable_Orderdetails__c'; -import { getObjectInfo } from 'lightning/uiObjectInfoApi'; -import hospitalInit from '@salesforce/apex/lexSearchAgencyHospitalController.init'; -import serContact from '@salesforce/apex/lexSearchAgencyHospitalController.serContact'; -import { NavigationMixin } from 'lightning/navigation'; - - - - +import { LightningElement, wire, api, track } from "lwc"; +import init from "@salesforce/apex/LexSummonsCreatController.init"; +import { ShowToastEvent } from "lightning/platformShowToastEvent"; +import searchConsumableorderdetails from "@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails"; +import PraseToPDF from "@salesforce/apex/LexSummonsCreatController.PraseToPDF"; +import apexSearch from "@salesforce/apex/LexSummonsCreatController.search"; +import saveFile from "@salesforce/apex/LexSummonsCreatController.saveFile"; +import getFiles from "@salesforce/apex/LexSummonsCreatController.getFiles"; +import GoodsDelivery from "@salesforce/apex/LexSummonsCreatController.GoodsDelivery"; +import DelConsumable from "@salesforce/apex/LexSummonsCreatController.DelConsumable"; +import categoryAllload from "@salesforce/apex/LexSummonsCreatController.categoryAllload"; +import categoryload from "@salesforce/apex/LexSummonsCreatController.categoryload"; +import GoodsDeliveryInit from "@salesforce/apex/LexSaleOrderController.GoodsDeliveryInit"; +import SearchPro from "@salesforce/apex/LexSaleOrderController.SearchPro"; +import ProdElivery from "@salesforce/apex/LexSaleOrderController.ProdElivery"; +import ProSale from "@salesforce/apex/LexSaleOrderController.ProSale"; +import save from "@salesforce/apex/LexSummonsCreatController.save"; +import OPPORTUNITY_OBJECT from "@salesforce/schema/Consumable_Orderdetails__c"; +import { getObjectInfo } from "lightning/uiObjectInfoApi"; +import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init"; +import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact"; +import { NavigationMixin } from "lightning/navigation"; export default class LexSummonsCreat extends NavigationMixin(LightningElement) { @track isShowSpinner = true; @track showResults = true; @track results = [ { - Id:'1', - Name : 'z' + Id: "1", + Name: "z", }, { - Id:'2', - Name : 'h' + Id: "2", + Name: "h", }, { - Id:'3', - Name : 'j' - } + Id: "3", + Name: "j", + }, ]; @track COLS = [ - { - label: 'Account Name', - type: 'customName', + { + label: "Account Name", + type: "customName", typeAttributes: { - accountName: { fieldName: 'Name' } - } - }]; + accountName: { fieldName: "Name" }, + }, + }, + ]; @track columns = [ - { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', - hideDefaultActions: true , - wrapText:true, + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + //hideDefaultActions: true, + wrapText: true, //initialWidth : 100, }, - { - label: '瑙勬牸', - fieldName: 'packinglist', + { + label: "瑙勬牸", + fieldName: "packinglist", //initialWidth : 50, - wrapText:true, - hideDefaultActions: true + wrapText: true, + hideDefaultActions: true, }, - { - label: 'CFDA鐘舵��', - fieldName: 'SFDA_Status__c', + { + label: "CFDA鐘舵��", + fieldName: "SFDA_Status__c", //initialWidth : 100, - wrapText:true, - hideDefaultActions: true + wrapText: true, + hideDefaultActions: true, }, - { - label: '娉ㄥ唽璇佺紪鐮佸彿', - fieldName: 'approbation_No', + { + label: "娉ㄥ唽璇佺紪鐮佸彿", + fieldName: "approbation_No", //initialWidth : 150, - wrapText:true, - hideDefaultActions: true + wrapText: true, + hideDefaultActions: true, }, - { - label: '娉ㄥ唽璇佹晥鏈�', - //initialWidth : 100, - wrapText:true, - fieldName: 'expiration_Date', - hideDefaultActions: true , - }, - { - label: '绗�3鍒嗙被', - fieldName: 'Category3__c', + { + label: "娉ㄥ唽璇佹晥鏈�", //initialWidth : 100, - wrapText:true, + wrapText: true, + fieldName: "expiration_Date", + hideDefaultActions: true, + }, + { + label: "绗�3鍒嗙被", + fieldName: "Category3__c", + //initialWidth : 100, + wrapText: true, hideDefaultActions: true, sortable: true, }, - { - label: '绗�4鍒嗙被', - fieldName: 'Category4__c', + { + label: "绗�4鍒嗙被", + fieldName: "Category4__c", //initialWidth : 100, - wrapText:true, + wrapText: true, hideDefaultActions: true, - sortable: true + sortable: true, }, - { - label: '绗�5鍒嗙被', - fieldName: 'Category5__c', + { + label: "绗�5鍒嗙被", + fieldName: "Category5__c", //initialWidth : 100, - wrapText:true, + wrapText: true, hideDefaultActions: true, - sortable: true + sortable: true, }, - { - label: '鍗曚綅', - type:'customUnit', + { + label: "鍗曚綅", + type: "customUnit", //initialWidth : 100, hideDefaultActions: true, typeAttributes: { - unitValue: { fieldName: 'unitValue' }, - unitOptions: { fieldName: 'unitOptions' }, - recordId: { fieldName: 'recordId' } + unitValue: { fieldName: "unitValue" }, + unitOptions: { fieldName: "unitOptions" }, + recordId: { fieldName: "recordId" }, }, }, - { - label: '鍑鸿揣鏁伴噺', - type: 'customShipment', + { + label: "鍑鸿揣鏁伴噺", + type: "customShipment", //initialWidth : 150, hideDefaultActions: true, typeAttributes: { - recordId: { fieldName: 'recordId' }, - shipmentNumber: { fieldName: 'shipmentNumber' }, + recordId: { fieldName: "recordId" }, + shipmentNumber: { fieldName: "shipmentNumber" }, }, }, - { - label: '鍑鸿揣鍗曚环(鍏�)', - type: 'customShipmentUnitPrice', + { + label: "鍑鸿揣鍗曚环(鍏�)", + type: "customShipmentUnitPrice", //initialWidth : 150, hideDefaultActions: true, typeAttributes: { - recordId: { fieldName: 'recordId' }, - shippingUnitPrice: { fieldName: 'shippingUnitPrice' } + recordId: { fieldName: "recordId" }, + shippingUnitPrice: { fieldName: "shippingUnitPrice" }, }, }, - { - label: '鍑鸿揣閲戦(鍏�)', - type: 'customShipmentAmount', + { + label: "鍑鸿揣閲戦(鍏�)", + type: "customShipmentAmount", //initialWidth : 120, hideDefaultActions: true, typeAttributes: { - shipmentAmount: { fieldName: 'shipmentAmount' } + shipmentAmount: { fieldName: "shipmentAmount" }, }, }, - { - label: '鏈夋晥鏈熷唴搴撳瓨(鐩�)', - fieldName: 'Boxnumber', + { + label: "鏈夋晥鏈熷唴搴撳瓨(鐩�)", + fieldName: "Boxnumber", //initialWidth : 120, - wrapText:true, + wrapText: true, hideDefaultActions: true, }, - { - label: '鏈夋晥鏈熷唴搴撳瓨(涓�)', - fieldName: 'Piecenumber', + { + label: "鏈夋晥鏈熷唴搴撳瓨(涓�)", + fieldName: "Piecenumber", //initialWidth : 120, - wrapText:true, + wrapText: true, hideDefaultActions: true, - } + }, ]; @track editColumns = [ - { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', - hideDefaultActions: true , - initialWidth : 250, + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + hideDefaultActions: true, + initialWidth: 250, }, - { - label: '瑙勬牸', - fieldName: 'packinglist', - initialWidth : 50, - hideDefaultActions: true + { + label: "瑙勬牸", + fieldName: "packinglist", + initialWidth: 50, + hideDefaultActions: true, }, - { - label: 'CFDA鐘舵��', - fieldName: 'SFDA_Status__c', - initialWidth : 100, - hideDefaultActions: true + { + label: "CFDA鐘舵��", + fieldName: "SFDA_Status__c", + initialWidth: 100, + hideDefaultActions: true, }, - { - label: '娉ㄥ唽璇佺紪鐮佸彿', - fieldName: 'approbation_No', - initialWidth : 150, - hideDefaultActions: true + { + label: "娉ㄥ唽璇佺紪鐮佸彿", + fieldName: "approbation_No", + initialWidth: 150, + hideDefaultActions: true, }, - { - label: '娉ㄥ唽璇佹晥鏈�', - initialWidth : 100, - fieldName: 'expiration_Date', - hideDefaultActions: true , + { + label: "娉ㄥ唽璇佹晥鏈�", + initialWidth: 100, + fieldName: "expiration_Date", + hideDefaultActions: true, }, - { - label: '绗�3鍒嗙被', - fieldName: 'Category3__c', - initialWidth : 100, + { + label: "绗�3鍒嗙被", + fieldName: "Category3__c", + initialWidth: 100, hideDefaultActions: true, sortable: true, }, - { - label: '绗�4鍒嗙被', - fieldName: 'Category4__c', - initialWidth : 100, + { + label: "绗�4鍒嗙被", + fieldName: "Category4__c", + initialWidth: 100, hideDefaultActions: true, - sortable: true + sortable: true, }, - { - label: '绗�5鍒嗙被', - fieldName: 'Category5__c', - initialWidth : 100, + { + label: "绗�5鍒嗙被", + fieldName: "Category5__c", + initialWidth: 100, hideDefaultActions: true, - sortable: true + sortable: true, }, - { - label: '鍗曚綅', - fieldName: 'Box_Piece__c', - initialWidth : 100, + { + label: "鍗曚綅", + fieldName: "Box_Piece__c", + initialWidth: 100, hideDefaultActions: true, }, - { - label: '鍑鸿揣鏁伴噺', - fieldName: 'Shipment_Count__c', - initialWidth : 150, + { + label: "鍑鸿揣鏁伴噺", + fieldName: "Shipment_Count__c", + initialWidth: 150, hideDefaultActions: true, }, - { - label: '鍑鸿揣鍗曚环(鍏�)', - fieldName: 'Shipment_amount__c', - initialWidth : 150, + { + label: "鍑鸿揣鍗曚环(鍏�)", + fieldName: "Shipment_amount__c", + initialWidth: 150, hideDefaultActions: true, - } + }, ]; - - @track hospitalList=[]; + @track hospitalList = []; @track hospitalColumns = [ - { - label: '鍖婚櫌鍚嶇О', - fieldName: 'Name', - initialWidth : 400, - hideDefaultActions: true , + { + label: "鍖婚櫌鍚嶇О", + fieldName: "Name", + initialWidth: 400, + hideDefaultActions: true, }, - { - label: '鐪佷唤', - fieldName: 'stateMasterName', - hideDefaultActions: true , + { + label: "鐪佷唤", + fieldName: "stateMasterName", + hideDefaultActions: true, }, - { - label: '閫夋嫨', - fieldName : 'Id1', - type : 'button', - hideDefaultActions: true , + { + label: "閫夋嫨", + fieldName: "Id1", + type: "button", + hideDefaultActions: true, typeAttributes: { - label: '閫夋嫨', - name: 'Id2', - size: 1 - } - } + label: "閫夋嫨", + name: "Id2", + size: 1, + }, + }, ]; - @track accountid = ''; + @track accountid = ""; @track consumableproductdetailsRecords = []; - @track SummonsStatus = ''; - @track ESetid = ''; + @track SummonsStatus = ""; + @track ESetid = ""; + @track statusEdit = ""; @track cocLwc = {}; @track selectedRows = []; - @track ConsumableOut_report = ''; + @track ConsumableOut_report = ""; + @track isMutualTransferGoods = false; + @track Barcode = ""; + @track summonsForDirction = ''; + + @track consumableorderdetails2RecordsColumns = [ + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "ProdName", + hideDefaultActions: true, + }, + { + label: "鎵规鍙�", + fieldName: "orderdetails2SerialLotNo__c", + hideDefaultActions: true, + }, + { + label: "绠$悊缂栫爜", + fieldName: "orderdetails2TracingCode__c", + hideDefaultActions: true, + }, + { + label: "浣跨敤鏈熼檺", + fieldName: "orderdetails2Sterilization_limit__c", + hideDefaultActions: true, + }, + ]; + @track consumableorderdetails2Records = []; + + //鍑鸿揣/閿�鍞� + @track salesColumns = [ + { + label: "娑堣�楀搧璁㈠崟", + fieldName: "Consumable_order_minor__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "娑堣�楀搧鏄庣粏2鍚嶇О", + fieldName: "orderdetails2NameUrl", + type: "url", + typeAttributes: { + label: { fieldName: "orderdetails2Name" }, + target: "_blank", + }, + hideDefaultActions: true, + wrapText: true, + }, + { + label: "鍗曚綅", + fieldName: "Box_Piece__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "ProdName", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "鍙戣揣鏃ユ湡", + fieldName: "Deliver_date__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "BarCode", + fieldName: "Bar_Code__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "浣跨敤鏈熼檺", + fieldName: "Sterilization_limit__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "鍑鸿揣鏁伴噺", + fieldName: "outboundCount", + hideDefaultActions: true, + wrapText: true, + }, + ]; + @track salesData = []; + + @track salesErrorColumns = [ + { + label: "娑堣�楀搧璁㈠崟", + fieldName: "Consumable_order_minor__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "娑堣�楀搧鏄庣粏2鍚嶇О", + fieldName: "orderdetails2Name", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "ProdName", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "鍗曚綅", + fieldName: "Box_Piece__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "BarCode", + fieldName: "Bar_Code__c", + hideDefaultActions: true, + }, + { + label: "浣跨敤鏈熼檺", + fieldName: "Sterilization_limit__c", + hideDefaultActions: true, + wrapText: true, + }, + { + label: "閿欒鍘熷洜", + fieldName: "ErrorReason", + hideDefaultActions: true, + wrapText: true, + }, + ]; + @track salesErrorData = []; + @track salesAccountName = ""; + @track salesUserWorkLocation = ""; + @track salesAccountid = ""; + @track salesOrderdetails = []; + @track salesCoc = {}; + @track salesOrderpieceorboxMap; + @track salesOrderpriceMap; + @track salesOrderagencypriceMap; //鏄剧ず鎸夐挳 @track isSaveShow = false; @@ -272,6 +417,11 @@ @track isOpenReportShow = false; @track isDeleteShow = false; @track isFileShow = false; + @track isShippingSales = false; + @track isSales = false; + @track isBarcode = true; + @track isShowInformation = true; + @track isShowOutboundProductDetails = false; //disable鎸夐挳 @track isEditDisabled = false; @@ -282,53 +432,55 @@ @track isDeleteDisabled = false; //鍑哄簱鍗曚俊鎭� - @track cocId = '' + @track cocId = ""; @track EditAble = false; @track summonsStatusPriceNotDetermined = false; @track isSummonsForDirctionTwoShow = false; @track isSummonsFlag = false; @track isConInvoiceShow = false; - @track sumPrice = ''; + @track sumPrice = ""; @track isSearchShow = false; @track Existarrive = false; - @track Category3 = ''; - @track category3Options=[]; - @track Category4 = ''; - @track category4Options=[]; - @track Category5 = ''; - @track category5Options=[]; + @track Category3 = ""; + @track category3Options = []; + @track Category4 = ""; + @track category4Options = []; + @track Category5 = ""; + @track category5Options = []; + //鍙戠エid + @track invoiceId = ''; //浜岀骇缁忛攢鍟� - @track secondaryDistributor = ''; + @track secondaryDistributor = ""; @track secondaryDistributorOptions = []; @track isDisabledSecondaryDistributor = false; //缁忛攢鍟嗗綍鍏� - @track ForDealerText = ''; + @track ForDealerText = ""; @track isDisabledForDealerText = false; //瀹㈡埛鍚� @track isModalOpen = false; - @track HospitalName = ''; - @track searchHospitalName = ''; - @track OECId = ''; + @track HospitalName = ""; + @track searchHospitalName = ""; + @track OECId = ""; @track isDisabledHospitalName = false; //绉戝 - @track ForCustomerText = ''; + @track ForCustomerText = ""; @track isDisabledForCustomerText = false; //娌℃湁纭畾浠锋牸 @track NoConfirmedPrice = false; //娑堣�楀搧鍚嶇О - @track consumableName = ''; + @track consumableName = ""; - @track agencyProType = ''; - @track accountName = ''; - @track userWorkLocation = ''; + @track agencyProType = ""; + @track accountName = ""; + @track userWorkLocation = ""; @track OutPattern__c = false; - @track outOutPattern = ''; + @track outOutPattern = ""; //鍑哄簱鍗曟槑缁� @track showTable = false; @@ -336,142 +488,200 @@ @track isSelectShow = false; @track hidecheckboxcolumn = false; @track is345Show = false; - @track arriveorder = ''; + @track arriveorder = ""; @track hasHosPro = false; - @track InvoiceProNotLabel = ''; - @track RrturnProLabel = ''; - @track InvoicedLabel = ''; + @track InvoiceProNotLabel = ""; + @track RrturnProLabel = ""; + @track InvoicedLabel = ""; @track outOutPatternOptionList = []; + //鏂囦欢涓婁紶 + @track showLoadingSpinner = false; + @track UploadFile = "Upload File"; + @track fileName = ""; + @track fileData = []; + @track fileColumns = [ + { + label: "鏍囬", + fieldName: "url", + type: "url", + typeAttributes: { label: { fieldName: "Title" }, target: "_blank" }, + hideDefaultActions: true, + }, + { + label: "鍒涘缓浜�", + fieldName: "CreatedByName", + hideDefaultActions: true, + }, + ]; + filesUploaded = []; + fileContents; + fileReader; + content; + MAX_FILE_SIZE = 1500000; + + get acceptedFormats() { + return [".xlsx"]; + } //InvoiceProNotLabel RrturnProLabel InvoicedLabel @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT }) oppInfo({ data, error }) { if (data) { - this.InvoiceProNotLabel = data.fields.InvoiceProNot_count__c.label - this.RrturnProLabel = data.fields.RrturnPro_count__c.label - this.InvoicedLabel = data.fields.Invoiced_Procount__c.label - console.log('this.InvoiceProNotLabel = ' + this.InvoiceProNotLabel); - console.log('this.RrturnProLabel = ' + this.RrturnProLabel); - console.log('this.InvoicedLabel = ' + this.InvoicedLabel); + this.InvoiceProNotLabel = data.fields.InvoiceProNot_count__c.label; + this.RrturnProLabel = data.fields.RrturnPro_count__c.label; + this.InvoicedLabel = data.fields.Invoiced_Procount__c.label; + console.log("this.InvoiceProNotLabel = " + this.InvoiceProNotLabel); + console.log("this.RrturnProLabel = " + this.RrturnProLabel); + console.log("this.InvoicedLabel = " + this.InvoicedLabel); } } - // get secondaryDistributorOptions() { - // return this.secondaryDistributorOptions; - // } - - // get outOutPatternOptionList() { - // return this.outOutPatternOptionList; - // } - - // // get category3Options() { - // // return this.category3Options; - // // } - // get category4Options() { - // return this.category4Options; - // } - // get category5Options() { - // return this.category5Options; - // } - //鑾峰彇閾炬帴鍙傛暟 getQueryString(name) { - console.log('getQueryString name ' + name) + console.log("getQueryString name " + name); let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); let r = window.location.search.substr(1).match(reg); if (r != null) { return decodeURIComponent(r[2]); - }; + } return null; - } - connectedCallback(){ - this.ESetid = this.getQueryString('ESetid'); - this.ESetid = this.ESetid == null ? '' : this.ESetid; + } + connectedCallback() { + console.log("connectedCallback LexSummonsCreat"); + this.ESetid = this.getQueryString("ESetid"); + this.ESetid = this.ESetid == null ? "" : this.ESetid; + //statusEdit + this.statusEdit = this.getQueryString("KeyWords"); + this.statusEdit = this.statusEdit == null ? "" : this.statusEdit; + console.log("this.ESetid = " + this.ESetid); + console.log("this.statusEdit = " + this.statusEdit); + if (this.ESetid == "") { + this.isShowInformation = false; + } + console.log("init LexSummonsCreat"); init({ - ESetidJs : this.ESetid + ESetidJs: this.ESetid, + statusEdit: this.statusEdit }).then((r) => { r = JSON.parse(JSON.stringify(r)); - console.log('r = ' + JSON.stringify(r)); - - if (r.status == 'Success') { + console.log("r = " + JSON.stringify(r)); + + if (r.status == "Success") { + this.OECId = r.entity.HospitalInfo == null ? '' : r.entity.HospitalInfo; + console.log("this.OECId = " + this.OECId); this.ConsumableOut_report = r.entity.ConsumableOut_report; - console.log('this.ConsumableOut_report = ' + this.ConsumableOut_report) + console.log("this.ConsumableOut_report = " + this.ConsumableOut_report); this.accountid = r.entity.accountid; - this.consumableproductdetailsRecords = r.entity.consumableproductdetailsRecords; + this.consumableproductdetailsRecords = + r.entity.consumableproductdetailsRecords; this.accountName = r.entity.accountName; this.agencyProType = r.entity.agencyProType; this.accountName = r.entity.accountName; this.userWorkLocation = r.entity.userWorkLocation; this.EditAble = r.entity.EditAble; - console.log('this.agencyProType = ' + this.agencyProType); - console.log('this.EditAble = ' + this.EditAble); + this.consumableorderdetails2Records = + r.entity.consumableorderdetails2Records; + for (var i in this.consumableorderdetails2Records) { + this.consumableorderdetails2Records[i]["ProdName"] = + this.consumableorderdetails2Records[i].Prod.Name; + this.consumableorderdetails2Records[i][ + "orderdetails2SerialLotNo__c" + ] = + this.consumableorderdetails2Records[i].orderdetails2.SerialLotNo__c; + this.consumableorderdetails2Records[i][ + "orderdetails2TracingCode__c" + ] = + this.consumableorderdetails2Records[i].orderdetails2.TracingCode__c; + this.consumableorderdetails2Records[i][ + "orderdetails2Sterilization_limit__c" + ] = + this.consumableorderdetails2Records[ + i + ].orderdetails2.Sterilization_limit__c; + } + this.isShowOutboundProductDetails = + r.entity.consumableorderdetails2Count > 0 ? true : false; + console.log("this.agencyProType = " + this.agencyProType); + console.log("this.EditAble = " + this.EditAble); + //鏌ヨ闄勪欢 + if (!this.EditAble) this.getFiles(); //绗�3鍒嗙被 - for(var key in r.entity.categoryOptionMap){ + for (var key in r.entity.categoryOptionMap) { let object = {}; - object['label'] = r.entity.categoryOptionMap[key]; - object['value'] = key; + object["label"] = r.entity.categoryOptionMap[key]; + object["value"] = key; this.category3Options.push(object); } - console.log('this.category3Options = ' + this.category3Options) + console.log("this.category3Options = " + JSON.stringify(this.category3Options)); //绗�4鍒嗙被 - for(var key in r.entity.category4OptionMap){ + for (var key in r.entity.category4OptionMap) { let object = {}; - object['label'] = r.entity.category4OptionMap[key]; - object['value'] = key; + object["label"] = r.entity.category4OptionMap[key]; + object["value"] = key; this.category4Options.push(object); } - console.log('this.category4Options = ' + this.category4Options) + console.log("this.category4Options = " + this.category4Options); //绗�5鍒嗙被 - for(var key in r.entity.category5OptionMap){ + for (var key in r.entity.category5OptionMap) { let object = {}; - object['label'] = r.entity.category5OptionMap[key]; - object['value'] = key; + object["label"] = r.entity.category5OptionMap[key]; + object["value"] = key; this.category5Options.push(object); } - console.log('this.category5Options = ' + this.category5Options) + console.log("this.category5Options = " + this.category5Options); this.data = r.entity.pageRecords; - for(var i in this.data){ + console.log("this.data start = " + JSON.stringify(this.data)); + for (var i in this.data) { let unitOptions = []; - for(var key in this.data[i].boxorpieceMap){ + for (var key in this.data[i].boxorpieceMap) { let unitOption = {}; - unitOption['label'] = this.data[i].boxorpieceMap[key]; - unitOption['value'] = key; + unitOption["label"] = this.data[i].boxorpieceMap[key]; + unitOption["value"] = key; unitOptions.push(unitOption); } - this.data[i]['unitOptions'] = unitOptions; - this.data[i]['unitValue'] = unitOptions[0].value; - if(this.EditAble){ - this.data[i].orderdetails1['Box_Piece__c'] = unitOptions[0].value; - this.data[i].orderdetails1['Shipment_Count__c'] = 0; - this.data[i].orderdetails1['Delivery_List_RMB__c'] = 0.00; - }else{ - this.data[i]['InvoiceProNot_count__c'] = this.data[i].orderdetails1.InvoiceProNot_count__c; - this.data[i]['RrturnPro_count__c'] = this.data[i].orderdetails1.RrturnPro_count__c; - this.data[i]['Invoiced_Procount__c'] = this.data[i].orderdetails1.Invoiced_Procount__c; + this.data[i]["unitOptions"] = unitOptions; + this.data[i]["unitValue"] = this.data[i]["unitValue"] == null ? unitOptions[0].value : this.data[i]["unitValue"]; + if (this.EditAble) { + this.data[i].orderdetails1["Box_Piece__c"] = this.data[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : this.data[i].orderdetails1["Box_Piece__c"]; + this.data[i].orderdetails1["Shipment_Count__c"] = this.data[i].orderdetails1["Shipment_Count__c"] == null ? 0 : this.data[i].orderdetails1["Shipment_Count__c"]; + this.data[i].orderdetails1["Delivery_List_RMB__c"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : this.data[i].orderdetails1["Delivery_List_RMB__c"]; + } else { + this.data[i]["InvoiceProNot_count__c"] = + this.data[i].orderdetails1.InvoiceProNot_count__c; + this.data[i]["RrturnPro_count__c"] = + this.data[i].orderdetails1.RrturnPro_count__c; + this.data[i]["Invoiced_Procount__c"] = + this.data[i].orderdetails1.Invoiced_Procount__c; } - this.data[i]['shipmentNumber'] = 0; - this.data[i]['shippingUnitPrice'] = 0.00; + // this.data[i]["shipmentNumber"] = 0; + // this.data[i]["shippingUnitPrice"] = 0.0; + this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"]; + this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"]; - this.data[i]['recordId'] = this.data[i].Prod.Id; - this.data[i]['Id'] = this.data[i].Prod.Id; - this.data[i]['Name__c'] = this.data[i].Prod.Name__c; - this.data[i]['SFDA_Status__c'] = this.data[i].Prod.SFDA_Status__c; - this.data[i]['Category3__c'] = this.data[i].Prod.Category3__c; - this.data[i]['Category4__c'] = this.data[i].Prod.Category4__c; - this.data[i]['Category5__c'] = this.data[i].Prod.Category5__c; - this.data[i]['Box_Piece__c'] = this.data[i].orderdetails1.Box_Piece__c; - this.data[i]['shipmentAmount'] = this.data[i].orderdetails1.Shipment_amount__c; - this.data[i]['Shipment_amount__c'] = this.data[i].orderdetails1.Shipment_amount__c; - this.data[i]['Shipment_Count__c'] = this.data[i].orderdetails1.Shipment_Count__c; - + this.data[i]["recordId"] = this.data[i].Prod.Id; + this.data[i]["Id"] = this.data[i].Prod.Id; + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; + this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c; + this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c; + this.data[i]["Box_Piece__c"] = this.data[i].orderdetails1.Box_Piece__c; + this.data[i]["shipmentAmount"] = this.data[i].orderdetails1.Shipment_amount__c; + this.data[i]["Shipment_amount__c"] = this.data[i].orderdetails1.Shipment_amount__c; + this.data[i]["Shipment_Count__c"] = this.data[i].orderdetails1.Shipment_Count__c; + + if (this.data[i]['check']) { + this.selectedRows.push(this.data[i].Id); + } + } - console.log('this.data = ' + JSON.stringify(this.data)); + console.log("this.data = " + JSON.stringify(this.data)); //show - if(r.entity.EditDelCommitBtnDisabled || r.entity.EditAble){ + if (r.entity.EditDelCommitBtnDisabled || r.entity.EditAble) { this.isSaveShow = true; - }else{ + } else { this.isEditShow = true; this.isDeliveryShow = true; this.isOpenToInvoiceShow = true; @@ -481,171 +691,256 @@ } this.Existarrive = r.entity.Existarrive; - - console.log('this.EditAble = ' + this.EditAble); + + console.log("this.EditAble = " + this.EditAble); this.hasHosPro = r.entity.hasHosPro; //disable - - if(Object.values(r.entity.coc).length > 0){ + + if (Object.values(r.entity.coc).length > 0) { this.cocLwc = r.entity.coc; - console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc)); + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); var coc = r.entity.coc; this.cocId = coc.Id; + console.log('cocId = ' + this.cocId); coc.SummonsStatus = coc.SummonsStatus_c__c; - if(coc.SummonsStatus_c__c == '宸插畬鎴�'){ + if (coc.SummonsStatus_c__c == "宸插畬鎴�") { this.isEditDisabled = true; } - if(coc.SummonsStatus_c__c == '鎵瑰噯' || coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' || coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' || coc.SummonsStatus_c__c == '宸插畬鎴�'){ + if ( + coc.SummonsStatus_c__c == "鎵瑰噯" || + coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" || + coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" || + coc.SummonsStatus_c__c == "宸插畬鎴�" + ) { this.isDeliveryDisabled = true; } - if(((coc.Billed_Status__c != '鍏ㄩ儴寮�绁�' && coc.SummonsStatus_c__c == '宸插畬鎴�') || coc.Onchange_order__c == true) && coc.SummonsForDirction__c != '浜掔浉璋冭揣'){ + if ( + ((coc.Billed_Status__c != "鍏ㄩ儴寮�绁�" && + coc.SummonsStatus_c__c == "宸插畬鎴�") || + coc.Onchange_order__c == true) && + coc.SummonsForDirction__c != "浜掔浉璋冭揣" + ) { this.isOpenToInvoiceDisabled = false; } - if(coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' || coc.SummonsStatus_c__c == '鎵瑰噯' || coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' || coc.SummonsStatus_c__c == '鑽夋涓�'){ + if ( + coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" || + coc.SummonsStatus_c__c == "鎵瑰噯" || + coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" || + coc.SummonsStatus_c__c == "鑽夋涓�" + ) { this.isPraseToPDFDisabled = false; } - if(coc.Billed_Status__c != '杩樻病寮�绁�' || coc.SummonsStatus_c__c == '宸插畬鎴�'){ + if ( + coc.Billed_Status__c != "杩樻病寮�绁�" || + coc.SummonsStatus_c__c == "宸插畬鎴�" + ) { this.isOpenReportDisabled = false; } - if(coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' || coc.SummonsStatus_c__c == '浠锋牸鏈畾' || coc.SummonsStatus_c__c == '鎵瑰噯' || coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' || coc.SummonsStatus_c__c == '宸插畬鎴�'){ + if ( + coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" || + coc.SummonsStatus_c__c == "浠锋牸鏈畾" || + coc.SummonsStatus_c__c == "鎵瑰噯" || + coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" || + coc.SummonsStatus_c__c == "宸插畬鎴�" + ) { this.isDeleteDisabled = true; } - this.isConInvoiceShow = (coc.SummonsStatus_c__c == '宸插畬鎴�' && coc.SummonsForDirction__c != '浜掔浉璋冭揣') ? true : false; - this.summonsStatusPriceNotDetermined = coc.SummonsStatus_c__c == '浠锋牸鏈畾' ? true : false; - this.isSummonsForDirctionTwoShow = coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ? true : false; + this.isConInvoiceShow = + coc.SummonsStatus_c__c == "宸插畬鎴�" && + coc.SummonsForDirction__c != "浜掔浉璋冭揣" + ? true + : false; + this.summonsStatusPriceNotDetermined = + coc.SummonsStatus_c__c == "浠锋牸鏈畾" ? true : false; + this.isSummonsForDirctionTwoShow = + coc.SummonsForDirction__c == "閿�鍞粰浜岀骇缁忛攢鍟�" ? true : false; } - this.isSearchShow = (!this.Existarrive && r.entity.coc.SummonsStatus_c__c != '浠锋牸鏈畾' && r.entity.EditAble) ? true : false; + this.isSearchShow = + !this.Existarrive && + r.entity.coc.SummonsStatus_c__c != "浠锋牸鏈畾" && + r.entity.EditAble + ? true + : false; this.hidecheckboxcolumn = !this.isSearchShow; this.arriveorder = r.entity.arriveorder; - this.is345Show = (this.arriveorder == '' && this.Existarrive == false && this.EditAble) ? true : false; + this.is345Show = + this.arriveorder == "" && this.Existarrive == false && this.EditAble + ? true + : false; //濡傛灉涓嶆樉绀�345鍒嗙被锛宑olumns閲岄潰鍒犻櫎3锛�4锛�5鍒嗙被 - if(!this.is345Show){ - for(var i=0; i<this.columns.length; i++){ - if(this.columns[i].label == '绗�3鍒嗙被'){ - this.columns.splice(i,1); + if (!this.is345Show) { + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].label == "绗�3鍒嗙被") { + this.columns.splice(i, 1); } } - for(var i=0; i<this.columns.length; i++){ - if(this.columns[i].label == '绗�4鍒嗙被'){ - this.columns.splice(i,1); + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].label == "绗�4鍒嗙被") { + this.columns.splice(i, 1); } } - for(var i=0; i<this.columns.length; i++){ - if(this.columns[i].label == '绗�5鍒嗙被'){ - this.columns.splice(i,1); + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].label == "绗�5鍒嗙被") { + this.columns.splice(i, 1); } } - for(var i=0; i<this.editColumns.length; i++){ - if(this.editColumns[i].label == '绗�3鍒嗙被'){ - this.editColumns.splice(i,1); + for (var i = 0; i < this.editColumns.length; i++) { + if (this.editColumns[i].label == "绗�3鍒嗙被") { + this.editColumns.splice(i, 1); } } - for(var i=0; i<this.editColumns.length; i++){ - if(this.editColumns[i].label == '绗�4鍒嗙被'){ - this.editColumns.splice(i,1); + for (var i = 0; i < this.editColumns.length; i++) { + if (this.editColumns[i].label == "绗�4鍒嗙被") { + this.editColumns.splice(i, 1); } } - for(var i=0; i<this.editColumns.length; i++){ - if(this.editColumns[i].label == '绗�5鍒嗙被'){ - this.editColumns.splice(i,1); + for (var i = 0; i < this.editColumns.length; i++) { + if (this.editColumns[i].label == "绗�5鍒嗙被") { + this.editColumns.splice(i, 1); } } } //濡傛灉EditAble==false锛屽垹闄� 鍑鸿揣閲戦(鍏�) 鏈夋晥鏈熷唴搴撳瓨(鐩�) 鏈夋晥鏈熷唴搴撳瓨(涓�) 3鍒� 灞曠ず 杩樻病鍙戠エ鏁伴噺 杩斿搧鏁伴噺 宸插彂绁ㄦ暟閲� - if(!this.EditAble){ + if (!this.EditAble) { let object1 = { - label: this.InvoiceProNotLabel, - fieldName: 'InvoiceProNot_count__c', - hideDefaultActions: true + label: this.InvoiceProNotLabel, + fieldName: "InvoiceProNot_count__c", + hideDefaultActions: true, }; let object2 = { - label: this.RrturnProLabel, - fieldName: 'RrturnPro_count__c', - hideDefaultActions: true + label: this.RrturnProLabel, + fieldName: "RrturnPro_count__c", + hideDefaultActions: true, }; let object3 = { - label: this.InvoicedLabel, - fieldName: 'Invoiced_Procount__c', - hideDefaultActions: true + label: this.InvoicedLabel, + fieldName: "Invoiced_Procount__c", + hideDefaultActions: true, }; this.editColumns.push(object1); this.editColumns.push(object2); this.editColumns.push(object3); + } else { + this.ForCustomerText = this.cocLwc.Order_ForCustomerText__c; + console.log('EditAble = true this.ForCustomerText = ' + this.ForCustomerText); + this.summonsForDirction = this.cocLwc.SummonsForDirction__c; + console.log('EditAble = true this.summonsForDirction = ' + this.summonsForDirction); + let value = this.summonsForDirction; + switch (value) { + case "鐩存帴閿�鍞粰鍖婚櫌": + this.isDisabledHospitalName = false; + this.isDisabledForCustomerText = false; + this.secondaryDistributor = ""; + this.ForDealerText = ""; + this.isDisabledForDealerText = true; + this.isDisabledSecondaryDistributor = true; + break; + case "鍖婚櫌璇曠敤": + this.isDisabledHospitalName = false; + this.isDisabledForCustomerText = false; + this.isDisabledForDealerText = false; + this.isDisabledSecondaryDistributor = false; + break; + case "閿�鍞粰浜岀骇缁忛攢鍟�": + this.isDisabledHospitalName = false; + this.isDisabledForCustomerText = false; + this.isDisabledForDealerText = false; + this.isDisabledSecondaryDistributor = false; + break; + case "浜掔浉璋冭揣": + this.isDisabledHospitalName = true; + this.HospitalName = ""; + this.OECId = ""; + this.isDisabledForCustomerText = true; + this.ForCustomerText = ""; + this.isDisabledForDealerText = false; + this.isDisabledSecondaryDistributor = false; + this.isMutualTransferGoods = true; + break; + default: + this.isDisabledHospitalName = false; + this.isDisabledForCustomerText = false; + this.isDisabledForDealerText = false; + this.isDisabledSecondaryDistributor = false; + } } //濡傛灉hasHosPro = true 鍖婚櫌鐗逛环 - if(this.hasHosPro){ + if (this.hasHosPro) { let object1 = { - label: '鍖婚櫌鐗逛环', - fieldName: 'InvoiceProNot_count__c', - hideDefaultActions: true + label: "鍖婚櫌鐗逛环", + fieldName: "InvoiceProNot_count__c", + hideDefaultActions: true, }; this.columns.push(object1); this.editColumns.push(object1); } //鍑哄簱鍗曚俊鎭� - this.isSummonsFlag = r.entity.SummonsFlag == 'visible' ? true : false; - console.log('r.entity.provinceOptsMap = ' + r.entity.provinceOptsMap); - for(var key in r.entity.provinceOptsMap){ + this.isSummonsFlag = r.entity.SummonsFlag == "visible" ? true : false; + console.log("r.entity.provinceOptsMap = " + r.entity.provinceOptsMap); + for (var key in r.entity.provinceOptsMap) { let object = {}; - object['label'] = r.entity.provinceOptsMap[key]; - object['value'] = key; + object["label"] = r.entity.provinceOptsMap[key]; + object["value"] = key; this.secondaryDistributorOptions.push(object); } - for(var key in r.entity.outOutPatternOptionMap){ + for (var key in r.entity.outOutPatternOptionMap) { let object = {}; - object['label'] = r.entity.outOutPatternOptionMap[key]; - object['value'] = key; + object["label"] = r.entity.outOutPatternOptionMap[key]; + object["value"] = key; this.outOutPatternOptionList.push(object); } - console.log('this.secondaryDistributorOptions = ' + JSON.stringify(this.secondaryDistributorOptions)); + console.log( + "this.secondaryDistributorOptions = " + + JSON.stringify(this.secondaryDistributorOptions) + ); this.HospitalName = r.entity.HospitalName; - this.sumPrice = r.entity.sumPrice + '鍏�'; + this.sumPrice = r.entity.sumPrice + "鍏�"; this.isShowSpinner = false; this.showTable = true; - console.log('ESetid = ' + this.ESetid) + console.log("ESetid = " + this.ESetid); } else { - console.log('r = ' + JSON.stringify(r)) - this.showToast('Error', r.msg); + console.log("r = " + JSON.stringify(r)); + this.showToast("Error", r.msg); } - }) + }); } - - ChangeDirction(event){ + ChangeDirction(event) { let value = event.target.value; this.summonsForDirction = value; - this.cocLwc['SummonsForDirction__c'] = value; - console.log('閫夋嫨浜� = ' + value); - switch(value){ - case '鐩存帴閿�鍞粰鍖婚櫌': + this.cocLwc["SummonsForDirction__c"] = value; + console.log("閫夋嫨浜� = " + value); + switch (value) { + case "鐩存帴閿�鍞粰鍖婚櫌": this.isDisabledHospitalName = false; this.isDisabledForCustomerText = false; - this.secondaryDistributor = ''; - this.ForDealerText = ''; + this.secondaryDistributor = ""; + this.ForDealerText = ""; this.isDisabledForDealerText = true; this.isDisabledSecondaryDistributor = true; break; - case '鍖婚櫌璇曠敤': + case "鍖婚櫌璇曠敤": this.isDisabledHospitalName = false; this.isDisabledForCustomerText = false; this.isDisabledForDealerText = false; this.isDisabledSecondaryDistributor = false; break; - case '閿�鍞粰浜岀骇缁忛攢鍟�': + case "閿�鍞粰浜岀骇缁忛攢鍟�": this.isDisabledHospitalName = false; this.isDisabledForCustomerText = false; this.isDisabledForDealerText = false; this.isDisabledSecondaryDistributor = false; break; - case '浜掔浉璋冭揣': + case "浜掔浉璋冭揣": this.isDisabledHospitalName = true; - this.HospitalName = ''; - this.OECId = ''; + this.HospitalName = ""; + this.OECId = ""; this.isDisabledForCustomerText = true; - this.ForCustomerText = ''; + this.ForCustomerText = ""; this.isDisabledForDealerText = false; this.isDisabledSecondaryDistributor = false; + this.isMutualTransferGoods = true; break; default: this.isDisabledHospitalName = false; @@ -658,71 +953,161 @@ dataChange(event) { let fieldName = event.target.getAttribute("data-field"); let value = event.detail.value; + console.log("fieldName = " + fieldName + " value = " + value); switch (fieldName) { - case 'summonsForDirction': + case "summonsForDirction": this.summonsForDirction = value; - break - case 'secondaryDistributor': + break; + case "secondaryDistributor": this.secondaryDistributor = value; - break - case 'HospitalName': + break; + case "HospitalName": this.HospitalName = value; - break - case 'ForDealerText': + break; + case "ForDealerText": this.ForDealerText = value; - this.cocLwc['Order_ForDealerText__c'] = value; - break - case 'ForCustomerText': - this.cocLwc['Order_ForCustomerText__c'] = value; + this.cocLwc["Order_ForDealerText__c"] = value; + break; + case "ForCustomerText": + this.cocLwc["Order_ForCustomerText__c"] = value; this.ForCustomerText = value; - break - case 'sumPrice': + break; + case "sumPrice": this.sumPrice = value; - break - case 'NoConfirmedPrice': - this.NoConfirmedPrice = !this.NoConfirmedPrice - this.cocLwc['NoConfirmedPrice__c'] = this.NoConfirmedPrice; - console.log('this.NoConfirmedPrice = ' + this.NoConfirmedPrice) - break - case 'consumableName': + break; + case "NoConfirmedPrice": + this.NoConfirmedPrice = !this.NoConfirmedPrice; + this.cocLwc["NoConfirmedPrice__c"] = this.NoConfirmedPrice; + console.log("this.NoConfirmedPrice = " + this.NoConfirmedPrice); + break; + case "consumableName": this.consumableName = value; - break - case 'Category3': + break; + case "Category3": this.Category3 = value; - break - case 'Category4': + //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫� + this.showAllCate(); + if(this.Category3 == ''){ + this.Category4 = ''; + this.Category5 = ''; + } + break; + case "Category4": this.Category4 = value; - break - case 'Category5': + //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被 + this.showCate(); + if(this.Category4 == ''){ + this.Category5 = ''; + } + break; + case "Category5": this.Category5 = value; - break - case 'searchHospitalName': + break; + case "searchHospitalName": this.searchHospitalName = value; - break + break; + case "Barcode": + this.Barcode = value; + break; } + } + + showAllCate(){ + console.log('showAllCate') + categoryAllload({ + category3Lwc : this.Category3 + }).then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + this.category4Options = []; + this.category5Options = []; + //绗�4鍒嗙被 + for (var key in r.entity.category4OptionMap) { + let object = {}; + object["label"] = r.entity.category4OptionMap[key]; + object["value"] = key; + this.category4Options.push(object); + } + console.log("this.category4Options = " + this.category4Options); + //绗�5鍒嗙被 + for (var key in r.entity.category5OptionMap) { + let object = {}; + object["label"] = r.entity.category5OptionMap[key]; + object["value"] = key; + this.category5Options.push(object); + } + }else { + console.log("r = " + JSON.stringify(r)); + this.showToast("Error", r.msg); + } + }).catch((error) => { + console.log("error" + JSON.stringify(error)); + }); + } + + showCate(){ + console.log('showAllCate') + categoryload({ + category3Lwc : this.Category3, + category4Lwc : this.Category4 + }).then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + this.category4Options = []; + this.category5Options = []; + //绗�4鍒嗙被 + for (var key in r.entity.category4OptionMap) { + let object = {}; + object["label"] = r.entity.category4OptionMap[key]; + object["value"] = key; + this.category4Options.push(object); + } + console.log("this.category4Options = " + this.category4Options); + //绗�5鍒嗙被 + for (var key in r.entity.category5OptionMap) { + let object = {}; + object["label"] = r.entity.category5OptionMap[key]; + object["value"] = key; + this.category5Options.push(object); + } + }else { + console.log("r = " + JSON.stringify(r)); + this.showToast("Error", r.msg); + } + }).catch((error) => { + console.log("error" + JSON.stringify(error)); + }); + } + + invoiceChange(event) { + this.invoiceId = event.target.value; + console.log('this.invoiceId = ' + this.invoiceId); } showToast(type, msg) { this.isShowSpinner = false; + this.showLoadingSpinner = false; const event = new ShowToastEvent({ title: type, variant: type, - message: msg + message: msg, }); this.dispatchEvent(event); } - searchProductJs(){ + searchProductJs() { this.isShowSpinner = true; //this.showTable = false; let cloneData = this.data; - for(var i in cloneData){ - cloneData[i]['Name'] = cloneData[i].Name__c; - cloneData[i]['Category3'] = cloneData[i].Category3__c; - cloneData[i]['Category4'] = cloneData[i].Category4__c; - cloneData[i]['Category5'] = cloneData[i].Category5__c; - cloneData[i]['BoxPiece'] = cloneData[i].Box_Piece__c; + for (var i in cloneData) { + cloneData[i]["Name"] = cloneData[i].Name__c; + cloneData[i]["Category3"] = cloneData[i].Category3__c; + cloneData[i]["Category4"] = cloneData[i].Category4__c; + cloneData[i]["Category5"] = cloneData[i].Category5__c; + cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c; delete cloneData[i].Name__c; delete cloneData[i].Category3__c; delete cloneData[i].Category4__c; @@ -730,380 +1115,795 @@ delete cloneData[i].Box_Piece__c; } - console.log('cloneData = ' + JSON.stringify(cloneData)); + console.log("cloneData = " + JSON.stringify(cloneData)); searchConsumableorderdetails({ - agencyProTypeLwc : this.agencyProType, - accountNameLwc : this.accountName, - userWorkLocationLwc : this.userWorkLocation, - outOutPattern : this.outOutPattern, - category1 : this.consumableName, - category3 : this.Category3, - category4 : this.Category4, - category5 : this.Category5, - editAbleLwc : this.EditAble, - pageRecordsLwcLwc : cloneData, - consumableproductdetailsRecordsLwc : this.consumableproductdetailsRecords, - arriveorderLwc : this.arriveorder + agencyProTypeLwc: this.agencyProType, + accountNameLwc: this.accountName, + userWorkLocationLwc: this.userWorkLocation, + outOutPattern: this.outOutPattern, + category1: this.consumableName, + category3: this.Category3, + category4: this.Category4, + category5: this.Category5, + editAbleLwc: this.EditAble, + pageRecordsLwcLwc: cloneData, + consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords, + arriveorderLwc: this.arriveorder, }).then((r) => { r = JSON.parse(JSON.stringify(r)); - console.log('r = ' + JSON.stringify(r)); - if (r.status == 'Success') { + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { let tempData = []; //this.data = r.entity.pageRecords; tempData = r.entity.pageRecords; - for(var i in tempData){ + for (var i in tempData) { let unitOptions = []; - for(var key in tempData[i].boxorpieceMap){ + for (var key in tempData[i].boxorpieceMap) { let unitOption = {}; - unitOption['label'] = tempData[i].boxorpieceMap[key]; - unitOption['value'] = key; + unitOption["label"] = tempData[i].boxorpieceMap[key]; + unitOption["value"] = key; unitOptions.push(unitOption); } - tempData[i]['unitOptions'] = unitOptions; - tempData[i]['unitValue'] = unitOptions[0].value; - tempData[i]['recordId'] = tempData[i].Prod.Id; - tempData[i]['Id'] = tempData[i].Prod.Id; - tempData[i]['Name__c'] = tempData[i].Prod.Name__c; - tempData[i]['SFDA_Status__c'] = tempData[i].Prod.SFDA_Status__c; - tempData[i]['Category3__c'] = tempData[i].Prod.Category3__c; - tempData[i]['Category4__c'] = tempData[i].Prod.Category4__c; - tempData[i]['Category5__c'] = tempData[i].Prod.Category5__c; - tempData[i]['Box_Piece__c'] = tempData[i].orderdetails1.Box_Piece__c; - tempData[i]['shipmentNumber'] = tempData[i].orderdetails1.Shipment_Count__c; - tempData[i]['shippingUnitPrice'] = tempData[i].orderdetails1.Delivery_List_RMB__c; - console.log('shippingUnitPrice = ' + tempData[i]['shippingUnitPrice']); - if(tempData[i]['shippingUnitPrice'] && tempData[i]['shipmentNumber']) - tempData[i]['shipmentAmount'] = this.amend(tempData[i]['shipmentNumber'],tempData[i]['shippingUnitPrice'],'*') + tempData[i]["unitOptions"] = unitOptions; + tempData[i]["unitValue"] = unitOptions[0].value; + tempData[i]["recordId"] = tempData[i].Prod.Id; + tempData[i]["Id"] = tempData[i].Prod.Id; + tempData[i]["Name__c"] = tempData[i].Prod.Name__c; + tempData[i]["SFDA_Status__c"] = tempData[i].Prod.SFDA_Status__c; + tempData[i]["Category3__c"] = tempData[i].Prod.Category3__c; + tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c; + tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c; + tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c; + tempData[i]["shipmentNumber"] = tempData[i].orderdetails1.Shipment_Count__c; + tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1.Delivery_List_RMB__c; + console.log( + "shippingUnitPrice = " + tempData[i]["shippingUnitPrice"] + ); + if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"]) + tempData[i]["shipmentAmount"] = this.amend( + tempData[i]["shipmentNumber"], + tempData[i]["shippingUnitPrice"], + "*" + ); } this.data = tempData; - console.log('this.data = ' + JSON.stringify(this.data)); + console.log("this.data = " + JSON.stringify(this.data)); //this.showTable = true; this.isShowSpinner = false; + }else { + console.log("r = " + JSON.stringify(r)); + this.showToast("Error", r.msg); } - }) + }); } - searchHospitalNameModal(){ - console.log('searchHospitalNameModal') + searchHospitalNameModal() { + console.log("searchHospitalNameModal"); hospitalInit({ - ctype : this.agencyProType + ctype: this.agencyProType, }).then((r) => { r = JSON.parse(JSON.stringify(r)); - if (r.status == 'Success') { + if (r.status == "Success") { this.hospitalList = r.entity.at; - for(var i in this.hospitalList){ - this.hospitalList[i]['stateMasterName'] = this.hospitalList[i].State_Master__r.Name; + for (var i in this.hospitalList) { + this.hospitalList[i]["stateMasterName"] = + this.hospitalList[i].State_Master__r.Name; } - console.log('hospitalInit r = ' + JSON.stringify(this.hospitalList)); + console.log("hospitalInit r = " + JSON.stringify(this.hospitalList)); this.isModalOpen = true; } }); - } - searchHospital(){ - console.log('this.searchHospitalName = ' + this.searchHospitalName); + searchHospital() { + console.log("this.searchHospitalName = " + this.searchHospitalName); serContact({ - searchName : this.searchHospitalName, - ctype : this.agencyProType + searchName: this.searchHospitalName, + ctype: this.agencyProType, }).then((r) => { r = JSON.parse(JSON.stringify(r)); - if (r.status == 'Success') { + if (r.status == "Success") { this.hospitalList = r.entity.at; - for(var i in this.hospitalList){ - this.hospitalList[i]['stateMasterName'] = this.hospitalList[i].State_Master__r.Name; + for (var i in this.hospitalList) { + this.hospitalList[i]["stateMasterName"] = + this.hospitalList[i].State_Master__r.Name; } - console.log('hospitalInit r = ' + JSON.stringify(this.hospitalList)); + console.log("hospitalInit r = " + JSON.stringify(this.hospitalList)); } }); } searchHandleRowAction(event) { - console.log('searchHandleRowAction') + console.log("searchHandleRowAction"); let row = event.detail.row; this.OECId = row.Id; this.HospitalName = row.Name; - console.log('this.OECId = ' + this.OECId + ' this.HospitalName = ' + this.HospitalName); + console.log( + "this.OECId = " + this.OECId + " this.HospitalName = " + this.HospitalName + ); this.isModalOpen = false; - console.log('this.isModalOpen = ' + this.isModalOpen); + console.log("this.isModalOpen = " + this.isModalOpen); } - clearAgencyI(event){ + clearAgencyI(event) { this.HospitalName = event.target.value; - if(this.HospitalName == '' || this.HospitalName == null){ - this.OECId = ''; + if (this.HospitalName == "" || this.HospitalName == null) { + this.OECId = ""; } - console.log('this.HospitalName = ' + this.HospitalName); - console.log('this.OECId = ' + this.OECId); - if (this.OECId != null && this.OECId != '') { + console.log("this.HospitalName = " + this.HospitalName); + console.log("this.OECId = " + this.OECId); + if (this.OECId != null && this.OECId != "") { this.checkOutPattern(); } } - checkOutPattern(){ + checkOutPattern() { //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊� let ishos = 0; - for(var i in this.data){ - if(this.data[i].check == true && this.data[i].hospitalSpecialOffer == true){ - ishos = ishos +1; + for (var i in this.data) { + if ( + this.data[i].check == true && + this.data[i].hospitalSpecialOffer == true + ) { + ishos = ishos + 1; } } if (ishos > 0) { - this.cocLwc['OutPattern__c'] = true; - }else{ - this.cocLwc['OutPattern__c'] = false; + this.cocLwc["OutPattern__c"] = true; + } else { + this.cocLwc["OutPattern__c"] = false; } } - closeModal(){ + closeModal() { this.isModalOpen = false; } - handleUnitChange(event){ - console.log('handleUnitChange') + handleUnitChange(event) { + console.log("handleUnitChange"); const unitDetail = event.detail; - console.log('unitDetail = ' + JSON.stringify(unitDetail)) - for(var i in this.data){ - if(this.data[i].recordId == unitDetail.data.recordId){ + console.log("unitDetail = " + JSON.stringify(unitDetail)); + for (var i in this.data) { + if (this.data[i].recordId == unitDetail.data.recordId) { this.data[i].unitValue = unitDetail.data.unitValue; - this.data[i].orderdetails1['Box_Piece__c'] = unitDetail.data.unitValue; + this.data[i].orderdetails1["Box_Piece__c"] = unitDetail.data.unitValue; } } - console.log('this.data = ' + JSON.stringify(this.data)) + console.log("this.data = " + JSON.stringify(this.data)); } - handleShipmentNumber(event){ - console.log('handleShipmentNumber') + handleShipmentNumber(event) { + console.log("handleShipmentNumber"); const numberDetail = event.detail; - console.log('numberDetail = ' + JSON.stringify(numberDetail)) + console.log("numberDetail = " + JSON.stringify(numberDetail)); let index = 0; - for(var i in this.data){ - if(this.data[i].recordId == numberDetail.data.recordId){ + for (var i in this.data) { + if (this.data[i].recordId == numberDetail.data.recordId) { index = i; this.data[i].shipmentNumber = Number(numberDetail.data.shipmentnumber); - this.data[i].orderdetails1['Shipment_Count__c'] = Number(numberDetail.data.shipmentnumber); - console.log('this.data[i].shipmentNumber = ' + this.data[i].shipmentNumber) + this.data[i].orderdetails1["Shipment_Count__c"] = Number( + numberDetail.data.shipmentnumber + ); + console.log( + "this.data[i].shipmentNumber = " + this.data[i].shipmentNumber + ); } } - this.ComputePrice(index,this.data[index].shipmentNumber,this.data[index].shippingUnitPrice); + this.ComputePrice( + index, + this.data[index].shipmentNumber, + this.data[index].shippingUnitPrice + ); } - handleShipmentUnitPrice(event){ - console.log('handleShipmentUnitPrice') + handleShipmentUnitPrice(event) { + console.log("handleShipmentUnitPrice"); const priceDetail = event.detail; let index = 0; - for(var i in this.data){ - if(this.data[i].recordId == priceDetail.data.recordId){ + for (var i in this.data) { + if (this.data[i].recordId == priceDetail.data.recordId) { index = i; - this.data[i].shippingUnitPrice = Number(priceDetail.data.shipmentunitprice); - this.data[i].orderdetails1['Delivery_List_RMB__c'] = Number(priceDetail.data.shipmentunitprice); - console.log('this.data[i].shippingUnitPrice = ' + this.data[i].shippingUnitPrice) + this.data[i].shippingUnitPrice = Number( + priceDetail.data.shipmentunitprice + ); + this.data[i].orderdetails1["Delivery_List_RMB__c"] = Number( + priceDetail.data.shipmentunitprice + ); + console.log( + "this.data[i].shippingUnitPrice = " + this.data[i].shippingUnitPrice + ); } } - this.ComputePrice(index,this.data[index].shipmentNumber,this.data[index].shippingUnitPrice); + this.ComputePrice( + index, + this.data[index].shipmentNumber, + this.data[index].shippingUnitPrice + ); } - ComputePrice(index,number,price){ - console.log('index = ' + index); - console.log('number = ' + number); - console.log('price = ' + price); - let shipmentAmount = this.amend(number,price,'*'); - console.log('shipmentAmount = ' + shipmentAmount); - let sumPrice = 0.00; + ComputePrice(index, number, price) { + console.log("index = " + index); + console.log("number = " + number); + console.log("price = " + price); + let shipmentAmount = this.amend(number, price, "*"); + console.log("shipmentAmount = " + shipmentAmount); + let sumPrice = 0.0; this.data[index].shipmentAmount = shipmentAmount; - for(var i in this.data){ - if(this.data[i].shipmentAmount) - sumPrice += this.data[i].shipmentAmount; + for (var i in this.data) { + if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount; } - this.sumPrice = sumPrice + '鍏�'; + this.sumPrice = sumPrice + "鍏�"; //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌� this.selectedRows = []; - for(var i in this.data){ - if(this.data[i].check){ + for (var i in this.data) { + if (this.data[i].check) { this.selectedRows.push(this.data[i].Id); } } this.data = [...this.data]; - console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows)) - console.log('this.data = ' + JSON.stringify(this.data)) + console.log("this.selectedRows = " + JSON.stringify(this.selectedRows)); + console.log("this.data = " + JSON.stringify(this.data)); } //num1 num2浼犲叆涓や釜鍊� symbol +-*/绗﹀彿 - amend(num1,num2,symbol){ - var str1=num1.toString(),str2=num2.toString(),result,str1Length,str2Length + amend(num1, num2, symbol) { + var str1 = num1.toString(), + str2 = num2.toString(), + result, + str1Length, + str2Length; //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉� - try {str1Length= str1.split('.')[1].length} catch (error) {str1Length=0} - try {str2Length= str2.split('.')[1].length} catch (error) {str2Length=0} - var step=Math.pow(10,Math.max(str1Length,str2Length)) - // + try { + str1Length = str1.split(".")[1].length; + } catch (error) { + str1Length = 0; + } + try { + str2Length = str2.split(".")[1].length; + } catch (error) { + str2Length = 0; + } + var step = Math.pow(10, Math.max(str1Length, str2Length)); + // console.log(step); switch (symbol) { case "+": - result= (num1*step+num2*step)/step + result = (num1 * step + num2 * step) / step; break; case "-": - result= (num1*step-num2*step)/step + result = (num1 * step - num2 * step) / step; break; case "*": - result= ((num1*step)*(num2*step)) / step/step + result = (num1 * step * (num2 * step)) / step / step; break; case "/": - result= (num1*step)/(num2*step) + result = (num1 * step) / (num2 * step); break; default: break; } - return result + return result; } - getSelectedRows(event) { const selectedRows = event.detail.selectedRows; - console.log('this.selectedRows = ' + this.selectedRows); - for(var i in this.data){ - this.data[i]['check'] = false; + console.log("this.selectedRows = " + this.selectedRows); + for (var i in this.data) { + this.data[i]["check"] = false; } - for(var i in this.data){ - for(var j in selectedRows){ - if(this.data[i].Id == selectedRows[j].Id){ - this.data[i]['check'] = true; + for (var i in this.data) { + for (var j in selectedRows) { + if (this.data[i].Id == selectedRows[j].Id) { + this.data[i]["check"] = true; } } } } - - saveConfirmJs(){ + + saveConfirmJs() { let msg = "鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒"; - if(this.SummonsStatus == '浠锋牸鏈畾'){ - if(confirm(msg)==true){ - this.saveConfirm() + if (this.SummonsStatus == "浠锋牸鏈畾") { + if (confirm(msg) == true) { + this.saveConfirm(); } - }else{ - this.saveConfirm() + } else { + this.saveConfirm(); } } - saveConfirm(){ + saveConfirm() { this.isShowSpinner = true; let cloneData = this.data; - for(var i in cloneData){ - cloneData[i]['Name'] = cloneData[i].Name__c; - cloneData[i]['Category3'] = cloneData[i].Category3__c; - cloneData[i]['Category4'] = cloneData[i].Category4__c; - cloneData[i]['Category5'] = cloneData[i].Category5__c; - cloneData[i]['BoxPiece'] = cloneData[i].Box_Piece__c; + for (var i in cloneData) { + cloneData[i]["Name"] = cloneData[i].Name__c; + cloneData[i]["Category3"] = cloneData[i].Category3__c; + cloneData[i]["Category4"] = cloneData[i].Category4__c; + cloneData[i]["Category5"] = cloneData[i].Category5__c; + cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c; delete cloneData[i].Name__c; delete cloneData[i].Category3__c; delete cloneData[i].Category4__c; delete cloneData[i].Category5__c; delete cloneData[i].Box_Piece__c; } - console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc)) - console.log('this.OECId = ' + this.OECId) - console.log('this.HospitalName = ' + this.HospitalName) - console.log('this.secondaryDistributor = ' + this.secondaryDistributor) - console.log('this.pageRecordsLwc = ' + JSON.stringify(cloneData)) - console.log('this.accountid = ' + this.accountid) - console.log('this.ESetid = ' + this.ESetid) - console.log('this.consumableproductdetailsRecords = ' + JSON.stringify(this.consumableproductdetailsRecords)) + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); + console.log("this.OECId = " + this.OECId); + console.log("this.HospitalName = " + this.HospitalName); + console.log("this.secondaryDistributor = " + this.secondaryDistributor); + console.log("this.pageRecordsLwc = " + JSON.stringify(cloneData)); + console.log("this.accountid = " + this.accountid); + console.log("this.ESetid = " + this.ESetid); + console.log( + "this.consumableproductdetailsRecords = " + + JSON.stringify(this.consumableproductdetailsRecords) + ); save({ - cocLwc : this.cocLwc, - hospitalInfoLwc : this.OECId, - hospitalNameLwc : this.HospitalName, - secondaryDistributor : this.secondaryDistributor, - pageRecordsLwc : cloneData, - accountid : this.accountid, - ESetId : this.ESetid, - consumableproductdetailsRecordsLwc : this.consumableproductdetailsRecords - }).then((r) => { - r = JSON.parse(JSON.stringify(r)); - console.log('r = ' + JSON.stringify(r)); - - if (r.status == 'Success') { - let url = '/lexsummonscreat?ESetid=' + r.entity.ESetId; - this[NavigationMixin.Navigate]({ - type: 'standard__webPage', - attributes: { - url: url - } - }); - }else{ - console.log('r.msg = ' + r.msg); - this.showToast('Error', r.msg); - } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)) - }); + cocLwc: this.cocLwc, + hospitalInfoLwc: this.OECId, + hospitalNameLwc: this.HospitalName, + secondaryDistributor: this.secondaryDistributor, + pageRecordsLwc: cloneData, + accountid: this.accountid, + ESetId: this.ESetid, + consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + + if (r.status == "Success") { + let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId; + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: url, + }, + }); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); } //鎵撳嵃鎸囩ず鍗� - PraseToPDFJs(){ - console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc)) - console.log('this.ESetId = ' + this.ESetid) + PraseToPDFJs() { + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); + console.log("this.ESetId = " + this.ESetid); PraseToPDF({ - cocLwc : this.cocLwc, - ESetId : this.ESetid + cocLwc: this.cocLwc, + ESetId: this.ESetid, }).then((r) => { r = JSON.parse(JSON.stringify(r)); - console.log('r = ' + JSON.stringify(r)); - if (r.status == 'Success') { - window.open('/customer/summonsPDF?ESetid=' + r.entity.ESetId); - }else{ - console.log('r.msg = ' + r.msg); - this.showToast('Error', r.msg); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + window.open("/customer/summonsPDF?ESetid=" + r.entity.ESetId); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); } }); } - //鏄剧ず鏄庣粏 - openReportJs(){ + //鏄剧ず鏄庣粏 + openReportJs() { + console.log("openReportJs"); var reportId = this.ESetid; - reportId = reportId.substring(0,15); - window.open("/customer/" +this.ConsumableOut_report+ "?pv1="+ reportId); + reportId = reportId.substring(0, 15); + let url = "/report/00O100000058VzB?fv1=" + reportId; + console.log("url = " + url); + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: url, + }, + }); } - setVisitorPlace(){ - console.log('setVisitorPlace') - if(this.summonsForDirction == '浜掔浉璋冭揣'){ - - } - } - - vpClear2Delay(event){ - console.log('vpClear2Delay') - if(this.summonsForDirction != '浜掔浉璋冭揣'){ - this.cocLwc['Order_ForDealerText__c'] = event.target.value; - }else{ - console.log('Order_ForDealerTextID__c = ' + this.cocLwc['Order_ForDealerTextID__c']) - this.cocLwc['Order_ForDealerText__c'] = (this.cocLwc['Order_ForDealerTextID__c'] == '' || this.cocLwc['Order_ForDealerTextID__c'] == null || this.cocLwc['Order_ForDealerTextID__c'] == undefined) ? '' : this.cocLwc['Order_ForDealerText__c']; - console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc)); - this.ForDealerText = this.cocLwc['Order_ForDealerText__c']; - event.target.value = this.cocLwc['Order_ForDealerText__c']; - console.log('this.ForDealerText = ' + this.ForDealerText); + vpClear2Delay(event) { + console.log("vpClear2Delay"); + if (this.summonsForDirction != "浜掔浉璋冭揣") { + this.cocLwc["Order_ForDealerText__c"] = event.target.value; + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); + } else { + //console.log('Order_ForDealerTextID__c = ' + this.cocLwc['Order_ForDealerTextID__c']) + this.cocLwc["Order_ForDealerText__c"] = + this.cocLwc["Order_ForDealerTextID__c"] == "" || + this.cocLwc["Order_ForDealerTextID__c"] == null || + this.cocLwc["Order_ForDealerTextID__c"] == undefined + ? "" + : this.cocLwc["Order_ForDealerText__c"]; + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); + // console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc)); + // this.ForDealerText = this.cocLwc['Order_ForDealerText__c']; + // event.target.value = this.cocLwc['Order_ForDealerText__c']; + // console.log('this.ForDealerText = ' + this.ForDealerText); } } handleSearch(event) { - debugger const lookupElement = event.target; - console.log('event.detail = ' + JSON.stringify(event.detail)) + console.log("event.detail = " + JSON.stringify(event.detail)); apexSearch({ - searchTerm : event.detail.searchTerm, - selectedIds : event.detail.selectedIds + searchTerm: event.detail.searchTerm, }) - .then(results => { + .then((results) => { lookupElement.setSearchResults(results); }) - .catch(error => { - // TODO: handle error - console.log('error'+JSON.stringify(error)); + .catch((error) => { + console.log("error" + JSON.stringify(error)); }); } handleSelectionChange(event) { - // Get the selected ids from the event (same interface as lightning-input-field) - const selectedIds = event.detail; - // Or, get the selection objects with ids, labels, icons... const selection = event.target.getSelection(); - // TODO: do something with the lookup selection + console.log("selection = " + JSON.stringify(selection)); + this.cocLwc["Order_ForDealerTextID__c"] = selection[0].id; + this.cocLwc["Order_ForDealerText__c"] = selection[0].title; + console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); + } + + handleFilesChange(event) { + console.log("handleFilesChange"); + if (event.target.files.length > 0) { + this.filesUploaded = event.target.files; + this.fileName = event.target.files[0].name; + } + } + + handleSave() { + console.log("saveFile"); + if (this.filesUploaded.length > 0) { + this.file = this.filesUploaded[0]; + if (this.file.size > this.MAX_FILE_SIZE) { + this.showToast("Error", "鏂囦欢杩囧ぇ"); + return; + } + this.showLoadingSpinner = true; + this.fileReader = new FileReader(); + + this.fileReader.onloadend = () => { + this.fileContents = this.fileReader.result; + let base64 = "base64,"; + this.content = this.fileContents.indexOf(base64) + base64.length; + this.fileContents = this.fileContents.substring(this.content); + this.saveToFile(); + }; + this.fileReader.readAsDataURL(this.file); + } else { + this.fileName = "閫夋嫨涓�涓枃浠朵笂浼�"; + } + } + + saveToFile() { + console.log("saveToFile"); + console.log("base64Data = " + encodeURIComponent(this.fileContents)); + saveFile({ + recordId: this.ESetid, + fileName: this.fileName, + base64Data: encodeURIComponent(this.fileContents), + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + this.showLoadingSpinner = false; + this.showToast("Success", "涓婁紶鎴愬姛"); + this.getFiles(); + }) + .catch((error) => { + console.log("error = " + error.message); + this.showToast("Error", "涓婁紶澶辫触"); + }); + } + + getFiles() { + console.log("getFiles"); + this.showLoadingSpinner = true; + getFiles({ + recordId: this.ESetid, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + this.fileData = r.entity.cvList; + for (var i in this.fileData) { + this.fileData[i]["CreatedByName"] = this.fileData[i].CreatedBy.Name; + this.fileData[i]["url"] = "/" + this.fileData[i].Id; + } + console.log("this.fileData = " + this.fileData); + this.showLoadingSpinner = false; + }) + .catch((error) => { + console.log("error = " + error.message); + this.showToast("Error", "鑾峰彇闄勪欢澶辫触"); + }); + } + + GoodsDeliveryJs() { + this.isShowSpinner = true; + let cloneData = this.data; + for (var i in cloneData) { + cloneData[i]["Name"] = cloneData[i].Name__c; + cloneData[i]["Category3"] = cloneData[i].Category3__c; + cloneData[i]["Category4"] = cloneData[i].Category4__c; + cloneData[i]["Category5"] = cloneData[i].Category5__c; + cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c; + delete cloneData[i].Name__c; + delete cloneData[i].Category3__c; + delete cloneData[i].Category4__c; + delete cloneData[i].Category5__c; + delete cloneData[i].Box_Piece__c; + } + console.log("cloneData = " + JSON.stringify(cloneData)); + GoodsDelivery({ + cocLwc: this.cocLwc, + ESetId: this.ESetid, + pageRecordsLwcLwc: cloneData, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + console.log( + "Summons_Order_type__c = " + this.cocLwc["Summons_Order_type__c"] + ); + this.isSales = + this.cocLwc["Summons_Order_type__c"] == "閿�鍞�" ? true : false; + this.GoodsDeliveryInit(); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + this.isShippingSales = true; + }) + .catch((error) => { + console.log("error = " + error.message); + this.showToast("Error", "璺宠浆澶辫触"); + }); + } + + GoodsDeliveryInit() { + console.log("GoodsDeliveryInit"); + GoodsDeliveryInit({ + ESetId: this.ESetid, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + this.salesCoc = r.entity.coc; + this.salesAccountName = r.entity.accountName; + this.salesUserWorkLocation = r.entity.userWorkLocation; + this.salesAccountid = r.entity.accountid; + this.salesOrderdetails = r.entity.orderdetails; + this.salesData = r.entity.consumableorderdetailsRecords; + this.salesErrorData = r.entity.consumableorderdetailsRecordserror; + this.salesOrderpieceorboxMap = r.entity.orderpieceorboxMap; + this.salesOrderpriceMap = r.entity.orderpriceMap; + this.salesOrderagencypriceMap = r.entity.orderagencypriceMap; + this.isShowSpinner = false; + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }) + .catch((error) => { + console.log("error = " + error.message); + this.showToast("Error", "鍒濆鍖栧け璐�"); + }); + } + + SalesearchProductJs() { + console.log("this.Barcode = " + this.Barcode); + this.isShowSpinner = true; + SearchPro({ + cocLwc: this.salesCoc, + barcodeLwc: this.Barcode, + accountName: this.salesAccountName, + userWorkLocation: this.salesUserWorkLocation, + accountid: this.salesAccountid, + orderdetails: this.salesOrderdetails, + orderpieceorboxMap: this.salesOrderpieceorboxMap, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + console.log("SearchPro success"); + this.salesErrorData = r.entity.consumableorderdetailsRecordserror; + this.salesData = r.entity.consumableorderdetailsRecords; + for (var i in this.salesErrorData) { + this.salesErrorData[i]["Consumable_order_minor__c"] = + this.salesErrorData[i].orderdetails2.Consumable_order_minor__c; + this.salesErrorData[i]["orderdetails2Name"] = + this.salesErrorData[i].orderdetails2.Name; + this.salesErrorData[i]["ProdName"] = + this.salesErrorData[i].Prod.Name; + this.salesErrorData[i]["Box_Piece__c"] = + this.salesErrorData[i].orderdetails2.Box_Piece__c; + this.salesErrorData[i]["Bar_Code__c"] = + this.salesErrorData[i].orderdetails2.Bar_Code__c; + this.salesErrorData[i]["Sterilization_limit__c"] = + this.salesErrorData[i].orderdetails2.Sterilization_limit__c; + } + for (var i in this.salesData) { + this.salesData[i]["Consumable_order_minor__c"] = + this.salesData[i].orderdetails2.Consumable_order_minor__c; + this.salesData[i]["orderdetails2Name"] = + this.salesData[i].orderdetails2.Name; + this.salesData[i]["orderdetails2NameUrl"] = + "/" + this.salesData[i].orderdetails2.Id; + this.salesData[i]["Box_Piece__c"] = + this.salesData[i].orderdetails2.Box_Piece__c; + this.salesData[i]["ProdName"] = this.salesData[i].Prod.Name; + this.salesData[i]["Deliver_date__c"] = + this.salesData[i].orderdetails2.Deliver_date__c; + this.salesData[i]["Bar_Code__c"] = + this.salesData[i].orderdetails2.Bar_Code__c; + this.salesData[i]["Sterilization_limit__c"] = + this.salesData[i].orderdetails2.Sterilization_limit__c; + } + this.isShowSpinner = false; + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error.message)); + this.showToast("Error", "鍒濆鍖栧け璐�"); + }); + } + + SaveP() { + let cloneSalesData = this.salesData; + for (var i in cloneSalesData) { + delete cloneSalesData[i].Consumable_order_minor__c; + delete cloneSalesData[i].orderdetails2Name; + delete cloneSalesData[i].orderdetails2NameUrl; + delete cloneSalesData[i].Box_Piece__c; + delete cloneSalesData[i].ProdName; + delete cloneSalesData[i].Deliver_date__c; + delete cloneSalesData[i].Bar_Code__c; + delete cloneSalesData[i].Sterilization_limit__c; + cloneSalesData[i]["ErrorReason"] = ""; + } + this.isShowSpinner = true; + ProSale({ + ESetId: this.ESetid, + cocLwc: this.salesCoc, + barcodeLwc: this.Barcode, + accountName: this.salesAccountName, + userWorkLocation: this.salesUserWorkLocation, + consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData), + orderdetails: this.salesOrderdetails, + orderpriceMap: this.salesOrderpriceMap, + orderagencypriceMap: this.salesOrderagencypriceMap, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + console.log("ProdElivery success"); + this.isShowSpinner = false; + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexsaleanddelivery", + }, + }); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error.message)); + this.showToast("Error", "ProSale2澶辫触"); + }); + } + + SaveE() { + let cloneSalesData = this.salesData; + for (var i in cloneSalesData) { + delete cloneSalesData[i].Consumable_order_minor__c; + delete cloneSalesData[i].orderdetails2Name; + delete cloneSalesData[i].orderdetails2NameUrl; + delete cloneSalesData[i].Box_Piece__c; + delete cloneSalesData[i].ProdName; + delete cloneSalesData[i].Deliver_date__c; + delete cloneSalesData[i].Bar_Code__c; + delete cloneSalesData[i].Sterilization_limit__c; + cloneSalesData[i]["ErrorReason"] = ""; + } + this.isShowSpinner = true; + ProdElivery({ + ESetId: this.ESetid, + cocLwc: this.salesCoc, + barcodeLwc: this.Barcode, + accountName: this.salesAccountName, + userWorkLocation: this.salesUserWorkLocation, + consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData), + orderdetails: this.salesOrderdetails, + orderpriceMap: this.salesOrderpriceMap, + orderagencypriceMap: this.salesOrderagencypriceMap, + }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + console.log("ProdElivery success"); + this.isShowSpinner = false; + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexsaleanddelivery", + }, + }); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error.message)); + this.showToast("Error", "鍒濆鍖栧け璐�"); + }); + } + + //鍙戠エ + openToInvoiceJs() { + let url = ''; + console.log('this.invoiceId = ' + this.invoiceId); + if (this.invoiceId.length > 0 && this.invoiceId != '000000000000000') { + url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&invoiceId=" + this.invoiceId + "&KeyWords=Redirect"; + } else { + url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&KeyWords=Redirect"; + } + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: url, + }, + }); + } + + //鍒犻櫎 + DeleteConsumable() { + this.isShowSpinner = true; + DelConsumable({ + ESetId: this.ESetid, + }).then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log("r = " + JSON.stringify(r)); + if (r.status == "Success") { + let url = "/lexsaleanddelivery"; + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: url, + }, + }); + } else { + console.log("r.msg = " + r.msg); + this.showToast("Error", r.msg); + } + }).catch((error) => { + console.log("error = " + error.message); + this.showToast("Error", "璺宠浆澶辫触"); + }); + } + + //缂栬緫鍑哄簱鍗� + EditConsumable() { + let url = "/lexsummonscreat?ESetid=" + this.ESetid + "&KeyWords=Redirect"; + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: url, + }, + }); } } \ No newline at end of file -- Gitblit v1.9.1