From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:56:14 +0800
Subject: [PATCH] lex community

---
 force-app/main/default/lwc/lexInventory/lexInventory.js | 1484 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 698 insertions(+), 786 deletions(-)

diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.js b/force-app/main/default/lwc/lexInventory/lexInventory.js
index ac48985..fc96ac2 100644
--- a/force-app/main/default/lwc/lexInventory/lexInventory.js
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.js
@@ -1,853 +1,765 @@
-import { LightningElement, wire, api, track } from 'lwc';
-import oninit from '@salesforce/apex/LexInventoryController.init';
+import { LightningElement, wire, api, track } from "lwc";
+import oninit from "@salesforce/apex/LexInventoryController.init";
 // import sheetjs from '@salesforce/resourceUrl/sheetjs';
-import barcodeEntry from '@salesforce/apex/LexInventoryController.searchConsumableorderdetails';
-import save from '@salesforce/apex/LexInventoryController.save';
-import datainit from '@salesforce/apex/LexInventoryListController.init';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import { NavigationMixin } from 'lightning/navigation';
+import barcodeEntry from "@salesforce/apex/LexInventoryController.searchConsumableorderdetails";
+import save from "@salesforce/apex/LexInventoryController.save";
+import datainit from "@salesforce/apex/LexInventoryListController.init";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import { NavigationMixin } from "lightning/navigation";
 
-//table css
-import { loadStyle } from 'lightning/platformResourceLoader';
-import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
+//table css 
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 //搴撳瓨鐩樼偣涓婚〉闈㈡暟鎹�
 const columns = [
-    {
-        label: '鏄惁鐩樼偣',
-        fieldName: 'iscount',
-        hideDefaultActions: true,
-        initialWidth: 80
-    },
-    {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        hideDefaultActions: true,
-        // initialWidth: 400,
-        wrapText: true
-    },
-    {
-        label: '瑙勬牸',
-        initialWidth: 50,
-        fieldName: 'Packing_list_manual__c',
-        cellAttributes: { alignment: 'right' },
-        hideDefaultActions: true
-    },
-    {
-        label: '鍗曚綅',
-        fieldName: 'boxPiece',
-        initialWidth: 50,
-        hideDefaultActions: true
-    },
-    {
-        label: '鏈夋晥鏈熷唴搴撳瓨',
-        fieldName: 'limitCount',
-        initialWidth: 120,
-        hideDefaultActions: true,
-        cellAttributes: { alignment: 'right' }
-    },
+	{
+		label: "鏄惁鐩樼偣",
+		fieldName: "iscount",
+		hideDefaultActions: true,
+		initialWidth: 80,
+	
+	},
+	{
+		label: "娑堣�楀搧鍚嶇О",
+		fieldName: "Name__c",
+		hideDefaultActions: true,
+		// initialWidth: 400,
+		wrapText:true
+		
+	},
+	{
+		label: "瑙勬牸",
+		initialWidth: 50,
+		fieldName: "Packing_list_manual__c",
+		cellAttributes: { alignment: "right" },
+		hideDefaultActions: true,
+		
+		
+	},
+	{
+		label: "鍗曚綅",
+		fieldName: "boxPiece",
+		initialWidth: 50,
+		hideDefaultActions: true,
+	
+		
+	},
+	{
+		label: "鏈夋晥鏈熷唴搴撳瓨",
+		fieldName: "limitCount",
+		initialWidth: 120,
+		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
+	},
 
-    {
-        label: '杩囨湡搴撳瓨',
-        initialWidth: 100,
-        fieldName: 'overlimitCount',
-        hideDefaultActions: true,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '鐩樼偣',
-        initialWidth: 50,
-        fieldName: 'Pandian',
-        hideDefaultActions: true,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '涓㈠け',
-        initialWidth: 50,
-        fieldName: 'Diff',
-        hideDefaultActions: true,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '瀵诲洖',
-        initialWidth: 50,
-        fieldName: 'refind',
-        hideDefaultActions: true,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '宸紓鍘熷洜',
-        // fieldName: "DiffReason",
-        initialWidth: 200,
-        hideDefaultActions: true,
-        type: 'customDiffReason',
-        typeAttributes: {
-            DiffReason: { fieldName: 'DiffReason' },
-            ProdId: { fieldName: 'ProdId' },
-            boxPiece: { fieldName: 'boxPiece' }
-        }
-    }
+	{
+		label: "杩囨湡搴撳瓨",
+		initialWidth: 100,
+		fieldName: "overlimitCount",
+		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
+		
+
+	},
+	{
+		label: "鐩樼偣",
+		initialWidth: 50,
+		fieldName: "Pandian",
+		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
+	
+		
+	},
+	{
+		label: "涓㈠け",
+		initialWidth: 50,
+		fieldName: "Diff",
+		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
+		
+		
+	},
+	{
+		label: "瀵诲洖",
+		initialWidth: 50,
+		fieldName: "refind",
+		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
+	
+	
+	},
+	{
+		label: "宸紓鍘熷洜",
+		// fieldName: "DiffReason",
+		initialWidth: 200,
+		hideDefaultActions: true,
+		type: "customDiffReason",
+		typeAttributes: {
+			DiffReason: { fieldName: "DiffReason" },
+			ProdId: { fieldName: "ProdId" },
+			boxPiece: { fieldName: "boxPiece" }
+
+		},
+	
+	},
 ];
 
 //璋冩暣鏄庣粏
 const column = [
-    {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        wrapText: true,
-        hideDefaultActions: true
-        // initialWidth: 550
-    },
-    {
-        label: '鍗曚綅',
-        fieldName: 'Box_Piece__c',
-        hideDefaultActions: true,
-        initialWidth: 50
-    },
-    {
-        label: 'BarCode',
-        fieldName: 'Bar_Code__c',
-        hideDefaultActions: true,
-        wrapText: true
-        // initialWidth: 300,
-    },
-    {
-        label: '璋冩暣鍘熷洜',
-        fieldName: 'DiffReason',
-        hideDefaultActions: true,
-        wrapText: true
-        // initialWidth:
-    }
+	{
+		label: "娑堣�楀搧鍚嶇О",
+		fieldName: "Name__c",
+		wrapText: true,
+		hideDefaultActions: true,
+		// initialWidth: 550
+	},
+	{
+		label: "鍗曚綅",
+		fieldName: "Box_Piece__c",
+		hideDefaultActions: true,
+		initialWidth: 50,
+	
+	},
+	{
+		label: "BarCode",
+		fieldName: "Bar_Code__c",
+		hideDefaultActions: true,
+		wrapText: true,
+	    // initialWidth: 300,
+	},
+	{
+		label: "璋冩暣鍘熷洜",
+		fieldName: "DiffReason",
+		hideDefaultActions: true,
+		wrapText: true,
+		// initialWidth: 
+		
+	},
 ];
 //鐩樼偣鏄庣粏
 const dcolumns = [
-    {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        hideDefaultActions: true,
-        // initialWidth: 250,
-        wrapText: true
-    },
-    {
-        label: '搴撳瓨',
-        fieldName: 'Count_Sum__c',
-        hideDefaultActions: true,
-        initialWidth: 100,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '鐩樼偣',
-        fieldName: 'inventory_sum__c',
-        hideDefaultActions: true,
-        initialWidth: 100,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '涓㈠け',
-        fieldName: 'Diff__c',
-        hideDefaultActions: true,
-        initialWidth: 100,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '瀵诲洖',
-        fieldName: 'Product_Refind__c',
-        hideDefaultActions: true,
-        initialWidth: 100,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '宸紓鍘熷洜',
-        fieldName: 'Lose_reason__c',
-        hideDefaultActions: true
-    }
+	{
+		label: "娑堣�楀搧鍚嶇О",
+		fieldName: "Name__c",
+		hideDefaultActions: true,
+		// initialWidth: 250,
+		wrapText: true,
+	
+
+	},
+	{
+		label: "搴撳瓨",
+		fieldName: "Count_Sum__c",
+		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
+	},
+	{
+		label: "鐩樼偣",
+		fieldName: "inventory_sum__c",
+		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
+	},
+	{
+		label: "涓㈠け",
+		fieldName: "Diff__c",
+		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
+	},
+	{
+		label: "瀵诲洖",
+		fieldName: "Product_Refind__c",
+		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+		
+	},
+	{
+		label: "宸紓鍘熷洜",
+		fieldName: "Lose_reason__c",
+		hideDefaultActions: true,
+	
+	},
 ];
 
 //鍦ㄥ簱璋冩暣鏄庣粏
 const stockadjustcolumns = [
-    {
-        label: '娑堣�楀搧鍚嶇О',
-        fieldName: 'Name__c',
-        wrapText: true,
-        hideDefaultActions: true
-    },
-    {
-        label: '浜у搧鍨嬪彿',
-        fieldName: 'Asset_Model_No__c',
-        hideDefaultActions: true
-    },
-    {
-        label: '宸紓鍘熷洜',
-        fieldName: 'Lose_reason__c',
-        hideDefaultActions: true,
-        initialWidth: 150
-    },
-    {
-        label: '鏄惁涓㈠け',
-        type: 'boolean',
-        fieldName: 'Lose_Flag__c',
-        hideDefaultActions: true
-    }
+	{
+		label: "娑堣�楀搧鍚嶇О",
+		fieldName: "Name__c",
+		wrapText: true,
+		hideDefaultActions: true,
+	
+	},
+	{
+		label: "浜у搧鍨嬪彿",
+		fieldName: "Asset_Model_No__c",
+		hideDefaultActions: true,
+	
+	},
+	{
+		label: "宸紓鍘熷洜",
+		fieldName: "Lose_reason__c",
+		hideDefaultActions: true,
+		initialWidth: 150,
+	
+	},
+	{
+		label: "鏄惁涓㈠け",
+		type: "boolean",
+		fieldName: "Lose_Flag__c",
+		hideDefaultActions: true,
+		
+	},
 ];
 
 export default class LexInventory extends NavigationMixin(LightningElement) {
-    columns = columns;
-    column = column;
-    stockadjustcolumns = stockadjustcolumns;
-    dcolumns = dcolumns;
-    @track data = [];
-    @track codPageRecords = [];
-    @track pageCodeRecords = [];
-    @track accountName;
-    @track agencyProType;
-    @track userWorkLocation;
-    @track accountid;
-    @track pandiandetailsMap;
-    @track reSet;
-    @track reSet1;
+	columns = columns;
+	column = column;
+	stockadjustcolumns = stockadjustcolumns;
+	dcolumns = dcolumns;
+	@track data = [];
+	@track codPageRecords = [];
+	@track pageCodeRecords = [];
+	@track accountName;
+	@track agencyProType;
+	@track userWorkLocation;
+	@track accountid
+	@track pandiandetailsMap
+	@track reSet
+	@track reSet1
 
-    @track showTable = false;
-    @track showbutton = false;
-    @track barcode = '';
-    @track ConsumableorderdetailsRecordsview = [];
-    @track consumableorderdetailsRecords = [];
-    @track showcount = true;
+	@track showTable = false;
+	@track showbutton = false;
+	@track barcode = "";
+	@track ConsumableorderdetailsRecordsview = [];
+	@track consumableorderdetailsRecords = [];
+	@track showcount = true;
 
-    @track iSinventory = false;
-    @track numberDetail;
-    @track hidecheckbox = true;
-    //鍒嗛〉start
-    @track sortBy = '';
-    @track sortDirection = 'asc';
-    @track pageSize = 10;
-    error;
-    records;
-    currentPageToken = 0;
-    nextPageToken = this.pageSize;
-    @track totalRecords = 0;
-    @track loader = false;
-    @track pageNumber = 1;
-    @track paginationVisibility = false;
-    @track totalPages = 1;
-    pageSizeOptions = [10, 25, 50, 100];
-    @track recordStart = 0;
-    @track recordEnd = 0;
-    //end
+	@track iSinventory = false
+	@track numberDetail;
+	@track hidecheckbox = true;
+	//鍒嗛〉start
+	@track sortBy = "";
+	@track sortDirection = "asc";
+	@track pageSize = 200;
+	error;
+	records;
+	currentPageToken = 0;
+	nextPageToken = this.pageSize;
+	@track totalRecords = 0;
+	@track loader = false;
+	@track pageNumber = 1;
+	@track paginationVisibility = false;
+	@track totalPages = 1;
+	pageSizeOptions = [100, 200, 300];
+	@track recordStart = 0;
+	@track recordEnd = 0;
+	//end
 
-    //鍔犺浇妗�
-    // @track casesSpinner = true;
-    @track showSpinner = true;
 
-    //row
-    @track selectedRows = [];
-    //inventoryList
-    @track isSummonsFlag;
-    //灞曞紑鏍�
-    activeSections = ['dataExpand'];
-    columnHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'BarCode', '璋冩暣鍘熷洜'];
-    //纭涓�瑙�
-    @track eSetId = '';
-    @track EditAble = false;
-    @track selectedData;
-    @track conId;
-    @track detailData = [];
-    @track adjustdata = [];
-    @track detalipan = [];
+	//鍔犺浇妗�
+	// @track casesSpinner = true;
+	@track showSpinner = true;
 
-    //瀵煎嚭csv
-    xlsDataHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'barCode', '璋冩暣鍘熷洜'];
+	//row
+	@track selectedRows = [];
+	//inventoryList
+	@track isSummonsFlag;
+	//灞曞紑鏍�
+	activeSections = ["dataExpand"];
+	columnHeader = ["娑堣�楀搧鍚嶇О", "鍗曚綅", "BarCode", "璋冩暣鍘熷洜"];
+	//纭涓�瑙�
+	@track eSetId = "";
+	@track EditAble = false;
+	@track selectedData;
+	@track conId;
+	@track detailData = [];
+	@track adjustdata = [];
+	@track detalipan = [];
 
-    //鑾峰彇閾炬帴鍙傛暟
-    getQueryString(name) {
-        console.log('getQueryString name ' + name);
-        let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
-        let r = window.location.search.substr(1).match(reg);
-        if (r != null) {
-            return decodeURIComponent(r[2]);
-        }
-        return null;
-    }
-    renderedCallback() {
+
+	//瀵煎嚭csv 
+	xlsDataHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'barCode', '璋冩暣鍘熷洜'];
+
+	//鑾峰彇閾炬帴鍙傛暟
+	getQueryString(name) {
+		console.log("getQueryString name " + name);
+		let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+		let r = window.location.search.substr(1).match(reg);
+		if (r != null) {
+			return decodeURIComponent(r[2]);
+		}
+		return null;
+	}
+	renderedCallback() {
         if (!this.stylesLoaded) {
             Promise.all([loadStyle(this, WrappedHeaderTable)])
                 .then(() => {
-                    console.log('Custom styles loaded');
+                    console.log("Custom styles loaded");
                     this.stylesLoaded = true;
                 })
                 .catch((error) => {
-                    console.error('Error loading custom styles');
+                    console.error("Error loading custom styles");
                 });
         }
     }
 
-    connectedCallback() {
-        console.log('===>鍒濆鍖�');
 
-        //鑾峰彇ESetid
-        this.eSetId = this.getQueryString('eSetId');
-        this.eSetId = this.eSetId == null ? '' : this.eSetId;
-        console.log(' this.eSetId' + this.eSetId);
-        if (this.eSetId == '') {
-            this.EditAble = false;
-            this.init();
-        } else {
-            this.inits();
-            this.showcount = false;
-            this.EditAble = true;
-        }
-    }
-    init() {
-        this.showSpinner = true;
-        oninit()
-            .then((result) => {
-                console.log('1112' + JSON.stringify(result));
-                result = JSON.parse(JSON.stringify(result));
-                console.log('result.status = ' + result.status);
-                console.log(
-                    'ConsumableorderdetailsRecordsview= ' +
-                        result.entity.ConsumableorderdetailsRecordsview
-                );
-                this.ConsumableorderdetailsRecordsview = JSON.parse(
-                    result.entity.ConsumableorderdetailsRecordsview
-                );
-                this.consumableorderdetailsRecords =
-                    result.entity.consumableorderdetailsRecords;
-                console.log(
-                    'consumableorderdetailsRecords= ' +
-                        result.entity.consumableorderdetailsRecords
-                );
-                console.log(
-                    '浼犲弬绫诲瀷',
-                    typeof this.consumableorderdetailsRecords
-                );
-                if (result.status == 'Success') {
-                    this.data = [];
-                    this.data = this.ConsumableorderdetailsRecordsview[0];
-                    console.log('this.data ==>' + JSON.stringify(this.data));
-                    for (let i in this.data) {
-                        this.data[i]['key'] =
-                            this.data[i]['ProdId'] + this.data[i]['boxPiece'];
-                        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.showSpinner = false;
-                    this.accountid = result.entity.accountid;
-                    this.showTable = true;
-                } else {
-                    this.showMyToast('鍒濆鍖栧け璐�', result.msg, 'error');
-                    this.showSpinner = false;
-                }
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
-                this.showSpinner = false;
-            });
-        //榛樿灞曞紑鏍�
-        this.activeSections = ['dataExpand'];
-        this.showTable = false;
-        this.showbutton = false;
-    }
+	connectedCallback() {
+		console.log("===>鍒濆鍖�");
 
-    //褰曞叆barcode
-    barcodeEntrys() {
-        console.log('Test');
-        this.showTable = false;
-        this.showbutton = false;
-        this.showSpinner = true;
+		//鑾峰彇ESetid
+		this.eSetId = this.getQueryString("eSetId");
+		this.eSetId = this.eSetId == null ? "" : this.eSetId;
+		console.log(" this.eSetId" + this.eSetId);
+		if (this.eSetId == "") {
+			this.EditAble = false;
+			this.init();
+		} else {
+			this.inits();
+			this.showcount = false;
+			this.EditAble = true;
+		}
 
-        //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-        const selectedRows = this.template
-            .querySelector('c-lex-custom-lightning-datatable')
-            .getSelectedRows();
-        console.log('selectedRows========> ' + JSON.stringify(selectedRows));
-        for (var i in this.data) {
-            this.data[i]['check'] = false;
-        }
-        for (var i in this.data) {
-            for (var j in selectedRows) {
-                if (
-                    this.data[i].ProdId + this.data[i]['boxPiece'] ==
-                    selectedRows[j].ProdId + selectedRows[j]['boxPiece']
-                ) {
-                    this.data[i]['check'] = true;
-                }
-                // console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
-                console.log(
-                    'selectedRows[j].ProdId+this.data[i]["boxPiece"]' +
-                        selectedRows[j].ProdId +
-                        selectedRows[j]['boxPiece']
-                );
-            }
-        }
-        // if(this.barcode == ''||this.barcode == null){
-        // 	this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
+	}
+	init() {
 
-        // }
-        console.log('this.data--->' + JSON.stringify(this.data));
-        console.log('this.currentPageToken' + this.currentPageToken);
-        this.selectedRows = [];
-        barcodeEntry({
-            accountName: this.accountName,
-            agencyProType: this.agencyProType,
-            userWorkLocation: this.userWorkLocation,
-            barcode: this.barcode,
-            consumableorderdetailsRecordsLWC: JSON.stringify(this.data),
-            pageSizeLWC: this.pageSize,
-            pageTokenLWC: this.currentPageToken,
-            sortFieldLWC: this.sortBy,
-            sortOrderLWC: this.sortDirection
-        })
-            .then((result) => {
-                result = JSON.parse(JSON.stringify(result));
-                console.log('result ===>' + JSON.stringify(result));
-                if (result.status == 'Success1') {
-                    //鍒嗛〉start
-                    this.nextPageToken =
-                        result.entity.paginatedAccounts.nextPageToken;
-                    this.totalRecords =
-                        result.entity.paginatedAccounts.totalRecords;
-                    this.recordStart =
-                        result.entity.paginatedAccounts.recordStart;
-                    this.recordEnd = result.entity.paginatedAccounts.recordEnd;
-                    this.totalPages = Math.ceil(
-                        result.entity.paginatedAccounts.totalRecords /
-                            this.pageSize
-                    );
-                    console.log('this.totalPages = ' + this.totalPages);
-                    this.paginationVisibility =
-                        this.totalPages > 1 ? true : false;
-                    console.log('this.sortDirection = ' + this.sortDirection);
-                    //鍒嗛〉end
-                    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.pageCodeRecords = result.entity.pageCodeRecords;
-                    for (var i in this.pageCodeRecords) {
-                        this.pageCodeRecords[i]['Name__c'] =
-                            this.pageCodeRecords[i].Prod.Name__c;
-                        this.pageCodeRecords[i]['Box_Piece__c'] =
-                            this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
-                        this.pageCodeRecords[i]['Bar_Code__c'] =
-                            this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
-                    }
-                    this.data = JSON.parse(
-                        result.entity.consumableorderdetailsRecords
-                    );
-                    for (var i in this.data) {
-                        this.data[i]['key'] =
-                            this.data[i]['ProdId'] + this.data[i]['boxPiece'];
-                        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;
-                        if (this.data[i]['check']) {
-                            this.selectedRows.push(
-                                this.data[i].ProdId + this.data[i]['boxPiece']
-                            );
-                            console.log('selectedRows:' + this.selectedRows);
-                        }
-                    }
-                    this.iSinventory = result.entity.iSinventory;
-                    this.pandiandetailsMap = result.entity.pandiandetailsMap;
-                    this.reSet = result.entity.reSet1;
-                    console.log('iSinventory:' + this.iSinventory);
-                    this.showTable = true;
-                    this.showbutton = true;
-                    this.showSpinner = false;
-                    console.log('result褰曞叆= ' + JSON.stringify(result));
-                } else {
-                    if (result.status == 'Sucess') {
-                        //鍒嗛〉start
-                        this.nextPageToken =
-                            result.entity.paginatedAccounts.nextPageToken;
-                        this.totalRecords =
-                            result.entity.paginatedAccounts.totalRecords;
-                        this.recordStart =
-                            result.entity.paginatedAccounts.recordStart;
-                        this.recordEnd =
-                            result.entity.paginatedAccounts.recordEnd;
-                        this.totalPages = Math.ceil(
-                            result.entity.paginatedAccounts.totalRecords /
-                                this.pageSize
-                        );
-                        console.log('this.totalPages = ' + this.totalPages);
-                        this.paginationVisibility =
-                            this.totalPages > 1 ? true : false;
-                        console.log(
-                            'this.sortDirection = ' + this.sortDirection
-                        );
-                        //鍒嗛〉end
-                        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.pageCodeRecords = result.entity.pageCodeRecords;
-                        for (var i in this.pageCodeRecords) {
-                            this.pageCodeRecords[i]['Name__c'] =
-                                this.pageCodeRecords[i].Prod.Name__c;
-                            this.pageCodeRecords[i]['Box_Piece__c'] =
-                                this.pageCodeRecords[
-                                    i
-                                ].orderdetails2.Box_Piece__c;
-                            this.pageCodeRecords[i]['Bar_Code__c'] =
-                                this.pageCodeRecords[
-                                    i
-                                ].orderdetails2.Bar_Code__c;
-                        }
-                        this.data = JSON.parse(
-                            result.entity.consumableorderdetailsRecords
-                        );
-                        for (var i in this.data) {
-                            this.data[i]['key'] =
-                                this.data[i]['ProdId'] +
-                                this.data[i]['boxPiece'];
-                            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;
-                            if (this.data[i]['check']) {
-                                this.selectedRows.push(
-                                    this.data[i].ProdId +
-                                        this.data[i]['boxPiece']
-                                );
-                                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('result褰曞叆= ' + JSON.stringify(result));
-                    } else {
-                        console.log('Error:' + result.msg);
-                        this.showMyToast(result.msg, '', 'error');
-                        this.showSpinner = false;
-                        this.showTable = true;
-                    }
-                }
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
-            });
-    }
-    //鑾峰彇褰撳墠杈撳叆鍊�
-    handleChange(event) {
-        let value = event.detail.value;
-        console.log('value' + value);
-        this.barcode = value;
-    }
+		this.showSpinner = true;
+		oninit()
+			.then((result) => {
+				console.log("1112" + JSON.stringify(result));
+				result = JSON.parse(JSON.stringify(result));
+				console.log("result.status = " + result.status);
+				console.log("ConsumableorderdetailsRecordsview= " + result.entity.ConsumableorderdetailsRecordsview);
+				this.ConsumableorderdetailsRecordsview = JSON.parse(result.entity.ConsumableorderdetailsRecordsview);
+				this.consumableorderdetailsRecords = result.entity.consumableorderdetailsRecords;
+				console.log("consumableorderdetailsRecords= " + result.entity.consumableorderdetailsRecords);
+				console.log("浼犲弬绫诲瀷", typeof this.consumableorderdetailsRecords);
+				if (result.status == "Success") {
+					this.data = [];
+					this.data = this.ConsumableorderdetailsRecordsview[0];
+					console.log("this.data ==>" + JSON.stringify(this.data));
+					for (let i in this.data) {
+						this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+						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.showSpinner = false;
+					this.accountid = result.entity.accountid;
+					this.showTable = true;
+				} else {
+					this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+					this.showSpinner = false;
+				}
+			})
+			.catch((error) => {
+				console.log("error = " + JSON.stringify(error));
+				this.showSpinner = false;
+			});
+		//榛樿灞曞紑鏍�
+		this.activeSections = ["dataExpand"];
+		this.showTable = false;
+		this.showbutton = false;
+	}
 
-    getSelectedRows(event) {
-        let selectedRowsEvent = event.detail.selectedRows;
-        this.selectedRows = [];
-        for (var i in this.data) {
-            for (var j in selectedRowsEvent) {
-                if (
-                    this.data[i].ProdId + this.data[i]['boxPiece'] ==
-                    selectedRowsEvent[j].ProdId +
-                        selectedRowsEvent[j]['boxPiece']
-                ) {
-                    this.selectedRows.push(
-                        selectedRowsEvent[j].ProdId + this.data[i]['boxPiece']
-                    );
-                }
-            }
-            // for (var i in selectedRowsEvent) {
-            //     this.selectedRows.push(selectedRowsEvent[i].ProdId+this.data[i]["boxPiece"]);
-            // }
-        }
-    }
-    //瀵煎嚭涓篶sv
-    exportData() {
-        // Prepare a html table
-        let doc = '<table>';
-        // Add styles for the table
-        doc += '<style>';
-        doc += 'table,th,td{';
-        doc += '    border: 1px solid;';
-        doc += '    border-collapse: collapse;';
-        doc += '    font-weight: normal;';
-        doc += '    text-align: left;';
-        doc += '}';
-        doc += '</style>';
-        // Add all the Table Headers
-        doc += '<tr>';
-        this.columnHeader.forEach((element) => {
-            doc += '<th style="font-weight: bold";>' + element + '</th>';
-        });
-        doc += '</tr>';
-        // Add the data rows
-        this.codPageRecords.forEach((record) => {
-            doc += '<tr>';
-            doc += '<td>' + record.Name__c + '</td>';
-            doc += '<td>' + record.Box_Piece__c + '</td>';
-            doc += '<td>' + record.Bar_Code__c + '</td>';
-            doc += '<td>' + record.DiffReason + '</td>';
-            doc += '</tr>';
-        });
-        doc += '</table>';
-        console.log('doc' + doc);
-        var bom = '\uFEFF';
-        var element =
-            'data:application/vnd.ms-excel,' + encodeURIComponent(bom + doc);
-        let downloadElement = document.createElement('a');
-        downloadElement.href = element;
-        downloadElement.target = '_self';
-        // use .csv as extension on below line if you want to export data as csv
-        downloadElement.download = '鍦ㄥ簱璋冩暣涓�瑙�.xls';
-        document.body.appendChild(downloadElement);
-        downloadElement.click();
-    }
+	//褰曞叆barcode
+	barcodeEntrys() {
+		console.log('Test');
+		this.showTable = false;
+		this.showbutton = false;
+		this.showSpinner = true;
+		
+		//鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+		const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+		console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+		for (var i in this.data) {
+			this.data[i]["check"] = false;
+		}
+		for (var i in this.data) {
+			for (var j in selectedRows) {
+				if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRows[j].ProdId+ selectedRows[j]["boxPiece"]) {
+					this.data[i]["check"] = true;
+				}
+				// console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
+				console.log('selectedRows[j].ProdId+this.data[i]["boxPiece"]'+selectedRows[j].ProdId+selectedRows[j]["boxPiece"]);
 
-    //鑷畾涔塪ataType
+			}
+		}
+		// if(this.barcode == ''||this.barcode == null){
+		// 	this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
 
-    diffreasons(event) {
-        const numberDetail = event.detail;
-        // this.numberDetail = numberDetail;
-        console.log('numberDetail' + JSON.stringify(numberDetail));
-        for (var i in this.data) {
-            console.log('this.data[i]["key"]' + this.data[i]['key']);
-            console.log(
-                'numberDetail.data.ProdId+numberDetail.data.boxPiece' +
-                    numberDetail.data.ProdId +
-                    numberDetail.data.boxPiece
-            );
+		// }
+		console.log('this.data--->'+JSON.stringify(this.data));
+		console.log('this.currentPageToken'+this.currentPageToken);
+		this.selectedRows = [];
+		barcodeEntry({
+			accountName: this.accountName,
+			agencyProType: this.agencyProType,
+			userWorkLocation: this.userWorkLocation,
+			barcode: this.barcode,
+			consumableorderdetailsRecordsLWC: JSON.stringify(this.data),
+			pageSizeLWC: this.pageSize,
+			pageTokenLWC: this.currentPageToken,
+			sortFieldLWC: this.sortBy,
+			sortOrderLWC: this.sortDirection
 
-            if (
-                this.data[i]['key'] ==
-                numberDetail.data.ProdId + numberDetail.data.boxPiece
-            ) {
-                this.data[i]['DiffReason'] = numberDetail.data.DiffReason;
-            }
-        }
-        console.log(' this.data==>' + JSON.stringify(this.data));
-    }
+		})
+			.then((result) => {
+				result = JSON.parse(JSON.stringify(result));
+				console.log("result ===>" + JSON.stringify(result));
+				if (result.status == "Success1") {
+						//鍒嗛〉start
+						this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+						this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+						this.recordStart = result.entity.paginatedAccounts.recordStart;
+						this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+						this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+						console.log('this.totalPages = ' + this.totalPages);
+						this.paginationVisibility = this.totalPages > 1 ? true : false;
+						console.log('this.sortDirection = ' + this.sortDirection);
+						//鍒嗛〉end
+						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.pageCodeRecords = result.entity.pageCodeRecords;
+						for (var i in this.pageCodeRecords) {
+							this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
+							this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
+							this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
+						}
+						this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+						for (var i in this.data) {
+							this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+							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;
+							if (this.data[i]["check"]) {
+								this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
+								console.log("selectedRows:" + this.selectedRows);
+							}
+						}
+						this.iSinventory = result.entity.iSinventory;
+						this.pandiandetailsMap = result.entity.pandiandetailsMap;
+						this.reSet = result.entity.reSet1;
+						console.log("iSinventory:" + this.iSinventory);
+						this.showTable = true;
+						this.showbutton = true;
+						this.showSpinner = false;
+						console.log("result褰曞叆= " + JSON.stringify(result));
+				}
+				else {
+					if (result.status == "Sucess") {
+						//鍒嗛〉start
+						this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+						this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+						this.recordStart = result.entity.paginatedAccounts.recordStart;
+						this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+						this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+						console.log('this.totalPages = ' + this.totalPages);
+						this.paginationVisibility = this.totalPages > 1 ? true : false;
+						console.log('this.sortDirection = ' + this.sortDirection);
+						//鍒嗛〉end
+						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.pageCodeRecords = result.entity.pageCodeRecords;
+						for (var i in this.pageCodeRecords) {
+							this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
+							this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
+							this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
+						}
+						this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+						for (var i in this.data) {
+							this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+							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;
+							if (this.data[i]["check"]) {
+								this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
+								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("result褰曞叆= " + JSON.stringify(result));
+					} else {
+						console.log('Error:' + result.msg);
+						this.showMyToast(result.msg,'','error');
+						this.showSpinner = false;
+						this.showTable = true;
+					}
+				}
+			})
+			.catch((error) => {
+				console.log("error = " + JSON.stringify(error));
+			});
+	}
+	//鑾峰彇褰撳墠杈撳叆鍊�
+	handleChange(event) {
+		let value = event.detail.value;
+		console.log("value" + value);
+		this.barcode = value;
+	}
 
-    saveConfirm() {
-        console.log('杩涘叆鐩樼偣纭');
-        console.log('reSet' + this.reSet);
-        this.showSpinner = true;
-        console.log('pandiandetailsMap' + this.pandiandetailsMap);
-        //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-        const selectedRows = this.template
-            .querySelector('c-lex-custom-lightning-datatable')
-            .getSelectedRows();
-        console.log('selectedRows========> ' + JSON.stringify(selectedRows));
-        for (var i in this.data) {
-            this.data[i]['check'] = false;
-        }
-        for (var i in this.data) {
-            for (var j in selectedRows) {
-                if (
-                    this.data[i].ProdId + this.data[i]['boxPiece'] ==
-                    selectedRows[j].ProdId + selectedRows[j]['boxPiece']
-                ) {
-                    this.data[i]['check'] = true;
-                }
-                // console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
-                console.log(
-                    'selectedRows[j].ProdId+this.data[i]["boxPiece"]' +
-                        selectedRows[j].ProdId +
-                        selectedRows[j]['boxPiece']
-                );
-            }
-        }
+	getSelectedRows(event) {
+			let selectedRowsEvent = event.detail.selectedRows;
+		    this.selectedRows = [];
+			for (var i in this.data) {
+				for (var j in selectedRowsEvent) {
+					if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRowsEvent[j].ProdId+ selectedRowsEvent[j]["boxPiece"]) {
+						this.selectedRows.push(selectedRowsEvent[j].ProdId+this.data[i]["boxPiece"])
+					}
+				}
+		    // for (var i in selectedRowsEvent) {
+		    //     this.selectedRows.push(selectedRowsEvent[i].ProdId+this.data[i]["boxPiece"]);
+		    // }
+			}
+	}
+	//瀵煎嚭涓篶sv
+	exportData() {
+		// Prepare a html table
+		let doc = '<table>';
+		// Add styles for the table
+		doc += '<style>';
+		doc += 'table,th,td{';
+		doc += '    border: 1px solid;';
+		doc += '    border-collapse: collapse;';
+		doc += '    font-weight: normal;';
+		doc += '    text-align: left;';
+		doc += '}';
+		doc += '</style>';
+		// Add all the Table Headers
+		doc += '<tr>';
+		this.columnHeader.forEach(element => {
+			doc += '<th style="font-weight: bold";>' + element + '</th>'
+		});
+		doc += '</tr>';
+		// Add the data rows
+		this.codPageRecords.forEach(record => {
+			doc += '<tr>';
+			doc += '<td>' + record.Name__c + '</td>';
+			doc += '<td>' + record.Box_Piece__c + '</td>';
+			doc += '<td>' + record.Bar_Code__c + '</td>';
+			doc += '<td>' + record.DiffReason + '</td>';
+			doc += '</tr>';
+		});
+		doc += '</table>';
+		console.log('doc' + doc);
+		var bom = "\uFEFF";
+		var element = 'data:application/vnd.ms-excel,' + encodeURIComponent(bom + doc);
+		let downloadElement = document.createElement('a');
+		downloadElement.href = element;
+		downloadElement.target = '_self';
+		// use .csv as extension on below line if you want to export data as csv
+		downloadElement.download = '鍦ㄥ簱璋冩暣涓�瑙�.xls';
+		document.body.appendChild(downloadElement);
+		downloadElement.click();
+	}
 
-        // var el = this.template.querySelector("c-lex-custom-lightning-datatable");
-        // var selected = el.getSelectedRows();
-        // this.selectedData = selected;
-        // console.log("閫変腑鏁版嵁" + JSON.stringify(this.selectedData));
-        // console.log("reset" + JSON.stringify(this.reSet));
-        // console.log("reset1" + JSON.stringify(this.reSet1));
-        // console.log("r" + JSON.stringify(this.reSet1));
 
-        save({
-            iSinventory: this.iSinventory,
-            consumableorderdetailsRecordsLWC: JSON.stringify(this.data),
-            accountid: this.accountid,
-            agencyProType: this.agencyProType,
-            reSet: this.reSet,
-            pandiandetailsMap: this.pandiandetailsMap
-        })
-            .then((result) => {
-                result = JSON.parse(JSON.stringify(result));
-                console.log('result = ' + JSON.stringify(result));
-                console.log('111111');
+	//鑷畾涔塪ataType
 
-                if (result.status == 'Success') {
-                    let url = '/lexinventory?ESetid=' + result.entity.eSetId;
-                    this[NavigationMixin.Navigate]({
-                        type: 'standard__webPage',
-                        attributes: {
-                            url: url
-                        }
-                    });
-                    this.showSpinner = false;
-                    console.log('Id' + this.eSetId);
-                    // this.EditAble = true;
-                    // this.showcount = false;
-                } else {
-                    this.showMyToast('鐩樼偣澶辫触', result.msg, 'error');
-                    this.showSpinner = false;
-                }
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
-                this.showSpinner = false;
-            });
-    }
+	diffreasons(event) {
+		const numberDetail = event.detail;
+		// this.numberDetail = numberDetail;
+		console.log("numberDetail" + JSON.stringify(numberDetail));
+		for (var i in this.data) {
+			console.log('this.data[i]["key"]' + this.data[i]["key"]);
+			console.log('numberDetail.data.ProdId+numberDetail.data.boxPiece' + numberDetail.data.ProdId + numberDetail.data.boxPiece);
 
-    inits() {
-        this.showSpinner = true;
-        datainit({
-            eSetId: this.eSetId
-        })
-            .then((result) => {
-                result = JSON.parse(JSON.stringify(result));
-                console.log('鐩樼偣涓�瑙�===>' + JSON.stringify(result));
+			if (this.data[i]["key"] == numberDetail.data.ProdId + numberDetail.data.boxPiece) {
+				this.data[i]["DiffReason"] = numberDetail.data.DiffReason;
+			}
+		}
+		console.log(" this.data==>" + JSON.stringify(this.data));
+	}
 
-                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;
-                    }
-                }
-                this.showSpinner = false;
-                console.log('result鐩樼偣Id' + JSON.stringify(this.conId));
-                console.log('璋冩暣鏄庣粏' + JSON.stringify(this.adjustdata));
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
-                this.showSpinner = false;
-            });
-    }
-    //鍒嗛〉
-    handlePrevious() {
-        this.currentPageToken =
-            Number(this.currentPageToken) - Number(this.pageSize);
-        this.barcodeEntrys();
-    }
+	saveConfirm() {
+		console.log("杩涘叆鐩樼偣纭");
+		console.log('reSet' + this.reSet);
+		this.showSpinner = true;
+		console.log('pandiandetailsMap' + this.pandiandetailsMap);
+		//鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+		const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+		console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+		for (var i in this.data) {
+			this.data[i]["check"] = false;
+		}
+		for (var i in this.data) {
+			for (var j in selectedRows) {
+				if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRows[j].ProdId+ selectedRows[j]["boxPiece"]) {
+					this.data[i]["check"] = true;
+				}
+				// console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
+				console.log('selectedRows[j].ProdId+this.data[i]["boxPiece"]'+selectedRows[j].ProdId+selectedRows[j]["boxPiece"]);
 
-    handleNext() {
-        console.log('111');
-        this.currentPageToken =
-            Number(this.currentPageToken) + Number(this.pageSize);
-        this.barcodeEntrys();
-    }
-    handleFirst() {
-        this.currentPageToken = 0;
-        this.barcodeEntrys();
-    }
+			}
+		}
 
-    handleLast() {
-        this.currentPageToken =
-            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
-        this.barcodeEntrys();
-    }
+		// var el = this.template.querySelector("c-lex-custom-lightning-datatable");
+		// var selected = el.getSelectedRows();
+		// this.selectedData = selected;
+		// console.log("閫変腑鏁版嵁" + JSON.stringify(this.selectedData));
+		// console.log("reset" + JSON.stringify(this.reSet));
+		// console.log("reset1" + JSON.stringify(this.reSet1));
+		// console.log("r" + JSON.stringify(this.reSet1));
 
-    handlePageschange(event) {
-        console.log(event.detail);
-        this.pageSize = event.detail;
-        this.currentPageToken = 0;
-        this.barcodeEntrys();
-    }
-    get previousButtonDisabled() {
-        return this.currentPageToken === 0;
-    }
+		save({
+			iSinventory: this.iSinventory,
+			consumableorderdetailsRecordsLWC:JSON.stringify(this.data),
+			accountid: this.accountid,
+			agencyProType: this.agencyProType,
+			reSet: this.reSet,
+			pandiandetailsMap: this.pandiandetailsMap
+		})
+			.then((result) => {
+				result = JSON.parse(JSON.stringify(result));
+				console.log("result = " + JSON.stringify(result));
+				console.log("111111");
 
-    get nextButtonDisabled() {
-        return this.nextPageToken === undefined;
-    }
+				if (result.status == "Success") {
+					let url = "/lexinventory?ESetid=" + result.entity.eSetId;
+					this[NavigationMixin.Navigate]({
+						type: "standard__webPage",
+						attributes: {
+							url: url,
+						},
+					});
+					this.showSpinner = false;
+					console.log("Id" + this.eSetId);
+					// this.EditAble = true;
+					// this.showcount = false;
+				} else {
+					this.showMyToast('鐩樼偣澶辫触',result.msg,'error');
+					this.showSpinner = false;
+				}
+			})
+			.catch((error) => {
+				console.log("error = " + JSON.stringify(error));
+				this.showSpinner = false;
+			});
+	}
 
-    handleLoad2() {
-        console.log('handleLoad2');
+	inits() {
+		this.showSpinner = true
+		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;
+					}
+				}
+				this.showSpinner = false;
+				console.log("result鐩樼偣Id" + JSON.stringify(this.conId));
+				console.log("璋冩暣鏄庣粏" + JSON.stringify(this.adjustdata));
+			})
+			.catch((error) => {
+				console.log("error = " + JSON.stringify(error));
+				this.showSpinner = false;
+			});
+	}
+	//鍒嗛〉
+	handlePrevious() {
+		this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+		this.barcodeEntrys();
+	}
+
+	handleNext() {
+		console.log('111');
+		this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+		this.barcodeEntrys();
+	}
+	handleFirst() {
+		this.currentPageToken = 0;
+		this.barcodeEntrys();
+	}
+
+	handleLast() {
+		this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+		this.barcodeEntrys();
+	}
+
+	handlePageschange(event) {
+		console.log(event.detail);
+		this.pageSize = event.detail;
+		this.currentPageToken = 0;
+		this.barcodeEntrys();
+	}
+	get previousButtonDisabled() {
+		return this.currentPageToken === 0;
+	}
+
+	get nextButtonDisabled() {
+		return this.nextPageToken === undefined;
+	}
+
+	handleLoad2() {
+        console.log('handleLoad2')
         try {
             const style2 = document.createElement('style');
-            style2.innerText =
-                '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
+            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
             this.template.querySelector('.hideHelpText').appendChild(style2);
         } catch (error) {
             console.log(error);
         }
     }
-    showMyToast(title, message, variant) {
+	showMyToast(title, message, variant) {
         console.log('show custom message');
         var iconName = '';
         var content = '';
-        if (variant == 'success') {
-            iconName = 'utility:check';
-        } else {
-            iconName = 'utility:error';
+        if(variant == '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>';
+        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);
-    }
-}
+        this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+	}
+}
\ No newline at end of file

--
Gitblit v1.9.1