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/lexInventoryCount/lexInventoryCount.js |  595 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 324 insertions(+), 271 deletions(-)

diff --git a/force-app/main/default/lwc/lexInventoryCount/lexInventoryCount.js b/force-app/main/default/lwc/lexInventoryCount/lexInventoryCount.js
index 3f9c9a4..eeba966 100644
--- a/force-app/main/default/lwc/lexInventoryCount/lexInventoryCount.js
+++ b/force-app/main/default/lwc/lexInventoryCount/lexInventoryCount.js
@@ -1,162 +1,164 @@
-import { LightningElement, wire, api, track } from 'lwc';
-import oninit from '@salesforce/apex/LexInventoryController.init';
-import barcodeEntry from '@salesforce/apex/LexInventoryController.searchConsumableorderdetails';
-import saveConfirm from '@salesforce/apex/LexInventoryController.save';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import { NavigationMixin } from 'lightning/navigation';
+import { LightningElement, wire, api, track } from "lwc";
+import oninit from "@salesforce/apex/LexInventoryController.init";
+import barcodeEntry from "@salesforce/apex/LexInventoryController.searchConsumableorderdetails";
+// import saveConfirm from '@salesforce/apex/LexInventoryController.saveConfirm';
+import save from "@salesforce/apex/LexInventoryController.save";
+import datainit from "@salesforce/apex/LexInventoryListController.init";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import { NavigationMixin } from "lightning/navigation";
 
 //搴撳瓨鐩樼偣涓婚〉闈㈡暟鎹�
 const columns = [
     {
-        label: '鏄惁鐩樼偣',
-        fieldName: 'iscount',
-        type: 'checkbox',
-        cellAttributes: { alignment: 'left' }
+        label: "鏄惁鐩樼偣",
+        fieldName: "iscount",
+        hideDefaultActions: true,
+        cellAttributes: { alignment: "left" },
     },
     {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        type: 'Name',
-        cellAttributes: { alignment: 'left' }
+        label: "娑堣�楀搧鍚嶇О",
+        fieldName: "Name__c",
+        hideDefaultActions: true,
+        initialWidth: 250,
+        cellAttributes: { alignment: "left" },
     },
     {
-        label: '瑙勬牸',
-        fieldName: 'Packing_list_manual__c',
-        hideDefaultActions: true
+        label: "瑙勬牸",
+        fieldName: "Packing_list_manual__c",
+        hideDefaultActions: true,
     },
     {
-        label: '鍗曚綅',
-        fieldName: 'boxPiece',
-        hideDefaultActions: true
+        label: "鍗曚綅",
+        fieldName: "boxPiece",
+        hideDefaultActions: true,
     },
     {
-        label: '鏈夋晥鏈熷唴搴撳瓨',
-        fieldName: 'limitCount',
-        hideDefaultActions: true
+        label: "鏈夋晥鏈熷唴搴撳瓨",
+        fieldName: "limitCount",
+        hideDefaultActions: true,
     },
 
     {
-        label: '杩囨湡搴撳瓨',
-        fieldName: 'overlimitCount',
+        label: "杩囨湡搴撳瓨",
+        fieldName: "overlimitCount",
         hideDefaultActions: true,
-        initialWidth: 100
+        initialWidth: 100,
     },
     {
-        label: '鐩樼偣',
-        fieldName: 'Pandian',
+        label: "鐩樼偣",
+        fieldName: "Pandian",
         hideDefaultActions: true,
-        initialWidth: 100
+        initialWidth: 100,
     },
     {
-        label: '涓㈠け',
-        fieldName: 'Diff',
+        label: "涓㈠け",
+        fieldName: "Diff",
         hideDefaultActions: true,
-        initialWidth: 100
+        initialWidth: 100,
     },
     {
-        label: '瀵诲洖	',
-        fieldName: 'refind',
+        label: "瀵诲洖	",
+        fieldName: "refind",
         hideDefaultActions: true,
-        initialWidth: 150
+        initialWidth: 150,
     },
     {
-        label: '宸紓鍘熷洜',
+        label: "宸紓鍘熷洜",
         // fieldName: "DiffReason",
         hideDefaultActions: true,
-        type: 'customDiffReason',
+        type: "customDiffReason",
         typeAttributes: {
-            DiffReason: { fieldName: 'DiffReason' },
-            ProdId: { fieldName: 'ProdId' }
-        }
-    }
+            DiffReason: { fieldName: "DiffReason" },
+            ProdId: { fieldName: "ProdId" },
+        },
+    },
 ];
 
 //璋冩暣鏄庣粏
 const column = [
     {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        type: 'Name',
-        cellAttributes: { alignment: 'left' }
-    },
-    {
-        label: '鍗曚綅',
-        fieldName: 'Box_Piece__c',
-        hideDefaultActions: true
-    },
-    {
-        label: 'barcode',
-        fieldName: 'Bar_Code__c',
+        label: "娑堣�楀搧鍚嶇О",
+        fieldName: "Name__c",
         hideDefaultActions: true,
-        initialWidth: 150
+        cellAttributes: { alignment: "left" },
     },
     {
-        label: '璋冩暣鍘熷洜',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true
-    }
+        label: "鍗曚綅",
+        fieldName: "Box_Piece__c",
+        hideDefaultActions: true,
+    },
+    {
+        label: "barcode",
+        fieldName: "Bar_Code__c",
+        hideDefaultActions: true,
+        initialWidth: 150,
+    },
+    {
+        label: "璋冩暣鍘熷洜",
+        fieldName: "DiffReason",
+        hideDefaultActions: true,
+    },
 ];
 //鐩樼偣鏄庣粏
 const dcolumns = [
     {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        type: 'Name',
-        cellAttributes: { alignment: 'left' }
-    },
-    {
-        label: '搴撳瓨',
-        fieldName: 'Box_Piece__c',
-        hideDefaultActions: true
-    },
-    {
-        label: '鐩樼偣',
-        fieldName: 'Bar_Code__c',
+        label: "娑堣�楀搧鍚嶇О",
+        fieldName: "Name__c",
         hideDefaultActions: true,
-        initialWidth: 150
+        cellAttributes: { alignment: "left" },
     },
     {
-        label: '涓㈠け',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true
+        label: "搴撳瓨",
+        fieldName: "Count_Sum__c",
+        hideDefaultActions: true,
     },
     {
-        label: '瀵诲洖',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true
+        label: "鐩樼偣",
+        fieldName: "inventory_sum__c",
+        hideDefaultActions: true,
+        initialWidth: 150,
     },
-    ,
     {
-        label: '宸紓鍘熷洜',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true
-    }
+        label: "涓㈠け",
+        fieldName: "Diff__c",
+        hideDefaultActions: true,
+    },
+    {
+        label: "瀵诲洖",
+        fieldName: "Product_Refind__c",
+        hideDefaultActions: true,
+    },
+    {
+        label: "宸紓鍘熷洜",
+        fieldName: "Lose_reason__c",
+        hideDefaultActions: true,
+    },
 ];
 
 //鍦ㄥ簱璋冩暣鏄庣粏
 const stockadjustcolumns = [
     {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        type: 'Name',
-        cellAttributes: { alignment: 'left' }
+        label: "娑堣�楀搧鍚嶇О",
+        fieldName: "Name__c",
+        cellAttributes: { alignment: "left" },
     },
     {
-        label: '浜у搧鍨嬪彿',
-        fieldName: 'Box_Piece__c',
-        hideDefaultActions: true
-    },
-    {
-        label: '宸紓鍘熷洜',
-        fieldName: 'Bar_Code__c',
+        label: "浜у搧鍨嬪彿",
+        fieldName: "Asset_Model_No__c",
         hideDefaultActions: true,
-        initialWidth: 150
     },
     {
-        label: '鏄惁涓㈠け',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true
-    }
+        label: "宸紓鍘熷洜",
+        fieldName: "Lose_reason__c",
+        hideDefaultActions: true,
+        initialWidth: 150,
+    },
+    {
+        label: "鏄惁涓㈠け",
+        type: "boolean",
+        fieldName: "Lose_Flag__c",
+        hideDefaultActions: true,
+    },
 ];
 
 export default class LexInventoryCount extends NavigationMixin(
@@ -171,29 +173,35 @@
     @track accountName;
     @track agencyProType;
     @track userWorkLocation;
+    @track accountid
+    @track pandiandetailsMap
+    @track reSet
+
     @track showTable = false;
     @track showbutton = false;
-    @track barCode;
+    @track barcode = "";
     @track ConsumableorderdetailsRecordsview = [];
     @track consumableorderdetailsRecords = [];
-    @track showTable = false;
-    @track barcode;
     @track showcount = true;
 
-    @track iSinventory;
+    @track iSinventory = false
     @track numberDetail;
+    @track hidecheckbox = true;
+
 
     //鍔犺浇妗�
-    @track casesSpinner = true;
+    // @track casesSpinner = true;
+    @track showSpinner = true;
+
     //row
     @track selectedRows = [];
     //inventoryList
     @track isSummonsFlag;
     //灞曞紑鏍�
-    activeSections = ['dataExpand'];
-    columnHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'barCode', '璋冩暣鍘熷洜'];
+    activeSections = ["dataExpand"];
+    columnHeader = ["娑堣�楀搧鍚嶇О", "鍗曚綅", "barCode", "璋冩暣鍘熷洜"];
     //纭涓�瑙�
-    @track eSetId = '';
+    @track eSetId = "";
     @track EditAble = false;
     @track selectedData;
     @track conId;
@@ -202,8 +210,8 @@
 
     //鑾峰彇閾炬帴鍙傛暟
     getQueryString(name) {
-        console.log('getQueryString name ' + name);
-        let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
+        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]);
@@ -212,21 +220,28 @@
     }
 
     connectedCallback() {
-        console.log('===>鍒濆鍖�');
+        console.log("===>鍒濆鍖�");
+        this.showSpinner = true;
         //鑾峰彇ESetid
-        this.eSetId = this.getQueryString('eSetId');
-        this.eSetId = this.eSetId == null ? '' : this.eSetId;
-        console.log(' this.eSetId' + this.eSetId);
-        this.EditAble = false;
-        this.showcount = true;
+        this.eSetId = this.getQueryString("eSetId");
+        this.eSetId = this.eSetId == null ? "" : this.eSetId;
+        console.log(" this.eSetId" + this.eSetId);
+        if (this.eSetId == "") {
+            this.EditAble = false;
+        } else {
+            this.inits();
+            this.showcount = false;
+            this.EditAble = true;
+        }
+
         oninit()
             .then((result) => {
-                console.log('1112' + JSON.stringify(result));
+                console.log("1112" + JSON.stringify(result));
                 result = JSON.parse(JSON.stringify(result));
-                console.log('result.status = ' + result.status);
+                console.log("result.status = " + result.status);
                 console.log(
-                    ' ConsumableorderdetailsRecordsview= ' +
-                        result.entity.ConsumableorderdetailsRecordsview
+                    " ConsumableorderdetailsRecordsview= " +
+                    result.entity.ConsumableorderdetailsRecordsview
                 );
                 this.ConsumableorderdetailsRecordsview = JSON.parse(
                     result.entity.ConsumableorderdetailsRecordsview
@@ -234,24 +249,19 @@
                 this.consumableorderdetailsRecords =
                     result.entity.consumableorderdetailsRecords;
                 console.log(
-                    ' consumableorderdetailsRecords= ' +
-                        result.entity.consumableorderdetailsRecords
+                    " consumableorderdetailsRecords= " +
+                    result.entity.consumableorderdetailsRecords
                 );
 
-                console.log(
-                    '浼犲弬绫诲瀷',
-                    typeof this.consumableorderdetailsRecords
-                );
-                if (result.status == 'Success') {
+                console.log("浼犲弬绫诲瀷", typeof this.consumableorderdetailsRecords);
+                if (result.status == "Success") {
                     console.log(
-                        'this.ConsumableorderdetailsRecordsview[0] = ' +
-                            JSON.stringify(
-                                this.ConsumableorderdetailsRecordsview[0]
-                            )
+                        "this.ConsumableorderdetailsRecordsview[0] = " +
+                        JSON.stringify(this.ConsumableorderdetailsRecordsview[0])
                     );
                     console.log(
-                        'this.ConsumableorderdetailsRecordsview[0].length = ' +
-                            this.ConsumableorderdetailsRecordsview[0].length
+                        "this.ConsumableorderdetailsRecordsview[0].length = " +
+                        this.ConsumableorderdetailsRecordsview[0].length
                     );
 
                     // let cloneData = [];
@@ -263,32 +273,34 @@
                     // this.data = cloneData;
                     this.data = [];
                     this.data = this.ConsumableorderdetailsRecordsview[0];
-                    console.log('this.data ==>' + JSON.stringify(this.data));
+                    console.log("this.data ==>" + JSON.stringify(this.data));
                     for (let i in this.data) {
-                        this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
-                        this.data[i]['Packing_list_manual__c'] =
+                        this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+                        this.data[i]["Packing_list_manual__c"] =
                             this.data[i].Prod.Packing_list_manual__c;
                     }
                     this.accountName = result.entity.accountName;
                     this.agencyProType = result.entity.agencyProType;
                     this.userWorkLocation = result.entity.userWorkLocation;
-                    this.casesSpinner = false;
+                    this.showSpinner = false;
+                    this.accountid = result.entity.accountid;
+                    // this.casesSpinner = false;
                     this.showTable = true;
                 } else {
-                    console.log('Error:' + result.errorMsg);
+                    console.log("Error:" + result.errorMsg);
                     const evt = new ShowToastEvent({
-                        title: '瑙f瀽澶辫触',
+                        title: "瑙f瀽澶辫触",
                         message: result.errorMsg,
-                        variant: 'error'
+                        variant: "error",
                     });
                     this.dispatchEvent(evt);
                 }
             })
             .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
+                console.log("error = " + JSON.stringify(error));
             });
         //榛樿灞曞紑鏍�
-        this.activeSections = ['dataExpand'];
+        this.activeSections = ["dataExpand"];
         this.showTable = false;
         this.showbutton = false;
         //init
@@ -298,86 +310,95 @@
     barcodeEntrys() {
         this.showTable = false;
         this.showbutton = false;
-        console.log('杩涘叆褰曞叆');
+        this.showSpinner = true;
+        console.log("杩涘叆褰曞叆");
         console.log(
-            'this.consumableorderdetailsRecords===>' +
-                this.consumableorderdetailsRecords
+            "this.consumableorderdetailsRecords===>" +
+            this.consumableorderdetailsRecords
         );
-        if (
-            this.barcode == '' ||
-            this.barcode == null ||
-            this.barcode == 'undefined'
-        ) {
-            this.connectedCallback();
-        }
 
         barcodeEntry({
             accountName: this.accountName,
             agencyProType: this.agencyProType,
             userWorkLocation: this.userWorkLocation,
             barcode: this.barcode,
-            consumableorderdetailsRecordsLWC: this.consumableorderdetailsRecords
+            consumableorderdetailsRecordsLWC: this.consumableorderdetailsRecords,
         })
             .then((result) => {
-                // result = JSON.parse(JSON.stringify(result));
-                this.codPageRecords = JSON.parse(result.entity.codPageRecords);
-                for (var i in this.codPageRecords) {
-                    this.codPageRecords[i]['Name__c'] =
-                        this.codPageRecords[i].Prod.Name__c;
-                    this.codPageRecords[i]['Box_Piece__c'] =
-                        this.codPageRecords[i].orderdetails2.Box_Piece__c;
-                    this.codPageRecords[i]['Bar_Code__c'] =
-                        this.codPageRecords[i].orderdetails2.Bar_Code__c;
-                }
-                this.data = JSON.parse(
-                    result.entity.consumableorderdetailsRecords
-                );
-                for (var i in this.data) {
-                    this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
-                    this.data[i]['Packing_list_manual__c'] =
-                        this.data[i].Prod.Packing_list_manual__c;
-                }
-                for (var i in this.data) {
-                    if (this.data[i]['check']) {
-                        this.selectedRows.push(this.data[i].ProdId);
-                        console.log('selectedRows:' + this.selectedRows);
-                    }
-                }
-                this.iSinventory = result.entity.iSinventory;
-                console.log('iSinventory:' + this.iSinventory);
-                this.showTable = true;
-                this.showbutton = true;
+                result = JSON.parse(JSON.stringify(result));
+                console.log("result ===>" + JSON.stringify(result));
 
-                console.log(
-                    ' this.codPageRecords=11111 ' + result.entity.codPageRecords
-                );
-                console.log('result褰曞叆= ' + JSON.stringify(result));
-                console.log(
-                    'result涓婚〉鏁版嵁= ' +
-                        result.entity.consumableorderdetailsRecords
-                );
+                console.log("1111");
+                if (result.status == "Sucess") {
+                    this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+                    for (var i in this.codPageRecords) {
+                        this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
+                        this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
+                        this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
+                    }
+                    this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+                    for (var i in this.data) {
+                        this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+                        this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+                    }
+                    for (var i in this.data) {
+                        if (this.data[i]["check"]) {
+                            this.selectedRows.push(this.data[i].ProdId);
+                            console.log("selectedRows:" + this.selectedRows);
+                        }
+                    }
+                    this.iSinventory = result.entity.iSinventory;
+                    this.pandiandetailsMap = result.entity.pandiandetailsMap;
+                    this.reSet = result.entity.reSet;
+                    console.log("iSinventory:" + this.iSinventory);
+                    this.showTable = true;
+                    this.showbutton = true;
+                    this.showSpinner = false;
+                    console.log('reSet' + this.reSet);
+                    console.log('pandiandetailsMap' + this.pandiandetailsMap);
+
+
+                    console.log(
+                        "this.codPageRecords=11111 " + result.entity.codPageRecords
+                    );
+                    console.log("result褰曞叆= " + JSON.stringify(result));
+                    console.log(
+                        "result涓婚〉鏁版嵁= " + result.entity.consumableorderdetailsRecords
+                    );
+                } else {
+                    console.log('Error:' + result.errorMsg);
+                    const evt = new ShowToastEvent({
+                      title: '',
+                      message: result.msg,
+                      variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.showSpinner = false;
+                    this.showTable = true;
+                    
+                }
             })
             .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
+                console.log("error = " + JSON.stringify(error));
             });
     }
     //鑾峰彇褰撳墠杈撳叆鍊�
     handleChange(event) {
         let value = event.detail.value;
-        console.log('value' + value);
+        console.log("value" + value);
         this.barcode = value;
     }
 
     getSelectedRows(event) {
         const selectedRows = event.detail.selectedRows;
-        console.log('this.selectedRows = ' + this.selectedRows);
+        console.log("this.selectedRows = " + this.selectedRows);
         for (var i in this.data) {
-            this.data[i]['check'] = false;
+            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;
+                if (this.data[i].ProdId == selectedRows[j].ProdId) {
+                    this.data[i]["check"] = true;
                 }
             }
         }
@@ -385,39 +406,38 @@
 
     //瀵煎嚭涓篶sv
     exportData() {
-        console.log('瀵煎嚭');
+        console.log("瀵煎嚭");
         // Prepare a html table
-        let doc = '<table>';
+        let doc = "<table>";
         // Add styles for the table
-        doc += '<style>';
-        doc += 'table, th, td {';
-        doc += '    border: 1px solid black;';
-        doc += '    border-collapse: collapse;';
-        doc += '}';
-        doc += '</style>';
+        doc += "<style>";
+        doc += "table, th, td {";
+        doc += "    border: 1px solid black;";
+        doc += "    border-collapse: collapse;";
+        doc += "}";
+        doc += "</style>";
         // Add all the Table Headers
-        doc += '<tr>';
+        doc += "<tr>";
         this.columnHeader.forEach((element) => {
-            doc += '<th>' + element + '</th>';
+            doc += "<th>" + element + "</th>";
         });
-        doc += '</tr>';
+        doc += "</tr>";
         // Add the data rows
         this.codPageRecords.forEach((record) => {
-            doc += '<tr>';
-            doc += '<th>' + record.Name__c + '</th>';
-            doc += '<th>' + record.Box_Piece__c + '</th>';
-            doc += '<th>' + record.Bar_Code__c + '</th>';
-            doc += '<th>' + record.DiffReason + '</th>';
-            doc += '</tr>';
+            doc += "<tr>";
+            doc += "<th>" + record.Name__c + "</th>";
+            doc += "<th>" + record.Box_Piece__c + "</th>";
+            doc += "<th>" + record.Bar_Code__c + "</th>";
+            doc += "<th>" + record.DiffReason + "</th>";
+            doc += "</tr>";
         });
-        doc += '</table>';
-        var element =
-            'data:application/vnd.ms-excel,' + encodeURIComponent(doc);
-        let downloadElement = document.createElement('a');
+        doc += "</table>";
+        var element = "data:application/vnd.ms-excel," + encodeURIComponent(doc);
+        let downloadElement = document.createElement("a");
         downloadElement.href = element;
-        downloadElement.target = '_self';
+        downloadElement.target = "_self";
         // use .csv as extension on below line if you want to export data as csv
-        downloadElement.download = '搴撳瓨鍙樺寲鏄庣粏.xls';
+        downloadElement.download = "搴撳瓨鍙樺寲鏄庣粏.xls";
         document.body.appendChild(downloadElement);
         downloadElement.click();
     }
@@ -427,76 +447,109 @@
     diffreasons(event) {
         const numberDetail = event.detail;
         // this.numberDetail = numberDetail;
-        console.log('numberDetail' + JSON.stringify(numberDetail));
+        console.log("numberDetail" + JSON.stringify(numberDetail));
         for (var i in this.data) {
-            if (this.data[i]['ProId'] == numberDetail.data.ProId) {
-                this.data[i]['DiffReason'] = numberDetail.data.DiffReason;
+            if (this.data[i]["ProId"] == numberDetail.data.ProId) {
+                this.data[i]["DiffReason"] = numberDetail.data.DiffReason;
             }
         }
-        console.log(' this.data==>' + JSON.stringify(this.data));
+        console.log(" this.data==>" + JSON.stringify(this.data));
     }
 
     saveConfirm() {
-        console.log('杩涘叆鐩樼偣纭');
-        var el = this.template.querySelector(
-            'c-lex-custom-lightning-datatable'
-        );
+        console.log("杩涘叆鐩樼偣纭");
+        console.log('reSet' + this.reSet);
+        console.log('pandiandetailsMap' + this.pandiandetailsMap);
+        var el = this.template.querySelector("c-lex-custom-lightning-datatable");
         var selected = el.getSelectedRows();
         this.selectedData = selected;
-        console.log('閫変腑鏁版嵁' + JSON.stringify(this.selectedData));
-        saveConfirm({
+        console.log("閫変腑鏁版嵁" + JSON.stringify(this.selectedData));
+        save({
             iSinventory: this.iSinventory,
-            consumableorderdetailsRecordsLWC: JSON.stringify(this.selectedData)
+            consumableorderdetailsRecordsLWC: JSON.stringify(this.selectedData),
+            accountid: this.accountid,
+            agencyProType: this.agencyProType,
+            reSet: this.reSet,
+            pandiandetailsMap: this.pandiandetailsMap
         })
             .then((result) => {
-                console.log('result = ' + JSON.stringify(result));
-                this.EditAble = true;
-                this.showcount = false;
-                // result = JSON.parse(JSON.stringify(result));
-                // console.log('result = ' + JSON.stringify(result));
+                result = JSON.parse(JSON.stringify(result));
+                console.log("result = " + JSON.stringify(result));
+                console.log("111111");
 
-                // if (result.status == 'Success') {
-                //   // let url = '/lexInventoryCount?eSetId=' + result.entity.eSetId;
-                //   // this[NavigationMixin.Navigate]({
-                //   //   type: 'standard__webPage',
-                //   //   attributes: {
-                //   //     url: url
-                //   //   }
-                //   // });
-                //   this.EditAble = true;
-                //   this.showcount = false;
-                // } else {
-                //   console.log('result.msg = ' + result.msg);
-                //   const evt = new ShowToastEvent({
-                //     title: '澶辫触',
-                //     message: result.msg,
-                //     variant: 'error'
-                //   });
-                //   this.dispatchEvent(evt);
-                // }
+                if (result.status == "Success") {
+                    let url = "/lexInventoryCount?ESetid=" + result.entity.eSetId;
+                    this[NavigationMixin.Navigate]({
+                        type: "standard__webPage",
+                        attributes: {
+                            url: url,
+                        },
+                    });
+                    console.log("Id" + this.eSetId);
+                    // this.EditAble = true;
+                    // this.showcount = false;
+                } else {
+                    console.log("result.msg = " + result.msg);
+                    const evt = new ShowToastEvent({
+                        title: "澶辫触",
+                        message: result.msg,
+                        variant: "error",
+                    });
+                    this.dispatchEvent(evt);
+                }
             })
             .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
+                console.log("error = " + JSON.stringify(error));
             });
     }
 
-    // inits(){
-    //   init({
-    //     eSetId:this.eSetId
-    //   }).then((result) => {
-    //     result = JSON.parse(JSON.stringify(result));
-    //     for(var i in result.entity.qs){
-    //       this.conId = result.entity.qs[i].Id;
-    //     }
-    //     console.log('this.conId'+typeof( this.conId));
-    //     this.detailData = JSON.parse(result.entity.consumableorderdetailsRecords);
+    inits() {
+        datainit({
+            eSetId: this.eSetId,
+        })
+            .then((result) => {
+                result = JSON.parse(JSON.stringify(result));
+                console.log('鐩樼偣涓�瑙�===>' + JSON.stringify(result));
+                for (var i in result.entity.qs) {
+                    this.conId = result.entity.qs[i].Id;
+                }
+                console.log("this.conId" + typeof this.conId);
+                this.detailData = JSON.parse(
+                    result.entity.consumableorderdetailsRecords
+                );
+                if (result.entity.ConsumableorderdetailsRecordsError != null) {
+                    this.adjustdata = JSON.parse(
+                        result.entity.ConsumableorderdetailsRecordsError
+                    );
+                    for (let i in this.detailData) {
+                        this.detailData[i].Name__c = this.detailData[i].Prod.Name__c;
+                        this.detailData[i].Count_Sum__c = this.detailData[i].orderdetails1.Count_Sum__c;
+                        this.detailData[i].inventory_sum__c = this.detailData[i].orderdetails1.inventory_sum__c;
+                        this.detailData[i].Diff__c = this.detailData[i].orderdetails1.Diff__c;
+                        this.detailData[i].Product_Refind__c = this.detailData[i].orderdetails1.Product_Refind__c;
+                        this.detailData[i].Lose_reason__c = this.detailData[i].orderdetails1.Lose_reason__c;
+                    }
+                    for (let i in this.adjustdata) {
+                        this.adjustdata[i].Name__c = this.adjustdata[i].Prod.Name__c;
+                        this.adjustdata[i].Asset_Model_No__c = this.adjustdata[i].Prod.Asset_Model_No__c;
+                        this.adjustdata[i].Lose_reason__c = this.adjustdata[i].orderdetails2.Lose_reason__c;
+                        this.adjustdata[i].Lose_Flag__c = this.adjustdata[i].orderdetails2.Lose_Flag__c;
 
-    //     console.log('result鐩樼偣Id'+JSON.stringify(this.conId));
 
-    //   })
-    //   .catch((error) => {
-    //     console.log("error = " + JSON.stringify(error));
-    //   });
 
-    // }
-}
+
+
+                    }
+
+
+
+
+                }
+                console.log("result鐩樼偣Id" + JSON.stringify(this.conId));
+                console.log("璋冩暣鏄庣粏" + JSON.stringify(this.adjustdata));
+            })
+            .catch((error) => {
+                console.log("error = " + JSON.stringify(error));
+            });
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1