|  |  |  | 
|---|
|  |  |  | import { LightningElement, wire, api, track } from "lwc"; save | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "注册证编码号", | 
|---|
|  |  |  | fieldName: "approbation_No", | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 130, | 
|---|
|  |  |  | initialWidth: 105, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "消耗品名称", | 
|---|
|  |  |  | fieldName: "Name__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 320, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | sortable: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "规格", | 
|---|
|  |  |  | fieldName: "packinglist", | 
|---|
|  |  |  | initialWidth: 80, | 
|---|
|  |  |  | initialWidth: 50, | 
|---|
|  |  |  | cellAttributes: { alignment: "right" }, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "CFDA状态", | 
|---|
|  |  |  | fieldName: "SFDA_Status__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "注册证编码号", | 
|---|
|  |  |  | fieldName: "approbation_No", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 130, | 
|---|
|  |  |  | initialWidth: 170, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "注册证效期", | 
|---|
|  |  |  | fieldName: "expiration_Date", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "第3分类", | 
|---|
|  |  |  | fieldName: "Category3__c", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | sortable: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "第4分类", | 
|---|
|  |  |  | fieldName: "Category4__c", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | sortable: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "第5分类", | 
|---|
|  |  |  | fieldName: "Category5__c", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | sortable: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "出货数量", | 
|---|
|  |  |  | fieldName: "Shipment_Count__c", | 
|---|
|  |  |  | initialWidth: 90, | 
|---|
|  |  |  | cellAttributes: { alignment: "right" }, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "出货单价(元)", | 
|---|
|  |  |  | fieldName: "shippingUnitPrice", | 
|---|
|  |  |  | type: "number", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | minimumFractionDigits: 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "消耗品订单", | 
|---|
|  |  |  | fieldName: "ConsumableorderminorUrl", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 210, | 
|---|
|  |  |  | type: "url", | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | label: { fieldName: "Consumable_order_minor__c" }, | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "消耗品明细2名称", | 
|---|
|  |  |  | fieldName: "orderdetails2NameUrl", | 
|---|
|  |  |  | type: "url", | 
|---|
|  |  |  | initialWidth: 150, | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | label: { fieldName: "orderdetails2Name" }, | 
|---|
|  |  |  | target: "_blank", | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 240 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "单位", | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "消耗品名称", | 
|---|
|  |  |  | fieldName: "ProdName", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | fieldName: "Bar_Code__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 400 | 
|---|
|  |  |  | initialWidth: 380 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "使用期限", | 
|---|
|  |  |  | fieldName: "Sterilization_limit__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 120 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "出货数量", | 
|---|
|  |  |  | 
|---|
|  |  |  | fieldName: "ConsumableorderminorUrl", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | type: "url", | 
|---|
|  |  |  | initialWidth: 210, | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | label: { fieldName: "Consumable_order_minor__c" }, | 
|---|
|  |  |  | target: "_blank", | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "消耗品明细2名称", | 
|---|
|  |  |  | fieldName: "orderdetails2Name", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | initialWidth: 150, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 240 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "消耗品名称", | 
|---|
|  |  |  | 
|---|
|  |  |  | fieldName: "Bar_Code__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 400 | 
|---|
|  |  |  | initialWidth: 380 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "使用期限", | 
|---|
|  |  |  | fieldName: "Sterilization_limit__c", | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | wrapText: true, | 
|---|
|  |  |  | initialWidth: 120 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | label: "错误原因", | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //InvoiceProNotLabel    RrturnProLabel  InvoicedLabel | 
|---|
|  |  |  | @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT }) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //disable | 
|---|
|  |  |  |  | 
|---|
|  |  |  | debugger | 
|---|
|  |  |  | if (Object.values(r.entity.coc).length > 0) { | 
|---|
|  |  |  | this.cocLwc = r.entity.coc; | 
|---|
|  |  |  | console.log("this.cocLwc = " + JSON.stringify(this.cocLwc)); | 
|---|
|  |  |  | var coc = r.entity.coc; | 
|---|
|  |  |  | this.accountValue = coc.Order_ForDealerText__c; | 
|---|
|  |  |  | this.ForDealerText = coc.Order_ForDealerText__c; | 
|---|
|  |  |  | this.accountValue = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c; | 
|---|
|  |  |  | this.ForDealerText = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c; | 
|---|
|  |  |  | console.log('this.accountValue = ' + this.accountValue); | 
|---|
|  |  |  | this.cocId = coc.Id; | 
|---|
|  |  |  | console.log('cocId = ' + this.cocId); | 
|---|
|  |  |  | coc.SummonsStatus = coc.SummonsStatus_c__c; | 
|---|
|  |  |  | console.log('this.cocLwc.Arrive_Order__c = ' + this.cocLwc.Arrive_Order__c) | 
|---|
|  |  |  | if(this.cocLwc.Arrive_Order__c == null){ | 
|---|
|  |  |  | this.isBarcode = true; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | this.isBarcode = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (coc.SummonsStatus_c__c == "已完成") { | 
|---|
|  |  |  | this.isEditDisabled = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | label: this.InvoiceProNotLabel, | 
|---|
|  |  |  | fieldName: "InvoiceProNot_count__c", | 
|---|
|  |  |  | type: "number", | 
|---|
|  |  |  | initialWidth: 120, | 
|---|
|  |  |  | initialWidth: 105, | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | minimumFractionDigits: 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | let object2 = { | 
|---|
|  |  |  | label: this.RrturnProLabel, | 
|---|
|  |  |  | fieldName: "RrturnPro_count__c", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | cellAttributes: { alignment: "right" }, | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let object3 = { | 
|---|
|  |  |  | label: this.InvoicedLabel, | 
|---|
|  |  |  | fieldName: "Invoiced_Procount__c", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | type: "number", | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | typeAttributes: { | 
|---|
|  |  |  | minimumFractionDigits: 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | if (this.hasHosPro) { | 
|---|
|  |  |  | let object1 = { | 
|---|
|  |  |  | label: "医院特价", | 
|---|
|  |  |  | initialWidth: 80, | 
|---|
|  |  |  | fieldName: "hospitalSpecialOffer", | 
|---|
|  |  |  | type: 'boolean', | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | this.columns.push(object1); | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "医院特价", | 
|---|
|  |  |  | fieldName: "hospitalSpecialOffer", | 
|---|
|  |  |  | type: 'boolean', | 
|---|
|  |  |  | initialWidth: 100, | 
|---|
|  |  |  | initialWidth: 80, | 
|---|
|  |  |  | hideDefaultActions: true, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | this.columns.push(object1); | 
|---|
|  |  |  | 
|---|
|  |  |  | this.salesOrderdetails = r.entity.orderdetails; | 
|---|
|  |  |  | console.log('this.salesOrderdetails = ' + JSON.stringify(this.salesOrderdetails)) | 
|---|
|  |  |  | this.salesData = r.entity.consumableorderdetailsRecords; | 
|---|
|  |  |  | console.log('this.salesData = ' + JSON.stringify(this.salesData)) | 
|---|
|  |  |  | this.salesErrorData = r.entity.consumableorderdetailsRecordserror; | 
|---|
|  |  |  | this.salesOrderpieceorboxMap = r.entity.orderpieceorboxMap; | 
|---|
|  |  |  | this.salesOrderpriceMap = r.entity.orderpriceMap; | 
|---|
|  |  |  | this.salesOrderagencypriceMap = r.entity.orderagencypriceMap; | 
|---|
|  |  |  | for (var i in this.salesData) { | 
|---|
|  |  |  | this.salesData[i]["Id"] = this.salesData[i].orderdetails2.Id; | 
|---|
|  |  |  | this.salesData[i]["Consumable_order_minor__c"] = this.salesData[i].orderdetails2.Consumable_order_minor__r != null ? this.salesData[i].orderdetails2.Consumable_order_minor__r.Name : ''; | 
|---|
|  |  |  | this.salesData[i]["ConsumableorderminorUrl"] = this.salesData[i].orderdetails2.Consumable_order_minor__c != null ? "/" + 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; | 
|---|
|  |  |  | if (this.salesData[i]["Box_Piece__c"] == '盒') { | 
|---|
|  |  |  | console.log('this.salesData[i] = ' + JSON.stringify(this.salesData[i])) | 
|---|
|  |  |  | this.salesData[i]["outboundCount"] = this.salesData[i].outboundCount; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | for (var j in this.salesOrderdetails) { | 
|---|
|  |  |  | console.log('this.salesOrderdetails[j].Consumable_product__c = ' + this.salesOrderdetails[j].Consumable_product__c); | 
|---|
|  |  |  | console.log('this.salesData[i].orderdetails2.Consumable_product__c = ' + this.salesData[i].orderdetails2.Consumable_product__c); | 
|---|
|  |  |  | if (this.salesOrderdetails[j].Consumable_product__c == this.salesData[i].orderdetails2.Consumable_product__c) { | 
|---|
|  |  |  | this.salesData[i]["outboundCount"] = this.salesOrderdetails[j].Shipment_Count__c; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (var i in this.salesErrorData) { | 
|---|
|  |  |  | this.salesErrorData[i]["Id"] = this.salesErrorData[i].orderdetails2.Id; | 
|---|
|  |  |  | this.salesErrorData[i]["Consumable_order_minor__c"] = this.salesErrorData[i].orderdetails2.Consumable_order_minor__r != null ? this.salesErrorData[i].orderdetails2.Consumable_order_minor__r.Name : ''; | 
|---|
|  |  |  | this.salesErrorData[i]["ConsumableorderminorUrl"] = this.salesErrorData[i].orderdetails2.Consumable_order_minor__c != null ? "/" + 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.isShowSpinner = false; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | console.log("r.msg = " + r.msg); | 
|---|