buli
2023-05-22 71b93327e8f3fb3bffffc7c033c1f782e7b6ab32
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -1,4 +1,4 @@
import { LightningElement, wire, api, track } from "lwc";
import { LightningElement, wire, api, track } from "lwc"; save
import init from "@salesforce/apex/LexSummonsCreatController.init";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import searchConsumableorderdetails from "@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails";
@@ -19,7 +19,11 @@
import { getObjectInfo } from "lightning/uiObjectInfoApi";
import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
import { NavigationMixin } from "lightning/navigation";
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexSummonsCreat extends NavigationMixin(LightningElement) {
    @track isShowSpinner = true;
@@ -55,33 +59,33 @@
            fieldName: "Name__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 150,
            initialWidth: 175,
            sortable: true
        },
        {
            label: "规格",
            fieldName: "packinglist",
            //initialWidth : 50,
            cellAttributes: { alignment: "right" },
            wrapText: true,
            initialWidth: 50,
            hideDefaultActions: true,
        },
        {
            label: "CFDA状态",
            fieldName: "SFDA_Status__c",
            //initialWidth : 100,
            initialWidth: 105,
            wrapText: true,
            hideDefaultActions: true,
        },
        {
            label: "注册证编码号",
            fieldName: "approbation_No",
            //initialWidth : 150,
            wrapText: true,
            initialWidth: 115,
            hideDefaultActions: true,
        },
        {
            label: "注册证效期",
            //initialWidth : 100,
            wrapText: true,
            fieldName: "expiration_Date",
            hideDefaultActions: true,
@@ -89,7 +93,6 @@
        {
            label: "第3分类",
            fieldName: "Category3__c",
            //initialWidth : 100,
            wrapText: true,
            hideDefaultActions: true,
            sortable: true,
@@ -97,7 +100,6 @@
        {
            label: "第4分类",
            fieldName: "Category4__c",
            //initialWidth : 100,
            wrapText: true,
            hideDefaultActions: true,
            sortable: true,
@@ -105,7 +107,6 @@
        {
            label: "第5分类",
            fieldName: "Category5__c",
            //initialWidth : 100,
            wrapText: true,
            hideDefaultActions: true,
            sortable: true,
@@ -113,7 +114,6 @@
        {
            label: "单位",
            type: "customUnit",
            //initialWidth : 100,
            hideDefaultActions: true,
            typeAttributes: {
                unitValue: { fieldName: "unitValue" },
@@ -124,8 +124,8 @@
        {
            label: "出货数量",
            type: "customShipment",
            //initialWidth : 150,
            hideDefaultActions: true,
            cellAttributes: { alignment: "right" },
            typeAttributes: {
                recordId: { fieldName: "recordId" },
                shipmentNumber: { fieldName: "shipmentNumber" },
@@ -134,8 +134,8 @@
        {
            label: "出货单价(元)",
            type: "customShipmentUnitPrice",
            //initialWidth : 150,
            hideDefaultActions: true,
            initialWidth: 110,
            typeAttributes: {
                recordId: { fieldName: "recordId" },
                shippingUnitPrice: { fieldName: "shippingUnitPrice" },
@@ -144,7 +144,8 @@
        {
            label: "出货金额(元)",
            type: "customShipmentAmount",
            //initialWidth : 120,
            initialWidth: 110,
            cellAttributes: { alignment: "right" },
            hideDefaultActions: true,
            typeAttributes: {
                shipmentAmount: { fieldName: "shipmentAmount" },
@@ -153,15 +154,17 @@
        {
            label: "有效期内库存(盒)",
            fieldName: "Boxnumber",
            //initialWidth : 120,
            cellAttributes: { alignment: "right" },
            wrapText: true,
            initialWidth: 120,
            hideDefaultActions: true,
        },
        {
            label: "有效期内库存(个)",
            fieldName: "Piecenumber",
            //initialWidth : 120,
            cellAttributes: { alignment: "right" },
            wrapText: true,
            initialWidth: 120,
            hideDefaultActions: true,
        },
    ];
@@ -170,33 +173,35 @@
            label: "消耗品名称",
            fieldName: "Name__c",
            hideDefaultActions: true,
            initialWidth: 250,
            initialWidth: 340,
            wrapText: true,
            sortable: true,
        },
        {
            label: "规格",
            fieldName: "packinglist",
            initialWidth: 50,
            initialWidth: 80,
            cellAttributes: { alignment: "right" },
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "CFDA状态",
            fieldName: "SFDA_Status__c",
            initialWidth: 100,
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "注册证编码号",
            fieldName: "approbation_No",
            initialWidth: 150,
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "注册证效期",
            initialWidth: 100,
            fieldName: "expiration_Date",
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "第3分类",
@@ -204,6 +209,7 @@
            initialWidth: 100,
            hideDefaultActions: true,
            sortable: true,
            wrapText: true,
        },
        {
            label: "第4分类",
@@ -211,6 +217,7 @@
            initialWidth: 100,
            hideDefaultActions: true,
            sortable: true,
            wrapText: true,
        },
        {
            label: "第5分类",
@@ -218,28 +225,32 @@
            initialWidth: 100,
            hideDefaultActions: true,
            sortable: true,
            wrapText: true,
        },
        {
            label: "单位",
            fieldName: "Box_Piece__c",
            initialWidth: 100,
            initialWidth: 50,
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "出货数量",
            fieldName: "Shipment_Count__c",
            initialWidth: 150,
            cellAttributes: { alignment: "right" },
            hideDefaultActions: true,
            initialWidth: 100,
            wrapText: true,
        },
        {
            label: "出货单价(元)",
            fieldName: "Shipment_amount__c",
            fieldName: "shippingUnitPrice",
            type: "number",
            typeAttributes: {
                minimumFractionDigits: 2,
            },
            initialWidth: 150,
            hideDefaultActions: true,
            wrapText: true,
        },
    ];
    @track editData = [];
@@ -281,6 +292,7 @@
    @track isMutualTransferGoods = false;
    @track Barcode = "";
    @track summonsForDirction = '';
    @track accountValue = '';
    @track consumableorderdetails2RecordsColumns = [
        {
@@ -310,8 +322,13 @@
    @track salesColumns = [
        {
            label: "消耗品订单",
            fieldName: "Consumable_order_minor__c",
            fieldName: "ConsumableorderminorUrl",
            hideDefaultActions: true,
            type: "url",
            typeAttributes: {
                label: { fieldName: "Consumable_order_minor__c" },
                target: "_blank",
            },
            wrapText: true,
        },
        {
@@ -331,6 +348,7 @@
            fieldName: "Box_Piece__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 50
        },
        {
            label: "消耗品名称",
@@ -349,28 +367,34 @@
            fieldName: "Bar_Code__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 500
            initialWidth: 400
        },
        {
            label: "使用期限",
            fieldName: "Sterilization_limit__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 120
        },
        {
            label: "出货数量",
            fieldName: "outboundCount",
            fieldName: 'outboundCount',
            hideDefaultActions: true,
            wrapText: true,
        },
            cellAttributes: { alignment: "right" },
        }
    ];
    @track salesData = [];
    @track salesErrorColumns = [
        {
            label: "消耗品订单",
            fieldName: "Consumable_order_minor__c",
            fieldName: "ConsumableorderminorUrl",
            hideDefaultActions: true,
            type: "url",
            typeAttributes: {
                label: { fieldName: "Consumable_order_minor__c" },
                target: "_blank",
            },
            wrapText: true,
        },
        {
@@ -378,6 +402,7 @@
            fieldName: "orderdetails2Name",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 240
        },
        {
            label: "消耗品名称",
@@ -390,17 +415,20 @@
            fieldName: "Box_Piece__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 50
        },
        {
            label: "BarCode",
            fieldName: "Bar_Code__c",
            hideDefaultActions: true,
            initialWidth: 400
        },
        {
            label: "使用期限",
            fieldName: "Sterilization_limit__c",
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 120
        },
        {
            label: "错误原因",
@@ -526,6 +554,18 @@
            fieldName: "CreatedByName",
            hideDefaultActions: true,
        },
        {
            label: '',
            type: 'tableCellIcon',
            typeAttributes: {
                iconName: 'utility:delete',
                recordId: {
                    fieldName: 'Id'
                }
            },
            initialWidth: 50,
            hideDefaultActions: true
        },
    ];
    filesUploaded = [];
    fileContents;
@@ -539,7 +579,7 @@
    defaultSortDirection = 'asc';
    sortDirection = 'asc';
    sortedBy;
    @track pageSize = 5;
    @track pageSize = 10;
    error;
    records;
    currentPageToken = 0;
@@ -549,11 +589,25 @@
    @track pageNumber = 1;
    @track paginationVisibility = false;
    @track totalPages = 1;
    pageSizeOptions = [5, 10, 25, 50, 75, 100];
    pageSizeOptions = [10, 25, 50, 100];
    @track recordStart = 0;
    @track recordEnd = 0;
    //end
    @track SearchDone = '';
    stylesLoaded = false;
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
    }
    //InvoiceProNotLabel    RrturnProLabel  InvoicedLabel
    @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT })
@@ -624,28 +678,14 @@
                this.accountName = r.entity.accountName;
                this.userWorkLocation = r.entity.userWorkLocation;
                this.EditAble = r.entity.EditAble;
                this.consumableorderdetails2Records =
                    r.entity.consumableorderdetails2Records;
                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.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;
                this.isShowOutboundProductDetails = r.entity.consumableorderdetails2Count > 0 ? true : false;
                console.log("this.agencyProType = " + this.agencyProType);
                console.log("this.EditAble = " + this.EditAble);
                //查询附件
@@ -691,15 +731,14 @@
                        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]["unitValue"] = this.data[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : this.data[i].orderdetails1["Box_Piece__c"];
                            console.log('this.data[i].orderdetails1["Box_Piece__c"] = ' + 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]["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.0;
@@ -708,8 +747,17 @@
                        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;
                        if (this.hasHosPro) {
                            if (this.data[i]["hospitalSpecialOffer"]) {
                                this.data[i]["Id"] = this.data[i].Prod.Id + 'ishos';
                            } else {
                                this.data[i]["Id"] = this.data[i].Prod.Id + 'nothos';
                            }
                        }
                        this.data[i]["recordId"] = 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;
@@ -742,9 +790,11 @@
                        this.editData[i]["Category5__c"] = this.editData[i].Prod.Category5__c;
                        this.editData[i]["Box_Piece__c"] = this.editData[i].orderdetails1.Box_Piece__c;
                        this.editData[i]["shipmentAmount"] = this.editData[i].orderdetails1.Shipment_amount__c;
                        this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
                        //this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
                        this.editData[i]["Delivery_List_RMB__c"] = this.editData[i].orderdetails1.Delivery_List_RMB__c;
                        this.editData[i]["Shipment_Count__c"] = this.editData[i].orderdetails1.Shipment_Count__c;
                    }
                    console.log('end this.editData = ' + JSON.stringify(this.editData));
                }
                console.log("this.data = " + JSON.stringify(this.data));
@@ -770,6 +820,9 @@
                    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;
                    console.log('this.accountValue = ' + this.accountValue);
                    this.cocId = coc.Id;
                    console.log('cocId = ' + this.cocId);
                    coc.SummonsStatus = coc.SummonsStatus_c__c;
@@ -800,10 +853,7 @@
                    ) {
                        this.isPraseToPDFDisabled = false;
                    }
                    if (
                        coc.Billed_Status__c != "还没开票" ||
                        coc.SummonsStatus_c__c == "已完成"
                    ) {
                    if ((coc.Billed_Status__c != "还没开票" || coc.SummonsStatus_c__c == "已完成") && this.agencyProType != 'ET') {
                        this.isOpenReportDisabled = false;
                    }
                    if (
@@ -880,6 +930,7 @@
                        label: this.InvoiceProNotLabel,
                        fieldName: "InvoiceProNot_count__c",
                        type: "number",
                        initialWidth: 100,
                        typeAttributes: {
                            minimumFractionDigits: 2,
                        },
@@ -888,11 +939,14 @@
                    let object2 = {
                        label: this.RrturnProLabel,
                        fieldName: "RrturnPro_count__c",
                        initialWidth: 100,
                        cellAttributes: { alignment: "right" },
                        hideDefaultActions: true,
                    };
                    let object3 = {
                        label: this.InvoicedLabel,
                        fieldName: "Invoiced_Procount__c",
                        initialWidth: 100,
                        type: "number",
                        typeAttributes: {
                            minimumFractionDigits: 2,
@@ -914,6 +968,7 @@
                            this.isDisabledForCustomerText = false;
                            this.secondaryDistributor = "";
                            this.ForDealerText = "";
                            this.accountValue = "";
                            this.isDisabledForDealerText = true;
                            this.isDisabledSecondaryDistributor = true;
                            break;
@@ -922,12 +977,14 @@
                            this.isDisabledForCustomerText = false;
                            this.isDisabledForDealerText = false;
                            this.isDisabledSecondaryDistributor = false;
                            this.isMutualTransferGoods = false;
                            break;
                        case "销售给二级经销商":
                            this.isDisabledHospitalName = false;
                            this.isDisabledForCustomerText = false;
                            this.isDisabledForDealerText = false;
                            this.isDisabledSecondaryDistributor = false;
                            this.isMutualTransferGoods = false;
                            break;
                        case "互相调货":
                            this.isDisabledHospitalName = true;
@@ -935,6 +992,7 @@
                            this.OECId = "";
                            this.isDisabledForCustomerText = true;
                            this.ForCustomerText = "";
                            this.cocLwc["Order_ForCustomerText__c"] = "";
                            this.isDisabledForDealerText = false;
                            this.isDisabledSecondaryDistributor = false;
                            this.isMutualTransferGoods = true;
@@ -953,6 +1011,7 @@
                        label: "医院特价",
                        fieldName: "hospitalSpecialOffer",
                        type: 'boolean',
                        initialWidth: 70,
                        hideDefaultActions: true,
                    };
                    this.columns.push(object1);
@@ -984,10 +1043,11 @@
                console.log("ESetid = " + this.ESetid);
            } else {
                console.log("r = " + JSON.stringify(r));
                this.showToast("Error", r.msg);
                this.showMyToast('初始化失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
            this.showMyToast('错误', '初始化失败', 'Error');
        });
    }
@@ -1011,12 +1071,14 @@
                this.isDisabledForCustomerText = false;
                this.isDisabledForDealerText = false;
                this.isDisabledSecondaryDistributor = false;
                this.isMutualTransferGoods = false;
                break;
            case "销售给二级经销商":
                this.isDisabledHospitalName = false;
                this.isDisabledForCustomerText = false;
                this.isDisabledForDealerText = false;
                this.isDisabledSecondaryDistributor = false;
                this.isMutualTransferGoods = false;
                break;
            case "互相调货":
                this.isDisabledHospitalName = true;
@@ -1024,6 +1086,7 @@
                this.OECId = "";
                this.isDisabledForCustomerText = true;
                this.ForCustomerText = "";
                this.cocLwc["Order_ForCustomerText__c"] = "";
                this.isDisabledForDealerText = false;
                this.isDisabledSecondaryDistributor = false;
                this.isMutualTransferGoods = true;
@@ -1033,6 +1096,7 @@
                this.isDisabledForCustomerText = false;
                this.isDisabledForDealerText = false;
                this.isDisabledSecondaryDistributor = false;
                this.isMutualTransferGoods = false;
        }
    }
@@ -1049,6 +1113,9 @@
                break;
            case "HospitalName":
                this.HospitalName = value;
                break;
            case "outOutPattern":
                this.outOutPattern = value;
                break;
            case "ForDealerText":
                this.ForDealerText = value;
@@ -1095,6 +1162,9 @@
            case "Barcode":
                this.Barcode = value;
                break;
            case "Order_ForDealerText__c":
                this.cocLwc["Order_ForDealerText__c"] = value;
                break;
        }
    }
@@ -1125,7 +1195,7 @@
                }
            } else {
                console.log("r = " + JSON.stringify(r));
                this.showToast("Error", r.msg);
                this.showMyToast('4/5分类查询失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error" + JSON.stringify(error));
@@ -1160,7 +1230,7 @@
                }
            } else {
                console.log("r = " + JSON.stringify(r));
                this.showToast("Error", r.msg);
                this.showMyToast('Error', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error" + JSON.stringify(error));
@@ -1172,16 +1242,24 @@
        console.log('this.invoiceId = ' + this.invoiceId);
    }
    showToast(type, msg) {
    showMyToast(title, message, variant) {
        this.isShowSpinner = false;
        this.showLoadingSpinner = false;
        this.isEditShowSpinner = false;
        const event = new ShowToastEvent({
            title: type,
            variant: type,
            message: msg,
        });
        this.dispatchEvent(event);
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant.toLowerCase() == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if (message != '') {
            content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
    }
    searchProductJs() {
@@ -1262,6 +1340,7 @@
                    tempData[i]["unitValue"] = tempData[i]["unitValue"] == null ? unitOptions[0].value : tempData[i]["unitValue"];
                    if (this.EditAble) {
                        tempData[i].orderdetails1["Box_Piece__c"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
                        tempData[i]["unitValue"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
                        tempData[i].orderdetails1["Shipment_Count__c"] = tempData[i].orderdetails1["Shipment_Count__c"] == null ? 0 : tempData[i].orderdetails1["Shipment_Count__c"];
                        tempData[i].orderdetails1["Delivery_List_RMB__c"] = tempData[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : tempData[i].orderdetails1["Delivery_List_RMB__c"];
                    } else {
@@ -1275,13 +1354,14 @@
                    tempData[i]["shipmentNumber"] = tempData[i].orderdetails1["Shipment_Count__c"];
                    tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1["Delivery_List_RMB__c"];
                    tempData[i]["recordId"] = tempData[i].Prod.Id;
                    console.log('tempData[i]["hospitalSpecialOffer"] = ' + tempData[i]["hospitalSpecialOffer"])
                    if (tempData[i]["hospitalSpecialOffer"]) {
                        tempData[i]["Id"] = tempData[i].Prod.Id + 'ishos';
                    } else {
                        tempData[i]["Id"] = tempData[i].Prod.Id + 'nothos';
                    }
                    tempData[i]["recordId"] = tempData[i]["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;
@@ -1311,7 +1391,7 @@
                this.isEditShowSpinner = false;
            } else {
                console.log("r = " + JSON.stringify(r));
                this.showToast("Error", r.msg);
                this.showMyToast('查询失败', r.msg, 'Error');
            }
        });
    }
@@ -1423,6 +1503,21 @@
                this.data[i].orderdetails1["Shipment_Count__c"] = Number(
                    numberDetail.data.shipmentnumber
                );
                console.log('this.data[i].orderdetails1["Shipment_Count__c"] = ' + this.data[i].orderdetails1["Shipment_Count__c"]);
                console.log('this.selectedRows.indexOf(this.data[i].Id) = ' + this.selectedRows.indexOf(this.data[i].Id));
                if (this.data[i].orderdetails1["Shipment_Count__c"] != '') {
                    if (this.selectedRows.indexOf(this.data[i].Id) == -1) {
                        this.selectedRows.push(this.data[i].Id);
                    }
                    this.data[i].check = true;
                } else {
                    if (this.selectedRows.indexOf(this.data[i].Id) != -1) {
                        this.selectedRows.splice(this.selectedRows.indexOf(this.data[i].Id), 1);
                    }
                    this.data[i].check = false;
                }
                this.selectedRows = [...this.selectedRows];
                console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows));
            }
        }
        this.ComputePrice(
@@ -1476,8 +1571,8 @@
        //     }
        // }
        this.data = [...this.data];
        this.selectedRows = [...this.selectedRows]
        console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
        // this.selectedRows = [...this.selectedRows]
        // console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
        console.log("this.data = " + JSON.stringify(this.data));
    }
@@ -1626,16 +1721,17 @@
            console.log("r = " + JSON.stringify(r));
            debugger
            if (r.status == "Success") {
                let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
                // let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
                // this[NavigationMixin.Navigate]({
                //     type: "standard__webPage",
                //     attributes: {
                //         url: url,
                //     },
                // });
                window.location.href = "/s/lexsummonscreat?ESetid=" + r.entity.ESetId;
            } else {
                console.log("r.msg = " + r.msg);
                this.showToast("Error", r.msg);
                this.showMyToast('保存失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
@@ -1656,7 +1752,7 @@
                window.open("/customer/summonsPDF?ESetid=" + r.entity.ESetId);
            } else {
                console.log("r.msg = " + r.msg);
                this.showToast("Error", r.msg);
                this.showMyToast('打印失败', r.msg, 'Error');
            }
        });
    }
@@ -1702,11 +1798,9 @@
        console.log("event.detail = " + JSON.stringify(event.detail));
        apexSearch({
            searchTerm: event.detail.searchTerm,
        })
            .then((results) => {
        }).then((results) => {
                lookupElement.setSearchResults(results);
            })
            .catch((error) => {
        }).catch((error) => {
                console.log("error" + JSON.stringify(error));
            });
    }
@@ -1732,7 +1826,7 @@
        if (this.filesUploaded.length > 0) {
            this.file = this.filesUploaded[0];
            if (this.file.size > this.MAX_FILE_SIZE) {
                this.showToast("Error", "文件过大");
                this.showMyToast('保存失败', '文件过大', 'Error');
                return;
            }
            this.showPopSpinner = true;
@@ -1758,19 +1852,17 @@
            recordId: this.ESetid,
            fileName: this.fileName,
            base64Data: encodeURIComponent(this.fileContents),
        })
            .then((r) => {
        }).then((r) => {
                this.showPopSpinner = false;
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                this.closePop();
                this.showToast("Success", "上传成功");
                this.showMyToast('成功', '上传成功', 'Success');
                this.getFiles();
            })
            .catch((error) => {
            }).catch((error) => {
                this.showPopSpinner = false;
                console.log("error = " + error.message);
                this.showToast("Error", "上传失败");
                this.showMyToast('失败', '上传失败', 'Error');
            });
    }
@@ -1779,21 +1871,24 @@
        this.showLoadingSpinner = true;
        getFiles({
            recordId: this.ESetid,
        })
            .then((r) => {
        }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                this.fileData = r.entity.cvList;
                console.log("this.fileData = " + JSON.stringify(this.fileData));
                for (var i in this.fileData) {
                    this.fileData[i]["CreatedByName"] = this.fileData[i].CreatedBy.Name;
                    this.fileData[i]["Id"] = this.fileData[i].Id;
                    this.fileData[i]["recordId"] = this.fileData[i].Id;
                    this.fileData[i]["url"] = "/" + this.fileData[i].Id;
                    this.fileData[i]["Title"] = this.fileData[i].Title;
                    this.fileData[i]["attUrl"] = '/' + this.fileData[i].Id;
                    this.fileData[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/' + this.fileData[i].ContentDocumentId + '?operationContext=S1';
                }
                console.log("this.fileData = " + this.fileData);
                this.showLoadingSpinner = false;
            })
            .catch((error) => {
            }).catch((error) => {
                console.log("error = " + error.message);
                this.showToast("Error", "获取附件失败");
                this.showMyToast('失败', '获取附件失败', 'Error');
            });
    }
@@ -1832,26 +1927,23 @@
            cocLwc: this.cocLwc,
            ESetId: this.ESetid,
            pageRecordsLwcLwc: cloneData,
        })
            .then((r) => {
        }).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.isSales = this.cocLwc["Summons_Order_type__c"] == "销售" ? true : false;
                    this.GoodsDeliveryInit();
                } else {
                    console.log("r.msg = " + r.msg);
                    this.showToast("Error", r.msg);
                this.showMyToast('错误', r.msg, 'Error');
                }
                this.isShippingSales = true;
            })
            .catch((error) => {
        }).catch((error) => {
                console.log("error = " + error.message);
                this.showToast("Error", "跳转失败");
            this.showMyToast('失败', '跳转失败', 'Error');
            });
    }
@@ -1859,8 +1951,7 @@
        console.log("GoodsDeliveryInit");
        GoodsDeliveryInit({
            ESetId: this.ESetid,
        })
            .then((r) => {
        }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                if (r.status == "Success") {
@@ -1869,6 +1960,7 @@
                    this.salesUserWorkLocation = r.entity.userWorkLocation;
                    this.salesAccountid = r.entity.accountid;
                    this.salesOrderdetails = r.entity.orderdetails;
                    console.log('this.salesOrderdetails = ' + JSON.stringify(this.salesOrderdetails))
                    this.salesData = r.entity.consumableorderdetailsRecords;
                    this.salesErrorData = r.entity.consumableorderdetailsRecordserror;
                    this.salesOrderpieceorboxMap = r.entity.orderpieceorboxMap;
@@ -1877,12 +1969,11 @@
                    this.isShowSpinner = false;
                } else {
                    console.log("r.msg = " + r.msg);
                    this.showToast("Error", r.msg);
                    this.showMyToast('初始化失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
            }).catch((error) => {
                console.log("error = " + error.message);
                this.showToast("Error", "初始化失败");
                this.showMyToast('错误', '初始化失败', 'Error');
            });
    }
@@ -1897,8 +1988,7 @@
            accountid: this.salesAccountid,
            orderdetails: this.salesOrderdetails,
            orderpieceorboxMap: this.salesOrderpieceorboxMap,
        })
            .then((r) => {
        }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                if (r.status == "Success") {
@@ -1906,52 +1996,76 @@
                    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;
                    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;
                    }
                console.log('this.salesData = ' + JSON.stringify(this.salesData));
                    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]["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;
                    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;
                    }
                        }
                    }
                    //salescolomus
                    // console.log('this.salesData[i]["Box_Piece__c"] = ' + this.salesData[i]["Box_Piece__c"])
                    // if (this.salesData[i]["Box_Piece__c"] == '盒') {
                    //     this.salesData[i]["isDisable"] = true;
                    //     this.salesData[i]["count"] = this.salesData[i].outboundCount;
                    // }
                    // if (this.salesData[i]["Box_Piece__c"] == '个') {
                    //     this.salesData[i]["isDisable"] = false;
                    // }
                }
                this.salesColumns = [...this.salesColumns];
                    this.isShowSpinner = false;
                } else {
                    console.log("r.msg = " + r.msg);
                    this.showToast("Error", r.msg);
                this.showMyToast('获取失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
        }).catch((error) => {
                console.log("error = " + JSON.stringify(error.message));
                this.showToast("Error", "初始化失败");
            });
    }
    handleOutboundCount(event) {
        let outboundDetail = event.detail;
        for (var i in this.salesData) {
            if (this.salesData[i].Id == outboundDetail.data.recordId) {
                this.salesData[i]['outboundCount'] = outboundDetail.data.count
            }
        }
        console.log('this.salesData = ' + JSON.stringify(this.salesData))
    }
    SaveP() {
        let cloneSalesData = this.salesData;
        for (var i in cloneSalesData) {
            delete cloneSalesData[i].Consumable_order_minor__c;
            delete cloneSalesData[i].ConsumableorderminorUrl;
            delete cloneSalesData[i].orderdetails2Name;
            delete cloneSalesData[i].orderdetails2NameUrl;
            delete cloneSalesData[i].Box_Piece__c;
@@ -1963,15 +2077,15 @@
        }
        this.isShowSpinner = true;
        ProSale({
            ESetId: this.ESetid,
            ESetIdLwc: this.ESetid,
            cocLwc: this.salesCoc,
            barcodeLwc: this.Barcode,
            accountName: this.salesAccountName,
            userWorkLocation: this.salesUserWorkLocation,
            accountNameLwc: this.salesAccountName,
            userWorkLocationLwc: this.salesUserWorkLocation,
            consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
            orderdetails: this.salesOrderdetails,
            orderpriceMap: this.salesOrderpriceMap,
            orderagencypriceMap: this.salesOrderagencypriceMap,
            orderdetailsLwc: this.salesOrderdetails,
            orderpriceMapLwc: this.salesOrderpriceMap,
            orderagencypriceMapLwc: this.salesOrderagencypriceMap,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
@@ -1986,12 +2100,11 @@
                });
            } else {
                console.log("r.msg = " + r.msg);
                this.showToast("Error", r.msg);
                this.showMyToast('销售失败', r.msg, 'Error');
            }
        })
            .catch((error) => {
        }).catch((error) => {
                console.log("error = " + JSON.stringify(error.message));
                this.showToast("Error", "ProSale2失败");
            this.showMyToast('错误', '销售失败', 'Error');
            });
    }
@@ -2010,15 +2123,15 @@
        }
        this.isShowSpinner = true;
        ProdElivery({
            ESetId: this.ESetid,
            ESetIdLwc: this.ESetid,
            cocLwc: this.salesCoc,
            barcodeLwc: this.Barcode,
            accountName: this.salesAccountName,
            userWorkLocation: this.salesUserWorkLocation,
            accountNameLwc: this.salesAccountName,
            userWorkLocationLwc: this.salesUserWorkLocation,
            consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
            orderdetails: this.salesOrderdetails,
            orderpriceMap: this.salesOrderpriceMap,
            orderagencypriceMap: this.salesOrderagencypriceMap,
            orderdetailsLwc: this.salesOrderdetails,
            orderpriceMapLwc: this.salesOrderpriceMap,
            orderagencypriceMapLwc: this.salesOrderagencypriceMap,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
@@ -2033,12 +2146,11 @@
                });
            } else {
                console.log("r.msg = " + r.msg);
                this.showToast("Error", r.msg);
                this.showMyToast('出货失败', r.msg, 'Error');
            }
        })
            .catch((error) => {
        }).catch((error) => {
                console.log("error = " + JSON.stringify(error.message));
                this.showToast("Error", "初始化失败");
            this.showMyToast('错误', '出货失败', 'Error');
            });
    }
@@ -2077,11 +2189,11 @@
                });
            } else {
                console.log("r.msg = " + r.msg);
                this.showToast("Error", r.msg);
                this.showMyToast('删除失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showToast("Error", "跳转失败");
            this.showMyToast('错误', '删除失败', 'Error');
        });
    }
@@ -2312,17 +2424,18 @@
                    this.editData[i]["Category5__c"] = this.editData[i].Prod.Category5__c;
                    this.editData[i]["Box_Piece__c"] = this.editData[i].orderdetails1.Box_Piece__c;
                    this.editData[i]["shipmentAmount"] = this.editData[i].orderdetails1.Shipment_amount__c;
                    this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
                    //this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
                    this.editData[i]["Delivery_List_RMB__c"] = this.editData[i].orderdetails1.Delivery_List_RMB__c;
                    this.editData[i]["Shipment_Count__c"] = this.editData[i].orderdetails1.Shipment_Count__c;
                }
                this.showTable = true;
                this.isEditShowSpinner = false;
            } else {
                console.log("r = " + JSON.stringify(r));
                this.showToast("Error", r.msg);
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
            this.showMyToast('错误', '搜索失败', 'Error');
        });
    }
@@ -2333,4 +2446,26 @@
    get nextButtonDisabled() {
        return this.nextPageToken === undefined;
    }
    //删除附件
    deleteAtt(event) {
        this.showLoadingSpinner = true;
        //var recordId = event.detail.data.recordId;
        var recordId = event.target.getAttribute("data-fileid");
        console.log('attid:' + recordId);
        deleteAtt(
            {
                contentVersionId: recordId
            }
        ).then(result => {
            if (result.result == 'Success') {
                this.showMyToast('成功', '删除成功', 'Success');
                this.getFiles();
            } else {
                this.showMyToast('删除失败', result.errorMsg, 'Error');
            }
        }).catch(error => {
            this.showMyToast('错误', '删除失败', 'Error');
        })
    }
}