add:1.新增木箱称重校验功能2.输送任务反馈执行中更新木箱毛重
This commit is contained in:
@@ -143,5 +143,12 @@ public class WmsToAcsController {
|
|||||||
return new ResponseEntity<>(wmsToAcsService.PaperTubeAction(jo), HttpStatus.OK);
|
return new ResponseEntity<>(wmsToAcsService.PaperTubeAction(jo), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryBoxWeigh")
|
||||||
|
@Log(value = "查询木箱毛重", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
|
||||||
|
|
||||||
|
public ResponseEntity<Object> querydeviceOne(@RequestBody JSONObject jo) {
|
||||||
|
return new ResponseEntity<>(wmsToAcsService.queryBoxWeigh(jo), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,4 +137,11 @@ public interface WmsToAcsService {
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject PaperTubeAction(JSONObject jo);
|
JSONObject PaperTubeAction(JSONObject jo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询木箱重量
|
||||||
|
* @param jo 、
|
||||||
|
* @return JSONObject
|
||||||
|
*/
|
||||||
|
JSONObject queryBoxWeigh(JSONObject jo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -459,4 +459,47 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject queryBoxWeigh(JSONObject jo) {
|
||||||
|
String api = "api/wms/querydevice";
|
||||||
|
//判断是否连接ACS系统
|
||||||
|
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
if (StrUtil.equals("0", isConnect)) {
|
||||||
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
result.put("message", "查询失败,未连接ACS!");
|
||||||
|
result.put("data", new JSONArray());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
String product_area = "LK";
|
||||||
|
|
||||||
|
String acs_url = URLEnum.find(product_area);
|
||||||
|
if (StrUtil.isEmpty(acs_url)) {
|
||||||
|
log.info(product_area);
|
||||||
|
throw new BadRequestException("未查询到区域对应的acs地址!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = acs_url + api;
|
||||||
|
try {
|
||||||
|
String resultMsg = HttpRequest.post(url)
|
||||||
|
.body(String.valueOf(jo.getJSONArray("data")))
|
||||||
|
.execute().body();
|
||||||
|
result = JSONObject.parseObject(resultMsg);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = e.getMessage();
|
||||||
|
//网络不通
|
||||||
|
System.out.println(msg);
|
||||||
|
result.put("status", HttpStatus.BAD_REQUEST);
|
||||||
|
result.put("message", "网络不通,操作失败!");
|
||||||
|
result.put("data", new JSONArray());
|
||||||
|
}
|
||||||
|
//acs抛异常这里
|
||||||
|
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||||
|
throw new BadRequestException("操作失败:" + result.getString("message"));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ public class ProductInstorController {
|
|||||||
return new ResponseEntity<>(productInstorService.boxQuery(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(productInstorService.boxQuery(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/weighCheck")
|
||||||
|
@Log("称重校验")
|
||||||
|
public ResponseEntity<Object> weighCheck(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(productInstorService.weighCheck(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/confirm")
|
@PostMapping("/confirm")
|
||||||
@Log("手持生产入库确认")
|
@Log("手持生产入库确认")
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ public interface ProductInstorService {
|
|||||||
JSONObject bale(JSONObject whereJson);
|
JSONObject bale(JSONObject whereJson);
|
||||||
|
|
||||||
JSONObject abnormalOut(JSONObject whereJson);
|
JSONObject abnormalOut(JSONObject whereJson);
|
||||||
|
|
||||||
|
JSONObject weighCheck(JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.wms.pda.st.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -17,6 +18,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
|||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||||
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
||||||
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
|
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||||
import org.nl.wms.pda.st.service.ProductInstorService;
|
import org.nl.wms.pda.st.service.ProductInstorService;
|
||||||
@@ -55,6 +57,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
|
|
||||||
private final RedissonClient redissonClient;
|
private final RedissonClient redissonClient;
|
||||||
|
|
||||||
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject boxQuery(JSONObject whereJson) {
|
public JSONObject boxQuery(JSONObject whereJson) {
|
||||||
String box_no = whereJson.getString("box_no");
|
String box_no = whereJson.getString("box_no");
|
||||||
@@ -540,4 +544,49 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
|
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject weighCheck(JSONObject whereJson) {
|
||||||
|
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
|
||||||
|
String point_code = whereJson.getString("point_code");
|
||||||
|
String box_no = whereJson.getString("box_no");
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(point_code)) {
|
||||||
|
throw new BadRequestException("点位不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(box_no)) {
|
||||||
|
throw new BadRequestException("木箱号不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组织数据
|
||||||
|
JSONArray paramArr = new JSONArray();
|
||||||
|
JSONObject paramJson = new JSONObject();
|
||||||
|
paramJson.put("device_code", point_code);
|
||||||
|
paramArr.add(paramJson);
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
|
whereJson.put("data", paramArr);
|
||||||
|
JSONObject jsonObject = wmsToAcsService.queryBoxWeigh(whereJson);
|
||||||
|
|
||||||
|
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
|
||||||
|
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
|
||||||
|
|
||||||
|
// 获取系统参数
|
||||||
|
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
|
||||||
|
|
||||||
|
// 查询子卷包装关系
|
||||||
|
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
|
||||||
|
double box_weight = jsonSub.getDoubleValue("box_weight");
|
||||||
|
|
||||||
|
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {
|
||||||
|
jo.put("message", "重量合格!当前称重重量:"+weight_now);
|
||||||
|
} else {
|
||||||
|
jo.put("message", "重量不合格!当前称重重量:"+weight_now);
|
||||||
|
}
|
||||||
|
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class CutConveyorTask extends AbstractAcsTask {
|
|||||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
|
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
|
||||||
|
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||||
|
|
||||||
String task_id = taskObj.getString("task_id");
|
String task_id = taskObj.getString("task_id");
|
||||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
@@ -111,6 +112,15 @@ public class CutConveyorTask extends AbstractAcsTask {
|
|||||||
jsonTask.put("update_time", DateUtil.now());
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
taskTab.update(jsonTask);
|
taskTab.update(jsonTask);
|
||||||
|
|
||||||
|
if ("010507".equals(jsonTask.getString("task_type"))) {
|
||||||
|
double weight = taskObj.getDoubleValue("weight");
|
||||||
|
|
||||||
|
// 更新子卷包装实际重量
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("real_weight",weight);
|
||||||
|
subTab.update(param,"package_box_sn ='"+jsonTask.getString("vehicle_code")+"'");
|
||||||
|
}
|
||||||
|
|
||||||
//只有输送入的时候才调用MES
|
//只有输送入的时候才调用MES
|
||||||
if ("010402".equals(jsonTask.getString("task_type"))) {
|
if ("010402".equals(jsonTask.getString("task_type"))) {
|
||||||
//调用MES接口,通知MES运输中
|
//调用MES接口,通知MES运输中
|
||||||
|
|||||||
Reference in New Issue
Block a user