add:新增手持菜单:矿用软废组桶功能
This commit is contained in:
@@ -116,5 +116,12 @@ public class PdaBucketController {
|
|||||||
return new ResponseEntity<>(bucketNoBagService.print(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(bucketNoBagService.print(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/checkCode")
|
||||||
|
@Log("根据二维码解析内容")
|
||||||
|
@ApiOperation("根据二维码解析内容")
|
||||||
|
public ResponseEntity<Object> checkCode(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketService.checkCode(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ public interface PdaBucketService {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
JSONObject getLevel();
|
JSONObject getLevel();
|
||||||
|
|
||||||
|
Map<String, Object> checkCode(JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.pda.st.set.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@@ -383,5 +384,77 @@ public class PdaBucketServiceImpl implements PdaBucketService {
|
|||||||
return returnjo;
|
return returnjo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map<String, Object> checkCode(JSONObject whereJson) {
|
||||||
|
String code_info = whereJson.getString("code_info");
|
||||||
|
if (ObjectUtil.isEmpty(code_info)) {
|
||||||
|
throw new BadRequestException("袋码内容为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] splitArr = code_info.split("##");
|
||||||
|
// 截取桶码
|
||||||
|
String bucketunique_bag = splitArr[0];
|
||||||
|
// 截取袋码
|
||||||
|
String bag_id = splitArr[1];
|
||||||
|
// 截取重量
|
||||||
|
String storage_qty = splitArr[4];
|
||||||
|
// 截取批次
|
||||||
|
String pcsn_bag = splitArr[3];
|
||||||
|
// 截取物料外部标识
|
||||||
|
String ext_id = splitArr[2];
|
||||||
|
|
||||||
|
// 根据物料外部标识找对应物料
|
||||||
|
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase")
|
||||||
|
.query("ext_id = '" + ext_id + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||||
|
throw new BadRequestException("外部标志【"+ext_id+"】找不到对应物料!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断前端传过来的批次和桶码是否与二维码中的一致
|
||||||
|
String bucketunique = whereJson.getString("bucketunique");
|
||||||
|
String pcsn = whereJson.getString("pcsn");
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(bucketunique) && ObjectUtil.isNotEmpty(pcsn)) {
|
||||||
|
if (!bucketunique_bag.equals(bucketunique)) {
|
||||||
|
throw new BadRequestException("当前桶码与二维码桶码不一致,二维码桶码为【"+bucketunique_bag+"】");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pcsn_bag.equals(pcsn)) {
|
||||||
|
throw new BadRequestException("当前批次与二维码批次不一致,二维码批次为【"+pcsn_bag+"】");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// group参数
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("bag_id", bag_id);
|
||||||
|
result.put("storage_qty", storage_qty);
|
||||||
|
result.put("pcsn", pcsn_bag);
|
||||||
|
result.put("material_id", jsonMater.getString("material_id"));
|
||||||
|
result.put("material_code", jsonMater.getString("material_code"));
|
||||||
|
result.put("material_name", jsonMater.getString("material_name"));
|
||||||
|
|
||||||
|
// 需赋值参数
|
||||||
|
JSONObject resultTwo = new JSONObject();
|
||||||
|
resultTwo.put("bucketunique",bucketunique_bag);
|
||||||
|
resultTwo.put("material_code",jsonMater.getString("material_code"));
|
||||||
|
resultTwo.put("pcsn",pcsn_bag);
|
||||||
|
|
||||||
|
// 桶信息参数
|
||||||
|
JSONObject resultOne = WQL.getWO("QPADSTSETSERVICE")
|
||||||
|
.addParam("flag", "5").addParam("bucketunique", bucketunique_bag)
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(resultOne)) {
|
||||||
|
throw new BadRequestException("桶信息不存在【"+bucketunique_bag+"】");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回参数
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功!");
|
||||||
|
returnjo.put("result", result);
|
||||||
|
returnjo.put("resultTwo", resultTwo);
|
||||||
|
returnjo.put("resultOne", resultOne);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user