Procházet zdrojové kódy

库存数量管理已验收数量需求变更开发

fanxw před 5 roky
rodič
revize
ec9fa454ac

+ 19 - 80
src/main/java/com/chinaitop/agile/controller/KcswController.java

@@ -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
 		}

+ 9 - 1
src/main/java/com/chinaitop/agile/mapper/DataKcglKcswDefaultMapper.java

@@ -90,7 +90,14 @@ public interface DataKcglKcswDefaultMapper {
90 90
     List<Map<String, Object>> getCrudeOilList(Map<String, Object> map);
91 91
 
92 92
     /**
93
-     * 查询已验收数量
93
+     * 查询验收类型和已验收数量
94
+     * @param map
95
+     * @return
96
+     */
97
+    List<Map<String, Object>> queryYYSSL(Map<String, Object> map);
98
+
99
+    /**
100
+     * 查询入库验收的已验收数量
94 101
      * 
95 102
      * @param map
96 103
      * @return
@@ -100,4 +107,5 @@ public interface DataKcglKcswDefaultMapper {
100 107
     List<DataKcglKcswDefault> findListOrRcsj(Map<String, Object> map);
101 108
 
102 109
     List<Map<String, Object>> findCondition(Map<String, Object> map);
110
+
103 111
 }

+ 20 - 1
src/main/java/com/chinaitop/agile/mapper/DataKcglKcswDefaultMapper.xml

@@ -1514,7 +1514,26 @@
1514 1514
 		) datas
1515 1515
 		order by datas.rq desc
1516 1516
   </select>
1517
-  
1517
+  <!-- 查询已验收数量 -->
1518
+  <select id="queryYYSSL" parameterType="java.util.Map" resultType="java.util.Map">
1519
+	    select a.check_type_num checktype,a.rksl rksl,a.accept_date accept_date from depot:storage_grain_card a
1520
+	    left join depot:basic_enum b on b.enumname=a.scnd and b.parentid=1004 
1521
+	    where 1=1 
1522
+	    <if test="orgId != null">
1523
+		and a.org_id = #{orgId} 
1524
+		</if>
1525
+		<if test="ch != null">
1526
+		and a.storehouse_id=#{ch} 
1527
+		</if>
1528
+		<if test="hwh != null">
1529
+		and a.warehouse_id=#{hwh} 
1530
+		</if>
1531
+		<if test="scnd != null">
1532
+		and b.enumid=#{scnd} 
1533
+		</if>
1534
+	    order by a.accept_date desc
1535
+  </select>
1536
+  <!-- 查询验收方式为入库验收的验收数量 -->
1518 1537
   <select id="findNumManager" parameterType="java.util.Map" resultType="java.util.Map">
1519 1538
 	    select nvl(sum(a.rksl), 0) rksl from depot:storage_grain_card a
1520 1539
 	    left join depot:basic_enum b on b.enumname=a.scnd and b.parentid=1004 

+ 13 - 0
src/main/java/com/chinaitop/agile/service/KcswService.java

@@ -2,6 +2,7 @@ package com.chinaitop.agile.service;
2 2
 
3 3
 import com.chinaitop.agile.model.DataKcglKcswDefault;
4 4
 import com.chinaitop.agile.model.DataKcglKcswDefaultExample;
5
+import com.github.pagehelper.PageInfo;
5 6
 
6 7
 import java.util.List;
7 8
 import java.util.Map;
@@ -107,4 +108,16 @@ public interface KcswService {
107 108
      * @return
108 109
      */
109 110
 	Map<String, Object> countByBlType(Integer orgId);
111
+
112
+	/**
113
+	 * 查询库存数量列表
114
+	 * 
115
+	 * @param pageNum
116
+	 * @param pageSize
117
+	 * @param kcswStr
118
+	 * @param order
119
+	 * @return
120
+	 * @throws Exception
121
+	 */
122
+	PageInfo<DataKcglKcswDefault> queryYYSSL(Integer pageNum, Integer pageSize, String kcswStr, String order) throws Exception;
110 123
 }

+ 95 - 0
src/main/java/com/chinaitop/agile/service/impl/KcswServiceImpl.java

@@ -7,8 +7,12 @@ import com.chinaitop.agile.mapper.DataKcglKcswDefaultMapper;
7 7
 import com.chinaitop.agile.mapper.DataKcglXckcDefaultMapper;
8 8
 import com.chinaitop.agile.model.*;
9 9
 import com.chinaitop.agile.model.DataKcglKcswDefaultExample.Criteria;
10
+import com.chinaitop.agile.service.DataKcglFcbgzDefaultService;
10 11
 import com.chinaitop.agile.service.KcswService;
11 12
 import com.chinaitop.agile.utils.ParameterUtil;
13
+import com.fasterxml.jackson.databind.ObjectMapper;
14
+import com.github.pagehelper.PageHelper;
15
+import com.github.pagehelper.PageInfo;
12 16
 
13 17
 import org.apache.commons.lang.ObjectUtils;
14 18
 import org.springframework.stereotype.Service;
@@ -29,6 +33,8 @@ public class KcswServiceImpl implements KcswService{
29 33
 	@Resource
30 34
 	private DataKcglFcbgzDefaultMapper dataKcglFcbgzDefaultMapper;
31 35
 	@Resource
36
+	private DataKcglFcbgzDefaultService fcbgzService;
37
+	@Resource
32 38
 	private BasicEnumFeignService basicEnumFeignService;
33 39
 
34 40
 	public Map<String, Object> queryByExample(Integer orgId) {
@@ -372,4 +378,93 @@ public class KcswServiceImpl implements KcswService{
372 378
 
373 379
 		return result_map;
374 380
 	}
381
+
382
+	@Override
383
+	public PageInfo<DataKcglKcswDefault> queryYYSSL(Integer pageNum, Integer pageSize, String kcswStr, String order)
384
+			throws Exception {
385
+		ObjectMapper mapper = new ObjectMapper();
386
+    	DataKcglKcswDefault kcsw = null;
387
+    	PageInfo<DataKcglKcswDefault> pageInfo = null;
388
+    	Map<String,Object> map = new HashMap<String,Object>();
389
+    	DataKcglKcswDefaultExample example = new DataKcglKcswDefaultExample();
390
+    	DataKcglKcswDefaultExample.Criteria criteria = example.createCriteria();
391
+
392
+    	if (null != kcswStr && !"".equals(kcswStr)) {
393
+			kcsw = mapper.readValue(kcswStr, DataKcglKcswDefault.class);
394
+		} else {
395
+			kcsw = new DataKcglKcswDefault();
396
+		}
397
+		/* 仓房 */
398
+		if (null != kcsw.getCh() && !"".equals(kcsw.getCh())) {
399
+			criteria.andChEqualTo(kcsw.getCh());
400
+		}
401
+		/* 货位 */
402
+		if (null != kcsw.getHwh() && !"".equals(kcsw.getHwh())) {
403
+			criteria.andHwhEqualTo(kcsw.getHwh());
404
+		}
405
+		/* 品种 */
406
+		if (null != kcsw.getPz() && !"".equals(kcsw.getPz())) {
407
+			criteria.andPzEqualTo(kcsw.getPz());
408
+		}
409
+		/* 单位 */
410
+		if (null != kcsw.getUnitid() && !"".equals(kcsw.getUnitid())) {
411
+			criteria.andUnitidEqualTo(kcsw.getUnitid());
412
+		}
413
+		/* 归档用最后一次编辑时间 */
414
+		if (null != kcsw.getModifydate() && !"".equals(kcsw.getModifydate())) {
415
+			criteria.andModifydateLessThan(kcsw.getModifydate());
416
+		}
417
+
418
+		if(null != pageNum && null != pageSize){
419
+			PageHelper.startPage(pageNum, pageSize);
420
+		}
421
+		example.setOrderByClause(" to_number(ch) ");
422
+		/* 1、查询库存实物表数据 */
423
+		List<DataKcglKcswDefault> list = dataKcglKcswDefaultMapper.selectByExample(example);
424
+		pageInfo = new PageInfo<DataKcglKcswDefault>(list);
425
+
426
+		/* 2、查询对应仓房的生产年份,ZJ是自检要做判断 */
427
+		if (!order.equals("ZJ") && null != pageInfo.getList() && pageInfo.getList().size() > 0) {
428
+			for (DataKcglKcswDefault kcswobj : pageInfo.getList()) {
429
+				DataKcglFcbgzDefaultExample fcbgz_example = new DataKcglFcbgzDefaultExample();
430
+				DataKcglFcbgzDefaultExample.Criteria fcbgz_criteria = fcbgz_example.createCriteria();
431
+				fcbgz_criteria.andUnitidEqualTo(kcsw.getUnitid());
432
+				fcbgz_criteria.andChEqualTo(kcswobj.getCh());
433
+				fcbgz_criteria.andHwhEqualTo(kcswobj.getHwh());
434
+				fcbgz_criteria.andSrslGreaterThan(0d);//收入数量大于0
435
+				fcbgz_example.setOrderByClause(" rq DESC");
436
+				List<DataKcglFcbgzDefault> fcbgz_list = fcbgzService.findByList(fcbgz_example);
437
+				if (null != fcbgz_list && fcbgz_list.size() > 0) {
438
+					int scnf = Integer.parseInt(ObjectUtils.toString(fcbgz_list.get(0).getScnf(), "0"));
439
+					kcswobj.setScnf(scnf);
440
+				}
441
+				/* 3、查询这个仓房的已验收数量和未验收数量 */
442
+				map.put("orgId", kcsw.getUnitid());
443
+				map.put("ch", kcswobj.getCh());
444
+				map.put("hwh", kcswobj.getHwh());
445
+				map.put("scnd", kcswobj.getScnf());
446
+				List<Map<String,Object>> map_list = dataKcglKcswDefaultMapper.queryYYSSL(map);
447
+				String checktype = "";
448
+				double rksl = 0d;
449
+				double wyssl = 0d;
450
+				if (null != map_list && map_list.size() > 0) {
451
+					checktype = map_list.get(0).get("checktype")+"";
452
+					if (!"0".equals(checktype)) {
453
+						rksl = Double.parseDouble(map_list.get(0).get("rksl").toString());
454
+					} else {
455
+						Map<String, Object> ysxx_map = dataKcglKcswDefaultMapper.findNumManager(map);
456
+						rksl = Double.parseDouble(ysxx_map.get("rksl")+"");
457
+					}
458
+				}
459
+				double kcsl = kcswobj.getKcsl();
460
+				rksl = rksl * 1000;
461
+				wyssl = kcsl - rksl;
462
+
463
+				kcswobj.setRksl(rksl);
464
+				kcswobj.setWyssl(wyssl);
465
+			}
466
+		}
467
+
468
+		return pageInfo;
469
+	}
375 470
 }