fanxw 5 年 前
コミット
1384c06ce5

+ 28 - 2
src/main/java/com/chinaitop/depot/basic/controller/BasicWarehouseController.java

@@ -7,6 +7,8 @@ import javax.annotation.Resource;
7 7
 import javax.servlet.http.HttpServletRequest;
8 8
 
9 9
 import org.apache.commons.lang.ObjectUtils;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
10 12
 import org.springframework.web.bind.annotation.RequestMapping;
11 13
 import org.springframework.web.bind.annotation.RequestMethod;
12 14
 import org.springframework.web.bind.annotation.RestController;
@@ -37,7 +39,9 @@ import io.swagger.annotations.ApiOperation;
37 39
 @RestController
38 40
 @RequestMapping(value="/Warehouse")
39 41
 @Api(value= "BasicWarehouseController", description = "货位管理控制类")
40
-public class BasicWarehouseController { 
42
+public class BasicWarehouseController {
43
+
44
+	final static Logger logger = LoggerFactory.getLogger(BasicWarehouse.class);
41 45
 
42 46
 	@Resource
43 47
 	private BasicWarehouseService basicWarehouseService;
@@ -323,6 +327,8 @@ public class BasicWarehouseController {
323 327
 	})
324 328
 	public void updateWarehouseCrkStatus(Integer wareId, String crk_status) {
325 329
 
330
+		String date = ParameterUtil.getSysDateTime();
331
+		logger.info("时间:"+date+",封仓时更新出入库状态回写接口,封仓调用,接收参数是,货位ID:"+wareId+",状态值:"+crk_status);
326 332
 		try {
327 333
 			if (null != wareId && null != crk_status && !"".equals(crk_status)) {
328 334
 				BasicWarehouse warehouse = new BasicWarehouse();
@@ -331,11 +337,31 @@ public class BasicWarehouseController {
331 337
 				
332 338
 				//修改数据
333 339
 				basicWarehouseService.update(warehouse);
340
+				logger.info("时间:"+date+",封仓时更新出入库状态回写接口,封仓调用,调用回写成功!");
334 341
 			} else {
335
-				System.out.println("更新出入库状态值crk_status出错,参数:货位ID="+wareId+",出入库状态值="+crk_status);
342
+				logger.info("时间:"+date+",封仓时更新出入库状态值crk_status出错,参数:货位ID="+wareId+",出入库状态值="+crk_status);
336 343
 			}
337 344
 		} catch (NumberFormatException e) {
345
+			logger.info("时间:"+date+",封仓时更新出入库状态回写接口,封仓调用,调用失败,报错如下!");
346
+			e.printStackTrace();
347
+		}
348
+	}
349
+
350
+	@SuppressWarnings("all")
351
+	@RequestMapping(value="/getCountWhs", method=RequestMethod.GET)
352
+	@ApiOperation(value="查询货位数", notes = "查询货位数")
353
+	@ApiImplicitParams({
354
+		@ApiImplicitParam(name = "orgId", value = "单位ID", paramType = "query")
355
+	})
356
+	public Integer getCountWhs(Integer orgId) {
357
+		Integer hws = 0;
358
+		try {
359
+			hws = basicWarehouseService.getCountWhs(orgId);
360
+		} catch (Exception e) {
361
+			hws = 0;
338 362
 			e.printStackTrace();
363
+		} finally {
364
+			return hws;
339 365
 		}
340 366
 	}
341 367
 }

+ 9 - 0
src/main/java/com/chinaitop/depot/basic/service/BasicWarehouseService.java

@@ -56,4 +56,13 @@ public interface BasicWarehouseService {
56 56
 	 */
57 57
 	void deletEexample(Integer storehouseId);
58 58
 
59
+	/**
60
+	 * 查询当前单位下货位总数
61
+	 * 
62
+	 * @param orgId 单位ID
63
+	 * @return
64
+	 * @throws Exception
65
+	 */
66
+	Integer getCountWhs(Integer orgId) throws Exception;
67
+
59 68
 }

+ 12 - 0
src/main/java/com/chinaitop/depot/basic/service/impl/BasicWarehouseServiceImpl.java

@@ -93,4 +93,16 @@ public class BasicWarehouseServiceImpl implements BasicWarehouseService {
93 93
 		mapper.updateByExampleSelective(warehouse, example);
94 94
 	}
95 95
 
96
+	@Override
97
+	public Integer getCountWhs(Integer orgId) throws Exception {
98
+		BasicWarehouseExample example = new BasicWarehouseExample();
99
+		BasicWarehouseExample.Criteria criteria = example.createCriteria();
100
+		criteria.andLibraryTypeEqualTo("0");//查询本库的,不查第三方库的
101
+		if (null != orgId) {
102
+			criteria.andOrgIdEqualTo(orgId);
103
+		}
104
+		Integer hws = mapper.countByExample(example);
105
+		return hws;
106
+	}
107
+
96 108
 }