1.更新一些内容

2.增加语音操作提醒信息
3.增加页面跳转时携带deviceId
master
董哲奇 7 months ago
parent 3f6611d5f9
commit 043876f09d

@ -172,6 +172,70 @@ public class PgdTzjhController {
returnMap.put("resourcesCodes",resourcesCodes);
returnMap.put("zyqs",zyqs);
returnMap.put("zyrys",zyrys);
returnMap.put("qgkw", qgkws);
returnMap.put("zylx", zylxs);
returnMap.put("pwwz", pwwzs);
returnMap.put("dhql", dhql);
/// zylx 流向 pwwz 抛丸位置 // QGKW 切割跨位
return new ResultBean(returnMap);
}
@PostMapping("/getPgdBase1")
@ResponseBody
@AuthFunction
public ResultBean getPgdBase1(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
Map returnMap = new HashMap();
List<DmCbxxp> cbbm = dmCbxxpService.list(new QueryWrapper<DmCbxxp>().orderBy(true, true, "wgbs","cbbm","len(cbbm)"));
// 班组人员
List<EmSbjgry> gxry = emSbjgryService.list();
List<Map> bmbm = syService.em_sbjbb_ZM("bmbm");
// 多为
List<DmDwxxp> dwxxs = dwxxpService.list();
List<DmDwxxp> qys = dwxxpService.list(new QueryWrapper<DmDwxxp>().select("DISTINCT qy as qy "));
returnMap.put("qys", qys);
returnMap.put("dwxxs", dwxxs);
returnMap.put("dwxxs1", dwxxs);
List<Ycldw> ycldws = ycldwService.ycldwList("ycl");
returnMap.put("cbbm", cbbm);
returnMap.put("gxry", gxry);
returnMap.put("ycldws", ycldws);
returnMap.put("bmbm", bmbm);
List<Dm_zhbmp> qgkws1 = dm_zhbmpRepository.findByBMLB("QGKW");
List<Dm_zhbmp>qgkws=new ArrayList<>();
for (Dm_zhbmp qgkw : qgkws1) {
if(qgkw.getBmsm().equals("1") || qgkw.getBmsm().equals("2")|| qgkw.getBmsm().equals("3")||qgkw.getBmsm().equals("4") ){
continue;
}
qgkws.add(qgkw);
}
List<Dm_zhbmp> zylxs = dm_zhbmpRepository.findByBMLB("zylx");
List<Dm_zhbmp> pwwzs = dm_zhbmpRepository.findByBMLB("pwwz");
List<Dm_zhbmp> dhql = dm_zhbmpRepository.findByBMLB("DHQL");
List<DmBzry> resourcesCodes = dmBzryService.list(new QueryWrapper<DmBzry>().select("DISTINCT zyq as zyq ")
.eq("flag_status", "1").in("zyq","一区").orderBy(true,true,"zyq"));
List<DmBzry> zyqs = dmBzryService.list(new QueryWrapper<DmBzry>().select(" resources_code","zyq")
.eq("flag_status", "1").in("zyq","一区").ne("isnull(resources_code,'')","").groupBy("resources_code","zyq").orderBy(true,true,"resources_code"));
List<DmBzry> zyrys= dmBzryService.list(new QueryWrapper<DmBzry>()
.eq("flag_status", "1").ne("isnull(zyq,'')","").in("zyq","一区").orderBy(true,true,"zyq"));
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("PBBM");
returnMap.put("resourcesCodes",resourcesCodes);
returnMap.put("zyqs",zyqs);
returnMap.put("zyrys",zyrys);

@ -1,7 +1,6 @@
package com.dsic.gj_erp.controller.yuyin;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.wsclient.WebSocketClientComponent;
import com.dsic.gj_erp.wsclient.WebSocketService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
@ -16,8 +15,6 @@ public class YuyinController {
private final WebSocketService socketService;
private final WebSocketClientComponent clientComponent;
/**
* websocket
*/
@ -25,10 +22,10 @@ public class YuyinController {
public ResultBean<?> recon() throws Exception {
WebSocketSession session = socketService.getSession();
if (session==null){
clientComponent.init();
socketService.init();
}else {
socketService.disconnect();
clientComponent.init();
socketService.init();
}
return new ResultBean<>();
}

@ -17,7 +17,6 @@ import com.dsic.gj_erp.service.zyjh.YcldwService;
import com.dsic.gj_erp.service.zyjh.ZyjhService;
import com.dsic.gj_erp.ws.WsHandler;
import com.dsic.gj_erp.wsclient.Message;
import com.dsic.gj_erp.wsclient.WebSocketClientComponent;
import com.dsic.gj_erp.wsclient.WebSocketService;
import lombok.AllArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
@ -41,7 +40,6 @@ public class ZyjhController {
private final WsHandler wsHandler;
private final WebSocketService webSocketService;
private final WebSocketClientComponent webSocketClientComponent;
/**
* ,&
@ -82,7 +80,7 @@ public class ZyjhController {
zyjhService.updateBatchById(list);
if (dto.getAudioFlag()){
Message result = Message.result(webSocketClientComponent.getErpId(), "1");
Message result = Message.result(webSocketService.getErpId(), "1");
webSocketService.sendMessage(result.toString());
}
@ -90,7 +88,7 @@ public class ZyjhController {
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
if (dto.getAudioFlag()){
Message result = Message.result(webSocketClientComponent.getErpId(), "0");
Message result = Message.result(webSocketService.getErpId(), "0");
try {
webSocketService.sendMessage(result.toString());
} catch (Exception ex) {

@ -8,19 +8,17 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsic.gj_erp.bean.SpringContextHolder;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.EmGcrl;
import com.dsic.gj_erp.bean.jcsj.EmSbcnp;
import com.dsic.gj_erp.bean.jcsj.EmSbjbb;
import com.dsic.gj_erp.bean.jhgk.DmSygdxq;
import com.dsic.gj_erp.bean.jhgk.DmZrcjh;
import com.dsic.gj_erp.exception.ServiceException;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.dto.data.;
import com.dsic.gj_erp.pc.dto.data.;
import com.dsic.gj_erp.pc.dto.gx.*;
import com.dsic.gj_erp.pc.dto.sb.*;
import com.dsic.gj_erp.pc.dto.tlt.*;
import com.dsic.gj_erp.pc.dto.;
import com.dsic.gj_erp.pc.dto.*;
import com.dsic.gj_erp.pc.service.CD;
import com.dsic.gj_erp.pc.service.;
@ -33,7 +31,6 @@ import com.dsic.gj_erp.service.jhgk.DmZrcjhService;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.AtomicDouble;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import java.io.FileOutputStream;
import java.io.OutputStream;
@ -43,7 +40,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static com.dsic.gj_erp.pc.Manager.;
import static com.dsic.gj_erp.pc.Manager.*;
@Slf4j
@ -81,8 +77,7 @@ public class DataFactory {
try {
();
}catch (Exception e){
// e.printStackTrace();
throw e;
throw new ServiceException(10001,"排产结果异常");
}finally {
(list);
}

@ -46,6 +46,10 @@ public class WsHandler {
socketIOServer.getBroadcastOperations().sendEvent("zyjhzx", object);
}
public void complete(JSONObject object){
socketIOServer.getBroadcastOperations().sendEvent("complete", object);
}
public void sendSlComplete(JSONObject object) {
socketIOServer.getBroadcastOperations().sendEvent("slComplete", object);
}

@ -1,39 +0,0 @@
package com.dsic.gj_erp.wsclient;
import com.dsic.gj_erp.wsclient.handler.HeartHandler;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
@RequiredArgsConstructor
public class WebSocketClientComponent {
@Value("${ws.client.url}")
private String url;
@Getter
@Value("${ws.client.id}")
private String erpId;
private final WebSocketService webSocketService;
private final HeartHandler heartHandler;
@PostConstruct
public void init() {
// 发送消息示例
try {
webSocketService.connect(this.url);
webSocketService.sendMessage(Message.reg(this.erpId).toString());
heartHandler.execute(Message.heart(erpId));
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -1,22 +1,31 @@
package com.dsic.gj_erp.wsclient;
import cn.hutool.cron.CronUtil;
import cn.hutool.cron.task.Task;
import com.alibaba.fastjson.JSONObject;
import com.dsic.gj_erp.wsclient.handler.TipHandler;
import com.dsic.gj_erp.wsclient.handler.ZxHandler;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.client.WebSocketClient;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import javax.annotation.PostConstruct;
import java.io.IOException;
@Slf4j
@Service
@RequiredArgsConstructor
public class WebSocketService extends TextWebSocketHandler {
@Getter
private WebSocketSession session;
private final WebSocketClient client;
@ -24,6 +33,19 @@ public class WebSocketService extends TextWebSocketHandler {
private final ZxHandler zxHandler;
private final TipHandler tipHandler;
@Getter
@Value("${ws.client.url}")
private String url;
@Getter
@Value("${ws.client.id}")
private String erpId;
@PostConstruct
public void init() {
System.out.println("========开始连接语音WS服务器========");
this.connect(this.url);
}
public void connect(String uri) {
WebSocketConnectionManager manager = new WebSocketConnectionManager(client, this, uri);
@ -47,6 +69,40 @@ public class WebSocketService extends TextWebSocketHandler {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
this.session = session; // 处理连接后保存session
this.sendMessage(Message.reg(this.erpId).toString());
this.heart(Message.heart(this.erpId));
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws IOException {
if (this.session!=null){
this.session.close();
this.session=null;
}
}
private boolean scheduleStartFlag=false;
public void heart(Message message) {
synchronized (this){
if (this.scheduleStartFlag){
return;
}
this.scheduleStartFlag=true;
}
CronUtil.schedule("*/20 * * * * *", (Task) () -> {
try {
System.out.println("心跳");
this.sendMessage(message.toString());
} catch (Exception e) {
this.connect(this.url);
}
});
// 支持秒级别定时任务
CronUtil.setMatchSecond(true);
CronUtil.start();
}
@Override
@ -60,14 +116,12 @@ public class WebSocketService extends TextWebSocketHandler {
case TIP:
tipHandler.execute(msg);
break;
case ERROR:
tipHandler.execute(msg);
case ZX:
zxHandler.execute(msg);
break;
}
}
public WebSocketSession getSession(){
return this.session;
}
}

@ -1,56 +0,0 @@
package com.dsic.gj_erp.wsclient.handler;
import cn.hutool.cron.CronUtil;
import cn.hutool.cron.task.Task;
import com.alibaba.fastjson.JSONObject;
import com.dsic.gj_erp.wsclient.Message;
import com.dsic.gj_erp.wsclient.WebSocketService;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class HeartHandler implements IHandlerService{
private final WebSocketService webSocketService;
private boolean scheduleStartFlag=false;
@Value("${ws.client.url}")
private String url;
@Getter
@Value("${ws.client.id}")
private String erpId;
@Override
public boolean execute(Message message) {
if (this.scheduleStartFlag){
return true;
}
CronUtil.schedule("*/10 * * * * *", (Task) () -> {
try {
System.out.println("心跳");
webSocketService.sendMessage(message.toString());
} catch (Exception e) {
if (webSocketService.getSession()==null){
webSocketService.connect(this.url);
try {
webSocketService.sendMessage(Message.reg(this.erpId).toString());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
e.printStackTrace();
}
});
// 支持秒级别定时任务
CronUtil.setMatchSecond(true);
CronUtil.start();
this.scheduleStartFlag=true;
return true;
}
}

@ -796,13 +796,14 @@
then 'Y'
else '' end,
'01',
'01','01',dm_ydjh.dmrq,dm_ydjh.pkrqm,dm_ydjh.qjgrq,'01'
'01','01',dm_ydjh.dmrq dmjhrq,dm_ydjh.pkrq pkjhrq,dm_ydjh.qjgrq qjgjhrq,'01'
from dm_ydjh,dm_bom
LEFT JOIN dm_qfxq on dm_qfxq.DC_CH=dm_bom.dcch and dm_qfxq.DC_PL=dm_bom.pl and dm_qfxq.DC_FD=dm_bom.fd
WHERE
dm_ydjh.dc_ch= dm_bom.dcch
and dm_ydjh.dc_pl=dm_bom.pl
and dm_ydjh.tzbh=dm_bom.tzbh
and dm_ydjh.dc_fd=dm_bom.fd
and dm_ydjh.id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=");">
#{item}

Loading…
Cancel
Save