fix:任务完成时状态更新不对:取的是历史数据;param字段没用了
This commit is contained in:
@@ -21,6 +21,8 @@ import org.nl.config.lucene.remote.coder.LogConsumerHandler;
|
|||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
@@ -30,7 +32,8 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
|||||||
* @Date 2024/7/5 14:53
|
* @Date 2024/7/5 14:53
|
||||||
*/
|
*/
|
||||||
public class HeartClientServer extends AbstraceServer {
|
public class HeartClientServer extends AbstraceServer {
|
||||||
|
private static ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
|
private static int i = 0;
|
||||||
private static EventLoopGroup group = new NioEventLoopGroup(4);
|
private static EventLoopGroup group = new NioEventLoopGroup(4);
|
||||||
|
|
||||||
public HeartClientServer(SocketAddress address) {
|
public HeartClientServer(SocketAddress address) {
|
||||||
@@ -47,7 +50,7 @@ public class HeartClientServer extends AbstraceServer {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(SocketChannel ch) throws Exception {
|
protected void initChannel(SocketChannel ch) throws Exception {
|
||||||
ch.pipeline()
|
ch.pipeline()
|
||||||
.addLast("client-idle-handler", new IdleStateHandler(8, 0,0 , TimeUnit.SECONDS))
|
.addLast("client-idle-handler", new IdleStateHandler(0, 10,0 , TimeUnit.SECONDS))
|
||||||
.addLast( new StringEncoder())
|
.addLast( new StringEncoder())
|
||||||
.addLast( new StringDecoder())
|
.addLast( new StringDecoder())
|
||||||
.addLast(new HeartConsumerHandler(body));
|
.addLast(new HeartConsumerHandler(body));
|
||||||
@@ -85,16 +88,16 @@ public class HeartClientServer extends AbstraceServer {
|
|||||||
channelFuture.channel().eventLoop().schedule(() -> doConnect(),6,TimeUnit.SECONDS);
|
channelFuture.channel().eventLoop().schedule(() -> doConnect(),6,TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect.channel().closeFuture().sync();
|
} catch (Throwable t){
|
||||||
} catch (Exception t){
|
t.printStackTrace();
|
||||||
t.getStackTrace();
|
|
||||||
this.doDestroy();
|
this.doDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void pingpong() {
|
public void pingpong() {
|
||||||
new Thread(()->{
|
System.out.println("pingpong被调用次数"+i++);
|
||||||
|
executor.submit(()->{
|
||||||
while (channel!=null && channel.isActive()){
|
while (channel!=null && channel.isActive()){
|
||||||
System.out.println("----ppp-----");
|
System.out.println(channel.id().toString()+"----ppp-----");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -106,6 +109,6 @@ public class HeartClientServer extends AbstraceServer {
|
|||||||
}
|
}
|
||||||
channel.writeAndFlush(log);
|
channel.writeAndFlush(log);
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class HeartConsumerHandler extends SimpleChannelInboundHandler {
|
|||||||
if (evt instanceof IdleStateEvent){
|
if (evt instanceof IdleStateEvent){
|
||||||
IdleStateEvent stateEvent = (IdleStateEvent) evt;
|
IdleStateEvent stateEvent = (IdleStateEvent) evt;
|
||||||
System.out.println(((IdleStateEvent) evt).state().toString());
|
System.out.println(((IdleStateEvent) evt).state().toString());
|
||||||
if (stateEvent.state() == IdleState.READER_IDLE) {
|
if (stateEvent.state() == IdleState.WRITER_IDLE) {
|
||||||
//如果五秒内写失败,说明服务网络异常
|
//如果五秒内写失败,说明服务网络异常
|
||||||
ctx.close();
|
ctx.close();
|
||||||
server.doConnect();
|
server.doConnect();
|
||||||
|
|||||||
@@ -173,18 +173,18 @@ public class PickingService {
|
|||||||
wmsToAcsService.toCommand(convery, "1");
|
wmsToAcsService.toCommand(convery, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// PickingService pickingService = SpringContextHolder.getBean(this.getClass());
|
PickingService pickingService = SpringContextHolder.getBean(this.getClass());
|
||||||
// pickingService.disGroup(mst);
|
pickingService.disGroup(mst);
|
||||||
// //只有透传才有vehicle_code参数否则只有inst_id
|
//只有透传才有vehicle_code参数否则只有inst_id
|
||||||
// FlowContinueEvent continueEvent = new FlowContinueEvent(mst.getProc_inst_id(), (PermeateFunction<String, String>) (inst_id, vehicle_code) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
FlowContinueEvent continueEvent = new FlowContinueEvent(mst.getProc_inst_id(), (PermeateFunction<String, String>) (inst_id, vehicle_code) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||||
// .set("proc_inst_id",inst_id).eq("vehicle_code",vehicle_code)), null)
|
.set("proc_inst_id",inst_id).eq("vehicle_code",vehicle_code)), null)
|
||||||
// .setDto(dto);
|
.setDto(dto);
|
||||||
// continueEvent.setCallback(emp->{
|
continueEvent.setCallback(emp->{
|
||||||
// iFormDataService.update(new UpdateWrapper<PmFormData>()
|
iFormDataService.update(new UpdateWrapper<PmFormData>()
|
||||||
// .set("status",StatusEnum.FORM_STATUS.code("执行中"))
|
.set("status",StatusEnum.FORM_STATUS.code("执行中"))
|
||||||
// .eq("id",mst.getId()));
|
.eq("id",mst.getId()));
|
||||||
// });
|
});
|
||||||
// BussEventMulticaster.Publish(continueEvent);
|
BussEventMulticaster.Publish(continueEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user