Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd
Conflicts: 6.program/wms-gateway/src/main/resources/config/application.yml
This commit is contained in:
		
							
								
								
									
										1765
									
								
								5.数据库/dump-mt_wms_qj-202112230921.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1765
									
								
								5.数据库/dump-mt_wms_qj-202112230921.sql
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -24,7 +24,7 @@
 | 
			
		||||
    <packaging>pom</packaging>
 | 
			
		||||
    <version>1.0</version>
 | 
			
		||||
 | 
			
		||||
    <name>wms</name>
 | 
			
		||||
    <name>wms-qj</name>
 | 
			
		||||
    <description>wms</description>
 | 
			
		||||
    <url>https://wms.picaiba.com</url>
 | 
			
		||||
 | 
			
		||||
@@ -45,15 +45,18 @@
 | 
			
		||||
                <spring.rabbitmq.username>guest</spring.rabbitmq.username>
 | 
			
		||||
                <spring.rabbitmq.password>guest</spring.rabbitmq.password>
 | 
			
		||||
                <!-- redis -->
 | 
			
		||||
                <spring.redis.cluster.nodes>redis.picaiba.com:6380</spring.redis.cluster.nodes>
 | 
			
		||||
<!--                <spring.redis.cluster.nodes>redis.picaiba.com:6380</spring.redis.cluster.nodes>
 | 
			
		||||
                <spring.redis.host>redis.picaiba.com</spring.redis.host>
 | 
			
		||||
                <spring.redis.port>6380</spring.redis.port>
 | 
			
		||||
                <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password>
 | 
			
		||||
                <spring.redis.database>5</spring.redis.database>
 | 
			
		||||
                <spring.redis.database>5</spring.redis.database>-->
 | 
			
		||||
                <!-- database -->
 | 
			
		||||
                <!--<spring.datasource.url>jdbc:p6spy:mysql://localhost:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false-->
 | 
			
		||||
 | 
			
		||||
                <spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30307/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
 | 
			
		||||
                </spring.datasource.url>
 | 
			
		||||
                 </spring.datasource.url>
 | 
			
		||||
                <spring.datasource.username>root</spring.datasource.username>
 | 
			
		||||
                <!--<spring.datasource.password>ABC.10086</spring.datasource.password>-->
 | 
			
		||||
                <spring.datasource.password>1qaz@WSX3edc$RFV</spring.datasource.password>
 | 
			
		||||
                <!-- email -->
 | 
			
		||||
                <spring.mail.host>smtp.mxhichina.com</spring.mail.host>
 | 
			
		||||
@@ -422,6 +425,14 @@
 | 
			
		||||
                        <skip>true</skip>
 | 
			
		||||
                    </configuration>
 | 
			
		||||
                </plugin>
 | 
			
		||||
                <plugin>
 | 
			
		||||
                    <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                    <artifactId>maven-resources-plugin</artifactId>
 | 
			
		||||
                    <configuration>
 | 
			
		||||
                        <delimiters>@</delimiters>
 | 
			
		||||
                        <useDefaultDelimiters>false</useDefaultDelimiters>
 | 
			
		||||
                    </configuration>
 | 
			
		||||
                </plugin>
 | 
			
		||||
            </plugins>
 | 
			
		||||
        </pluginManagement>
 | 
			
		||||
    </build>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,89 @@
 | 
			
		||||
package com.mt.wms.basic.controller;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseParam;
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
 | 
			
		||||
import com.mt.wms.basic.service.AlarmBaseService;
 | 
			
		||||
import com.mt.wms.basic.service.CraftInfoService;
 | 
			
		||||
import com.mt.wms.basic.vo.AlarmBaseVo;
 | 
			
		||||
import com.mt.wms.basic.vo.CraftInfoVo;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.utils.IDGenerator;
 | 
			
		||||
import com.mt.wms.core.validator.groups.AddGroup;
 | 
			
		||||
import com.mt.wms.core.validator.groups.PageGroup;
 | 
			
		||||
import com.mt.wms.core.validator.groups.UpdateGroup;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.validation.groups.Default;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/10/9 11:09
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "craftInfo")
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Api(value = "工艺基础信息管理", tags = "工艺基础信息管理", hidden = false)
 | 
			
		||||
public class CraftInfoController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CraftInfoService craftInfoService;
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "get")
 | 
			
		||||
    @ApiOperation(value = "获取报警基础信息")
 | 
			
		||||
    private R<CraftInfoVo> get(@Validated @RequestBody IdParam idParam) {
 | 
			
		||||
        return craftInfoService.get(idParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "list")
 | 
			
		||||
    @ApiOperation(value = "获取报警基础信息列表")
 | 
			
		||||
    private R<List<CraftInfoVo>> list(@Validated({Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
 | 
			
		||||
        return craftInfoService.list(craftInfoQueryParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "page")
 | 
			
		||||
    @ApiOperation(value = "获取分页报警基础信息")
 | 
			
		||||
    private R<PageVo<CraftInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
 | 
			
		||||
        return craftInfoService.page(craftInfoQueryParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "add")
 | 
			
		||||
    @ApiOperation(value = "新增")
 | 
			
		||||
    private R<IdVo> add(@Validated({AddGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
 | 
			
		||||
        return craftInfoService.add(craftInfoParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "update")
 | 
			
		||||
    @ApiOperation(value = "更新")
 | 
			
		||||
    private R<IdVo> update(@Validated({UpdateGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
 | 
			
		||||
        return craftInfoService.update(craftInfoParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "delete")
 | 
			
		||||
    @ApiOperation(value = "删除报警基础信息")
 | 
			
		||||
    private R<IdVo> delete(@Validated @RequestBody IdParam idParam) {
 | 
			
		||||
        return craftInfoService.delete(idParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "codeGenerator")
 | 
			
		||||
    @ApiOperation(value = "编码生成")
 | 
			
		||||
    private R<String> codeGenerator() {
 | 
			
		||||
        return successful(IDGenerator.gen("GY", "yyyyMMddHHmm", 2, "CRAFTINFO_CODE"));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +1,14 @@
 | 
			
		||||
package com.mt.wms.basic.controller;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.basic.params.VehicleParam;
 | 
			
		||||
import com.mt.wms.basic.params.VehicleQueryParam;
 | 
			
		||||
import com.mt.wms.basic.service.VehicleService;
 | 
			
		||||
import com.mt.wms.basic.vo.VehicleVo;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.dal.entity.VehicleInfo;
 | 
			
		||||
import com.mt.wms.core.dal.service.VehicleInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.utils.IDGenerator;
 | 
			
		||||
import com.mt.wms.core.validator.groups.AddGroup;
 | 
			
		||||
@@ -40,6 +43,8 @@ public class VehicleController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private VehicleService vehicleService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private VehicleInfoServiceBiz vehicleInfoServiceBiz;
 | 
			
		||||
    @PostMapping(value = "get")
 | 
			
		||||
    @ApiOperation(value = "获取车辆信息")
 | 
			
		||||
    private R<VehicleVo> get(@Validated @RequestBody IdParam idParam) {
 | 
			
		||||
@@ -82,4 +87,15 @@ public class VehicleController extends BaseController {
 | 
			
		||||
        return successful(IDGenerator.gen("CL", "yyyyMMddHHmm", 2, "VEHICLE_CODE"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "resetStatus")
 | 
			
		||||
    @ApiOperation(value = "重置车辆状态")
 | 
			
		||||
    private R<String> reset(){
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
        for (VehicleInfo vehicleInfo:vehicleInfoList
 | 
			
		||||
             ) {
 | 
			
		||||
            vehicleInfo.setStatus(0);
 | 
			
		||||
            vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
        }
 | 
			
		||||
        return successful("操作成功,车辆状态已重置为空闲!");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,53 @@
 | 
			
		||||
package com.mt.wms.basic.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseParam;
 | 
			
		||||
import com.mt.wms.core.validator.groups.UpdateGroup;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/1/25 21:34
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "工艺基础信息参数对象", description = "用于新增和更新工艺基础信息")
 | 
			
		||||
public class CraftInfoParam  extends BaseParam {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键,自增
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "主键",required = false, example = "1")
 | 
			
		||||
    @NotNull(message = "xxID不能为空", groups = {UpdateGroup.class})
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "编码", example = "1")
 | 
			
		||||
    private String  code;
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号", example = "1")
 | 
			
		||||
    @NotNull(message = "工艺号不能为空")
 | 
			
		||||
    private String  craftCode;
 | 
			
		||||
    /**
 | 
			
		||||
     * plc值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "plc值", example = "1")
 | 
			
		||||
    @NotNull(message = "plc值不能为空")
 | 
			
		||||
    private Integer plcValue;
 | 
			
		||||
    /**
 | 
			
		||||
     * 说明
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "说明", example = "1")
 | 
			
		||||
    private String  content;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
package com.mt.wms.basic.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/1/25 21:37
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "报警基础信息查询参数", description = "用于查询报警基础信息")
 | 
			
		||||
public class CraftInfoQueryParam  extends BasePageParam {
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键,自增
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "主键",required = false, example = "1")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号",required = false, example = "1")
 | 
			
		||||
    private String craftCode;
 | 
			
		||||
}
 | 
			
		||||
@@ -49,6 +49,12 @@ public class KilnInfoParam extends BaseParam {
 | 
			
		||||
    @ApiModelProperty(value = "缩写(别名)",  example = "1")
 | 
			
		||||
    @NotNull(message = "别名不能为空")
 | 
			
		||||
    private String kilnAlias;
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型,存储数据字典编码,修改为1:加工炉,2:回火炉,3:氮化炉,4:清洗炉
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备类型,存储数据字典编码,修改为1:加工炉,2:回火炉,3:氮化炉,4:清洗炉",  example = "1")
 | 
			
		||||
    @NotNull(message = "设备类型不能为空")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,73 @@
 | 
			
		||||
package com.mt.wms.basic.service;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseParam;
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
 | 
			
		||||
import com.mt.wms.basic.vo.AlarmBaseVo;
 | 
			
		||||
import com.mt.wms.basic.vo.CraftInfoVo;
 | 
			
		||||
import com.mt.wms.core.dal.entity.CraftInfo;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/10/9 10:46
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
public interface CraftInfoService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx
 | 
			
		||||
     *
 | 
			
		||||
     * @param idParam 主键参数
 | 
			
		||||
     * @return xx
 | 
			
		||||
     */
 | 
			
		||||
    R<CraftInfoVo> get(IdParam idParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param craftInfoQueryParam xx查询参数
 | 
			
		||||
     * @return xx列表
 | 
			
		||||
     */
 | 
			
		||||
    R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx分页列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param craftInfoQueryParam xx查询参数
 | 
			
		||||
     * @return xx分页列表
 | 
			
		||||
     */
 | 
			
		||||
    R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增xx
 | 
			
		||||
     *
 | 
			
		||||
     * @param craftInfoParam xx参数
 | 
			
		||||
     * @return 主键
 | 
			
		||||
     */
 | 
			
		||||
    R<IdVo> add(CraftInfoParam craftInfoParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新xx
 | 
			
		||||
     *
 | 
			
		||||
     * @param craftInfoParam xx参数
 | 
			
		||||
     * @return 主键
 | 
			
		||||
     */
 | 
			
		||||
    R<IdVo> update(CraftInfoParam craftInfoParam);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除xx
 | 
			
		||||
     *
 | 
			
		||||
     * @param idParam 主键参数
 | 
			
		||||
     * @return 主键
 | 
			
		||||
     */
 | 
			
		||||
    R<IdVo> delete(IdParam idParam);
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,97 @@
 | 
			
		||||
package com.mt.wms.basic.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseParam;
 | 
			
		||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoParam;
 | 
			
		||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
 | 
			
		||||
import com.mt.wms.basic.service.AlarmBaseService;
 | 
			
		||||
import com.mt.wms.basic.service.CraftInfoService;
 | 
			
		||||
import com.mt.wms.basic.vo.AlarmBaseVo;
 | 
			
		||||
import com.mt.wms.basic.vo.CraftInfoVo;
 | 
			
		||||
import com.mt.wms.core.api.Assert;
 | 
			
		||||
import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.AlarmBase;
 | 
			
		||||
import com.mt.wms.core.dal.entity.CraftInfo;
 | 
			
		||||
import com.mt.wms.core.dal.service.AlarmBaseServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.errorcode.ApiErrorCode;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/10/9 10:49
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
@Transactional
 | 
			
		||||
public class CraftInfoServiceImpl extends BaseService implements CraftInfoService {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CraftInfoServiceBiz craftInfoServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<CraftInfoVo> get(IdParam idParam) {
 | 
			
		||||
        Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
 | 
			
		||||
        CraftInfo craftInfo = craftInfoServiceBiz.getById(idParam.getId());
 | 
			
		||||
        CraftInfoVo craftInfoVo = CraftInfoVo.builder().build();
 | 
			
		||||
        BeanUtils.copyProperties(craftInfo,craftInfoVo);
 | 
			
		||||
        return successful(craftInfoVo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam) {
 | 
			
		||||
        QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
 | 
			
		||||
        wrapper.eq(CraftInfo.VALID,1);
 | 
			
		||||
        List<CraftInfo> craftInfoList = craftInfoServiceBiz.list(wrapper);
 | 
			
		||||
        List<CraftInfoVo> craftInfoVoList = com.mt.wms.core.utils.BeanUtils.copyList(craftInfoList, CraftInfoVo.class);
 | 
			
		||||
        return successful(craftInfoVoList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) {
 | 
			
		||||
        QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
 | 
			
		||||
        wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode())
 | 
			
		||||
                .orderByAsc(CraftInfo.CREATE_TIME);
 | 
			
		||||
        Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper);
 | 
			
		||||
        return successful(new PageVo<>(page,CraftInfoVo.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<IdVo> add(CraftInfoParam craftInfoParam) {
 | 
			
		||||
        QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
 | 
			
		||||
 | 
			
		||||
        CraftInfo craftInfo=new CraftInfo();
 | 
			
		||||
        BeanUtils.copyProperties(craftInfoParam,craftInfo);
 | 
			
		||||
        setCommonField(craftInfo);
 | 
			
		||||
        craftInfoServiceBiz.save(craftInfo);
 | 
			
		||||
        return successful(IdVo.builder().id(craftInfo.getId()).build());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<IdVo> update(CraftInfoParam craftInfoParam) {
 | 
			
		||||
        CraftInfo craftInfo = craftInfoServiceBiz.getById(craftInfoParam.getId());
 | 
			
		||||
        CraftInfo updateCraftInfo=new CraftInfo();
 | 
			
		||||
        BeanUtils.copyProperties(craftInfoParam,updateCraftInfo);
 | 
			
		||||
        setUpdateCommonField(updateCraftInfo);
 | 
			
		||||
        craftInfoServiceBiz.updateById(updateCraftInfo);
 | 
			
		||||
        return successful(IdVo.builder().id(updateCraftInfo.getId()).build());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<IdVo> delete(IdParam idParam) {
 | 
			
		||||
        craftInfoServiceBiz.removeById(idParam.getId());
 | 
			
		||||
        return successful(IdVo.builder().id(idParam.getId()).build());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,55 @@
 | 
			
		||||
package com.mt.wms.basic.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 io.swagger.models.auth.In;
 | 
			
		||||
import lombok.Builder;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/1/25 21:27
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@ApiModel(value = "工艺信息视图对象", description = "用于查询工艺信息信息")
 | 
			
		||||
public class CraftInfoVo extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键,自增
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "主键,更新时需要填写", example = "1")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "编码", example = "1")
 | 
			
		||||
    private String  code;
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号", example = "1")
 | 
			
		||||
    private String  craftCode;
 | 
			
		||||
    /**
 | 
			
		||||
     * plc值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "plc值", example = "1")
 | 
			
		||||
    private Integer plcValue;
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "状态", example = "1")
 | 
			
		||||
    private Integer  status;
 | 
			
		||||
    /**
 | 
			
		||||
     * 说明
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "说明", example = "1")
 | 
			
		||||
    private String  content;
 | 
			
		||||
}
 | 
			
		||||
@@ -32,6 +32,12 @@ public class KilnInfoVo  extends BaseVo implements PageVo.ConvertVo {
 | 
			
		||||
    @ApiModelProperty(value = "编码",  example = "1")
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 类型,存储数据字典编码,修改为1:加工炉,2:回火炉,3:氮化炉,4:清洗炉
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "类型,存储数据字典编码,修改为1:加工炉,2:回火炉,3:氮化炉,4:清洗炉",  example = "1")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 名称
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ public class LocationInfoVo extends BaseVo implements PageVo.ConvertVo {
 | 
			
		||||
     * 状态
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "状态:0空闲,1使用,2不可用",  example = "1")
 | 
			
		||||
    private String status;
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缓存区
 | 
			
		||||
 
 | 
			
		||||
@@ -106,7 +106,7 @@ public class MyGenerator {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void generateCodeWithInjectConfigForAllTable() {
 | 
			
		||||
        generateByTablesWithInjectConfig(new String[]{"t_apms_check_result"});
 | 
			
		||||
        generateByTablesWithInjectConfig(new String[]{"t_auto_exe_task"});
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -92,7 +92,7 @@ public class AlarmInfo extends Model<AlarmInfo> {
 | 
			
		||||
     * 设备id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("equipment_id")
 | 
			
		||||
    private Integer equipmentId;
 | 
			
		||||
    private Long equipmentId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
@@ -130,6 +130,12 @@ public class AlarmInfo extends Model<AlarmInfo> {
 | 
			
		||||
    @TableField("note")
 | 
			
		||||
    private String note;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加工任务编码(炉子报警时记录)
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_code")
 | 
			
		||||
    private String taskCode;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static final String ID = "id";
 | 
			
		||||
 | 
			
		||||
@@ -165,6 +171,8 @@ public class AlarmInfo extends Model<AlarmInfo> {
 | 
			
		||||
 | 
			
		||||
    public static final String NOTE = "note";
 | 
			
		||||
 | 
			
		||||
    public static final String TASK_CODE = "task_code";
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Serializable pkVal() {
 | 
			
		||||
        return this.id;
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-03-04
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -46,7 +46,7 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态,0:新增,1:执行中,2完成
 | 
			
		||||
     * 状态,0:新增,1:执行中,2完成,3 终止
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("status")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
@@ -117,6 +117,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
    @TableField("f_equipment_id")
 | 
			
		||||
    private Long fEquipmentId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称(炉子名称)
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("f_equipment_name")
 | 
			
		||||
    private String fEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号ID,关联工艺号表:t_craft_info
 | 
			
		||||
     */
 | 
			
		||||
@@ -165,6 +171,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
    @TableField("t_equipment_type_id")
 | 
			
		||||
    private Long tEquipmentTypeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("t_equipment_name")
 | 
			
		||||
    private String tEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备ID,关联设备表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
@@ -219,6 +231,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
    @TableField("th_equipment_type_id")
 | 
			
		||||
    private Long thEquipmentTypeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("th_equipment_name")
 | 
			
		||||
    private String thEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备ID,关联设备表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
@@ -292,6 +310,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
 | 
			
		||||
    public static final String F_EQUIPMENT_ID = "f_equipment_id";
 | 
			
		||||
 | 
			
		||||
    public static final String F_EQUIPMENT_NAME = "f_equipment_name";
 | 
			
		||||
 | 
			
		||||
    public static final String F_CRAFT_CODE_ID = "f_craft_code_id";
 | 
			
		||||
 | 
			
		||||
    public static final String F_PLC_VALUE = "f_plc_value";
 | 
			
		||||
@@ -308,6 +328,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
 | 
			
		||||
    public static final String T_EQUIPMENT_TYPE_ID = "t_equipment_type_id";
 | 
			
		||||
 | 
			
		||||
    public static final String T_EQUIPMENT_NAME = "t_equipment_name";
 | 
			
		||||
 | 
			
		||||
    public static final String T_EQUIPMENT_ID = "t_equipment_id";
 | 
			
		||||
 | 
			
		||||
    public static final String T_CRAFT_CODE_ID = "t_craft_code_id";
 | 
			
		||||
@@ -326,6 +348,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
 | 
			
		||||
 | 
			
		||||
    public static final String TH_EQUIPMENT_TYPE_ID = "th_equipment_type_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TH_EQUIPMENT_NAME = "th_equipment_name";
 | 
			
		||||
 | 
			
		||||
    public static final String TH_EQUIPMENT_ID = "th_equipment_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TH_CRAFT_CODE_ID = "th_craft_code_id";
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -71,7 +71,7 @@ public class KilnInfo extends Model<KilnInfo> {
 | 
			
		||||
    private String version;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态	0初始化,1损坏
 | 
			
		||||
     * 状态	0初始化,1损坏 ,2 工作中
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("status")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
@@ -83,7 +83,7 @@ public class KilnInfo extends Model<KilnInfo> {
 | 
			
		||||
    private String interCode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 编码
 | 
			
		||||
     * 编码 必须与AMPS相同
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("code")
 | 
			
		||||
    private String code;
 | 
			
		||||
@@ -95,7 +95,7 @@ public class KilnInfo extends Model<KilnInfo> {
 | 
			
		||||
    private Integer factoryId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 窑炉名称
 | 
			
		||||
     * 窑炉名称 建议与AMPS相同
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_name")
 | 
			
		||||
    private String kilnName;
 | 
			
		||||
@@ -113,10 +113,10 @@ public class KilnInfo extends Model<KilnInfo> {
 | 
			
		||||
    private String en;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型,存储数据字典编码
 | 
			
		||||
     * 设备类型,存储数据字典编码,修改为1:加工炉,2:回火炉,3:氮化炉,4:清洗炉
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("type")
 | 
			
		||||
    private String type;
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * ip地址
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -53,7 +53,13 @@ public class ParEleValue extends Model<ParEleValue> {
 | 
			
		||||
     * 窑炉id,关联设备窑炉表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_id")
 | 
			
		||||
    private Integer kilnId;
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_id")
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数id,关联参数表:t_par_info
 | 
			
		||||
@@ -104,10 +110,10 @@ public class ParEleValue extends Model<ParEleValue> {
 | 
			
		||||
    private Float totalBat;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段1
 | 
			
		||||
     * 时间段类型。0:半小时,1:天,2:月
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_a")
 | 
			
		||||
    private Float addA;
 | 
			
		||||
    @TableField("date_type")
 | 
			
		||||
    private Integer dateType;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段2
 | 
			
		||||
@@ -150,6 +156,8 @@ public class ParEleValue extends Model<ParEleValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String KILN_ID = "kiln_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TASK_ID = "task_id";
 | 
			
		||||
 | 
			
		||||
    public static final String PAR_ID = "par_id";
 | 
			
		||||
 | 
			
		||||
    public static final String A_VOLTAGEV_VALUE = "a_voltagev_value";
 | 
			
		||||
@@ -166,7 +174,7 @@ public class ParEleValue extends Model<ParEleValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String TOTAL_BAT = "total_bat";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_A = "add_a";
 | 
			
		||||
    public static final String DATE_TYPE = "date_type";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_B = "add_b";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -53,7 +53,13 @@ public class ParGasValue extends Model<ParGasValue> {
 | 
			
		||||
     * 窑炉id,关联设备窑炉表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_id")
 | 
			
		||||
    private Integer kilnId;
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_id")
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数id,关联参数表:t_par_info
 | 
			
		||||
@@ -62,13 +68,13 @@ public class ParGasValue extends Model<ParGasValue> {
 | 
			
		||||
    private Integer parId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设定氮势值
 | 
			
		||||
     * 设定氮/碳势值
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("set_nit_pot_value")
 | 
			
		||||
    private Float setNitPotValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 实际氮势值
 | 
			
		||||
     * 实际氮/碳势值
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("actual_nit_pot_value")
 | 
			
		||||
    private Float actualNitPotValue;
 | 
			
		||||
@@ -80,46 +86,46 @@ public class ParGasValue extends Model<ParGasValue> {
 | 
			
		||||
    private Float acceptNitPotValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 氮气流量
 | 
			
		||||
     * 氮气量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("nit_flow_value")
 | 
			
		||||
    private Float nitFlowValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 氨气流量
 | 
			
		||||
     * 氨气量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("ammonia_flow_value")
 | 
			
		||||
    private Float ammoniaFlowValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 二氧化碳流量
 | 
			
		||||
     * 二氧化碳量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("car_dioxide_flow_value")
 | 
			
		||||
    private Float carDioxideFlowValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段1
 | 
			
		||||
     * 甲烷量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_a")
 | 
			
		||||
    private Float addA;
 | 
			
		||||
    @TableField("methanol_flow")
 | 
			
		||||
    private Float methanolFlow;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段2
 | 
			
		||||
     * 丙烷量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_b")
 | 
			
		||||
    private Float addB;
 | 
			
		||||
    @TableField("propane_flow")
 | 
			
		||||
    private Float propaneFlow;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段3
 | 
			
		||||
     * 氢含量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_c")
 | 
			
		||||
    private Float addC;
 | 
			
		||||
    @TableField("hydrogen_content")
 | 
			
		||||
    private Float hydrogenContent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段4
 | 
			
		||||
     * 分解率
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("orther_a")
 | 
			
		||||
    private String ortherA;
 | 
			
		||||
    @TableField("decomposition_rate")
 | 
			
		||||
    private Float decompositionRate;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段5
 | 
			
		||||
@@ -144,6 +150,8 @@ public class ParGasValue extends Model<ParGasValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String KILN_ID = "kiln_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TASK_ID = "task_id";
 | 
			
		||||
 | 
			
		||||
    public static final String PAR_ID = "par_id";
 | 
			
		||||
 | 
			
		||||
    public static final String SET_NIT_POT_VALUE = "set_nit_pot_value";
 | 
			
		||||
@@ -158,13 +166,13 @@ public class ParGasValue extends Model<ParGasValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String CAR_DIOXIDE_FLOW_VALUE = "car_dioxide_flow_value";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_A = "add_a";
 | 
			
		||||
    public static final String METHANOL_FLOW = "methanol_flow";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_B = "add_b";
 | 
			
		||||
    public static final String PROPANE_FLOW = "propane_flow";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_C = "add_c";
 | 
			
		||||
    public static final String HYDROGEN_CONTENT = "hydrogen_content";
 | 
			
		||||
 | 
			
		||||
    public static final String ORTHER_A = "orther_a";
 | 
			
		||||
    public static final String DECOMPOSITION_RATE = "decomposition_rate";
 | 
			
		||||
 | 
			
		||||
    public static final String ORTHER_B = "orther_b";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -53,7 +53,13 @@ public class ParRotSpeedValue extends Model<ParRotSpeedValue> {
 | 
			
		||||
     * 窑炉id,关联设备窑炉表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_id")
 | 
			
		||||
    private Integer kilnId;
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_id")
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数id,关联参数表:t_par_info
 | 
			
		||||
@@ -156,6 +162,8 @@ public class ParRotSpeedValue extends Model<ParRotSpeedValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String KILN_ID = "kiln_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TASK_ID = "task_id";
 | 
			
		||||
 | 
			
		||||
    public static final String PAR_ID = "par_id";
 | 
			
		||||
 | 
			
		||||
    public static final String FAN_SPEED_A_VALUE = "fan_speed_a_value";
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -53,7 +53,13 @@ public class ParTemValue extends Model<ParTemValue> {
 | 
			
		||||
     * 窑炉id,关联设备窑炉表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_id")
 | 
			
		||||
    private Integer kilnId;
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_id")
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数id,关联参数表:t_par_info
 | 
			
		||||
@@ -98,22 +104,22 @@ public class ParTemValue extends Model<ParTemValue> {
 | 
			
		||||
    private Float takeOverOilSetTemValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段1
 | 
			
		||||
     * 外一区温度
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_a")
 | 
			
		||||
    private Float addA;
 | 
			
		||||
    @TableField("outer_zone1_temp")
 | 
			
		||||
    private Float outerZone1Temp;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段2
 | 
			
		||||
     * 外二区温度
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_b")
 | 
			
		||||
    private Float addB;
 | 
			
		||||
    @TableField("outer_zone2_temp")
 | 
			
		||||
    private Float outerZone2Temp;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段3
 | 
			
		||||
     * 炉压
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("add_c")
 | 
			
		||||
    private Float addC;
 | 
			
		||||
    @TableField("furnace_pressure")
 | 
			
		||||
    private Float furnacePressure;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 扩展字段4
 | 
			
		||||
@@ -144,6 +150,8 @@ public class ParTemValue extends Model<ParTemValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String KILN_ID = "kiln_id";
 | 
			
		||||
 | 
			
		||||
    public static final String TASK_ID = "task_id";
 | 
			
		||||
 | 
			
		||||
    public static final String PAR_ID = "par_id";
 | 
			
		||||
 | 
			
		||||
    public static final String SET_TEM_VALUE = "set_tem_value";
 | 
			
		||||
@@ -158,11 +166,11 @@ public class ParTemValue extends Model<ParTemValue> {
 | 
			
		||||
 | 
			
		||||
    public static final String TAKE_OVER_OIL_SET_TEM_VALUE = "take_over_oil_set_tem_value";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_A = "add_a";
 | 
			
		||||
    public static final String OUTER_ZONE1_TEMP = "outer_zone1_temp";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_B = "add_b";
 | 
			
		||||
    public static final String OUTER_ZONE2_TEMP = "outer_zone2_temp";
 | 
			
		||||
 | 
			
		||||
    public static final String ADD_C = "add_c";
 | 
			
		||||
    public static final String FURNACE_PRESSURE = "furnace_pressure";
 | 
			
		||||
 | 
			
		||||
    public static final String ORTHER_A = "orther_a";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,98 @@
 | 
			
		||||
package com.mt.wms.core.dal.entity;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableName;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.Version;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * PLC变量nameSpace对照表
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@TableName("t_plc_name_space")
 | 
			
		||||
public class PlcNameSpace extends Model<PlcNameSpace> {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("id")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型,1:多用加工炉,2:氮化炉,3:回火炉,4:清洗机,5:rgv
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("eq_type")
 | 
			
		||||
    private Integer eqType;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 变量名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("name")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 变量的含义
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("note")
 | 
			
		||||
    private String note;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("eq_id")
 | 
			
		||||
    private Long eqId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("eq_name")
 | 
			
		||||
    private String eqName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 变量类型,0:变量,1:报警变量
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("type")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 备注
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("remark")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static final String ID = "id";
 | 
			
		||||
 | 
			
		||||
    public static final String EQ_TYPE = "eq_type";
 | 
			
		||||
 | 
			
		||||
    public static final String NAME = "name";
 | 
			
		||||
 | 
			
		||||
    public static final String NOTE = "note";
 | 
			
		||||
 | 
			
		||||
    public static final String EQ_ID = "eq_id";
 | 
			
		||||
 | 
			
		||||
    public static final String EQ_NAME = "eq_name";
 | 
			
		||||
 | 
			
		||||
    public static final String TYPE = "type";
 | 
			
		||||
 | 
			
		||||
    public static final String REMARK = "remark";
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Serializable pkVal() {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,91 @@
 | 
			
		||||
package com.mt.wms.core.dal.entity;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableName;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.Version;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 点位信息表
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-03-02
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@TableName("t_point_info")
 | 
			
		||||
public class PointInfo extends Model<PointInfo> {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * id
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("id")
 | 
			
		||||
    private Integer id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 点位编码,对应plc
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("code")
 | 
			
		||||
    private Long code;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 点位对应的设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("name")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 点位说明;关联对应表数据的code,窑炉code,库位code等等
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("note")
 | 
			
		||||
    private String note;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 类型:1 炉子,2 液压台,3 库位
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("type")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 距离原点的距离
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("distance")
 | 
			
		||||
    private Double distance;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建时间
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("create_time")
 | 
			
		||||
    private LocalDate createTime;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static final String ID = "id";
 | 
			
		||||
 | 
			
		||||
    public static final String CODE = "code";
 | 
			
		||||
 | 
			
		||||
    public static final String NAME = "name";
 | 
			
		||||
 | 
			
		||||
    public static final String NOTE = "note";
 | 
			
		||||
 | 
			
		||||
    public static final String TYPE = "type";
 | 
			
		||||
 | 
			
		||||
    public static final String DISTANCE = "distance";
 | 
			
		||||
 | 
			
		||||
    public static final String CREATE_TIME = "create_time";
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Serializable pkVal() {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface AlarmInfoMapper extends BaseMapper<AlarmInfo> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,11 +21,12 @@
 | 
			
		||||
        <result column="alarm_info" property="alarmInfo" />
 | 
			
		||||
        <result column="description" property="description" />
 | 
			
		||||
        <result column="note" property="note" />
 | 
			
		||||
        <result column="task_code" property="taskCode" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, equipment_id, equipment_name, type, alarm_code, alarm_info, description, note
 | 
			
		||||
        id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, equipment_id, equipment_name, type, alarm_code, alarm_info, description, note, task_code
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-03-04
 | 
			
		||||
 */
 | 
			
		||||
public interface AutoExeTaskMapper extends BaseMapper<AutoExeTask> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@
 | 
			
		||||
        <result column="f_det_task_code" property="fDetTaskCode" />
 | 
			
		||||
        <result column="f_equipment_type_id" property="fEquipmentTypeId" />
 | 
			
		||||
        <result column="f_equipment_id" property="fEquipmentId" />
 | 
			
		||||
        <result column="f_equipment_name" property="fEquipmentName" />
 | 
			
		||||
        <result column="f_craft_code_id" property="fCraftCodeId" />
 | 
			
		||||
        <result column="f_plc_value" property="fPlcValue" />
 | 
			
		||||
        <result column="f_in_tran_status" property="fInTranStatus" />
 | 
			
		||||
@@ -27,6 +28,7 @@
 | 
			
		||||
        <result column="t_task_id" property="tTaskId" />
 | 
			
		||||
        <result column="t_det_task_code" property="tDetTaskCode" />
 | 
			
		||||
        <result column="t_equipment_type_id" property="tEquipmentTypeId" />
 | 
			
		||||
        <result column="t_equipment_name" property="tEquipmentName" />
 | 
			
		||||
        <result column="t_equipment_id" property="tEquipmentId" />
 | 
			
		||||
        <result column="t_craft_code_id" property="tCraftCodeId" />
 | 
			
		||||
        <result column="t_plc_value" property="tPlcValue" />
 | 
			
		||||
@@ -36,6 +38,7 @@
 | 
			
		||||
        <result column="th_task_id" property="thTaskId" />
 | 
			
		||||
        <result column="th_det_task_code" property="thDetTaskCode" />
 | 
			
		||||
        <result column="th_equipment_type_id" property="thEquipmentTypeId" />
 | 
			
		||||
        <result column="th_equipment_name" property="thEquipmentName" />
 | 
			
		||||
        <result column="th_equipment_id" property="thEquipmentId" />
 | 
			
		||||
        <result column="th_craft_code_id" property="thCraftCodeId" />
 | 
			
		||||
        <result column="th_plc_value" property="thPlcValue" />
 | 
			
		||||
@@ -47,7 +50,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, valid, create_time, status, inter_code, process_flow_id, process_flow_name, process_flow_type, craft_code_id, craft_code, warehouse_id, f_task_id, f_det_task_code, f_equipment_type_id, f_equipment_id, f_craft_code_id, f_plc_value, f_in_tran_status, f_pro_status, f_out_tran_status, t_task_id, t_det_task_code, t_equipment_type_id, t_equipment_id, t_craft_code_id, t_plc_value, t_in_tran_status, t_pro_status, t_out_tran_status, th_task_id, th_det_task_code, th_equipment_type_id, th_equipment_id, th_craft_code_id, th_plc_value, th_in_tran_status, th_pro_status, th_out_tran_status, content
 | 
			
		||||
        id, valid, create_time, status, inter_code, process_flow_id, process_flow_name, process_flow_type, craft_code_id, craft_code, warehouse_id, f_task_id, f_det_task_code, f_equipment_type_id, f_equipment_id, f_equipment_name, f_craft_code_id, f_plc_value, f_in_tran_status, f_pro_status, f_out_tran_status, t_task_id, t_det_task_code, t_equipment_type_id, t_equipment_name, t_equipment_id, t_craft_code_id, t_plc_value, t_in_tran_status, t_pro_status, t_out_tran_status, th_task_id, th_det_task_code, th_equipment_type_id, th_equipment_name, th_equipment_id, th_craft_code_id, th_plc_value, th_in_tran_status, th_pro_status, th_out_tran_status, content
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface KilnInfoMapper extends BaseMapper<KilnInfo> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParEleValueMapper extends BaseMapper<ParEleValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
        <result column="inter_code" property="interCode" />
 | 
			
		||||
        <result column="status" property="status" />
 | 
			
		||||
        <result column="kiln_id" property="kilnId" />
 | 
			
		||||
        <result column="task_id" property="taskId" />
 | 
			
		||||
        <result column="par_id" property="parId" />
 | 
			
		||||
        <result column="a_voltagev_value" property="aVoltagevValue" />
 | 
			
		||||
        <result column="b_voltagev_value" property="bVoltagevValue" />
 | 
			
		||||
@@ -17,7 +18,7 @@
 | 
			
		||||
        <result column="b_current_value" property="bCurrentValue" />
 | 
			
		||||
        <result column="c_current_value" property="cCurrentValue" />
 | 
			
		||||
        <result column="total_bat" property="totalBat" />
 | 
			
		||||
        <result column="add_a" property="addA" />
 | 
			
		||||
        <result column="date_type" property="dateType" />
 | 
			
		||||
        <result column="add_b" property="addB" />
 | 
			
		||||
        <result column="add_c" property="addC" />
 | 
			
		||||
        <result column="orther_a" property="ortherA" />
 | 
			
		||||
@@ -27,7 +28,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, par_id, a_voltagev_value, b_voltagev_value, c_voltagev_value, a_current_value, b_current_value, c_current_value, total_bat, add_a, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, task_id, par_id, a_voltagev_value, b_voltagev_value, c_voltagev_value, a_current_value, b_current_value, c_current_value, total_bat, date_type, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParGasValueMapper extends BaseMapper<ParGasValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
        <result column="inter_code" property="interCode" />
 | 
			
		||||
        <result column="status" property="status" />
 | 
			
		||||
        <result column="kiln_id" property="kilnId" />
 | 
			
		||||
        <result column="task_id" property="taskId" />
 | 
			
		||||
        <result column="par_id" property="parId" />
 | 
			
		||||
        <result column="set_nit_pot_value" property="setNitPotValue" />
 | 
			
		||||
        <result column="actual_nit_pot_value" property="actualNitPotValue" />
 | 
			
		||||
@@ -16,17 +17,17 @@
 | 
			
		||||
        <result column="nit_flow_value" property="nitFlowValue" />
 | 
			
		||||
        <result column="ammonia_flow_value" property="ammoniaFlowValue" />
 | 
			
		||||
        <result column="car_dioxide_flow_value" property="carDioxideFlowValue" />
 | 
			
		||||
        <result column="add_a" property="addA" />
 | 
			
		||||
        <result column="add_b" property="addB" />
 | 
			
		||||
        <result column="add_c" property="addC" />
 | 
			
		||||
        <result column="orther_a" property="ortherA" />
 | 
			
		||||
        <result column="methanol_flow" property="methanolFlow" />
 | 
			
		||||
        <result column="propane_flow" property="propaneFlow" />
 | 
			
		||||
        <result column="hydrogen_content" property="hydrogenContent" />
 | 
			
		||||
        <result column="decomposition_rate" property="decompositionRate" />
 | 
			
		||||
        <result column="orther_b" property="ortherB" />
 | 
			
		||||
        <result column="orther_c" property="ortherC" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, par_id, set_nit_pot_value, actual_nit_pot_value, accept_nit_pot_value, nit_flow_value, ammonia_flow_value, car_dioxide_flow_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, task_id, par_id, set_nit_pot_value, actual_nit_pot_value, accept_nit_pot_value, nit_flow_value, ammonia_flow_value, car_dioxide_flow_value, methanol_flow, propane_flow, hydrogen_content, decomposition_rate, orther_b, orther_c
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParRotSpeedValueMapper extends BaseMapper<ParRotSpeedValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
        <result column="inter_code" property="interCode" />
 | 
			
		||||
        <result column="status" property="status" />
 | 
			
		||||
        <result column="kiln_id" property="kilnId" />
 | 
			
		||||
        <result column="task_id" property="taskId" />
 | 
			
		||||
        <result column="par_id" property="parId" />
 | 
			
		||||
        <result column="fan_speed_a_value" property="fanSpeedAValue" />
 | 
			
		||||
        <result column="fan_speed_b_value" property="fanSpeedBValue" />
 | 
			
		||||
@@ -28,7 +29,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, par_id, fan_speed_a_value, fan_speed_b_value, oil_sti_speed_a_value, oil_sti_speed_b_value, oil_sti_speed_c_value, oil_sti_speed_d_value, oil_sti_speed_e_value, oil_sti_speed_f_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, task_id, par_id, fan_speed_a_value, fan_speed_b_value, oil_sti_speed_a_value, oil_sti_speed_b_value, oil_sti_speed_c_value, oil_sti_speed_d_value, oil_sti_speed_e_value, oil_sti_speed_f_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParTemValueMapper extends BaseMapper<ParTemValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
        <result column="inter_code" property="interCode" />
 | 
			
		||||
        <result column="status" property="status" />
 | 
			
		||||
        <result column="kiln_id" property="kilnId" />
 | 
			
		||||
        <result column="task_id" property="taskId" />
 | 
			
		||||
        <result column="par_id" property="parId" />
 | 
			
		||||
        <result column="set_tem_value" property="setTemValue" />
 | 
			
		||||
        <result column="act_tem_value" property="actTemValue" />
 | 
			
		||||
@@ -16,9 +17,9 @@
 | 
			
		||||
        <result column="oil_tank_set_tem_value" property="oilTankSetTemValue" />
 | 
			
		||||
        <result column="take_over_set_tem_value" property="takeOverSetTemValue" />
 | 
			
		||||
        <result column="take_over_oil_set_tem_value" property="takeOverOilSetTemValue" />
 | 
			
		||||
        <result column="add_a" property="addA" />
 | 
			
		||||
        <result column="add_b" property="addB" />
 | 
			
		||||
        <result column="add_c" property="addC" />
 | 
			
		||||
        <result column="outer_zone1_temp" property="outerZone1Temp" />
 | 
			
		||||
        <result column="outer_zone2_temp" property="outerZone2Temp" />
 | 
			
		||||
        <result column="furnace_pressure" property="furnacePressure" />
 | 
			
		||||
        <result column="orther_a" property="ortherA" />
 | 
			
		||||
        <result column="orther_b" property="ortherB" />
 | 
			
		||||
        <result column="orther_c" property="ortherC" />
 | 
			
		||||
@@ -26,7 +27,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, par_id, set_tem_value, act_tem_value, oil_tank_act_tem_value, oil_tank_set_tem_value, take_over_set_tem_value, take_over_oil_set_tem_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
 | 
			
		||||
        id, create_time, inter_code, status, kiln_id, task_id, par_id, set_tem_value, act_tem_value, oil_tank_act_tem_value, oil_tank_set_tem_value, take_over_set_tem_value, take_over_oil_set_tem_value, outer_zone1_temp, outer_zone2_temp, furnace_pressure, orther_a, orther_b, orther_c
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
package com.mt.wms.core.dal.mapper;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PlcNameSpace;
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * PLC变量nameSpace对照表 Mapper 接口
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface PlcNameSpaceMapper extends BaseMapper<PlcNameSpace> {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.mt.wms.core.dal.mapper.PlcNameSpaceMapper">
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询映射结果 -->
 | 
			
		||||
    <resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.PlcNameSpace">
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="eq_type" property="eqType" />
 | 
			
		||||
        <result column="name" property="name" />
 | 
			
		||||
        <result column="note" property="note" />
 | 
			
		||||
        <result column="eq_id" property="eqId" />
 | 
			
		||||
        <result column="eq_name" property="eqName" />
 | 
			
		||||
        <result column="type" property="type" />
 | 
			
		||||
        <result column="remark" property="remark" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, eq_type, name, note, eq_id, eq_name, type, remark
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
package com.mt.wms.core.dal.mapper;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PointInfo;
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 点位信息表 Mapper 接口
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-03-02
 | 
			
		||||
 */
 | 
			
		||||
public interface PointInfoMapper extends BaseMapper<PointInfo> {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.mt.wms.core.dal.mapper.PointInfoMapper">
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询映射结果 -->
 | 
			
		||||
    <resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.PointInfo">
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="code" property="code" />
 | 
			
		||||
        <result column="name" property="name" />
 | 
			
		||||
        <result column="note" property="note" />
 | 
			
		||||
        <result column="type" property="type" />
 | 
			
		||||
        <result column="distance" property="distance" />
 | 
			
		||||
        <result column="create_time" property="createTime" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        id, code, name, note, type, distance, create_time
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface AlarmInfoServiceBiz extends IService<AlarmInfo> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-03-04
 | 
			
		||||
 */
 | 
			
		||||
public interface AutoExeTaskServiceBiz extends IService<AutoExeTask> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface KilnInfoServiceBiz extends IService<KilnInfo> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParEleValueServiceBiz extends IService<ParEleValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParGasValueServiceBiz extends IService<ParGasValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParRotSpeedValueServiceBiz extends IService<ParRotSpeedValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
public interface ParTemValueServiceBiz extends IService<ParTemValue> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
package com.mt.wms.core.dal.service;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PlcNameSpace;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * PLC变量nameSpace对照表 服务类
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
public interface PlcNameSpaceServiceBiz extends IService<PlcNameSpace> {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
package com.mt.wms.core.dal.service;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PointInfo;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 点位信息表 服务类
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-03-02
 | 
			
		||||
 */
 | 
			
		||||
public interface PointInfoServiceBiz extends IService<PointInfo> {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class AlarmInfoServiceBizImpl extends ServiceImpl<AlarmInfoMapper, AlarmInfo> implements AlarmInfoServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-03-04
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class AutoExeTaskServiceBizImpl extends ServiceImpl<AutoExeTaskMapper, AutoExeTask> implements AutoExeTaskServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class KilnInfoServiceBizImpl extends ServiceImpl<KilnInfoMapper, KilnInfo> implements KilnInfoServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class ParEleValueServiceBizImpl extends ServiceImpl<ParEleValueMapper, ParEleValue> implements ParEleValueServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class ParGasValueServiceBizImpl extends ServiceImpl<ParGasValueMapper, ParGasValue> implements ParGasValueServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class ParRotSpeedValueServiceBizImpl extends ServiceImpl<ParRotSpeedValueMapper, ParRotSpeedValue> implements ParRotSpeedValueServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-11-18
 | 
			
		||||
 * @since 2022-03-01
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class ParTemValueServiceBizImpl extends ServiceImpl<ParTemValueMapper, ParTemValue> implements ParTemValueServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
package com.mt.wms.core.dal.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PlcNameSpace;
 | 
			
		||||
import com.mt.wms.core.dal.mapper.PlcNameSpaceMapper;
 | 
			
		||||
import com.mt.wms.core.dal.service.PlcNameSpaceServiceBiz;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * PLC变量nameSpace对照表 服务实现类
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-02-28
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class PlcNameSpaceServiceBizImpl extends ServiceImpl<PlcNameSpaceMapper, PlcNameSpace> implements PlcNameSpaceServiceBiz {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
package com.mt.wms.core.dal.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.entity.PointInfo;
 | 
			
		||||
import com.mt.wms.core.dal.mapper.PointInfoMapper;
 | 
			
		||||
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 点位信息表 服务实现类
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2022-03-02
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class PointInfoServiceBizImpl extends ServiceImpl<PointInfoMapper, PointInfo> implements PointInfoServiceBiz {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -27,7 +27,23 @@ public class CodeGeneratorHelper {
 | 
			
		||||
     */
 | 
			
		||||
    public static final String ORDER_CODE = "ORDER_CODE";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 报警编码
 | 
			
		||||
     */
 | 
			
		||||
    public static final String ALARM_CODE = "ALARM_CODE";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 自动任务编码
 | 
			
		||||
     */
 | 
			
		||||
    public static final String AUTO_TASK_CODE = "AUTO_TASK_CODE";
 | 
			
		||||
    /**
 | 
			
		||||
     * 生成自动任务编码
 | 
			
		||||
     *
 | 
			
		||||
     * @return 订单编号
 | 
			
		||||
     */
 | 
			
		||||
    public static String getAutoTaskCode() {
 | 
			
		||||
        return IDGenerator.gen("ZD", "yyyyMMdd", 6, AUTO_TASK_CODE);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 生成订单编号
 | 
			
		||||
     *
 | 
			
		||||
@@ -36,5 +52,13 @@ public class CodeGeneratorHelper {
 | 
			
		||||
    public static String getOrderCode() {
 | 
			
		||||
        return IDGenerator.gen("20", "yyyyMMdd", 6, ORDER_CODE);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 生成报警编码
 | 
			
		||||
     *
 | 
			
		||||
     * @return 报警编码
 | 
			
		||||
     */
 | 
			
		||||
    public static String getAlarmCode() {
 | 
			
		||||
        return IDGenerator.gen("BJ", "yyyyMMdd", 6, ALARM_CODE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ import java.io.IOException;
 | 
			
		||||
import java.nio.charset.Charset;
 | 
			
		||||
import java.security.cert.CertificateException;
 | 
			
		||||
import java.security.cert.X509Certificate;
 | 
			
		||||
import java.util.concurrent.TimeUnit;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 使用 OKhttp 请求 Api 数据
 | 
			
		||||
@@ -46,7 +47,11 @@ public class HttpClient {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String httpPost(String url, String json) throws IOException {
 | 
			
		||||
        OkHttpClient httpClient = new OkHttpClient();
 | 
			
		||||
        //OkHttpClient httpClient = new OkHttpClient();
 | 
			
		||||
        OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.MINUTES)
 | 
			
		||||
                .writeTimeout(60*30, TimeUnit.SECONDS)
 | 
			
		||||
                .readTimeout(60*30, TimeUnit.SECONDS)
 | 
			
		||||
                .build();
 | 
			
		||||
        RequestBody requestBody = RequestBody.create(JSON, json);
 | 
			
		||||
        Request request = new Request.Builder()
 | 
			
		||||
                .url(url)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,13 @@
 | 
			
		||||
            <artifactId>hutool-all</artifactId>
 | 
			
		||||
            <version>5.5.7</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-websocket -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-websocket</artifactId>
 | 
			
		||||
            <version>2.5.4</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
</project>
 | 
			
		||||
@@ -49,7 +49,7 @@ public class ApmsController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    static String Token = "";
 | 
			
		||||
    static LocalDateTime TokenExpireTime = LocalDateTime.now();
 | 
			
		||||
    static String ApiAddress = "http://59.110.171.25:9010";
 | 
			
		||||
    static String ApiAddress = "http://192.168.1.109:80";
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "apmsPostOrder")
 | 
			
		||||
    @ApiOperation(value = "WMS接收APMS推送订单信息")
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,56 @@
 | 
			
		||||
package com.mt.wms.empty.controller;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.validator.groups.PageGroup;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.AutoTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.service.AutoTaskService;
 | 
			
		||||
import com.mt.wms.empty.vo.AutoTaskVo;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.validation.groups.Default;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 23:35
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "autoTask")
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Api(value = "自动任务相关接口", tags = "自动任务相关接口", hidden = false)
 | 
			
		||||
public class AutoTaskController extends BaseController {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private AutoTaskService autoTaskService;
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "get")
 | 
			
		||||
    @ApiOperation(value = "获取自动任务基础信息")
 | 
			
		||||
    private R<AutoTaskVo> get(@Validated @RequestBody IdParam idParam) {
 | 
			
		||||
        return autoTaskService.get(idParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "page")
 | 
			
		||||
    @ApiOperation(value = "获取分页自动任务基础信息")
 | 
			
		||||
    private R<PageVo<AutoTaskVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody AutoTaskQueryParam autoTaskQueryParam) {
 | 
			
		||||
        return autoTaskService.page(autoTaskQueryParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "stop")
 | 
			
		||||
    @ApiOperation(value = "终止自动任务")
 | 
			
		||||
    private R<IdVo> stop(@Validated @RequestBody IdParam idParam){
 | 
			
		||||
        return autoTaskService.stop(idParam);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
package com.mt.wms.empty.controller;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.dal.entity.ApmsCheckResult;
 | 
			
		||||
import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.ApmsCheckRusultQueryParam;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: LGH
 | 
			
		||||
 * @Date: 2022/7/6
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "checkResult")
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Api(value = "检验结果相关接口", tags = "检验结果相关接口", hidden = false)
 | 
			
		||||
public class CheckResultController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ApmsCheckResultServiceBiz apmsCheckResultServiceBiz;
 | 
			
		||||
 | 
			
		||||
    public R<ApmsCheckResult> checkResult(ApmsCheckRusultQueryParam apmsCheckRusultQueryParam){
 | 
			
		||||
        ApmsCheckResult apmsCheckResult = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>()
 | 
			
		||||
                .eq(ApmsCheckResult.SHEET_NO, apmsCheckRusultQueryParam.getSheetNo())
 | 
			
		||||
                .eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCheckRusultQueryParam.getIdenCardNum()));
 | 
			
		||||
        return successful(apmsCheckResult);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +1,23 @@
 | 
			
		||||
package com.mt.wms.empty.controller;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.mt.wms.basic.service.KilnInfoService;
 | 
			
		||||
import com.mt.wms.basic.vo.KilnInfoVo;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.dal.entity.AutoExeTask;
 | 
			
		||||
import com.mt.wms.core.dal.entity.CurrTask;
 | 
			
		||||
import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.utils.CodeGeneratorHelper;
 | 
			
		||||
import com.mt.wms.core.utils.HttpClient;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.ApmsCreateProcessSheet;
 | 
			
		||||
import com.mt.wms.empty.params.CreateItem;
 | 
			
		||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.params.TaskCreateParam;
 | 
			
		||||
import com.mt.wms.empty.params.*;
 | 
			
		||||
import com.mt.wms.empty.service.CurrTaskDetService;
 | 
			
		||||
import com.mt.wms.empty.service.CurrTaskService;
 | 
			
		||||
import com.mt.wms.empty.service.OrderInfoService;
 | 
			
		||||
@@ -24,6 +28,8 @@ import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
@@ -31,10 +37,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author xcc
 | 
			
		||||
@@ -56,6 +62,11 @@ public class CurrTaskController extends BaseController {
 | 
			
		||||
    private ApmsController apmsControl;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private KilnInfoService kilnInfoService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "createProcessTask")
 | 
			
		||||
    @ApiOperation(value = "订单加工-创建一个加工任务至任务队列")
 | 
			
		||||
@@ -124,6 +135,114 @@ public class CurrTaskController extends BaseController {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "createAutoTask")
 | 
			
		||||
    @ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
 | 
			
		||||
    public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
 | 
			
		||||
        List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
 | 
			
		||||
        //自动任务循环添加多条currTask
 | 
			
		||||
        AutoExeTask autoExeTask=new AutoExeTask();
 | 
			
		||||
        for (TaskCreateParam param:detParams
 | 
			
		||||
             ) {
 | 
			
		||||
            //验证标识卡号正确无误。
 | 
			
		||||
            orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
 | 
			
		||||
            //验证炉子编码信息在apms正确无误
 | 
			
		||||
            R<KilnInfoVo> kilnInfoVoR = kilnInfoService.get(IdParam.builder().id(param.getKilnId()).build());
 | 
			
		||||
            String kilnCode = kilnInfoVoR.getData().getCode();
 | 
			
		||||
            R<ApmsStoveVo> bm = apmsControl.getStoveCodeByWorkShopCode("BM");
 | 
			
		||||
            ArrayList<Map<String, String>> stoveCodes = bm.getData().getStoveCodes();
 | 
			
		||||
            //验证apms数据中存在这个炉子
 | 
			
		||||
            boolean verifyCodes = false;
 | 
			
		||||
            ArrayList<String> codeStr = new ArrayList<>();
 | 
			
		||||
            stoveCodes.forEach(kilnMap -> {
 | 
			
		||||
                codeStr.add(kilnMap.get("code"));
 | 
			
		||||
            });
 | 
			
		||||
            for (String s : codeStr)
 | 
			
		||||
            {
 | 
			
		||||
                if (s.equals(kilnCode))
 | 
			
		||||
                {
 | 
			
		||||
                    verifyCodes = true;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (!verifyCodes)
 | 
			
		||||
            {
 | 
			
		||||
                return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //通知apms创建一个生产单
 | 
			
		||||
            ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
 | 
			
		||||
            apmsCreateSheet.setWorkShopCode("BM");
 | 
			
		||||
            apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
 | 
			
		||||
            apmsCreateSheet.setTechCode(param.getCraftCode());
 | 
			
		||||
            //fixme 暂时没有正式user,使用测试账户
 | 
			
		||||
            apmsCreateSheet.setStartUser("QJJP03");
 | 
			
		||||
            ArrayList<CreateItem> createItems = new ArrayList<>();
 | 
			
		||||
            param.getDetParams().forEach(e -> {
 | 
			
		||||
                CreateItem createItem = new CreateItem();
 | 
			
		||||
                createItem.setItemCode(e.getIdenCardNum());
 | 
			
		||||
                createItem.setQuantity(e.getQuantity().intValue());
 | 
			
		||||
                createItem.setWeight(e.getWeight().doubleValue());
 | 
			
		||||
                createItems.add(createItem);
 | 
			
		||||
            });
 | 
			
		||||
            apmsCreateSheet.setStoveCode(kilnCode);
 | 
			
		||||
            apmsCreateSheet.setItems(createItems);
 | 
			
		||||
            R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
 | 
			
		||||
 | 
			
		||||
            if (processSheet.getData().getSuccess())
 | 
			
		||||
            {
 | 
			
		||||
                //apms创建成功后写入数据库
 | 
			
		||||
                R<IdVo> mainTask = currTaskService.createProcessTask(param);
 | 
			
		||||
                currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
 | 
			
		||||
                CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
 | 
			
		||||
                //工艺步骤中第一步
 | 
			
		||||
                if (param.getAutoTaskStep()==1){
 | 
			
		||||
                    autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
 | 
			
		||||
                    autoExeTask.setProcessFlowType(param.getAutoTaskType());
 | 
			
		||||
                    autoExeTask.setFTaskId(currTask.getId());
 | 
			
		||||
                    autoExeTask.setFDetTaskCode(currTask.getTaskCode());
 | 
			
		||||
                    autoExeTask.setFEquipmentId(currTask.getKilnId());
 | 
			
		||||
                    autoExeTask.setFEquipmentName(currTask.getKilnName());
 | 
			
		||||
                    autoExeTask.setFCraftCodeId(currTask.getCraftCodeId());
 | 
			
		||||
                    autoExeTask.setFPlcValue(currTask.getPlcValue());
 | 
			
		||||
                    setCommonField(autoExeTask);
 | 
			
		||||
                    autoExeTaskServiceBiz.save(autoExeTask);
 | 
			
		||||
                }
 | 
			
		||||
                if (param.getAutoTaskStep()==2){
 | 
			
		||||
                    autoExeTask.setTTaskId(currTask.getId());
 | 
			
		||||
                    autoExeTask.setTDetTaskCode(currTask.getTaskCode());
 | 
			
		||||
                    autoExeTask.setTEquipmentId(currTask.getKilnId());
 | 
			
		||||
                    autoExeTask.setTEquipmentName(currTask.getKilnName());
 | 
			
		||||
                    autoExeTask.setTCraftCodeId(currTask.getCraftCodeId());
 | 
			
		||||
                    autoExeTask.setTPlcValue(currTask.getPlcValue());
 | 
			
		||||
                    setUpdateCommonField(autoExeTask);
 | 
			
		||||
                    autoExeTaskServiceBiz.updateById(autoExeTask);
 | 
			
		||||
                }
 | 
			
		||||
                if (param.getAutoTaskStep()==3){
 | 
			
		||||
                    autoExeTask.setThTaskId(currTask.getId());
 | 
			
		||||
                    autoExeTask.setThDetTaskCode(currTask.getTaskCode());
 | 
			
		||||
                    autoExeTask.setThEquipmentId(currTask.getKilnId());
 | 
			
		||||
                    autoExeTask.setThEquipmentName(currTask.getKilnName());
 | 
			
		||||
                    autoExeTask.setThCraftCodeId(currTask.getCraftCodeId());
 | 
			
		||||
                    autoExeTask.setThPlcValue(currTask.getPlcValue());
 | 
			
		||||
                    setUpdateCommonField(autoExeTask);
 | 
			
		||||
                    autoExeTaskServiceBiz.updateById(autoExeTask);
 | 
			
		||||
                }
 | 
			
		||||
                String sheetNo = processSheet.getData().getSheetNo();
 | 
			
		||||
                //将返回的生产单号写入到主任务中。
 | 
			
		||||
                CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
 | 
			
		||||
                currTaskById.setSheetNo(sheetNo);
 | 
			
		||||
                currTaskService.updateCurrTaskById(currTaskById);
 | 
			
		||||
                //生成详细任务中的检验结果数据在apms推送生产单结果时创建
 | 
			
		||||
                //return successful("创建成功,任务添加至等待执行队列。");
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "mainCurrentTaskNow")
 | 
			
		||||
    @ApiOperation(value = "首页-获取当前执行中的任务")
 | 
			
		||||
@@ -148,4 +267,10 @@ public class CurrTaskController extends BaseController {
 | 
			
		||||
    public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
 | 
			
		||||
        return currTaskService.deleteBySheetNo(sheetNo);
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping(value = "runTask")
 | 
			
		||||
    @ApiOperation(value = "执行任务")
 | 
			
		||||
    public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
 | 
			
		||||
        //点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时)
 | 
			
		||||
        return currTaskService.runTask(param.getId());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,99 +0,0 @@
 | 
			
		||||
package com.mt.wms.empty.controller;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.dal.entity.ParEleValue;
 | 
			
		||||
import com.mt.wms.core.dal.service.ParEleValueServiceBiz;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.ElectricQueryParam;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.validation.groups.Default;
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.LocalTime;
 | 
			
		||||
import java.time.temporal.ChronoUnit;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/16 11:20
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "electric")
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
 | 
			
		||||
public class ElectricController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ParEleValueServiceBiz parEleValueServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "eletric")
 | 
			
		||||
    @ApiOperation(value = "根据窑炉id获取电能消耗情况")
 | 
			
		||||
    private R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
 | 
			
		||||
        Long kiln = electricQueryParam.getKilnId();
 | 
			
		||||
        //窑炉id为0代表全部
 | 
			
		||||
        if (kiln==0){
 | 
			
		||||
 | 
			
		||||
        }else {
 | 
			
		||||
            JSONObject jsonObject=new JSONObject();
 | 
			
		||||
            //指定时间节点
 | 
			
		||||
            LocalDate timeDate = electricQueryParam.getTime().toLocalDate();
 | 
			
		||||
            LocalDateTime timeStart = LocalDateTime.of(timeDate, LocalTime.MIN);
 | 
			
		||||
            LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX);
 | 
			
		||||
            //当前时间节点
 | 
			
		||||
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
 | 
			
		||||
            LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
 | 
			
		||||
 | 
			
		||||
            //总电能消耗
 | 
			
		||||
            List<ParEleValue> todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                    .eq("kiln_id", kiln)
 | 
			
		||||
                    .between("create_time", todayStart, todayEnd)
 | 
			
		||||
                    .orderByDesc("create_time"));
 | 
			
		||||
            Float countEleValue = todayEleValueList.get(0).getTotalBat();
 | 
			
		||||
            jsonObject.put("countEle",countEleValue);
 | 
			
		||||
 | 
			
		||||
            //昨日电能消耗
 | 
			
		||||
            LocalDateTime yesterdayStart = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MIN);
 | 
			
		||||
            LocalDateTime yesterdayEnd = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MAX);
 | 
			
		||||
            List<ParEleValue> yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                    .eq("kiln_id", kiln)
 | 
			
		||||
                    .between("create_time", yesterdayStart, yesterdayEnd)
 | 
			
		||||
                    .orderByAsc("create_time"));
 | 
			
		||||
            Float yesterdayTotalBat= yesterdayEleValueList.get(yesterdayEleValueList.size()-1).getTotalBat()-yesterdayEleValueList.get(0).getTotalBat();
 | 
			
		||||
            jsonObject.put("yesterdayCountEle",yesterdayTotalBat);
 | 
			
		||||
 | 
			
		||||
            //指定日期当天的电能消耗
 | 
			
		||||
            if (electricQueryParam.getDateType()==1){
 | 
			
		||||
                List<ParEleValue> dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                        .eq("kiln_id", kiln)
 | 
			
		||||
                        .between("create_time", timeStart, timeEnd)
 | 
			
		||||
                        .orderByAsc("create_time"));
 | 
			
		||||
                //总耗电量
 | 
			
		||||
                Float dateCountEle=0F;
 | 
			
		||||
                if (dateEleValueList.size()!=0){
 | 
			
		||||
                    dateCountEle= dateEleValueList.get(dateEleValueList.size()-1).getTotalBat()-dateEleValueList.get(0).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("dateCountEle",dateCountEle);
 | 
			
		||||
                //分时消耗量
 | 
			
		||||
                for (int i = 0; i < dateEleValueList.size() - 1; ++i) {
 | 
			
		||||
                    // TODO: 2021/12/16
 | 
			
		||||
                    float eleValue = dateEleValueList.get(i).getTotalBat() - dateEleValueList.get(i - 1).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,538 @@
 | 
			
		||||
package com.mt.wms.empty.controller;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
import com.mt.wms.core.base.BaseController;
 | 
			
		||||
import com.mt.wms.core.constants.CommonConstant;
 | 
			
		||||
import com.mt.wms.core.dal.entity.*;
 | 
			
		||||
import com.mt.wms.core.dal.service.*;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.ElectricQueryParam;
 | 
			
		||||
import com.mt.wms.empty.vo.ConsumeDataVo;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.PostConstruct;
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import javax.validation.groups.Default;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.DayOfWeek;
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.LocalTime;
 | 
			
		||||
import java.time.temporal.ChronoUnit;
 | 
			
		||||
import java.time.temporal.TemporalAdjusters;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/16 11:20
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "electric")
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
 | 
			
		||||
public class EnergyController extends BaseController {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //@PostConstruct
 | 
			
		||||
    public void test(){
 | 
			
		||||
        LocalDateTime time=LocalDateTime.of(2021, 3, 31, 0, 0, 0);
 | 
			
		||||
        Float f=29000F;
 | 
			
		||||
 | 
			
		||||
        LocalDate timeDate=time.toLocalDate();
 | 
			
		||||
        LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX).minus(5,ChronoUnit.SECONDS);
 | 
			
		||||
        for (int i = 0; i < 10; i++) {
 | 
			
		||||
 | 
			
		||||
            ParEleValue parEleValue=new ParEleValue();
 | 
			
		||||
            parEleValue.setDateType(2);
 | 
			
		||||
            parEleValue.setParId(1);
 | 
			
		||||
            parEleValue.setKilnId(1L);
 | 
			
		||||
            parEleValue.setTotalBat(Float.valueOf(String.valueOf(f+(Math.random()*24000))));
 | 
			
		||||
            parEleValue.setCreateTime(timeEnd);
 | 
			
		||||
            timeEnd=timeEnd.plus(1,ChronoUnit.MONTHS);
 | 
			
		||||
            f=parEleValue.getTotalBat();
 | 
			
		||||
            parEleValueServiceBiz.save(parEleValue);
 | 
			
		||||
            System.out.println(parEleValue);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ParEleValueServiceBiz parEleValueServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ParGasValueServiceBiz parGasValueServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ParTemValueServiceBiz parTemValueServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private KilnInfoServiceBiz kilnInfoServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private TaskHisServiceBiz taskHisServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "eletric")
 | 
			
		||||
    @ApiOperation(value = "根据窑炉id获取消耗情况")
 | 
			
		||||
    public R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
 | 
			
		||||
        Long kiln = electricQueryParam.getKilnId();
 | 
			
		||||
        //窑炉id为0代表全部,存储的时候计算全部
 | 
			
		||||
            JSONObject jsonObject=new JSONObject();
 | 
			
		||||
            //指定时间节点
 | 
			
		||||
            LocalDate timeDate = electricQueryParam.getTime().toLocalDate();
 | 
			
		||||
            LocalDateTime timeStart = LocalDateTime.of(timeDate, LocalTime.MIN);
 | 
			
		||||
            LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX);
 | 
			
		||||
            //当前时间节点
 | 
			
		||||
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
 | 
			
		||||
            LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
 | 
			
		||||
 | 
			
		||||
            //总电能消耗
 | 
			
		||||
            List<ParEleValue> todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                    .eq("kiln_id", kiln)
 | 
			
		||||
                    .between("create_time", todayStart, todayEnd)
 | 
			
		||||
                    .orderByDesc("create_time"));
 | 
			
		||||
            Float countEleValue = todayEleValueList.get(0).getTotalBat();
 | 
			
		||||
            jsonObject.put("countEle",countEleValue);
 | 
			
		||||
 | 
			
		||||
            //昨日电能消耗
 | 
			
		||||
            LocalDateTime yesterdayStart = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MIN);
 | 
			
		||||
            LocalDateTime yesterdayEnd = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MAX);
 | 
			
		||||
            List<ParEleValue> yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                    .eq("kiln_id", kiln)
 | 
			
		||||
                    .between("create_time", yesterdayStart, yesterdayEnd)
 | 
			
		||||
                    .eq("date_type",0)
 | 
			
		||||
                    .orderByAsc("create_time"));
 | 
			
		||||
            Float yesterdayTotalBat= yesterdayEleValueList.get(yesterdayEleValueList.size()-1).getTotalBat()-yesterdayEleValueList.get(0).getTotalBat();
 | 
			
		||||
            jsonObject.put("yesterdayCountEle",yesterdayTotalBat);
 | 
			
		||||
 | 
			
		||||
            //指定日期当天的电能消耗
 | 
			
		||||
            if (electricQueryParam.getDateType()==0){
 | 
			
		||||
                List<ParEleValue> dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                        .eq("kiln_id", kiln)
 | 
			
		||||
                        .between("create_time", timeStart, timeEnd)
 | 
			
		||||
                        .orderByAsc("create_time"));
 | 
			
		||||
                //总耗电量
 | 
			
		||||
                Float dateCountEle=0F;
 | 
			
		||||
                if (dateEleValueList.size()!=0){
 | 
			
		||||
                    dateCountEle= dateEleValueList.get(dateEleValueList.size()-1).getTotalBat()-dateEleValueList.get(0).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("dateCountEle",dateCountEle);
 | 
			
		||||
                //分时消耗量
 | 
			
		||||
                Map<String,Float> timeJsonObject=new LinkedHashMap();
 | 
			
		||||
                for (int i = 0; i < dateEleValueList.size() - 1; ++i) {
 | 
			
		||||
                    // TODO: 2021/12/16
 | 
			
		||||
                    float eleValue = dateEleValueList.get(i).getTotalBat() - dateEleValueList.get(i - 1).getTotalBat();
 | 
			
		||||
                    int j=i+1;
 | 
			
		||||
                    if (j%2==0){
 | 
			
		||||
                        String time=(j-1)/2+":30";
 | 
			
		||||
                        timeJsonObject.put(time,eleValue);
 | 
			
		||||
                    }else {
 | 
			
		||||
                        String time=(j-1)/2+":00";
 | 
			
		||||
                        timeJsonObject.put(time,eleValue);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("timeEle",timeJsonObject);
 | 
			
		||||
            }
 | 
			
		||||
            //指定日期当周的每天电能消耗
 | 
			
		||||
            if(electricQueryParam.getDateType()==1){
 | 
			
		||||
                LocalDate monday = timeDate.with(DayOfWeek.MONDAY);
 | 
			
		||||
                LocalDate sunday = timeDate.with(DayOfWeek.SUNDAY);
 | 
			
		||||
                List<ParEleValue> timeWeekEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                        .eq("kiln_id", kiln)
 | 
			
		||||
                        .between("create_time", monday, sunday.plusDays(1))
 | 
			
		||||
                        .eq("date_type", 1)
 | 
			
		||||
                        .orderByAsc("create_time"));
 | 
			
		||||
                //总耗电量
 | 
			
		||||
                Float dateCountEle=0F;
 | 
			
		||||
                if (timeWeekEleValueList.size()!=0){
 | 
			
		||||
                    dateCountEle= timeWeekEleValueList.get(timeWeekEleValueList.size()-1).getTotalBat()-timeWeekEleValueList.get(0).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("dateCountEle",dateCountEle);
 | 
			
		||||
                Map<String,Float> timeJsonObject=new LinkedHashMap();
 | 
			
		||||
                for (ParEleValue parEleValue:timeWeekEleValueList
 | 
			
		||||
                     ) {
 | 
			
		||||
                    LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
 | 
			
		||||
                    timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("timeEle",timeJsonObject);
 | 
			
		||||
            }
 | 
			
		||||
            //指定日期当月的每天电能消耗
 | 
			
		||||
            if(electricQueryParam.getDateType()==2){
 | 
			
		||||
                LocalDate firstday = LocalDate.of(timeDate.getYear(), timeDate.getMonthValue(), 1);
 | 
			
		||||
                LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfMonth());
 | 
			
		||||
                List<ParEleValue> timeMonthEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                        .eq("kiln_id", kiln)
 | 
			
		||||
                        .between("create_time", firstday, lastDay.plusDays(1))
 | 
			
		||||
                        .eq("date_type", 1)
 | 
			
		||||
                        .orderByAsc("create_time"));
 | 
			
		||||
                //总耗电量
 | 
			
		||||
                Float dateCountEle=0F;
 | 
			
		||||
                if (timeMonthEleValueList.size()!=0){
 | 
			
		||||
                    dateCountEle= timeMonthEleValueList.get(timeMonthEleValueList.size()-1).getTotalBat()-timeMonthEleValueList.get(0).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("dateCountEle",dateCountEle);
 | 
			
		||||
                Map<String,Float> timeJsonObject=new LinkedHashMap();
 | 
			
		||||
                for (ParEleValue parEleValue:timeMonthEleValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
 | 
			
		||||
                    timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("timeEle",timeJsonObject);
 | 
			
		||||
            }
 | 
			
		||||
            //指定日期当年的每月电能消耗
 | 
			
		||||
            if(electricQueryParam.getDateType()==2){
 | 
			
		||||
                LocalDate firstDay = timeDate.with(TemporalAdjusters.firstDayOfYear());
 | 
			
		||||
                LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfYear());
 | 
			
		||||
                List<ParEleValue> timeYearEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                        .eq("kiln_id", kiln)
 | 
			
		||||
                        .between("create_time", firstDay, lastDay.plusDays(1))
 | 
			
		||||
                        .eq("date_type", 2)
 | 
			
		||||
                        .orderByAsc("create_time"));
 | 
			
		||||
                //总耗电量
 | 
			
		||||
                Float dateCountEle=0F;
 | 
			
		||||
                if (timeYearEleValueList.size()!=0){
 | 
			
		||||
                    dateCountEle= timeYearEleValueList.get(timeYearEleValueList.size()-1).getTotalBat()-timeYearEleValueList.get(0).getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("dateCountEle",dateCountEle);
 | 
			
		||||
                Map<String,Float> timeJsonObject=new LinkedHashMap();
 | 
			
		||||
                for (ParEleValue parEleValue:timeYearEleValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
 | 
			
		||||
                    timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
 | 
			
		||||
                }
 | 
			
		||||
                jsonObject.put("timeEle",timeJsonObject);
 | 
			
		||||
            }
 | 
			
		||||
        return successful(jsonObject.toJSONString());
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping(value = "energyList")
 | 
			
		||||
    @ApiOperation(value = "根据加工炉id获取能源消耗情况")
 | 
			
		||||
    public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){
 | 
			
		||||
        TaskHis currTask = taskHisServiceBiz.getById(electricQueryParam.getTaskId());
 | 
			
		||||
        Long kilnId = currTask.getKilnId();
 | 
			
		||||
        KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
 | 
			
		||||
        Integer kilnType = kilnInfo.getType();
 | 
			
		||||
        //传入任务号,窑炉号,查询消耗数据,返回json字符串
 | 
			
		||||
        JSONObject jsonObject=new JSONObject();
 | 
			
		||||
        ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build();
 | 
			
		||||
 | 
			
		||||
        Map<String,Object> map=new HashMap<>();
 | 
			
		||||
        //电能消耗
 | 
			
		||||
        List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
 | 
			
		||||
                .eq(ParEleValue.KILN_ID, kilnId)
 | 
			
		||||
                .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
 | 
			
		||||
        if (parEleValueList.size()>0){
 | 
			
		||||
            List<Object> eleList=new ArrayList<>();
 | 
			
		||||
            //电能消耗
 | 
			
		||||
            List<Object> eleConsume=new ArrayList<>();
 | 
			
		||||
            //A向电压
 | 
			
		||||
            List<Object> aVolConsume=new ArrayList<>();
 | 
			
		||||
            //B向电压
 | 
			
		||||
            List<Object> bVolConsume=new ArrayList<>();
 | 
			
		||||
            //C向电压
 | 
			
		||||
            List<Object> cVolConsume=new ArrayList<>();
 | 
			
		||||
            Float talBat=0F;
 | 
			
		||||
            int i=0;
 | 
			
		||||
            for (ParEleValue parEleValue:parEleValueList
 | 
			
		||||
                 ) {
 | 
			
		||||
                //首位置为0
 | 
			
		||||
                if (i==0){
 | 
			
		||||
                    talBat=parEleValue.getTotalBat();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                i++;
 | 
			
		||||
                map.put("time",parEleValue.getCreateTime());
 | 
			
		||||
                map.put("value",floatSubtract(parEleValue.getTotalBat(),talBat));
 | 
			
		||||
                map.put("name","耗电量");
 | 
			
		||||
                map.put("unit","KW");
 | 
			
		||||
                eleConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                map.clear();
 | 
			
		||||
                map.put("time",parEleValue.getCreateTime());
 | 
			
		||||
                map.put("value",parEleValue.getAVoltagevValue());
 | 
			
		||||
                map.put("name","A向电压");
 | 
			
		||||
                map.put("unit","V");
 | 
			
		||||
                aVolConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                map.clear();
 | 
			
		||||
                map.put("time",parEleValue.getCreateTime());
 | 
			
		||||
                map.put("value",parEleValue.getBVoltagevValue());
 | 
			
		||||
                map.put("name","B向电压");
 | 
			
		||||
                map.put("unit","V");
 | 
			
		||||
                bVolConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                map.clear();
 | 
			
		||||
                map.put("time",parEleValue.getCreateTime());
 | 
			
		||||
                map.put("value",parEleValue.getCVoltagevValue());
 | 
			
		||||
                map.put("name","C向电压");
 | 
			
		||||
                map.put("unit","V");
 | 
			
		||||
                cVolConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                map.clear();
 | 
			
		||||
            }
 | 
			
		||||
            eleList.add(eleConsume);
 | 
			
		||||
            eleList.add(aVolConsume);
 | 
			
		||||
            eleList.add(bVolConsume);
 | 
			
		||||
            eleList.add(cVolConsume);
 | 
			
		||||
            jsonObject.put("ele",eleList);
 | 
			
		||||
        }
 | 
			
		||||
        //氮气、甲醇、丙烷、氨气消耗量
 | 
			
		||||
        List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
 | 
			
		||||
                .eq(ParEleValue.KILN_ID, kilnId)
 | 
			
		||||
                .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
 | 
			
		||||
        if (parGasValueList.size()>0){
 | 
			
		||||
            if (kilnType==1){
 | 
			
		||||
                List<Object> gasList=new ArrayList<>();
 | 
			
		||||
                //氮气
 | 
			
		||||
                List<Object> nitConsume=new ArrayList<>();
 | 
			
		||||
                Float nit=0F;
 | 
			
		||||
                //甲醇
 | 
			
		||||
                List<Object> metConsume=new ArrayList<>();
 | 
			
		||||
                Float met=0F;
 | 
			
		||||
                //丙烷
 | 
			
		||||
                List<Object> propaneConsume=new ArrayList<>();
 | 
			
		||||
                Float propane=0F;
 | 
			
		||||
                //氨气
 | 
			
		||||
                List<Object> ammoniaConsume=new ArrayList<>();
 | 
			
		||||
                Float ammonia=0F;
 | 
			
		||||
                int i=0;
 | 
			
		||||
                for (ParGasValue parGasValue:parGasValueList
 | 
			
		||||
                     ) {
 | 
			
		||||
                    //累计值的量首位置为0
 | 
			
		||||
                    if (i==0){
 | 
			
		||||
                        nit=parGasValue.getNitFlowValue();
 | 
			
		||||
                        met=parGasValue.getMethanolFlow();
 | 
			
		||||
                        propane=parGasValue.getPropaneFlow();
 | 
			
		||||
                        ammonia=parGasValue.getAmmoniaFlowValue();
 | 
			
		||||
                    }
 | 
			
		||||
                    i++;
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit));
 | 
			
		||||
                    map.put("name","氮气");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    nitConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getMethanolFlow(),met));
 | 
			
		||||
                    map.put("name","甲醇");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    metConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getPropaneFlow(),propane));
 | 
			
		||||
                    map.put("name","丙烷");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    propaneConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getAmmoniaFlowValue(),ammonia));
 | 
			
		||||
                    map.put("name","氨气");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    ammoniaConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                gasList.add(nitConsume);
 | 
			
		||||
                gasList.add(metConsume);
 | 
			
		||||
                gasList.add(propaneConsume);
 | 
			
		||||
                gasList.add(ammoniaConsume);
 | 
			
		||||
                jsonObject.put("gas",gasList);
 | 
			
		||||
            }
 | 
			
		||||
            if (kilnType==3){
 | 
			
		||||
                List<Object> gasList=new ArrayList<>();
 | 
			
		||||
                //氮气
 | 
			
		||||
                List<Object> nitConsume=new ArrayList<>();
 | 
			
		||||
                Float nit=0F;
 | 
			
		||||
                //二氧化碳
 | 
			
		||||
                List<Object> carbonConsume=new ArrayList<>();
 | 
			
		||||
                Float carbon=0F;
 | 
			
		||||
                //氨气
 | 
			
		||||
                List<Object> ammoniaConsume=new ArrayList<>();
 | 
			
		||||
                Float ammonia=0F;
 | 
			
		||||
                int i=0;
 | 
			
		||||
                for (ParGasValue parGasValue:parGasValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    //累计值的量首位置为0
 | 
			
		||||
                    if (i==0){
 | 
			
		||||
                        nit=parGasValue.getNitFlowValue();
 | 
			
		||||
                        carbon=parGasValue.getCarDioxideFlowValue();
 | 
			
		||||
                        ammonia=parGasValue.getAmmoniaFlowValue();
 | 
			
		||||
                    }
 | 
			
		||||
                    i++;
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit));
 | 
			
		||||
                    map.put("name","氮气");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    nitConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getCarDioxideFlowValue(),carbon));
 | 
			
		||||
                    map.put("name","二氧化碳");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    carbonConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parGasValue.getCreateTime());
 | 
			
		||||
                    map.put("value",floatSubtract(parGasValue.getAmmoniaFlowValue(),ammonia));
 | 
			
		||||
                    map.put("name","氨气");
 | 
			
		||||
                    map.put("unit","m³");
 | 
			
		||||
                    ammoniaConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                gasList.add(nitConsume);
 | 
			
		||||
                gasList.add(carbonConsume);
 | 
			
		||||
                gasList.add(ammoniaConsume);
 | 
			
		||||
                jsonObject.put("gas",gasList);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //油搅拌转速趋势
 | 
			
		||||
        List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
 | 
			
		||||
                .eq(ParEleValue.KILN_ID, kilnId)
 | 
			
		||||
                .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
 | 
			
		||||
        if (parRotSpeedValueList.size()>0){
 | 
			
		||||
            if (kilnType==1){
 | 
			
		||||
                List<Object> rotList=new ArrayList<>();
 | 
			
		||||
                List<Object> rot1Consume=new ArrayList<>();
 | 
			
		||||
                List<Object> rot2Consume=new ArrayList<>();
 | 
			
		||||
                for (ParRotSpeedValue parRotSpeedValue:parRotSpeedValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    map.put("time",parRotSpeedValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parRotSpeedValue.getOilStiSpeedAValue());
 | 
			
		||||
                    map.put("name","1号油搅拌转速");
 | 
			
		||||
                    map.put("unit","转/min");
 | 
			
		||||
                    rot1Consume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parRotSpeedValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parRotSpeedValue.getOilStiSpeedBValue());
 | 
			
		||||
                    map.put("name","2号油搅拌转速");
 | 
			
		||||
                    map.put("unit","转/min");
 | 
			
		||||
                    rot2Consume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                rotList.add(rot1Consume);
 | 
			
		||||
                rotList.add(rot2Consume);
 | 
			
		||||
                jsonObject.put("rot",rotList);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //温度趋势(实际温度、设定温度)
 | 
			
		||||
        List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
 | 
			
		||||
                .eq(ParEleValue.KILN_ID, kilnId)
 | 
			
		||||
                .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
 | 
			
		||||
        if (parTemValueList.size()>0){
 | 
			
		||||
            if (kilnType==1){
 | 
			
		||||
                List<Object> tempList=new ArrayList<>();
 | 
			
		||||
                List<Object> actualTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> setupTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> actualOilTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> setupOilTempConsume=new ArrayList<>();
 | 
			
		||||
                for (ParTemValue parTemValue:parTemValueList
 | 
			
		||||
                     ) {
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getActTemValue());
 | 
			
		||||
                    map.put("name","实际温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    actualTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getSetTemValue());
 | 
			
		||||
                    map.put("name","设定温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    setupTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getOilTankActTemValue());
 | 
			
		||||
                    map.put("name","油槽实际温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    actualOilTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getOilTankSetTemValue());
 | 
			
		||||
                    map.put("name","油槽设定温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    setupOilTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                tempList.add(actualTempConsume);
 | 
			
		||||
                tempList.add(setupTempConsume);
 | 
			
		||||
                tempList.add(actualOilTempConsume);
 | 
			
		||||
                tempList.add(setupOilTempConsume);
 | 
			
		||||
                jsonObject.put("temp",tempList);
 | 
			
		||||
            }
 | 
			
		||||
            if (kilnType==2){
 | 
			
		||||
                List<Object> tempList=new ArrayList<>();
 | 
			
		||||
                List<Object> actualTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> setupTempConsume=new ArrayList<>();
 | 
			
		||||
                for (ParTemValue parTemValue:parTemValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getActTemValue());
 | 
			
		||||
                    map.put("name","实际温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    actualTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getSetTemValue());
 | 
			
		||||
                    map.put("name","设定温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    setupTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                tempList.add(actualTempConsume);
 | 
			
		||||
                tempList.add(setupTempConsume);
 | 
			
		||||
                jsonObject.put("temp",tempList);
 | 
			
		||||
            }
 | 
			
		||||
            if (kilnType==3){
 | 
			
		||||
 | 
			
		||||
                List<Object> tempList=new ArrayList<>();
 | 
			
		||||
                List<Object> actualTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> setupTempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> outerZone1TempConsume=new ArrayList<>();
 | 
			
		||||
                List<Object> outerZone2TempConsume=new ArrayList<>();
 | 
			
		||||
                for (ParTemValue parTemValue:parTemValueList
 | 
			
		||||
                ) {
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getActTemValue());
 | 
			
		||||
                    map.put("name","实际温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    actualTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getSetTemValue());
 | 
			
		||||
                    map.put("name","设定温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    setupTempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
                    map.put("value",parTemValue.getOuterZone1Temp());
 | 
			
		||||
                    map.put("name","外一区温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    outerZone1TempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                    map.put("time",parTemValue.getCreateTime());
 | 
			
		||||
 | 
			
		||||
                    map.put("value",parTemValue.getOuterZone2Temp());
 | 
			
		||||
                    map.put("name","外二区温度");
 | 
			
		||||
                    map.put("unit","℃");
 | 
			
		||||
                    outerZone2TempConsume.add(JSONObject.toJSON(map));
 | 
			
		||||
                    map.clear();
 | 
			
		||||
                }
 | 
			
		||||
                tempList.add(actualTempConsume);
 | 
			
		||||
                tempList.add(setupTempConsume);
 | 
			
		||||
                tempList.add(outerZone1TempConsume);
 | 
			
		||||
                tempList.add(outerZone2TempConsume);
 | 
			
		||||
                jsonObject.put("temp",tempList);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return R.ok(jsonObject.toJSONString());
 | 
			
		||||
    }
 | 
			
		||||
    private Float floatSubtract(Float a,Float b){
 | 
			
		||||
        BigDecimal a1 = new BigDecimal(Float.toString(a));
 | 
			
		||||
        BigDecimal b1 = new BigDecimal(Float.toString(b));
 | 
			
		||||
        return a1.subtract(b1).floatValue();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import javax.validation.groups.Default;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -51,7 +52,7 @@ public class OutStockController  extends BaseController {
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping(value = "runOutTask")
 | 
			
		||||
    @ApiOperation(value = "执行出库操作")
 | 
			
		||||
    private R<String> runOutTask(@Validated({PageGroup.class, Default.class}) @RequestBody OutStockParam outStockParam) {
 | 
			
		||||
    private R<String> runOutTask(@Validated({PageGroup.class, Default.class}) @RequestBody OutStockParam outStockParam) throws IOException {
 | 
			
		||||
        return outStockService.outTask(outStockParam);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,9 +24,9 @@ public class AlarmInfoQueryParam extends BasePageParam {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "设备ID", required = false)
 | 
			
		||||
    private Long equipmentID;
 | 
			
		||||
    private Long equipmentId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "报警类型", required = true)
 | 
			
		||||
    @ApiModelProperty(value = "报警类型0窑炉,1表示车辆", required = true)
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "开始时间", required = false)
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
package com.mt.wms.empty.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: LGH
 | 
			
		||||
 * @Date: 2022/7/6
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "检验结果查询参数", description = "检验结果查询参数")
 | 
			
		||||
public class ApmsCheckRusultQueryParam extends BasePageParam {
 | 
			
		||||
    @ApiModelProperty(value = "生产单号", required = true)
 | 
			
		||||
    private String sheetNo;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "标识卡号", required = true)
 | 
			
		||||
    private String idenCardNum;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
package com.mt.wms.empty.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/2/27 22:18
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "自动currTask参数", description = "自动currTask参数")
 | 
			
		||||
public class AutoCurrTaskParam extends BaseParam {
 | 
			
		||||
    @ApiModelProperty(value = "详细信息", required = true)
 | 
			
		||||
    private List<TaskCreateParam> taskCreateParamList;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
package com.mt.wms.empty.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 23:09
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "自动任务参数", description = "自动任务参数")
 | 
			
		||||
public class AutoTaskParam extends BaseParam {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "autoTaskId", required = true)
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
package com.mt.wms.empty.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseParam;
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 23:09
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "自动任务查询参数", description = "自动任务查询参数")
 | 
			
		||||
public class AutoTaskQueryParam extends BasePageParam {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "autoTaskId", required = true)
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "任务状态:执行中、未执行", required = true)
 | 
			
		||||
    private Integer status;
 | 
			
		||||
}
 | 
			
		||||
@@ -22,13 +22,16 @@ public class ElectricQueryParam extends BaseParam {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "窑炉id", required = true)
 | 
			
		||||
    @ApiModelProperty(value = "窑炉id", required = false)
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "任务id", required = true)
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "时间节点", required = true)
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "时间节点", required = false)
 | 
			
		||||
    private LocalDateTime time;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "时间类型:1 天,2 周,3 月,4 年", required = true)
 | 
			
		||||
    @ApiModelProperty(value = "时间类型:1 天,2 周,3 月,4 年", required = false)
 | 
			
		||||
    private Integer dateType;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ public class OutStockParam extends BaseParam {
 | 
			
		||||
    /**
 | 
			
		||||
     * 提升台
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "提升台",required = true, example = "1")
 | 
			
		||||
    @NotNull(message = "提升台不能为空")
 | 
			
		||||
    private Integer code;
 | 
			
		||||
    @ApiModelProperty(value = "液压台code",required = true, example = "1")
 | 
			
		||||
    @NotNull(message = "液压台code不能为空")
 | 
			
		||||
    private String code;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
package com.mt.wms.empty.params;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.base.BaseParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/2/27 22:23
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel(value = "工艺步骤参数", description = "工艺步骤参数")
 | 
			
		||||
public class StepInfoParam  extends BaseParam {
 | 
			
		||||
    @ApiModelProperty(value = "窑炉id", required = true)
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "工艺号id", required = true)
 | 
			
		||||
    private Long craftId;
 | 
			
		||||
}
 | 
			
		||||
@@ -24,8 +24,12 @@ public class TaskCreateParam extends BaseParam {
 | 
			
		||||
 | 
			
		||||
//    @ApiModelProperty(value = "托盘号")
 | 
			
		||||
//    private String palletCode;
 | 
			
		||||
@ApiModelProperty(value = "起点(提升平台)", required = true)
 | 
			
		||||
private String startPosition;
 | 
			
		||||
    @ApiModelProperty(value = "自动任务类型", required = true)
 | 
			
		||||
    private Integer autoTaskType;
 | 
			
		||||
    @ApiModelProperty(value = "自动任务步骤标识", required = true)
 | 
			
		||||
    private Integer autoTaskStep;
 | 
			
		||||
    @ApiModelProperty(value = "起点(提升平台)", required = true)
 | 
			
		||||
    private String startPosition;
 | 
			
		||||
    @ApiModelProperty(value = "终点位置", required = true)
 | 
			
		||||
    private String targetPosition;
 | 
			
		||||
    @ApiModelProperty(value = "加工类型:0 初始加工,1 复加工", required = true)
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,51 @@
 | 
			
		||||
package com.mt.wms.empty.service;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.AutoTaskParam;
 | 
			
		||||
import com.mt.wms.empty.params.AutoTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.vo.AutoTaskVo;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 23:14
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
public interface AutoTaskService {
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx
 | 
			
		||||
     *
 | 
			
		||||
     * @param idParam 主键参数
 | 
			
		||||
     * @return xx
 | 
			
		||||
     */
 | 
			
		||||
    R<AutoTaskVo> get(IdParam idParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param autoTaskQueryParam xx查询参数
 | 
			
		||||
     * @return xx列表
 | 
			
		||||
     */
 | 
			
		||||
    R<List<AutoTaskVo>> list(AutoTaskQueryParam autoTaskQueryParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取xx分页列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param autoTaskQueryParam xx查询参数
 | 
			
		||||
     * @return xx分页列表
 | 
			
		||||
     */
 | 
			
		||||
    R<PageVo<AutoTaskVo>> page(AutoTaskQueryParam autoTaskQueryParam);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 终止自动任务
 | 
			
		||||
     *
 | 
			
		||||
     * @param idParam xx参数
 | 
			
		||||
     * @return 主键
 | 
			
		||||
     */
 | 
			
		||||
    R<IdVo> stop(IdParam idParam);
 | 
			
		||||
}
 | 
			
		||||
@@ -6,12 +6,15 @@ import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.AutoCurrTaskParam;
 | 
			
		||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.params.TaskCreateParam;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskVo;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 拆分任务相关服务
 | 
			
		||||
 *
 | 
			
		||||
@@ -82,4 +85,11 @@ public interface CurrTaskService {
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    R<PageVo<CurrTaskMainQueryVo>> currentTaskMainPage(BasePageParam param);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 执行任务
 | 
			
		||||
     */
 | 
			
		||||
    R<String> runTask(Long taskId) throws InterruptedException, IOException;
 | 
			
		||||
 | 
			
		||||
    R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,8 @@ import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.OutStockParam;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/17 8:53
 | 
			
		||||
@@ -15,5 +17,5 @@ public interface OutStockService {
 | 
			
		||||
     *
 | 
			
		||||
     * @param outStockParam xx查询参数
 | 
			
		||||
     */
 | 
			
		||||
    R<String> outTask(OutStockParam outStockParam);
 | 
			
		||||
    R<String> outTask(OutStockParam outStockParam) throws IOException;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ public class AlarmInfoServiceImpl extends BaseService implements AlarmInfoServic
 | 
			
		||||
        QueryWrapper<AlarmInfo> wrapper = new QueryWrapper<>();
 | 
			
		||||
        wrapper.between(alarmInfoQueryParam.getStartTime() != null, AlarmInfo.CREATE_TIME, alarmInfoQueryParam.getStartTime(), alarmInfoQueryParam.getEndTime())
 | 
			
		||||
                .eq(AlarmInfo.TYPE, alarmInfoQueryParam.getType())
 | 
			
		||||
                .eq(alarmInfoQueryParam.getEquipmentID() != null, AlarmInfo.EQUIPMENT_ID, alarmInfoQueryParam.getEquipmentID())
 | 
			
		||||
                .eq(alarmInfoQueryParam.getEquipmentId() != null, AlarmInfo.EQUIPMENT_ID, alarmInfoQueryParam.getEquipmentId())
 | 
			
		||||
                .orderByDesc(AlarmInfo.CREATE_TIME);
 | 
			
		||||
        Page<AlarmInfo> page = alarmInfoServiceBiz.page(new Page<>(alarmInfoQueryParam.getCurrent(), alarmInfoQueryParam.getSize()), wrapper);
 | 
			
		||||
        return successful(new PageVo<>(page, AlarmInfoVo.class));
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,103 @@
 | 
			
		||||
package com.mt.wms.empty.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.mt.wms.core.api.Assert;
 | 
			
		||||
import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.AutoExeTask;
 | 
			
		||||
import com.mt.wms.core.dal.entity.AutoExeTaskHis;
 | 
			
		||||
import com.mt.wms.core.dal.entity.CurrTask;
 | 
			
		||||
import com.mt.wms.core.dal.service.AutoExeTaskHisServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.errorcode.ApiErrorCode;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.controller.ApmsController;
 | 
			
		||||
import com.mt.wms.empty.params.AutoTaskParam;
 | 
			
		||||
import com.mt.wms.empty.params.AutoTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.service.AutoTaskService;
 | 
			
		||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
 | 
			
		||||
import com.mt.wms.empty.vo.AutoTaskVo;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 23:18
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
@Transactional
 | 
			
		||||
public class AutoTaskServiceImpl extends BaseService implements AutoTaskService {
 | 
			
		||||
 | 
			
		||||
    private final static Logger logger = LoggerFactory.getLogger(AutoTaskServiceImpl.class);
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AutoExeTaskHisServiceBiz autoExeTaskHisServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ApmsController apmsController;
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<AutoTaskVo> get(IdParam idParam) {
 | 
			
		||||
        Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
 | 
			
		||||
        AutoExeTask autoExeTask=autoExeTaskServiceBiz.getById(idParam.getId());
 | 
			
		||||
        AutoTaskVo autoTaskVo=AutoTaskVo.builder().build();
 | 
			
		||||
        org.springframework.beans.BeanUtils.copyProperties(autoExeTask,autoTaskVo);
 | 
			
		||||
        return successful(autoTaskVo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<AutoTaskVo>> list(AutoTaskQueryParam autoTaskQueryParam) {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<PageVo<AutoTaskVo>> page(AutoTaskQueryParam autoTaskQueryParam) {
 | 
			
		||||
        QueryWrapper<AutoExeTask> wrapper=new QueryWrapper<>();
 | 
			
		||||
        wrapper.eq((autoTaskQueryParam.getStatus()!=null&&("").equals(autoTaskQueryParam.getStatus())),AutoExeTask.STATUS,autoTaskQueryParam.getStatus());
 | 
			
		||||
        wrapper.in(AutoExeTask.STATUS,0,1);
 | 
			
		||||
        Page<AutoExeTask> page = autoExeTaskServiceBiz.page(new Page<>(autoTaskQueryParam.getCurrent(), autoTaskQueryParam.getSize()), wrapper);
 | 
			
		||||
        return successful(new PageVo<>(page,AutoTaskVo.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<IdVo> stop(IdParam idParam) {
 | 
			
		||||
 | 
			
		||||
        AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(idParam.getId());
 | 
			
		||||
        //状态置为终止
 | 
			
		||||
        autoExeTask.setStatus(3);
 | 
			
		||||
        autoExeTaskServiceBiz.updateById(autoExeTask);
 | 
			
		||||
        //记录到自动任务历史表
 | 
			
		||||
        AutoExeTaskHis autoExeTaskHis=new AutoExeTaskHis();
 | 
			
		||||
        BeanUtils.copyProperties(autoExeTask,autoExeTaskHis);
 | 
			
		||||
        autoExeTaskHisServiceBiz.save(autoExeTaskHis);
 | 
			
		||||
        //释放后续步骤
 | 
			
		||||
        // TODO: 2022/3/3
 | 
			
		||||
            //删除对应的几条currtask(未执行的),通知apms生产单作废
 | 
			
		||||
            List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
 | 
			
		||||
                    .eq(CurrTask.AUTO_EXE_TASK_ID, autoExeTask.getId()).eq(CurrTask.STATUS,0));
 | 
			
		||||
            for (CurrTask currTask:currTaskList
 | 
			
		||||
                 ) {
 | 
			
		||||
                R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.deleteBySheetNo(currTask.getSheetNo());
 | 
			
		||||
                if (!apmsEndProcessVoR.getData().getSuccess()){
 | 
			
		||||
                    logger.info("Apms作废生产单接口错误");
 | 
			
		||||
                    return R.failed("Apms作废生产单接口错误");
 | 
			
		||||
                }
 | 
			
		||||
                currTaskServiceBiz.removeById(currTask);
 | 
			
		||||
            }
 | 
			
		||||
        autoExeTaskServiceBiz.removeById(autoExeTask);
 | 
			
		||||
        return successful(IdVo.builder().id(idParam.getId()).build());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,38 +1,41 @@
 | 
			
		||||
package com.mt.wms.empty.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.mt.wms.core.api.Assert;
 | 
			
		||||
import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.*;
 | 
			
		||||
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.*;
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.utils.HttpClient;
 | 
			
		||||
import com.mt.wms.core.utils.IDGenerator;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.controller.ApmsController;
 | 
			
		||||
import com.mt.wms.empty.enums.TaskTypeEnum;
 | 
			
		||||
import com.mt.wms.empty.params.AutoCurrTaskParam;
 | 
			
		||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.params.TaskCreateParam;
 | 
			
		||||
import com.mt.wms.empty.service.CurrTaskDetService;
 | 
			
		||||
import com.mt.wms.empty.service.CurrTaskService;
 | 
			
		||||
import com.mt.wms.empty.service.TaskDetHisService;
 | 
			
		||||
import com.mt.wms.empty.service.TaskHisService;
 | 
			
		||||
import com.mt.wms.empty.service.*;
 | 
			
		||||
import com.mt.wms.empty.task.RunTaskUtils;
 | 
			
		||||
import com.mt.wms.empty.task.TaskDistanceUtils;
 | 
			
		||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskVo;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 服务实现类
 | 
			
		||||
@@ -45,6 +48,7 @@ import java.util.List;
 | 
			
		||||
@Transactional
 | 
			
		||||
public class CurrTaskServiceImpl extends BaseService implements CurrTaskService {
 | 
			
		||||
 | 
			
		||||
    private Logger logger = LoggerFactory.getLogger(getClass());
 | 
			
		||||
    @Autowired
 | 
			
		||||
    CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
 | 
			
		||||
@@ -64,6 +68,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
 | 
			
		||||
    OrderInfoServiceBiz orderInfoServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    CraftInfoServiceBiz craftInfoServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    VehicleInfoServiceBiz vehicleInfoServiceBiz;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    TaskDistanceUtils taskDistanceUtils;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    RunTaskUtils runTaskUtils;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    AutoExeTaskServiceBiz autoExeTaskServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public CurrTaskVo getCurrTask(IdParam idParam) {
 | 
			
		||||
@@ -90,10 +102,12 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
 | 
			
		||||
        BeanUtils.copyProperties(param, currTask);
 | 
			
		||||
        currTask.setTaskType(TaskTypeEnum.WTK.getValue());
 | 
			
		||||
        //根据工艺号查询工艺id以及工艺plc值
 | 
			
		||||
        CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CREATOR_ID, param.getCraftCode()));
 | 
			
		||||
        // TODO: 2022/7/7  工艺号临时
 | 
			
		||||
        CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, 1));
 | 
			
		||||
        currTask.setCraftCodeId(one.getId());
 | 
			
		||||
        currTask.setPlcValue(one.getPlcValue());
 | 
			
		||||
        currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE"));
 | 
			
		||||
        currTask.setTaskCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE"));
 | 
			
		||||
        setCommonField(currTask);
 | 
			
		||||
        currTaskServiceBiz.save(currTask);
 | 
			
		||||
        return successful(IdVo.builder().id(currTask.getId()).build());
 | 
			
		||||
@@ -132,7 +146,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<String> deleteBySheetNo(String sheetNo) {
 | 
			
		||||
        CurrTask byId = currTaskServiceBiz.getById(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
 | 
			
		||||
        CurrTask byId = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
 | 
			
		||||
        //如果尚未执行(状态 0)
 | 
			
		||||
        if (byId.getStatus() == 0)
 | 
			
		||||
        {
 | 
			
		||||
@@ -185,4 +199,22 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
 | 
			
		||||
        });
 | 
			
		||||
        return successful(pageVo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R runTask(Long taskId) throws InterruptedException, IOException {
 | 
			
		||||
        CurrTask currTask = currTaskServiceBiz.getById(taskId);
 | 
			
		||||
        //是否为自动任务
 | 
			
		||||
        if (currTask.getIsAuto()==1){
 | 
			
		||||
            List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
 | 
			
		||||
            if (exeTaskList.size()==0){
 | 
			
		||||
                return R.failed("该任务为多步骤加工任务且该步骤不是第一步,请选择第一步骤任务执行!");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return runTaskUtils.runTaskForInKiln(taskId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -176,21 +176,21 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
 | 
			
		||||
                    CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build());
 | 
			
		||||
                    orderInfo.setABeginTime(currTask.getABeginTime());
 | 
			
		||||
                    orderInfo.setAEndTime(currTask.getAEndTime());
 | 
			
		||||
                    orderInfo.setTaskType(currTask.getTaskType());
 | 
			
		||||
                    orderInfo.setTaskType(currTask.getProcessType());
 | 
			
		||||
                    orderInfo.setStatus(currTask.getStatus());
 | 
			
		||||
                    orderInfo.setKilnId(currTask.getKilnId());
 | 
			
		||||
                    orderInfo.setStartPosition(currTask.getStartPosition());
 | 
			
		||||
                    orderInfo.setTargetPosition(currTask.getTargetPosition());
 | 
			
		||||
                    orderInfo.setVehicleId(currTask.getVehicleId());
 | 
			
		||||
                    //orderInfo.setVehicleId(currTask.getVehicleId());
 | 
			
		||||
                    //获取窑炉和车辆的名称信息
 | 
			
		||||
                    if (orderInfo.getKilnId() != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        orderInfo.setKilnName(collect2.get(orderInfo.getKilnId()).get(0).getKilnName());
 | 
			
		||||
                    }
 | 
			
		||||
                    if (orderInfo.getVehicleId() != null)
 | 
			
		||||
/*                    if (orderInfo.getVehicleId() != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        orderInfo.setVehicleName(collect.get(orderInfo.getVehicleId()).get(0).getVehicleName());
 | 
			
		||||
                    }
 | 
			
		||||
                    }*/
 | 
			
		||||
                }
 | 
			
		||||
        );
 | 
			
		||||
        return successful(currOrderCurrTask);
 | 
			
		||||
 
 | 
			
		||||
@@ -3,18 +3,26 @@ package com.mt.wms.empty.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.InStockInfo;
 | 
			
		||||
import com.mt.wms.core.dal.entity.InStockInfoHis;
 | 
			
		||||
import com.mt.wms.core.dal.entity.RunTask;
 | 
			
		||||
import com.mt.wms.core.dal.entity.VehicleInfo;
 | 
			
		||||
import com.mt.wms.core.dal.service.InStockInfoHisServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.RunTaskServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.VehicleInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.impl.InStockInfoHisServiceBizImpl;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.OutStockParam;
 | 
			
		||||
import com.mt.wms.empty.service.OutStockService;
 | 
			
		||||
import com.mt.wms.empty.task.AsynRunTaskService;
 | 
			
		||||
import com.mt.wms.empty.task.RunTaskUtils;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -33,33 +41,18 @@ public class OutStockServiceImpl extends BaseService implements OutStockService
 | 
			
		||||
    private AsynRunTaskService asynRunTaskService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private InStockInfoServiceBiz inStockInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private RunTaskServiceBiz runTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private RunTaskUtils runTaskUtils;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<String> outTask(OutStockParam outStockParam) {
 | 
			
		||||
        // TODO: 2021/12/17 出库
 | 
			
		||||
        Long localtionId = outStockParam.getLocaltionId();
 | 
			
		||||
    public R outTask(OutStockParam outStockParam) throws IOException {
 | 
			
		||||
        // 2021/12/17 出库
 | 
			
		||||
        Long locationId = outStockParam.getLocaltionId();
 | 
			
		||||
        //提升台
 | 
			
		||||
        Integer code = outStockParam.getCode();
 | 
			
		||||
        //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
 | 
			
		||||
                .eq(VehicleInfo.STATUS, 0)
 | 
			
		||||
                .eq(VehicleInfo.VALID, 1));
 | 
			
		||||
        if (vehicleInfoList.size()>0){
 | 
			
		||||
            VehicleInfo vehicleInfo = vehicleInfoList.get(0);
 | 
			
		||||
            vehicleInfo.setStatus(1);
 | 
			
		||||
            vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
            vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
        }else {
 | 
			
		||||
            return R.failed("暂无可用车辆!请稍后重试!");
 | 
			
		||||
        }
 | 
			
		||||
        //异步调用车辆
 | 
			
		||||
        asynRunTaskService.asynRunOutStock();
 | 
			
		||||
        //修改库位状态
 | 
			
		||||
        InStockInfo inStockInfo = inStockInfoServiceBiz
 | 
			
		||||
                .getOne(new QueryWrapper<InStockInfo>().eq("Location_id", localtionId));
 | 
			
		||||
        inStockInfo.setStatus(1);
 | 
			
		||||
        inStockInfoServiceBiz.updateById(inStockInfo);
 | 
			
		||||
        return R.ok("操作成功");
 | 
			
		||||
 | 
			
		||||
        String code = outStockParam.getCode();
 | 
			
		||||
        return runTaskUtils.runTaskForOut(locationId,code);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,11 @@ import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.CurrTaskDet;
 | 
			
		||||
import com.mt.wms.core.dal.entity.InStockInfo;
 | 
			
		||||
import com.mt.wms.core.dal.entity.Location;
 | 
			
		||||
import com.mt.wms.core.dal.entity.OrderInfo;
 | 
			
		||||
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.LocationServiceBiz;
 | 
			
		||||
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.StockInfoQueryParam;
 | 
			
		||||
@@ -36,11 +38,18 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
 | 
			
		||||
    private LocationServiceBiz locationServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CurrTaskDetServiceBiz currTaskDetServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private OrderInfoServiceBiz orderInfoServiceBiz;
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<CurrTaskDetVo>> get(IdParam idParam) {
 | 
			
		||||
        Long taskId = inStockInfoServiceBiz.getById(idParam).getTaskId();
 | 
			
		||||
        Long taskId = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID,idParam.getId())).getTaskId();
 | 
			
		||||
        List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq("curr_task_id", taskId));
 | 
			
		||||
        List<CurrTaskDetVo> currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
 | 
			
		||||
        for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList
 | 
			
		||||
             ) {
 | 
			
		||||
            String costomerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq("order_no", currTaskDetVo.getOrderNo())).getCustomerName();
 | 
			
		||||
            currTaskDetVo.setCustomer(costomerName);
 | 
			
		||||
        }
 | 
			
		||||
        return successful(currTaskDetVoList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -55,11 +64,13 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
 | 
			
		||||
            //库位为空
 | 
			
		||||
            if (location.getStatus()!=1){
 | 
			
		||||
                stockInfoVo.setEmpty(1);
 | 
			
		||||
                stockInfoVo.setLocaltionId(location.getId());
 | 
			
		||||
                stockInfoVo.setLocationId(location.getId());
 | 
			
		||||
                stockInfoVo.setLocationName(location.getLocationNameAlias());
 | 
			
		||||
            }else {
 | 
			
		||||
                InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>()
 | 
			
		||||
                        .eq("localtion_id", location.getId()));
 | 
			
		||||
                        .eq("location_id", location.getId()));
 | 
			
		||||
                BeanUtils.copyProperties(inStockInfo,stockInfoVo);
 | 
			
		||||
                stockInfoVo.setEmpty(0);
 | 
			
		||||
            }
 | 
			
		||||
            stockInfoVoList.add(stockInfoVo);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,112 +1,411 @@
 | 
			
		||||
package com.mt.wms.empty.task;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.core.dal.entity.*;
 | 
			
		||||
import com.mt.wms.core.dal.service.*;
 | 
			
		||||
import com.mt.wms.core.utils.HttpClient;
 | 
			
		||||
import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.websocket.WebSocketServer;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.scheduling.annotation.Async;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import static org.bouncycastle.asn1.x500.style.RFC4519Style.l;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/11/15 21:55
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Component
 | 
			
		||||
@Transactional
 | 
			
		||||
public class RunTaskUtils {
 | 
			
		||||
    private Logger logger = LoggerFactory.getLogger(getClass());
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private RunTaskServiceBiz runTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private LocationServiceBiz locationServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AsynRunTaskService asynRunTaskService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private VehicleInfoServiceBiz vehicleInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TaskDistanceUtils taskDistanceUtils;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PointInfoServiceBiz pointInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private KilnInfoServiceBiz kilnInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private WebSocketServer webSocketServer;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 进炉加工
 | 
			
		||||
     * @param currTaskId
 | 
			
		||||
     * @return
 | 
			
		||||
     * @param currTaskId 任务id
 | 
			
		||||
     * @return R
 | 
			
		||||
     * @throws InterruptedException
 | 
			
		||||
     */
 | 
			
		||||
    public R runTaskForInKiln(Integer currTaskId) throws InterruptedException {
 | 
			
		||||
    public R runTaskForInKiln(Long currTaskId) throws InterruptedException, IOException {
 | 
			
		||||
        CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
 | 
			
		||||
        //传入任务id,起始点,若终点是窑炉,获取窑炉状态
 | 
			
		||||
        int kilnStatus = 1;
 | 
			
		||||
 | 
			
		||||
        //起点,起点和终点是液压台code、窑炉code、缓存区code
 | 
			
		||||
        String startPosition = currTask.getStartPosition();
 | 
			
		||||
        PointInfo startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPosition));
 | 
			
		||||
        // 可以根据点位类型判断起点是否为液压台(2是液压台)
 | 
			
		||||
        Integer startPointType = startPoint.getType();
 | 
			
		||||
        if (startPointType==2){
 | 
			
		||||
            Map<String, Object> yeya = new HashMap();
 | 
			
		||||
            //type=1为 入
 | 
			
		||||
            yeya.put("type", 1);
 | 
			
		||||
            if ("YYT003".equals(startPoint.getNote())){
 | 
			
		||||
                yeya.put("number", 2);
 | 
			
		||||
            }
 | 
			
		||||
            if ("YYT004".equals(startPoint.getNote())){
 | 
			
		||||
                yeya.put("number", 1);
 | 
			
		||||
            }
 | 
			
		||||
            String yeyaJudgeStatus = JSON.toJSONString(yeya);
 | 
			
		||||
            //判断起点液压台是否已放货且提升到位
 | 
			
		||||
            String yeyaStatus=null;
 | 
			
		||||
            try {
 | 
			
		||||
                yeyaStatus = HttpClient.httpPost("http://192.168.6.51:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus);
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
                logger.error(new Date() + "WCS接口超时未响应!");
 | 
			
		||||
            }
 | 
			
		||||
            //taskStatus==3满足条件,其他状态值说明液压台不满足开始任务的条件(无货物或者有货物但是没提升到位)
 | 
			
		||||
            if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 3){
 | 
			
		||||
                return R.failed(startPoint.getName()+"号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //是否有小车在运行
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
        if (vehicleInfoList.size()>0){
 | 
			
		||||
            //有小车在运行,提示当前有车辆在运行,请稍后
 | 
			
		||||
            return R.failed("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!");
 | 
			
		||||
        }
 | 
			
		||||
        //  2022/2/27  传入任务id,起始点,若终点是窑炉,获取窑炉状态,能放两坨货的窑炉怎么判定状态?(AllowIn)
 | 
			
		||||
        KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
 | 
			
		||||
        String kilnNamePlace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
			
		||||
                .eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName();
 | 
			
		||||
        String result = readPlcToString(kilnNamePlace, "AllowIn");
 | 
			
		||||
        Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
        //窑炉状态为不可用
 | 
			
		||||
        if (kilnStatus == 0) {
 | 
			
		||||
        if (kilnInfo.getStatus() == 1) {
 | 
			
		||||
            return R.failed("目标窑炉不可用!");
 | 
			
		||||
        }
 | 
			
		||||
        //窑炉可用未满
 | 
			
		||||
        if (kilnStatus==1){
 | 
			
		||||
            //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆
 | 
			
		||||
            List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
 | 
			
		||||
                    .eq(VehicleInfo.STATUS, 0)
 | 
			
		||||
                    .eq(VehicleInfo.VALID, 1));
 | 
			
		||||
            if (vehicleInfoList.size()>0){
 | 
			
		||||
                VehicleInfo vehicleInfo = vehicleInfoList.get(0);
 | 
			
		||||
                vehicleInfo.setStatus(1);
 | 
			
		||||
                vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
            }else {
 | 
			
		||||
                return R.failed("暂无可用车辆!请稍后重试!");
 | 
			
		||||
        if (resultBoolean){
 | 
			
		||||
            //计算出路径最短的车辆id
 | 
			
		||||
            Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
 | 
			
		||||
            if (vehicleId==0){
 | 
			
		||||
                return R.failed("两辆车都不在线,请检查后重试!");
 | 
			
		||||
            }
 | 
			
		||||
            //占用车辆
 | 
			
		||||
            VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
 | 
			
		||||
            vehicleInfo.setStatus(1);
 | 
			
		||||
            vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
            vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
            //更改任务状态为执行中
 | 
			
		||||
            currTask.setStatus(1);
 | 
			
		||||
            currTask.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
            currTaskServiceBiz.updateById(currTask);
 | 
			
		||||
            //异步调用车辆
 | 
			
		||||
            asynRunTaskService.asynRunTask(currTask.getId(),vehicleInfoList.get(0).getId());
 | 
			
		||||
            return R.ok("操作成功");
 | 
			
		||||
        }
 | 
			
		||||
        //窑炉已满
 | 
			
		||||
        if (kilnStatus==2){
 | 
			
		||||
            asynRunTaskService.asynRunTask(currTask.getId(),vehicleId);
 | 
			
		||||
            return R.ok("操作成功,任务已开始执行。");
 | 
			
		||||
        } else {
 | 
			
		||||
            //窑炉已满
 | 
			
		||||
            //查询缓存区库位是否已满
 | 
			
		||||
            int count = locationServiceBiz.count(new QueryWrapper<Location>()
 | 
			
		||||
                    .eq(Location.STATUS, 0)
 | 
			
		||||
                    .eq(Location.VALID, 1));
 | 
			
		||||
            //缓存区未满
 | 
			
		||||
            if (count >0) {
 | 
			
		||||
                //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆
 | 
			
		||||
                List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
 | 
			
		||||
                        .eq(VehicleInfo.STATUS, 0)
 | 
			
		||||
                        .eq(VehicleInfo.VALID, 1));
 | 
			
		||||
                if (vehicleInfoList.size()>0){
 | 
			
		||||
                    VehicleInfo vehicleInfo = vehicleInfoList.get(0);
 | 
			
		||||
                    vehicleInfo.setStatus(1);
 | 
			
		||||
                    vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                    vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
                }else {
 | 
			
		||||
                    return R.failed("暂无可用车辆!请稍后重试!");
 | 
			
		||||
                //分配一个缓存区库位
 | 
			
		||||
                Location location = locationServiceBiz.list(new QueryWrapper<Location>()
 | 
			
		||||
                        .eq(Location.STATUS, 0)
 | 
			
		||||
                        .eq(Location.VALID, 1)).get(0);
 | 
			
		||||
                //更新 location 表对应库位状态为占用
 | 
			
		||||
                location.setStatus(1);
 | 
			
		||||
                location.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                locationServiceBiz.updateById(location);
 | 
			
		||||
                //通过库位code去point_info表中查出该库位对应的点
 | 
			
		||||
                PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode()));
 | 
			
		||||
                //计算出路径最短的车辆id,起点液压台,终点缓存区库位点
 | 
			
		||||
                Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), location.getCode());
 | 
			
		||||
                if (vehicleId==0){
 | 
			
		||||
                    return R.failed("两辆车都不在线,请检查后重试!");
 | 
			
		||||
                }
 | 
			
		||||
                //占用车辆
 | 
			
		||||
                VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
 | 
			
		||||
                vehicleInfo.setStatus(1);
 | 
			
		||||
                vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
                //更改任务为入缓存区
 | 
			
		||||
                currTask.setIsCache(1);
 | 
			
		||||
                currTask.setCacheSatatus(1);
 | 
			
		||||
                currTask.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                currTask.setLocationId(location.getId());
 | 
			
		||||
                currTaskServiceBiz.updateById(currTask);
 | 
			
		||||
 | 
			
		||||
                //异步调用车辆
 | 
			
		||||
                asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleInfoList.get(0).getId());
 | 
			
		||||
                return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
 | 
			
		||||
                asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleId);
 | 
			
		||||
                return R.ok("操作成功!当前目标窑炉已满,托盘准备加入缓存区待加工队列。");
 | 
			
		||||
            }
 | 
			
		||||
            return R.failed("当前目标窑炉已满!缓存区已满!请稍后重试!");
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加工完成、出炉。传入窑炉id,查询正在该窑炉加工的currTask,查询是否有空闲车辆,有,
 | 
			
		||||
     * (查询是否为自动任务,是,查询下一步的窑炉是否空闲,是,调车去下一窑炉加工,否,暂存缓存区)
 | 
			
		||||
     * 呼叫车辆暂存缓存区,车辆调度任务结束后,(结束后再查询缓存区队列避免车辆路线冲突)查询该窑炉的缓存区队列,开始下一托盘货物调度进窑炉
 | 
			
		||||
     * @return
 | 
			
		||||
     * 呼叫车辆暂存缓存区,车辆调度任务结束后,(结束后再查询缓R存区队列避免车辆路线冲突)查询该窑炉的缓存区队列,开始下一托盘货物调度进窑炉
 | 
			
		||||
     * @return R
 | 
			
		||||
     */
 | 
			
		||||
    public R runTaskForOutKiln(){
 | 
			
		||||
        return null;
 | 
			
		||||
    public R runTaskForOutKiln(Long kilnId) throws IOException {
 | 
			
		||||
        //查询正在该窑炉加工的currTask
 | 
			
		||||
        CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>()
 | 
			
		||||
                .eq("is_in", 1)
 | 
			
		||||
                .eq("status", 1)
 | 
			
		||||
                .eq("kiln_id", kilnId));
 | 
			
		||||
        //查询是否为自动任务
 | 
			
		||||
        if (currTask.getIsAuto()==1) {
 | 
			
		||||
            //查询自动任务的哪一步的设备id是该窑炉
 | 
			
		||||
            int firstCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
 | 
			
		||||
            if (firstCount == 1) {
 | 
			
		||||
                //当前为自动任务第一步
 | 
			
		||||
                AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
 | 
			
		||||
                //第二部的currTaskId
 | 
			
		||||
                Long taskId = autoExeTask.getTTaskId();
 | 
			
		||||
                CurrTask currTaskTwo = currTaskServiceBiz.getById(taskId);
 | 
			
		||||
                try {
 | 
			
		||||
                    logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
 | 
			
		||||
                    //  2022/2/27 websocket推送到页面显示
 | 
			
		||||
                    webSocketServer.sendtoAll("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
 | 
			
		||||
                     return runTaskForInKiln(taskId);
 | 
			
		||||
                } catch (InterruptedException e) {
 | 
			
		||||
                    e.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                //当前加工步骤不为第一步
 | 
			
		||||
                int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
 | 
			
		||||
                if (secondCount == 1) {
 | 
			
		||||
                    //当前为自动任务第二步
 | 
			
		||||
                    AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
 | 
			
		||||
                    //该自动任务的工艺类型为2,还有第三步
 | 
			
		||||
                    if (autoExeTask.getProcessFlowType()==2){
 | 
			
		||||
                        Long thTaskId = autoExeTask.getThTaskId();
 | 
			
		||||
                        CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId);
 | 
			
		||||
                        try {
 | 
			
		||||
                            logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
 | 
			
		||||
                            // 2022/2/27 websocket推送到页面显示
 | 
			
		||||
                            webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
 | 
			
		||||
                            return runTaskForInKiln(thTaskId);
 | 
			
		||||
                        } catch (InterruptedException e) {
 | 
			
		||||
                            e.printStackTrace();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //查询缓存区库位是否已满
 | 
			
		||||
        int count = locationServiceBiz.count(new QueryWrapper<Location>()
 | 
			
		||||
                .eq(Location.STATUS, 0)
 | 
			
		||||
                .eq(Location.VALID, 1));
 | 
			
		||||
        //缓存区未满
 | 
			
		||||
        if (count >0) {
 | 
			
		||||
            List<Location> locationList = locationServiceBiz.list(new QueryWrapper<Location>()
 | 
			
		||||
                    .eq(Location.STATUS, 0)
 | 
			
		||||
                    .eq(Location.VALID, 1).orderByDesc(Location.ID));
 | 
			
		||||
            //是否有小车在运行
 | 
			
		||||
            List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
            if (vehicleInfoList.size()>0){
 | 
			
		||||
                //有小车在运行,提示当前有车辆在运行,请稍后
 | 
			
		||||
                return R.failed("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!");
 | 
			
		||||
            }
 | 
			
		||||
            //计算出路径最短的车辆id
 | 
			
		||||
            KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
 | 
			
		||||
            //窑炉为起点,缓存区为终点
 | 
			
		||||
            Location location = locationList.get(0);
 | 
			
		||||
            Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), location.getCode());
 | 
			
		||||
            if (vehicleId==0){
 | 
			
		||||
                return R.failed("两辆车都不在线,请检查后重试!");
 | 
			
		||||
            }
 | 
			
		||||
            //占用车辆
 | 
			
		||||
            VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
 | 
			
		||||
            vehicleInfo.setStatus(1);
 | 
			
		||||
            vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
            vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
            //修改任务状态
 | 
			
		||||
            currTask.setIsOut(0);
 | 
			
		||||
            currTask.setTaskType(2);
 | 
			
		||||
            currTask.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
            currTask.setOutStartPosition(kilnInfo.getCode());
 | 
			
		||||
            currTask.setOutTargetPosition(location.getCode());
 | 
			
		||||
            currTaskServiceBiz.updateById(currTask);
 | 
			
		||||
            //  2022/2/16 异步调用车辆
 | 
			
		||||
            asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleId);
 | 
			
		||||
            return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
 | 
			
		||||
        }else {
 | 
			
		||||
            return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 从缓存区出库
 | 
			
		||||
     * @param locationId 库位id
 | 
			
		||||
     * @param yeyaTaiCode 液压台code
 | 
			
		||||
     * @return R
 | 
			
		||||
     */
 | 
			
		||||
    public R runTaskForOut(Long locationId,String yeyaTaiCode) throws IOException {
 | 
			
		||||
        Location location = locationServiceBiz.getById(locationId);
 | 
			
		||||
        //是否有小车在运行
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
        if (vehicleInfoList.size()>0){
 | 
			
		||||
            //有小车在运行,提示当前有车辆在运行,请稍后
 | 
			
		||||
            return R.failed("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!");
 | 
			
		||||
        }
 | 
			
		||||
        Boolean platFormStatus = platFormStatus(yeyaTaiCode);
 | 
			
		||||
        if (!platFormStatus){
 | 
			
		||||
            // TODO: 2022/3/19 delete
 | 
			
		||||
            System.out.println("当前选定的液压台为在线或未提升到位,请检查后重试!");
 | 
			
		||||
            return R.failed("当前选定的液压台为在线或未提升到位,请检查后重试!");
 | 
			
		||||
        }
 | 
			
		||||
        //计算出路径最短的车辆id
 | 
			
		||||
        Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), yeyaTaiCode);
 | 
			
		||||
        if (vehicleId==0){
 | 
			
		||||
            return R.failed("两辆车都不在线,请检查后重试!");
 | 
			
		||||
        }
 | 
			
		||||
        //占用车辆
 | 
			
		||||
        VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
 | 
			
		||||
        vehicleInfo.setStatus(1);
 | 
			
		||||
        vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
        vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
        //异步调用车辆
 | 
			
		||||
        asynRunTaskService.asynRunOutStock(locationId,yeyaTaiCode,vehicleInfo.getId());
 | 
			
		||||
        // TODO: 2022/3/19
 | 
			
		||||
        System.out.println("操作成功,任务已开始执行。");
 | 
			
		||||
        return R.ok("操作成功,任务已开始执行。");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取变量值
 | 
			
		||||
     * @param nameSpace nameSpace前缀
 | 
			
		||||
     * @param variableName 变量名称
 | 
			
		||||
     * @return result字符串
 | 
			
		||||
     */
 | 
			
		||||
    private String readPlcToString(String nameSpace, String variableName){
 | 
			
		||||
        String identifier=nameSpace.concat(variableName);
 | 
			
		||||
        Map<String, Object> json = new HashMap();
 | 
			
		||||
        json.put("nameSpace", 6);
 | 
			
		||||
        json.put("plcName", "plc1");
 | 
			
		||||
        json.put("identifier",identifier);
 | 
			
		||||
        String result = null;
 | 
			
		||||
        try {
 | 
			
		||||
            result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.info("readPLC: "+identifier+" 的值失败");
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断液压台是否准备好放货
 | 
			
		||||
     * @param platFormCode 液压台编码
 | 
			
		||||
     * @return 是/否
 | 
			
		||||
     */
 | 
			
		||||
    private Boolean platFormStatus(String platFormCode){
 | 
			
		||||
        String identifier=null;
 | 
			
		||||
        if ("YYT001".equals(platFormCode)){
 | 
			
		||||
            identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
 | 
			
		||||
            Map<String, Object> json = new HashMap();
 | 
			
		||||
            json.put("nameSpace", 6);
 | 
			
		||||
            json.put("plcName", "plc1");
 | 
			
		||||
            json.put("identifier",identifier+"Online");
 | 
			
		||||
            String result = null;
 | 
			
		||||
            try {
 | 
			
		||||
                result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
                logger.info("获取液压台1当前是否在线失败");
 | 
			
		||||
            }
 | 
			
		||||
            Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
            if (aBoolean){
 | 
			
		||||
                Map<String, Object> statusJson = new HashMap();
 | 
			
		||||
                statusJson.put("nameSpace", 6);
 | 
			
		||||
                statusJson.put("plcName", "plc1");
 | 
			
		||||
                statusJson.put("identifier",identifier+"TaskState");
 | 
			
		||||
                String statusResult = null;
 | 
			
		||||
                try {
 | 
			
		||||
                    statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
 | 
			
		||||
                } catch (IOException e) {
 | 
			
		||||
                    e.printStackTrace();
 | 
			
		||||
                    logger.info("获取液压台1当前状态失败");
 | 
			
		||||
                }
 | 
			
		||||
                Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
 | 
			
		||||
                if (status==1){
 | 
			
		||||
                    return true;
 | 
			
		||||
                }else {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }else {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if ("YYT002".equals(platFormCode)){
 | 
			
		||||
            identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform3ToWCS.";
 | 
			
		||||
            Map<String, Object> json = new HashMap();
 | 
			
		||||
            json.put("nameSpace", 6);
 | 
			
		||||
            json.put("plcName", "plc1");
 | 
			
		||||
            json.put("identifier",identifier+"Online");
 | 
			
		||||
            String result = null;
 | 
			
		||||
            try {
 | 
			
		||||
                result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
                logger.info("获取液压台2当前是否在线失败");
 | 
			
		||||
            }
 | 
			
		||||
            Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
            if (aBoolean){
 | 
			
		||||
                Map<String, Object> statusJson = new HashMap();
 | 
			
		||||
                statusJson.put("nameSpace", 6);
 | 
			
		||||
                statusJson.put("plcName", "plc1");
 | 
			
		||||
                statusJson.put("identifier",identifier+"TaskState");
 | 
			
		||||
                String statusResult = null;
 | 
			
		||||
                try {
 | 
			
		||||
                    statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
 | 
			
		||||
                } catch (IOException e) {
 | 
			
		||||
                    e.printStackTrace();
 | 
			
		||||
                    logger.info("获取液压台2当前状态失败");
 | 
			
		||||
                }
 | 
			
		||||
                Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
 | 
			
		||||
                if (status==1){
 | 
			
		||||
                    return true;
 | 
			
		||||
                }else {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }else {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,637 @@
 | 
			
		||||
package com.mt.wms.empty.task;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.core.base.BaseService;
 | 
			
		||||
import com.mt.wms.core.dal.entity.*;
 | 
			
		||||
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.HttpClient;
 | 
			
		||||
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 org.junit.jupiter.api.Test;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.scheduling.annotation.Scheduled;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/13 19:54
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
public class ScheduledTask {
 | 
			
		||||
@Component
 | 
			
		||||
public class ScheduledTask extends BaseService {
 | 
			
		||||
 | 
			
		||||
    private final static Logger logger = LoggerFactory.getLogger(ScheduledTask.class);
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private KilnInfoServiceBiz kilnInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private VehicleInfoServiceBiz vehicleInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private InStockInfoServiceBiz inStockInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TaskDistanceUtils taskDistanceUtils;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private LocationServiceBiz locationServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CurrTaskServiceBiz currTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AsynRunTaskService asynRunTaskService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AlarmInfoServiceBiz alarmInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ParGasValueServiceBiz parGasValueServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ParTemValueServiceBiz parTemValueServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ParEleValueServiceBiz parEleValueServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PointInfoServiceBiz pointInfoServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private RunTaskUtils runTaskUtils;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private WebSocketServer webSocketServer;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private CurrTaskDetServiceBiz currTaskDetServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private OrderInfoServiceBiz orderInfoServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void test() throws IOException {
 | 
			
		||||
    }
 | 
			
		||||
    //@Scheduled(fixedDelay = 1000*60)
 | 
			
		||||
    public void testWebsocket() throws IOException {
 | 
			
		||||
        //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
 | 
			
		||||
        List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
 | 
			
		||||
        if (currTaskList.size()==0){
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
 | 
			
		||||
        for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
 | 
			
		||||
        ) {
 | 
			
		||||
            Long kilnId = nowCurrTask.getKilnId();
 | 
			
		||||
            Boolean kilnWorking = true;
 | 
			
		||||
            //查询对应炉号是否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 = 300;
 | 
			
		||||
                //剩余时间
 | 
			
		||||
                Integer remainingTime = 122;
 | 
			
		||||
                nowCurrTask.setSetupTime(setupTime);
 | 
			
		||||
                nowCurrTask.setRemainingTime(remainingTime);
 | 
			
		||||
                int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
 | 
			
		||||
                nowCurrTask.setCompleteness(completeness);
 | 
			
		||||
                nowCurrTask.setKilnCode("BMA1");
 | 
			
		||||
                //标识卡详情
 | 
			
		||||
                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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println(JSON.toJSONString(nowCurrTaskDetVoList));
 | 
			
		||||
        webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 正在加工的加工任务详情
 | 
			
		||||
     */
 | 
			
		||||
    //@Scheduled(fixedDelay = 1000*60)
 | 
			
		||||
    public void screen() throws IOException {
 | 
			
		||||
        //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
 | 
			
		||||
        List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
 | 
			
		||||
        if (currTaskList.size()==0){
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        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();
 | 
			
		||||
                KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
 | 
			
		||||
                nowCurrTask.setKilnCode(kilnInfo.getCode());
 | 
			
		||||
                //设定时间
 | 
			
		||||
                Integer setupTime =1;
 | 
			
		||||
                //剩余时间
 | 
			
		||||
                Integer remainingTime=0;
 | 
			
		||||
                if (kilnInfo.getType()!=4){
 | 
			
		||||
                    remainingTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramTimeRemain"));
 | 
			
		||||
                }
 | 
			
		||||
                if(kilnInfo.getType()==1||kilnInfo.getType()==3){
 | 
			
		||||
                    //运行时间
 | 
			
		||||
                    Integer runTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramRunTime"));
 | 
			
		||||
                    setupTime=runTime+remainingTime;
 | 
			
		||||
                }
 | 
			
		||||
                if (kilnInfo.getType()==2){
 | 
			
		||||
                    setupTime=Integer.parseInt(readPlcToString(nameSpace, "SetTime"));
 | 
			
		||||
                }
 | 
			
		||||
                nowCurrTask.setSetupTime(setupTime);
 | 
			
		||||
                nowCurrTask.setRemainingTime(remainingTime);
 | 
			
		||||
                int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
 | 
			
		||||
                nowCurrTask.setCompleteness(completeness);
 | 
			
		||||
                nowCurrTask.setKilnCode(kilnInfo.getCode());
 | 
			
		||||
                //标识卡详情
 | 
			
		||||
                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.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询加工完成的窑炉
 | 
			
		||||
     */
 | 
			
		||||
    @Scheduled
 | 
			
		||||
    public void taskForStockToKiln(){
 | 
			
		||||
        //遍历窑炉状态,若加工完毕,查询空车,占用,异步处理,继续遍历下一个窑炉状态
 | 
			
		||||
    //@Scheduled(fixedDelay = 1000*60*2)
 | 
			
		||||
    public void taskForStockToKiln() throws IOException {
 | 
			
		||||
        //两辆车是否都空闲,只有两辆车都空闲才被允许做任务
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
 | 
			
		||||
        if (vehicleInfoList.size()==2){
 | 
			
		||||
            //遍历currTask为进行中且is_in为正在加工的窑炉状态,若加工完毕,调用runTaskForOutKiln
 | 
			
		||||
            //  2022/3/6 有两托的判定哪一托好了(通过开始加工时间顺序排列)
 | 
			
		||||
            List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
 | 
			
		||||
                    .eq(CurrTask.STATUS, 1)
 | 
			
		||||
                    .eq(CurrTask.IS_IN, 1)
 | 
			
		||||
                    .orderByAsc(CurrTask.BEGIN_TIME));
 | 
			
		||||
            for (CurrTask currTask :currTaskList
 | 
			
		||||
                    ) {
 | 
			
		||||
                Long kilnId = currTask.getKilnId();
 | 
			
		||||
                KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
 | 
			
		||||
                PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                        .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
			
		||||
                        .eq(PlcNameSpace.TYPE, 0)
 | 
			
		||||
                        .eq(PlcNameSpace.EQ_ID,kilnId));
 | 
			
		||||
                //通过允许出炉信号来判定是否加工完成
 | 
			
		||||
                String result = readPlcToString(plcNameSpace.getName(), "AllowOut");
 | 
			
		||||
                Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
                if (resultBoolean){
 | 
			
		||||
                    //调用RunTaskUtils.runTaskForOutKiln
 | 
			
		||||
                    logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
 | 
			
		||||
                    runTaskUtils.runTaskForOutKiln(kilnId);
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒
 | 
			
		||||
    @Scheduled(fixedDelay = 1000*30)
 | 
			
		||||
    public void getFastValue(){
 | 
			
		||||
        logger.info("==采集高频能耗数据开始==");
 | 
			
		||||
        //加工炉列表
 | 
			
		||||
        List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
 | 
			
		||||
        for (KilnInfo kilnInfo:kilnInfoList
 | 
			
		||||
             ) {
 | 
			
		||||
            PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
 | 
			
		||||
                    .eq(PlcNameSpace.TYPE,0));
 | 
			
		||||
            String nameSpaceNote = nameSpace.getName();
 | 
			
		||||
            String result = readPlcToString(nameSpaceNote, "Working");
 | 
			
		||||
            Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
            //该炉子在工作中
 | 
			
		||||
            if (resultBoolean){
 | 
			
		||||
                Long kilnId = kilnInfo.getId();
 | 
			
		||||
                String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
 | 
			
		||||
                Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
 | 
			
		||||
                if (currTaskId==0){
 | 
			
		||||
                    logger.info("==当前加工的为手动加工任务,不记录能耗==");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                //加工炉
 | 
			
		||||
                if (kilnInfo.getType()==1){
 | 
			
		||||
                    //一号油搅拌转速
 | 
			
		||||
                    Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
 | 
			
		||||
                    //二号油搅拌转速
 | 
			
		||||
                    Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
 | 
			
		||||
                    ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
 | 
			
		||||
                    parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
 | 
			
		||||
                    parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
 | 
			
		||||
                    parRotSpeedValue.setKilnId(kilnId);
 | 
			
		||||
                    parRotSpeedValue.setTaskId(currTaskId);
 | 
			
		||||
                    parRotSpeedValue.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parRotSpeedValueServiceBiz.save(parRotSpeedValue);
 | 
			
		||||
                    //氮气
 | 
			
		||||
                    Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
 | 
			
		||||
                    //甲烷
 | 
			
		||||
                    Double methanolFlow = readPlc(nameSpaceNote, "MethanolFlow");
 | 
			
		||||
                    //丙烷
 | 
			
		||||
                    Double propaneFlow = readPlc(nameSpaceNote, "PropaneFlow");
 | 
			
		||||
                    //氨气
 | 
			
		||||
                    Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
 | 
			
		||||
                    //实际碳势
 | 
			
		||||
                    Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
 | 
			
		||||
                    //设定碳势
 | 
			
		||||
                    Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
 | 
			
		||||
                    ParGasValue parGasValue=new ParGasValue();
 | 
			
		||||
                    parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
 | 
			
		||||
                    parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
 | 
			
		||||
                    parGasValue.setMethanolFlow(methanolFlow.floatValue());
 | 
			
		||||
                    parGasValue.setPropaneFlow(propaneFlow.floatValue());
 | 
			
		||||
                    parGasValue.setActualNitPotValue(actualCarbon.floatValue());
 | 
			
		||||
                    parGasValue.setSetNitPotValue(setupCarbon.floatValue());
 | 
			
		||||
                    parGasValue.setKilnId(kilnId);
 | 
			
		||||
                    parGasValue.setTaskId(currTaskId);
 | 
			
		||||
                    parGasValue.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parGasValueServiceBiz.save(parGasValue);
 | 
			
		||||
                }
 | 
			
		||||
                //氮化炉
 | 
			
		||||
                if (kilnInfo.getType()==3){
 | 
			
		||||
                    //实际氮势
 | 
			
		||||
                    Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
 | 
			
		||||
                    //设定氮势
 | 
			
		||||
                    Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
 | 
			
		||||
                    //氢含量
 | 
			
		||||
                    Double hydrogenContent = readPlc(nameSpaceNote, "HydrogenContent");
 | 
			
		||||
                    //分解率
 | 
			
		||||
                    Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
 | 
			
		||||
                    //氨气量
 | 
			
		||||
                    Double ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
 | 
			
		||||
                    //氮气量
 | 
			
		||||
                    Double nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
 | 
			
		||||
                    //二氧化碳量
 | 
			
		||||
                    Double carbonDioxideFlow = readPlc(nameSpaceNote, "CO2Flow");
 | 
			
		||||
                    ParGasValue parGasValue3=new ParGasValue();
 | 
			
		||||
                    parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
 | 
			
		||||
                    parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
 | 
			
		||||
                    parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
 | 
			
		||||
                    parGasValue3.setSetNitPotValue(setupCarbon.floatValue());
 | 
			
		||||
                    parGasValue3.setHydrogenContent(hydrogenContent.floatValue());
 | 
			
		||||
                    parGasValue3.setDecompositionRate(decompositionRate.floatValue());
 | 
			
		||||
                    parGasValue3.setKilnId(kilnId);
 | 
			
		||||
                    parGasValue3.setTaskId(currTaskId);
 | 
			
		||||
                    parGasValue3.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parGasValueServiceBiz.save(parGasValue3);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("==采集高频能耗数据结束==");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次
 | 
			
		||||
    @Scheduled(fixedDelay = 1000*60*3)
 | 
			
		||||
    public void getSlowValue(){
 | 
			
		||||
        logger.info("==开始采集低频数据==");
 | 
			
		||||
        List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
 | 
			
		||||
        for (KilnInfo kilnInfo:kilnInfoList
 | 
			
		||||
             ) {
 | 
			
		||||
            PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
 | 
			
		||||
                    .eq(PlcNameSpace.TYPE,0));
 | 
			
		||||
            String nameSpaceNote = nameSpace.getName();
 | 
			
		||||
            String result = readPlcToString(nameSpaceNote, "Working");
 | 
			
		||||
            Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
            if (resultBoolean){
 | 
			
		||||
                Long kilnId = kilnInfo.getId();
 | 
			
		||||
                String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
 | 
			
		||||
                Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
 | 
			
		||||
                if (currTaskId==0){
 | 
			
		||||
                    logger.info("==当前加工的为手动加工任务,不记录能耗==");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                //加工炉
 | 
			
		||||
                if (kilnInfo.getType()==1){
 | 
			
		||||
                    //实际温度
 | 
			
		||||
                    Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
 | 
			
		||||
                    //设定温度
 | 
			
		||||
                    Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
 | 
			
		||||
                    //油槽实际温度
 | 
			
		||||
                    Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
 | 
			
		||||
                    //油槽设定温度
 | 
			
		||||
                    Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
 | 
			
		||||
                    ParTemValue parTemValue=new ParTemValue();
 | 
			
		||||
                    parTemValue.setSetTemValue(setUpTemp.floatValue());
 | 
			
		||||
                    parTemValue.setActTemValue(actualTemp.floatValue());
 | 
			
		||||
                    parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
 | 
			
		||||
                    parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
 | 
			
		||||
                    parTemValue.setKilnId(kilnId);
 | 
			
		||||
                    parTemValue.setTaskId(currTaskId);
 | 
			
		||||
                    parTemValue.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parTemValueServiceBiz.save(parTemValue);
 | 
			
		||||
                    //电度值
 | 
			
		||||
                    Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
 | 
			
		||||
                    //A向电压
 | 
			
		||||
                    Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
 | 
			
		||||
                    Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
 | 
			
		||||
                    Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
 | 
			
		||||
                    ParEleValue parEleValue=new ParEleValue();
 | 
			
		||||
                    parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
 | 
			
		||||
                    parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
 | 
			
		||||
                    parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
 | 
			
		||||
                    parEleValue.setTotalBat(electricalValue.floatValue());
 | 
			
		||||
                    parEleValue.setKilnId(kilnId);
 | 
			
		||||
                    parEleValue.setTaskId(currTaskId);
 | 
			
		||||
                    parEleValue.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parEleValueServiceBiz.save(parEleValue);
 | 
			
		||||
                }
 | 
			
		||||
                //回火炉
 | 
			
		||||
                if (kilnInfo.getType()==2){
 | 
			
		||||
                    //实际温度
 | 
			
		||||
                    Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
 | 
			
		||||
                    //设定温度
 | 
			
		||||
                    Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
 | 
			
		||||
                    ParTemValue parTemValue2=new ParTemValue();
 | 
			
		||||
                    parTemValue2.setSetTemValue(setUpTemp.floatValue());
 | 
			
		||||
                    parTemValue2.setActTemValue(actualTemp.floatValue());
 | 
			
		||||
                    parTemValue2.setKilnId(kilnId);
 | 
			
		||||
                    parTemValue2.setTaskId(currTaskId);
 | 
			
		||||
                    parTemValue2.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parTemValueServiceBiz.save(parTemValue2);
 | 
			
		||||
                    //电度值
 | 
			
		||||
                    Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
 | 
			
		||||
                    //A向电压
 | 
			
		||||
                    Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage");
 | 
			
		||||
                    Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
 | 
			
		||||
                    Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
 | 
			
		||||
                    ParEleValue parEleValue2=new ParEleValue();
 | 
			
		||||
                    parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
 | 
			
		||||
                    parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
 | 
			
		||||
                    parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
 | 
			
		||||
                    parEleValue2.setTotalBat(electricalValue.floatValue());
 | 
			
		||||
                    parEleValue2.setKilnId(kilnId);
 | 
			
		||||
                    parEleValue2.setTaskId(currTaskId);
 | 
			
		||||
                    parEleValue2.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parEleValueServiceBiz.save(parEleValue2);
 | 
			
		||||
                }
 | 
			
		||||
                //氮化炉
 | 
			
		||||
                if (kilnInfo.getType()==3){
 | 
			
		||||
                    //实际温度
 | 
			
		||||
                    Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
 | 
			
		||||
                    //设定温度
 | 
			
		||||
                    Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
 | 
			
		||||
                    //炉压
 | 
			
		||||
                    Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
 | 
			
		||||
                    //外一区温度
 | 
			
		||||
                    Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
 | 
			
		||||
                    //外二区温度
 | 
			
		||||
                    Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
 | 
			
		||||
                    ParTemValue parTemValue3=new ParTemValue();
 | 
			
		||||
                    parTemValue3.setSetTemValue(setUpTemp.floatValue());
 | 
			
		||||
                    parTemValue3.setActTemValue(actualTemp.floatValue());
 | 
			
		||||
                    parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
 | 
			
		||||
                    parTemValue3.setOuterZone2Temp(outerZone2Temperature.floatValue());
 | 
			
		||||
                    parTemValue3.setFurnacePressure(furnacePressure.floatValue());
 | 
			
		||||
                    parTemValue3.setKilnId(kilnId);
 | 
			
		||||
                    parTemValue3.setTaskId(currTaskId);
 | 
			
		||||
                    parTemValue3.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parTemValueServiceBiz.save(parTemValue3);
 | 
			
		||||
                    //电度值
 | 
			
		||||
                    Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
 | 
			
		||||
                    //A向电压
 | 
			
		||||
                    Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
 | 
			
		||||
                    Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
 | 
			
		||||
                    Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
 | 
			
		||||
                    ParEleValue parEleValue3=new ParEleValue();
 | 
			
		||||
                    parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
 | 
			
		||||
                    parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
 | 
			
		||||
                    parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
 | 
			
		||||
                    parEleValue3.setTotalBat(electricalValue.floatValue());
 | 
			
		||||
                    parEleValue3.setKilnId(kilnId);
 | 
			
		||||
                    parEleValue3.setTaskId(currTaskId);
 | 
			
		||||
                    parEleValue3.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parEleValueServiceBiz.save(parEleValue3);
 | 
			
		||||
                }
 | 
			
		||||
                //清洗炉
 | 
			
		||||
                if (kilnInfo.getType()==4){
 | 
			
		||||
                    //电度值
 | 
			
		||||
                    Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
 | 
			
		||||
                    //A向电压
 | 
			
		||||
                    Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage");
 | 
			
		||||
                    Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
 | 
			
		||||
                    Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
 | 
			
		||||
                    ParEleValue parEleValue4=new ParEleValue();
 | 
			
		||||
                    parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
 | 
			
		||||
                    parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
 | 
			
		||||
                    parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
 | 
			
		||||
                    parEleValue4.setTotalBat(electricalValue.floatValue());
 | 
			
		||||
                    parEleValue4.setKilnId(kilnId);
 | 
			
		||||
                    parEleValue4.setTaskId(currTaskId);
 | 
			
		||||
                    parEleValue4.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    parEleValueServiceBiz.save(parEleValue4);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("==结束采集低频数据==");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务,
 | 
			
		||||
    //待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉
 | 
			
		||||
    //@Scheduled(fixedDelay = 1000*60)
 | 
			
		||||
    public void runTaskForEmptyKiln() throws IOException {
 | 
			
		||||
        List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
 | 
			
		||||
                .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0));
 | 
			
		||||
        // 呼叫车辆运送货物给炉子
 | 
			
		||||
        //存在空闲窑炉
 | 
			
		||||
        if (kilnInfoList.size()!=0) {
 | 
			
		||||
            for (KilnInfo kilnInfo:kilnInfoList
 | 
			
		||||
                 ) {
 | 
			
		||||
                //查询是否有车辆正在执行任务,如果有,等。(根据车辆是否正在运行可以避免出现前一个任务获取还没进去炉子,炉子状态依然为allowIn,从而继续发送任务的情况)
 | 
			
		||||
                List<VehicleInfo> vehicleInfos = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
                if (vehicleInfos.size()>0){
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                //查询炉子是否allowIn
 | 
			
		||||
                Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId());
 | 
			
		||||
                if (kilnAllowIn){
 | 
			
		||||
                    //缓存区是否有目标位置为窑炉的待加工任务
 | 
			
		||||
                    List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
 | 
			
		||||
                            .eq(InStockInfo.TYPE, 1)
 | 
			
		||||
                            .eq(InStockInfo.KILN_ID, kilnInfo.getId())
 | 
			
		||||
                            .orderByAsc(InStockInfo.IN_TIME));
 | 
			
		||||
                    if (inStockInfoList.size() > 0) {
 | 
			
		||||
                        InStockInfo inStockInfo = inStockInfoList.get(0);
 | 
			
		||||
                        CurrTask currTask = currTaskServiceBiz.getById(inStockInfo.getTaskId());
 | 
			
		||||
                        Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
 | 
			
		||||
                        //是否有小车在运行
 | 
			
		||||
                        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
 | 
			
		||||
                        //两辆车同时空闲(其中一辆车在运行时,不能调度另一辆车,防止运行中路线冲突)
 | 
			
		||||
                        if (vehicleInfoList.size() == 0) {
 | 
			
		||||
                            //计算出路径最短的车辆id
 | 
			
		||||
                            Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), kilnInfo.getCode());
 | 
			
		||||
                            //占用车辆
 | 
			
		||||
                            VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
 | 
			
		||||
                            vehicleInfo.setStatus(1);
 | 
			
		||||
                            vehicleInfo.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                            vehicleInfoServiceBiz.updateById(vehicleInfo);
 | 
			
		||||
                            asynRunTaskService.asynRunTaskForStockToKiln(inStockInfo.getId(), vehicleId);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //遍历正在工作炉子的报警变量,记录报警
 | 
			
		||||
    @Scheduled(fixedDelay = 1000*60)
 | 
			
		||||
    public void listenKilnAlarm(){
 | 
			
		||||
        List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
 | 
			
		||||
        logger.info("==开始查询炉子是否有报警==");
 | 
			
		||||
        for (KilnInfo kilnInfo:kilnInfoList
 | 
			
		||||
             ) {
 | 
			
		||||
            PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_TYPE, 0)
 | 
			
		||||
                    .eq(PlcNameSpace.EQ_ID, kilnInfo.getId()));
 | 
			
		||||
            //判断炉子是否在工作状态
 | 
			
		||||
            String working = readPlcToString(kilnNameSpace.getName(), "Working");
 | 
			
		||||
            JSONObject jsonObject = JSON.parseObject(working);
 | 
			
		||||
            Boolean aBoolean = Boolean.valueOf(String.valueOf(jsonObject.get("msg")));
 | 
			
		||||
            if (aBoolean){
 | 
			
		||||
                //命名空间前缀
 | 
			
		||||
                String nameSpace = kilnNameSpace.getNote();
 | 
			
		||||
                //炉子的报警变量
 | 
			
		||||
                List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
 | 
			
		||||
                        .eq(PlcNameSpace.EQ_TYPE, 1)
 | 
			
		||||
                        .eq(PlcNameSpace.TYPE, 1)
 | 
			
		||||
                        .eq(PlcNameSpace.EQ_ID,kilnInfo.getId()));;
 | 
			
		||||
                for (PlcNameSpace plcNameSpace:alarmNameList
 | 
			
		||||
                ) {
 | 
			
		||||
                    String name = plcNameSpace.getName();
 | 
			
		||||
                    Map<String, Object> json = new HashMap();
 | 
			
		||||
                    json.put("nameSpace", 6);
 | 
			
		||||
                    json.put("plcName", "plc1");
 | 
			
		||||
                    json.put("identifier",nameSpace+name);
 | 
			
		||||
                    String jsonString = JSON.toJSONString(json);
 | 
			
		||||
                    try {
 | 
			
		||||
                        String result = HttpClient.httpPost("http://localhost:8009/opcua/read", jsonString);
 | 
			
		||||
                        Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
                        //报警状态为true
 | 
			
		||||
                        if (resultBoolean){
 | 
			
		||||
                            //任务状态为执行中且正在炉子中加工的任务
 | 
			
		||||
                            CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>()
 | 
			
		||||
                                    .eq(CurrTask.KILN_ID, kilnInfo.getId())
 | 
			
		||||
                                    .eq(CurrTask.IS_IN, 1)
 | 
			
		||||
                                    .eq(CurrTask.STATUS, 1));
 | 
			
		||||
                            AlarmInfo alarmInfo=new AlarmInfo();
 | 
			
		||||
                            alarmInfo.setEquipmentId(currTask.getKilnId());
 | 
			
		||||
                            alarmInfo.setEquipmentName(currTask.getKilnName());
 | 
			
		||||
                            alarmInfo.setType(0);
 | 
			
		||||
                            alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
 | 
			
		||||
                            alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+":"+plcNameSpace.getNote());
 | 
			
		||||
                            alarmInfo.setTaskCode(currTask.getTaskCode());
 | 
			
		||||
                            alarmInfo.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                            alarmInfoServiceBiz.save(alarmInfo);
 | 
			
		||||
                        }
 | 
			
		||||
                    } catch (IOException e) {
 | 
			
		||||
                        e.printStackTrace();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("==结束查询炉子是否有报警==");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //监听车辆是否在线(暂时不用)
 | 
			
		||||
    public void listenVehicleOnline() throws IOException {
 | 
			
		||||
        List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
 | 
			
		||||
                .eq(VehicleInfo.STATUS, 0));
 | 
			
		||||
        for (VehicleInfo vehicleInfo:vehicleInfoList
 | 
			
		||||
             ) {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取变量值
 | 
			
		||||
     * @param nameSpace nameSpace前缀
 | 
			
		||||
     * @param variableName 变量名称
 | 
			
		||||
     * @return result字符串
 | 
			
		||||
     */
 | 
			
		||||
    private String readPlcToString(String nameSpace, String variableName){
 | 
			
		||||
        String identifier=nameSpace.concat(variableName);
 | 
			
		||||
        Map<String, Object> json = new HashMap();
 | 
			
		||||
        json.put("nameSpace", 6);
 | 
			
		||||
        json.put("plcName", "plc1");
 | 
			
		||||
        json.put("identifier",identifier);
 | 
			
		||||
        String result = null;
 | 
			
		||||
        try {
 | 
			
		||||
            result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.info("readPLC: "+identifier+" 的值失败");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取变量值
 | 
			
		||||
     * @param nameSpace nameSpace前缀
 | 
			
		||||
     * @param variableName 变量名称
 | 
			
		||||
     * @return 变量值
 | 
			
		||||
     */
 | 
			
		||||
    private Double readPlc(String nameSpace, String variableName){
 | 
			
		||||
        String identifier=nameSpace.concat(variableName);
 | 
			
		||||
        Map<String, Object> json = new HashMap();
 | 
			
		||||
        json.put("nameSpace", 6);
 | 
			
		||||
        json.put("plcName", "plc1");
 | 
			
		||||
        json.put("identifier",identifier);
 | 
			
		||||
        String result = null;
 | 
			
		||||
        try {
 | 
			
		||||
            result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.info("能源消耗统计:获取 "+identifier+" 的值失败");
 | 
			
		||||
        }
 | 
			
		||||
        return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Boolean kilnAllowIn(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, "AllowIn");
 | 
			
		||||
        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());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,184 @@
 | 
			
		||||
package com.mt.wms.empty.task;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.mt.wms.core.dal.entity.PointInfo;
 | 
			
		||||
import com.mt.wms.core.dal.entity.VehicleInfo;
 | 
			
		||||
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
 | 
			
		||||
import com.mt.wms.core.utils.HttpClient;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Value;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/1 16:56
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Component
 | 
			
		||||
public class TaskDistanceUtils {
 | 
			
		||||
 | 
			
		||||
    private final static Logger logger = LoggerFactory.getLogger(TaskDistanceUtils.class);
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private PointInfoServiceBiz pointInfoServiceBiz;
 | 
			
		||||
    /**
 | 
			
		||||
     *计算各个空闲小车执行此任务的路径长度,传入任务起终点,返回一个小车ID
 | 
			
		||||
     * 计算各个空闲小车执行此任务的路径长度,传入任务起终点,返回一个小车ID
 | 
			
		||||
     * @param startPoint 起点
 | 
			
		||||
     * @param endPoint 终点
 | 
			
		||||
     * @return 路径最短的小车id
 | 
			
		||||
     */
 | 
			
		||||
    public static Long chooseVehicle(String startPoint,String endPoint){
 | 
			
		||||
        //计算任务起点到终点的距离
 | 
			
		||||
    public  Long chooseVehicle(String startPoint,String endPoint) throws IOException {
 | 
			
		||||
        //车辆是否在线,若不在线,返回在线的那一辆,都不在线返回0
 | 
			
		||||
        if (!rgvOnline(1L)){
 | 
			
		||||
 | 
			
		||||
            //液压台4 和 1号回火炉只能调用车辆1
 | 
			
		||||
            if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"BMC2".equals(startPoint)||"BMC2".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){
 | 
			
		||||
                return 0L;
 | 
			
		||||
            }
 | 
			
		||||
            if (!rgvOnline(2L)){
 | 
			
		||||
                return 0L;
 | 
			
		||||
            }
 | 
			
		||||
            return 2L;
 | 
			
		||||
        }
 | 
			
		||||
        if (!rgvOnline(2L)){
 | 
			
		||||
 | 
			
		||||
            //3-4号回火炉只能调用车辆2
 | 
			
		||||
            if ("BMC3".equals(startPoint)||"BMC3".equals(endPoint)||"BMC4".equals(startPoint)||"BMC4".equals(endPoint)){
 | 
			
		||||
                return 0L;
 | 
			
		||||
            }
 | 
			
		||||
            if (!rgvOnline(1L)){
 | 
			
		||||
                return 0L;
 | 
			
		||||
            }
 | 
			
		||||
            return 1L;
 | 
			
		||||
        }
 | 
			
		||||
        //3-4号回火炉只能调用车辆2
 | 
			
		||||
        if ("BMC3".equals(startPoint)||"BMC3".equals(endPoint)||"BMC4".equals(startPoint)||"BMC4".equals(endPoint)){
 | 
			
		||||
            return 2L;
 | 
			
		||||
        }
 | 
			
		||||
        //液压台4 和 1号回火炉只能调用车辆1
 | 
			
		||||
        if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){
 | 
			
		||||
            return 1L;
 | 
			
		||||
        }
 | 
			
		||||
        Double startDistance = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPoint)).getDistance();
 | 
			
		||||
        //  2022/2/19  两辆小车都空闲,获取出当前位置
 | 
			
		||||
        Double rgv1CurrPosition = RGVCurrPosition(1L);
 | 
			
		||||
        Double rgv2CurrPosition = RGVCurrPosition(2L);
 | 
			
		||||
        //计算空闲小车当前位置到起点的距离
 | 
			
		||||
        Double vehicle1Distance = Math.abs(startDistance - rgv1CurrPosition);
 | 
			
		||||
        Double vehicle2Distance = Math.abs(startDistance - rgv2CurrPosition);
 | 
			
		||||
        return  (vehicle1Distance < vehicle2Distance) ? 1L : 2L;
 | 
			
		||||
 | 
			
		||||
        //计算得出总距离最短的小车
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 计算正在执行任务的小车本次任务的剩余路径经过的点位集合
 | 
			
		||||
     * 计算执行任务的小车本次任务的剩余路径经过的点位集合
 | 
			
		||||
     * @param vehicle 小车id
 | 
			
		||||
     * @param startPoint 起点
 | 
			
		||||
     * @param endPoint 终点
 | 
			
		||||
     * @return 点位集合
 | 
			
		||||
     */
 | 
			
		||||
    public static List getPointList(){
 | 
			
		||||
        //获取小车当前位置
 | 
			
		||||
 | 
			
		||||
    public  List getPointList(Long vehicle,String startPoint,String endPoint){
 | 
			
		||||
        Integer start = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, startPoint)).getId();
 | 
			
		||||
        Integer end = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, endPoint)).getId();
 | 
			
		||||
        //获取点位list
 | 
			
		||||
        List<PointInfo> pointInfoList = pointInfoServiceBiz.list(new QueryWrapper<PointInfo>().orderByAsc(PointInfo.ID));
 | 
			
		||||
        // TODO: 2022/2/19  获取小车当前位置
 | 
			
		||||
        Integer nowPoint=3;
 | 
			
		||||
        //计算小车当前位置到任务起点-任务起点到任务终点的路径点集合
 | 
			
		||||
        //小车当前位置、起点、终点,找出最大最小值
 | 
			
		||||
        int min=(((nowPoint<start)?nowPoint:start)<end)?((nowPoint<start)?nowPoint:start):end;
 | 
			
		||||
        int max=(((nowPoint>start)?nowPoint:start)>end)?((nowPoint>start)?nowPoint:start):end;
 | 
			
		||||
        return pointInfoList.subList(min, max);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    //判断小车是否冲突,传入选定小车的id,任务起终点,另一小车位置。
 | 
			
		||||
    public Boolean conflictForVehicle(Long vehicleId,String startPoint,String endPoint,Double otherNowPosition) throws IOException {
 | 
			
		||||
        if (!rgvOnline(1L)||!rgvOnline(2L)){
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        Double startDistance = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPoint)).getDistance();
 | 
			
		||||
        Double endDistance = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, endPoint)).getDistance();
 | 
			
		||||
        //获取点位list
 | 
			
		||||
        List<PointInfo> pointInfoList = pointInfoServiceBiz.list(new QueryWrapper<PointInfo>().orderByAsc(PointInfo.ID));
 | 
			
		||||
        // 2022/2/19  获取小车当前位置
 | 
			
		||||
        Double rgvCurrPosition = RGVCurrPosition(vehicleId);
 | 
			
		||||
        //计算小车当前位置到任务起点-任务起点到任务终点的路径点集合
 | 
			
		||||
        //小车当前位置、起点、终点,找出最大最小值
 | 
			
		||||
        Double minDistance=(((rgvCurrPosition<startDistance)?rgvCurrPosition:startDistance)<endDistance)?((rgvCurrPosition<startDistance)?rgvCurrPosition:startDistance):endDistance;
 | 
			
		||||
        Double maxDistance=(((rgvCurrPosition>startDistance)?rgvCurrPosition:startDistance)>endDistance)?((rgvCurrPosition>startDistance)?rgvCurrPosition:startDistance):endDistance;
 | 
			
		||||
        //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(4米)
 | 
			
		||||
        if (otherNowPosition>=minDistance&&otherNowPosition<=maxDistance){
 | 
			
		||||
            return true;
 | 
			
		||||
        }else {
 | 
			
		||||
            if (Math.abs(otherNowPosition-maxDistance)<4){
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            if (Math.abs(otherNowPosition-minDistance)<4){
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * RGV1的当前位置
 | 
			
		||||
     * id 小车表示
 | 
			
		||||
     * @return 小车位置值(距离原点的值)
 | 
			
		||||
     */
 | 
			
		||||
    private Double RGVCurrPosition(Long id){
 | 
			
		||||
        Map<String, Object> json = new HashMap();
 | 
			
		||||
        json.put("nameSpace", 6);
 | 
			
		||||
        json.put("plcName", "plc1");
 | 
			
		||||
        if (id==1){
 | 
			
		||||
            json.put("identifier","S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.CurrentPosition");
 | 
			
		||||
        }
 | 
			
		||||
        if (id==2){
 | 
			
		||||
            json.put("identifier","S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.CurrentPosition");
 | 
			
		||||
        }
 | 
			
		||||
        String result = null;
 | 
			
		||||
        try {
 | 
			
		||||
            result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.info("获取RGV的当前位置失败");
 | 
			
		||||
        }
 | 
			
		||||
        Double value = Double.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
        return value*0.0001;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 车辆是否在线
 | 
			
		||||
     * @param vehicleId 车辆id
 | 
			
		||||
     * @return true/false
 | 
			
		||||
     * @throws IOException  plc访问失败
 | 
			
		||||
     */
 | 
			
		||||
    private Boolean rgvOnline(Long vehicleId) throws IOException {
 | 
			
		||||
        String identifier=null;
 | 
			
		||||
        if (vehicleId==1){
 | 
			
		||||
            identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
 | 
			
		||||
        }
 | 
			
		||||
        if (vehicleId==2){
 | 
			
		||||
            identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
 | 
			
		||||
        }
 | 
			
		||||
        Map<String, Object> json = new HashMap();
 | 
			
		||||
        json.put("nameSpace", 6);
 | 
			
		||||
        json.put("plcName", "plc1");
 | 
			
		||||
        json.put("identifier",identifier);
 | 
			
		||||
        String result = null;
 | 
			
		||||
        try {
 | 
			
		||||
            result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.info("获取车辆"+vehicleId+"当前是否在线失败");
 | 
			
		||||
        }
 | 
			
		||||
        Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
 | 
			
		||||
        return online;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,17 @@
 | 
			
		||||
package com.mt.wms.empty.task;
 | 
			
		||||
 | 
			
		||||
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/12/1 16:38
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
//计算车辆路径是否冲突的方法,若只有一辆车空闲,计算是否冲突,
 | 
			
		||||
// 若两辆车都空闲且路径冲突,离起点近的那辆车计算避让出起点的距离,离终点近的那辆车计算出避让出终点的距离,取小
 | 
			
		||||
@Component
 | 
			
		||||
public class VehicleCollisionUtils {
 | 
			
		||||
    //获取当前车辆执行任务的路径,与其他正在执行任务的车辆路径对比
 | 
			
		||||
    //根据点坐标的最大最小值确定任务需要经过的点的集合,再根据车辆自身大小加上安全距离包含的点位
 | 
			
		||||
    //比较两个集合是否有相同元素
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,11 @@ public class AlarmInfoVo extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备名称",example = "0")
 | 
			
		||||
    private String equipmentName;
 | 
			
		||||
    /**
 | 
			
		||||
     * currtask任务code
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "currtask任务code",example = "0")
 | 
			
		||||
    private String taskCode;
 | 
			
		||||
    /**
 | 
			
		||||
     * 报警类型
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,236 @@
 | 
			
		||||
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.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/3 22:56
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@ApiModel(value = "自动任务视图对象", description = "用于查询自动任务信息")
 | 
			
		||||
public class AutoTaskVo extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键,自增
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "主键", example = "1")
 | 
			
		||||
    private Long id;
 | 
			
		||||
    /**
 | 
			
		||||
     * 添加时间
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "添加时间", example = "0")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "编码",example = "0")
 | 
			
		||||
    private String interCode;
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺类型,1表示第一种工艺流程,2表示第二种工艺流程
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺类型,1表示第一种工艺流程,2表示第二种工艺流程",example = "0")
 | 
			
		||||
    private Integer processFlowType;
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态,0:新增,1:执行中,2完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "状态,0:新增,1:执行中,2完成",example = "0")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 执行任务ID,关联任务表:t_curr_task
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "执行任务ID,关联任务表:t_curr_task",example = "0")
 | 
			
		||||
    private Long fTaskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务编码,子任务编码对应任务表t_curr_task中task_code编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
 | 
			
		||||
    private String fDetTaskCode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型ID,关联设备类型表:t_equipment_type
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备类型ID,关联设备类型表:t_equipment_type",example = "0")
 | 
			
		||||
    private Long fEquipmentTypeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备ID,关联设备表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备ID,关联设备表:t_kiln_info",example = "0")
 | 
			
		||||
    private Long fEquipmentId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称(炉子名称)
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备名称(炉子名称)",example = "0")
 | 
			
		||||
    private String fEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号ID,关联工艺号表:t_craft_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号ID,关联工艺号表:t_craft_info",example = "0")
 | 
			
		||||
    private Long fCraftCodeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号对应PLC值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号对应PLC值",example = "0")
 | 
			
		||||
    private Integer fPlcValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 进炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "进炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer fInTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加工状态,0:加工开始,1:加工中,2:加工完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "加工状态,0:加工开始,1:加工中,2:加工完成",example = "0")
 | 
			
		||||
    private Integer fProStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 出炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "出炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer fOutTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 执行任务ID,关联任务表:t_curr_task
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "执行任务ID,关联任务表:t_curr_task",example = "0")
 | 
			
		||||
    private Long tTaskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务编码,子任务编码对应任务表t_curr_task中task_code编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
 | 
			
		||||
    private String tDetTaskCode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型ID,关联设备类型表:t_equipment_type
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备类型ID,关联设备类型表:t_equipment_type",example = "0")
 | 
			
		||||
    private Long tEquipmentTypeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备名称",example = "0")
 | 
			
		||||
    private String tEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备ID,关联设备表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备ID,关联设备表:t_kiln_info",example = "0")
 | 
			
		||||
    private Long tEquipmentId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号ID,关联工艺号表:t_craft_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号ID,关联工艺号表:t_craft_info",example = "0")
 | 
			
		||||
    private Long tCraftCodeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号对应PLC值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号对应PLC值",example = "0")
 | 
			
		||||
    private Integer tPlcValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 进炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "进炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer tInTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加工状态,0:加工开始,1:加工中,2:加工完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "加工状态,0:加工开始,1:加工中,2:加工完成",example = "0")
 | 
			
		||||
    private Integer tProStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 出炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "出炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer tOutTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 执行任务ID,关联任务表:t_curr_task
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "执行任务ID,关联任务表:t_curr_task",example = "0")
 | 
			
		||||
    private Long thTaskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务编码,子任务编码对应任务表t_curr_task中task_code编码
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
 | 
			
		||||
    private String thDetTaskCode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备类型ID,关联设备类型表:t_equipment_type
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备类型ID,关联设备类型表:t_equipment_type",example = "0")
 | 
			
		||||
    private Long thEquipmentTypeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备名称
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备名称",example = "0")
 | 
			
		||||
    private String thEquipmentName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设备ID,关联设备表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "设备ID,关联设备表:t_kiln_info",example = "0")
 | 
			
		||||
    private Long thEquipmentId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号ID,关联工艺号表:t_craft_info
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号ID,关联工艺号表:t_craft_info",example = "0")
 | 
			
		||||
    private Long thCraftCodeId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺号对应PLC值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺号对应PLC值",example = "0")
 | 
			
		||||
    private Integer thPlcValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 进炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "进炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer thInTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加工状态,0:加工开始,1:加工中,2:加工完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "加工状态,0:加工开始,1:加工中,2:加工完成",example = "0")
 | 
			
		||||
    private Integer thProStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 出炉运输状态,0:开始,1:运输中,2:运输完成
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "出炉运输状态,0:开始,1:运输中,2:运输完成",example = "0")
 | 
			
		||||
    private Integer thOutTranStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 备注
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "备注",example = "0")
 | 
			
		||||
    private String content;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,46 @@
 | 
			
		||||
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.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2022/3/4 10:47
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@ApiModel(value = "消耗数据视图对象", description = "用于查询消耗数据")
 | 
			
		||||
public class ConsumeDataVo  extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
    /**
 | 
			
		||||
     * 时间
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "时间", example = "0")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 消耗值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "消耗值",example = "0.0")
 | 
			
		||||
    private Float value;
 | 
			
		||||
    /**
 | 
			
		||||
     * 单位
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "单位",example = "0.0")
 | 
			
		||||
    private String unit;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 名称
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "名称",example = "0.0")
 | 
			
		||||
    private String name;
 | 
			
		||||
}
 | 
			
		||||
@@ -56,6 +56,12 @@ public class CurrTaskMainQueryVo extends BaseVo implements PageVo.ConvertVo {
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("任务类型")
 | 
			
		||||
    private Integer taskType;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否自动执行:	0手动,1自动,如果是自动任务这里要监控进出和到缓存区的调度任务
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("是否自动执行:手动,1自动")
 | 
			
		||||
    private Integer is_auto;
 | 
			
		||||
    /**
 | 
			
		||||
     * 开始位置
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,11 @@ public class CurrTaskQueryVo extends BaseVo implements PageVo.ConvertVo {
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("任务类型")
 | 
			
		||||
    private Integer taskType;
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否自动执行:	0手动,1自动,如果是自动任务这里要监控进出和到缓存区的调度任务
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("是否自动执行:手动,1自动")
 | 
			
		||||
    private Integer is_auto;
 | 
			
		||||
    /**
 | 
			
		||||
     * 开始加工时间
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,73 @@
 | 
			
		||||
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;
 | 
			
		||||
    /**
 | 
			
		||||
     * 工艺进度
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "工艺进度",example = "0")
 | 
			
		||||
    private Integer completeness;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 标识卡list
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "标识卡list",example = "0")
 | 
			
		||||
    private List<CurrTaskDetVo> currTaskDetVoList;
 | 
			
		||||
}
 | 
			
		||||
@@ -36,12 +36,12 @@ public class StockInfoVo extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
     * 库位id
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "库位id",example = "0")
 | 
			
		||||
    private Long localtionId;
 | 
			
		||||
    private Long locationId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 库位名称
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "库位名称",example = "0")
 | 
			
		||||
    private String localtionName;
 | 
			
		||||
    private String locationName;
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务id
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,42 @@
 | 
			
		||||
package com.mt.wms.empty.websocket;
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: liguanghao
 | 
			
		||||
 * @Date: 2021/11/4 18:42
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Component
 | 
			
		||||
public class MessageModule {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WebSocketServer webSocketServer;
 | 
			
		||||
    public boolean sendMessageToAll(String message) throws IOException {
 | 
			
		||||
        try {
 | 
			
		||||
            String msg = message+"|0";
 | 
			
		||||
            webSocketServer.onMessage(msg,null);
 | 
			
		||||
        }catch (Exception e){
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean sendMessageToSomeone(String message,String userId){
 | 
			
		||||
        /*String msg =message+"|"+userId;
 | 
			
		||||
        try {
 | 
			
		||||
            WebSocketServer webSocketServer1 = webSocketServer.getWebSocketSessions().get(userId);
 | 
			
		||||
            if(webSocketServer1!=null){
 | 
			
		||||
                Session session1 = webSocketServer1.getSession();
 | 
			
		||||
                webSocketServer.onMessage(msg,session1);
 | 
			
		||||
            }else {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }catch (RRException e){
 | 
			
		||||
            throw new RRException("websocket出现异常");
 | 
			
		||||
        }*/
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
package com.mt.wms.empty.websocket;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
public class WebSocketConfig {
 | 
			
		||||
    @Bean
 | 
			
		||||
    public ServerEndpointExporter serverEndpointExporter() {
 | 
			
		||||
        return new ServerEndpointExporter();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,179 @@
 | 
			
		||||
package com.mt.wms.empty.websocket;
 | 
			
		||||
 | 
			
		||||
import org.apache.logging.log4j.LogManager;
 | 
			
		||||
import org.apache.logging.log4j.Logger;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import javax.websocket.*;
 | 
			
		||||
import javax.websocket.server.PathParam;
 | 
			
		||||
import javax.websocket.server.ServerEndpoint;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 注意:
 | 
			
		||||
 *  1.如果多个客户端来 连接 websocket,,那么 不要相同id。。如果是相同id只能发送一个。所以前端连接的id 号要由后台给出 getUniqeId() 这个方法
 | 
			
		||||
 * */
 | 
			
		||||
//访问服务端的url地址
 | 
			
		||||
@Component
 | 
			
		||||
@ServerEndpoint(value = "/qj/websocket/{id}")
 | 
			
		||||
public class WebSocketServer {
 | 
			
		||||
    private static int onlineCount = 0;
 | 
			
		||||
    private static ConcurrentHashMap<String, WebSocketServer> webSocketSet = new ConcurrentHashMap<>();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //前端的id 右后端给他
 | 
			
		||||
    public synchronized String getUniqeId(){
 | 
			
		||||
        //return UUID.randomUUID().toString()+System.currentTimeMillis();
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //与某个客户端的连接会话,需要通过它来给客户端发送数据
 | 
			
		||||
    private Session session;
 | 
			
		||||
    private static Logger log = LogManager.getLogger(WebSocketServer.class);
 | 
			
		||||
    private String id = getUniqeId();
 | 
			
		||||
 | 
			
		||||
    public Integer getCurrentNum(){
 | 
			
		||||
        return webSocketSet.size();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 连接建立成功调用的方法*/
 | 
			
		||||
    @OnOpen
 | 
			
		||||
    public void onOpen(@PathParam(value = "id") String id, Session session) {
 | 
			
		||||
        this.session = session;
 | 
			
		||||
        this.id = id;//接收到发送消息的人员编号
 | 
			
		||||
        webSocketSet.put(id, this);     //加入set中
 | 
			
		||||
        addOnlineCount();           //在线数加1
 | 
			
		||||
        log.info("用户"+id+"加入!当前在线人数为" + getOnlineCount());
 | 
			
		||||
        try {
 | 
			
		||||
            sendMessage("连接成功");
 | 
			
		||||
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            log.error("websocket IO异常");
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 连接关闭调用的方法
 | 
			
		||||
     */
 | 
			
		||||
    /*@OnClose
 | 
			
		||||
    public void onClose() {
 | 
			
		||||
 | 
			
		||||
        webSocketSet.remove(this);  //从set中删除
 | 
			
		||||
        subOnlineCount();           //在线数减1
 | 
			
		||||
        log.info("有一连接关闭!当前在线人数为" + getOnlineCount());
 | 
			
		||||
    }*/
 | 
			
		||||
 | 
			
		||||
    // 关闭连接触发事件
 | 
			
		||||
    @OnClose
 | 
			
		||||
    public void onClose(Session session, CloseReason closeReason) {
 | 
			
		||||
        String[] uris = session.getRequestURI().toString().split("/");
 | 
			
		||||
        webSocketSet.remove(uris[uris.length-1]);
 | 
			
		||||
        subOnlineCount();
 | 
			
		||||
        //log.info("有一连接关闭!当前在线人数为" + getOnlineCount());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 收到客户端消息后调用的方法
 | 
			
		||||
     *
 | 
			
		||||
     * @param message 客户端发送过来的消息
 | 
			
		||||
     * */
 | 
			
		||||
    @OnMessage
 | 
			
		||||
    public void onMessage(String message, Session session) throws Exception {
 | 
			
		||||
        //log.info("来自客户端的消息:" + message);
 | 
			
		||||
        //可以自己约定字符串内容,比如 内容|0 表示信息群发,内容|X 表示信息发给id为X的用户
 | 
			
		||||
        String sendMessage = message;
 | 
			
		||||
        String sendUserId = "0";
 | 
			
		||||
        if(sendMessage.equals("1")){
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
/*    @OnMessage
 | 
			
		||||
    public void onMessage(String message, Session session) {
 | 
			
		||||
        log.info("来自客户端的消息:" + message);
 | 
			
		||||
        //可以自己约定字符串内容,比如 内容|0 表示信息群发,内容|X 表示信息发给id为X的用户
 | 
			
		||||
        String sendMessage = message.split("[|]")[0];
 | 
			
		||||
        String sendUserId = message.split("[|]")[1];
 | 
			
		||||
        try {
 | 
			
		||||
            if(sendUserId.equals("0")){
 | 
			
		||||
                sendtoAll(sendMessage);
 | 
			
		||||
            }
 | 
			
		||||
            else{
 | 
			
		||||
                sendtoUser(sendMessage,sendUserId);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }*/
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param session
 | 
			
		||||
     * @param error
 | 
			
		||||
     */
 | 
			
		||||
    @OnError
 | 
			
		||||
    public void onError(Session session, Throwable error) {
 | 
			
		||||
        log.error("发生错误");
 | 
			
		||||
        error.printStackTrace();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public void sendMessage(String message) throws IOException {
 | 
			
		||||
        this.session.getBasicRemote().sendText(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 发送信息给指定ID用户,如果用户不在线则返回不在线信息给自己
 | 
			
		||||
     * @param message
 | 
			
		||||
     * @param sendUserId
 | 
			
		||||
     * @throws IOException
 | 
			
		||||
     */
 | 
			
		||||
    public void sendtoUser(String message,String sendUserId) throws IOException {
 | 
			
		||||
        if (webSocketSet.get(sendUserId) != null) {
 | 
			
		||||
            //if(!id.equals(sendUserId)){
 | 
			
		||||
                //webSocketSet.get(sendUserId).sendMessage( "用户" + id + "发来消息:" + " <br/> " + message);
 | 
			
		||||
           // }
 | 
			
		||||
            //else{
 | 
			
		||||
                webSocketSet.get(sendUserId).sendMessage(message);
 | 
			
		||||
            //}
 | 
			
		||||
        } else {
 | 
			
		||||
            //如果用户不在线则返回不在线信息给自己
 | 
			
		||||
            //sendtoUser("当前用户不在线",id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 发送信息给所有人
 | 
			
		||||
     * @param message
 | 
			
		||||
     * @throws IOException
 | 
			
		||||
     */
 | 
			
		||||
    public void sendtoAll(String message) throws IOException {
 | 
			
		||||
        for (String key : webSocketSet.keySet()) {
 | 
			
		||||
            try {
 | 
			
		||||
                webSocketSet.get(key).sendMessage(message);
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static synchronized int getOnlineCount() {
 | 
			
		||||
        return onlineCount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static synchronized void addOnlineCount() {
 | 
			
		||||
        WebSocketServer.onlineCount++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static synchronized void subOnlineCount() {
 | 
			
		||||
        WebSocketServer.onlineCount--;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user