YL2767 1 viikko sitten
vanhempi
commit
3d9f4386a2

+ 85
- 0
src/main/java/com/th/demo/controller/home/HomeController.java Näytä tiedosto

@@ -0,0 +1,85 @@
1
+package com.th.demo.controller.home;
2
+
3
+import com.th.demo.model.system.ResponseCodeMsg;
4
+import com.th.demo.model.system.Type;
5
+import com.th.demo.service.home.HomeService;
6
+import com.th.demo.service.ware.ChangeService;
7
+import com.th.demo.service.ware.CombineService;
8
+import com.th.demo.service.ware.StoreService;
9
+import com.th.demo.tools.JSONTools;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RequestMethod;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.servlet.http.HttpServletRequest;
16
+
17
+@RestController
18
+@RequestMapping(value = "/Home")
19
+public class HomeController {
20
+    @Autowired
21
+    public HomeService homeService;
22
+    String result = Type.FAIL;
23
+
24
+    @RequestMapping(value = "/querydrawLine1.do")//查询方法 前两个参数是分页参数
25
+    public String querydrawLine1(
26
+            HttpServletRequest request) {
27
+
28
+        try {
29
+            String userId = (String) request.getAttribute("userId");
30
+            String belongId = (String) request.getAttribute("belongId");
31
+            result = homeService.querydrawLine1( userId, belongId);
32
+        } catch (Exception ex) {
33
+            ex.printStackTrace();
34
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
35
+        } finally {
36
+            return result;
37
+        }
38
+    }
39
+
40
+    @RequestMapping(value = "/querydrawLine2.do")//查询方法 前两个参数是分页参数
41
+    public String querydrawLine2(
42
+            HttpServletRequest request) {
43
+
44
+        try {
45
+            String userId = (String) request.getAttribute("userId");
46
+            String belongId = (String) request.getAttribute("belongId");
47
+            result = homeService.querydrawLine2( userId, belongId);
48
+        } catch (Exception ex) {
49
+            ex.printStackTrace();
50
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
51
+        } finally {
52
+            return result;
53
+        }
54
+    }
55
+    @RequestMapping(value = "/querydrawLine3.do")//查询方法 前两个参数是分页参数
56
+    public String querydrawLine3(
57
+            HttpServletRequest request) {
58
+
59
+        try {
60
+            String userId = (String) request.getAttribute("userId");
61
+            String belongId = (String) request.getAttribute("belongId");
62
+            result = homeService.querydrawLine3( userId, belongId);
63
+        } catch (Exception ex) {
64
+            ex.printStackTrace();
65
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
66
+        } finally {
67
+            return result;
68
+        }
69
+    }
70
+    @RequestMapping(value = "/querydrawLine4.do")//查询方法 前两个参数是分页参数
71
+    public String querydrawLine4(
72
+            HttpServletRequest request) {
73
+
74
+        try {
75
+            String userId = (String) request.getAttribute("userId");
76
+            String belongId = (String) request.getAttribute("belongId");
77
+            result = homeService.querydrawLine4( userId, belongId);
78
+        } catch (Exception ex) {
79
+            ex.printStackTrace();
80
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
81
+        } finally {
82
+            return result;
83
+        }
84
+    }
85
+}

+ 49
- 0
src/main/java/com/th/demo/controller/ware/StoreController.java Näytä tiedosto

@@ -143,6 +143,55 @@ public class StoreController {
143 143
         }
144 144
     }
145 145
 
146
+    @RequestMapping(value = "/queryTotal.do")
147
+    public String queryTotal(
148
+                             String wareName,
149
+                             String stackName,
150
+                             String model,
151
+                             String materialName,
152
+                             String standard,
153
+                             String customerName,
154
+                             String fkcustmerName,
155
+                             String plateNo,
156
+                             String ordNo,
157
+                             String contractNo,
158
+                             String packNo,
159
+                             String outFlag,
160
+                             String fromDate,
161
+                             String toDate,
162
+                             HttpServletRequest request) {
163
+
164
+        try {
165
+            Date fromDate2 = new Date();
166
+            Date toDate2 = new Date();
167
+            if (fromDate != null && fromDate!= ""){
168
+                fromDate2 = DateTools.StrToDate(fromDate, "yyyy-MM-dd HH:mm:ss");
169
+            }else {
170
+                fromDate2 =null;
171
+            }
172
+            if (toDate != null && toDate != ""){
173
+                toDate2 = DateTools.StrToDate(toDate, "yyyy-MM-dd HH:mm:ss");
174
+            }else {
175
+                toDate2 =null;
176
+            }
177
+            String userId = (String) request.getAttribute("userId");
178
+            String belongId = (String) request.getAttribute("belongId");
179
+            result = storeService.queryTotal(wareName,
180
+                    stackName,
181
+                    model,
182
+                    materialName,
183
+                    standard,
184
+                    customerName,
185
+                    userId,
186
+                    belongId,plateNo,ordNo,contractNo,fkcustmerName,packNo,outFlag,fromDate2,toDate2);
187
+        } catch (Exception ex) {
188
+            ex.printStackTrace();
189
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
190
+        } finally {
191
+            return result;
192
+        }
193
+    }
194
+
146 195
     @RequestMapping(value = "/modifyCustomer.do")
147 196
     public String modifyCustomer(String id,String customerNameOld,String customerNameNew,HttpServletRequest request) {
148 197
 

+ 16
- 0
src/main/java/com/th/demo/mapping/home/HomeMapper.java Näytä tiedosto

@@ -0,0 +1,16 @@
1
+package com.th.demo.mapping.home;
2
+
3
+import com.th.demo.model.finance.AccountDetail;
4
+import com.th.demo.model.finance.RcvMoney;
5
+import com.th.demo.model.home.HomeValue;
6
+
7
+import java.util.List;
8
+
9
+public interface HomeMapper {
10
+    List<HomeValue> selectdrawLine1();
11
+    List<HomeValue> selectdrawLine2();
12
+    List<HomeValue> selectdrawLine3();
13
+    HomeValue selectdrawLine4();
14
+
15
+
16
+}

+ 7
- 0
src/main/java/com/th/demo/mapping/ware/StoreMapper.java Näytä tiedosto

@@ -39,6 +39,13 @@ public interface StoreMapper {
39 39
                             String packNo, List<String> packNos,
40 40
                             String out_lag, String localFlag, String outBound, Date fromDate, Date toDate);
41 41
 
42
+    List<TotalRecord> selectStoreTotal(String wareName, String stackName, String model, String materialName, String standard,
43
+                            String customerName, String userId, String belongId,
44
+                            String fkcustmerName, String plateNo, String ordNo, String contractNo,
45
+                            List<String> plateNos, List<String> ordNos, List<String> contractNos,
46
+                            String packNo, List<String> packNos,
47
+                            String out_lag, String localFlag, String outBound, Date fromDate, Date toDate);
48
+
42 49
     int updateForUpDownByLayer(String wareName, String stackName, String userId, String belongId, int min, int max, int i);
43 50
 
44 51
     int updateForUpDownByStep(String wareName, String stackName, String userId, String belongId, int min, int max, int i);

+ 31
- 0
src/main/java/com/th/demo/model/home/HomeValue.java Näytä tiedosto

@@ -0,0 +1,31 @@
1
+package com.th.demo.model.home;
2
+
3
+public class HomeValue {
4
+    String value1;
5
+    String value2;
6
+    String value3;
7
+
8
+    public String getValue1() {
9
+        return value1;
10
+    }
11
+
12
+    public void setValue1(String value1) {
13
+        this.value1 = value1;
14
+    }
15
+
16
+    public String getValue2() {
17
+        return value2;
18
+    }
19
+
20
+    public void setValue2(String value2) {
21
+        this.value2 = value2;
22
+    }
23
+
24
+    public String getValue3() {
25
+        return value3;
26
+    }
27
+
28
+    public void setValue3(String value3) {
29
+        this.value3 = value3;
30
+    }
31
+}

+ 9
- 0
src/main/java/com/th/demo/service/home/HomeService.java Näytä tiedosto

@@ -0,0 +1,9 @@
1
+package com.th.demo.service.home;
2
+
3
+public interface HomeService {
4
+    String querydrawLine1(String userId, String belongId);
5
+    String querydrawLine2(String userId, String belongId);
6
+    String querydrawLine3(String userId, String belongId);
7
+    String querydrawLine4(String userId, String belongId);
8
+
9
+}

+ 48
- 0
src/main/java/com/th/demo/service/impl/home/HomeServiceImpl.java Näytä tiedosto

@@ -0,0 +1,48 @@
1
+package com.th.demo.service.impl.home;
2
+
3
+import com.th.demo.mapping.home.HomeMapper;
4
+import com.th.demo.model.home.HomeValue;
5
+import com.th.demo.service.home.HomeService;
6
+import com.th.demo.tools.JSONTools;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+@Service("HomeService")
12
+public class HomeServiceImpl implements HomeService {
13
+
14
+    @Autowired
15
+    HomeMapper homeMapper;
16
+    String result = "";
17
+
18
+    int num = 0;
19
+
20
+
21
+    @Override
22
+    public String querydrawLine1(String userId, String belongId) {
23
+        List<HomeValue> homeValue = homeMapper.selectdrawLine1();
24
+        result = JSONTools.toString(homeValue);
25
+        return result;
26
+    }
27
+
28
+    @Override
29
+    public String querydrawLine2(String userId, String belongId) {
30
+        List<HomeValue> homeValue = homeMapper.selectdrawLine2();
31
+        result = JSONTools.toString(homeValue);
32
+        return result;
33
+    }
34
+
35
+    @Override
36
+    public String querydrawLine3(String userId, String belongId) {
37
+        List<HomeValue> homeValue = homeMapper.selectdrawLine3();
38
+        result = JSONTools.toString(homeValue);
39
+        return result;
40
+    }
41
+
42
+    @Override
43
+    public String querydrawLine4(String userId, String belongId) {
44
+        HomeValue homeValue = homeMapper.selectdrawLine4();
45
+        result = JSONTools.toString(homeValue);
46
+        return result;
47
+    }
48
+}

+ 59
- 0
src/main/java/com/th/demo/service/impl/ware/StoreServiceImpl.java Näytä tiedosto

@@ -459,6 +459,65 @@ public class StoreServiceImpl implements StoreService {
459 459
         return result;
460 460
     }
461 461
 
462
+    @Override
463
+    public String queryTotal(String wareName, String stackName, String model, String materialName, String standard, String customerName, String userId, String belongId, String plateNo, String ordNo, String contractNo, String fkcustmerName, String packNo, String outFlag, Date fromDate, Date toDate) {
464
+        List<String> pltNos =new ArrayList<>() ;
465
+        List<String> ordNos =new ArrayList<>() ;
466
+        List<String> contractNos =new ArrayList<>() ;
467
+        List<String> packNos =new ArrayList<>() ;
468
+        if (plateNo.indexOf(",") != -1){
469
+            pltNos = Arrays.asList(plateNo.split(","));
470
+        }
471
+        if (ordNo.indexOf(",") != -1){
472
+            ordNos = Arrays.asList(ordNo.split(","));
473
+        }
474
+        if (contractNo.indexOf(",") != -1){
475
+            contractNos = Arrays.asList(contractNo.split(","));
476
+        }
477
+        if (packNo.indexOf(",") != -1){
478
+            packNos = Arrays.asList(packNo.split(","));
479
+        }
480
+
481
+        String out_lag ="0";
482
+        String localFlag = "0";
483
+        String outBound = "";
484
+        // add by zhangqy 库存信息增加状态信息,
485
+        // 0: 正常在库
486
+        // 1: 已出库
487
+        // 2: 在库已锁定
488
+        // 3: 在库已标记入仓
489
+        // 4: 出库已标记入仓
490
+        if (outFlag.equals("0")){
491
+            out_lag = "0";
492
+            localFlag="0";
493
+            outBound = "";
494
+        }else if (outFlag.equals("1")){
495
+            out_lag = "1";
496
+            localFlag="1";
497
+            outBound = "";
498
+        }else if (outFlag.equals("2")){
499
+            out_lag = "0";
500
+            localFlag="1";
501
+            outBound = "";
502
+        }else if (outFlag.equals("3")){
503
+            out_lag = "0";
504
+            localFlag="0";
505
+            outBound = "已入仓";
506
+        }else if (outFlag.equals("4")){
507
+            out_lag = "1";
508
+            localFlag="1";
509
+            outBound = "已入仓";
510
+        }
511
+
512
+
513
+        List<TotalRecord> list =storeMapper.selectStoreTotal(wareName,stackName,model,materialName,standard,    customerName,   userId,belongId,
514
+                fkcustmerName,plateNo,ordNo,contractNo,pltNos,ordNos,contractNos,packNo,packNos,
515
+                out_lag,localFlag,outBound,fromDate,toDate);
516
+        result = JSONTools.toStringyyyyMMddHHmmss(list);
517
+
518
+        return result;
519
+    }
520
+
462 521
     private MoveRecord getMoveRecord(Store store, Stack fromStack, Stack toStack, int layerNew, int layerOld, String userId) {
463 522
         MoveRecord moveRecord = new MoveRecord();
464 523
         moveRecord.setWareNameOld(fromStack.getWare().getName());

+ 5
- 0
src/main/java/com/th/demo/service/ware/StoreService.java Näytä tiedosto

@@ -40,4 +40,9 @@ public interface StoreService {
40 40
     String lockAndUnlock(String json,String lockFlag,String userId,String belongId);
41 41
 
42 42
     String Outbound(String json,String outbound,String userId,String belongId);
43
+
44
+    String queryTotal(String wareName, String stackName, String model, String materialName, String standard,
45
+                      String customerName, String userId, String belongId,
46
+                      String plateNo, String ordNo, String contractNo, String fkcustmerName, String packNo,
47
+                      String outFlag, Date fromDate, Date toDate);
43 48
 }

+ 43
- 0
src/main/resource/mapper/home/HomeMapper.xml Näytä tiedosto

@@ -0,0 +1,43 @@
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.th.demo.mapping.home.HomeMapper" >
4
+    <resultMap id="BaseResultMap" type="com.th.demo.model.home.HomeValue" >
5
+        <result column="value1" property="value1" jdbcType="VARCHAR" />
6
+        <result column="value2" property="value2" jdbcType="VARCHAR" />
7
+        <result column="value3" property="value3" jdbcType="VARCHAR" />
8
+    </resultMap>
9
+
10
+    <select id="selectdrawLine1" resultMap="BaseResultMap" >
11
+        SELECT CC.MONTH_NUM AS value1 , (CC.inweight + CC.outweight) AS value2
12
+        FROM (select SUBSTR(A.date_note,6) AS MONTH_NUM , A.weight as inweight , IFNULL(B.weight,0) as outweight,A.date_note
13
+              from (select sum(twir.weight) weight ,DATE_FORMAT(twir.add_time,'%Y-%m') as date_note
14
+                    from t_ware_in_record twir where twir.cancel_flag ='0' group by date_note) A
15
+                       LEFT JOIN (select sum(twor.weight) weight,DATE_FORMAT(twor.add_time,'%Y-%m') as date_note
16
+                                  from t_ware_out_record twor where twor.cancel_flag ='0' group by date_note) B
17
+                                 ON A.date_note = B.date_note ORDER BY A.date_note DESC LIMIT 12) CC ORDER BY date_note;
18
+    </select>
19
+
20
+    <select id="selectdrawLine2" resultMap="BaseResultMap" parameterType="java.lang.String" >
21
+        SELECT tmm.name AS value1,sum(tws.weight) as value2 FROM t_ware_store tws, t_maint_material tmm
22
+        where 1=1 AND tws.material_id = tmm.id
23
+          AND tws.cancel_flag ='0' and tws.out_flag ='0' and tws.lock_flag ='0' group by tmm.name order by value2 desc
24
+    </select>
25
+
26
+    <select id="selectdrawLine3" resultMap="BaseResultMap" parameterType="java.lang.String" >
27
+        SELECT CC.MONTH_NUM AS value1 , CC.inweight AS value2, CC.outweight AS value3
28
+        FROM (select SUBSTR(A.date_note,6) AS MONTH_NUM , A.weight as inweight , IFNULL(B.weight,0) as outweight,A.date_note
29
+              from (select sum(twir.weight) weight ,DATE_FORMAT(twir.add_time,'%Y-%m') as date_note
30
+                    from t_ware_in_record twir where twir.cancel_flag ='0' group by date_note) A
31
+                       LEFT JOIN (select sum(twor.weight) weight,DATE_FORMAT(twor.add_time,'%Y-%m') as date_note
32
+                                  from t_ware_out_record twor where twor.cancel_flag ='0' group by date_note) B
33
+                                 ON A.date_note = B.date_note ORDER BY A.date_note DESC LIMIT 12) CC ORDER BY date_note;
34
+    </select>
35
+
36
+    <select id="selectdrawLine4" resultMap="BaseResultMap" parameterType="java.lang.String" >
37
+        select (select count(A.stack_id) from
38
+            (select DISTINCT tws.stack_id from t_ware_store tws
39
+             where tws.cancel_flag ='0' and tws.out_flag ='0' and tws.lock_flag ='0') A)/count(*)*100 AS value1
40
+        from t_maint_stack tms where tms.cancel_flag ='0'
41
+    </select>
42
+
43
+</mapper>

+ 59
- 0
src/main/resource/mapper/ware/StoreMapper.xml Näytä tiedosto

@@ -537,6 +537,65 @@ update t_ware_store t set t.layer =   #{param7,jdbcType=INTEGER}
537 537
      )
538 538
     order by b.code,t.layer desc
539 539
   </select>
540
+
541
+
542
+  <select id="selectStoreTotal" resultMap="TotalResultMap" >
543
+    select sum(t.count) as total_amount
544
+    ,sum(t.weight) as total_weight
545
+    from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d,t_maint_customer e
546
+    where t.ware_id = a.id
547
+    and t.stack_id = b.id
548
+    and t.material_id  = c.id
549
+    and t.customer_id = d.id
550
+    and t.fk_compony_id = e.id
551
+    and  a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
552
+    and  b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
553
+    and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
554
+    and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
555
+    and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
556
+    and  d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
557
+    and  e.name like concat('%',#{param9,jdbcType=VARCHAR},'%')
558
+
559
+    and  (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
560
+    <if test="param13 != null and param13.size() !=0" >
561
+      or t.plate_no IN <foreach  item="item" collection="param13" index="index"  open="(" separator="," close=")">
562
+      #{item,jdbcType=VARCHAR}  </foreach>
563
+    </if>
564
+    )
565
+    and  (t.ord_no like concat('%',#{param11,jdbcType=VARCHAR},'%')
566
+    <if test="param14 != null and param14.size() !=0" >
567
+      OR t.ord_no IN <foreach  item="item" collection="param14" index="index"  open="(" separator="," close=")">
568
+      #{item,jdbcType=VARCHAR}  </foreach>
569
+    </if>
570
+    )
571
+    and  (t.contract_no like concat('%',#{param12,jdbcType=VARCHAR},'%')
572
+    <if test="param15 != null and param15.size() !=0" >
573
+      OR t.contract_no IN <foreach  item="item" collection="param15" index="index"  open="(" separator="," close=")">
574
+      #{item,jdbcType=VARCHAR}  </foreach>
575
+    </if>
576
+    )
577
+    and  (t.pack_no like concat('%',#{param16,jdbcType=VARCHAR},'%')
578
+    <if test="param17 != null and param17.size() !=0" >
579
+      OR t.pack_no IN <foreach  item="item" collection="param17" index="index"  open="(" separator="," close=")">
580
+      #{item,jdbcType=VARCHAR}  </foreach>
581
+    </if>
582
+    )
583
+    and t.belong_id = #{param8,jdbcType=VARCHAR}
584
+    and t.cancel_flag = '0'
585
+    and t.out_flag = #{param18,jdbcType=VARCHAR}
586
+    and t.lock_flag = #{param19,jdbcType=VARCHAR}
587
+    <if test="param20 != null and param20 !=''">
588
+      and t.out_bound = #{param20,jdbcType=VARCHAR}
589
+    </if>
590
+    <if test="param21 != null and param22 != null">
591
+      and t.add_time between #{param21,jdbcType=TIMESTAMP} and #{param22,jdbcType=TIMESTAMP}
592
+    </if>
593
+    and t.ware_id in (
594
+    select m.ware_id from t_maint_userware m  where m.user_id = #{param7,jdbcType=VARCHAR}
595
+    )
596
+    order by b.code,t.layer desc
597
+  </select>
598
+
540 599
   <select id="selectWareStackByDistributionStore" resultMap="StoreOfWareStack" >
541 600
     select distinct  t.ware_id ,t.stack_id
542 601
     from t_ware_store t where t.id in

Loading…
Peruuta
Tallenna