czt
2023-05-31 ae2c433ecf08e10d55488320e5db0936ca323710
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ld.igds.inout.controller;
 
import com.ld.igds.constant.RespCodeEnum;
import com.ld.igds.data.PageResponse;
import com.ld.igds.inout.InoutConstant;
import com.ld.igds.inout.dto.InoutData;
import com.ld.igds.inout.manager.InoutReportManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Date;
 
/**
 * 出入库管理-出库和入库的接口
 */
@Slf4j
@RestController
@RequestMapping("basic/inout-report")
public class InoutReportController {
 
    @Autowired
    private InoutReportManager reportManager;
 
 
    /**
     * 获取出库称重打印单
     *
     * @param data
     * @return
     */
    @RequestMapping("/inout-bill-weight")
    public PageResponse<String> inoutWeightBill(@RequestBody InoutData data) {
        try {
            String html;
            if (InoutConstant.TYPE_IN.equals(data.getType())) {
                data.setEmptyWeightTime(new Date());
                html = reportManager.inWeightBill(data);
            } else {
                data.setFullWeightTime(new Date());
                html = reportManager.outWeightBill(data);
            }
            return new PageResponse<>(RespCodeEnum.CODE_0000, html);
        } catch (Exception e) {
            log.error("后台异常:{}", e);
            return new PageResponse<String>(RespCodeEnum.CODE_1111.getCode(),
                    "后台异常:" + e.getMessage());
        }
    }
}