ソースを参照

收支凭证导入优化

hxh 4 ヶ月 前
コミット
79fbc9c559

+ 27 - 13
src/custom/restcontroller/sale/cashbill/IncomeExportExcel.java

@@ -105,7 +105,8 @@ public class IncomeExportExcel {
         sheet.setColumnWidth((short) 3, (short) 5500);// 设置 分类 宽度
         sheet.setColumnWidth((short) 4, (short) 5500);// 设置 分类明细 宽度
         sheet.setColumnWidth((short) 5, (short) 5500);// 设置 单据日期 宽度
-        sheet.setColumnWidth((short) 3, (short) 11000);// 设置 备注 宽度
+        sheet.setColumnWidth((short) 6, (short) 5500);// 设置 单据日期 宽度
+        sheet.setColumnWidth((short) 7, (short) 11000);// 设置 备注 宽度
     }
     
     
@@ -123,6 +124,7 @@ public class IncomeExportExcel {
         sheet.setColumnWidth((short) 5, (short) 5500);// 设置 单据日期 宽度
         sheet.setColumnWidth((short) 6, (short) 11000);// 设置 备注 宽度
         sheet.setColumnWidth((short) 7, (short) 8000);// 设置 错误信息 宽度
+        sheet.setColumnWidth((short) 8, (short) 8000);// 设置 错误信息 宽度
     }
     /**
      * 2022-07-14 17:42:03
@@ -162,7 +164,7 @@ public class IncomeExportExcel {
         cellStyle4.setDataFormat(format.getFormat("@"));
 
    	 /*第一行*/
-       sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
+       sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7));
 
        /*第一行塞值*/
        row = sheet.createRow(0);
@@ -170,7 +172,7 @@ public class IncomeExportExcel {
        cell.setCellStyle(cellStyle4);
        cell.setCellValue("收入凭证导入");
        /*第二行*/
-       sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
+       sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 7));
        /*第二行塞值*/
        row = sheet.createRow(1);
        cell = row.createCell(0);// ID
@@ -193,18 +195,22 @@ public class IncomeExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类(必填)");
+        cell.setCellValue("优惠金额");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类明细");
+        cell.setCellValue("分类(必填)");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("单据日期");
+        cell.setCellValue("分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle2);
+        cell.setCellValue("单据日期");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle2);
         cell.setCellValue("备注");
        
 
@@ -225,18 +231,22 @@ public class IncomeExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("货款");
+        cell.setCellValue("0");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("分类明细");
+        cell.setCellValue("货款");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("2024-07-01");
+        cell.setCellValue("分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle3);
+        cell.setCellValue("2024-07-01");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle3);
         cell.setCellValue("备注");
         
     }
@@ -298,21 +308,25 @@ public class IncomeExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类(必填)");
+        cell.setCellValue("优惠金额");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue(" 分类明细");
+        cell.setCellValue("分类(必填)");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue(" 单据日期");
+        cell.setCellValue(" 分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle2);
+        cell.setCellValue(" 单据日期");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle2);
         cell.setCellValue("备注");
 
-          cell = row.createCell(7);
+          cell = row.createCell(8);
           cell.setCellStyle(cellStyle2);
           cell.setCellValue("错误信息");         
       

+ 27 - 13
src/custom/restcontroller/sale/cashbill/PayExportExcel.java

@@ -105,7 +105,8 @@ public class PayExportExcel {
         sheet.setColumnWidth((short) 3, (short) 5500);// 设置 分类 宽度
         sheet.setColumnWidth((short) 4, (short) 5500);// 设置 分类明细 宽度
         sheet.setColumnWidth((short) 5, (short) 5500);// 设置 单据日期 宽度
-        sheet.setColumnWidth((short) 6, (short) 11000);// 设置 备注 宽度
+        sheet.setColumnWidth((short) 6, (short) 5500);// 设置 单据日期 宽度
+        sheet.setColumnWidth((short) 7, (short) 11000);// 设置 备注 宽度
     }
     
     
@@ -123,6 +124,7 @@ public class PayExportExcel {
         sheet.setColumnWidth((short) 5, (short) 5500);// 设置 单据日期 宽度
         sheet.setColumnWidth((short) 6, (short) 11000);// 设置 备注 宽度
         sheet.setColumnWidth((short) 7, (short) 8000);// 设置 错误信息 宽度
+        sheet.setColumnWidth((short) 8, (short) 8000);// 设置 错误信息 宽度
     }
     /**
      * 2022-07-14 17:42:03
@@ -162,7 +164,7 @@ public class PayExportExcel {
         cellStyle4.setDataFormat(format.getFormat("@"));
 
    	 /*第一行*/
-       sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
+       sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7));
 
        /*第一行塞值*/
        row = sheet.createRow(0);
@@ -170,7 +172,7 @@ public class PayExportExcel {
        cell.setCellStyle(cellStyle4);
        cell.setCellValue("支出凭证导入");
        /*第二行*/
-       sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
+       sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 7));
        /*第二行塞值*/
        row = sheet.createRow(1);
        cell = row.createCell(0);// ID
@@ -193,18 +195,22 @@ public class PayExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类(必填)");
+        cell.setCellValue("优惠金额");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类明细");
+        cell.setCellValue("分类(必填)");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("单据日期");
+        cell.setCellValue("分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle2);
+        cell.setCellValue("单据日期");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle2);
         cell.setCellValue("备注");
        
 
@@ -225,18 +231,22 @@ public class PayExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("货款");
+        cell.setCellValue("0");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("分类明细");
+        cell.setCellValue("货款");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("2024-07-01");
+        cell.setCellValue("分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle3);
+        cell.setCellValue("2024-07-01");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle3);
         cell.setCellValue("备注");
         
     }
@@ -298,21 +308,25 @@ public class PayExportExcel {
 
         cell = row.createCell(3);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue("分类(必填)");
+        cell.setCellValue("优惠金额");
 
         cell = row.createCell(4);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue(" 分类明细");
+        cell.setCellValue("分类(必填)");
 
         cell = row.createCell(5);
         cell.setCellStyle(cellStyle2);
-        cell.setCellValue(" 单据日期");
+        cell.setCellValue(" 分类明细");
 
         cell = row.createCell(6);
         cell.setCellStyle(cellStyle2);
+        cell.setCellValue(" 单据日期");
+
+        cell = row.createCell(7);
+        cell.setCellStyle(cellStyle2);
         cell.setCellValue("备注");
 
-          cell = row.createCell(7);
+          cell = row.createCell(8);
           cell.setCellStyle(cellStyle2);
           cell.setCellValue("错误信息");         
       

+ 11 - 6
src/custom/restcontroller/sale/cashbill/cashbill.java

@@ -99,7 +99,7 @@ public class cashbill extends Controller {
             // 华为云
             e = getExcelAttachment(content.getLong("attachmentid"));
             // 本地
-            //e = getPostExcelFactory();
+            //e = getPostExcel();
 
             // Rows keyRow = dbConnect.runSqlQuery("select fagentnum,faddress from tagents
             // where 1=2");
@@ -109,6 +109,7 @@ public class cashbill extends Controller {
             keys.add("agentnum");
             keys.add("accountname");
             keys.add("amount");
+            keys.add("discountamount");
             keys.add("type");
             keys.add("typemx");
             keys.add("period");
@@ -226,6 +227,7 @@ public class cashbill extends Controller {
                     sqlFactoryupload.addParameter("siteid", siteid);
                     sqlFactoryupload.addParameter("remarks", row.getString("remarks"));
                     sqlFactoryupload.addParameter("amount", row.getDouble("amount"));
+                    sqlFactoryupload.addParameter("discountamount", StringUtils.isBlank(row.getString("discountamount"))?0:row.getDouble("discountamount"));
                     sqlFactoryupload.addParameter("subclass", row.getString("typemx"));
                     sqlFactoryupload.addParameter("class", row.getString("type"));
                     sqlFactoryupload.addParameter("userid", userid);
@@ -234,7 +236,6 @@ public class cashbill extends Controller {
                     sqlFactoryupload.addParameter("ownerid", 0);
                     sqlFactoryupload.addParameter("source", "");
                     sqlFactoryupload.addParameter("sourcenote", "");
-                    sqlFactoryupload.addParameter("discountamount", 0);
                     if (StringUtils.isBlank(row.getString("period"))) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         sqlFactoryupload.addParameter("billdate", sdf.format(new Date()));
@@ -254,6 +255,7 @@ public class cashbill extends Controller {
                 map.put("agentnum", "经销商编码");
                 map.put("accountname", "账户名称");
                 map.put("amount", "金额");
+                map.put("discountamount", "优惠金额");
                 map.put("type", "分类");
                 map.put("typemx", "分类明细");
                 map.put("period", "单据日期");
@@ -264,6 +266,7 @@ public class cashbill extends Controller {
                 colNameList.add("agentnum");
                 colNameList.add("accountname");
                 colNameList.add("amount");
+                colNameList.add("discountamount");
                 colNameList.add("type");
                 colNameList.add("typemx");
                 colNameList.add("period");
@@ -272,6 +275,7 @@ public class cashbill extends Controller {
                 keytypemap.put("agentnum", String.class);
                 keytypemap.put("accountname", String.class);
                 keytypemap.put("amount", String.class);
+                keytypemap.put("discountamount", String.class);
                 keytypemap.put("type", String.class);
                 keytypemap.put("typemx", String.class);
                 keytypemap.put("period", String.class);
@@ -674,7 +678,7 @@ public class cashbill extends Controller {
                 } else {
                     BigDecimal canuseamount = rowsaccountbalance.get(0).getBigDecimal("creditquota").add(rowsaccountbalance.get(0).getBigDecimal("balance")).add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
                     if ((rows.get(0).getBigDecimal("amount").add(canuseamount)).compareTo(BigDecimal.ZERO) == -1 && rows.get(0).getBigDecimal("amount").compareTo(BigDecimal.ZERO) <= 0) {
-                        return getErrReturnObject().setErrMsg("该营销账户可用余额不足,收入凭证无法审核").toString();
+                        //return getErrReturnObject().setErrMsg("该营销账户可用余额不足,收入凭证无法审核").toString();
                     }
                     balance = rows.get(0).getBigDecimal("amount").add(rowsaccountbalance.get(0).getBigDecimal("balance"));
                     discountamount = rows.get(0).getBigDecimal("discountamount").add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
@@ -779,7 +783,7 @@ public class cashbill extends Controller {
                 } else {
                     BigDecimal canuseamount = rowsaccountbalance.get(0).getBigDecimal("creditquota").add(rowsaccountbalance.get(0).getBigDecimal("balance")).add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
                     if (rows.get(0).getBigDecimal("amount").compareTo(canuseamount) == 1) {
-                        return getErrReturnObject().setErrMsg("该营销账户可用余额不足,收入凭证无法反审核").toString();
+                        //return getErrReturnObject().setErrMsg("该营销账户可用余额不足,收入凭证无法反审核").toString();
                     }
                     BigDecimal newbalance = rowsaccountbalance.get(0).getBigDecimal("balance").subtract(rows.get(0).getBigDecimal("amount"));
                     balance = newbalance;
@@ -917,6 +921,7 @@ public class cashbill extends Controller {
         titleMap.put("type_ch", "收支类型");
         titleMap.put("accountname", "账户名称");
         titleMap.put("amount", "收支金额");
+        titleMap.put("discountamount", "优惠金额");
         titleMap.put("remarks", "备注");
         titleMap.put("source", "凭证来源");
         titleMap.put("checkby", "审核人");
@@ -1239,7 +1244,7 @@ public class cashbill extends Controller {
                 } else {
                     datarow.createCell(i1).setCellValue(row.getString((String) keylist.get(i1)));
                 }
-                if (i1 == 7) {
+                if (i1 == 8) {
                     datarow.getCell(i1).setCellStyle(xssfCellStyle1);
                 }
             }
@@ -1282,7 +1287,7 @@ public class cashbill extends Controller {
                 } else {
                     datarow.createCell(i1).setCellValue(row.getString((String) keylist.get(i1)));
                 }
-                if (i1 == 7) {
+                if (i1 == 8) {
                     datarow.getCell(i1).setCellStyle(xssfCellStyle1);
                 }
             }