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';
|
|
//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: '过期库存',
|
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:
|
}
|
];
|
//盘点明细
|
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
|
}
|
];
|
|
//在库调整明细
|
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
|
}
|
];
|
|
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;
|
|
@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 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 = [];
|
|
//导出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');
|
this.stylesLoaded = true;
|
})
|
.catch((error) => {
|
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;
|
}
|
|
//录入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']
|
);
|
}
|
}
|
// if(this.barcode == ''||this.barcode == null){
|
// this.showMyToast('获取失败','请输入BarCode号','error');
|
|
// }
|
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;
|
}
|
|
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"]);
|
// }
|
}
|
}
|
//导出为csv
|
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();
|
}
|
|
//自定义dataType
|
|
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
|
);
|
|
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));
|
}
|
|
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']
|
);
|
}
|
}
|
|
// 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');
|
|
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;
|
});
|
}
|
|
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}';
|
this.template.querySelector('.hideHelpText').appendChild(style2);
|
} catch (error) {
|
console.log(error);
|
}
|
}
|
showMyToast(title, message, variant) {
|
console.log('show custom message');
|
var iconName = '';
|
var content = '';
|
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>';
|
}
|
this.template
|
.querySelector('c-common-toast')
|
.showToast(variant, content, iconName, 10000);
|
}
|
}
|