作者 xudada

兼容C6导入EXCEL

@@ -2980,90 +2980,142 @@ Handling Information @@ -2980,90 +2980,142 @@ Handling Information
2980 const worksheetName = '格式化打印'; // 指定工作表名称 2980 const worksheetName = '格式化打印'; // 指定工作表名称
2981 const worksheet = workbook.Sheets[worksheetName]; 2981 const worksheet = workbook.Sheets[worksheetName];
2982 if (worksheet) { 2982 if (worksheet) {
2983 - const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '单元格不存在';  
2984 - const A16 = (worksheet['A16'] && worksheet['A16'].v) || '单元格不存在';  
2985 - const C16 = (worksheet['C16'] && worksheet['C16'].v) || '单元格不存在';  
2986 - const K16 = (worksheet['K16'] && worksheet['K16'].v) || '单元格不存在';  
2987 - const L16 = (worksheet['L16'] && worksheet['L16'].v) || '单元格不存在';  
2988 - const S16 = (worksheet['S16'] && worksheet['S16'].v) || '单元格不存在';  
2989 - const I18 = (worksheet['I18'] && worksheet['I18'].v) || '单元格不存在';  
2990 - const M18 = (worksheet['M18'] && worksheet['M18'].v) || '单元格不存在';  
2991 - const A20 = (worksheet['A20'] && worksheet['A20'].v) || '单元格不存在';  
2992 - const A22 = (worksheet['A22'] && worksheet['A22'].v) || '单元格不存在';  
2993 - const C22 = (worksheet['C22'] && worksheet['C22'].v) || '单元格不存在';  
2994 - const K22 = (worksheet['K22'] && worksheet['K22'].v) || '单元格不存在';  
2995 - const P22 = (worksheet['P22'] && worksheet['P22'].v) || '单元格不存在';  
2996 - const U22 = (worksheet['U22'] && worksheet['U22'].v) || '单元格不存在';  
2997 - const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '单元格不存在';  
2998 - const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '单元格不存在';  
2999 - const O34 = (worksheet['O34'] && worksheet['O34'].v) || '单元格不存在';  
3000 - //const O38 = (worksheet['O38'] && worksheet['O38'].v) || '单元格不存在';  
3001 - const X38 = (worksheet['X38'] && worksheet['X38'].v) || '单元格不存在';  
3002 - const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '单元格不存在'; 2983 + const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '';
  2984 + const A16 = (worksheet['A16'] && worksheet['A16'].v) || '';
  2985 + const C16 = (worksheet['C16'] && worksheet['C16'].v) || '';
  2986 + const K16 = (worksheet['K16'] && worksheet['K16'].v) || '';
  2987 + const L16 = (worksheet['L16'] && worksheet['L16'].v) || '';
  2988 + const S16 = (worksheet['S16'] && worksheet['S16'].v) || '';
  2989 + const I18 = (worksheet['I18'] && worksheet['I18'].v) || '';
  2990 + const M18 = (worksheet['M18'] && worksheet['M18'].v) || '';
  2991 + const A20 = (worksheet['A20'] && worksheet['A20'].v) || '';
  2992 + const A22 = (worksheet['A22'] && worksheet['A22'].v) || '';
  2993 + const C22 = (worksheet['C22'] && worksheet['C22'].v) || '';
  2994 + const K22 = (worksheet['K22'] && worksheet['K22'].v) || '';
  2995 + const P22 = (worksheet['P22'] && worksheet['P22'].v) || '';
  2996 + const U22 = (worksheet['U22'] && worksheet['U22'].v) || '';
  2997 + const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '';
  2998 + const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '';
  2999 + const O34 = (worksheet['O34'] && worksheet['O34'].v) || '';
  3000 + //const O38 = (worksheet['O38'] && worksheet['O38'].v) || '';
  3001 + const X38 = (worksheet['X38'] && worksheet['X38'].v) || '';
  3002 + const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '';
3003 3003
3004 - const inFlightInfo = I18.split('/');  
3005 - const outFlightInfo = M18.split('/');  
3006 - const inFlightNumber = inFlightInfo[0];  
3007 - const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';  
3008 - const outFlightNumber = outFlightInfo[0];  
3009 - const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : ''; 3004 + if(I18.includes("/")){
  3005 + const inFlightInfo = I18.split('/');
  3006 + const outFlightInfo = M18.split('/');
  3007 + const inFlightNumber = inFlightInfo[0];
  3008 + const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';
  3009 + const outFlightNumber = outFlightInfo[0];
  3010 + const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : '';
3010 3011
3011 - const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');  
3012 - //const signatureDate = parseCustomDate(O38);  
3013 - const formattedAF23 = formatAF23(AF23); 3012 + const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
  3013 + //const signatureDate = parseCustomDate(O38);
  3014 + const formattedAF23 = formatAF23(AF23);
3014 3015
3015 - this.fileContent = {  
3016 - AF1: AF1,  
3017 - A16: A16,  
3018 - C16: C16,  
3019 - K16: K16,  
3020 - L16: L16,  
3021 - S16: S16,  
3022 - inFlightNumber: inFlightNumber,  
3023 - inFlightDate: inFlightDate,  
3024 - outFlightNumber: outFlightNumber,  
3025 - outFlightDate: outFlightDate,  
3026 - SSRInfo: SSRInfo,  
3027 - A22: A22,  
3028 - C22: C22,  
3029 - K22: K22,  
3030 - P22: P22,  
3031 - U22: U22,  
3032 - AF22: cleanString(AF22),  
3033 - AF23: formattedAF23,  
3034 - O34: cleanString(O34),  
3035 - //signatureDate: signatureDate,  
3036 - X38: X38,  
3037 - AF38: cleanString(AF38),  
3038 - }; 3016 + this.fileContent = {
  3017 + AF1: AF1,
  3018 + A16: A16,
  3019 + C16: C16,
  3020 + K16: K16,
  3021 + L16: L16,
  3022 + S16: S16,
  3023 + inFlightNumber: inFlightNumber,
  3024 + inFlightDate: inFlightDate,
  3025 + outFlightNumber: outFlightNumber,
  3026 + outFlightDate: outFlightDate,
  3027 + SSRInfo: SSRInfo,
  3028 + A22: A22,
  3029 + C22: C22,
  3030 + K22: K22,
  3031 + P22: P22,
  3032 + U22: U22,
  3033 + AF22: cleanString(AF22),
  3034 + AF23: formattedAF23,
  3035 + O34: cleanString(O34),
  3036 + //signatureDate: signatureDate,
  3037 + X38: X38,
  3038 + AF38: cleanString(AF38),
  3039 + };
  3040 + this.form.bill.waybillNum=this.fileContent.AF1;
  3041 + this.form.cvd.cvd_currency_code=this.fileContent.S16;
  3042 + this.form.rtg.destinationAirport=this.fileContent.A16;
  3043 + this.form.rtg.destinationCarrier=this.fileContent.C16;
  3044 + this.form.rtg.onwardAirport=this.fileContent.K16;
  3045 + this.form.rtg.onwardCarrier=this.fileContent.L16;
  3046 + this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);
  3047 + this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);
  3048 + this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);
  3049 + this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);
  3050 + this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);
  3051 + this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);
  3052 + this.ssr_content=this.fileContent.SSRInfo;
  3053 + this.form.bill.quantity_picecs=this.fileContent.A22;
  3054 + this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
  3055 + this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
  3056 + this.form.rtd.rtd_rate_charge=this.fileContent.P22;
  3057 + this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);
  3058 + this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);
  3059 + this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);
  3060 + this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
  3061 + this.form.cer.cer_signature=this.fileContent.O34;
  3062 + this.form.isu.isu_signature=this.fileContent.AF38;
  3063 + this.dimension_textarea=this.fileContent.AF23;
  3064 + this.convertAndCalculateVolume();
  3065 +
  3066 + this.form.isu.isu_day_mounth_year=this.formattedDate();
  3067 + }else{
  3068 + //const outFlightInfo = M18.split('/');
  3069 + //const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[2].split(' ')[0] : '';
  3070 +
  3071 + const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
  3072 + //const signatureDate = parseCustomDate(O38);
  3073 + const formattedAF23 = formatAF23(AF23);
3039 3074
3040 - this.form.bill.waybillNum=this.fileContent.AF1;  
3041 - this.form.cvd.cvd_currency_code=this.fileContent.S16;  
3042 - this.form.rtg.destinationAirport=this.fileContent.A16;  
3043 - this.form.rtg.destinationCarrier=this.fileContent.C16;  
3044 - this.form.rtg.onwardAirport=this.fileContent.K16;  
3045 - this.form.rtg.onwardCarrier=this.fileContent.L16;  
3046 - this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);  
3047 - this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);  
3048 - this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);  
3049 - this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);  
3050 - this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);  
3051 - this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);  
3052 - this.ssr_content=this.fileContent.SSRInfo;  
3053 - this.form.bill.quantity_picecs=this.fileContent.A22;  
3054 - this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);  
3055 - this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);  
3056 - this.form.rtd.rtd_rate_charge=this.fileContent.P22;  
3057 - this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);  
3058 - this.form.rtd.rtd_goods_DES=this.fileContent.AF22;  
3059 - this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);  
3060 - this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);  
3061 - this.form.cer.cer_signature=this.fileContent.O34;  
3062 - this.form.isu.isu_signature=this.fileContent.AF38;  
3063 - this.dimension_textarea=this.fileContent.AF23;  
3064 - this.convertAndCalculateVolume(); 3075 + this.fileContent = {
  3076 + AF1: AF1,
  3077 + A16: A16,
  3078 + C16: C16,
  3079 + K16: K16,
  3080 + L16: L16,
  3081 + S16: S16,
  3082 + //outFlightDate: outFlightDate,
  3083 + I18:I18,
  3084 + SSRInfo: SSRInfo,
  3085 + A22: A22,
  3086 + C22: C22,
  3087 + K22: K22,
  3088 + P22: P22,
  3089 + U22: U22,
  3090 + AF22: cleanString(AF22),
  3091 + AF23: formattedAF23,
  3092 + O34: cleanString(O34),
  3093 + //signatureDate: signatureDate,
  3094 + X38: X38,
  3095 + AF38: cleanString(AF38),
  3096 + };
  3097 + this.form.bill.waybillNum=this.fileContent.AF1;
  3098 + this.form.cvd.cvd_currency_code=this.fileContent.S16;
  3099 + this.form.rtg.destinationAirport=this.fileContent.A16;
  3100 + this.form.rtg.destinationCarrier=this.fileContent.C16;
  3101 + this.form.rtg.onwardAirport=this.fileContent.K16;
  3102 + this.form.rtg.onwardCarrier=this.fileContent.L16;
  3103 + this.form.flt.cariier=this.fileContent.I18.substring(0,2);
  3104 + this.form.flt.flightNumber=this.fileContent.I18.substring(2);
  3105 + this.ssr_content=this.fileContent.SSRInfo;
  3106 + this.form.bill.quantity_picecs=this.fileContent.A22;
  3107 + this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
  3108 + this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
  3109 + this.form.rtd.rtd_rate_charge='';
  3110 + this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
  3111 + this.form.cer.cer_signature=this.fileContent.O34;
  3112 + this.form.isu.isu_signature=this.fileContent.AF38;
  3113 + this.dimension_textarea=this.fileContent.AF23;
  3114 + this.convertAndCalculateVolume();
  3115 +
  3116 + this.form.isu.isu_day_mounth_year=this.formattedDate();
  3117 + }
3065 3118
3066 - this.form.isu.isu_day_mounth_year=this.formattedDate();  
3067 } else { 3119 } else {
3068 this.fileContent = { AF1: '工作表不存在' }; 3120 this.fileContent = { AF1: '工作表不存在' };
3069 } 3121 }