Commit 87984628 张少辉

1.开线数量维护优化

2.物料日志按小时查询修改
1 个父辈 961b3603
......@@ -23,7 +23,7 @@ public class TaskQueryCondition {
private String barcode;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "updateDate")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private BetweenData<Date> updateDate;
@QueryCondition
......
package com.neotel.smfcore.custom.lizhen.innerBox.rest;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.ReelConsumption;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -28,41 +29,62 @@ public class WireQtyMaintController {
@ApiOperation("获取线体信息")
@RequestMapping(value = "/detail")
//@AnonymousAccess
public ResultBean detail() {
Map<String, Integer> cacheMap = dataCache.getCache(Constants.CACHE_wireQtyMaint);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
Map<String, ReelConsumption> reelConsumptionMap = dataCache.getCache(Constants.Cache_reelConsumption);
if (reelConsumptionMap == null) {
reelConsumptionMap = new HashMap<>();
return ResultBean.newOkResult(cacheMap);
}
@ApiOperation("新增线体信息")
@RequestMapping("/save")
public ResultBean save(@RequestBody Map<String, String> paramMap) {
String line = paramMap.get("line");
String amountStr = paramMap.get("amount");
if (StringUtils.isEmpty(line) || StringUtils.isEmpty(amountStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"线体或者开线数量"});
}
if (reelConsumptionMap.size() > 0) {
for (ReelConsumption reelConsumption : reelConsumptionMap.values()) {
for (String key : reelConsumption.getInventoryMap().keySet()) {
Integer integer = cacheMap.get(key);
if (integer == null) {
integer = 0;
cacheMap.put(key, integer);
}
}
}
int amount = 0;
try {
amount = Integer.parseInt(amountStr);
} catch (NumberFormatException e) {
return ResultBean.newErrorResult(-1, "", "开线数量填写错误");
}
Map<String, Integer> cacheMap = dataCache.getCache(Constants.CACHE_wireQtyMaint);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
cacheMap.put(line, amount);
dataCache.updateCache(Constants.CACHE_wireQtyMaint, cacheMap);
return ResultBean.newOkResult(cacheMap);
return ResultBean.newOkResult("");
}
@ApiOperation("删除线体信息")
@RequestMapping(value = "/delete")
public ResultBean delete(String line) {
if (StringUtils.isEmpty(line)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"线体"});
}
Map<String, Integer> cacheMap = dataCache.getCache(Constants.CACHE_wireQtyMaint);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
cacheMap.remove(line);
dataCache.updateCache(Constants.CACHE_wireQtyMaint, cacheMap);
return ResultBean.newOkResult("");
}
@ApiOperation("修改线体信息")
@RequestMapping(value = "/update")
//@AnonymousAccess
public ResultBean update(@RequestBody Map<String, Integer> paramMap) {
Map<String, Integer> cacheMap = dataCache.getCache(Constants.CACHE_wireQtyMaint);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
for (String key : paramMap.keySet()) {
cacheMap.put(key,paramMap.get(key));
cacheMap.put(key, paramMap.get(key));
}
dataCache.updateCache(Constants.CACHE_wireQtyMaint, cacheMap);
return ResultBean.newOkResult("");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!