Bläddra i källkod

LY 工作票导出

ly 2 år sedan
förälder
incheckning
d396c8e7a0

+ 185 - 30
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -224,16 +224,16 @@ public class TInvoiceBookingworkticketController extends BaseController
         row0.createCell(10).setCellValue("变更原因");row0.getCell(10).setCellStyle(style);
         row0.createCell(11).setCellValue("作业是否取消");row0.getCell(11).setCellStyle(style);
         row0.createCell(12).setCellValue("取消原因");row0.getCell(12).setCellStyle(style);
-        row0.createCell(13).setCellValue("装置批准人");row0.getCell(13).setCellStyle(style);
-        row0.createCell(14).setCellValue("短号");row0.getCell(14).setCellStyle(style);
-        row0.createCell(15).setCellValue("用户单位");row0.getCell(15).setCellStyle(style);
-        row0.createCell(16).setCellValue("用户主管");row0.getCell(16).setCellStyle(style);
-        row0.createCell(17).setCellValue("短号");row0.getCell(17).setCellStyle(style);
-        row0.createCell(18).setCellValue("危害工作许可证号");row0.getCell(18).setCellStyle(style);
-        row0.createCell(19).setCellValue("动火作业许可证号");row0.getCell(19).setCellStyle(style);
-        row0.createCell(20).setCellValue("限制空间许可证号");row0.getCell(20).setCellStyle(style);
-        row0.createCell(21).setCellValue("盲板作业许可证号");row0.getCell(21).setCellStyle(style);
-        row0.createCell(22).setCellValue("高处作业许可证号");row0.getCell(22).setCellStyle(style);
+//        row0.createCell(13).setCellValue("装置批准人");row0.getCell(13).setCellStyle(style);
+//        row0.createCell(14).setCellValue("短号");row0.getCell(14).setCellStyle(style);
+//        row0.createCell(15).setCellValue("用户单位");row0.getCell(15).setCellStyle(style);
+//        row0.createCell(16).setCellValue("用户主管");row0.getCell(16).setCellStyle(style);
+//        row0.createCell(17).setCellValue("短号");row0.getCell(17).setCellStyle(style);
+//        row0.createCell(18).setCellValue("危害工作许可证号");row0.getCell(18).setCellStyle(style);
+//        row0.createCell(19).setCellValue("动火作业许可证号");row0.getCell(19).setCellStyle(style);
+//        row0.createCell(20).setCellValue("限制空间许可证号");row0.getCell(20).setCellStyle(style);
+//        row0.createCell(21).setCellValue("盲板作业许可证号");row0.getCell(21).setCellStyle(style);
+//        row0.createCell(22).setCellValue("高处作业许可证号");row0.getCell(22).setCellStyle(style);
         //填充数据
         int rowIndex = 1;
         int columnIndex = 1;
@@ -289,26 +289,26 @@ public class TInvoiceBookingworkticketController extends BaseController
             row.createCell(11).setCellValue("否");
             //
             row.createCell(12).setCellValue("");
-            //装置批准人
-            row.createCell(13).setCellValue(t.getBookingworkticket().getUserSupName());
-            //装置批准人短号
-            row.createCell(14).setCellValue(t.getBookingworkticket().getUserSupPhone());
-            //用户单位
-            row.createCell(15).setCellValue(t.getBookingworkticket().getUserUnit());
-            //用户主管
-            row.createCell(16).setCellValue(t.getBookingworkticket().getUserMgName());
-            //用户主管短号
-            row.createCell(17).setCellValue(t.getBookingworkticket().getUserMgPhone());
-            //危害工作许可证号
-            row.createCell(18).setCellValue(t.getWhgzxkzh());
-            //动火作业许可证号
-            row.createCell(19).setCellValue(t.getDhzyxkzh());
-            //限制空间许可证号
-            row.createCell(20).setCellValue(t.getXzkjxkzh());
-            //盲板作业许可证号
-            row.createCell(21).setCellValue(t.getMbzyxkzh());
-            //高处作业许可证号
-            row.createCell(22).setCellValue(t.getGczyxkzh());
+//            //装置批准人
+//            row.createCell(13).setCellValue(t.getBookingworkticket().getUserSupName());
+//            //装置批准人短号
+//            row.createCell(14).setCellValue(t.getBookingworkticket().getUserSupPhone());
+//            //用户单位
+//            row.createCell(15).setCellValue(t.getBookingworkticket().getUserUnit());
+//            //用户主管
+//            row.createCell(16).setCellValue(t.getBookingworkticket().getUserMgName());
+//            //用户主管短号
+//            row.createCell(17).setCellValue(t.getBookingworkticket().getUserMgPhone());
+//            //危害工作许可证号
+//            row.createCell(18).setCellValue(t.getWhgzxkzh());
+//            //动火作业许可证号
+//            row.createCell(19).setCellValue(t.getDhzyxkzh());
+//            //限制空间许可证号
+//            row.createCell(20).setCellValue(t.getXzkjxkzh());
+//            //盲板作业许可证号
+//            row.createCell(21).setCellValue(t.getMbzyxkzh());
+//            //高处作业许可证号
+//            row.createCell(22).setCellValue(t.getGczyxkzh());
 
 
             rowIndex++;
@@ -444,6 +444,161 @@ public class TInvoiceBookingworkticketController extends BaseController
         return AjaxResult.success(filename);
     }
 
+    /**
+     * 值班导出excel
+     * @param tInvoiceBookingworkticket
+     * @return
+     * @throws IOException
+     */
+    @GetMapping("/exportBookZb")
+    public AjaxResult exportBookZb(TInvoiceBookingworkticket tInvoiceBookingworkticket) throws IOException {
+        logger.info(JSON.toJSONString(tInvoiceBookingworkticket));
+        //字典查询
+        List<SysDictData> book_work_type = iSysDictTypeService.selectDictDataByType("book_work_type");
+
+        List<TInvoiceWorkcontent> tInvoiceWorkcontentList = tInvoiceBookingworkticketService.selectTInvoiceWorkcontentList(tInvoiceBookingworkticket);
+        for (TInvoiceWorkcontent workcontent : tInvoiceWorkcontentList) {
+            TInvoiceBookingworkticket bookingworkticket=tInvoiceBookingworkticketService.selectTInvoiceBookingworkticketById(workcontent.getBookingticketId());
+            workcontent.setBookingworkticket(bookingworkticket);
+        }
+        //除去作废的票 以及 续票
+        Iterator<TInvoiceWorkcontent> iterator = tInvoiceWorkcontentList.iterator();
+        while (iterator.hasNext()) {
+            TInvoiceWorkcontent t = iterator.next();
+            if (t.getBookingworkticket().getStatus() !=  3 || t.getXpxp().equals("12")) {
+                iterator.remove();
+            }
+        }
+
+//        List<TInvoiceWorkcontent> newWorkcontentList = new ArrayList<>();
+        //多个工作类型拆分成多条数据
+//        for (TInvoiceWorkcontent t: tInvoiceWorkcontentList
+//        ) {
+//            String[] wtArr=t.getWorkType().split(",");
+//            if (wtArr.length > 1) {
+//                for (int i = 0; i < wtArr.length; i++) {
+//                    TInvoiceWorkcontent arrItem = new TInvoiceWorkcontent();
+//                    BeanUtils.copyProperties(t, arrItem);
+//                    arrItem.setWorkType(wtArr[i]);
+//                    newWorkcontentList.add(arrItem);
+//                }
+//            }else {
+//                newWorkcontentList.add(t);
+//            }
+//        }
+
+
+        SXSSFWorkbook wb = new SXSSFWorkbook(1000);
+        CellStyle wrapStyle = wb.createCellStyle();
+        wrapStyle.setWrapText(true);    //设置自动换行
+        //创建sheet页
+        Sheet sheet = wb.createSheet("sheet1");
+        //设置列的宽度,第一个参数为列的序号,从0开始,第二参数为列宽,单位1/256个字节
+        sheet.setColumnWidth(0, 12*256);
+        sheet.setColumnWidth(1, 26*256);
+        sheet.setColumnWidth(2, 26*256);
+        sheet.setColumnWidth(3, 26*256);
+        sheet.setColumnWidth(4, 26*256);
+        sheet.setColumnWidth(5, 26*256);
+        sheet.setColumnWidth(6, 26*256);
+        sheet.setColumnWidth(7, 26*256);
+        sheet.setColumnWidth(8, 40*256);
+        sheet.setColumnWidth(9, 40*256);
+        sheet.setColumnWidth(10, 40*256);
+        sheet.setColumnWidth(11, 40*256);
+        sheet.setColumnWidth(12, 40*256);
+        sheet.setColumnWidth(13, 40*256);
+        sheet.setColumnWidth(14, 40*256);
+        sheet.setColumnWidth(15, 40*256);
+        sheet.setColumnWidth(16, 40*256);
+        sheet.setColumnWidth(17, 40*256);
+        sheet.setColumnWidth(18, 40*256);
+        sheet.setColumnWidth(19, 40*256);
+        sheet.setColumnWidth(20, 40*256);
+        sheet.setColumnWidth(21, 40*256);
+        sheet.setColumnWidth(22, 40*256);
+
+        //设置开始行和开始列
+        Row row0 = sheet.createRow(0);
+        CellStyle style = wb.createCellStyle();
+        style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+
+        Cell cell0 = row0.createCell(0);
+        row0.createCell(0).setCellValue("作业开始时间");row0.getCell(0).setCellStyle(style);
+        row0.createCell(1).setCellValue("作业类型");row0.getCell(1).setCellStyle(style);
+        row0.createCell(2).setCellValue("作业区域单元");row0.getCell(2).setCellStyle(style);
+        row0.createCell(3).setCellValue("作业地址");row0.getCell(3).setCellStyle(style);
+        row0.createCell(4).setCellValue("工艺主管");row0.getCell(4).setCellStyle(style);
+        row0.createCell(5).setCellValue("作业单位");row0.getCell(5).setCellStyle(style);
+        row0.createCell(6).setCellValue("负责人");row0.getCell(6).setCellStyle(style);
+        row0.createCell(7).setCellValue("联系电话");row0.getCell(7).setCellStyle(style);
+        row0.createCell(8).setCellValue("用户");row0.getCell(8).setCellStyle(style);
+        row0.createCell(9).setCellValue("票号");row0.getCell(9).setCellStyle(style);
+
+        //填充数据
+        int rowIndex = 1;
+        int columnIndex = 1;
+        StringBuilder contentUserWorkType=new StringBuilder();
+        String cuw="";
+        for (TInvoiceWorkcontent t: tInvoiceWorkcontentList) {
+            if(t.getBookingworkticket().getStatus()!=3){
+                continue;
+            }
+            Row row = sheet.createRow(rowIndex);
+            //开始时间
+            if (t.getBookingworkticket().getWorkStartTime()!= null){
+                row.createCell(0).setCellValue(new SimpleDateFormat("yyyy/MM/dd").format(t.getBookingworkticket().getWorkStartTime()));
+            }
+            //作业类型
+            if (t.getWorkType()!= null){
+                String newStr=t.getWorkType()+",";
+                String[] wtArr=newStr.split(",");
+                List<String> contentlist = Arrays.asList(wtArr);
+                for (SysDictData p : book_work_type) {
+                    for (String c : contentlist)
+                        if (c.equals(p.getDictValue())) {
+                            contentUserWorkType.append(","+p.getDictLabel());//作业类型
+                        }
+                }
+                if(contentUserWorkType.toString().startsWith(",")){
+                    cuw=contentUserWorkType.substring(1);
+                }
+                row.createCell(1).setCellValue(cuw);
+            }
+            if (t.getBookingworkticket().getWorkArea()!= null){
+                row.createCell(2).setCellValue(t.getBookingworkticket().getWorkArea());
+            }
+            //作业地址
+            if (t.getWorkDescription()!= null){
+                row.createCell(3).setCellValue(t.getWorkDescription());
+            }
+            //工艺主管
+            row.createCell(4).setCellValue(t.getBookingworkticket().getUserSupName() + " " + t.getBookingworkticket().getUserSupPhone());
+            //作业单位
+            if (t.getBookingworkticket().getWorkUnit()!= null){
+                row.createCell(5).setCellValue(t.getBookingworkticket().getWorkUnit());
+            }
+            //负责人
+            row.createCell(6).setCellValue(t.getBookingworkticket().getContact());
+            //电话
+            row.createCell(7).setCellValue(t.getBookingworkticket().getPhonenumber());
+            //用户
+            row.createCell(8).setCellValue(t.getBookingworkticket().getUserMgName() + " " + t.getBookingworkticket().getUserMgPhone());
+
+            rowIndex++;
+            contentUserWorkType.delete(0, contentUserWorkType.length());
+        }
+
+        OutputStream out = null;
+        String filename = ExcelUtil.encodingFilename("预约票台账导出");
+        out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
+        wb.write(out);
+        wb.close();
+        out.close();
+        return AjaxResult.success(filename);
+    }
+
     /**
      * 获取预约作业票台账详细信息
      */

+ 9 - 0
ui/src/api/invoice/bookingworkticket.js

@@ -57,6 +57,15 @@ export function exportBookingworkticket(query) {
   })
 }
 
+// 导出预约作业票台账值班
+export function exportBookingworkticketZb(query) {
+  return request({
+    url: '/invoice/bookingworkticket/exportBookZb',
+    method: 'get',
+    params: query
+  })
+}
+
 // 生成word并预览作业票
 export function seeBookingworkticket(query) {
   return request({

+ 24 - 0
ui/src/views/invoice/bookingworkticket/index.vue

@@ -125,6 +125,16 @@
         >作业票统计
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExportZb"
+          v-hasPermi="['invoice:bookingworkticket:export']"
+        >值班导出
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="cancelQuery"></right-toolbar>
     </el-row>
 
@@ -519,6 +529,7 @@ import {
   addBookingworkticket,
   updateBookingworkticket,
   exportBookingworkticket,
+  exportBookingworkticketZb,
   importTemplate,
   seeBookingworkticket,
   assion
@@ -1248,6 +1259,19 @@ export default {
         this.download(response.msg);
       })
     },
+    /** 值班导出按钮操作 */
+    handleExportZb() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有预约作业票台账数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return exportBookingworkticketZb(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+      })
+    },
     /** 导出按钮操作 */
     handleExportToday() {
       const queryParams = {};