|
|
@@ -1,7 +1,22 @@
|
|
1
|
1
|
package com.chinaitop.agile.controller;
|
|
2
|
2
|
|
|
3
|
|
-import com.chinaitop.agile.model.DataKcglFcbgzDefault;
|
|
4
|
|
-import com.chinaitop.agile.model.DataKcglFcbgzDefaultExample;
|
|
|
3
|
+import java.text.SimpleDateFormat;
|
|
|
4
|
+import java.util.ArrayList;
|
|
|
5
|
+import java.util.Calendar;
|
|
|
6
|
+import java.util.Date;
|
|
|
7
|
+import java.util.HashMap;
|
|
|
8
|
+import java.util.List;
|
|
|
9
|
+import java.util.Map;
|
|
|
10
|
+
|
|
|
11
|
+import javax.annotation.Resource;
|
|
|
12
|
+
|
|
|
13
|
+import org.apache.commons.lang.ObjectUtils;
|
|
|
14
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
15
|
+import org.springframework.http.MediaType;
|
|
|
16
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
17
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
18
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
19
|
+
|
|
5
|
20
|
import com.chinaitop.agile.model.DataKcglKcswDefault;
|
|
6
|
21
|
import com.chinaitop.agile.model.DataKcglKcswDefaultExample;
|
|
7
|
22
|
import com.chinaitop.agile.model.DataKcglKcswDefaultExample.Criteria;
|
|
|
@@ -14,20 +29,11 @@ import com.github.pagehelper.PageHelper;
|
|
14
|
29
|
import com.github.pagehelper.PageInfo;
|
|
15
|
30
|
import com.google.gson.Gson;
|
|
16
|
31
|
import com.google.gson.reflect.TypeToken;
|
|
|
32
|
+
|
|
17
|
33
|
import io.swagger.annotations.Api;
|
|
18
|
34
|
import io.swagger.annotations.ApiImplicitParam;
|
|
19
|
35
|
import io.swagger.annotations.ApiImplicitParams;
|
|
20
|
36
|
import io.swagger.annotations.ApiOperation;
|
|
21
|
|
-import org.apache.commons.lang.ObjectUtils;
|
|
22
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
23
|
|
-import org.springframework.http.MediaType;
|
|
24
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
25
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
26
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
27
|
|
-
|
|
28
|
|
-import javax.annotation.Resource;
|
|
29
|
|
-import java.text.SimpleDateFormat;
|
|
30
|
|
-import java.util.*;
|
|
31
|
37
|
|
|
32
|
38
|
@RestController
|
|
33
|
39
|
@RequestMapping(value="/agile/kcsw")
|
|
|
@@ -101,76 +107,9 @@ public class KcswController {
|
|
101
|
107
|
})
|
|
102
|
108
|
public PageInfo<DataKcglKcswDefault> getList(Integer pageNum, Integer pageSize, String kcswStr,
|
|
103
|
109
|
String order){
|
|
104
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
105
|
|
- DataKcglKcswDefault kcsw = null;
|
|
106
|
110
|
PageInfo<DataKcglKcswDefault> pageInfo = null;
|
|
107
|
|
- Map<String,Object> map = new HashMap<String,Object>();
|
|
108
|
|
- DataKcglKcswDefaultExample example = new DataKcglKcswDefaultExample();
|
|
109
|
|
- DataKcglKcswDefaultExample.Criteria criteria = example.createCriteria();
|
|
110
|
111
|
try {
|
|
111
|
|
- if (null != kcswStr && !"".equals(kcswStr)) {
|
|
112
|
|
- kcsw = mapper.readValue(kcswStr, DataKcglKcswDefault.class);
|
|
113
|
|
- } else {
|
|
114
|
|
- kcsw = new DataKcglKcswDefault();
|
|
115
|
|
- }
|
|
116
|
|
- /* 仓房 */
|
|
117
|
|
- if (null != kcsw.getCh() && !"".equals(kcsw.getCh())) {
|
|
118
|
|
- criteria.andChEqualTo(kcsw.getCh());
|
|
119
|
|
- }
|
|
120
|
|
- /* 货位 */
|
|
121
|
|
- if (null != kcsw.getHwh() && !"".equals(kcsw.getHwh())) {
|
|
122
|
|
- criteria.andHwhEqualTo(kcsw.getHwh());
|
|
123
|
|
- }
|
|
124
|
|
- /* 品种 */
|
|
125
|
|
- if (null != kcsw.getPz() && !"".equals(kcsw.getPz())) {
|
|
126
|
|
- criteria.andPzEqualTo(kcsw.getPz());
|
|
127
|
|
- }
|
|
128
|
|
- /* 单位 */
|
|
129
|
|
- if (null != kcsw.getUnitid() && !"".equals(kcsw.getUnitid())) {
|
|
130
|
|
- criteria.andUnitidEqualTo(kcsw.getUnitid());
|
|
131
|
|
- }
|
|
132
|
|
- /* 归档用最后一次编辑时间 */
|
|
133
|
|
- if (null != kcsw.getModifydate() && !"".equals(kcsw.getModifydate())) {
|
|
134
|
|
- criteria.andModifydateLessThan(kcsw.getModifydate());
|
|
135
|
|
- }
|
|
136
|
|
-
|
|
137
|
|
- if(null != pageNum && null != pageSize){
|
|
138
|
|
- PageHelper.startPage(pageNum, pageSize);
|
|
139
|
|
- }
|
|
140
|
|
- example.setOrderByClause(" to_number(ch) ");
|
|
141
|
|
- /* 1、查询库存实物表数据 */
|
|
142
|
|
- List<DataKcglKcswDefault> list = kcswService.findCondition(example);
|
|
143
|
|
- pageInfo = new PageInfo<DataKcglKcswDefault>(list);
|
|
144
|
|
-
|
|
145
|
|
- /* 2、查询对应仓房的生产年份,ZJ是自检要做判断 */
|
|
146
|
|
- if (!order.equals("ZJ") && null != pageInfo.getList() && pageInfo.getList().size() > 0) {
|
|
147
|
|
- for (DataKcglKcswDefault kcswobj : pageInfo.getList()) {
|
|
148
|
|
- DataKcglFcbgzDefaultExample fcbgz_example = new DataKcglFcbgzDefaultExample();
|
|
149
|
|
- DataKcglFcbgzDefaultExample.Criteria fcbgz_criteria = fcbgz_example.createCriteria();
|
|
150
|
|
- fcbgz_criteria.andUnitidEqualTo(kcsw.getUnitid());
|
|
151
|
|
- fcbgz_criteria.andChEqualTo(kcswobj.getCh());
|
|
152
|
|
- fcbgz_criteria.andHwhEqualTo(kcswobj.getHwh());
|
|
153
|
|
- fcbgz_criteria.andSrslGreaterThan(0d);//收入数量大于0
|
|
154
|
|
- fcbgz_example.setOrderByClause(" rq DESC");
|
|
155
|
|
- List<DataKcglFcbgzDefault> fcbgz_list = fcbgzService.findByList(fcbgz_example);
|
|
156
|
|
- if (null != fcbgz_list && fcbgz_list.size() > 0) {
|
|
157
|
|
- int scnf = Integer.parseInt(ObjectUtils.toString(fcbgz_list.get(0).getScnf(), "0"));
|
|
158
|
|
- kcswobj.setScnf(scnf);
|
|
159
|
|
- }
|
|
160
|
|
- /* 3、查询这个仓房的已验收数量和未验收数量 */
|
|
161
|
|
- map.put("orgId", kcsw.getUnitid());
|
|
162
|
|
- map.put("ch", kcswobj.getCh());
|
|
163
|
|
- map.put("hwh", kcswobj.getHwh());
|
|
164
|
|
- map.put("scnd", kcswobj.getScnf());
|
|
165
|
|
- Map<String,Object> ysxx_map = kcswService.findNumManager(map);
|
|
166
|
|
- double kcsl = kcswobj.getKcsl();
|
|
167
|
|
- double rksl = Double.parseDouble(ysxx_map.get("rksl").toString());
|
|
168
|
|
- rksl = rksl * 1000;
|
|
169
|
|
- double wyssl = kcsl - rksl;
|
|
170
|
|
- kcswobj.setRksl(rksl);
|
|
171
|
|
- kcswobj.setWyssl(wyssl);
|
|
172
|
|
- }
|
|
173
|
|
- }
|
|
|
112
|
+ pageInfo = kcswService.queryYYSSL(pageNum, pageSize, kcswStr, order);
|
|
174
|
113
|
} catch (Exception e) {
|
|
175
|
114
|
e.printStackTrace();
|
|
176
|
115
|
}
|