Kaynağa Gözat

垛位管理

dxq 3 ay önce
ebeveyn
işleme
2811a5b654

+ 93
- 0
sto/src/main/java/com/shinsoft/sto/controller/main/StackController.java Dosyayı Görüntüle

@@ -0,0 +1,93 @@
1
+package com.shinsoft.sto.controller.main;
2
+
3
+import com.shinsoft.sto.model.system.ResponseCodeMsg;
4
+import com.shinsoft.sto.model.system.ResultJSON;
5
+import com.shinsoft.sto.service.main.StackService;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.web.bind.annotation.RequestMapping;
8
+import org.springframework.web.bind.annotation.RequestMethod;
9
+import org.springframework.web.bind.annotation.RequestParam;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+
14
+@RestController
15
+@RequestMapping(value = "/MaintStack")
16
+public class StackController {
17
+
18
+    @Autowired
19
+    private StackService stackService;
20
+
21
+    @RequestMapping(value = {"/query", "/query.do"})
22
+    public ResultJSON query( int page,
23
+                            int rows,
24
+                            @RequestParam(required = false) String query,
25
+                            @RequestParam(required = false) String queryWare,
26
+                            HttpServletRequest request) {
27
+        try {
28
+            String userId = resolveUserId(request);
29
+            String belongId = resolveBelongId(request);
30
+            return stackService.query(page, rows, query, queryWare, userId, belongId);
31
+        } catch (Exception ex) {
32
+            ex.printStackTrace();
33
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
34
+        }
35
+    }
36
+
37
+    @RequestMapping(value = {"/queryByWareId", "/queryByWareId.do"})
38
+    public ResultJSON queryByWareId(@RequestParam String wareId,
39
+                                    @RequestParam(required = false) String areaId,
40
+                                    HttpServletRequest request) {
41
+        try {
42
+            String userId = resolveUserId(request);
43
+            String belongId = resolveBelongId(request);
44
+            return stackService.queryByWareId(wareId, areaId, userId, belongId);
45
+        } catch (Exception ex) {
46
+            ex.printStackTrace();
47
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
48
+        }
49
+    }
50
+
51
+    @RequestMapping(value = {"/save", "/save.do"}, method = RequestMethod.POST)
52
+    public ResultJSON save(@RequestParam String json, HttpServletRequest request) {
53
+        try {
54
+            String userId = resolveUserId(request);
55
+            String belongId = resolveBelongId(request);
56
+            return stackService.save(json, userId, belongId);
57
+        } catch (Exception ex) {
58
+            ex.printStackTrace();
59
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
60
+        }
61
+    }
62
+
63
+    @RequestMapping(value = {"/remove", "/remove.do"}, method = RequestMethod.POST)
64
+    public ResultJSON remove(@RequestParam String id, HttpServletRequest request) {
65
+        try {
66
+            String userId = resolveUserId(request);
67
+            return stackService.remove(id, userId);
68
+        } catch (NullPointerException ex) {
69
+            ex.printStackTrace();
70
+            return ResultJSON.error(ResponseCodeMsg.CODE_NULL, ResponseCodeMsg.MSG_NULL);
71
+        } catch (Exception ex) {
72
+            ex.printStackTrace();
73
+            return ResultJSON.error(ResponseCodeMsg.CODE_EX, ex.getMessage());
74
+        }
75
+    }
76
+
77
+    private String resolveUserId(HttpServletRequest request) {
78
+        String userId = (String) request.getHeader("userId");
79
+        if (userId == null) {
80
+            userId = (String) request.getAttribute("userId");
81
+        }
82
+        return userId;
83
+    }
84
+
85
+    private String resolveBelongId(HttpServletRequest request) {
86
+        String belongId = (String) request.getHeader("belongId");
87
+        if (belongId == null) {
88
+            belongId = (String) request.getAttribute("belongId");
89
+        }
90
+        return belongId;
91
+    }
92
+}
93
+

+ 30
- 0
sto/src/main/java/com/shinsoft/sto/mapper/main/StackMapper.java Dosyayı Görüntüle

@@ -0,0 +1,30 @@
1
+package com.shinsoft.sto.mapper.main;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.shinsoft.sto.model.main.Cargo;
6
+import com.shinsoft.sto.model.main.Customer;
7
+import com.shinsoft.sto.model.main.Stack;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+public interface StackMapper extends BaseMapper<Stack> {
13
+
14
+//    int insert(Stack record);
15
+
16
+    int insertSelective(Stack record);
17
+
18
+    Stack selectByPrimaryKey(String id);
19
+
20
+    int updateByPrimaryKeySelective(Stack record);
21
+
22
+//    int updateByPrimaryKey(Stack record);
23
+
24
+    Page<Stack> select(Page<Stack> page, @Param("query") String query, @Param("queryWare") String queryWare, @Param("belongId") String belongId);
25
+
26
+    List<Stack> selectByWareId(String wareId, String areaid, String belongId);
27
+
28
+
29
+    Stack selectByWareNameStackName(String wareName, String stackName, String userId, String belongId);
30
+}

+ 227
- 0
sto/src/main/java/com/shinsoft/sto/mapper/main/StackMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,227 @@
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.main.StackMapper" >
4
+  <resultMap id="BaseResultMap" type="com.shinsoft.sto.model.main.Stack" >
5
+    <id column="id" property="id" jdbcType="VARCHAR" />
6
+
7
+    <result column="name" property="name" jdbcType="VARCHAR" />
8
+    <result column="code" property="code" jdbcType="VARCHAR" />
9
+    <result column="add_id" property="addId" jdbcType="VARCHAR" />
10
+    <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
11
+    <result column="modify_id" property="modifyId" jdbcType="VARCHAR" />
12
+    <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
13
+    <result column="cancel_id" property="cancelId" jdbcType="VARCHAR" />
14
+    <result column="cancel_time" property="cancelTime" jdbcType="TIMESTAMP" />
15
+    <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
16
+    <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
17
+    <result column="stack_x" property="stackX" jdbcType="INTEGER" />
18
+    <result column="stack_y" property="stackY" jdbcType="INTEGER" />
19
+    <result column="width" property="width" jdbcType="INTEGER" />
20
+    <result column="height" property="height" jdbcType="INTEGER" />
21
+    <result column="is_layer" property="isLayer" jdbcType="VARCHAR" />
22
+    <result column="on_stack_amt" property="onStackAmt" jdbcType="INTEGER" />
23
+    <result column="ware_id" property="wareId" jdbcType="VARCHAR" />
24
+  </resultMap>
25
+  <sql id="Base_Column_List" >
26
+    id, ware_id, name, code, add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, 
27
+    cancel_flag, belong_id, stack_x, stack_y, width, height,is_layer
28
+  </sql>
29
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
30
+    select id
31
+    from t_main_stack
32
+    where id = #{id}
33
+  </select>
34
+
35
+
36
+  <insert id="insertSelective" parameterType="com.shinsoft.sto.model.main.Stack" >
37
+    insert into t_maint_stack
38
+    <trim prefix="(" suffix=")" suffixOverrides="," >
39
+      <if test="id != null" >
40
+        id,
41
+      </if>
42
+      <if test="wareId != null" >
43
+        ware_id,
44
+      </if>
45
+      <if test="name != null" >
46
+        name,
47
+      </if>
48
+      <if test="code != null" >
49
+        code,
50
+      </if>
51
+      <if test="addId != null" >
52
+        add_id,
53
+      </if>
54
+      <if test="addTime != null" >
55
+        add_time,
56
+      </if>
57
+      <if test="modifyId != null" >
58
+        modify_id,
59
+      </if>
60
+      <if test="modifyTime != null" >
61
+        modify_time,
62
+      </if>
63
+      <if test="cancelId != null" >
64
+        cancel_id,
65
+      </if>
66
+      <if test="cancelTime != null" >
67
+        cancel_time,
68
+      </if>
69
+      <if test="cancelFlag != null" >
70
+        cancel_flag,
71
+      </if>
72
+      <if test="belongId != null" >
73
+        belong_id,
74
+      </if>
75
+    </trim>
76
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
77
+      <if test="id != null" >
78
+        #{id,jdbcType=VARCHAR},
79
+      </if>
80
+      <if test="wareId != null" >
81
+        #{wareId,jdbcType=VARCHAR},
82
+      </if>
83
+      <if test="name != null" >
84
+        #{name,jdbcType=VARCHAR},
85
+      </if>
86
+      <if test="code != null" >
87
+        #{code,jdbcType=VARCHAR},
88
+      </if>
89
+      <if test="addId != null" >
90
+        #{addId,jdbcType=VARCHAR},
91
+      </if>
92
+      <if test="addTime != null" >
93
+        #{addTime,jdbcType=TIMESTAMP},
94
+      </if>
95
+      <if test="modifyId != null" >
96
+        #{modifyId,jdbcType=VARCHAR},
97
+      </if>
98
+      <if test="modifyTime != null" >
99
+        #{modifyTime,jdbcType=TIMESTAMP},
100
+      </if>
101
+      <if test="cancelId != null" >
102
+        #{cancelId,jdbcType=VARCHAR},
103
+      </if>
104
+      <if test="cancelTime != null" >
105
+        #{cancelTime,jdbcType=TIMESTAMP},
106
+      </if>
107
+      <if test="cancelFlag != null" >
108
+        #{cancelFlag,jdbcType=VARCHAR},
109
+      </if>
110
+      <if test="belongId != null" >
111
+        #{belongId,jdbcType=VARCHAR},
112
+      </if>
113
+    </trim>
114
+  </insert>
115
+  <update id="updateByPrimaryKeySelective" parameterType="com.shinsoft.sto.model.main.Stack" >
116
+    update t_maint_stack
117
+    <set >
118
+      <if test="wareId != null" >
119
+        ware_id = #{wareId,jdbcType=VARCHAR},
120
+      </if>
121
+      <if test="name != null" >
122
+        name = #{name,jdbcType=VARCHAR},
123
+      </if>
124
+      <if test="code != null" >
125
+        code = #{code,jdbcType=VARCHAR},
126
+      </if>
127
+      <if test="addId != null" >
128
+        add_id = #{addId,jdbcType=VARCHAR},
129
+      </if>
130
+      <if test="addTime != null" >
131
+        add_time = #{addTime,jdbcType=TIMESTAMP},
132
+      </if>
133
+      <if test="modifyId != null" >
134
+        modify_id = #{modifyId,jdbcType=VARCHAR},
135
+      </if>
136
+      <if test="modifyTime != null" >
137
+        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
138
+      </if>
139
+      <if test="cancelId != null" >
140
+        cancel_id = #{cancelId,jdbcType=VARCHAR},
141
+      </if>
142
+      <if test="cancelTime != null" >
143
+        cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
144
+      </if>
145
+      <if test="cancelFlag != null" >
146
+        cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
147
+      </if>
148
+      <if test="belongId != null" >
149
+        belong_id = #{belongId,jdbcType=VARCHAR},
150
+      </if>
151
+    </set>
152
+    where id = #{id,jdbcType=VARCHAR}
153
+  </update>
154
+  <update id="updateByPrimaryKey" parameterType="com.shinsoft.sto.model.main.Stack" >
155
+    update t_maint_stack
156
+    set ware_id = #{ware.id,jdbcType=VARCHAR},
157
+      name = #{name,jdbcType=VARCHAR},
158
+      code = #{code,jdbcType=VARCHAR},
159
+      add_id = #{addId,jdbcType=VARCHAR},
160
+      add_time = #{addTime,jdbcType=TIMESTAMP},
161
+      modify_id = #{modifyId,jdbcType=VARCHAR},
162
+      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
163
+      cancel_id = #{cancelId,jdbcType=VARCHAR},
164
+      cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
165
+      cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
166
+      belong_id = #{belongId,jdbcType=VARCHAR},
167
+        stack_x = #{stackX,jdbcType=INTEGER},
168
+      stack_y = #{stackY,jdbcType=INTEGER},
169
+      width = #{width,jdbcType=INTEGER},
170
+      height = #{height,jdbcType=INTEGER},
171
+     is_layer = #{isLayer,jdbcType=INTEGER}
172
+    where id = #{id,jdbcType=VARCHAR}
173
+  </update>
174
+
175
+
176
+
177
+  <select id="select" resultMap="BaseResultMap" >
178
+    select t.*,w.ware_nm wareName
179
+    from t_main_stack t left join t_main_ware w on w.id = t.ware_id
180
+    where  1=1
181
+    <if test="query !=null and query !=''">
182
+      and (t.name like '%' || #{query} || '%'
183
+      or t.code like '%' || #{query} || '%')
184
+    </if>
185
+    <if test="queryWare !=null and queryWare != ''" >
186
+      and  t.ware_id = #{queryWare}
187
+    </if>
188
+    and   t.belong_id = #{belongId}
189
+    and t.cancel_flag = '0'
190
+    order by t.code
191
+  </select>
192
+
193
+
194
+
195
+  <select id="selectByWareId" resultMap="BaseResultMap" >
196
+    select t.*
197
+       ,b.on_stack_amt
198
+    from t_maint_stack t
199
+        left outer join (select temp.stack_id
200
+                 ,count(*) as on_stack_amt
201
+          from t_ware_store temp
202
+          where (temp.cancel_flag is null  or temp.cancel_flag = '0')
203
+          and (temp.out_flag is null or temp.out_flag = '0')
204
+          group by temp.stack_id) b
205
+    on t.id = b.stack_id
206
+    where   t.ware_id =  #{param1,jdbcType=VARCHAR}
207
+      and substr(t.code,2,1) =  #{param2,jdbcType=VARCHAR}
208
+    and   t.belong_id =  #{param3,jdbcType=VARCHAR}
209
+    and ifnull(t.cancel_flag,'0') = '0'
210
+    order by t.code
211
+
212
+  </select>
213
+
214
+
215
+  <select id="selectByWareNameStackName" resultMap="BaseResultMap" >
216
+    select t.*
217
+    from t_maint_stack t ,t_maint_ware d
218
+    where t.ware_id = d.id
219
+    and d.id in  (
220
+    select  a.ware_id from t_maint_userware a where  a.user_id = #{param3,jdbcType=VARCHAR}
221
+    )  and d.name = #{param1,jdbcType=VARCHAR}
222
+    and t.name = #{param2,jdbcType=VARCHAR}
223
+    and   t.belong_id = #{param4,jdbcType=VARCHAR}
224
+    and ifnull(t.cancel_flag,'0') = '0'
225
+    order by t.code
226
+  </select>
227
+</mapper>

+ 2
- 0
sto/src/main/java/com/shinsoft/sto/mapper/main/WareMapper.java Dosyayı Görüntüle

@@ -11,4 +11,6 @@ public interface WareMapper extends BaseMapper<Ware> {
11 11
 
12 12
     @Select("SELECT id AS value, ware_nm AS label FROM T_MAIN_WARE WHERE NVL(cancel_flag,'0') = '0' ORDER BY add_time DESC")
13 13
     List<selectModel> selectWareOptions();
14
+    Ware selectByWareId(String wareId, String userId, String belongId);
15
+
14 16
 }

+ 81
- 0
sto/src/main/java/com/shinsoft/sto/mapper/main/WareMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,81 @@
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.main.WareMapper" >
4
+  <resultMap id="BaseResultMap" type="com.shinsoft.sto.model.main.Ware" >
5
+    <id column="id" property="id" jdbcType="VARCHAR" />
6
+    <result column="name" property="wareNm" jdbcType="VARCHAR" />
7
+    <result column="code" property="wareCode" jdbcType="VARCHAR" />
8
+    <result column="add_id" property="addId" jdbcType="VARCHAR" />
9
+    <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
10
+    <result column="modify_id" property="modifyId" jdbcType="VARCHAR" />
11
+    <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
12
+    <result column="cancel_id" property="cancelId" jdbcType="VARCHAR" />
13
+    <result column="cancel_time" property="cancelTime" jdbcType="TIMESTAMP" />
14
+    <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
15
+    <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
16
+    <result column="width" property="wareWidth" jdbcType="INTEGER" />
17
+    <result column="height" property="wareLength" jdbcType="INTEGER" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, name, code, add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, 
21
+    cancel_flag, belong_id, width, height
22
+  </sql>
23
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
24
+    select 
25
+    <include refid="Base_Column_List" />
26
+    from t_maint_ware
27
+    where id = #{id,jdbcType=VARCHAR}
28
+  </select>
29
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
30
+    delete from t_maint_ware
31
+    where id = #{id,jdbcType=VARCHAR}
32
+  </delete>
33
+
34
+
35
+
36
+
37
+
38
+  <select id="select" resultMap="BaseResultMap" >
39
+    select *
40
+    from t_maint_ware
41
+    where (name like concat('%',#{param1,jdbcType=VARCHAR},'%') or code like concat('%',#{param1,jdbcType=VARCHAR},'%'))
42
+    and   belong_id = #{param2,jdbcType=VARCHAR}
43
+    and ifnull(cancel_flag,'0') = '0'
44
+  </select>
45
+
46
+  <select id="selectAll" resultMap="BaseResultMap" >
47
+    select *
48
+    from t_maint_ware
49
+    where belong_id = #{param1,jdbcType=VARCHAR}
50
+    and ifnull(cancel_flag,'0') = '0'
51
+  </select>
52
+
53
+  <select id="selectByUserId" resultMap="BaseResultMap" >
54
+     select t.*  from t_maint_ware t
55
+  where t.id in (
56
+ select  d.ware_id from t_maint_userware d where t.id = d.ware_id and d.user_id = #{param1,jdbcType=VARCHAR}
57
+) and  t.belong_id = #{param2,jdbcType=VARCHAR}
58
+    and ifnull(t.cancel_flag,'0') = '0'
59
+  </select>
60
+
61
+
62
+  <select id="selectByWareName" resultMap="BaseResultMap" >
63
+     select t.*  from t_maint_ware t
64
+  where t.id in  (
65
+ select  d.ware_id from t_maint_userware d where t.id = d.ware_id and d.user_id = #{param2,jdbcType=VARCHAR}
66
+)
67
+and t.name =   #{param1,jdbcType=VARCHAR}
68
+and  t.belong_id = #{param3,jdbcType=VARCHAR}
69
+    and ifnull(t.cancel_flag,'0') = '0'
70
+  </select>
71
+
72
+  <select id="selectByWareId" resultMap="BaseResultMap" >
73
+     select t.*  from t_maint_ware t
74
+  where t.id in  (
75
+ select  d.ware_id from t_maint_userware d where t.id = d.ware_id and d.user_id = #{param2,jdbcType=VARCHAR}
76
+)
77
+and t.id =   #{param1,jdbcType=VARCHAR}
78
+and  t.belong_id = #{param3,jdbcType=VARCHAR}
79
+    and ifnull(t.cancel_flag,'0') = '0'
80
+  </select>
81
+</mapper>

+ 55
- 0
sto/src/main/java/com/shinsoft/sto/model/main/Stack.java Dosyayı Görüntüle

@@ -0,0 +1,55 @@
1
+package com.shinsoft.sto.model.main;
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 lombok.Getter;
8
+import lombok.Setter;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.util.Date;
12
+@Getter
13
+@Setter
14
+@Accessors(chain = true)
15
+@TableName("T_MAIN_STACK")
16
+@ApiModel(value = "垛位", description = "垛位基本信息表")
17
+public class Stack extends BaseModel {
18
+
19
+    private String wareId;
20
+    @TableField(exist = false)
21
+    private String wareName;
22
+
23
+    private String name;
24
+
25
+    private String code;
26
+
27
+    private String addId;
28
+
29
+    private Date addTime;
30
+
31
+    private String modifyId;
32
+
33
+    private Date modifyTime;
34
+
35
+    private String cancelId;
36
+
37
+    private Date cancelTime;
38
+
39
+    private String cancelFlag;
40
+
41
+    private String belongId;
42
+
43
+    private Integer stackX;
44
+
45
+    private Integer stackY;
46
+
47
+    private Integer width;
48
+
49
+    private Integer height;
50
+
51
+    private String isLayer;
52
+
53
+    private Integer onStackAmt;
54
+
55
+}

+ 84
- 0
sto/src/main/java/com/shinsoft/sto/service/impl/main/StackServiceImpl.java Dosyayı Görüntüle

@@ -0,0 +1,84 @@
1
+package com.shinsoft.sto.service.impl.main;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.alibaba.fastjson.TypeReference;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
+import com.shinsoft.sto.mapper.main.StackMapper;
8
+import com.shinsoft.sto.model.main.Stack;
9
+import com.shinsoft.sto.model.system.ResponseCodeMsg;
10
+import com.shinsoft.sto.model.system.ResultJSON;
11
+import com.shinsoft.sto.service.main.StackService;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Service;
14
+
15
+import java.util.Date;
16
+import java.util.List;
17
+
18
+@Service("StackService")
19
+public class StackServiceImpl implements StackService {
20
+
21
+    @Autowired
22
+    private StackMapper stackMapper;
23
+
24
+    @Override
25
+    public ResultJSON query(int page, int rows, String query, String queryWare, String userId, String belongId) {
26
+        Page<Stack> pricePage = new Page<>(page, rows);
27
+        Page<Stack> list = stackMapper.select(pricePage, query, queryWare, belongId);
28
+        return ResultJSON.success(list);
29
+    }
30
+
31
+    @Override
32
+    public ResultJSON save(String json, String userId, String belongId) {
33
+        JSONObject object = JSON.parseObject(json);
34
+//        String wareName = object.getJSONObject("ware").getString("name");
35
+        String wareName = object.getString("wareId");
36
+        Stack stack = JSON.parseObject(json, new TypeReference<Stack>() {
37
+        });
38
+        stack.setWareId(wareName);
39
+
40
+        int num;
41
+        if (stack.getId() == null || stack.getId().equals("")) {
42
+            stack.setAddId(userId);
43
+            stack.setAddTime(new Date());
44
+            stack.setModifyId(userId);
45
+            stack.setModifyTime(new Date());
46
+            stack.setCancelFlag("0");
47
+            stack.setBelongId(belongId);
48
+            num = stackMapper.insert(stack);
49
+            if (num > 0) {
50
+                return ResultJSON.success("新增成功");
51
+            }
52
+        } else {
53
+            stack.setModifyId(userId);
54
+            stack.setModifyTime(new Date());
55
+            num = stackMapper.updateById(stack);
56
+            if (num > 0) {
57
+                return ResultJSON.success("更新成功");
58
+            }
59
+        }
60
+        return ResultJSON.error(ResponseCodeMsg.CODE_FAIL, "操作失败,未执行成功");
61
+    }
62
+
63
+    @Override
64
+    public ResultJSON remove(String id, String userId) {
65
+        Stack stack = stackMapper.selectByPrimaryKey(id);
66
+        if (stack == null) {
67
+            return ResultJSON.error(ResponseCodeMsg.CODE_NOT_FOUND, "垛位不存在");
68
+        }
69
+        stack.setCancelFlag("9");
70
+        stack.setCancelId(userId);
71
+        stack.setCancelTime(new Date());
72
+        int num = stackMapper.updateById(stack);
73
+        if (num > 0) {
74
+            return ResultJSON.success("删除成功");
75
+        }
76
+        return ResultJSON.error(ResponseCodeMsg.CODE_FAIL, "操作失败,未执行成功");
77
+    }
78
+
79
+    @Override
80
+    public ResultJSON queryByWareId(String wareId, String areaId, String userId, String belongId) {
81
+        List<Stack> list = stackMapper.selectByWareId(wareId, areaId, belongId);
82
+        return ResultJSON.success(list);
83
+    }
84
+}

+ 13
- 0
sto/src/main/java/com/shinsoft/sto/service/main/StackService.java Dosyayı Görüntüle

@@ -0,0 +1,13 @@
1
+package com.shinsoft.sto.service.main;
2
+
3
+import com.shinsoft.sto.model.system.ResultJSON;
4
+
5
+public interface StackService {
6
+    ResultJSON query(int page, int rows, String query, String queryWare, String userId, String belongId);
7
+
8
+    ResultJSON save(String json, String userId, String belongId);
9
+
10
+    ResultJSON remove(String id, String userId);
11
+
12
+    ResultJSON queryByWareId(String wareId, String areaId, String userId, String belongId);
13
+}

+ 249
- 0
sto/src/main/java/com/shinsoft/sto/tools/Tools.java Dosyayı Görüntüle

@@ -0,0 +1,249 @@
1
+package com.shinsoft.sto.tools;
2
+
3
+
4
+import com.shinsoft.frameworkapi.model.*;
5
+
6
+import javax.servlet.http.HttpServletResponse;
7
+import java.io.IOException;
8
+import java.io.OutputStream;
9
+import java.io.PrintWriter;
10
+import java.util.*;
11
+
12
+public class Tools {
13
+
14
+
15
+    public static void out(HttpServletResponse response, String result) {
16
+        //下半部分固定格式 给jsp返回数据
17
+        try {
18
+            System.out.println("result=" + result);
19
+            response.setCharacterEncoding("utf-8");
20
+            response.setHeader("Content-type", "text/html;charset=utf-8");
21
+//            response.setHeader("Access-Control-Allow-Origin","*");
22
+//            response.setHeader("Access-Control-Request-Methods","GET,POST,OPTIONS,PUT,DELETE");
23
+//            response.setHeader("Access-Control-Request-Headers","x-requested-with,content-type");
24
+            PrintWriter out = null;
25
+            out = response.getWriter();
26
+            out.print(result);
27
+            out.flush();
28
+            out.close();
29
+
30
+        } catch (IOException e) {
31
+            e.printStackTrace();
32
+        }
33
+    }
34
+
35
+    public static String getRandomFour() {
36
+
37
+        int intCount = 0;
38
+
39
+        intCount = (new Random()).nextInt(9999);//
40
+
41
+        if (intCount < 1000)
42
+            intCount += 1000;
43
+
44
+
45
+        return intCount + "";
46
+    }
47
+
48
+    public static String moreThanZero(int num) {
49
+        if (num > 0) {
50
+            return Type.SUCCESS;
51
+        } else {
52
+            return Type.FAIL;
53
+        }
54
+    }
55
+
56
+
57
+    public static String moreThanZeroResultJSON(int num) {
58
+        if (num > 0) {
59
+            return JSONTools.toStringyyyyMMdd(num);
60
+        } else {
61
+            return JSONTools.toString(1,"操作失败,未执行成功");
62
+        }
63
+    }
64
+
65
+    public static List<TreeNode> getTree(List<SysMenu> list, String pid) {
66
+        List<TreeNode> tree = new ArrayList<TreeNode>();
67
+        for (int i = 0; i < list.size(); i++) {
68
+            if (list.get(i).getMenuPid().equals(pid)) {
69
+                TreeNode tn = new TreeNode();
70
+                tn.setId(list.get(i).getId());
71
+                tn.setCode(list.get(i).getMenuCode());
72
+                tn.setText(list.get(i).getMenuName());
73
+                if (list.get(i).getMenuShow() == null) {
74
+                    tn.setState("0");
75
+                } else {
76
+                    tn.setState(list.get(i).getMenuShow() + "");
77
+                }
78
+                tn.setUrl(list.get(i).getMenuOpenBs());
79
+
80
+                List<TreeNode> children = getTree(list, list.get(i)
81
+                        .getMenuCode());
82
+                tn.setChildren(children);
83
+
84
+                tree.add(tn);
85
+            }
86
+        }
87
+
88
+        return tree;
89
+    }
90
+
91
+
92
+
93
+    public static List<TreeNode> getTreeVue(List<SysMenu> list, String pid) {
94
+        List<TreeNode> tree = new ArrayList<TreeNode>();
95
+        for (int i = 0; i < list.size(); i++) {
96
+            if (list.get(i).getMenuPid().equals(pid)) {
97
+                TreeNode tn = new TreeNode();
98
+                tn.setId(list.get(i).getId());
99
+                tn.setCode(list.get(i).getMenuCode());
100
+                tn.setText(list.get(i).getMenuName());
101
+                tn.setState(list.get(i).getMenuOpenAnd());
102
+                tn.setUrl(list.get(i).getMenuOpenCs());
103
+
104
+                List<TreeNode> children = getTreeVue(list, list.get(i)
105
+                        .getMenuCode());
106
+                tn.setChildren(children);
107
+
108
+                tree.add(tn);
109
+            }
110
+        }
111
+
112
+        return tree;
113
+    }
114
+
115
+
116
+    public static List<TreeNode> getDeptTree(List<SysDepartment> list, String pid) {
117
+        List<TreeNode> tree = new ArrayList<TreeNode>();
118
+        for (int i = 0; i < list.size(); i++) {
119
+            if (list.get(i).getFId().equals(pid)) {
120
+                TreeNode tn = new TreeNode();
121
+                tn.setId(list.get(i).getId());
122
+                //	tn.setCode(list.get(i).getMenuCode());
123
+                tn.setText(list.get(i).getDeptName());
124
+                tn.setState("open");
125
+//				tn.setUrl(list.get(i).getMenuDesc());
126
+//				tn.setMemo(list.get(i).getMenuOpen());
127
+                List<TreeNode> children = getDeptTree(list, list.get(i)
128
+                        .getId() + "");
129
+                tn.setChildren(children);
130
+
131
+                tree.add(tn);
132
+            }
133
+        }
134
+
135
+        return tree;
136
+    }
137
+
138
+
139
+
140
+
141
+
142
+    ///123423456
143
+    public static OutputStream getExportOutStream(String filename, HttpServletResponse response) {
144
+        OutputStream out = null;
145
+        try {
146
+            response.setContentType("application/vnd.ms-excel");
147
+            response.setHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes("UTF-8"), "ISO8859-1"));
148
+            out = response.getOutputStream();
149
+        } catch (Exception ex) {
150
+            ex.printStackTrace();
151
+        } finally {
152
+            return out;
153
+        }
154
+    }
155
+
156
+    //888888
157
+    public static String[] getDicKeyToArrStr(List<SysDic> list) {
158
+        String[] result = new String[list.size()];
159
+        for (int i = 0; i < list.size(); i++) {
160
+            result[i] = list.get(i).getDicCode();
161
+        }
162
+        return result;
163
+    }
164
+
165
+    public static String[] getDicValueToArrStr(List<SysDic> list) {
166
+        String[] result = new String[list.size()];
167
+        for (int i = 0; i < list.size(); i++) {
168
+            result[i] = list.get(i).getDicName();
169
+        }
170
+        return result;
171
+    }
172
+
173
+    public static Map<String, Integer[]> getStrToMapInt(String ids) {
174
+
175
+        String[] srtIds = ids.split(",");
176
+        Integer[] intIds = new Integer[srtIds.length];
177
+        for (int i = 0; i < intIds.length; i++) {
178
+            intIds[i] = Integer.parseInt(srtIds[i]);
179
+        }
180
+        Map<String, Integer[]> mapIds = new HashMap<String, Integer[]>();
181
+        mapIds.put("ids", intIds);
182
+
183
+        return mapIds;
184
+    }
185
+
186
+    public static Integer[] getStrToArrInt(String ids) {
187
+
188
+        String[] srtIds = ids.split(",");
189
+        Integer[] intIds = new Integer[srtIds.length];
190
+        for (int i = 0; i < intIds.length; i++) {
191
+            intIds[i] = Integer.parseInt(srtIds[i]);
192
+        }
193
+
194
+        return intIds;
195
+    }
196
+
197
+    public static List<Integer> getStrToListInt(String ids) {
198
+
199
+        String[] srtIds = ids.split(",");
200
+
201
+        List<Integer> list = new ArrayList<Integer>();
202
+        for (int i = 0; i < srtIds.length; i++) {
203
+            list.add(Integer.parseInt(srtIds[i]));
204
+        }
205
+
206
+        return list;
207
+    }
208
+
209
+    public static String getArrStrToStr(String[] arr) {
210
+
211
+        String result = "";
212
+        for (int i = 0; i < arr.length; i++) {
213
+            result += arr[i] + ",";
214
+        }
215
+        if (result.endsWith(",")) {
216
+            result = result.substring(0, result.length() - 1);
217
+        }
218
+        return result;
219
+    }
220
+
221
+    public static List<TreeNode> getRoute(List<SysMenu> list, String pid) {
222
+
223
+        List<TreeNode> tree = new ArrayList<TreeNode>();
224
+        for (int i = 0; i < list.size(); i++) {
225
+            if (list.get(i).getAttr1().equals(pid)) {
226
+                TreeNode tn = new TreeNode();
227
+                tn.setId(list.get(i).getId());
228
+                tn.setCode(list.get(i).getMenuCode());
229
+                tn.setText(list.get(i).getMenuName());
230
+                if (list.get(i).getMenuShow() == null) {
231
+                    tn.setState("0");
232
+                } else {
233
+                    tn.setState(list.get(i).getMenuShow() + "");
234
+                }
235
+                tn.setUrl(list.get(i).getMenuOpenBs());
236
+
237
+                List<TreeNode> children = getRoute(list, list.get(i)
238
+                        .getMenuCode());
239
+                tn.setChildren(children);
240
+
241
+                tree.add(tn);
242
+            }
243
+        }
244
+
245
+        return tree;
246
+
247
+
248
+    }
249
+}

Loading…
İptal
Kaydet