作者 xudada

兼容C6导入EXCEL

... ... @@ -2980,90 +2980,142 @@ Handling Information
const worksheetName = '格式化打印'; // 指定工作表名称
const worksheet = workbook.Sheets[worksheetName];
if (worksheet) {
const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '单元格不存在';
const A16 = (worksheet['A16'] && worksheet['A16'].v) || '单元格不存在';
const C16 = (worksheet['C16'] && worksheet['C16'].v) || '单元格不存在';
const K16 = (worksheet['K16'] && worksheet['K16'].v) || '单元格不存在';
const L16 = (worksheet['L16'] && worksheet['L16'].v) || '单元格不存在';
const S16 = (worksheet['S16'] && worksheet['S16'].v) || '单元格不存在';
const I18 = (worksheet['I18'] && worksheet['I18'].v) || '单元格不存在';
const M18 = (worksheet['M18'] && worksheet['M18'].v) || '单元格不存在';
const A20 = (worksheet['A20'] && worksheet['A20'].v) || '单元格不存在';
const A22 = (worksheet['A22'] && worksheet['A22'].v) || '单元格不存在';
const C22 = (worksheet['C22'] && worksheet['C22'].v) || '单元格不存在';
const K22 = (worksheet['K22'] && worksheet['K22'].v) || '单元格不存在';
const P22 = (worksheet['P22'] && worksheet['P22'].v) || '单元格不存在';
const U22 = (worksheet['U22'] && worksheet['U22'].v) || '单元格不存在';
const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '单元格不存在';
const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '单元格不存在';
const O34 = (worksheet['O34'] && worksheet['O34'].v) || '单元格不存在';
//const O38 = (worksheet['O38'] && worksheet['O38'].v) || '单元格不存在';
const X38 = (worksheet['X38'] && worksheet['X38'].v) || '单元格不存在';
const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '单元格不存在';
const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '';
const A16 = (worksheet['A16'] && worksheet['A16'].v) || '';
const C16 = (worksheet['C16'] && worksheet['C16'].v) || '';
const K16 = (worksheet['K16'] && worksheet['K16'].v) || '';
const L16 = (worksheet['L16'] && worksheet['L16'].v) || '';
const S16 = (worksheet['S16'] && worksheet['S16'].v) || '';
const I18 = (worksheet['I18'] && worksheet['I18'].v) || '';
const M18 = (worksheet['M18'] && worksheet['M18'].v) || '';
const A20 = (worksheet['A20'] && worksheet['A20'].v) || '';
const A22 = (worksheet['A22'] && worksheet['A22'].v) || '';
const C22 = (worksheet['C22'] && worksheet['C22'].v) || '';
const K22 = (worksheet['K22'] && worksheet['K22'].v) || '';
const P22 = (worksheet['P22'] && worksheet['P22'].v) || '';
const U22 = (worksheet['U22'] && worksheet['U22'].v) || '';
const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '';
const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '';
const O34 = (worksheet['O34'] && worksheet['O34'].v) || '';
//const O38 = (worksheet['O38'] && worksheet['O38'].v) || '';
const X38 = (worksheet['X38'] && worksheet['X38'].v) || '';
const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '';
const inFlightInfo = I18.split('/');
const outFlightInfo = M18.split('/');
const inFlightNumber = inFlightInfo[0];
const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';
const outFlightNumber = outFlightInfo[0];
const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : '';
if(I18.includes("/")){
const inFlightInfo = I18.split('/');
const outFlightInfo = M18.split('/');
const inFlightNumber = inFlightInfo[0];
const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';
const outFlightNumber = outFlightInfo[0];
const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : '';
const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
//const signatureDate = parseCustomDate(O38);
const formattedAF23 = formatAF23(AF23);
const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
//const signatureDate = parseCustomDate(O38);
const formattedAF23 = formatAF23(AF23);
this.fileContent = {
AF1: AF1,
A16: A16,
C16: C16,
K16: K16,
L16: L16,
S16: S16,
inFlightNumber: inFlightNumber,
inFlightDate: inFlightDate,
outFlightNumber: outFlightNumber,
outFlightDate: outFlightDate,
SSRInfo: SSRInfo,
A22: A22,
C22: C22,
K22: K22,
P22: P22,
U22: U22,
AF22: cleanString(AF22),
AF23: formattedAF23,
O34: cleanString(O34),
//signatureDate: signatureDate,
X38: X38,
AF38: cleanString(AF38),
};
this.fileContent = {
AF1: AF1,
A16: A16,
C16: C16,
K16: K16,
L16: L16,
S16: S16,
inFlightNumber: inFlightNumber,
inFlightDate: inFlightDate,
outFlightNumber: outFlightNumber,
outFlightDate: outFlightDate,
SSRInfo: SSRInfo,
A22: A22,
C22: C22,
K22: K22,
P22: P22,
U22: U22,
AF22: cleanString(AF22),
AF23: formattedAF23,
O34: cleanString(O34),
//signatureDate: signatureDate,
X38: X38,
AF38: cleanString(AF38),
};
this.form.bill.waybillNum=this.fileContent.AF1;
this.form.cvd.cvd_currency_code=this.fileContent.S16;
this.form.rtg.destinationAirport=this.fileContent.A16;
this.form.rtg.destinationCarrier=this.fileContent.C16;
this.form.rtg.onwardAirport=this.fileContent.K16;
this.form.rtg.onwardCarrier=this.fileContent.L16;
this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);
this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);
this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);
this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);
this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);
this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);
this.ssr_content=this.fileContent.SSRInfo;
this.form.bill.quantity_picecs=this.fileContent.A22;
this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
this.form.rtd.rtd_rate_charge=this.fileContent.P22;
this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);
this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
this.form.cer.cer_signature=this.fileContent.O34;
this.form.isu.isu_signature=this.fileContent.AF38;
this.dimension_textarea=this.fileContent.AF23;
this.convertAndCalculateVolume();
this.form.isu.isu_day_mounth_year=this.formattedDate();
}else{
//const outFlightInfo = M18.split('/');
//const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[2].split(' ')[0] : '';
const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
//const signatureDate = parseCustomDate(O38);
const formattedAF23 = formatAF23(AF23);
this.form.bill.waybillNum=this.fileContent.AF1;
this.form.cvd.cvd_currency_code=this.fileContent.S16;
this.form.rtg.destinationAirport=this.fileContent.A16;
this.form.rtg.destinationCarrier=this.fileContent.C16;
this.form.rtg.onwardAirport=this.fileContent.K16;
this.form.rtg.onwardCarrier=this.fileContent.L16;
this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);
this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);
this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);
this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);
this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);
this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);
this.ssr_content=this.fileContent.SSRInfo;
this.form.bill.quantity_picecs=this.fileContent.A22;
this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
this.form.rtd.rtd_rate_charge=this.fileContent.P22;
this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);
this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.cer.cer_signature=this.fileContent.O34;
this.form.isu.isu_signature=this.fileContent.AF38;
this.dimension_textarea=this.fileContent.AF23;
this.convertAndCalculateVolume();
this.fileContent = {
AF1: AF1,
A16: A16,
C16: C16,
K16: K16,
L16: L16,
S16: S16,
//outFlightDate: outFlightDate,
I18:I18,
SSRInfo: SSRInfo,
A22: A22,
C22: C22,
K22: K22,
P22: P22,
U22: U22,
AF22: cleanString(AF22),
AF23: formattedAF23,
O34: cleanString(O34),
//signatureDate: signatureDate,
X38: X38,
AF38: cleanString(AF38),
};
this.form.bill.waybillNum=this.fileContent.AF1;
this.form.cvd.cvd_currency_code=this.fileContent.S16;
this.form.rtg.destinationAirport=this.fileContent.A16;
this.form.rtg.destinationCarrier=this.fileContent.C16;
this.form.rtg.onwardAirport=this.fileContent.K16;
this.form.rtg.onwardCarrier=this.fileContent.L16;
this.form.flt.cariier=this.fileContent.I18.substring(0,2);
this.form.flt.flightNumber=this.fileContent.I18.substring(2);
this.ssr_content=this.fileContent.SSRInfo;
this.form.bill.quantity_picecs=this.fileContent.A22;
this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
this.form.rtd.rtd_rate_charge='';
this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
this.form.cer.cer_signature=this.fileContent.O34;
this.form.isu.isu_signature=this.fileContent.AF38;
this.dimension_textarea=this.fileContent.AF23;
this.convertAndCalculateVolume();
this.form.isu.isu_day_mounth_year=this.formattedDate();
}
this.form.isu.isu_day_mounth_year=this.formattedDate();
} else {
this.fileContent = { AF1: '工作表不存在' };
}
... ...