生产看板
This commit is contained in:
		@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
				
			|||||||
import com.mt.wms.core.base.BaseService;
 | 
					import com.mt.wms.core.base.BaseService;
 | 
				
			||||||
import com.mt.wms.core.dal.entity.*;
 | 
					import com.mt.wms.core.dal.entity.*;
 | 
				
			||||||
import com.mt.wms.core.dal.service.*;
 | 
					import com.mt.wms.core.dal.service.*;
 | 
				
			||||||
 | 
					import com.mt.wms.core.utils.BeanUtils;
 | 
				
			||||||
import com.mt.wms.core.utils.CodeGeneratorHelper;
 | 
					import com.mt.wms.core.utils.CodeGeneratorHelper;
 | 
				
			||||||
import com.mt.wms.core.utils.HttpClient;
 | 
					import com.mt.wms.core.utils.HttpClient;
 | 
				
			||||||
import com.mt.wms.core.vo.R;
 | 
					import com.mt.wms.core.vo.R;
 | 
				
			||||||
 | 
					import com.mt.wms.empty.vo.CurrTaskDetVo;
 | 
				
			||||||
 | 
					import com.mt.wms.empty.vo.NowCurrTaskDetVo;
 | 
				
			||||||
import com.mt.wms.empty.websocket.WebSocketServer;
 | 
					import com.mt.wms.empty.websocket.WebSocketServer;
 | 
				
			||||||
import org.junit.jupiter.api.Test;
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
@@ -66,11 +69,52 @@ public class ScheduledTask extends BaseService {
 | 
				
			|||||||
    private RunTaskUtils runTaskUtils;
 | 
					    private RunTaskUtils runTaskUtils;
 | 
				
			||||||
    @Resource
 | 
					    @Resource
 | 
				
			||||||
    private WebSocketServer webSocketServer;
 | 
					    private WebSocketServer webSocketServer;
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private CurrTaskDetServiceBiz currTaskDetServiceBiz;
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private OrderInfoServiceBiz orderInfoServiceBiz;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void testWebsocket() throws IOException {
 | 
					    public void testWebsocket() throws IOException {
 | 
				
			||||||
        webSocketServer.sendtoAll(LocalDateTime.now()+"测试");
 | 
					        webSocketServer.sendtoAll(LocalDateTime.now()+"测试");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 正在加工的加工任务详情
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void screen() throws IOException {
 | 
				
			||||||
 | 
					        //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
 | 
				
			||||||
 | 
					        List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
 | 
				
			||||||
 | 
					        List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
 | 
				
			||||||
 | 
					        for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
 | 
				
			||||||
 | 
					             ) {
 | 
				
			||||||
 | 
					            Long kilnId = nowCurrTask.getKilnId();
 | 
				
			||||||
 | 
					            Boolean kilnWorking = kilnWorking(kilnId);
 | 
				
			||||||
 | 
					            //查询对应炉号是否Working
 | 
				
			||||||
 | 
					            if (kilnWorking){
 | 
				
			||||||
 | 
					                String nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
				
			||||||
 | 
					                        .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
				
			||||||
 | 
					                        .eq(PlcNameSpace.TYPE, 0)
 | 
				
			||||||
 | 
					                        .eq(PlcNameSpace.EQ_ID, kilnId)).getName();
 | 
				
			||||||
 | 
					                //设定时间
 | 
				
			||||||
 | 
					                // TODO: 2022/4/11  PLC变量名称设定时间和剩余时间统一命名
 | 
				
			||||||
 | 
					                Integer setupTime = Integer.parseInt(readPlcToString(nameSpace, "SetupTime"));
 | 
				
			||||||
 | 
					                //剩余时间
 | 
				
			||||||
 | 
					                Integer remainingTime = Integer.parseInt(readPlcToString(nameSpace, "RemainingTime"));
 | 
				
			||||||
 | 
					                nowCurrTask.setSetupTime(setupTime);
 | 
				
			||||||
 | 
					                nowCurrTask.setRemainingTime(remainingTime);
 | 
				
			||||||
 | 
					                //标识卡详情
 | 
				
			||||||
 | 
					                List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, nowCurrTask.getId()));
 | 
				
			||||||
 | 
					                List<CurrTaskDetVo> currTaskDetVoList = BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
 | 
				
			||||||
 | 
					                for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList
 | 
				
			||||||
 | 
					                     ) {
 | 
				
			||||||
 | 
					                    String customerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.ORDER_NO, currTaskDetVo.getOrderNo())).getCustomerName();
 | 
				
			||||||
 | 
					                    currTaskDetVo.setCustomer(customerName);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        webSocketServer.sendtoAll(JSONObject.toJSONString(nowCurrTaskDetVoList));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询加工完成的窑炉
 | 
					     * 查询加工完成的窑炉
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -104,7 +148,6 @@ public class ScheduledTask extends BaseService {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒
 | 
					    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒
 | 
				
			||||||
    //@Scheduled(fixedDelay = 1000*30)
 | 
					    //@Scheduled(fixedDelay = 1000*30)
 | 
				
			||||||
    public void getFastValue(){
 | 
					    public void getFastValue(){
 | 
				
			||||||
@@ -192,6 +235,7 @@ public class ScheduledTask extends BaseService {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次
 | 
					    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次
 | 
				
			||||||
    //@Scheduled(fixedDelay = 1000*60*3)
 | 
					    //@Scheduled(fixedDelay = 1000*60*3)
 | 
				
			||||||
    public void getSlowValue(){
 | 
					    public void getSlowValue(){
 | 
				
			||||||
@@ -503,4 +547,15 @@ public class ScheduledTask extends BaseService {
 | 
				
			|||||||
        return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
					        return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Boolean kilnWorking(Long kilnId){
 | 
				
			||||||
 | 
					        PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
				
			||||||
 | 
					                .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
				
			||||||
 | 
					                .eq(PlcNameSpace.EQ_ID, kilnId)
 | 
				
			||||||
 | 
					                .eq(PlcNameSpace.TYPE,0));
 | 
				
			||||||
 | 
					        String nameSpaceNote = nameSpace.getName();
 | 
				
			||||||
 | 
					        String result = readPlcToString(nameSpaceNote, "Working");
 | 
				
			||||||
 | 
					        return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,68 @@
 | 
				
			|||||||
 | 
					package com.mt.wms.empty.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.mt.wms.core.base.BaseVo;
 | 
				
			||||||
 | 
					import com.mt.wms.core.vo.PageVo;
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiModel;
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiModelProperty;
 | 
				
			||||||
 | 
					import lombok.Builder;
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import lombok.EqualsAndHashCode;
 | 
				
			||||||
 | 
					import lombok.experimental.Accessors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author: LGH
 | 
				
			||||||
 | 
					 * @Date: 2022/4/12
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@EqualsAndHashCode(callSuper = false)
 | 
				
			||||||
 | 
					@Accessors(chain = true)
 | 
				
			||||||
 | 
					@Builder
 | 
				
			||||||
 | 
					@ApiModel(value = "当前正在加工炉任务详情视图对象", description = "用于查询当前正在加工炉任务详情")
 | 
				
			||||||
 | 
					public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 主键,自增
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "主键", example = "1")
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * currtask任务code
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "currtask任务code",example = "0")
 | 
				
			||||||
 | 
					    private String taskCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 炉子id
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "炉子id",example = "0")
 | 
				
			||||||
 | 
					    private Long kilnId;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 炉子code
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "炉子code",example = "0")
 | 
				
			||||||
 | 
					    private String kilnCode;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 工艺plc值
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "工艺plc值",example = "0")
 | 
				
			||||||
 | 
					    private Integer plcValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 工艺设定时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "工艺设定时间",example = "0")
 | 
				
			||||||
 | 
					    private Integer setupTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 工艺剩余时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "工艺剩余时间",example = "0")
 | 
				
			||||||
 | 
					    private Integer remainingTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 标识卡list
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "标识卡list",example = "0")
 | 
				
			||||||
 | 
					    private List<CurrTaskDetVo> currTaskDetVoList;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user