dxq 6 dni temu
rodzic
commit
8041ba31ca

+ 66
- 0
sto/src/main/java/com/shinsoft/sto/controller/record/InrecordController.java Wyświetl plik

@@ -0,0 +1,66 @@
1
+package com.shinsoft.sto.controller.record;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.shinsoft.sto.model.system.ResultJSON;
5
+import com.shinsoft.sto.service.record.InrecordService;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.web.bind.annotation.GetMapping;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RequestParam;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+import java.util.HashMap;
14
+import java.util.Map;
15
+
16
+@RestController
17
+@RequestMapping("/InRecord")
18
+public class InrecordController {
19
+
20
+    @Autowired
21
+    private InrecordService inrecordService;
22
+
23
+    @RequestMapping("/query")
24
+    public ResultJSON query(@RequestParam(defaultValue = "1") int page,
25
+                            @RequestParam(defaultValue = "50") int rows,
26
+                            String params,
27
+                            HttpServletRequest request) {
28
+        try {
29
+            Map<String, Object> map = buildQueryParams(params, request);
30
+            return inrecordService.query(page, rows, map);
31
+        } catch (Exception ex) {
32
+            ex.printStackTrace();
33
+            return ResultJSON.error("查询失败:" + ex.getMessage());
34
+        }
35
+    }
36
+
37
+    @GetMapping("/statistics")
38
+    public ResultJSON statistics(String params, HttpServletRequest request) {
39
+        try {
40
+            Map<String, Object> map = buildQueryParams(params, request);
41
+            return inrecordService.statistics(map);
42
+        } catch (Exception ex) {
43
+            ex.printStackTrace();
44
+            return ResultJSON.error("统计失败:" + ex.getMessage());
45
+        }
46
+    }
47
+
48
+    private String resolveBelongId(HttpServletRequest request) {
49
+        String belongId = (String) request.getHeader("belongId");
50
+        if (belongId == null) {
51
+            belongId = (String) request.getAttribute("belongId");
52
+        }
53
+        return belongId;
54
+    }
55
+
56
+    @SuppressWarnings("unchecked")
57
+    private Map<String, Object> buildQueryParams(String params, HttpServletRequest request) {
58
+        Map<String, Object> map = new HashMap<>();
59
+        if (params != null && !params.trim().isEmpty()) {
60
+            map.putAll(JSON.parseObject(params, Map.class));
61
+        }
62
+//        map.put("belongId", resolveBelongId(request));
63
+        return map;
64
+    }
65
+}
66
+

+ 18
- 0
sto/src/main/java/com/shinsoft/sto/mapper/record/InrecordMapper.java Wyświetl plik

@@ -0,0 +1,18 @@
1
+package com.shinsoft.sto.mapper.record;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.shinsoft.sto.model.record.Inrecord;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.Map;
10
+
11
+public interface InrecordMapper extends BaseMapper<Inrecord> {
12
+
13
+    IPage<Inrecord> selectInrecordPage(Page<Inrecord> page,
14
+                                       @Param("parms") Map<String,Object> map);
15
+
16
+    Map<String,Object> selectStatistics(@Param("parms") Map<String,Object> map);
17
+}
18
+

+ 185
- 0
sto/src/main/java/com/shinsoft/sto/mapper/record/InrecordMapper.xml Wyświetl plik

@@ -0,0 +1,185 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.shinsoft.sto.mapper.record.InrecordMapper">
4
+
5
+    <resultMap id="InrecordResultMap" type="com.shinsoft.sto.model.record.Inrecord">
6
+        <id column="id" property="id" jdbcType="VARCHAR"/>
7
+        <result column="belong_id" property="belongId" jdbcType="VARCHAR"/>
8
+        <result column="in_truck_no" property="inTruckNo" jdbcType="VARCHAR"/>
9
+        <result column="tally_people" property="tallyPeople" jdbcType="VARCHAR"/>
10
+        <result column="in_dtm" property="inDtm" jdbcType="TIMESTAMP"/>
11
+        <result column="in_ware_name" property="inWareName" jdbcType="VARCHAR"/>
12
+        <result column="in_stack_name" property="inStackName" jdbcType="VARCHAR"/>
13
+        <result column="in_layer_no" property="inLayerNo" jdbcType="VARCHAR"/>
14
+        <result column="prod_no" property="prodNo" jdbcType="VARCHAR"/>
15
+        <result column="owner_company" property="ownerCompany" jdbcType="VARCHAR"/>
16
+        <result column="receiving_company" property="receivingCompany" jdbcType="VARCHAR"/>
17
+        <result column="customer_company" property="customerCompany" jdbcType="VARCHAR"/>
18
+        <result column="material_id" property="materialId" jdbcType="VARCHAR"/>
19
+        <result column="st_grade" property="stGrade" jdbcType="VARCHAR"/>
20
+        <result column="in_weight" property="inWeight" jdbcType="DECIMAL"/>
21
+        <result column="in_quantity" property="inQuantity" jdbcType="DECIMAL"/>
22
+        <result column="in_flag" property="inFlag" jdbcType="VARCHAR"/>
23
+        <result column="delivery_address" property="deliveryAddress" jdbcType="VARCHAR"/>
24
+        <result column="attrib_01" property="attrib01" jdbcType="VARCHAR"/>
25
+        <result column="attrib_02" property="attrib02" jdbcType="VARCHAR"/>
26
+        <result column="attrib_03" property="attrib03" jdbcType="VARCHAR"/>
27
+        <result column="attrib_04" property="attrib04" jdbcType="VARCHAR"/>
28
+        <result column="attrib_05" property="attrib05" jdbcType="VARCHAR"/>
29
+        <result column="attrib_06" property="attrib06" jdbcType="VARCHAR"/>
30
+        <result column="attrib_07" property="attrib07" jdbcType="VARCHAR"/>
31
+        <result column="attrib_08" property="attrib08" jdbcType="VARCHAR"/>
32
+        <result column="attrib_09" property="attrib09" jdbcType="VARCHAR"/>
33
+        <result column="attrib_10" property="attrib10" jdbcType="VARCHAR"/>
34
+        <result column="attrib_11" property="attrib11" jdbcType="VARCHAR"/>
35
+        <result column="attrib_12" property="attrib12" jdbcType="VARCHAR"/>
36
+        <result column="attrib_13" property="attrib13" jdbcType="VARCHAR"/>
37
+        <result column="attrib_14" property="attrib14" jdbcType="VARCHAR"/>
38
+        <result column="attrib_15" property="attrib15" jdbcType="VARCHAR"/>
39
+        <result column="attrib_16" property="attrib16" jdbcType="VARCHAR"/>
40
+        <result column="attrib_17" property="attrib17" jdbcType="VARCHAR"/>
41
+        <result column="attrib_18" property="attrib18" jdbcType="VARCHAR"/>
42
+        <result column="attrib_19" property="attrib19" jdbcType="VARCHAR"/>
43
+        <result column="attrib_20" property="attrib20" jdbcType="VARCHAR"/>
44
+        <result column="attrib_21" property="attrib21" jdbcType="VARCHAR"/>
45
+        <result column="attrib_22" property="attrib22" jdbcType="VARCHAR"/>
46
+        <result column="attrib_23" property="attrib23" jdbcType="VARCHAR"/>
47
+        <result column="attrib_24" property="attrib24" jdbcType="VARCHAR"/>
48
+        <result column="attrib_25" property="attrib25" jdbcType="VARCHAR"/>
49
+        <result column="remark_1" property="remark1" jdbcType="VARCHAR"/>
50
+        <result column="remark_2" property="remark2" jdbcType="VARCHAR"/>
51
+        <result column="remark_3" property="remark3" jdbcType="VARCHAR"/>
52
+        <result column="remark_4" property="remark4" jdbcType="VARCHAR"/>
53
+        <result column="remark_5" property="remark5" jdbcType="VARCHAR"/>
54
+        <result column="owner_company_name" property="ownerCompanyName" jdbcType="VARCHAR"/>
55
+        <result column="receiving_company_name" property="receivingCompanyName" jdbcType="VARCHAR"/>
56
+        <result column="customer_company_name" property="customerCompanyName" jdbcType="VARCHAR"/>
57
+        <result column="material_name" property="materialName" jdbcType="VARCHAR"/>
58
+        <result column="material_code" property="materialCode" jdbcType="VARCHAR"/>
59
+        <result column="material_standard" property="materialStandard" jdbcType="VARCHAR"/>
60
+        <result column="material_model" property="materialModel" jdbcType="VARCHAR"/>
61
+    </resultMap>
62
+
63
+    <sql id="StatisticsWhere">
64
+        where 1=1
65
+<!--        <if test="parms.belongId != null and parms.belongId != ''">-->
66
+<!--            and ir.belong_id = #{parms.belongId}-->
67
+<!--        </if>-->
68
+        <if test="parms.wareName != null and parms.wareName != ''">
69
+            and ir.IN_WARE_NAME like   '%' || #{parms.wareName} || '%'
70
+        </if>
71
+        <if test="parms.stackName != null and parms.stackName != ''">
72
+            and ir.IN_STACK_NAME like   '%' || #{parms.stackName} || '%'
73
+        </if>
74
+        <if test="parms.inTruckNo != null and parms.inTruckNo != ''">
75
+            and ir.in_truck_no like '%' || #{parms.inTruckNo} || '%'
76
+        </if>
77
+        <if test="parms.materialName != null and parms.materialName != ''">
78
+            and material.material_name like '%' || #{parms.materialName} || '%'
79
+        </if>
80
+        <if test="parms.ownerCompany != null and parms.ownerCompany != ''">
81
+            and owner.id =#{parms.ownerCompany}
82
+        </if>
83
+        <if test="parms.receivingCompany != null and parms.receivingCompany != ''">
84
+            and owner.id =#{parms.receivingCompany}
85
+        </if>
86
+        <if test="parms.customerCompany != null and parms.customerCompany != ''">
87
+            and owner.id =#{parms.customerCompany}
88
+        </if>
89
+        <if test="parms.startDtm != null and parms.startDtm != ''">
90
+            and ir.IN_DTM &gt;= TO_DATE(#{parms.startDtm}, 'yyyy-MM-dd hh24:mi:ss')
91
+        </if>
92
+        <if test="parms.endDtm != null and parms.endDtm != ''">
93
+            and ir.IN_DTM &lt;= TO_DATE(#{parms.endDtm}, 'yyyy-MM-dd hh24:mi:ss')
94
+        </if>
95
+        <if test="parms.prodNo != null and parms.prodNo != ''">
96
+            and ir.PROD_NO like '%' || #{parms.prodNo} || '%'
97
+        </if>
98
+<!--        <if test="parms.orderNo != null and parms.orderNo != ''">-->
99
+<!--            and ir.order_NO like '%' || #{parms.orderNo} || '%'-->
100
+<!--        </if>-->
101
+
102
+<!--        <if test="parms.contractNo != null and parms.contractNo != ''">-->
103
+<!--            and ir.contract_no like '%' || #{parms.contractNo} || '%'-->
104
+<!--        </if>-->
105
+    </sql>
106
+
107
+    <select id="selectInrecordPage" resultMap="InrecordResultMap" parameterType="map">
108
+        select
109
+            ir.id,
110
+            ir.belong_id,
111
+            ir.in_truck_no,
112
+            ir.tally_people,
113
+            ir.in_dtm,
114
+            ir.in_ware_name,
115
+            ir.in_stack_name,
116
+            ir.in_layer_no,
117
+            ir.prod_no,
118
+            ir.owner_company,
119
+            ir.receiving_company,
120
+            ir.customer_company,
121
+            ir.material_id,
122
+            ir.st_grade,
123
+            ir.in_weight,
124
+            ir.in_quantity,
125
+            ir.in_flag,
126
+            nvl(ir.delivery_address, owner.default_address) as delivery_address,
127
+            ir.attrib_01,
128
+            ir.attrib_02,
129
+            ir.attrib_03,
130
+            ir.attrib_04,
131
+            ir.attrib_05,
132
+            ir.attrib_06,
133
+            ir.attrib_07,
134
+            ir.attrib_08,
135
+            ir.attrib_09,
136
+            ir.attrib_10,
137
+            ir.attrib_11,
138
+            ir.attrib_12,
139
+            ir.attrib_13,
140
+            ir.attrib_14,
141
+            ir.attrib_15,
142
+            ir.attrib_16,
143
+            ir.attrib_17,
144
+            ir.attrib_18,
145
+            ir.attrib_19,
146
+            ir.attrib_20,
147
+            ir.attrib_21,
148
+            ir.attrib_22,
149
+            ir.attrib_23,
150
+            ir.attrib_24,
151
+            ir.attrib_25,
152
+            ir.remark_1,
153
+            ir.remark_2,
154
+            ir.remark_3,
155
+            ir.remark_4,
156
+            ir.remark_5,
157
+            owner.customer_nm as owner_company_name,
158
+            receiving.customer_nm as receiving_company_name,
159
+            customer.customer_nm as customer_company_name,
160
+            material.material_name as material_name,
161
+            material.material_code as material_code,
162
+            material.material_standard as material_standard,
163
+            material.material_model as material_model
164
+        from T_IN_RECORD ir
165
+                 left join T_MAIN_CUSTOMER owner on owner.id = ir.owner_company
166
+                 left join T_MAIN_CUSTOMER receiving on receiving.id = ir.receiving_company
167
+                 left join T_MAIN_CUSTOMER customer on customer.id = ir.customer_company
168
+                 left join T_MAIN_MATERIAL material on material.id = ir.material_id
169
+        <include refid="StatisticsWhere"/>
170
+        order by ir.in_dtm desc
171
+    </select>
172
+
173
+    <select id="selectStatistics" resultType="map" parameterType="map">
174
+        select
175
+            nvl(sum(ir.in_quantity), 0) as totalQuantity,
176
+            nvl(sum(ir.in_weight), 0) as totalWeight
177
+        from T_IN_RECORD ir
178
+                 left join T_MAIN_CUSTOMER owner on owner.id = ir.owner_company
179
+                 left join T_MAIN_CUSTOMER receiving on receiving.id = ir.receiving_company
180
+                 left join T_MAIN_CUSTOMER customer on customer.id = ir.customer_company
181
+                 left join T_MAIN_MATERIAL material on material.id = ir.material_id
182
+        <include refid="StatisticsWhere"/>
183
+    </select>
184
+</mapper>
185
+

+ 157
- 0
sto/src/main/java/com/shinsoft/sto/model/record/Inrecord.java Wyświetl plik

@@ -0,0 +1,157 @@
1
+package com.shinsoft.sto.model.record;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.baomidou.mybatisplus.annotation.TableName;
5
+import com.shinsoft.generator.model.BaseModel;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Getter;
9
+import lombok.Setter;
10
+import lombok.experimental.Accessors;
11
+
12
+import java.math.BigDecimal;
13
+import java.util.Date;
14
+
15
+/**
16
+ * 入库记录视图模型,对应 STO_IN_RECORD 表
17
+ */
18
+@Getter
19
+@Setter
20
+@Accessors(chain = true)
21
+@TableName("T_IN_RECORD")
22
+@ApiModel(value = "Inrecord", description = "入库记录")
23
+public class Inrecord extends BaseModel {
24
+
25
+    @ApiModelProperty("入库车号")
26
+    private String inTruckNo;
27
+
28
+    @ApiModelProperty("理货人员")
29
+    private String tallyPeople;
30
+
31
+    @ApiModelProperty("入库时间")
32
+    private Date inDtm;
33
+
34
+    @ApiModelProperty("入库库房名称")
35
+    private String inWareName;
36
+
37
+    @ApiModelProperty("入库垛位名称")
38
+    private String inStackName;
39
+
40
+    @ApiModelProperty("入库层号")
41
+    private String inLayerNo;
42
+
43
+    @ApiModelProperty("材料号/批号")
44
+    private String prodNo;
45
+
46
+    @ApiModelProperty("货权公司")
47
+    private String ownerCompany;
48
+
49
+    @ApiModelProperty("收货公司")
50
+    private String receivingCompany;
51
+
52
+    @ApiModelProperty("最终客户")
53
+    private String customerCompany;
54
+
55
+    @ApiModelProperty("物料ID")
56
+    private String materialId;
57
+
58
+    @ApiModelProperty("钢种信息")
59
+    private String stGrade;
60
+
61
+    @ApiModelProperty("入库重量")
62
+    private BigDecimal inWeight;
63
+
64
+    @ApiModelProperty("入库数量")
65
+    private BigDecimal inQuantity;
66
+
67
+    @ApiModelProperty("入库标记")
68
+    private String inFlag;
69
+
70
+    @ApiModelProperty("收货地址")
71
+    private String deliveryAddress;
72
+
73
+    @ApiModelProperty("属性1")
74
+    private String attrib01;
75
+    @ApiModelProperty("属性1")
76
+    private String attrib02;
77
+    @ApiModelProperty("属性1")
78
+    private String attrib03;
79
+    @ApiModelProperty("属性1")
80
+    private String attrib04;
81
+    @ApiModelProperty("属性1")
82
+    private String attrib05;
83
+    @ApiModelProperty("属性1")
84
+    private String attrib06;
85
+    @ApiModelProperty("属性1")
86
+    private String attrib07;
87
+    @ApiModelProperty("属性1")
88
+    private String attrib08;
89
+    @ApiModelProperty("属性1")
90
+    private String attrib09;
91
+    @ApiModelProperty("属性1")
92
+    private String attrib10;
93
+    @ApiModelProperty("属性1")
94
+    private String attrib11;
95
+    @ApiModelProperty("属性1")
96
+    private String attrib12;
97
+    @ApiModelProperty("属性1")
98
+    private String attrib13;
99
+    @ApiModelProperty("属性1")
100
+    private String attrib14;
101
+    @ApiModelProperty("属性1")
102
+    private String attrib15;
103
+    @ApiModelProperty("属性1")
104
+    private String attrib16;
105
+    @ApiModelProperty("属性1")
106
+    private String attrib17;
107
+    @ApiModelProperty("属性1")
108
+    private String attrib18;
109
+    @ApiModelProperty("属性1")
110
+    private String attrib19;
111
+    @ApiModelProperty("属性1")
112
+    private String attrib20;
113
+    @ApiModelProperty("属性1")
114
+    private String attrib21;
115
+    @ApiModelProperty("属性1")
116
+    private String attrib22;
117
+    @ApiModelProperty("属性1")
118
+    private String attrib23;
119
+    @ApiModelProperty("属性1")
120
+    private String attrib24;
121
+    @ApiModelProperty("属性")
122
+    private String attrib25;
123
+
124
+    @ApiModelProperty("备注1")
125
+    private String remark1;
126
+    @ApiModelProperty("备注2")
127
+    private String remark2;
128
+    @ApiModelProperty("备注3")
129
+    private String remark3;
130
+    @ApiModelProperty("备注4")
131
+    private String remark4;
132
+    @ApiModelProperty("备注5")
133
+    private String remark5;
134
+
135
+    @TableField(exist = false)
136
+    private String ownerCompanyName;
137
+
138
+    @TableField(exist = false)
139
+    private String receivingCompanyName;
140
+
141
+    @TableField(exist = false)
142
+    private String customerCompanyName;
143
+
144
+    @TableField(exist = false)
145
+    private String materialName;
146
+
147
+    @TableField(exist = false)
148
+    private String materialCode;
149
+
150
+    @TableField(exist = false)
151
+    private String materialStandard;
152
+
153
+    @TableField(exist = false)
154
+    private String materialModel;
155
+}
156
+
157
+

+ 41
- 0
sto/src/main/java/com/shinsoft/sto/service/impl/record/InrecordServiceImpl.java Wyświetl plik

@@ -0,0 +1,41 @@
1
+package com.shinsoft.sto.service.impl.record;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.shinsoft.sto.mapper.record.InrecordMapper;
7
+import com.shinsoft.sto.model.record.Inrecord;
8
+import com.shinsoft.sto.model.system.ResponseCodeMsg;
9
+import com.shinsoft.sto.model.system.ResultJSON;
10
+import com.shinsoft.sto.service.record.InrecordService;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.util.Map;
14
+
15
+@Service
16
+public class InrecordServiceImpl extends ServiceImpl<InrecordMapper, Inrecord> implements InrecordService {
17
+
18
+    @Override
19
+    public ResultJSON query(int page, int rows, Map<String,Object> map) {
20
+        try {
21
+            Page<Inrecord> pageParam = new Page<>(page, rows);
22
+            IPage<Inrecord> result = baseMapper.selectInrecordPage(pageParam, map);
23
+            return ResultJSON.success(result);
24
+        } catch (Exception ex) {
25
+            ex.printStackTrace();
26
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
27
+        }
28
+    }
29
+
30
+    @Override
31
+    public ResultJSON statistics(Map<String, Object> map) {
32
+        try {
33
+            Map<String, Object> stats = baseMapper.selectStatistics(map);
34
+            return ResultJSON.success(stats);
35
+        } catch (Exception ex) {
36
+            ex.printStackTrace();
37
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
38
+        }
39
+    }
40
+}
41
+

+ 15
- 0
sto/src/main/java/com/shinsoft/sto/service/record/InrecordService.java Wyświetl plik

@@ -0,0 +1,15 @@
1
+package com.shinsoft.sto.service.record;
2
+
3
+import com.shinsoft.sto.model.system.ResultJSON;
4
+
5
+import java.util.Map;
6
+
7
+public interface InrecordService {
8
+
9
+    ResultJSON query(int page,
10
+                     int rows,
11
+                     Map<String,Object> map);
12
+
13
+    ResultJSON statistics(Map<String,Object> map);
14
+}
15
+

Ładowanie…
Anuluj
Zapisz