看板初版
This commit is contained in:
@@ -19,6 +19,11 @@ public class ItemProtocol {
|
||||
public static String item_weight = "weight";
|
||||
public static String item_sub_tray = "sub_tray";
|
||||
public static String item_mother_tray = "mother_tray";
|
||||
public static String item_error_code="error_code";
|
||||
public static String item_device_type="device_type";
|
||||
public static String item_frame_type="frame_type";
|
||||
public static String item_mother_type="mother_type";
|
||||
public static String item_sub_type="sub_type";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
@@ -60,6 +65,26 @@ public class ItemProtocol {
|
||||
return this.getOpcStringValue(item_mother_tray);
|
||||
}
|
||||
|
||||
public Integer getErrorCode() {
|
||||
return this.getOpcIntegerValue(item_error_code);
|
||||
}
|
||||
|
||||
public Integer getDeviceType() {
|
||||
return this.getOpcIntegerValue(item_device_type);
|
||||
}
|
||||
|
||||
public Integer getFrameType() {
|
||||
return this.getOpcIntegerValue(item_frame_type);
|
||||
}
|
||||
|
||||
public Integer getMotherType() {
|
||||
return this.getOpcIntegerValue(item_mother_type);
|
||||
}
|
||||
|
||||
public Integer getSubType() {
|
||||
return this.getOpcIntegerValue(item_sub_type);
|
||||
}
|
||||
|
||||
public int getToCommand() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,7 @@ import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
@@ -130,6 +127,17 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
|
||||
String devicecode;
|
||||
|
||||
int device_type=0;
|
||||
int last_device_type=0;
|
||||
int frame_type=0;
|
||||
int last_frame_type=0;
|
||||
int mother_type=0;
|
||||
int last_mother_type=0;
|
||||
int sub_type=0;
|
||||
int last_sub_type=0;
|
||||
int error_code=0;
|
||||
int last_error_code=0;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
@@ -149,6 +157,11 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
weight = this.itemProtocol.getWeight();
|
||||
mother_tray = this.itemProtocol.getMotherTray();
|
||||
sub_tray = this.itemProtocol.getSubTray();
|
||||
device_type = this.itemProtocol.getDeviceType();
|
||||
frame_type = this.itemProtocol.getFrameType();
|
||||
mother_type = this.itemProtocol.getMotherType();
|
||||
sub_type = this.itemProtocol.getSubType();
|
||||
error_code = this.itemProtocol.getErrorCode();
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if(mode==2){
|
||||
@@ -159,10 +172,56 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
|
||||
if (error != last_error) {
|
||||
}
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
|
||||
if (move != last_move) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("point_qty", move);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (!Objects.equals(mother_tray, last_mother_tray)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("mother_tray", mother_tray);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (!Objects.equals(sub_tray, last_sub_tray)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sub_tray", sub_tray);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (device_type != last_device_type) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_type", device_type);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (frame_type != last_frame_type) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("frame_type", frame_type);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (mother_type != last_mother_type) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sub_type", sub_type);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (sub_type != last_sub_type) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sub_type", sub_type);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
if (error_code != last_error_code) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("error", error_code);
|
||||
acsToWmsService.notify(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
@@ -222,6 +281,11 @@ public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
last_sub_tray = sub_tray;
|
||||
last_mother_tray = mother_tray;
|
||||
last_action = action;
|
||||
last_device_type=device_type;
|
||||
last_frame_type=frame_type;
|
||||
last_mother_type=mother_type;
|
||||
last_sub_type=sub_type;
|
||||
last_error_code=error_code;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public interface AcsToWmsService {
|
||||
/**
|
||||
* ACS向WMS反馈任务状态
|
||||
*/
|
||||
String notify(BaseRequest request);
|
||||
String notify(JSONObject param);
|
||||
|
||||
/**
|
||||
* 任务阶段反馈最新点位
|
||||
|
||||
@@ -580,12 +580,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String notify(BaseRequest requestParam) {
|
||||
public String notify(JSONObject param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String api = addressService.findByCode("notify").getMethods_url();
|
||||
log.info("notify-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect));
|
||||
String result = LmsUtil.notifyAcs(api, requestParam);
|
||||
log.info("notify-----输入参数{}", param);
|
||||
String result = LmsUtil.notifyAcs(api, param);
|
||||
log.info("notify-----输出参数{}", result);
|
||||
return result;
|
||||
} finally {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BoardController {
|
||||
@ApiOperation("称重看板")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> cz(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(boardService.cz(param), HttpStatus.OK);
|
||||
return new ResponseEntity<>(boardService.cz(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/rk")
|
||||
@@ -54,21 +54,11 @@ public class BoardController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/sc/pt")
|
||||
@Log("生产看板普通回温")
|
||||
@ApiOperation("生产看板普通回温")
|
||||
@PostMapping("/sc")
|
||||
@Log("生产看板")
|
||||
@ApiOperation("生产看板")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> pt(){
|
||||
return new ResponseEntity<>(boardService.sc("HW"), HttpStatus.OK);
|
||||
public ResponseEntity<Object> sc(){
|
||||
return new ResponseEntity<>(boardService.sc(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/sc/ks")
|
||||
@Log("生产看板快速回温")
|
||||
@ApiOperation("生产看板快速回温")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> ks(){
|
||||
return new ResponseEntity<>(boardService.sc("HWK"), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import java.util.List;
|
||||
|
||||
public interface BoardService {
|
||||
PdaResponseVo cz(JSONObject param);
|
||||
JSONObject cz();
|
||||
|
||||
JSONObject rk();
|
||||
|
||||
|
||||
List<ScDto> sc(String region_code);
|
||||
JSONObject sc();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.board.service.dao.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CzDto {
|
||||
private String sub_tray;
|
||||
private String mother_tray;
|
||||
private String material_code;
|
||||
private String material_name;
|
||||
private Integer number;
|
||||
private Float qty;
|
||||
private String simtType;
|
||||
private String locationCode;
|
||||
private String supplierName;
|
||||
private String point_qty;
|
||||
private Integer device_type;
|
||||
private Integer frame_type;
|
||||
private Integer mother_type;
|
||||
private Integer sub_type;
|
||||
private Integer error;
|
||||
|
||||
}
|
||||
@@ -8,6 +8,9 @@ import java.util.List;
|
||||
import java.util.logging.Handler;
|
||||
|
||||
public interface BoardMapper {
|
||||
|
||||
CzDto cz(String sub_tray);
|
||||
|
||||
List<ScDto> sc(String region_code);
|
||||
|
||||
List<WlDto> kn();
|
||||
|
||||
@@ -60,11 +60,11 @@
|
||||
<select id="wrk" resultType="org.nl.wms.board.service.dao.dto.WlDto">
|
||||
SELECT
|
||||
a.palletSN,
|
||||
any_value ( a.productName ),
|
||||
any_value ( a.productDescription ),
|
||||
sum( a.qty ),
|
||||
sum( a.incomingWeight ),
|
||||
any_value ( a.supplierName )
|
||||
any_value ( a.productName ) as productName,
|
||||
any_value ( a.productDescription ) as productDescription,
|
||||
sum( a.qty ) as qty,
|
||||
sum( a.incomingWeight ) as incomingWeight,
|
||||
any_value ( a.supplierName ) as supplierName
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@@ -134,4 +134,26 @@
|
||||
( SELECT m.* FROM sch_base_material m WHERE group_bind_material_status = 2 and m.PalletSN NOT IN ( SELECT vehicle_code2 FROM sch_base_point WHERE vehicle_code2 IS NOT NULL and vehicle_code2!='' ) )b ) c
|
||||
</select>
|
||||
|
||||
<select id="cz" resultType="org.nl.wms.board.service.dao.dto.CzDto">
|
||||
SELECT
|
||||
a.palletSN,
|
||||
any_value ( a.productName ) as productName,
|
||||
any_value ( a.productDescription ) as productDescription,
|
||||
sum( a.qty ) as qty,
|
||||
sum( a.incomingWeight ) as incomingWeight,
|
||||
any_value ( a.supplierName ) as supplierName
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
m.*
|
||||
FROM
|
||||
sch_base_material m
|
||||
WHERE
|
||||
m.PalletSN = #{sub_tray}
|
||||
) a
|
||||
GROUP BY
|
||||
PalletSN;
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package org.nl.wms.board.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
import org.nl.wms.board.service.BoardService;
|
||||
import org.nl.wms.board.service.dao.dto.HwDto;
|
||||
import org.nl.wms.board.service.dao.dto.KcDto;
|
||||
import org.nl.wms.board.service.dao.dto.ScDto;
|
||||
import org.nl.wms.board.service.dao.dto.WlDto;
|
||||
import org.nl.wms.board.service.dao.dto.*;
|
||||
import org.nl.wms.board.service.dao.mapper.BoardMapper;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,25 +18,50 @@ import java.util.List;
|
||||
public class BoardServiceImpl implements BoardService {
|
||||
@Autowired
|
||||
private BoardMapper boardMapper;
|
||||
public PdaResponseVo cz(JSONObject param){
|
||||
return PdaResponseVo.pdaResultOk("回温状态查询成功");
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
public JSONObject cz() {
|
||||
CzDto czDto = boardMapper.cz(String.valueOf(redisUtils.get("sub_tray")));
|
||||
if (czDto == null) {
|
||||
czDto = new CzDto();
|
||||
}
|
||||
redisUtils.set("mother_tray",0);
|
||||
redisUtils.set("sub_tray",0);
|
||||
redisUtils.set("device_type",0);
|
||||
redisUtils.set("frame_type",0);
|
||||
redisUtils.set("mother_type",0);
|
||||
redisUtils.set("sub_type",0);
|
||||
redisUtils.set("point_qty",0);
|
||||
|
||||
czDto.setMother_tray(String.valueOf(redisUtils.get("mother_tray")));
|
||||
czDto.setPoint_qty(String.valueOf(redisUtils.get("point_qty")));
|
||||
czDto.setDevice_type((Integer) redisUtils.get("device_type"));
|
||||
czDto.setFrame_type((Integer) redisUtils.get("frame_type"));
|
||||
czDto.setMother_type((Integer) redisUtils.get("mother_type"));
|
||||
czDto.setSub_type((Integer) redisUtils.get("sub_type"));
|
||||
czDto.setError((Integer) redisUtils.get("error"));
|
||||
return JSONObject.parseObject(JSON.toJSONString(czDto));
|
||||
}
|
||||
|
||||
public JSONObject rk(){
|
||||
KcDto kcDto=boardMapper.kc();
|
||||
public JSONObject rk() {
|
||||
KcDto kcDto = boardMapper.kc();
|
||||
kcDto.setList(boardMapper.wuliao());
|
||||
HwDto hwDto=boardMapper.hw();
|
||||
List<WlDto> knList= boardMapper.kn();
|
||||
List<WlDto> wrkList=boardMapper.wrk();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("kc",kcDto);
|
||||
jsonObject.put("hw",hwDto);
|
||||
jsonObject.put("kn",knList);
|
||||
jsonObject.put("wrk",wrkList);
|
||||
HwDto hwDto = boardMapper.hw();
|
||||
List<WlDto> knList = boardMapper.kn();
|
||||
List<WlDto> wrkList = boardMapper.wrk();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("kc", kcDto);
|
||||
jsonObject.put("hw", hwDto);
|
||||
jsonObject.put("kn", knList);
|
||||
jsonObject.put("wrk", wrkList);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public List<ScDto> sc(String region_code){
|
||||
return boardMapper.sc(region_code);
|
||||
public JSONObject sc() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("pt", boardMapper.sc("HW"));
|
||||
jsonObject.put("ks", boardMapper.sc("HWK"));
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
import org.nl.system.service.logicflow.dao.Stage;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -43,6 +44,7 @@ import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -73,6 +75,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private PointMapper pointMapper;
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
// 初始化反射方法
|
||||
@PostConstruct
|
||||
@@ -166,22 +170,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public BaseResponse notify(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
log.info("notifyAcs - 请求参数 {}", param);
|
||||
Integer type=param.getInteger("type");
|
||||
String device_code = param.getString("device_code");
|
||||
String state = param.getString("state");
|
||||
switch(type) {
|
||||
case 1:
|
||||
//自动门反馈设备状态,将对应十个固化室工位的状态修改为传入状态
|
||||
String ghs_device_code="GHS"+device_code.substring(device_code.length()-2);
|
||||
pointMapper.updatePointStatus(ghs_device_code,state);
|
||||
break;
|
||||
case 2:
|
||||
//正极板对接位反馈设备有无货
|
||||
device_code=device_code.substring(0,device_code.length()-2);
|
||||
pointMapper.updatePointVehicleQty(device_code,state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// 遍历所有键
|
||||
for(String key:param.keySet()){
|
||||
redisUtils.set(key,param.getString(key));
|
||||
}
|
||||
return BaseResponse.responseOk(requestNo, "反馈成功!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user