Compare commits
	
		
			152 Commits
		
	
	
		
			4531db10da
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d14d142472 | ||
|  | 571cee49a0 | ||
|  | f1878910e3 | ||
|  | f5aa87d7e9 | ||
| fa189331b8 | |||
|  | 0616844403 | ||
| ac476e936e | |||
| 6259a0237e | |||
| b0540ce4dc | |||
|  | 395817f10e | ||
|  | 21a4cfab23 | ||
|  | 63d251325f | ||
| a002354d49 | |||
|  | 7e9d8f5e64 | ||
| bcff5830f4 | |||
| 75471b7166 | |||
| ec7f364ccf | |||
|  | 5582a6929c | ||
|  | 74b42527c6 | ||
| b407f99872 | |||
| 292c511c22 | |||
| 59921c28ca | |||
| 5eed777f0a | |||
| 592d27b858 | |||
| 59f008f19e | |||
| 3ecf06ae6a | |||
|  | 605cdb5aa0 | ||
|  | 647e3f5761 | ||
| 85299bb26a | |||
| 1a6c19bf14 | |||
| 7cfa7168e1 | |||
| d5464eed6c | |||
| 9d8b6c065f | |||
| e6995b99a3 | |||
|  | ef0ba77715 | ||
|  | 2def9c889f | ||
| 17f5ddbfa0 | |||
| 6ed7a735ed | |||
|  | f359470fc4 | ||
| 5e54011371 | |||
| 8643ca11d7 | |||
|  | 5711a2acf6 | ||
| cb0be1cbbf | |||
| 9a7170d9e9 | |||
| 18590dafb9 | |||
| d107699d2c | |||
| d49759efdf | |||
| 412dbd04d4 | |||
| 249ca25963 | |||
| 942bde619f | |||
|  | bd14fe3ed9 | ||
|  | 1ea55bd39a | ||
|  | dd1a4b448e | ||
| 4af20b8551 | |||
|  | 1616215534 | ||
|  | ddf6078774 | ||
|  | f125fac9ee | ||
| 8abbc7193a | |||
| 17c0c1e973 | |||
|  | c19066792c | ||
|  | 40f44f57d9 | ||
|  | fbdb10ace7 | ||
| 2c186a6ff4 | |||
|  | 05fb4a348a | ||
|  | 771351b12f | ||
| d2e37ee2c8 | |||
|  | 7000c02653 | ||
|  | 2013d5b815 | ||
| e1181e0423 | |||
| 5d9ce09137 | |||
|  | 4c0f84d742 | ||
|  | 039f791c97 | ||
| 4c731348d4 | |||
|  | 1dd028a202 | ||
|  | 7812f248a2 | ||
| 2741a7aa6e | |||
| 8b488b0f45 | |||
| 1c0f610e52 | |||
| 95f1c30cad | |||
|  | e3d17d1923 | ||
|  | be0ffcae00 | ||
| d595e8985c | |||
| 41227ec816 | |||
| 373b66aaa3 | |||
|  | c742686502 | ||
| af9b7a83cb | |||
| 3dce5380d8 | |||
|  | a4951da905 | ||
| 9189d77953 | |||
| 2ee047474a | |||
| f5342d1427 | |||
| a509e54803 | |||
| 592fdf285d | |||
| f2de6a3a04 | |||
| 1f7332fdbb | |||
|  | 5aa655b2b0 | ||
|  | 189475f09b | ||
|  | f555907877 | ||
|  | c44edba722 | ||
|  | ae816ce7f3 | ||
|  | 8c735058a1 | ||
|  | c73289bcc0 | ||
|  | 03d2e453fb | ||
|  | dae060d573 | ||
| 25d9354d81 | |||
| 1a6940eb70 | |||
|  | 6eb2839b7a | ||
|  | 8047bab61c | ||
|  | 26e5b24c32 | ||
| f0992ed9ce | |||
|  | 9f4dd3b1e3 | ||
| b9e55a7e5b | |||
| c734d69ce5 | |||
|  | 766b17274b | ||
|  | 52dfdc9c7f | ||
|  | 22c6288659 | ||
| 3015a43a55 | |||
| dd2ae384ad | |||
| 1cb26378a1 | |||
| 8d0b4aed82 | |||
|  | 5ae4100205 | ||
|  | 93eaf9ed40 | ||
|  | ddf86e07b4 | ||
|  | f3dda753a4 | ||
| 10e46121c3 | |||
| a440684232 | |||
|  | 8af8c45335 | ||
| 0c026853ef | |||
| 591716ebc8 | |||
|  | 0a1c21970b | ||
|  | 002a0cd1c3 | ||
|  | d8e4cb5bfa | ||
|  | 40c4e20949 | ||
| 4867a5cc26 | |||
|  | 6f0e487bc4 | ||
| 835b98e486 | |||
| 0fcdcd462c | |||
|  | 936dc5b71a | ||
|  | 722ecf61c0 | ||
|  | b12bd2294f | ||
| c324aa524f | |||
| 81b9f5c45e | |||
|  | 9cc6ef98f9 | ||
| 4133285cdd | |||
| f260cffd56 | |||
|  | 0c67641710 | ||
| b2319f2a51 | |||
| cf1c8eeb5e | |||
| b107cd2446 | |||
| 14b05bae7e | |||
| 0dd56c1e8b | |||
| 0b4795e92c | 
| @@ -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> | ||||
|  | ||||
| @@ -51,10 +51,13 @@ | ||||
|                 <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password> | ||||
|                 <spring.redis.database>5</spring.redis.database>--> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://192.168.6.51:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
|                 <!--<spring.datasource.url>jdbc:p6spy:mysql://localhost:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false--> | ||||
|  | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://localhost:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                  </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> | ||||
|                 <!-- #25 ssl 465 --> | ||||
| @@ -98,11 +101,11 @@ | ||||
|                 <spring.rabbitmq.username>wms</spring.rabbitmq.username> | ||||
|                 <spring.rabbitmq.password>wms</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>10</spring.redis.database>--> | ||||
|                 <spring.redis.database>10</spring.redis.database> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30306/wms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
| @@ -149,11 +152,11 @@ | ||||
|                 <spring.rabbitmq.username>wms</spring.rabbitmq.username> | ||||
|                 <spring.rabbitmq.password>wms</spring.rabbitmq.password> | ||||
|                 <!-- redis --> | ||||
| <!--                <spring.redis.cluster.nodes>127.0.0.1:6379</spring.redis.cluster.nodes> | ||||
|                 <spring.redis.cluster.nodes>127.0.0.1:6379</spring.redis.cluster.nodes> | ||||
|                 <spring.redis.host>127.0.0.1</spring.redis.host> | ||||
|                 <spring.redis.port>6379</spring.redis.port> | ||||
|                 <spring.redis.password>2018</spring.redis.password> | ||||
|                 <spring.redis.database>10</spring.redis.database>--> | ||||
|                 <spring.redis.database>10</spring.redis.database> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://localhost:3306/wms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
| @@ -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> | ||||
|   | ||||
| @@ -36,26 +36,26 @@ import java.util.List; | ||||
| @RestController | ||||
| @RequestMapping(CommonConstant.API_MODULE_BASE + "kilnInfo") | ||||
| @Slf4j | ||||
| @Api(value = "窑炉基础信息管理", tags = "窑炉基础信息管理", hidden = false) | ||||
| @Api(value = "工业炉基础信息管理", tags = "工业炉基础信息管理", hidden = false) | ||||
| public class KilnInfoController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private KilnInfoService kilnInfoService; | ||||
|  | ||||
|     @PostMapping(value = "get") | ||||
|     @ApiOperation(value = "获取窑炉信息") | ||||
|     @ApiOperation(value = "获取工业炉信息") | ||||
|     private R<KilnInfoVo> get(@Validated @RequestBody IdParam idParam) { | ||||
|         return kilnInfoService.get(idParam); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取窑炉列表") | ||||
|     @ApiOperation(value = "获取工业炉列表") | ||||
|     private R<List<KilnInfoVo>> list(@Validated({Default.class}) @RequestBody KilnInfoQueryParam kilnInfoQueryParam) { | ||||
|         return kilnInfoService.list(kilnInfoQueryParam); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "page") | ||||
|     @ApiOperation(value = "获取分页窑炉") | ||||
|     @ApiOperation(value = "获取分页工业炉") | ||||
|     private R<PageVo<KilnInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody KilnInfoQueryParam kilnInfoQueryParam) { | ||||
|         return kilnInfoService.page(kilnInfoQueryParam); | ||||
|     } | ||||
|   | ||||
| @@ -18,7 +18,7 @@ import javax.validation.constraints.NotNull; | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "窑炉参数对象", description = "用于新增和更新窑炉信息") | ||||
| @ApiModel(value = "工业炉参数对象", description = "用于新增和更新工业炉信息") | ||||
| public class KilnInfoParam extends BaseParam { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import lombok.experimental.Accessors; | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "窑炉查询参数", description = "用于查询窑炉信息") | ||||
| @ApiModel(value = "工业炉查询参数", description = "用于查询工业炉信息") | ||||
| public class KilnInfoQueryParam extends BasePageParam { | ||||
|     /** | ||||
|      * 主键,自增 | ||||
|   | ||||
| @@ -63,7 +63,7 @@ public class CraftInfoServiceImpl extends BaseService implements CraftInfoServic | ||||
|     public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) { | ||||
|         QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>(); | ||||
|         wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode()) | ||||
|                 .orderByDesc(CraftInfo.CREATE_TIME); | ||||
|                 .orderByAsc(CraftInfo.CREATE_TIME); | ||||
|         Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper); | ||||
|         return successful(new PageVo<>(page,CraftInfoVo.class)); | ||||
|     } | ||||
|   | ||||
| @@ -18,7 +18,7 @@ import lombok.experimental.Accessors; | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @Builder | ||||
| @ApiModel(value = "窑炉视图对象", description = "用于查询窑炉信息") | ||||
| @ApiModel(value = "工业炉视图对象", description = "用于查询工业炉信息") | ||||
| public class KilnInfoVo  extends BaseVo implements PageVo.ConvertVo { | ||||
|     /** | ||||
|      * 主键,自增 | ||||
|   | ||||
| @@ -60,4 +60,10 @@ public class VehicleVo extends BaseVo implements PageVo.ConvertVo{ | ||||
|      */ | ||||
|     @ApiModelProperty(value = "描述信息",  example = "1") | ||||
|     private String description; | ||||
|  | ||||
|     /** | ||||
|      * 描述信息 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "车辆状态:0-空闲,1-占用",  example = "1") | ||||
|     private Integer status; | ||||
| } | ||||
|   | ||||
| @@ -21,9 +21,9 @@ public class MyGenerator { | ||||
|     /** | ||||
|      * 数据库地址 | ||||
|      */ | ||||
|     static String dbUrl = "jdbc:mysql://mysql.picaiba.com:30307/mt_wms_qj"; | ||||
|     static String dbUrl = "jdbc:mysql://localhost:3306/mt_wms_qj"; | ||||
|     static String userName = "root"; | ||||
|     static String password = "1qaz@WSX3edc$RFV"; | ||||
|     static String password = "123456"; | ||||
|     /** | ||||
|      * 是否去掉生成实体的属性名前缀 | ||||
|      */ | ||||
| @@ -106,7 +106,7 @@ public class MyGenerator { | ||||
|  | ||||
|     @Test | ||||
|     public void generateCodeWithInjectConfigForAllTable() { | ||||
|         generateByTablesWithInjectConfig(new String[]{"t_auto_exe_task"}); | ||||
|         generateByTablesWithInjectConfig(new String[]{"t_question_answer"}); | ||||
|     } | ||||
|  | ||||
|     public static void main(String[] args) { | ||||
|   | ||||
| @@ -100,6 +100,19 @@ public abstract class BaseSupport { | ||||
|     protected <T> R<T> successful(String msg, T data) { | ||||
|         return R.ok(msg, data); | ||||
|     } | ||||
|     /** | ||||
|      * <p> | ||||
|      * 请求成功 | ||||
|      * </p> | ||||
|      * @param code 正确码 | ||||
|      * @param msg  提示内容 | ||||
|      * @param data 数据内容 | ||||
|      * @param <T>  对象泛型 | ||||
|      * @return | ||||
|      */ | ||||
|     protected <T> R<T> successful(int code,String msg, T data) { | ||||
|         return R.ok(code,msg, data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * <p> | ||||
|   | ||||
| @@ -101,7 +101,7 @@ public class AlarmInfo extends Model<AlarmInfo> { | ||||
|     private String equipmentName; | ||||
|  | ||||
|     /** | ||||
|      * 报警类型		0窑炉,1表示车辆,依次类推 | ||||
|      * 报警类型		0工业炉,1表示车辆,依次类推 | ||||
|      */ | ||||
|     @TableField("type") | ||||
|     private Integer type; | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import java.time.LocalDateTime; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-29 | ||||
|  * @since 2022-01-05 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @@ -79,7 +79,7 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> { | ||||
|     private String idenCardNum; | ||||
|  | ||||
|     /** | ||||
|      * 硬度检验结果(合格、不合格、返工、作废) | ||||
|      * 硬度检验结果(待检验、合格、不合格、返工、作废) | ||||
|      */ | ||||
|     @TableField("hardness") | ||||
|     private String hardness; | ||||
| @@ -120,6 +120,90 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> { | ||||
|     @TableField("hardness_value_three") | ||||
|     private String hardnessValueThree; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 渗碳层深度 | ||||
|      */ | ||||
|     @TableField("metallography_stch_stccsd") | ||||
|     private Float metallographyStchStccsd; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 表面为马氏体、残余奥氏体(级) | ||||
|      */ | ||||
|     @TableField("metallography_stch_mstost") | ||||
|     private String metallographyStchMstost; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 细小颗粒状碳化物 | ||||
|      */ | ||||
|     @TableField("metallography_stch_xxklzthw") | ||||
|     private String metallographyStchXxklzthw; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级) | ||||
|      */ | ||||
|     @TableField("metallography_stch_dtmstyltst") | ||||
|     private String metallographyStchDtmstyltst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火马氏体(级) | ||||
|      */ | ||||
|     @TableField("metallography_ztch_hhmst") | ||||
|     private String metallographyZtchHhmst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火托式体(级) | ||||
|      */ | ||||
|     @TableField("metallography_ztch_hhtst") | ||||
|     private String metallographyZtchHhtst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火素式体(级) | ||||
|      */ | ||||
|     @TableField("metallography_ztch_hhsst") | ||||
|     private String metallographyZtchHhsst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 表面亮白色的为氮化合物层深 | ||||
|      */ | ||||
|     @TableField("metallography_dh_dhhwcs") | ||||
|     private Float metallographyDhDhhwcs; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 向内为扩散层深 | ||||
|      */ | ||||
|     @TableField("metallography_dh_kscs") | ||||
|     private Float metallographyDhKscs; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 心部 | ||||
|      */ | ||||
|     @TableField("metallography_dh_xb") | ||||
|     private String metallographyDhXb; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验表面淬火 表面为板条马氏体(级) | ||||
|      */ | ||||
|     @TableField("metallography_bmch_btmst") | ||||
|     private String metallographyBmchBtmst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验表面淬火 心部 | ||||
|      */ | ||||
|     @TableField("metallography_bmch_xb") | ||||
|     private String metallographyBmchXb; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验 备注 | ||||
|      */ | ||||
|     @TableField("metallography_bz") | ||||
|     private String metallographyBz; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验心部硬度 心部硬度检验结果 | ||||
|      */ | ||||
|     @TableField("metallography_xbyd_xbydjyjg") | ||||
|     private Float metallographyXbydXbydjyjg; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "id"; | ||||
|  | ||||
| @@ -153,6 +237,34 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> { | ||||
|  | ||||
|     public static final String HARDNESS_VALUE_THREE = "hardness_value_three"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_STCH_STCCSD = "metallography_stch_stccsd"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_STCH_MSTOST = "metallography_stch_mstost"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_STCH_XXKLZTHW = "metallography_stch_xxklzthw"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_STCH_DTMSTYLTST = "metallography_stch_dtmstyltst"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_ZTCH_HHMST = "metallography_ztch_hhmst"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_ZTCH_HHTST = "metallography_ztch_hhtst"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_ZTCH_HHSST = "metallography_ztch_hhsst"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_DH_DHHWCS = "metallography_dh_dhhwcs"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_DH_KSCS = "metallography_dh_kscs"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_DH_XB = "metallography_dh_xb"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_BMCH_BTMST = "metallography_bmch_btmst"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_BMCH_XB = "metallography_bmch_xb"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_BZ = "metallography_bz"; | ||||
|  | ||||
|     public static final String METALLOGRAPHY_XBYD_XBYDJYJG = "metallography_xbyd_xbydjyjg"; | ||||
|  | ||||
|     @Override | ||||
|     protected Serializable pkVal() { | ||||
|         return this.id; | ||||
|   | ||||
| @@ -91,13 +91,13 @@ public class CurrTask extends Model<CurrTask> { | ||||
|     private Long autoExeTaskId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id,关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id,关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉名称 | ||||
|      * 工业炉名称 | ||||
|      */ | ||||
|     @TableField("kiln_name") | ||||
|     private String kilnName; | ||||
| @@ -145,13 +145,13 @@ public class CurrTask extends Model<CurrTask> { | ||||
|     private String startPosition; | ||||
|  | ||||
|     /** | ||||
|      * 目标位置指的是窑炉的位置 | ||||
|      * 目标位置指的是工业炉的位置 | ||||
|      */ | ||||
|     @TableField("target_position") | ||||
|     private String targetPosition; | ||||
|  | ||||
|     /** | ||||
|      * 是否缓存,如果当前指的窑炉正在加工,系统自动分配货物到缓存位置,		      并且记录缓存库位,这是当指定窑炉加工完成后系统先判断是否当前缓存有当前等待执行的任务,然后按照先来先执行原则(等待多个任务)自动调用车辆来执行 | ||||
|      * 是否缓存,如果当前指的工业炉正在加工,系统自动分配货物到缓存位置,		      并且记录缓存库位,这是当指定工业炉加工完成后系统先判断是否当前缓存有当前等待执行的任务,然后按照先来先执行原则(等待多个任务)自动调用车辆来执行 | ||||
|      */ | ||||
|     @TableField("is_cache") | ||||
|     private Integer isCache; | ||||
| @@ -217,7 +217,7 @@ public class CurrTask extends Model<CurrTask> { | ||||
|     private String sheetNo; | ||||
|  | ||||
|     /** | ||||
|      * 任务类型:0:入库到窑炉,1:入库到缓存区,2出库到	窑炉到缓存区,3缓存区出库 | ||||
|      * 任务类型:0:入库到工业炉,1:入库到缓存区,2出库到	工业炉到缓存区,3缓存区出库 | ||||
|      */ | ||||
|     @TableField("task_type") | ||||
|     private Integer taskType; | ||||
| @@ -228,6 +228,12 @@ public class CurrTask extends Model<CurrTask> { | ||||
|     @TableField("process_type") | ||||
|     private Integer processType; | ||||
|  | ||||
|     /** | ||||
|      * 炉号 | ||||
|      */ | ||||
|     @TableField("stove_code") | ||||
|     private String stoveCode; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "id"; | ||||
|  | ||||
| @@ -297,6 +303,8 @@ public class CurrTask extends Model<CurrTask> { | ||||
|  | ||||
|     public static final String PROCESS_TYPE = "process_type"; | ||||
|  | ||||
|     public static final String STOVE_CODE = "stove_code"; | ||||
|  | ||||
|     @Override | ||||
|     protected Serializable pkVal() { | ||||
|         return this.id; | ||||
|   | ||||
| @@ -95,13 +95,13 @@ public class InStockInfo extends Model<InStockInfo> { | ||||
|     private Long taskId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id ,if(status == 0){从窑炉出来等待库存} else if(status == 1){到目标窑炉前缓存到库位}关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id ,if(status == 0){从工业炉出来等待库存} else if(status == 1){到目标工业炉前缓存到库位}关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉名称 | ||||
|      * 工业炉名称 | ||||
|      */ | ||||
|     @TableField("kiln_name") | ||||
|     private String kilnName; | ||||
| @@ -125,7 +125,7 @@ public class InStockInfo extends Model<InStockInfo> { | ||||
|     private String palletCode; | ||||
|  | ||||
|     /** | ||||
|      * 类型:	0等待出库,1到窑炉前缓存,2插单任务缓存 | ||||
|      * 类型:	0等待出库,1到工业炉前缓存,2插单任务缓存 | ||||
|      */ | ||||
|     @TableField("type") | ||||
|     private Integer type; | ||||
|   | ||||
| @@ -95,13 +95,13 @@ public class InStockInfoHis extends Model<InStockInfoHis> { | ||||
|     private Integer taskId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id ,if(status == 0){从窑炉出来等待库存} else if(status == 1){到目标窑炉前缓存到库位}关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id ,if(status == 0){从工业炉出来等待库存} else if(status == 1){到目标工业炉前缓存到库位}关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Integer kilnId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉名称 | ||||
|      * 工业炉名称 | ||||
|      */ | ||||
|     @TableField("kiln_name") | ||||
|     private String kilnName; | ||||
| @@ -125,7 +125,7 @@ public class InStockInfoHis extends Model<InStockInfoHis> { | ||||
|     private String palletCode; | ||||
|  | ||||
|     /** | ||||
|      * 类型:	0等待出库,1到窑炉前缓存,2插单任务缓存 | ||||
|      * 类型:	0等待出库,1到工业炉前缓存,2插单任务缓存 | ||||
|      */ | ||||
|     @TableField("type") | ||||
|     private Integer type; | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉信息 | ||||
|  * 工业炉信息 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
| @@ -95,13 +95,13 @@ public class KilnInfo extends Model<KilnInfo> { | ||||
|     private Integer factoryId; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉名称 建议与AMPS相同 | ||||
|      * 工业炉名称 建议与AMPS相同 | ||||
|      */ | ||||
|     @TableField("kiln_name") | ||||
|     private String kilnName; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉别名 | ||||
|      * 工业炉别名 | ||||
|      */ | ||||
|     @TableField("kiln_alias") | ||||
|     private String kilnAlias; | ||||
|   | ||||
| @@ -97,7 +97,7 @@ public class OrderInfo extends Model<OrderInfo> { | ||||
|     private String orderNo; | ||||
|  | ||||
|     /** | ||||
|      * 原订单号,APMS系统获取 返单时才存在 | ||||
|      * 原订单号(对应原先的标识卡号),APMS系统获取 返单时才存在 | ||||
|      */ | ||||
|     @TableField("old_order_no") | ||||
|     private String oldOrderNo; | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉电能参数值 | ||||
|  * 工业炉电能参数值 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
| @@ -50,7 +50,7 @@ public class ParEleValue extends Model<ParEleValue> { | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id,关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id,关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉使用气检测值 | ||||
|  * 工业炉使用气检测值 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
| @@ -50,7 +50,7 @@ public class ParGasValue extends Model<ParGasValue> { | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id,关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id,关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉运转速度 | ||||
|  * 工业炉运转速度 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
| @@ -50,7 +50,7 @@ public class ParRotSpeedValue extends Model<ParRotSpeedValue> { | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id,关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id,关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉温度监控 | ||||
|  * 工业炉温度监控 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
| @@ -50,7 +50,7 @@ public class ParTemValue extends Model<ParTemValue> { | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|      * 窑炉id,关联设备窑炉表:t_kiln_info | ||||
|      * 工业炉id,关联设备工业炉表:t_kiln_info | ||||
|      */ | ||||
|     @TableField("kiln_id") | ||||
|     private Long kilnId; | ||||
|   | ||||
| @@ -45,7 +45,7 @@ public class PointInfo extends Model<PointInfo> { | ||||
|     private String name; | ||||
|  | ||||
|     /** | ||||
|      * 点位说明;关联对应表数据的code,窑炉code,库位code等等 | ||||
|      * 点位说明;关联对应表数据的code,工业炉code,库位code等等 | ||||
|      */ | ||||
|     @TableField("note") | ||||
|     private String note; | ||||
|   | ||||
| @@ -0,0 +1,149 @@ | ||||
| package com.mt.wms.core.dal.entity; | ||||
|  | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.baomidou.mybatisplus.annotation.IdType; | ||||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | ||||
| import com.baomidou.mybatisplus.annotation.Version; | ||||
| import com.baomidou.mybatisplus.annotation.TableId; | ||||
| import java.time.LocalDateTime; | ||||
| import com.baomidou.mybatisplus.annotation.TableLogic; | ||||
| 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-08-11 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @TableName("t_question_answer") | ||||
| public class QuestionAnswer extends Model<QuestionAnswer> { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|       @TableId(value = "id", type = IdType.AUTO) | ||||
|     private Long id; | ||||
|  | ||||
|     /** | ||||
|      * 删除标志,是否有效:1 可用 0不可用 | ||||
|      */ | ||||
|     @TableField("valid") | ||||
|     @TableLogic | ||||
|     private Integer valid; | ||||
|  | ||||
|     /** | ||||
|      * 添加时间 | ||||
|      */ | ||||
|     @TableField("create_time") | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
|     /** | ||||
|      * 创建人id | ||||
|      */ | ||||
|     @TableField("creator_id") | ||||
|     private Integer creatorId; | ||||
|  | ||||
|     /** | ||||
|      * 更新人id | ||||
|      */ | ||||
|     @TableField("updater_id") | ||||
|     private Integer updaterId; | ||||
|  | ||||
|     /** | ||||
|      * 修改时间 | ||||
|      */ | ||||
|     @TableField("update_time") | ||||
|     private LocalDateTime updateTime; | ||||
|  | ||||
|     /** | ||||
|      * 版本号 默认为 1 | ||||
|      */ | ||||
|     @TableField("version") | ||||
|     @Version | ||||
|     private String version; | ||||
|  | ||||
|     /** | ||||
|      * 状态		0初始化 | ||||
|      */ | ||||
|     @TableField("status") | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|      * 内部编码 | ||||
|      */ | ||||
|     @TableField("inter_code") | ||||
|     private String interCode; | ||||
|  | ||||
|     /** | ||||
|      * 编码 | ||||
|      */ | ||||
|     @TableField("code") | ||||
|     private String code; | ||||
|  | ||||
|     /** | ||||
|      * 问题 | ||||
|      */ | ||||
|     @TableField("question") | ||||
|     private String question; | ||||
|  | ||||
|     /** | ||||
|      * 解答 | ||||
|      */ | ||||
|     @TableField("answer") | ||||
|     private String answer; | ||||
|  | ||||
|     /** | ||||
|      * 描述信息 | ||||
|      */ | ||||
|     @TableField("description") | ||||
|     private String description; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|     @TableField("note") | ||||
|     private String note; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "id"; | ||||
|  | ||||
|     public static final String VALID = "valid"; | ||||
|  | ||||
|     public static final String CREATE_TIME = "create_time"; | ||||
|  | ||||
|     public static final String CREATOR_ID = "creator_id"; | ||||
|  | ||||
|     public static final String UPDATER_ID = "updater_id"; | ||||
|  | ||||
|     public static final String UPDATE_TIME = "update_time"; | ||||
|  | ||||
|     public static final String VERSION = "version"; | ||||
|  | ||||
|     public static final String STATUS = "status"; | ||||
|  | ||||
|     public static final String INTER_CODE = "inter_code"; | ||||
|  | ||||
|     public static final String CODE = "code"; | ||||
|  | ||||
|     public static final String QUESTION = "question"; | ||||
|  | ||||
|     public static final String ANSWER = "answer"; | ||||
|  | ||||
|     public static final String DESCRIPTION = "description"; | ||||
|  | ||||
|     public static final String NOTE = "note"; | ||||
|  | ||||
|     @Override | ||||
|     protected Serializable pkVal() { | ||||
|         return this.id; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -91,8 +91,8 @@ public class TaskDetHis extends Model<TaskDetHis> { | ||||
|     /** | ||||
|      * 历史任务id,关联当前任务表:t_task_his | ||||
|      */ | ||||
|     @TableField("task_id") | ||||
|     private Long taskId; | ||||
|     @TableField("curr_task_id") | ||||
|     private Long currTaskId; | ||||
|  | ||||
|     /** | ||||
|      * 订单号 | ||||
| @@ -163,7 +163,7 @@ public class TaskDetHis extends Model<TaskDetHis> { | ||||
|  | ||||
|     public static final String TASK_CODE = "task_code"; | ||||
|  | ||||
|     public static final String TASK_ID = "task_id"; | ||||
|     public static final String CURR_TASK_ID = "curr_task_id"; | ||||
|  | ||||
|     public static final String ORDER_NO = "order_no"; | ||||
|  | ||||
|   | ||||
| @@ -1,21 +1,25 @@ | ||||
| package com.mt.wms.core.dal.entity; | ||||
|  | ||||
| import com.baomidou.mybatisplus.annotation.*; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.baomidou.mybatisplus.annotation.IdType; | ||||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | ||||
| import com.baomidou.mybatisplus.annotation.Version; | ||||
| import com.baomidou.mybatisplus.annotation.TableId; | ||||
| import java.time.LocalDateTime; | ||||
| import com.baomidou.mybatisplus.annotation.TableLogic; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import java.io.Serializable; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 任务历史表 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-14 | ||||
|  * @since 2022-08-01 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @@ -228,6 +232,17 @@ public class TaskHis extends Model<TaskHis> { | ||||
|     @TableField("sheet_no") | ||||
|     private String sheetNo; | ||||
|  | ||||
|     /** | ||||
|      * 生产单号 APMS生成生产单后返回 | ||||
|      */ | ||||
|     @TableField("task_id") | ||||
|     private Long taskId; | ||||
|  | ||||
|     /** | ||||
|      * 炉号 | ||||
|      */ | ||||
|     @TableField("stove_code") | ||||
|     private String stoveCode; | ||||
|  | ||||
|     public static final String ID = "id"; | ||||
|  | ||||
| @@ -297,6 +312,10 @@ public class TaskHis extends Model<TaskHis> { | ||||
|  | ||||
|     public static final String SHEET_NO = "sheet_no"; | ||||
|  | ||||
|     public static final String TASK_ID = "task_id"; | ||||
|  | ||||
|     public static final String STOVE_CODE = "stove_code"; | ||||
|  | ||||
|     @Override | ||||
|     protected Serializable pkVal() { | ||||
|         return this.id; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-29 | ||||
|  * @since 2022-01-05 | ||||
|  */ | ||||
| public interface ApmsCheckResultMapper extends BaseMapper<ApmsCheckResult> { | ||||
|  | ||||
|   | ||||
| @@ -20,12 +20,30 @@ | ||||
|         <result column="hardness_value_one" property="hardnessValueOne"/> | ||||
|         <result column="hardness_value_two" property="hardnessValueTwo"/> | ||||
|         <result column="hardness_value_three" property="hardnessValueThree"/> | ||||
|         <result column="metallography_stch_stccsd" property="metallographyStchStccsd"/> | ||||
|         <result column="metallography_stch_mstost" property="metallographyStchMstost"/> | ||||
|         <result column="metallography_stch_xxklzthw" property="metallographyStchXxklzthw"/> | ||||
|         <result column="metallography_stch_dtmstyltst" property="metallographyStchDtmstyltst"/> | ||||
|         <result column="metallography_ztch_hhmst" property="metallographyZtchHhmst"/> | ||||
|         <result column="metallography_ztch_hhtst" property="metallographyZtchHhtst"/> | ||||
|         <result column="metallography_ztch_hhsst" property="metallographyZtchHhsst"/> | ||||
|         <result column="metallography_dh_dhhwcs" property="metallographyDhDhhwcs"/> | ||||
|         <result column="metallography_dh_kscs" property="metallographyDhKscs"/> | ||||
|         <result column="metallography_dh_xb" property="metallographyDhXb"/> | ||||
|         <result column="metallography_bmch_btmst" property="metallographyBmchBtmst"/> | ||||
|         <result column="metallography_bmch_xb" property="metallographyBmchXb"/> | ||||
|         <result column="metallography_bz" property="metallographyBz"/> | ||||
|         <result column="metallography_xbyd_xbydjyjg" property="metallographyXbydXbydjyjg"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- 通用查询结果列 --> | ||||
|     <sql id="Base_Column_List"> | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, sheet_no, iden_card_num, hardness, | ||||
|         metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three | ||||
|         metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three, | ||||
|         metallography_stch_stccsd, metallography_stch_mstost, metallography_stch_xxklzthw, | ||||
|         metallography_stch_dtmstyltst, metallography_ztch_hhmst, metallography_ztch_hhtst, metallography_ztch_hhsst, | ||||
|         metallography_dh_dhhwcs, metallography_dh_kscs, metallography_dh_xb, metallography_bmch_btmst, | ||||
|         metallography_bmch_xb, metallography_bz, metallography_xbyd_xbydjyjg | ||||
|     </sql> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉信息 Mapper 接口 | ||||
|  * 工业炉信息 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉电能参数值 Mapper 接口 | ||||
|  * 工业炉电能参数值 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉使用气检测值 Mapper 接口 | ||||
|  * 工业炉使用气检测值 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉运转速度 Mapper 接口 | ||||
|  * 工业炉运转速度 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉温度监控 Mapper 接口 | ||||
|  * 工业炉温度监控 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -0,0 +1,16 @@ | ||||
| package com.mt.wms.core.dal.mapper; | ||||
|  | ||||
| import com.mt.wms.core.dal.entity.QuestionAnswer; | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 问题解答表 Mapper 接口 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2022-08-11 | ||||
|  */ | ||||
| public interface QuestionAnswerMapper extends BaseMapper<QuestionAnswer> { | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,28 @@ | ||||
| <?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.QuestionAnswerMapper"> | ||||
|  | ||||
|     <!-- 通用查询映射结果 --> | ||||
|     <resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.QuestionAnswer"> | ||||
|         <id column="id" property="id" /> | ||||
|         <result column="valid" property="valid" /> | ||||
|         <result column="create_time" property="createTime" /> | ||||
|         <result column="creator_id" property="creatorId" /> | ||||
|         <result column="updater_id" property="updaterId" /> | ||||
|         <result column="update_time" property="updateTime" /> | ||||
|         <result column="version" property="version" /> | ||||
|         <result column="status" property="status" /> | ||||
|         <result column="inter_code" property="interCode" /> | ||||
|         <result column="code" property="code" /> | ||||
|         <result column="question" property="question" /> | ||||
|         <result column="answer" property="answer" /> | ||||
|         <result column="description" property="description" /> | ||||
|         <result column="note" property="note" /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- 通用查询结果列 --> | ||||
|     <sql id="Base_Column_List"> | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, question, answer, description, note | ||||
|     </sql> | ||||
|  | ||||
| </mapper> | ||||
| @@ -14,7 +14,7 @@ | ||||
|         <result column="status" property="status" /> | ||||
|         <result column="inter_code" property="interCode" /> | ||||
|         <result column="task_code" property="taskCode" /> | ||||
|         <result column="task_id" property="taskId" /> | ||||
|         <result column="curr_task_id" property="currTaskId" /> | ||||
|         <result column="order_no" property="orderNo" /> | ||||
|         <result column="iden_card_num" property="idenCardNum" /> | ||||
|         <result column="product_name" property="productName" /> | ||||
| @@ -27,7 +27,7 @@ | ||||
|  | ||||
|     <!-- 通用查询结果列 --> | ||||
|     <sql id="Base_Column_List"> | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, task_id, order_no, iden_card_num, product_name, material_des, craft_ill, unit, weight, quantity | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, curr_task_id, order_no, iden_card_num, product_name, material_des, craft_ill, unit, weight, quantity | ||||
|     </sql> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-14 | ||||
|  * @since 2022-08-01 | ||||
|  */ | ||||
| public interface TaskHisMapper extends BaseMapper<TaskHis> { | ||||
|  | ||||
|   | ||||
| @@ -25,27 +25,25 @@ | ||||
|         <result column="run_task_id" property="runTaskId" /> | ||||
|         <result column="start_position" property="startPosition" /> | ||||
|         <result column="target_position" property="targetPosition" /> | ||||
|         <result column="is_cache" property="isCache"/> | ||||
|         <result column="cache_satatus" property="cacheSatatus"/> | ||||
|         <result column="cache_run_task_id" property="cacheRunTaskId"/> | ||||
|         <result column="location_id" property="locationId"/> | ||||
|         <result column="location_name" property="locationName"/> | ||||
|         <result column="is_out" property="isOut"/> | ||||
|         <result column="out_run_task_id" property="outRunTaskId"/> | ||||
|         <result column="out_start_position" property="outStartPosition"/> | ||||
|         <result column="out_target_position" property="outTargetPosition"/> | ||||
|         <result column="task_code" property="taskCode"/> | ||||
|         <result column="process_type" property="processType"/> | ||||
|         <result column="task_type" property="taskType"/> | ||||
|         <result column="sheet_no" property="sheetNo"/> | ||||
|         <result column="is_cache" property="isCache" /> | ||||
|         <result column="cache_satatus" property="cacheSatatus" /> | ||||
|         <result column="cache_run_task_id" property="cacheRunTaskId" /> | ||||
|         <result column="location_id" property="locationId" /> | ||||
|         <result column="location_name" property="locationName" /> | ||||
|         <result column="is_out" property="isOut" /> | ||||
|         <result column="out_run_task_id" property="outRunTaskId" /> | ||||
|         <result column="out_start_position" property="outStartPosition" /> | ||||
|         <result column="out_target_position" property="outTargetPosition" /> | ||||
|         <result column="task_code" property="taskCode" /> | ||||
|         <result column="process_type" property="processType" /> | ||||
|         <result column="task_type" property="taskType" /> | ||||
|         <result column="sheet_no" property="sheetNo" /> | ||||
|         <result column="task_id" property="taskId" /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- 通用查询结果列 --> | ||||
|     <sql id="Base_Column_List"> | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, is_auto, | ||||
|         auto_exe_task_id, kiln_id, kiln_name, craft_code_id, plc_value, begin_time, end_time, is_in, run_task_id, | ||||
|         start_position, target_position, is_cache, cache_satatus, cache_run_task_id, location_id, location_name, is_out, | ||||
|         out_run_task_id, out_start_position, out_target_position, task_code, process_type, task_type, sheet_no | ||||
|         id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, is_auto, auto_exe_task_id, kiln_id, kiln_name, craft_code_id, plc_value, begin_time, end_time, is_in, run_task_id, start_position, target_position, is_cache, cache_satatus, cache_run_task_id, location_id, location_name, is_out, out_run_task_id, out_start_position, out_target_position, task_code, process_type, task_type, sheet_no, task_id | ||||
|     </sql> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-29 | ||||
|  * @since 2022-01-05 | ||||
|  */ | ||||
| public interface ApmsCheckResultServiceBiz extends IService<ApmsCheckResult> { | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉信息 服务类 | ||||
|  * 工业炉信息 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉电能参数值 服务类 | ||||
|  * 工业炉电能参数值 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉使用气检测值 服务类 | ||||
|  * 工业炉使用气检测值 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉运转速度 服务类 | ||||
|  * 工业炉运转速度 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉温度监控 服务类 | ||||
|  * 工业炉温度监控 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -0,0 +1,16 @@ | ||||
| package com.mt.wms.core.dal.service; | ||||
|  | ||||
| import com.mt.wms.core.dal.entity.QuestionAnswer; | ||||
| import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 问题解答表 服务类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2022-08-11 | ||||
|  */ | ||||
| public interface QuestionAnswerServiceBiz extends IService<QuestionAnswer> { | ||||
|  | ||||
| } | ||||
| @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-14 | ||||
|  * @since 2022-08-01 | ||||
|  */ | ||||
| public interface TaskHisServiceBiz extends IService<TaskHis> { | ||||
|  | ||||
|   | ||||
| @@ -12,7 +12,7 @@ import org.springframework.stereotype.Service; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-29 | ||||
|  * @since 2022-01-05 | ||||
|  */ | ||||
| @Service | ||||
| public class ApmsCheckResultServiceBizImpl extends ServiceImpl<ApmsCheckResultMapper, ApmsCheckResult> implements ApmsCheckResultServiceBiz { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉信息 服务实现类 | ||||
|  * 工业炉信息 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉电能参数值 服务实现类 | ||||
|  * 工业炉电能参数值 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉使用气检测值 服务实现类 | ||||
|  * 工业炉使用气检测值 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉运转速度 服务实现类 | ||||
|  * 工业炉运转速度 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 窑炉温度监控 服务实现类 | ||||
|  * 工业炉温度监控 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|   | ||||
| @@ -0,0 +1,20 @@ | ||||
| package com.mt.wms.core.dal.service.impl; | ||||
|  | ||||
| import com.mt.wms.core.dal.entity.QuestionAnswer; | ||||
| import com.mt.wms.core.dal.mapper.QuestionAnswerMapper; | ||||
| import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
|  * 问题解答表 服务实现类 | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2022-08-11 | ||||
|  */ | ||||
| @Service | ||||
| public class QuestionAnswerServiceBizImpl extends ServiceImpl<QuestionAnswerMapper, QuestionAnswer> implements QuestionAnswerServiceBiz { | ||||
|  | ||||
| } | ||||
| @@ -12,7 +12,7 @@ import org.springframework.stereotype.Service; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author mt | ||||
|  * @since 2021-12-14 | ||||
|  * @since 2022-08-01 | ||||
|  */ | ||||
| @Service | ||||
| public class TaskHisServiceBizImpl extends ServiceImpl<TaskHisMapper, TaskHis> implements TaskHisServiceBiz { | ||||
|   | ||||
| @@ -36,6 +36,24 @@ public class CodeGeneratorHelper { | ||||
|      * 自动任务编码 | ||||
|      */ | ||||
|     public static final String AUTO_TASK_CODE = "AUTO_TASK_CODE"; | ||||
|  | ||||
|     /** | ||||
|      * 炉号编码 | ||||
|      */ | ||||
|     public static final String STOVE_CODE = "STOVE_CODE"; | ||||
|  | ||||
|     /** | ||||
|      * 生成自炉号编码 | ||||
|      * | ||||
|      * @return 订单编号 | ||||
|      */ | ||||
|     public static String getStoveCode(String kilnNameAndCraft) { | ||||
|         return IDGenerator.gen(kilnNameAndCraft, "yyMMdd", 2, STOVE_CODE); | ||||
|     } | ||||
|  | ||||
|     public static String getStoveCode(String kilnName,String craft) { | ||||
|         return IDGenerator.gen(kilnName+"-"+craft+"-", "yyMMdd", 4,kilnName); | ||||
|     } | ||||
|     /** | ||||
|      * 生成自动任务编码 | ||||
|      * | ||||
|   | ||||
| @@ -48,9 +48,9 @@ public class HttpClient { | ||||
|  | ||||
|     public static String httpPost(String url, String json) throws IOException { | ||||
|         //OkHttpClient httpClient = new OkHttpClient(); | ||||
|         OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.SECONDS) | ||||
|                 .writeTimeout(60*30, TimeUnit.SECONDS) | ||||
|                 .readTimeout(60*30, TimeUnit.SECONDS) | ||||
|         OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.MINUTES) | ||||
|                 .writeTimeout(60*300, TimeUnit.SECONDS) | ||||
|                 .readTimeout(60*300, TimeUnit.SECONDS) | ||||
|                 .build(); | ||||
|         RequestBody requestBody = RequestBody.create(JSON, json); | ||||
|         Request request = new Request.Builder() | ||||
|   | ||||
| @@ -11,10 +11,8 @@ import org.springframework.stereotype.Component; | ||||
| import javax.annotation.PostConstruct; | ||||
| import java.text.DecimalFormat; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| /** | ||||
|  * id生成器,使用redis自增接口实现 | ||||
| @@ -153,6 +151,13 @@ public class IDGenerator { | ||||
|         } | ||||
|         if (!isEmpty(sequenceName)) { | ||||
|             long sequence = gen(sequenceName); | ||||
|             //设置key有效期为当天,次日凌晨失效 | ||||
|             Calendar curDate = Calendar.getInstance(); | ||||
|             Calendar tomorrowDate = new GregorianCalendar(curDate.get(Calendar.YEAR), curDate.get(Calendar.MONTH), curDate.get(Calendar.DATE) + 1, 0, 0, 0); | ||||
|             int second = (int)(tomorrowDate.getTimeInMillis() - curDate.getTimeInMillis()) / 1000; | ||||
|             idGenerator.redisTemplate.opsForValue().set(KEY_PREFIX_SEQUENCE + sequenceName, sequence, second, TimeUnit.SECONDS); | ||||
|             idGenerator.redisTemplate.opsForValue().getOperations(); | ||||
|  | ||||
|             if (sequenceLength > 0) { | ||||
|                 if (sequenceLength > MAX_SEQUENCE_LENGTH) { | ||||
|                     sequenceLength = MAX_SEQUENCE_LENGTH; | ||||
|   | ||||
| @@ -99,5 +99,8 @@ public class R<T> implements Serializable { | ||||
|     public static <T> R<T> ok(String msg, T data) { | ||||
|         return new R<T>().msg(msg).data(data); | ||||
|     } | ||||
|     public static <T> R<T> ok(int code,String msg, T data) { | ||||
|         return new R<T>().code(code).msg(msg).data(data); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse; | ||||
| import cn.hutool.http.HttpUtil; | ||||
| import cn.hutool.json.JSON; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.mt.wms.core.base.BaseController; | ||||
| import com.mt.wms.core.constants.CommonConstant; | ||||
| import com.mt.wms.core.dal.entity.CommunicationLog; | ||||
| @@ -17,6 +18,7 @@ import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo; | ||||
| import com.mt.wms.empty.vo.ApmsEndProcessVo; | ||||
| import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo; | ||||
| import com.mt.wms.empty.vo.ApmsStoveVo; | ||||
| import com.mt.wms.empty.websocket.WebSocketServer; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| @@ -27,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.io.IOException; | ||||
| import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.HashMap; | ||||
| @@ -46,11 +50,12 @@ public class ApmsController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private CommunicationLogServiceBiz communicationLogServiceBiz; | ||||
|     @Autowired | ||||
|     private WebSocketServer webSocketServer; | ||||
|  | ||||
|     //    static String Token = "eyJhbGciOiJIUzI1NiJ9.eyJkYXRlIjozMTkyNzU4NDk4ODA3LCJwbGF0Rm9ybUlkIjoyLCJhcGlLZXkiOiI3ZWU4ZjU5YmJhZWFlMjdlIiwiZXhwIjozMTkyNzU4NDk4LCJpYXQiOjE2Mzc1NTg0OTh9.RH3MRQr1dCBYW996-WXN69eXu1ZFblAQHfhZHNbTmCg"; | ||||
|     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推送订单信息") | ||||
| @@ -135,9 +140,20 @@ public class ApmsController extends BaseController { | ||||
|         communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body()); | ||||
|         setCommonField(communicationLog); | ||||
|         communicationLogServiceBiz.save(communicationLog); | ||||
|         String body = response.body(); | ||||
|         JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(body); | ||||
|         Object success = jsonObject.get("success"); | ||||
|         if (status == 200) | ||||
|         { | ||||
|             return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class)); | ||||
|             ApmsCreateProcessSheetVo apmsCreateProcessSheetVo = JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class); | ||||
|             if (!apmsCreateProcessSheetVo.getSuccess()){ | ||||
|                 try { | ||||
|                     webSocketServer.sendtoAll(apmsCreateProcessSheetVo.getMsg()); | ||||
|                 } catch (IOException e) { | ||||
|                     e.printStackTrace(); | ||||
|                 } | ||||
|             } | ||||
|             return successful(apmsCreateProcessSheetVo); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|   | ||||
| @@ -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); | ||||
|     } | ||||
| } | ||||
| @@ -2,6 +2,7 @@ package com.mt.wms.empty.controller; | ||||
|  | ||||
| import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.mt.wms.basic.service.KilnInfoService; | ||||
| import com.mt.wms.basic.vo.KilnInfoVo; | ||||
| import com.mt.wms.core.base.BaseController; | ||||
| @@ -21,10 +22,9 @@ 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; | ||||
| import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo; | ||||
| import com.mt.wms.empty.vo.ApmsStoveVo; | ||||
| import com.mt.wms.empty.vo.CurrTaskMainQueryVo; | ||||
| import com.mt.wms.empty.vo.CurrTaskQueryVo; | ||||
| import com.mt.wms.empty.task.StoveCodeUtils; | ||||
| import com.mt.wms.empty.task.TaskDistanceUtils; | ||||
| import com.mt.wms.empty.vo.*; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| @@ -66,6 +66,8 @@ public class CurrTaskController extends BaseController { | ||||
|     private CurrTaskServiceBiz currTaskServiceBiz; | ||||
|     @Autowired | ||||
|     private AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|     @Autowired | ||||
|     private TaskDistanceUtils taskDistanceUtils; | ||||
|  | ||||
|  | ||||
|     @PostMapping(value = "createProcessTask") | ||||
| @@ -84,26 +86,23 @@ public class CurrTaskController extends BaseController { | ||||
|         stoveCodes.forEach(kilnMap -> { | ||||
|             codeStr.add(kilnMap.get("code")); | ||||
|         }); | ||||
|         for (String s : codeStr) | ||||
|         { | ||||
|             if (s.equals(kilnCode)) | ||||
|             { | ||||
|         for (String s : codeStr) { | ||||
|             if (s.equals(kilnCode)) { | ||||
|                 verifyCodes = true; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         if (!verifyCodes) | ||||
|         { | ||||
|         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()); | ||||
|         //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"); | ||||
|         //apmsCreateSheet.setStartUser("QJJP03"); | ||||
|         ArrayList<CreateItem> createItems = new ArrayList<>(); | ||||
|         param.getDetParams().forEach(e -> { | ||||
|             CreateItem createItem = new CreateItem(); | ||||
| @@ -112,37 +111,45 @@ public class CurrTaskController extends BaseController { | ||||
|             createItem.setWeight(e.getWeight().doubleValue()); | ||||
|             createItems.add(createItem); | ||||
|         }); | ||||
|         apmsCreateSheet.setStoveCode(kilnCode); | ||||
|         apmsCreateSheet.setItems(createItems); | ||||
|         R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); | ||||
|         //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()); | ||||
|             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()); | ||||
|         } | ||||
|         //if (processSheet.getData().getSuccess()) | ||||
|         //{ | ||||
|         //apms创建成功后写入数据库 | ||||
|         param.setAutoTaskType(0); | ||||
|         R<IdVo> mainTask = currTaskService.createProcessTask(param); | ||||
|         currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId()); | ||||
|         //String sheetNo = processSheet.getData().getSheetNo(); | ||||
|         //将返回的生产单号写入到主任务中。 | ||||
|         //CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); | ||||
|         //currTaskById.setSheetNo(sheetNo); | ||||
|         //currTaskService.updateCurrTaskById(currTaskById); | ||||
|         //生成详细任务中的检验结果数据在apms推送生产单结果时创建 | ||||
|         return successful(0, "创建成功,任务添加至等待执行队列。详情请在订单加工管理下当前任务列表查看", ""); | ||||
|         //} | ||||
|         //else | ||||
|         //{ | ||||
|         //    return failed("创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
|         //} | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "createAutoTask") | ||||
|     @ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列") | ||||
|     public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){ | ||||
|     public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam) { | ||||
|         List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList(); | ||||
|         Boolean apmsCreateProcessSheet = false; | ||||
|         String sheetNo = null; | ||||
|         int i = 1; | ||||
|         R<ApmsCreateProcessSheetVo> processSheet = null; | ||||
|         //自动任务循环添加多条currTask | ||||
|         AutoExeTask autoExeTask=new AutoExeTask(); | ||||
|         for (TaskCreateParam param:detParams | ||||
|              ) { | ||||
|         AutoExeTask autoExeTask = new AutoExeTask(); | ||||
|         for (TaskCreateParam param : detParams | ||||
|         ) { | ||||
|             if(param.getDetParams().size()==0){ | ||||
|                 return failed("请添加至少一个标识卡!"); | ||||
|             } | ||||
|             //验证标识卡号正确无误。 | ||||
|             orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams()); | ||||
|             //验证炉子编码信息在apms正确无误 | ||||
| @@ -156,92 +163,95 @@ public class CurrTaskController extends BaseController { | ||||
|             stoveCodes.forEach(kilnMap -> { | ||||
|                 codeStr.add(kilnMap.get("code")); | ||||
|             }); | ||||
|             for (String s : codeStr) | ||||
|             { | ||||
|                 if (s.equals(kilnCode)) | ||||
|                 { | ||||
|             for (String s : codeStr) { | ||||
|                 if (s.equals(kilnCode)) { | ||||
|                     verifyCodes = true; | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|             if (!verifyCodes) | ||||
|             { | ||||
|             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("创建成功,任务添加至等待执行队列。"); | ||||
|  | ||||
| /* | ||||
|             if (i==1){ | ||||
|                 //通知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); | ||||
|                  processSheet = apmsControl.createProcessSheet(apmsCreateSheet); | ||||
|                 apmsCreateProcessSheet=processSheet.getData().getSuccess(); | ||||
|                 sheetNo=processSheet.getData().getSheetNo(); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 return failed("创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
| */ | ||||
|  | ||||
|             //if (apmsCreateProcessSheet) | ||||
|             //{ | ||||
|             //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); | ||||
|             } | ||||
|             //将返回的生产单号写入到主任务中。 | ||||
|             CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); | ||||
|             //currTaskById.setSheetNo(sheetNo); | ||||
|             currTaskById.setAutoExeTaskId(autoExeTask.getId()); | ||||
|             currTaskService.updateCurrTaskById(currTaskById); | ||||
|             //生成详细任务中的检验结果数据在apms推送生产单结果时创建 | ||||
|             //return successful("创建成功,任务添加至等待执行队列。"); | ||||
|  | ||||
|             //} | ||||
|             //else | ||||
|             //{ | ||||
|             //    return failed("创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
|             //} | ||||
|             //i++; | ||||
|         } | ||||
|         return null; | ||||
|         return successful(0, "操作成功,任务加入待执行队列,详情请在订单加工管理下当前任务列表查看!", ""); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "mainCurrentTaskNow") | ||||
| @@ -251,11 +261,35 @@ public class CurrTaskController extends BaseController { | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "currentTaskNow") | ||||
|     @ApiOperation(value = "获取当前执行的任务 (车辆名称传id)") | ||||
|     @ApiOperation(value = "获取当前执行的任务") | ||||
|     public R<PageVo<CurrTaskQueryVo>> currentTask(@Validated @RequestBody CurrTaskQueryParam param) { | ||||
|         return currTaskService.currentTaskPage(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "currentTaskInfo") | ||||
|     @ApiOperation(value = "获取当前任务列表以及详情") | ||||
|     public R<List<CurrTaskInfoVo>> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) { | ||||
|         return currTaskService.currentTaskInfoPage(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "taskInfoNotToApms") | ||||
|     @ApiOperation(value = "获取未报工任务列表以及详情") | ||||
|     public R<List<CurrTaskInfoVo>> taskInfoNotToApms(@Validated @RequestBody CurrTaskQueryParam param) { | ||||
|         return currTaskService.currentTaskInfoPageForNotToApms(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "oneStepToApms") | ||||
|     @ApiOperation(value = "手动报工") | ||||
|     public R<String> oneStepToApms(@Validated @RequestBody CurrTaskInfoVo currTaskInfoVo) { | ||||
|         return currTaskService.oneStepToApms(currTaskInfoVo); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "updateCurrTaskStatus") | ||||
|     @ApiOperation(value = "更新任务状态") | ||||
|     public R<String> updateCurrTaskStatus(@Validated @RequestBody CurrTaskParam param) { | ||||
|         return currTaskService.updateCurrTaskStatus(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "completeTask") | ||||
|     @ApiOperation(value = "执行任务完成(仅wms,不通知apms)") | ||||
|     public R<String> completeTask(@Validated @RequestBody IdParam param) { | ||||
| @@ -264,13 +298,72 @@ public class CurrTaskController extends BaseController { | ||||
|  | ||||
|     @PostMapping(value = "deleteBySheetNo") | ||||
|     @ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)") | ||||
|     public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) { | ||||
|         return currTaskService.deleteBySheetNo(sheetNo); | ||||
|     public R<String> deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) { | ||||
|         return currTaskService.deleteBySheetNo(param.getSheetNo()); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "deleteById") | ||||
|     @ApiOperation(value = "人工id删除未正式开始的生产单") | ||||
|     public R<String> deleteById(@Validated @RequestBody IdParam param) { | ||||
|         return currTaskService.deleteById(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "top") | ||||
|     @ApiOperation(value = "置顶该任务") | ||||
|     public R<String> top(@Validated @RequestBody IdParam param) { | ||||
|         return currTaskService.top(param); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "runTask") | ||||
|     @ApiOperation(value = "执行任务") | ||||
|     public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException { | ||||
|         //点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时) | ||||
|         return currTaskService.runTask(param.getId()); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "testRunTask") | ||||
|     @ApiOperation(value = "执行任务") | ||||
|     public R<String> testRunTask(@RequestBody RGVTask rgvTask) { | ||||
|         sendTaskToRgv(rgvTask.getTaskType(), rgvTask.getVehicleId(), rgvTask.getTaskNo(), rgvTask.getPickRow(), rgvTask.getSendRow(), rgvTask.getProcessNumber()); | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "testRgv") | ||||
|     @ApiOperation(value = "测试rgv避让逻辑") | ||||
|     private String testRgv(@RequestBody TestRgv testRgv) throws IOException { | ||||
|         Long aLong = taskDistanceUtils.chooseVehicle(testRgv.getStartPoint(), testRgv.getEndPoint()); | ||||
|         Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle()); | ||||
|         return String.valueOf(aLong) + String.valueOf(aBoolean); | ||||
|     } | ||||
|  | ||||
|     private Integer sendTaskToRgv(Integer taskType, Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) { | ||||
|         Map<String, Object> json = new HashMap(); | ||||
|         // taskType 1 搬运 | ||||
|         json.put("taskType", taskType); | ||||
|         json.put("sendRow", endPoint); | ||||
|         json.put("pickRow", startPoint); | ||||
|         json.put("taskNo", currTaskId); | ||||
|         json.put("ideNumber", currTaskId); | ||||
|         json.put("processNumber", processNumber); | ||||
|         String taskJson = JSON.toJSONString(json); | ||||
|         String result = null; | ||||
|         try { | ||||
|             if (vehicleId == 1) { | ||||
|                 result = HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask", taskJson); | ||||
|             } | ||||
|             if (vehicleId == 2) { | ||||
|                 result = HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask", taskJson); | ||||
|             } | ||||
|         } catch (IOException e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         JSONObject jsonObject = JSON.parseObject(result); | ||||
|         return Integer.parseInt(String.valueOf(jsonObject.get("msg"))); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "testStoveCode") | ||||
|     @ApiOperation(value = "测试炉号生成") | ||||
|     public String testStoveCode(@RequestBody TestStoveCode testStoveCode) { | ||||
|         return StoveCodeUtils.getStoveCode(testStoveCode.getKilnName(), testStoveCode.getCraft()); | ||||
|     } | ||||
| } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,38 @@ | ||||
| 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.vo.R; | ||||
| import com.mt.wms.empty.service.StockInfoService; | ||||
| import com.mt.wms.empty.vo.CurrTaskDetVo; | ||||
| 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 java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/9/9 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping(CommonConstant.API_MODULE_BASE + "inStockInfo") | ||||
| @Slf4j | ||||
| @Api(value = "缓存库位相关接口", tags = "缓存库位相关接口", hidden = false) | ||||
| public class InStockInfoController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private StockInfoService stockInfoService; | ||||
|     @PostMapping(value = "top") | ||||
|     @ApiOperation(value = "置顶改缓存库位") | ||||
|     private R<String> top(@Validated @RequestBody IdParam idParam) { | ||||
|         return stockInfoService.top(idParam); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,105 @@ | ||||
| package com.mt.wms.empty.controller; | ||||
|  | ||||
| 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.service.AlarmBaseService; | ||||
| import com.mt.wms.basic.vo.AlarmBaseVo; | ||||
| import com.mt.wms.core.base.BaseController; | ||||
| import com.mt.wms.core.constants.CommonConstant; | ||||
| import com.mt.wms.core.dal.entity.AlarmBase; | ||||
| import com.mt.wms.core.dal.entity.QuestionAnswer; | ||||
| import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz; | ||||
| import com.mt.wms.core.params.IdParam; | ||||
| 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 com.mt.wms.empty.params.QuestionAnswerParam; | ||||
| import com.mt.wms.empty.params.QuestionAnswerQueryparam; | ||||
| import com.mt.wms.empty.vo.QuestionAnswerVo; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.lang.StringUtils; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| 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: LGH | ||||
|  * @Date: 2022/8/11 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping(CommonConstant.API_MODULE_BASE + "questionAnswer") | ||||
| @Slf4j | ||||
| @Api(value = "问题解答相关接口", tags = "问题解答相关接口", hidden = false) | ||||
| public class QuestionAnswerController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private QuestionAnswerServiceBiz questionAnswerServiceBiz; | ||||
|  | ||||
|     @PostMapping(value = "get") | ||||
|     @ApiOperation(value = "获取报警基础信息") | ||||
|     private R<QuestionAnswerVo> get(@Validated @RequestBody IdParam idParam) { | ||||
|         QuestionAnswer questionAnswer = questionAnswerServiceBiz.getById(idParam.getId()); | ||||
|         QuestionAnswerVo questionAnswerVo= QuestionAnswerVo.builder().build(); | ||||
|         BeanUtils.copyProperties(questionAnswer,QuestionAnswerVo.class); | ||||
|         return successful(questionAnswerVo); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取报警基础信息列表") | ||||
|     private R<List<QuestionAnswerVo>> list(@Validated({Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) { | ||||
|         List<QuestionAnswer> questionAnswerList = questionAnswerServiceBiz.list(new QueryWrapper<QuestionAnswer>() | ||||
|                 .like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey())); | ||||
|         List<QuestionAnswerVo> questionAnswerVos = com.mt.wms.core.utils.BeanUtils.copyList(questionAnswerList, QuestionAnswerVo.class); | ||||
|         return successful(questionAnswerVos); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "page") | ||||
|     @ApiOperation(value = "获取分页报警基础信息") | ||||
|     private R<PageVo<QuestionAnswerVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) { | ||||
|         QueryWrapper<QuestionAnswer> wrapper=new QueryWrapper<>(); | ||||
|         wrapper.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey()); | ||||
|         Page<QuestionAnswer> page = questionAnswerServiceBiz.page(new Page<>(questionAnswerQueryparam.getCurrent(), questionAnswerQueryparam.getSize()), wrapper); | ||||
|         return successful(new PageVo<>(page,QuestionAnswerVo.class)); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "add") | ||||
|     @ApiOperation(value = "新增") | ||||
|     private R<IdVo> add(@Validated({AddGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) { | ||||
|         QuestionAnswer questionAnswer=new QuestionAnswer(); | ||||
|         BeanUtils.copyProperties(questionAnswerParam,questionAnswer); | ||||
|         setCommonField(questionAnswer); | ||||
|         questionAnswerServiceBiz.save(questionAnswer); | ||||
|         return successful(IdVo.builder().id(questionAnswer.getId()).build()); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "update") | ||||
|     @ApiOperation(value = "更新") | ||||
|     private R<IdVo> update(@Validated({UpdateGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) { | ||||
|         QuestionAnswer questionAnswer=new QuestionAnswer(); | ||||
|         BeanUtils.copyProperties(questionAnswerParam,questionAnswer); | ||||
|         setCommonField(questionAnswer); | ||||
|         questionAnswerServiceBiz.save(questionAnswer); | ||||
|         return successful(IdVo.builder().id(questionAnswer.getId()).build()); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "delete") | ||||
|     @ApiOperation(value = "删除报警基础信息") | ||||
|     private R<IdVo> delete(@Validated @RequestBody IdParam idParam) { | ||||
|         questionAnswerServiceBiz.removeById(idParam.getId()); | ||||
|         return successful(IdVo.builder().id(idParam.getId()).build()); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,693 @@ | ||||
| package com.mt.wms.empty.controller; | ||||
|  | ||||
| import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| 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.*; | ||||
| import com.mt.wms.core.dal.service.*; | ||||
| import com.mt.wms.core.params.IdParam; | ||||
| import com.mt.wms.core.utils.BeanUtils; | ||||
| import com.mt.wms.core.utils.HttpClient; | ||||
| import com.mt.wms.core.vo.R; | ||||
| import com.mt.wms.empty.params.ElectricQueryParam; | ||||
| import com.mt.wms.empty.service.EleService; | ||||
| import com.mt.wms.empty.task.ScheduledTask; | ||||
| import com.mt.wms.empty.vo.ApmsCheckResultVo; | ||||
| import com.mt.wms.empty.vo.CurrTaskDetVo; | ||||
| import com.mt.wms.empty.vo.EnergyVo; | ||||
| import com.mt.wms.empty.vo.NowCurrTaskDetVo; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.xmlbeans.impl.xb.xsdschema.Public; | ||||
| 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; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import javax.validation.groups.Default; | ||||
| import java.io.IOException; | ||||
| import java.math.BigDecimal; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/12/27 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping(CommonConstant.API_MODULE_BASE + "screenInfo") | ||||
| @Slf4j | ||||
| @Api(value = "大屏信息相关接口", tags = "大屏信息相关接口", hidden = false) | ||||
| public class ScreenController extends BaseController { | ||||
|  | ||||
|     private final static Logger logger = LoggerFactory.getLogger(ScreenController.class); | ||||
|     @Autowired | ||||
|     private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz; | ||||
|     @Autowired | ||||
|     private CurrTaskDetServiceBiz currTaskDetServiceBiz; | ||||
|     @Autowired | ||||
|     private OrderInfoServiceBiz orderInfoServiceBiz; | ||||
|     @Autowired | ||||
|     private CurrTaskServiceBiz currTaskServiceBiz; | ||||
|     @Autowired | ||||
|     private KilnInfoServiceBiz kilnInfoServiceBiz; | ||||
|     @Autowired | ||||
|     private ParEleValueServiceBiz parEleValueServiceBiz; | ||||
|     @Autowired | ||||
|     private ParGasValueServiceBiz parGasValueServiceBiz; | ||||
|     @Autowired | ||||
|     private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz; | ||||
|     @Autowired | ||||
|     private ParTemValueServiceBiz parTemValueServiceBiz; | ||||
|     @Autowired | ||||
|     private EleService eleService; | ||||
|  | ||||
|     @PostMapping(value = "getKilnList") | ||||
|     @ApiOperation(value = "获取加工炉信息") | ||||
|     public R<List<KilnInfo>> getKilnList() { | ||||
|         List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(); | ||||
|         for (KilnInfo kilnInfo : kilnInfoList | ||||
|         ) { | ||||
|             Boolean kilnWorking = kilnWorking(kilnInfo.getId()); | ||||
|             if (kilnWorking) { | ||||
|                 kilnInfo.setStatus(2); | ||||
|             } | ||||
|             Boolean kilnOnline = kilnOnline(kilnInfo.getId()); | ||||
|             if (!kilnOnline) { | ||||
|                 //不在线视为损坏 | ||||
|                 kilnInfo.setStatus(1); | ||||
|             } | ||||
|         } | ||||
|         return successful(kilnInfoList); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "getEleList") | ||||
|     @ApiOperation(value = "获取加工炉最近十条加工任务电能消耗信息") | ||||
|     public R countEleByKiln(@Validated @RequestBody IdParam idParam) { | ||||
|         return eleService.list(idParam.getId()); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "CurrTaskInfo") | ||||
|     @ApiOperation(value = "获取当前加工任务基础信息") | ||||
|     public R<List<NowCurrTaskDetVo>> CurrTaskInfo() { | ||||
|         //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情 | ||||
|         List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>() | ||||
|                 .eq(CurrTask.IS_IN, 1) | ||||
|                 .eq(CurrTask.STATUS, 1)); | ||||
|         if (currTaskList.size() == 0) { | ||||
|             return failed(""); | ||||
|         } | ||||
|         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.setTaskCode(nowCurrTask.getSheetNo()); | ||||
|                 nowCurrTask.setKilnCode(kilnInfo.getCode()); | ||||
|                 nowCurrTask.setTaskId(nowCurrTask.getId()); | ||||
|                 //设定时间 | ||||
|                 Integer setupTime = 1; | ||||
|                 //剩余时间 | ||||
|                 Integer remainingTime = 0; | ||||
|  | ||||
|  | ||||
|                 if (kilnInfo.getType() != 4) { | ||||
|                     if (kilnInfo.getType() == 3) { | ||||
|                         remainingTime = readPlc(nameSpace, "ProgramTimeRemaining").intValue(); | ||||
|                     } else { | ||||
|                         remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue(); | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|                 if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) { | ||||
|                     //运行时间 | ||||
|                     Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue(); | ||||
|                     setupTime = runTime + remainingTime; | ||||
|                 } | ||||
|                 if (kilnInfo.getType() == 2) { | ||||
|                     setupTime = readPlc(nameSpace, "SetTime").intValue(); | ||||
|                 } | ||||
|                 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.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName(); | ||||
|                     currTaskDetVo.setCustomer(customerName); | ||||
|                 } | ||||
|                 nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList); | ||||
|             } | ||||
|         } | ||||
|         return successful(nowCurrTaskDetVoList); | ||||
|     } | ||||
|  | ||||
|     @PostMapping(value = "energyInfo") | ||||
|     @ApiOperation(value = "获取当前加工任务能源消耗信息") | ||||
|     public R<JSONObject> list(@Validated @RequestBody IdParam idParam) { | ||||
|         Long taskId = idParam.getId(); | ||||
|         Map<String, Object> map = new HashMap<>(); | ||||
|         //电度值 | ||||
|         List<List<EnergyVo>> eleConsumeList = new ArrayList<>(); | ||||
|         //A向电压 | ||||
|         List<List<EnergyVo>> aVolConsumeList = new ArrayList<>(); | ||||
|         //B向电压 | ||||
|         List<List<EnergyVo>> bVolConsumeList = new ArrayList<>(); | ||||
|         //C向电压 | ||||
|         List<List<EnergyVo>> cVolConsumeList = new ArrayList<>(); | ||||
|         //A向电流 | ||||
|         List<List<EnergyVo>> aCurrentList = new ArrayList<>(); | ||||
|         //B向电流 | ||||
|         List<List<EnergyVo>> bCurrentList = new ArrayList<>(); | ||||
|         //C向电流 | ||||
|         List<List<EnergyVo>> cCurrentList = new ArrayList<>(); | ||||
|         //氮气 | ||||
|         List<List<EnergyVo>> nitConsumeList = new ArrayList<>(); | ||||
|         //甲醇 | ||||
|         List<List<EnergyVo>> metConsumeList = new ArrayList<>(); | ||||
|         //丙烷 | ||||
|         List<List<EnergyVo>> propaneConsumeList = new ArrayList<>(); | ||||
|         //氨气 | ||||
|         List<List<EnergyVo>> ammoniaConsumeList = new ArrayList<>(); | ||||
|         //二氧化碳 | ||||
|         List<List<EnergyVo>> carbonConsumeList = new ArrayList<>(); | ||||
|         //1号油搅拌转速 | ||||
|         List<List<EnergyVo>> rot1ConsumeList = new ArrayList<>(); | ||||
|         //2号油搅拌转速 | ||||
|         List<List<EnergyVo>> rot2ConsumeList = new ArrayList<>(); | ||||
|         //温度 | ||||
|         List<List<EnergyVo>> tempConsumeList = new ArrayList<>(); | ||||
|         //油槽温度 | ||||
|         List<List<EnergyVo>> oilTempConsumeList = new ArrayList<>(); | ||||
|         //外一区温度 | ||||
|         List<List<EnergyVo>> outerZone1TempConsumeList = new ArrayList<>(); | ||||
|         //外二区温度 | ||||
|         List<List<EnergyVo>> outerZone2TempConsumeList = new ArrayList<>(); | ||||
|         //碳/氮势 | ||||
|         List<List<EnergyVo>> carbonList = new ArrayList<>(); | ||||
|         List<List<ApmsCheckResultVo>> checkResultList = new ArrayList<>(); | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(taskId); | ||||
|         //防止早期没有炉号的报错 | ||||
|         if (currTask.getStoveCode() == null) { | ||||
|             currTask.setStoveCode(currTask.getSheetNo()); | ||||
|         } | ||||
|  | ||||
|         Long kilnId = currTask.getKilnId(); | ||||
|         KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId); | ||||
|         Integer kilnType = kilnInfo.getType(); | ||||
|         //电能消耗 | ||||
|         List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>() | ||||
|                 .eq(ParEleValue.KILN_ID, kilnId) | ||||
|                 .eq(ParEleValue.TASK_ID, taskId)); | ||||
|         if (parEleValueList.size() > 0) { | ||||
|             List<Object> eleList = new ArrayList<>(); | ||||
|             //电能消耗 | ||||
|             List<EnergyVo> eleConsume = new ArrayList<>(); | ||||
|             //A向电压 | ||||
|             List<EnergyVo> aVolConsume = new ArrayList<>(); | ||||
|             //B向电压 | ||||
|             List<EnergyVo> bVolConsume = new ArrayList<>(); | ||||
|             //C向电压 | ||||
|             List<EnergyVo> cVolConsume = new ArrayList<>(); | ||||
|             //A向电流 | ||||
|             List<EnergyVo> aCurrentConsume = new ArrayList<>(); | ||||
|             //B向电流 | ||||
|             List<EnergyVo> bCurrentConsume = new ArrayList<>(); | ||||
|             //C向电流 | ||||
|             List<EnergyVo> cCurrentConsume = new ArrayList<>(); | ||||
|             Float talBat = 0F; | ||||
|             int i = 0; | ||||
|             for (ParEleValue parEleValue : parEleValueList | ||||
|             ) { | ||||
|                 //首位置为0 | ||||
|                 if (i == 0) { | ||||
|                     talBat = parEleValue.getTotalBat(); | ||||
|                 } | ||||
|                 i++; | ||||
|                 EnergyVo eleVo = EnergyVo.builder().build(); | ||||
|                 eleVo.setCode(currTask.getStoveCode()); | ||||
|                 eleVo.setName("耗电量"); | ||||
|                 eleVo.setUnit("KW"); | ||||
|                 eleVo.setTime(parEleValue.getCreateTime()); | ||||
|                 eleVo.setValue(floatSubtract(parEleValue.getTotalBat(), talBat)); | ||||
|                 eleConsume.add(eleVo); | ||||
|  | ||||
|                 EnergyVo aVolVo = EnergyVo.builder().build(); | ||||
|                 aVolVo.setCode(currTask.getStoveCode()); | ||||
|                 aVolVo.setName("A向电压"); | ||||
|                 aVolVo.setUnit("V"); | ||||
|                 aVolVo.setTime(parEleValue.getCreateTime()); | ||||
|                 aVolVo.setValue(parEleValue.getAVoltagevValue()); | ||||
|                 aVolConsume.add(aVolVo); | ||||
|  | ||||
|                 EnergyVo bVolVo = EnergyVo.builder().build(); | ||||
|                 bVolVo.setCode(currTask.getStoveCode()); | ||||
|                 bVolVo.setName("B向电压"); | ||||
|                 bVolVo.setUnit("V"); | ||||
|                 bVolVo.setTime(parEleValue.getCreateTime()); | ||||
|                 bVolVo.setValue(parEleValue.getBVoltagevValue()); | ||||
|                 bVolConsume.add(bVolVo); | ||||
|  | ||||
|                 EnergyVo cVolVo = EnergyVo.builder().build(); | ||||
|                 cVolVo.setCode(currTask.getStoveCode()); | ||||
|                 cVolVo.setName("C向电压"); | ||||
|                 cVolVo.setUnit("V"); | ||||
|                 cVolVo.setTime(parEleValue.getCreateTime()); | ||||
|                 cVolVo.setValue(parEleValue.getCVoltagevValue()); | ||||
|                 cVolConsume.add(cVolVo); | ||||
|  | ||||
|                 EnergyVo aCurrVo = EnergyVo.builder().build(); | ||||
|                 aCurrVo.setCode(currTask.getStoveCode()); | ||||
|                 aCurrVo.setName("A向电流"); | ||||
|                 aCurrVo.setUnit("A"); | ||||
|                 aCurrVo.setTime(parEleValue.getCreateTime()); | ||||
|                 aCurrVo.setValue(parEleValue.getACurrentValue()); | ||||
|                 aCurrentConsume.add(aCurrVo); | ||||
|  | ||||
|                 EnergyVo bCurrVo = EnergyVo.builder().build(); | ||||
|                 bCurrVo.setCode(currTask.getStoveCode()); | ||||
|                 bCurrVo.setName("B向电流"); | ||||
|                 bCurrVo.setUnit("A"); | ||||
|                 bCurrVo.setTime(parEleValue.getCreateTime()); | ||||
|                 bCurrVo.setValue(parEleValue.getBCurrentValue()); | ||||
|                 bCurrentConsume.add(bCurrVo); | ||||
|  | ||||
|                 EnergyVo cCurrVo = EnergyVo.builder().build(); | ||||
|                 cCurrVo.setCode(currTask.getStoveCode()); | ||||
|                 cCurrVo.setName("C向电流"); | ||||
|                 cCurrVo.setUnit("A"); | ||||
|                 cCurrVo.setTime(parEleValue.getCreateTime()); | ||||
|                 cCurrVo.setValue(parEleValue.getCCurrentValue()); | ||||
|                 cCurrentConsume.add(cCurrVo); | ||||
|             } | ||||
|             eleConsumeList.add(eleConsume); | ||||
|             aVolConsumeList.add(aVolConsume); | ||||
|             bVolConsumeList.add(bVolConsume); | ||||
|             cVolConsumeList.add(cVolConsume); | ||||
|             aCurrentList.add(aCurrentConsume); | ||||
|             bCurrentList.add(bCurrentConsume); | ||||
|             cCurrentList.add(cCurrentConsume); | ||||
|  | ||||
|         } | ||||
|         //氮气、甲醇、丙烷、氨气二氧化碳消耗量碳势 | ||||
|         List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>() | ||||
|                 .eq(ParEleValue.KILN_ID, kilnId) | ||||
|                 .eq(ParEleValue.TASK_ID, taskId)); | ||||
|         if (parGasValueList.size() > 0) { | ||||
|             if (kilnType == 1) { | ||||
|                 //碳/氮势 | ||||
|                 List<EnergyVo> carbon = new ArrayList<>(); | ||||
|                 //碳/氮势-设定 | ||||
|                 List<EnergyVo> carbonSet = new ArrayList<>(); | ||||
|                 //氮气 | ||||
|                 List<EnergyVo> nitConsume = new ArrayList<>(); | ||||
|                 //甲醇 | ||||
|                 List<EnergyVo> metConsume = new ArrayList<>(); | ||||
|                 //丙烷 | ||||
|                 List<EnergyVo> propaneConsume = new ArrayList<>(); | ||||
|                 //氨气 | ||||
|                 List<EnergyVo> ammoniaConsume = new ArrayList<>(); | ||||
|                 for (ParGasValue parGasValue : parGasValueList | ||||
|                 ) { | ||||
|                     EnergyVo carbonSetVo = EnergyVo.builder().build(); | ||||
|                     carbonSetVo.setTime(parGasValue.getCreateTime()); | ||||
|                     carbonSetVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     carbonSetVo.setUnit("%"); | ||||
|                     carbonSetVo.setName("碳/氮势"); | ||||
|                     carbonSetVo.setValue(parGasValue.getSetNitPotValue()); | ||||
|                     carbonSet.add(carbonSetVo); | ||||
|                     EnergyVo carbonActVo = EnergyVo.builder().build(); | ||||
|                     carbonActVo.setValue(parGasValue.getActualNitPotValue()); | ||||
|                     carbonActVo.setUnit("%"); | ||||
|                     carbonActVo.setName("碳/氮势"); | ||||
|                     carbonActVo.setCode(currTask.getStoveCode()); | ||||
|                     carbon.add(carbonActVo); | ||||
|  | ||||
|                     EnergyVo nitVo = EnergyVo.builder().build(); | ||||
|                     nitVo.setTime(parGasValue.getCreateTime()); | ||||
|                     nitVo.setUnit("m³/h"); | ||||
|                     nitVo.setValue(parGasValue.getNitFlowValue()); | ||||
|                     nitVo.setName("氮气"); | ||||
|                     nitVo.setCode(currTask.getStoveCode()); | ||||
|                     nitConsume.add(nitVo); | ||||
|  | ||||
|                     EnergyVo metVo = EnergyVo.builder().build(); | ||||
|                     metVo.setCode(currTask.getStoveCode()); | ||||
|                     metVo.setValue(parGasValue.getMethanolFlow()); | ||||
|                     metVo.setName("甲醇"); | ||||
|                     metVo.setUnit("m³/h"); | ||||
|                     metVo.setTime(parGasValue.getCreateTime()); | ||||
|                     metConsume.add(metVo); | ||||
|  | ||||
|                     EnergyVo propaneVo = EnergyVo.builder().build(); | ||||
|                     propaneVo.setTime(parGasValue.getCreateTime()); | ||||
|                     propaneVo.setCode(currTask.getStoveCode()); | ||||
|                     propaneVo.setUnit("m³/h"); | ||||
|                     propaneVo.setValue(parGasValue.getPropaneFlow()); | ||||
|                     propaneVo.setName("丙烷"); | ||||
|                     propaneConsume.add(propaneVo); | ||||
|  | ||||
|                     EnergyVo ammoniaVo = EnergyVo.builder().build(); | ||||
|                     ammoniaVo.setName("氨气"); | ||||
|                     ammoniaVo.setCode(currTask.getStoveCode()); | ||||
|                     ammoniaVo.setValue(parGasValue.getAmmoniaFlowValue()); | ||||
|                     ammoniaVo.setUnit("m³/h"); | ||||
|                     ammoniaVo.setTime(parGasValue.getCreateTime()); | ||||
|                     ammoniaConsume.add(ammoniaVo); | ||||
|                 } | ||||
|                 carbonList.add(carbon); | ||||
|                 carbonList.add(carbonSet); | ||||
|                 nitConsumeList.add(nitConsume); | ||||
|                 metConsumeList.add(metConsume); | ||||
|                 propaneConsumeList.add(propaneConsume); | ||||
|                 ammoniaConsumeList.add(ammoniaConsume); | ||||
|             } | ||||
|             if (kilnType == 3) { | ||||
|                 //碳/氮势 | ||||
|                 List<EnergyVo> carbon = new ArrayList<>(); | ||||
|                 //碳/氮势-设定 | ||||
|                 List<EnergyVo> carbonSet = new ArrayList<>(); | ||||
|                 //氮气 | ||||
|                 List<EnergyVo> nitConsume = new ArrayList<>(); | ||||
|                 //二氧化碳 | ||||
|                 List<EnergyVo> carbonConsume = new ArrayList<>(); | ||||
|                 //氨气 | ||||
|                 List<EnergyVo> ammoniaConsume = new ArrayList<>(); | ||||
|                 for (ParGasValue parGasValue : parGasValueList | ||||
|                 ) { | ||||
|                     EnergyVo carbonSetVo = EnergyVo.builder().build(); | ||||
|                     carbonSetVo.setTime(parGasValue.getCreateTime()); | ||||
|                     carbonSetVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     carbonSetVo.setUnit("%"); | ||||
|                     carbonSetVo.setName("碳/氮势"); | ||||
|                     carbonSetVo.setValue(parGasValue.getSetNitPotValue()); | ||||
|                     carbonSet.add(carbonSetVo); | ||||
|                     EnergyVo carbonActVo = EnergyVo.builder().build(); | ||||
|                     carbonActVo.setTime(parGasValue.getCreateTime()); | ||||
|                     carbonActVo.setValue(parGasValue.getActualNitPotValue()); | ||||
|                     carbonActVo.setUnit("%"); | ||||
|                     carbonActVo.setName("碳/氮势"); | ||||
|                     carbonActVo.setCode(currTask.getStoveCode()); | ||||
|                     carbon.add(carbonActVo); | ||||
|  | ||||
|                     EnergyVo nitVo = EnergyVo.builder().build(); | ||||
|                     nitVo.setTime(parGasValue.getCreateTime()); | ||||
|                     nitVo.setUnit("m³/h"); | ||||
|                     nitVo.setValue(parGasValue.getNitFlowValue()); | ||||
|                     nitVo.setName("氮气"); | ||||
|                     nitVo.setCode(currTask.getStoveCode()); | ||||
|                     nitConsume.add(nitVo); | ||||
|  | ||||
|                     EnergyVo carbonVo = EnergyVo.builder().build(); | ||||
|                     carbonVo.setTime(parGasValue.getCreateTime()); | ||||
|                     carbonVo.setCode(currTask.getStoveCode()); | ||||
|                     carbonVo.setUnit("m³/h"); | ||||
|                     carbonVo.setValue(parGasValue.getCarDioxideFlowValue()); | ||||
|                     carbonVo.setName("二氧化碳"); | ||||
|                     carbonConsume.add(carbonVo); | ||||
|  | ||||
|                     EnergyVo ammoniaVo = EnergyVo.builder().build(); | ||||
|                     ammoniaVo.setName("氨气"); | ||||
|                     ammoniaVo.setCode(currTask.getStoveCode()); | ||||
|                     ammoniaVo.setValue(parGasValue.getAmmoniaFlowValue()); | ||||
|                     ammoniaVo.setUnit("m³/h"); | ||||
|                     ammoniaVo.setTime(parGasValue.getCreateTime()); | ||||
|                     ammoniaConsume.add(ammoniaVo); | ||||
|                 } | ||||
|                 carbonList.add(carbon); | ||||
|                 carbonList.add(carbonSet); | ||||
|                 carbonConsumeList.add(carbonConsume); | ||||
|                 nitConsumeList.add(nitConsume); | ||||
|                 ammoniaConsumeList.add(ammoniaConsume); | ||||
|             } | ||||
|         } | ||||
|         //油搅拌转速趋势 | ||||
|         List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>() | ||||
|                 .eq(ParEleValue.KILN_ID, kilnId) | ||||
|                 .eq(ParEleValue.TASK_ID, taskId)); | ||||
|         if (parRotSpeedValueList.size() > 0) { | ||||
|             if (kilnType == 1) { | ||||
|                 List<EnergyVo> rot1Consume = new ArrayList<>(); | ||||
|                 List<EnergyVo> rot2Consume = new ArrayList<>(); | ||||
|                 for (ParRotSpeedValue parRotSpeedValue : parRotSpeedValueList | ||||
|                 ) { | ||||
|                     EnergyVo rot1Vo = EnergyVo.builder().build(); | ||||
|                     rot1Vo.setCode(currTask.getStoveCode()); | ||||
|                     rot1Vo.setUnit("转/min"); | ||||
|                     rot1Vo.setName("1号油搅拌转速"); | ||||
|                     rot1Vo.setValue(parRotSpeedValue.getOilStiSpeedAValue()); | ||||
|                     rot1Vo.setTime(parRotSpeedValue.getCreateTime()); | ||||
|                     rot1Consume.add(rot1Vo); | ||||
|  | ||||
|                     EnergyVo rot2Vo = EnergyVo.builder().build(); | ||||
|                     rot2Vo.setCode(currTask.getStoveCode()); | ||||
|                     rot2Vo.setUnit("转/min"); | ||||
|                     rot2Vo.setName("2号油搅拌转速"); | ||||
|                     rot2Vo.setValue(parRotSpeedValue.getOilStiSpeedBValue()); | ||||
|                     rot2Vo.setTime(parRotSpeedValue.getCreateTime()); | ||||
|                     rot2Consume.add(rot2Vo); | ||||
|                 } | ||||
|                 rot1ConsumeList.add(rot1Consume); | ||||
|                 rot2ConsumeList.add(rot2Consume); | ||||
|             } | ||||
|         } | ||||
|         //温度趋势(实际温度、设定温度)油槽温度外区温度 | ||||
|         List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>() | ||||
|                 .eq(ParEleValue.KILN_ID, kilnId) | ||||
|                 .eq(ParEleValue.TASK_ID, taskId)); | ||||
|         if (parTemValueList.size() > 0) { | ||||
|             if (kilnType == 1) { | ||||
|                 List<EnergyVo> actualTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> setupTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> actualOilTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> setupOilTempConsume = new ArrayList<>(); | ||||
|                 for (ParTemValue parTemValue : parTemValueList | ||||
|                 ) { | ||||
|                     EnergyVo actTempVo = EnergyVo.builder().build(); | ||||
|                     actTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     actTempVo.setCode(currTask.getStoveCode()); | ||||
|                     actTempVo.setUnit("℃"); | ||||
|                     actTempVo.setValue(parTemValue.getActTemValue()); | ||||
|                     actTempVo.setName("实际温度"); | ||||
|                     actualTempConsume.add(actTempVo); | ||||
|  | ||||
|                     EnergyVo setTempVo = EnergyVo.builder().build(); | ||||
|                     setTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     setTempVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     setTempVo.setUnit("℃"); | ||||
|                     setTempVo.setValue(parTemValue.getSetTemValue()); | ||||
|                     setTempVo.setName("设定温度"); | ||||
|                     setupTempConsume.add(setTempVo); | ||||
|  | ||||
|                     EnergyVo oilSetTempVo = EnergyVo.builder().build(); | ||||
|                     oilSetTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     oilSetTempVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     oilSetTempVo.setUnit("℃"); | ||||
|                     oilSetTempVo.setValue(parTemValue.getOilTankSetTemValue()); | ||||
|                     oilSetTempVo.setName("油槽设定温度"); | ||||
|                     setupOilTempConsume.add(oilSetTempVo); | ||||
|  | ||||
|                     EnergyVo oilActTempVo = EnergyVo.builder().build(); | ||||
|                     oilActTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     oilActTempVo.setCode(currTask.getStoveCode()); | ||||
|                     oilActTempVo.setUnit("℃"); | ||||
|                     oilActTempVo.setValue(parTemValue.getOilTankActTemValue()); | ||||
|                     oilActTempVo.setName("油槽实际温度"); | ||||
|                     actualOilTempConsume.add(oilActTempVo); | ||||
|  | ||||
|                 } | ||||
|                 tempConsumeList.add(actualTempConsume); | ||||
|                 tempConsumeList.add(setupTempConsume); | ||||
|                 oilTempConsumeList.add(actualOilTempConsume); | ||||
|                 oilTempConsumeList.add(setupOilTempConsume); | ||||
|             } | ||||
|             if (kilnType == 2) { | ||||
|                 List<EnergyVo> actualTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> setupTempConsume = new ArrayList<>(); | ||||
|                 for (ParTemValue parTemValue : parTemValueList | ||||
|                 ) { | ||||
|                     EnergyVo actTempVo = EnergyVo.builder().build(); | ||||
|                     actTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     actTempVo.setCode(currTask.getStoveCode()); | ||||
|                     actTempVo.setUnit("℃"); | ||||
|                     actTempVo.setValue(parTemValue.getActTemValue()); | ||||
|                     actTempVo.setName("实际温度"); | ||||
|                     actualTempConsume.add(actTempVo); | ||||
|  | ||||
|                     EnergyVo setTempVo = EnergyVo.builder().build(); | ||||
|                     setTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     setTempVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     setTempVo.setUnit("℃"); | ||||
|                     setTempVo.setValue(parTemValue.getSetTemValue()); | ||||
|                     setTempVo.setName("设定温度"); | ||||
|                     setupTempConsume.add(setTempVo); | ||||
|                 } | ||||
|                 tempConsumeList.add(actualTempConsume); | ||||
|                 tempConsumeList.add(setupTempConsume); | ||||
|                 ; | ||||
|             } | ||||
|             if (kilnType == 3) { | ||||
|  | ||||
|                 List<EnergyVo> actualTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> setupTempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> outerZone1TempConsume = new ArrayList<>(); | ||||
|                 List<EnergyVo> outerZone2TempConsume = new ArrayList<>(); | ||||
|                 for (ParTemValue parTemValue : parTemValueList | ||||
|                 ) { | ||||
|                     EnergyVo actTempVo = EnergyVo.builder().build(); | ||||
|                     actTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     actTempVo.setCode(currTask.getStoveCode()); | ||||
|                     actTempVo.setUnit("℃"); | ||||
|                     actTempVo.setValue(parTemValue.getActTemValue()); | ||||
|                     actTempVo.setName("实际温度"); | ||||
|                     actualTempConsume.add(actTempVo); | ||||
|  | ||||
|                     EnergyVo setTempVo = EnergyVo.builder().build(); | ||||
|                     setTempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     setTempVo.setCode(currTask.getStoveCode().concat("-设定")); | ||||
|                     setTempVo.setUnit("℃"); | ||||
|                     setTempVo.setValue(parTemValue.getSetTemValue()); | ||||
|                     setTempVo.setName("设定温度"); | ||||
|                     setupTempConsume.add(setTempVo); | ||||
|  | ||||
|                     EnergyVo outer1TempVo = EnergyVo.builder().build(); | ||||
|                     outer1TempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     outer1TempVo.setCode(currTask.getStoveCode()); | ||||
|                     outer1TempVo.setUnit("℃"); | ||||
|                     outer1TempVo.setValue(parTemValue.getOuterZone1Temp()); | ||||
|                     outer1TempVo.setName("外一区温度"); | ||||
|                     outerZone1TempConsume.add(outer1TempVo); | ||||
|  | ||||
|                     EnergyVo outer2TempVo = EnergyVo.builder().build(); | ||||
|                     outer2TempVo.setTime(parTemValue.getCreateTime()); | ||||
|                     outer2TempVo.setCode(currTask.getStoveCode()); | ||||
|                     outer2TempVo.setUnit("℃"); | ||||
|                     outer2TempVo.setValue(parTemValue.getOuterZone2Temp()); | ||||
|                     outer2TempVo.setName("外二区温度"); | ||||
|                     outerZone2TempConsume.add(outer2TempVo); | ||||
|  | ||||
|                 } | ||||
|                 tempConsumeList.add(actualTempConsume); | ||||
|                 tempConsumeList.add(setupTempConsume); | ||||
|                 outerZone1TempConsumeList.add(outerZone1TempConsume); | ||||
|                 outerZone2TempConsumeList.add(outerZone2TempConsume); | ||||
|             } | ||||
|         } | ||||
|         map.put("checkResult", checkResultList); | ||||
|         map.put("ele", eleConsumeList); | ||||
|         map.put("aVol", aVolConsumeList); | ||||
|         map.put("bVol", bVolConsumeList); | ||||
|         map.put("cVol", cVolConsumeList); | ||||
|         map.put("aCurr", aCurrentList); | ||||
|         map.put("bCurr", bCurrentList); | ||||
|         map.put("cCurr", cCurrentList); | ||||
|         map.put("carbon", carbonList); | ||||
|         map.put("nit", nitConsumeList); | ||||
|         map.put("met", metConsumeList); | ||||
|         map.put("propane", propaneConsumeList); | ||||
|         map.put("ammon", ammoniaConsumeList); | ||||
|         map.put("car", carbonConsumeList); | ||||
|         map.put("rot1", rot1ConsumeList); | ||||
|         map.put("rot2", rot2ConsumeList); | ||||
|         map.put("temp", tempConsumeList); | ||||
|         map.put("oilTemp", oilTempConsumeList); | ||||
|         map.put("outerZone1Temp",outerZone1TempConsumeList); | ||||
|         map.put("outerZone2Temp",outerZone2TempConsumeList); | ||||
|         return successful(JSONObject.parseObject(JSON.toJSONString(map))); | ||||
|     } | ||||
|  | ||||
|     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()); | ||||
|     } | ||||
|  | ||||
|     private Boolean kilnOnline(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, "ManualAutomatic"); | ||||
|         return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取变量值 | ||||
|      * | ||||
|      * @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()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取变量值 | ||||
|      * | ||||
|      * @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; | ||||
|     } | ||||
|  | ||||
|     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(); | ||||
|     } | ||||
| } | ||||
| @@ -34,16 +34,8 @@ public class TaskHisController extends BaseController { | ||||
|     private TaskHisService taskHisService; | ||||
|  | ||||
|     @PostMapping(value = "taskHis") | ||||
|     @ApiOperation(value = "获取历史执行的任务 (车辆名称传id)") | ||||
|     @ApiOperation(value = "获取历史执行的任务") | ||||
|     public R<PageVo<TaskHisQueryVo>> currentTask(@Validated @RequestBody TaskHisQueryParam param) { | ||||
|         if (Objects.nonNull(param.getStartTime())) | ||||
|         { | ||||
|             param.setStartTime(LocalDateTimeUtils.getDayStart(param.getStartTime())); | ||||
|         } | ||||
|         if (Objects.nonNull(param.getEndTime())) | ||||
|         { | ||||
|             param.setEndTime(LocalDateTimeUtils.getDayEnd(param.getEndTime())); | ||||
|         } | ||||
|         return taskHisService.taskHisPage(param); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -16,17 +16,17 @@ import com.mt.wms.core.base.IEnum; | ||||
|  */ | ||||
| public enum TaskTypeEnum implements IEnum<Integer> { | ||||
|     /** | ||||
|      * 入库到窑炉 | ||||
|      * 入库到工业炉 | ||||
|      */ | ||||
|     WTK(0, "入库到窑炉"), | ||||
|     WTK(0, "入库到工业炉"), | ||||
|     /** | ||||
|      * 入库到缓存 | ||||
|      */ | ||||
|     WTC(1, "入库到缓存"), | ||||
|     /** | ||||
|      * 出库到窑炉到缓存区 | ||||
|      * 出库到工业炉到缓存区 | ||||
|      */ | ||||
|     KTC(2, "出库到窑炉到缓存区"), | ||||
|     KTC(2, "出库到工业炉到缓存区"), | ||||
|     /** | ||||
|      * 缓存区出库 | ||||
|      */ | ||||
|   | ||||
| @@ -0,0 +1,17 @@ | ||||
| package com.mt.wms.empty.mapper; | ||||
|  | ||||
| import com.mt.wms.empty.vo.CountEleVo; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/12/27 | ||||
|  */ | ||||
| public interface EleMapper { | ||||
|     /** | ||||
|      * 获取最近十条电能统计值 | ||||
|      */ | ||||
|     List<CountEleVo> list(@Param("kilnId") Long kilnId); | ||||
| } | ||||
| @@ -26,7 +26,7 @@ public class AlarmInfoQueryParam extends BasePageParam { | ||||
|     @ApiModelProperty(value = "设备ID", required = false) | ||||
|     private Long equipmentId; | ||||
|  | ||||
|     @ApiModelProperty(value = "报警类型0窑炉,1表示车辆", 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; | ||||
| } | ||||
| @@ -41,6 +41,92 @@ public class ApmsCompleteOrder extends BaseParam { | ||||
|     @ApiModelProperty(value = "硬度检验值3", required = false) | ||||
|     private String hardnessValueThree; | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 渗碳层深度 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验渗碳淬火 渗碳层深度") | ||||
|     private Float metallographyStchStccsd; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 表面为马氏体、残余奥氏体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验渗碳淬火 表面为马氏体、残余奥氏体(级)") | ||||
|     private String metallographyStchMstost; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 细小颗粒状碳化物 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验渗碳淬火 细小颗粒状碳化物") | ||||
|     private String metallographyStchXxklzthw; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级)") | ||||
|     private String metallographyStchDtmstyltst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火马氏体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验整体淬火 基体为回火马氏体(级)") | ||||
|     private String metallographyZtchHhmst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火托式体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验整体淬火 基体为回火托式体(级)") | ||||
|     private String metallographyZtchHhtst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验整体淬火 基体为回火素式体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验整体淬火 基体为回火素式体(级)") | ||||
|     private String metallographyZtchHhsst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 表面亮白色的为氮化合物层深 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验氮化 表面亮白色的为氮化合物层深") | ||||
|     private Float metallographyDhDhhwcs; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 向内为扩散层深 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验氮化 向内为扩散层深") | ||||
|     private Float metallographyDhKscs; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验氮化 心部 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验氮化 心部") | ||||
|     private String metallographyDhXb; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验表面淬火 表面为板条马氏体(级) | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验表面淬火 表面为板条马氏体(级)") | ||||
|     private String metallographyBmchBtmst; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验表面淬火 心部 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验表面淬火 心部") | ||||
|     private String metallographyBmchXb; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验 备注 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验 备注") | ||||
|     private String metallographyBz; | ||||
|  | ||||
|     /** | ||||
|      * 金相检验心部硬度 心部硬度检验结果 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "金相检验心部硬度 心部硬度检验结果") | ||||
|     private Float metallographyXbydXbydjyjg; | ||||
|  | ||||
|  | ||||
|     @ApiModelProperty(value = "备注", required = false) | ||||
|     private String remake; | ||||
| } | ||||
|   | ||||
| @@ -29,7 +29,7 @@ public class ApmsCreateProcessSheet extends BaseParam { | ||||
|     @ApiModelProperty(value = "开始加工人:为APMS账号", required = true) | ||||
|     private String startUser; | ||||
|  | ||||
|     @ApiModelProperty(value = "配炉号", required = true) | ||||
|     @ApiModelProperty(value = "配炉号", required = false) | ||||
|     private String stoveCode; | ||||
|  | ||||
|     @ApiModelProperty(value = "炉号备注", required = false) | ||||
|   | ||||
| @@ -25,7 +25,7 @@ public class ApmsStartProcess extends BaseParam { | ||||
|     @ApiModelProperty(value = "开始加工人:为APMS账号", required = true) | ||||
|     private String startUser; | ||||
|  | ||||
|     @ApiModelProperty(value = "配炉号", required = true) | ||||
|     @ApiModelProperty(value = "配炉号", required = false) | ||||
|     private String stoveCode; | ||||
|  | ||||
|     @ApiModelProperty(value = "工艺号", required = false) | ||||
|   | ||||
| @@ -0,0 +1,28 @@ | ||||
| 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: LGH | ||||
|  * @Date: 2022/9/5 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "任务参数对象", description = "任务参数对象") | ||||
| public class CurrTaskParam extends BaseParam { | ||||
|     @ApiModelProperty(value = "id", required = true) | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "状态", required = false) | ||||
|     private  Integer status; | ||||
|  | ||||
|     @ApiModelProperty(value = "加工炉", required = false) | ||||
|     private  Long kilnId; | ||||
|  | ||||
| } | ||||
| @@ -23,4 +23,7 @@ public class CurrTaskQueryParam extends BasePageParam { | ||||
|    @ApiModelProperty(value = "车辆id") | ||||
|     private String vehicleId; | ||||
|  | ||||
|    private String sheetNo; | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: liguanghao | ||||
| @@ -22,11 +23,11 @@ public class ElectricQueryParam extends BaseParam { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     @ApiModelProperty(value = "窑炉id", required = false) | ||||
|     @ApiModelProperty(value = "工业炉id", required = false) | ||||
|     private Long kilnId; | ||||
|  | ||||
|     @ApiModelProperty(value = "任务id", required = true) | ||||
|     private Long taskId; | ||||
|     private List<Long> taskIds; | ||||
|  | ||||
|  | ||||
|     @ApiModelProperty(value = "时间节点", required = false) | ||||
| @@ -34,4 +35,6 @@ public class ElectricQueryParam extends BaseParam { | ||||
|  | ||||
|     @ApiModelProperty(value = "时间类型:1 天,2 周,3 月,4 年", required = false) | ||||
|     private Integer dateType; | ||||
|  | ||||
|     private String sheetNo; | ||||
| } | ||||
|   | ||||
| @@ -32,5 +32,11 @@ public class OrderInfoBasePageParam extends BasePageParam { | ||||
|     @ApiModelProperty(value = "标识卡号", required = true) | ||||
|     private String idenCardNum; | ||||
|  | ||||
|     /** | ||||
|      * 客户名称,APMS系统获取 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "客户名称", required = true) | ||||
|     private String customerName; | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -81,4 +81,11 @@ public class OrderParamForApms extends BaseParam { | ||||
|  | ||||
|     @ApiModelProperty(value = "单位") | ||||
|     private String unit; | ||||
|  | ||||
|     /** | ||||
|      * 技术要求 APMS系统获取 | ||||
|      */ | ||||
|     @ApiModelProperty(value = "技术要求") | ||||
|     private String techRequest; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,28 @@ | ||||
| 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: LGH | ||||
|  * @Date: 2022/8/11 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "问题解答参数对象", description = "问题解答参数对象") | ||||
| public class QuestionAnswerParam extends BaseParam { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     @ApiModelProperty(value = "问题", required = true) | ||||
|     private String question; | ||||
|  | ||||
|     @ApiModelProperty(value = "解答", required = true) | ||||
|     private String answer; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| 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/8/11 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "问题解答查询对象", description = "问题解答查询对象") | ||||
| public class QuestionAnswerQueryparam extends BasePageParam { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     @ApiModelProperty(value = "问题", required = false) | ||||
|     private String key; | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| package com.mt.wms.empty.params; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "调用wcs发起任务", description = "调用wcs发起任务") | ||||
| public class RGVTask { | ||||
|     private Integer taskType; | ||||
|     private Long sendRow; | ||||
|     private Long pickRow; | ||||
|     private Long taskNo; | ||||
|     private Long ideNumber; | ||||
|     private Integer processNumber; | ||||
|     private Long vehicleId; | ||||
|  | ||||
| } | ||||
| @@ -17,7 +17,7 @@ import lombok.experimental.Accessors; | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "工艺步骤参数", description = "工艺步骤参数") | ||||
| public class StepInfoParam  extends BaseParam { | ||||
|     @ApiModelProperty(value = "窑炉id", required = true) | ||||
|     @ApiModelProperty(value = "工业炉id", required = true) | ||||
|     private Long kilnId; | ||||
|  | ||||
|     @ApiModelProperty(value = "工艺号id", required = true) | ||||
|   | ||||
| @@ -34,7 +34,7 @@ public class TaskCreateParam extends BaseParam { | ||||
|     private String targetPosition; | ||||
|     @ApiModelProperty(value = "加工类型:0 初始加工,1 复加工", required = true) | ||||
|     private Integer processType; | ||||
|     @ApiModelProperty(value = "窑炉Id", example = "1", required = true) | ||||
|     @ApiModelProperty(value = "工业炉Id", example = "1", required = true) | ||||
|     private Long kilnId; | ||||
|     @ApiModelProperty(value = "工艺号", required = true) | ||||
|     private String craftCode; | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package com.mt.wms.empty.params; | ||||
|  | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import com.mt.wms.core.params.BasePageParam; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| @@ -22,10 +23,17 @@ public class TaskHisQueryParam extends BasePageParam { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     @ApiModelProperty(value = "车辆id") | ||||
|     private String vehicleId; | ||||
|     @ApiModelProperty(value = "加工炉id") | ||||
|     private String kilnId; | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||||
|     @ApiModelProperty(value = "开始时间", example = "2021-11-20T12:05:20") | ||||
|     private LocalDateTime startTime; | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||||
|     @ApiModelProperty(value = "结束时间", example = "2021-11-25T12:05:20") | ||||
|     private LocalDateTime endTime; | ||||
|     @ApiModelProperty(value = "生产单号", example = "1219391") | ||||
|     private String sheetNo; | ||||
|  | ||||
|     @ApiModelProperty(value = "炉号", example = "BMA1-01-200011030001") | ||||
|     private String stoveCode; | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,23 @@ | ||||
| package com.mt.wms.empty.params; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/8/3 | ||||
|  */ | ||||
|  | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "测试rgv避让", description = "测试rgv避让") | ||||
| public class TestRgv { | ||||
|     private String startPoint; | ||||
|     private String endPoint; | ||||
|  | ||||
|     private Double otherVehicle; | ||||
|     private Long vehicleId; | ||||
| } | ||||
| @@ -0,0 +1,20 @@ | ||||
| package com.mt.wms.empty.params; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/8/3 | ||||
|  */ | ||||
|  | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @ApiModel(value = "测试stoveCode", description = "测试stoveCode") | ||||
| public class TestStoveCode { | ||||
|     private String kilnName; | ||||
|     private Integer craft; | ||||
| } | ||||
| @@ -7,13 +7,16 @@ 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.CurrTaskParam; | ||||
| import com.mt.wms.empty.params.CurrTaskQueryParam; | ||||
| import com.mt.wms.empty.params.TaskCreateParam; | ||||
| import com.mt.wms.empty.vo.CurrTaskInfoVo; | ||||
| 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; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 拆分任务相关服务 | ||||
| @@ -63,6 +66,38 @@ public interface CurrTaskService { | ||||
|      */ | ||||
|     R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param); | ||||
|  | ||||
|     /** | ||||
|      * 查询分页信息 | ||||
|      * | ||||
|      * @param param 查询参数 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param); | ||||
|  | ||||
|     /** | ||||
|      * 未成功报工任务查询 | ||||
|      * | ||||
|      * @param param 查询参数 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param); | ||||
|  | ||||
|     /** | ||||
|      * 未成功报工任务查询 | ||||
|      * | ||||
|      * @param | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo); | ||||
|  | ||||
|     /** | ||||
|      * 更新任务状态 | ||||
|      * | ||||
|      * @param param 查询参数 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     R<String> updateCurrTaskStatus(CurrTaskParam param); | ||||
|  | ||||
|     /** | ||||
|      * 完成执行任务 不会物理删除,会将删除值置为0,同时在历史表复制一份记录 方便在订单未完成时查询任务详情 | ||||
|      * | ||||
| @@ -79,6 +114,14 @@ public interface CurrTaskService { | ||||
|      */ | ||||
|     R<String> deleteBySheetNo(String sheetNo); | ||||
|  | ||||
|     /** | ||||
|      * 通过id删除生产单 | ||||
|      * | ||||
|      * @param | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     R<String> deleteById(IdParam idParam); | ||||
|  | ||||
|     /** | ||||
|      * 首页 获取当前执行的任务 | ||||
|      * | ||||
| @@ -92,4 +135,7 @@ public interface CurrTaskService { | ||||
|     R<String> runTask(Long taskId) throws InterruptedException, IOException; | ||||
|  | ||||
|     R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam); | ||||
|  | ||||
|     //置顶 | ||||
|     R<String> top(IdParam idParam); | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| package com.mt.wms.empty.service; | ||||
|  | ||||
| import com.mt.wms.core.vo.R; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/12/27 | ||||
|  */ | ||||
| public interface EleService { | ||||
|     R list(Long kilnId); | ||||
| } | ||||
| @@ -29,4 +29,8 @@ public interface StockInfoService { | ||||
|      * @return xx列表 | ||||
|      */ | ||||
|     R<List<StockInfoVo>> list(); | ||||
|     /** | ||||
|      * 置顶缓存库位顺序 | ||||
|      */ | ||||
|     R<String> top(IdParam idParam); | ||||
| } | ||||
|   | ||||
| @@ -3,8 +3,10 @@ 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.base.BaseService; | ||||
| import com.mt.wms.core.dal.entity.AutoExeTask; | ||||
| import com.mt.wms.core.dal.entity.CurrTaskDet; | ||||
| import com.mt.wms.core.dal.entity.OrderInfo; | ||||
| import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz; | ||||
| import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz; | ||||
| import com.mt.wms.core.dal.service.OrderInfoServiceBiz; | ||||
| import com.mt.wms.core.params.IdParam; | ||||
| @@ -25,6 +27,7 @@ import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
| @@ -44,6 +47,8 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe | ||||
|     CurrTaskService currTaskService; | ||||
|     @Autowired | ||||
|     OrderInfoServiceBiz orderInfoService; | ||||
|     @Autowired | ||||
|     AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|  | ||||
|     @Override | ||||
|     public PageVo<OrderInfoTaskDetVo> getCurrOrderCurrTask(OrderInfoTaskDetParam param) { | ||||
| @@ -78,6 +83,7 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe | ||||
|                     OrderInfo one = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, e.getIdenCardNum())); | ||||
|                     e.setProductModel(one.getProductModel()); | ||||
|                     e.setCustomer(one.getCustomerName()); | ||||
|                     e.setCraftIll(orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM,e.getIdenCardNum())).getCraftIll()); | ||||
|                 } | ||||
|         ); | ||||
|         return successful(currTaskDetVo); | ||||
| @@ -112,14 +118,44 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe | ||||
|         queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, idCard) | ||||
|                 .eq(CurrTaskDet.VALID, 1); | ||||
|         List<CurrTaskDet> list = currTaskDetServiceBiz.list(queryWrapper); | ||||
|         list.forEach(e -> { | ||||
|         Iterator<CurrTaskDet> iterator=list.iterator(); | ||||
|         while (iterator.hasNext()){ | ||||
|             CurrTaskDet currTaskDet = iterator.next(); | ||||
|             CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(currTaskDet.getCurrTaskId()).build()); | ||||
|             if (byId.getStatus()==2){ | ||||
|                 iterator.remove(); | ||||
|                 continue; | ||||
|             } | ||||
|             //如果加工类型是复加工,或者任务作废。移除对象 | ||||
|             if (byId.getProcessType().equals(2) || byId.getValid() != 1) | ||||
|             { | ||||
|                 iterator.remove(); | ||||
|                 continue; | ||||
|             } | ||||
|             //如果是多步骤任务且不是第一步,移除对象 | ||||
|             if (byId.getIsAuto()==1){ | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId()); | ||||
|                 if (!byId.getId().equals(autoExeTask.getFTaskId())){ | ||||
|                     iterator.remove(); | ||||
|                     continue; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| /*        list.forEach(e -> { | ||||
|             CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(e.getCurrTaskId()).build()); | ||||
|             //如果加工类型是复加工,或者任务作废。移除对象 | ||||
|             if (byId.getProcessType().equals(2) || byId.getValid() != 1) | ||||
|             { | ||||
|                 list.remove(e); | ||||
|             } | ||||
|         }); | ||||
|             //如果是多步骤任务且不是第一步,移除对象 | ||||
|             if (byId.getIsAuto()==1){ | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId()); | ||||
|                 if (!byId.getId().equals(autoExeTask.getFTaskId())){ | ||||
|                     list.remove(e); | ||||
|                 } | ||||
|             } | ||||
|         });*/ | ||||
|         //计算加工总数 | ||||
|         double sumWeight = list.stream().mapToDouble(CurrTaskDet::getWeight).sum(); | ||||
|         double sumQuantity = list.stream().mapToDouble(CurrTaskDet::getQuantity).sum(); | ||||
|   | ||||
| @@ -1,7 +1,5 @@ | ||||
| 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; | ||||
| @@ -10,26 +8,19 @@ import com.mt.wms.core.dal.entity.*; | ||||
| 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.params.*; | ||||
| import com.mt.wms.empty.service.*; | ||||
| import com.mt.wms.empty.task.RunTaskUtils; | ||||
| import com.mt.wms.empty.task.StoveCodeUtils; | ||||
| 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 com.mt.wms.empty.vo.*; | ||||
| import com.mt.wms.empty.websocket.WebSocketServer; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| @@ -37,8 +28,13 @@ import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.io.IOException; | ||||
| import java.math.BigDecimal; | ||||
| import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.*; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| /** | ||||
|  * 服务实现类 | ||||
| @@ -51,22 +47,18 @@ import java.util.*; | ||||
| @Transactional | ||||
| public class CurrTaskServiceImpl extends BaseService implements CurrTaskService { | ||||
|  | ||||
|     private Logger logger = LoggerFactory.getLogger(getClass()); | ||||
|     @Autowired | ||||
|     CurrTaskServiceBiz currTaskServiceBiz; | ||||
|  | ||||
|     @Autowired | ||||
|     CurrTaskDetService currTaskDetService; | ||||
|  | ||||
|     @Autowired | ||||
|     TaskHisService taskHisService; | ||||
|  | ||||
|     @Autowired | ||||
|     TaskDetHisService taskDetHisService; | ||||
|  | ||||
|     @Autowired | ||||
|     ApmsController apmsControl; | ||||
|  | ||||
|     @Autowired | ||||
|     WebSocketServer webSocketServer; | ||||
|     @Autowired | ||||
|     OrderInfoServiceBiz orderInfoServiceBiz; | ||||
|     @Autowired | ||||
| @@ -77,6 +69,21 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     TaskDistanceUtils taskDistanceUtils; | ||||
|     @Autowired | ||||
|     RunTaskUtils runTaskUtils; | ||||
|     @Autowired | ||||
|     AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|     @Autowired | ||||
|     KilnInfoServiceBiz kilnInfoServiceBiz; | ||||
|     @Autowired | ||||
|     LocationServiceBiz locationServiceBiz; | ||||
|     @Autowired | ||||
|     CurrTaskDetServiceBiz currTaskDetServiceBiz; | ||||
|     @Autowired | ||||
|     InStockInfoServiceBiz inStockInfoServiceBiz; | ||||
|     @Autowired | ||||
|     TaskDetHisServiceBiz taskDetHisServiceBiz; | ||||
|     @Autowired | ||||
|     TaskHisServiceBiz taskHisServiceBiz; | ||||
|     private Logger logger = LoggerFactory.getLogger(getClass()); | ||||
|  | ||||
|     @Override | ||||
|     public CurrTaskVo getCurrTask(IdParam idParam) { | ||||
| @@ -102,11 +109,18 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|         CurrTask currTask = new CurrTask(); | ||||
|         BeanUtils.copyProperties(param, currTask); | ||||
|         currTask.setTaskType(TaskTypeEnum.WTK.getValue()); | ||||
|         KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId()); | ||||
|         if (param.getAutoTaskType() != 0) { | ||||
|             currTask.setIsAuto(1); | ||||
|         } | ||||
|  | ||||
|         //根据工艺号查询工艺id以及工艺plc值 | ||||
|         CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CREATOR_ID, param.getCraftCode())); | ||||
|         CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode())); | ||||
|         currTask.setTargetPosition(kilnInfo.getCode()); | ||||
|         currTask.setCraftCodeId(one.getId()); | ||||
|         currTask.setPlcValue(one.getPlcValue()); | ||||
|         currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); | ||||
|         currTask.setTaskCode(currTask.getInterCode()); | ||||
|         setCommonField(currTask); | ||||
|         currTaskServiceBiz.save(currTask); | ||||
|         return successful(IdVo.builder().id(currTask.getId()).build()); | ||||
| @@ -116,10 +130,406 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) { | ||||
|         QueryWrapper<CurrTask> currTaskQueryWrapper = new QueryWrapper<>(); | ||||
|         currTaskQueryWrapper.eq(CurrTask.VALID, 1); | ||||
|         currTaskQueryWrapper.in(CurrTask.STATUS, 0, 1); | ||||
|         Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper); | ||||
|         return successful(new PageVo<>(page, CurrTaskQueryVo.class)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param) { | ||||
|         QueryWrapper<CurrTask> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(CurrTask.VALID, 1); | ||||
|         wrapper.in(CurrTask.STATUS, 0, 1); | ||||
|         List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper); | ||||
|         List<CurrTaskInfoVo> list = new ArrayList<>(); | ||||
|         for (CurrTask currTask : currTaskList | ||||
|         ) { | ||||
|             CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build(); | ||||
|             //是否多步骤任务 | ||||
|             currTaskInfoVo.setIsAuto(currTask.getIsAuto()); | ||||
|             //任务状态 | ||||
|             if (currTask.getStatus() == 1) { | ||||
|                 currTaskInfoVo.setStatus(currTask.getStatus()); | ||||
|             } else if (currTask.getIsCache() == 1) { | ||||
|                 currTaskInfoVo.setStatus(2); | ||||
|             } else { | ||||
|                 currTaskInfoVo.setStatus(0); | ||||
|             } | ||||
|             //生产单号 | ||||
|             if (currTask.getSheetNo() != null) { | ||||
|                 currTaskInfoVo.setSheetNo(currTask.getSheetNo()); | ||||
|             } | ||||
|             currTaskInfoVo.setCreateTime(currTask.getCreateTime()); | ||||
|             //开始位置 | ||||
|             currTaskInfoVo.setStartPosition(currTask.getStartPosition()); | ||||
|             //currTask | ||||
|             if (currTask.getIsAuto() == 1) { | ||||
|                 List<CurrTask> currTasks = currTaskServiceBiz | ||||
|                         .list(new QueryWrapper<CurrTask>() | ||||
|                                 .eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()) | ||||
|                                 .orderByAsc(CurrTask.ID)); | ||||
|                 List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class); | ||||
|                 currTaskInfoVo.setCurrTaskVoList(currTaskVos); | ||||
|                 String allStep = "液压台"; | ||||
|                 String nowStep = "未开始"; | ||||
|                 for (CurrTask currTask1 : currTasks | ||||
|                 ) { | ||||
|                     InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId())); | ||||
|                     if (inStockInfo != null) { | ||||
|                         List<InStockInfoVo> inStockInfoVoList = new ArrayList<>(); | ||||
|                         InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build(); | ||||
|                         BeanUtils.copyProperties(inStockInfo, inStockInfoVo); | ||||
|                         inStockInfoVoList.add(inStockInfoVo); | ||||
|                         currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList); | ||||
|                     } | ||||
|                     if (currTask1.getStatus() == 1) { | ||||
|                         nowStep = currTask1.getTargetPosition(); | ||||
|                     } else if (currTask1.getIsCache() == 1) { | ||||
|                         nowStep = currTask.getLocationName(); | ||||
|                     } | ||||
|                     if (currTaskInfoVo.getInStockInfoVoList() != null) { | ||||
|                         if (currTaskInfoVo.getCurrTaskVoList().size() > 0) { | ||||
|  | ||||
|                             nowStep = currTaskInfoVo.getInStockInfoVoList().get(0).getLocationName(); | ||||
|                         } | ||||
|                     } | ||||
|                     allStep = allStep.concat("->").concat(currTask1.getTargetPosition()); | ||||
|                 } | ||||
|                 // | ||||
|                 currTaskInfoVo.setAllStep(allStep); | ||||
|                 currTaskInfoVo.setNowStep(nowStep); | ||||
|                 currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId()); | ||||
|             } else { | ||||
|                 currTaskInfoVo.setAllStep(currTask.getTargetPosition()); | ||||
|                 if (currTask.getStatus() == 1) { | ||||
|                     currTaskInfoVo.setNowStep(currTask.getTargetPosition()); | ||||
|                 } else if (currTask.getIsCache() == 1) { | ||||
|                     currTaskInfoVo.setNowStep(currTask.getLocationName()); | ||||
|                 } | ||||
|                 currTaskInfoVo.setAutoExeTaskId(currTask.getId()); | ||||
|                 InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); | ||||
|                 if (inStockInfo != null) { | ||||
|                     List<InStockInfoVo> inStockInfoVoList = new ArrayList<>(); | ||||
|                     InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build(); | ||||
|                     BeanUtils.copyProperties(inStockInfo, inStockInfoVo); | ||||
|                     inStockInfoVoList.add(inStockInfoVo); | ||||
|                     currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList); | ||||
|                 } | ||||
|             } | ||||
|             //currTaskDet | ||||
|             List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|             currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class)); | ||||
|             for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList() | ||||
|             ) { | ||||
|                 String idenCardNum = currTaskDetVo.getIdenCardNum(); | ||||
|                 OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum)); | ||||
|                 currTaskDetVo.setCustomer(orderInfo.getCustomerName()); | ||||
|                 currTaskDetVo.setCraftIll(orderInfo.getCraftIll()); | ||||
|                 currTaskDetVo.setProductModel(orderInfo.getProductModel()); | ||||
|             } | ||||
|             list.add(currTaskInfoVo); | ||||
|         } | ||||
|         list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new)); | ||||
|  | ||||
|         return successful(list); | ||||
|     } | ||||
|  | ||||
|     //获取未成功报工apms的任务,判定标准:没有生产单号,状态为完成 | ||||
|     @Override | ||||
|     public R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param) { | ||||
|         QueryWrapper<CurrTask> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(CurrTask.VALID, 1); | ||||
|         wrapper.in(CurrTask.STATUS, 2); | ||||
|         wrapper.isNull(CurrTask.SHEET_NO); | ||||
|         wrapper.between(CurrTask.CREATE_TIME, "2022-11-19 05:14:11", LocalDateTime.now()); | ||||
|         List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper); | ||||
|         List<CurrTaskInfoVo> list = new ArrayList<>(); | ||||
|         for (CurrTask currTask : currTaskList | ||||
|         ) { | ||||
|             CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build(); | ||||
|             //currTask | ||||
|             if (currTask.getIsAuto() == 1) { | ||||
|  | ||||
|  | ||||
|                 currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId()); | ||||
|                 List<CurrTask> currTasks = currTaskServiceBiz | ||||
|                         .list(new QueryWrapper<CurrTask>() | ||||
|                                 .eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()) | ||||
|                                 .orderByAsc(CurrTask.ID)); | ||||
|                 List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class); | ||||
|                 currTaskInfoVo.setCurrTaskVoList(currTaskVos); | ||||
|                 String allStep = ""; | ||||
|                 for (CurrTask currTask1 : currTasks | ||||
|                 ) { | ||||
|  | ||||
|                     allStep = allStep.concat("->").concat(currTask1.getTargetPosition()); | ||||
|                 } | ||||
|                 currTaskInfoVo.setAllStep(allStep); | ||||
|             } else { | ||||
|                 currTaskInfoVo.setAllStep(currTask.getTargetPosition()); | ||||
|             } | ||||
|             //currTaskDet | ||||
|             List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|             currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class)); | ||||
|             for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList() | ||||
|             ) { | ||||
|                 String idenCardNum = currTaskDetVo.getIdenCardNum(); | ||||
|                 OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum)); | ||||
|                 currTaskDetVo.setCustomer(orderInfo.getCustomerName()); | ||||
|                 currTaskDetVo.setCraftIll(orderInfo.getCraftIll()); | ||||
|                 currTaskDetVo.setProductModel(orderInfo.getProductModel()); | ||||
|             } | ||||
|             list.add(currTaskInfoVo); | ||||
|         } | ||||
|         list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new)); | ||||
|  | ||||
|         return successful(list); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo) { | ||||
|         List<CurrTaskDetVo> currTaskDetVoList = currTaskInfoVo.getCurrTaskDetVoList(); | ||||
|         List<CurrTaskVo> currTaskVoList = currTaskInfoVo.getCurrTaskVoList(); | ||||
|         //报工apms | ||||
|         List<CurrTaskDet> currTaskDetList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetVoList, CurrTaskDet.class); | ||||
|         List<CurrTask> currTasks = com.mt.wms.core.utils.BeanUtils.copyList(currTaskVoList, CurrTask.class); | ||||
|         for (CurrTask currTask1 : currTasks | ||||
|         ) { | ||||
|             if (currTask1.getIsAuto() == 1) { | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTaskInfoVo.getAutoExeTaskId()); | ||||
|                 KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask1.getKilnId()); | ||||
|                 //加工炉为BMA或BMB时上报apms,其他的不需要上报 | ||||
|                 if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) { | ||||
|                     if (currTask1.getStoveCode() == null) { | ||||
|                         return failed("该任务没有正常进炉加工生成炉号,不能上报apms!"); | ||||
|                     } | ||||
|                     //通知apms创建一个生产单 | ||||
|                     ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); | ||||
|                     apmsCreateSheet.setWorkShopCode("BM"); | ||||
|                     apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|                     apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString()); | ||||
|                     //fixme 暂时没有正式user,使用测试账户 | ||||
|                     apmsCreateSheet.setStartUser("QJJP03"); | ||||
|                     ArrayList<CreateItem> createItems = new ArrayList<>(); | ||||
|                     currTaskDetList.forEach(e -> { | ||||
|                         CreateItem createItem = new CreateItem(); | ||||
|                         createItem.setItemCode(e.getIdenCardNum()); | ||||
|                         createItem.setQuantity(e.getQuantity().intValue()); | ||||
|                         BigDecimal b = new BigDecimal(String.valueOf(e.getWeight())); | ||||
|                         createItem.setWeight(b.doubleValue()); | ||||
|                         createItems.add(createItem); | ||||
|                     }); | ||||
|                     //apmsCreateSheet.setStoveCode(code); | ||||
|                     if (currTask1.getStoveCode() != null) { | ||||
|                         apmsCreateSheet.setStoveCode(currTask1.getStoveCode()); | ||||
|                     } | ||||
|                     apmsCreateSheet.setItems(createItems); | ||||
|                     logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报"); | ||||
|                     R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); | ||||
|                     if (!processSheet.getData().getSuccess()) { | ||||
|                         logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
|                         return failed(processSheet.getData().getMsg()); | ||||
|                     } else { | ||||
|                         logger.info(currTask1.getId() + "创建apms生产单号成功"); | ||||
|                         currTask1.setSheetNo(processSheet.getData().getSheetNo()); | ||||
|                         currTaskServiceBiz.updateById(currTask1); | ||||
|                         //多步骤任务除了第一步写入sheetNo | ||||
|                         if (currTask1.getIsAuto() == 1) { | ||||
|                             CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); | ||||
|                             secondCurrTask.setSheetNo(currTask1.getSheetNo()); | ||||
|                             currTaskServiceBiz.updateById(secondCurrTask); | ||||
|                             //三步任务 | ||||
|                             if (autoExeTask.getProcessFlowType() == 2) { | ||||
|                                 CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); | ||||
|                                 threeCurrTask.setSheetNo(currTask1.getSheetNo()); | ||||
|                                 currTaskServiceBiz.updateById(threeCurrTask); | ||||
|                             } | ||||
|                         } | ||||
|                         return successful("上报APMS成功"); | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|                 //通知apms创建一个生产单 | ||||
|                 ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); | ||||
|                 apmsCreateSheet.setWorkShopCode("BM"); | ||||
|                 apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|                 apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString()); | ||||
|                 //fixme 暂时没有正式user,使用测试账户 | ||||
|                 apmsCreateSheet.setStartUser("QJJP03"); | ||||
|                 ArrayList<CreateItem> createItems = new ArrayList<>(); | ||||
|                 currTaskDetList.forEach(e -> { | ||||
|                     CreateItem createItem = new CreateItem(); | ||||
|                     createItem.setItemCode(e.getIdenCardNum()); | ||||
|                     createItem.setQuantity(e.getQuantity().intValue()); | ||||
|                     BigDecimal b = new BigDecimal(String.valueOf(e.getWeight())); | ||||
|                     createItem.setWeight(b.doubleValue()); | ||||
|                     createItems.add(createItem); | ||||
|                 }); | ||||
|                 //apmsCreateSheet.setStoveCode(code); | ||||
|                 if (currTask1.getStoveCode() != null) { | ||||
|                     apmsCreateSheet.setStoveCode(currTask1.getStoveCode()); | ||||
|                 } | ||||
|                 apmsCreateSheet.setItems(createItems); | ||||
|                 logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报"); | ||||
|                 R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); | ||||
|                 if (!processSheet.getData().getSuccess()) { | ||||
|                     logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
|                     return failed(processSheet.getData().getMsg()); | ||||
|                 } else { | ||||
|                     logger.info(currTask1.getId() + "创建apms生产单号成功"); | ||||
|                     currTask1.setSheetNo(processSheet.getData().getSheetNo()); | ||||
|                     currTaskServiceBiz.updateById(currTask1); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public R<String> updateCurrTaskStatus(CurrTaskParam param) { | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(param.getId()); | ||||
|         Integer status = param.getStatus(); | ||||
|         Long kilnId = param.getKilnId(); | ||||
|         //修改任务状态 | ||||
|         if (!status.equals(currTask.getStatus())) { | ||||
|             //修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改 | ||||
|             if (status == 1) { | ||||
|                 currTask.setStatus(1); | ||||
|                 currTask.setIsIn(1); | ||||
|                 currTask.setUpdaterId(99); | ||||
|                 currTask.setUpdateTime(LocalDateTime.now()); | ||||
|                 currTask.setBeginTime(LocalDateTime.now()); | ||||
|                 //生产炉号 | ||||
|                 createStoveCode(currTask); | ||||
|                 InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); | ||||
|                 if (inStockInfo != null) { | ||||
|                     //更新库位状态为未占用 | ||||
|                     Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); | ||||
|                     location.setStatus(0); | ||||
|                     locationServiceBiz.updateById(location); | ||||
|                     //删除库位缓存 | ||||
|                     inStockInfoServiceBiz.removeById(inStockInfo); | ||||
|                 } | ||||
|                 if (currTask.getIsAuto() == 1) { | ||||
|                     AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); | ||||
|                     if (currTask.getId().equals(autoExeTask.getFTaskId())) { | ||||
|                         //该任务为自动任务第一条,是否有sheetNo,若无上报apms | ||||
|                         if (currTask.getSheetNo() == null) { | ||||
|                             try { | ||||
|                                 apmsCreateProcess(currTask); | ||||
|                             } catch (IOException e) { | ||||
|                                 e.printStackTrace(); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     if (currTask.getId().equals(autoExeTask.getTTaskId())) { | ||||
|                         //该任务为自动任务第二条,修改自动任务第一条的状态 | ||||
|                         CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); | ||||
|                         currTask1.setStatus(2); | ||||
|                         currTask1.setIsIn(2); | ||||
|                         //99代表该条记录手动修改过 | ||||
|                         currTask1.setUpdaterId(99); | ||||
|                         currTask1.setUpdateTime(LocalDateTime.now()); | ||||
|                         currTaskServiceBiz.updateById(currTask1); | ||||
|                         apmsEndProcess(currTask1); | ||||
|                         apmsStartProcess(currTask); | ||||
|                     } else if (currTask.getId().equals(autoExeTask.getThTaskId())) { | ||||
|                         //该任务为自动任务第三条,修改自动任务第二条的状态 | ||||
|                         CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); | ||||
|                         currTask2.setStatus(2); | ||||
|                         currTask2.setIsIn(2); | ||||
|                         //99代表该条记录手动修改过 | ||||
|                         currTask2.setUpdaterId(99); | ||||
|                         currTask2.setUpdateTime(LocalDateTime.now()); | ||||
|                         currTaskServiceBiz.updateById(currTask2); | ||||
|                         apmsEndProcess(currTask2); | ||||
|                         apmsStartProcess(currTask); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 currTaskServiceBiz.updateById(currTask); | ||||
|                 logger.info("修改任务" + currTask.getId() + "状态为加工中成功"); | ||||
|             } | ||||
|             //修改为加工完成,查询缓存,并修改 | ||||
|             if (status == 2) { | ||||
|                 InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); | ||||
|                 if (inStockInfo != null) { | ||||
|                     //更新库位状态为未占用 | ||||
|                     Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); | ||||
|                     location.setStatus(0); | ||||
|                     locationServiceBiz.updateById(location); | ||||
|                     //删除库位缓存 | ||||
|                     inStockInfoServiceBiz.removeById(inStockInfo); | ||||
|  | ||||
|                 } | ||||
|                 currTask.setStatus(1); | ||||
|                 currTask.setCreatorId(99); | ||||
|                 currTask.setBeginTime(LocalDateTime.now()); | ||||
|                 currTaskServiceBiz.updateById(currTask); | ||||
|                 logger.info("修改任务" + currTask.getId() + "状态为加工完成成功"); | ||||
|                 //存入历史任务表以便查询能源消耗 | ||||
|                 TaskHis taskHis = new TaskHis(); | ||||
|                 org.springframework.beans.BeanUtils.copyProperties(currTask, taskHis); | ||||
|                 taskHis.setStatus(2); | ||||
|                 taskHis.setIsIn(2); | ||||
|                 taskHis.setTaskId(currTask.getId()); | ||||
|                 taskHisServiceBiz.save(taskHis); | ||||
|                 List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|                 List<TaskDetHis> taskDetHisList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDets, TaskDetHis.class); | ||||
|                 taskDetHisServiceBiz.saveBatch(taskDetHisList); | ||||
|             } | ||||
|             currTask.setStatus(status); | ||||
|             currTask.setCreatorId(99); | ||||
|             currTask.setBeginTime(LocalDateTime.now()); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             logger.info("修改任务" + currTask.getId() + "状态为未加工成功"); | ||||
|         } | ||||
|         //修改目标加工炉 | ||||
|         if (!kilnId.equals(currTask.getKilnId())) { | ||||
|             KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId); | ||||
|             //修改目标加工炉,修改终点 | ||||
|             currTask.setKilnId(kilnId); | ||||
|             currTask.setTargetPosition(kiln.getCode()); | ||||
|             currTask.setUpdaterId(99); | ||||
|             currTask.setUpdateTime(LocalDateTime.now()); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); | ||||
|             //是否存在缓存 | ||||
|             if (inStockInfo != null) { | ||||
|                 //修改缓存后目标加工炉 | ||||
|                 inStockInfo.setKilnId(kilnId); | ||||
|                 inStockInfo.setKilnName(kiln.getKilnName()); | ||||
|                 inStockInfo.setUpdaterId(99); | ||||
|                 inStockInfo.setUpdateTime(LocalDateTime.now()); | ||||
|                 inStockInfoServiceBiz.updateById(inStockInfo); | ||||
|             } | ||||
|             //任务为多步骤任务 | ||||
|             if (currTask.getIsAuto() == 1) { | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); | ||||
|                 //任务为多步骤任务第一步 | ||||
|                 if (currTask.getId().equals(autoExeTask.getFTaskId())) { | ||||
|                     //修改多步骤第二步的起点 | ||||
|                     CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); | ||||
|                     currTask2.setStartPosition(kiln.getCode()); | ||||
|                     currTask2.setUpdateTime(LocalDateTime.now()); | ||||
|                     currTask2.setUpdaterId(99); | ||||
|                     currTaskServiceBiz.updateById(currTask2); | ||||
|                 } else if (currTask.getId().equals(autoExeTask.getTTaskId())) { | ||||
|                     //任务为多步骤任务第二步且有第三步,修改第三步起点 | ||||
|                     if (autoExeTask.getProcessFlowType() == 2) { | ||||
|                         CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); | ||||
|                         currTask3.setStartPosition(kiln.getCode()); | ||||
|                         currTask3.setUpdateTime(LocalDateTime.now()); | ||||
|                         currTask3.setUpdaterId(99); | ||||
|                         currTaskServiceBiz.updateById(currTask3); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return successful("操作成功!"); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public R<String> completeTask(IdParam param) { | ||||
|         CurrTask byId = currTaskServiceBiz.getById(param.getId()); | ||||
| @@ -136,7 +546,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|         List<CurrTaskDet> taskDetailsByMainId = currTaskDetService.getTaskDetailsByMainId(IdParam.builder().id(byId.getId()).build()); | ||||
|         List<TaskDetHis> taskDetHis = com.mt.wms.core.utils.BeanUtils.copyList(taskDetailsByMainId, TaskDetHis.class); | ||||
|         taskDetHis.forEach(detHis -> { | ||||
|             detHis.setTaskId(save.getData().getId()); | ||||
|             detHis.setCurrTaskId(save.getData().getId()); | ||||
|         }); | ||||
|         //将详细任务信息放入详细历史表 | ||||
|         taskDetHisService.saveList(taskDetHis); | ||||
| @@ -145,24 +555,109 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|  | ||||
|     @Override | ||||
|     public R<String> deleteBySheetNo(String sheetNo) { | ||||
|         CurrTask byId = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo)); | ||||
|         //如果尚未执行(状态 0) | ||||
|         if (byId.getStatus() == 0) | ||||
|         { | ||||
|         //一个生产单可能对应多个currTask,删除的时候查询是否对应多个,如果对应多个,自动循环删除所有currTask,当删除最后一条currTask时上报apms | ||||
|         List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo)); | ||||
|         if (currTaskList.size() > 1) { | ||||
|             int i = 0; | ||||
|             for (CurrTask currTask : currTaskList | ||||
|             ) { | ||||
|                 i++; | ||||
|                 if (currTask.getStatus() == 0) { | ||||
|                     if (i == currTaskList.size()) { | ||||
|                         R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); | ||||
|                         if (!apmsStartProcessR.getData().getSuccess()) { | ||||
|                             return failed(apmsStartProcessR.getData().getMsg()); | ||||
|                         } | ||||
|                     } | ||||
|                     Long currTaskId = currTask.getId(); | ||||
|                     if (currTask.getIsAuto() == 1) { | ||||
|                         List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())); | ||||
|                         if (currTaskList2.size() == 1) { | ||||
|                             autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId()); | ||||
|                         } | ||||
|                     } | ||||
|                     currTaskServiceBiz.removeById(currTaskId); | ||||
|                     currTaskDetService.deleteByCurrTaskId(currTaskId); | ||||
|  | ||||
|             R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); | ||||
|             if (apmsStartProcessR.getData().getSuccess()) | ||||
|             { | ||||
|                 currTaskServiceBiz.removeById(byId.getId()); | ||||
|                 currTaskDetService.deleteByCurrTaskId(byId.getId()); | ||||
|                 return successful("APMS生产单删除成功。"); | ||||
|                 } | ||||
|                 if (currTask.getStatus() == 2) { | ||||
|                     return failed("无法删除,任务已加工完成。"); | ||||
|                 } | ||||
|                 if (currTask.getStatus() == 1) { | ||||
|                     return failed("无法删除,任务正在执行中。"); | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 return failed(apmsStartProcessR.getData().getMsg()); | ||||
|             return successful(0, "APMS生产单删除成功。", ""); | ||||
|         } else { | ||||
|             for (CurrTask currTask : currTaskList | ||||
|             ) { | ||||
|                 if (currTask.getStatus() == 0) { | ||||
|                     R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); | ||||
|                     if (apmsStartProcessR.getData().getSuccess()) { | ||||
|                         Long currTaskId = currTask.getId(); | ||||
|                         if (currTask.getIsAuto() == 1) { | ||||
|                             List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())); | ||||
|                             if (currTaskList2.size() == 1) { | ||||
|                                 autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId()); | ||||
|                             } | ||||
|                         } | ||||
|                         currTaskServiceBiz.removeById(currTaskId); | ||||
|                         currTaskDetService.deleteByCurrTaskId(currTaskId); | ||||
|                         if (currTask.getIsAuto() == 1) { | ||||
|                             List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())); | ||||
|                             if (currTaskList2.size() == 0) { | ||||
|                                 autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId()); | ||||
|                             } | ||||
|                         } | ||||
|                         return successful(0, "APMS生产单删除成功。", ""); | ||||
|                     } else { | ||||
|                         return failed(apmsStartProcessR.getData().getMsg()); | ||||
|                     } | ||||
|                 } | ||||
|                 if (currTask.getStatus() == 2) { | ||||
|                     return failed("无法删除,任务已加工完成。"); | ||||
|                 } | ||||
|                 if (currTask.getStatus() == 1) { | ||||
|                     return failed("无法删除,任务正在执行中。"); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         return failed("无法删除,任务正在执行中。"); | ||||
|         return failed("根据生产单号删除任务失败!"); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public R<String> deleteById(IdParam idParam) { | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(idParam.getId()); | ||||
|         if (currTask.getIsAuto() == 1) { | ||||
|             List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())); | ||||
|             for (CurrTask currTask1 : currTaskList | ||||
|             ) { | ||||
|                 if (currTask1.getStatus() != 0) { | ||||
|                     return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!"); | ||||
|                 } | ||||
|             } | ||||
|             //能删除 | ||||
|             autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId()); | ||||
|             for (CurrTask currTask1 : currTaskList | ||||
|             ) { | ||||
|                 InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId())); | ||||
|                 if (inStockInfo != null) { | ||||
|                     Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); | ||||
|                     location.setStatus(0); | ||||
|                     locationServiceBiz.updateById(location); | ||||
|                     inStockInfoServiceBiz.removeById(inStockInfo); | ||||
|                 } | ||||
|                 currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask1.getId())); | ||||
|                 currTaskServiceBiz.removeById(currTask1); | ||||
|             } | ||||
|             return R.ok(idParam.getId().toString()); | ||||
|         } else { | ||||
|             currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|             currTaskServiceBiz.removeById(idParam); | ||||
|             return R.ok(idParam.getId().toString()); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
| @@ -195,6 +690,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|                     } | ||||
|             ); | ||||
|             e.setCustomers(customers); | ||||
|             e.setKilnName(e.getTargetPosition()); | ||||
|             //e.setLocationName(locationServiceBiz.getById(e.getLocationId()).getLocationName()); | ||||
|         }); | ||||
|         return successful(pageVo); | ||||
|     } | ||||
| @@ -202,6 +699,19 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     @Override | ||||
|     public R runTask(Long taskId) throws InterruptedException, IOException { | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(taskId); | ||||
|         if (currTask.getStatus() != 0) { | ||||
|             return R.failed("该任务状态不为未执行,无法执行!"); | ||||
|         } | ||||
|         if (currTask.getCacheSatatus()==2&&currTask.getIsCache()==1){ | ||||
|             return R.failed("该任务已在缓存队列,状态不为未执行,无法执行!"); | ||||
|         } | ||||
|         //是否为自动任务 | ||||
|         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); | ||||
|     } | ||||
|  | ||||
| @@ -209,4 +719,165 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早 | ||||
|      * | ||||
|      * @param idParam | ||||
|      * @return | ||||
|      */ | ||||
|     @Override | ||||
|     public R<String> top(IdParam idParam) { | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(idParam.getId()); | ||||
|         currTask.getIsCache(); | ||||
|         if (currTask.getIsCache() == 0) { | ||||
|             return R.failed("当前任务未进入等待队列,不能置顶"); | ||||
|         } | ||||
|         Long kilnId = currTask.getKilnId(); | ||||
|         List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>() | ||||
|                 .eq(InStockInfo.KILN_ID, kilnId) | ||||
|                 .eq(InStockInfo.TYPE, 1) | ||||
|                 .eq(InStockInfo.STATUS, 2) | ||||
|                 .orderByAsc(InStockInfo.IN_TIME)); | ||||
|  | ||||
|         if (inStockInfoList.size() < 2) { | ||||
|             return R.failed("当前加工炉等待队列只有一个任务,无需置顶"); | ||||
|         } | ||||
|         LocalDateTime inTime = null; | ||||
|         inTime = inStockInfoList.get(0).getInTime(); | ||||
|         InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID, currTask.getLocationId())); | ||||
|         inStockInfo.setInTime(inTime.minusHours(1)); | ||||
|         inStockInfoServiceBiz.updateById(inStockInfo); | ||||
|         return R.ok("当前任务置顶成功", ""); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 上报apms创建生产单并开始处理 | ||||
|      * | ||||
|      * @param currTask 任务 | ||||
|      * @return 成功与否 | ||||
|      * @throws IOException | ||||
|      */ | ||||
|     private Boolean apmsCreateProcess(CurrTask currTask) throws IOException { | ||||
|         List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|         String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode(); | ||||
|         //通知apms创建一个生产单 | ||||
|         ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); | ||||
|         apmsCreateSheet.setWorkShopCode("BM"); | ||||
|         apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|         apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString()); | ||||
|         //fixme 暂时没有正式user,使用测试账户 | ||||
|         apmsCreateSheet.setStartUser("QJJP03"); | ||||
|         ArrayList<CreateItem> createItems = new ArrayList<>(); | ||||
|         currTaskDetList.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(code); | ||||
|         apmsCreateSheet.setItems(createItems); | ||||
|         logger.info(currTask.getId() + "开始创建apms生产单号"); | ||||
|         R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); | ||||
|         if (!processSheet.getData().getSuccess()) { | ||||
|             logger.info(currTask.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg()); | ||||
|             webSocketServer.sendtoUser("创建失败,APMS报错:" + processSheet.getData().getMsg(), "1"); | ||||
|             return false; | ||||
|         } else { | ||||
|             logger.info(currTask.getId() + "创建apms生产单号成功"); | ||||
|             currTask.setSheetNo(processSheet.getData().getSheetNo()); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             //多步骤任务除了第一步写入sheetNo | ||||
|             if (currTask.getIsAuto() == 1) { | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); | ||||
|                 CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); | ||||
|                 secondCurrTask.setSheetNo(currTask.getSheetNo()); | ||||
|                 currTaskServiceBiz.updateById(secondCurrTask); | ||||
|                 //三步任务 | ||||
|                 if (autoExeTask.getProcessFlowType() == 2) { | ||||
|                     CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); | ||||
|                     threeCurrTask.setSheetNo(currTask.getSheetNo()); | ||||
|                     currTaskServiceBiz.updateById(threeCurrTask); | ||||
|                 } | ||||
|             } | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
|     /** | ||||
|      * 上报apms开始加工 | ||||
|      * | ||||
|      * @param currTask | ||||
|      * @return | ||||
|      */ | ||||
|     private Boolean apmsStartProcess(CurrTask currTask) { | ||||
|         String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode(); | ||||
|         ApmsStartProcess apmsStartProcess = new ApmsStartProcess(); | ||||
|         apmsStartProcess.setStartUser("QJJP03"); | ||||
|         apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|         apmsStartProcess.setTechName(currTask.getCraftCodeId().toString()); | ||||
|         apmsStartProcess.setSheetNo(currTask.getSheetNo()); | ||||
|         if (currTask.getStoveCode() != null) { | ||||
|             apmsStartProcess.setStoveCode(currTask.getStoveCode()); | ||||
|         } | ||||
|  | ||||
|         R<ApmsStartProcess> apmsStartProcessR = apmsControl.startProcess(apmsStartProcess); | ||||
|         if (apmsStartProcessR.getCode() != 0) { | ||||
|             logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败"); | ||||
|             return false; | ||||
|         } | ||||
|         logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功"); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 上报apms-end | ||||
|      * | ||||
|      * @param currTask | ||||
|      * @return | ||||
|      */ | ||||
|     private Boolean apmsEndProcess(CurrTask currTask) { | ||||
|         ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); | ||||
|         LocalDateTime date=LocalDateTime.now(); | ||||
|         if (currTask.getEndTime()!=null){ | ||||
|             date=currTask.getEndTime(); | ||||
|         } | ||||
|         apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|         apmsEndProcess.setEndUser("QJJP03"); | ||||
|         apmsEndProcess.setSheetNo(currTask.getSheetNo()); | ||||
|         R<ApmsEndProcessVo> apmsEndProcessVoR = apmsControl.endProcess(apmsEndProcess); | ||||
|         if (apmsEndProcessVoR.getCode() != 0) { | ||||
|             logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败"); | ||||
|             return false; | ||||
|         } | ||||
|         logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功"); | ||||
|         return true; | ||||
|     } | ||||
|     /** | ||||
|      * 生成炉号 | ||||
|      * 多步骤任务除了第一步为清洗炉外,每步都生成炉号 | ||||
|      * 单步骤任务都生成炉号 | ||||
|      */ | ||||
|     private void createStoveCode(CurrTask currTask) { | ||||
|         //单步骤任务,直接生成炉号 | ||||
|         if (currTask.getIsAuto() == 0) { | ||||
|             String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue()); | ||||
|             currTask.setStoveCode(stoveCode); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             return; | ||||
|         } | ||||
|         //多步骤任务,只有BMA,BMB步骤生成炉号 | ||||
|         else { | ||||
|             //获取加工炉 | ||||
|             KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId()); | ||||
|             //只有BMA,BMB生成炉号 | ||||
|             if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) { | ||||
|                 String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue()); | ||||
|                 currTask.setStoveCode(stoveCode); | ||||
|                 currTaskServiceBiz.updateById(currTask); | ||||
|             } else { | ||||
|                 logger.info(currTask.getId() + "任务为多步骤任务但该步骤不生成洗炉炉号."); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,46 @@ | ||||
| package com.mt.wms.empty.service.impl; | ||||
|  | ||||
| import com.mt.wms.core.base.BaseService; | ||||
| import com.mt.wms.core.dal.entity.CurrTask; | ||||
| import com.mt.wms.core.dal.service.CurrTaskServiceBiz; | ||||
| import com.mt.wms.core.vo.R; | ||||
| import com.mt.wms.empty.mapper.EleMapper; | ||||
| import com.mt.wms.empty.service.EleService; | ||||
| import com.mt.wms.empty.vo.CountEleVo; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/12/27 | ||||
|  */ | ||||
| @Service | ||||
| public class EleServiceImpl extends BaseService implements EleService { | ||||
|  | ||||
|     @Resource | ||||
|     EleMapper eleMapper; | ||||
|     @Resource | ||||
|     CurrTaskServiceBiz currTaskServiceBiz; | ||||
|  | ||||
|     @Override | ||||
|     public R list(Long kilnId) { | ||||
|         List<CountEleVo> list = eleMapper.list(kilnId); | ||||
|         for (CountEleVo countEleVo:list | ||||
|              ) { | ||||
|             CurrTask currTask = currTaskServiceBiz.getById(countEleVo.getTaskId()); | ||||
|             if (currTask.getStoveCode()==null){ | ||||
|                 if (currTask.getSheetNo()!=null){ | ||||
|                     currTask.setStoveCode(currTask.getSheetNo()); | ||||
|                 }else { | ||||
|                     currTask.setStoveCode(currTask.getTaskCode()); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|             countEleVo.setStoveCode(currTask.getStoveCode()); | ||||
|             countEleVo.setCreateTime(currTask.getCreateTime()); | ||||
|         } | ||||
|         return successful(list); | ||||
|     } | ||||
| } | ||||
| @@ -98,22 +98,22 @@ public class OrderInfoHisServiceImpl extends BaseService implements OrderInfoHis | ||||
|         //获取车辆信息 | ||||
|         R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam()); | ||||
|         Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); | ||||
|         //获取窑炉信息 | ||||
|         //获取工业炉信息 | ||||
|         R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam()); | ||||
|         Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId)); | ||||
|         currOrderCurrTask.getRecords().forEach(orderInfo -> | ||||
|                 { | ||||
|                     //获取对应的任务 | ||||
|                     CurrTaskVo currTask = taskHisService.getById(IdParam.builder().id(orderInfo.getCurrTaskId()).build()); | ||||
|                     orderInfo.setABeginTime(currTask.getABeginTime()); | ||||
|                     orderInfo.setAEndTime(currTask.getAEndTime()); | ||||
|                     orderInfo.setABeginTime(currTask.getBeginTime()); | ||||
|                     orderInfo.setAEndTime(currTask.getEndTime()); | ||||
|                     orderInfo.setTaskType(currTask.getTaskType()); | ||||
|                     orderInfo.setStatus(currTask.getStatus()); | ||||
|                     orderInfo.setKilnId(currTask.getKilnId()); | ||||
|                     orderInfo.setStartPosition(currTask.getStartPosition()); | ||||
|                     orderInfo.setTargetPosition(currTask.getTargetPosition()); | ||||
|                     orderInfo.setVehicleId(currTask.getVehicleId()); | ||||
|                     //获取窑炉和车辆的名称信息 | ||||
|                     //获取工业炉和车辆的名称信息 | ||||
|                     if (orderInfo.getKilnId() != null) | ||||
|                     { | ||||
|                         orderInfo.setKilnName(collect2.get(orderInfo.getKilnId()).get(0).getKilnName()); | ||||
|   | ||||
| @@ -14,8 +14,10 @@ import com.mt.wms.core.base.BaseService; | ||||
| import com.mt.wms.core.dal.entity.ApmsCheckResult; | ||||
| import com.mt.wms.core.dal.entity.CurrTaskDet; | ||||
| import com.mt.wms.core.dal.entity.OrderInfo; | ||||
| import com.mt.wms.core.dal.entity.OrderInfoHis; | ||||
| import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz; | ||||
| import com.mt.wms.core.dal.service.CommunicationLogServiceBiz; | ||||
| import com.mt.wms.core.dal.service.OrderInfoHisServiceBiz; | ||||
| import com.mt.wms.core.dal.service.OrderInfoServiceBiz; | ||||
| import com.mt.wms.core.enums.WhetherEnum; | ||||
| import com.mt.wms.core.params.IdParam; | ||||
| @@ -81,6 +83,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|     ApmsCheckResultServiceBiz apmsCheckResultServiceBiz; | ||||
|     @Autowired | ||||
|     ApmsController apmsControl; | ||||
|     @Autowired | ||||
|     OrderInfoHisServiceBiz orderInfoHisServiceBiz; | ||||
|  | ||||
|     private void setCommon(OrderInfo communicationLog) { | ||||
|         communicationLog.setValid(WhetherEnum.YES.getValue()); | ||||
| @@ -95,6 +99,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         setCommon(orderInfo); | ||||
|         //设定来源信息为apms | ||||
|         orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue()); | ||||
|         //apms传来的技术要求字段使用工艺要求字段,不关注工艺要求字段, | ||||
|         orderInfo.setCraftIll(apmsPostOrderParam.getTechRequest()); | ||||
|         orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE")); | ||||
|         //检查是否为重复的单号 | ||||
|         OrderInfo one = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.ORDER_NO, apmsPostOrderParam.getOrderNo()).eq(OrderInfo.IDEN_CARD_NUM, apmsPostOrderParam.getIdenCardNum())); | ||||
| @@ -103,7 +109,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|             return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo()); | ||||
|         } | ||||
|         orderInfoService.save(orderInfo); | ||||
|         return successful("Wms接收Apms订单成功。", ""); | ||||
|         return successful(0,"Wms接收Apms订单成功。", ""); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -111,19 +117,33 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()), OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum()) | ||||
|                 .like(StringUtils.isNotBlank(param.getOrderNo()), OrderInfo.ORDER_NO, param.getOrderNo()) | ||||
|                 .like(StringUtils.isNotBlank(param.getCustomerName()),OrderInfo.CUSTOMER_NAME,param.getCustomerName()) | ||||
|                 .in(OrderInfo.STATUS,0,1) | ||||
|                 .eq(OrderInfo.ORDER_VOID,1) | ||||
|                 .orderByDesc(OrderInfo.CREATE_TIME); | ||||
|         Page<OrderInfo> page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper); | ||||
|         PageVo<OrderInfoVo> orderInfoVoPageVo = new PageVo<>(page, OrderInfoVo.class); | ||||
|         orderInfoVoPageVo.getRecords().forEach(e -> | ||||
|         { | ||||
|         for (OrderInfoVo e : orderInfoVoPageVo.getRecords()) { | ||||
|             R<OrderInfoVo> info = getTaskInfoByIdenCardNum(e.getIdenCardNum()); | ||||
|             e.setFinishWeight(info.getData().getFinishWeight()); | ||||
|             e.setFinishQuantity(info.getData().getQuantity()); | ||||
|             e.setFinishQuantity(info.getData().getFinishQuantity()); | ||||
|             e.setWaitWeight(info.getData().getWaitWeight()); | ||||
|             e.setWaitQuantity(info.getData().getWaitQuantity()); | ||||
|             e.setReProcessQuantity(info.getData().getReProcessQuantity()); | ||||
|             e.setReProcessWeight(info.getData().getReProcessWeight()); | ||||
|         }); | ||||
|             e.setSurplusQuantity(e.getQuantity() - e.getFinishQuantity() - e.getWaitQuantity()); | ||||
|             e.setSurplusWeight(e.getWeight() - e.getFinishWeight() - e.getWaitWeight()); | ||||
|             //当完成数量等于总数量且完成重量等于总重量时订单状态置为2 | ||||
|             if (e.getQuantity().equals(e.getFinishQuantity()) && e.getWeight().equals(e.getFinishWeight())) { | ||||
|                 OrderInfo orderInfo = orderInfoService.getById(e.getId()); | ||||
|                 orderInfo.setStatus(2); | ||||
|                 orderInfoService.updateById(orderInfo); | ||||
|                 OrderInfoHis orderInfoHis=new OrderInfoHis(); | ||||
|                 BeanUtils.copyProperties(orderInfo, orderInfoHis); | ||||
|                 orderInfoHisServiceBiz.save(orderInfoHis); | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         return successful(orderInfoVoPageVo); | ||||
|     } | ||||
|  | ||||
| @@ -147,7 +167,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         BeanUtils.copyProperties(byId, build); | ||||
|         R<OrderInfoVo> info = getTaskInfoByIdenCardNum(build.getIdenCardNum()); | ||||
|         build.setFinishWeight(info.getData().getFinishWeight()); | ||||
|         build.setFinishQuantity(info.getData().getQuantity()); | ||||
|         build.setFinishQuantity(info.getData().getFinishQuantity()); | ||||
|         build.setWaitWeight(info.getData().getWaitWeight()); | ||||
|         build.setWaitQuantity(info.getData().getWaitQuantity()); | ||||
|         build.setReProcessQuantity(info.getData().getReProcessQuantity()); | ||||
| @@ -165,32 +185,33 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param); | ||||
|         Assert.notNull("该订单暂无详细任务记录。", currOrderCurrTask.getRecords()); | ||||
|         //获取车辆信息 | ||||
|         R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam()); | ||||
|         Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); | ||||
|         //获取窑炉信息 | ||||
|         //R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam()); | ||||
|         //Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); | ||||
|         //获取工业炉信息 | ||||
|         R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam()); | ||||
|         Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId)); | ||||
|         currOrderCurrTask.getRecords().forEach(orderInfo -> | ||||
|                 { | ||||
|                     //获取对应的任务 | ||||
|                     CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build()); | ||||
|                     orderInfo.setABeginTime(currTask.getABeginTime()); | ||||
|                     orderInfo.setAEndTime(currTask.getAEndTime()); | ||||
|                     orderInfo.setTaskType(currTask.getTaskType()); | ||||
|                     orderInfo.setABeginTime(currTask.getBeginTime()); | ||||
|                     orderInfo.setAEndTime(currTask.getEndTime()); | ||||
|                     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.setTaskCode(currTask.getTaskCode()); | ||||
|                     //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); | ||||
| @@ -199,7 +220,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|     @Override | ||||
|     public R<OrderInfoVo> getTaskInfoByIdenCardNum(String idenCardNum) { | ||||
|         QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1); | ||||
|         wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1); | ||||
|         OrderInfo one = orderInfoService.getOne(wrapper); | ||||
|         Assert.notNull("未找到该标识卡信息!", one); | ||||
|         OrderInfoVo build = OrderInfoVo.builder().build(); | ||||
| @@ -216,7 +237,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         // 考虑返工单的加工情况,添加到返工统计信息中。 | ||||
|         if (Objects.nonNull(one.getOldOrderNo())) | ||||
|         { | ||||
|             List<OrderInfo> list = orderInfoService.list(new QueryWrapper<OrderInfo>().eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_NO, one.getOldOrderNo())); | ||||
|             List<OrderInfo> list = orderInfoService.list(new QueryWrapper<OrderInfo>().eq(OrderInfo.VALID, 1).eq(OrderInfo.IDEN_CARD_NUM, one.getOldOrderNo())); | ||||
|             float reQuantity = 0; | ||||
|             float reWeight = 0; | ||||
|             for (OrderInfo orderInfo : list) | ||||
| @@ -241,7 +262,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         for (TaskCreateDetParam detParam : detParams) | ||||
|         { | ||||
|             QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>(); | ||||
|             wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1); | ||||
|             wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1); | ||||
|             OrderInfo one = orderInfoService.getOne(wrapper); | ||||
|             Assert.notNull("错误,标识卡号" + detParam.getIdenCardNum() + "在订单中不存在!", one); | ||||
|         } | ||||
| @@ -265,7 +286,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         byId.setUpdateTime(LocalDateTime.now()); | ||||
|         byId.setOrderVoid(0); | ||||
|         orderInfoService.updateById(byId); | ||||
|         return successful("操作成功,订单状态置为作废。", ""); | ||||
|         return successful(0,"操作成功,订单状态置为作废。", ""); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -303,38 +324,23 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|         { | ||||
|             //通过标识卡号与生产单号进行检验结果存储 | ||||
|             ApmsCheckResult one = new ApmsCheckResult(); | ||||
|             one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); | ||||
|             one.setSheetNo(apmsCompleteOrder.getSheetNo()); | ||||
|             BeanUtils.copyProperties(apmsCompleteOrder, one); | ||||
|             one.setCreateTime(LocalDateTime.now()); | ||||
|             one.setUpdateTime(LocalDateTime.now()); | ||||
|             one.setValid(WhetherEnum.YES.getValue()); | ||||
|             one.setMetallography(apmsCompleteOrder.getMetallographic()); | ||||
|             one.setHeartHardness(apmsCompleteOrder.getHeartHardness()); | ||||
|             one.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne()); | ||||
|             one.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo()); | ||||
|             one.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree()); | ||||
|             one.setHardness(apmsCompleteOrder.getHardness()); | ||||
|             one.setUpdateTime(LocalDateTime.now()); | ||||
|             one.setRemake(apmsCompleteOrder.getRemake()); | ||||
|             apmsCheckResultServiceBiz.save(one); | ||||
|             //订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms | ||||
|             return successful("操作成功,接收检验结果完成。", ""); | ||||
|             return successful(0,"操作成功,接收检验结果完成。", ""); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             //存在检验结果更新的情况。主管或其他人员可能会更改结果。 | ||||
|             one1.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); | ||||
|             one1.setSheetNo(apmsCompleteOrder.getSheetNo()); | ||||
|             one1.setValid(WhetherEnum.YES.getValue()); | ||||
|             BeanUtils.copyProperties(apmsCompleteOrder, one1); | ||||
|             one1.setMetallography(apmsCompleteOrder.getMetallographic()); | ||||
|             one1.setHeartHardness(apmsCompleteOrder.getHeartHardness()); | ||||
|             one1.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne()); | ||||
|             one1.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo()); | ||||
|             one1.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree()); | ||||
|             one1.setHardness(apmsCompleteOrder.getHardness()); | ||||
|             one1.setUpdateTime(LocalDateTime.now()); | ||||
|             one1.setRemake(apmsCompleteOrder.getRemake()); | ||||
|             apmsCheckResultServiceBiz.updateById(one1); | ||||
|             return successful("操作成功,更新检验结果完成。", ""); | ||||
|             return successful(0,"操作成功,更新检验结果完成。", ""); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|   | ||||
| @@ -2,10 +2,7 @@ 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.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.entity.*; | ||||
| import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz; | ||||
| import com.mt.wms.core.dal.service.InStockInfoServiceBiz; | ||||
| import com.mt.wms.core.dal.service.LocationServiceBiz; | ||||
| @@ -21,6 +18,7 @@ import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -47,7 +45,7 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic | ||||
|         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(); | ||||
|             String costomerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName(); | ||||
|             currTaskDetVo.setCustomer(costomerName); | ||||
|         } | ||||
|         return successful(currTaskDetVoList); | ||||
| @@ -76,4 +74,24 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic | ||||
|         } | ||||
|         return successful(stockInfoVoList); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public R<String> top(IdParam idParam) { | ||||
|         InStockInfo inStockInfo = inStockInfoServiceBiz.getById(idParam.getId()); | ||||
|         Long kilnId = inStockInfo.getKilnId(); | ||||
|         List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>() | ||||
|                 .eq(InStockInfo.KILN_ID, kilnId) | ||||
|                 .eq(InStockInfo.TYPE,1) | ||||
|                 .eq(InStockInfo.STATUS,2) | ||||
|                 .orderByAsc(InStockInfo.IN_TIME)); | ||||
|  | ||||
|         if (inStockInfoList.size()<2){ | ||||
|             return R.failed("当前加工炉等待队列只有一个任务,无需置顶"); | ||||
|         } | ||||
|         LocalDateTime inTime=null; | ||||
|         inTime = inStockInfoList.get(0).getInTime(); | ||||
|         inStockInfo.setInTime(inTime.minusHours(1)); | ||||
|         inStockInfoServiceBiz.updateById(inStockInfo); | ||||
|         return R.ok("当前任务置顶成功",""); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,8 +3,10 @@ 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.base.BaseService; | ||||
| import com.mt.wms.core.dal.entity.AutoExeTask; | ||||
| import com.mt.wms.core.dal.entity.OrderInfo; | ||||
| import com.mt.wms.core.dal.entity.TaskDetHis; | ||||
| import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz; | ||||
| import com.mt.wms.core.dal.service.OrderInfoServiceBiz; | ||||
| import com.mt.wms.core.dal.service.TaskDetHisServiceBiz; | ||||
| import com.mt.wms.core.params.IdParam; | ||||
| @@ -22,6 +24,7 @@ import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
| @@ -41,6 +44,8 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ | ||||
|     TaskHisService taskhisService; | ||||
|     @Autowired | ||||
|     OrderInfoServiceBiz orderInfoService; | ||||
|     @Autowired | ||||
|     AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|  | ||||
|     @Override | ||||
|     public R<String> save(TaskDetHis taskDetHis) { | ||||
| @@ -71,14 +76,38 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ | ||||
|         queryWrapper.eq(TaskDetHis.IDEN_CARD_NUM, idCard) | ||||
|                 .eq(TaskDetHis.VALID, 1); | ||||
|         List<TaskDetHis> list = taskDetHisServiceBiz.list(queryWrapper); | ||||
|         list.forEach(e -> { | ||||
|             CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(e.getTaskId()).build()); | ||||
|         Iterator<TaskDetHis> iterator=list.iterator(); | ||||
|         while (iterator.hasNext()){ | ||||
|             TaskDetHis taskDetHis = iterator.next(); | ||||
|             CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(taskDetHis.getCurrTaskId()).build()); | ||||
|             //如果加工类型是复加工,或者任务作废。移除对象 | ||||
|             if (byId.getProcessType().equals(2) || byId.getValid() != 1) | ||||
|             { | ||||
|                 iterator.remove(); | ||||
|             } | ||||
|             //如果是多步骤任务且不是第一步,移除对象 | ||||
|             if (byId.getIsAuto()==1){ | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId()); | ||||
|                 if (!byId.getTaskId().equals(autoExeTask.getFTaskId())){ | ||||
|                     iterator.remove(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| /*        list.forEach(e -> { | ||||
|             CurrTaskVo byId = taskhisService.getById(IdParam.builder().id(e.getCurrTaskId()).build()); | ||||
|             //如果加工类型是复加工,或者任务作废。移除对象 | ||||
|             if (byId.getProcessType().equals(2) || byId.getValid() != 1) | ||||
|             { | ||||
|                 list.remove(e); | ||||
|             } | ||||
|         }); | ||||
|             //如果是多步骤任务且不是第一步,移除对象 | ||||
|             if (byId.getIsAuto()==1){ | ||||
|                 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId()); | ||||
|                 if (!byId.getId().equals(autoExeTask.getFTaskId())){ | ||||
|                     list.remove(e); | ||||
|                 } | ||||
|             } | ||||
|         });*/ | ||||
|         //计算加工总数 | ||||
|         double sumWeight = list.stream().mapToDouble(TaskDetHis::getWeight).sum(); | ||||
|         double sumQuantity = list.stream().mapToDouble(TaskDetHis::getQuantity).sum(); | ||||
| @@ -90,7 +119,7 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ | ||||
|     @Override | ||||
|     public R<PageVo<TaskHisDetVo>> getTaskDetailsPage(CurrTaskDetQueryParam currTaskId) { | ||||
|         QueryWrapper<TaskDetHis> queryWrapper = new QueryWrapper<>(); | ||||
|         queryWrapper.eq(TaskDetHis.TASK_ID, currTaskId.getCurrTaskId()) | ||||
|         queryWrapper.eq(TaskDetHis.CURR_TASK_ID, currTaskId.getCurrTaskId()) | ||||
|                 .eq(TaskDetHis.VALID, 1); | ||||
|         Page<TaskDetHis> page = taskDetHisServiceBiz.page(new Page<>(currTaskId.getCurrent(), currTaskId.getSize()), queryWrapper); | ||||
|         PageVo<TaskHisDetVo> taskHisDetVoPageVo = new PageVo<>(page, TaskHisDetVo.class); | ||||
|   | ||||
| @@ -13,6 +13,7 @@ import com.mt.wms.empty.params.TaskHisQueryParam; | ||||
| import com.mt.wms.empty.service.TaskHisService; | ||||
| import com.mt.wms.empty.vo.CurrTaskVo; | ||||
| import com.mt.wms.empty.vo.TaskHisQueryVo; | ||||
| import org.apache.commons.lang.StringUtils; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| @@ -43,7 +44,8 @@ public class TaskHisServiceImpl extends BaseService implements TaskHisService { | ||||
|  | ||||
|     @Override | ||||
|     public CurrTaskVo getById(IdParam id) { | ||||
|         TaskHis byId = taskHisService.getById(id.getId()); | ||||
|         //TaskHis byId = taskHisService.getById(id.getId()); | ||||
|         TaskHis byId = taskHisService.getOne(new QueryWrapper<TaskHis>().eq(TaskHis.TASK_ID, id.getId())); | ||||
|         CurrTaskVo build = CurrTaskVo.builder().build(); | ||||
|         BeanUtils.copyProperties(byId, build); | ||||
|         return build; | ||||
| @@ -52,8 +54,11 @@ public class TaskHisServiceImpl extends BaseService implements TaskHisService { | ||||
|     @Override | ||||
|     public R<PageVo<TaskHisQueryVo>> taskHisPage(TaskHisQueryParam param) { | ||||
|         QueryWrapper<TaskHis> queryWrapper = new QueryWrapper<>(); | ||||
|         queryWrapper.between(Objects.nonNull(param.getStartTime()) && Objects.nonNull(param.getEndTime()), TaskHis.CREATE_TIME, param.getStartTime(), param.getEndTime()) | ||||
|                 .eq(TaskHis.VALID, 1).orderByDesc(TaskHis.CREATE_TIME); | ||||
|         queryWrapper.eq(StringUtils.isNotBlank(param.getKilnId()),TaskHis.KILN_ID,param.getKilnId()); | ||||
|         queryWrapper.like(StringUtils.isNotBlank(param.getSheetNo()),TaskHis.SHEET_NO,param.getSheetNo()); | ||||
|         queryWrapper.like(StringUtils.isNotBlank(param.getStoveCode()),TaskHis.STOVE_CODE,param.getStoveCode()); | ||||
|         queryWrapper.between(Objects.nonNull(param.getStartTime()) && Objects.nonNull(param.getEndTime()), TaskHis.BEGIN_TIME, param.getStartTime(), param.getEndTime()) | ||||
|                 .eq(TaskHis.VALID, 1).orderByDesc(TaskHis.BEGIN_TIME); | ||||
|         Page<TaskHis> page = taskHisService.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper); | ||||
|         return successful(new PageVo<>(page, TaskHisQueryVo.class)); | ||||
|     } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -7,6 +7,9 @@ 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.controller.ApmsController; | ||||
| import com.mt.wms.empty.params.ApmsEndProcess; | ||||
| import com.mt.wms.empty.vo.ApmsEndProcessVo; | ||||
| import com.mt.wms.empty.websocket.WebSocketServer; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| @@ -18,11 +21,13 @@ import org.springframework.transaction.annotation.Transactional; | ||||
| import javax.annotation.Resource; | ||||
| import java.io.IOException; | ||||
| import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import static org.bouncycastle.asn1.x500.style.RFC4519Style.c; | ||||
| import static org.bouncycastle.asn1.x500.style.RFC4519Style.l; | ||||
|  | ||||
| /** | ||||
| @@ -31,7 +36,6 @@ import static org.bouncycastle.asn1.x500.style.RFC4519Style.l; | ||||
|  * @Version 1.0 | ||||
|  */ | ||||
| @Component | ||||
| @Transactional | ||||
| public class RunTaskUtils { | ||||
|     private Logger logger = LoggerFactory.getLogger(getClass()); | ||||
|     @Resource | ||||
| @@ -54,33 +58,42 @@ public class RunTaskUtils { | ||||
|     private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz; | ||||
|     @Resource | ||||
|     private WebSocketServer webSocketServer; | ||||
|     @Resource | ||||
|     private ApmsController apmsController; | ||||
|  | ||||
|     /** | ||||
|      * 进炉加工 | ||||
|      * | ||||
|      * @param currTaskId 任务id | ||||
|      * @return R | ||||
|      * @throws InterruptedException | ||||
|      */ | ||||
|     public R runTaskForInKiln(Long currTaskId) throws InterruptedException, IOException { | ||||
|         CurrTask currTask = currTaskServiceBiz.getById(currTaskId); | ||||
|         //起点,起点和终点是液压台code、窑炉code、缓存区code | ||||
|         //起点,起点和终点是液压台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){ | ||||
|         if (startPointType == 2) { | ||||
|             Map<String, Object> yeya = new HashMap(); | ||||
|             //type=1为 入 | ||||
|             yeya.put("type", 1); | ||||
|             if ("YYT003".equals(startPoint.getNote())){ | ||||
|             if ("YYT003".equals(currTask.getStartPosition())) { | ||||
|                 yeya.put("number", 3); | ||||
|             } | ||||
|             if ("YYT004".equals(currTask.getStartPosition())) { | ||||
|                 yeya.put("number", 4); | ||||
|             } | ||||
|             if ("YYT002".equals(currTask.getStartPosition())) { | ||||
|                 yeya.put("number", 2); | ||||
|             } | ||||
|             if ("YYT004".equals(startPoint.getNote())){ | ||||
|             if ("YYT001".equals(currTask.getStartPosition())) { | ||||
|                 yeya.put("number", 1); | ||||
|             } | ||||
|             String yeyaJudgeStatus = JSON.toJSONString(yeya); | ||||
|             //判断起点液压台是否已放货且提升到位 | ||||
|             String yeyaStatus=null; | ||||
|             String yeyaStatus = null; | ||||
|             try { | ||||
|                 yeyaStatus = HttpClient.httpPost("http://192.168.6.51:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus); | ||||
|             } catch (IOException e) { | ||||
| @@ -88,32 +101,33 @@ public class RunTaskUtils { | ||||
|                 logger.error(new Date() + "WCS接口超时未响应!"); | ||||
|             } | ||||
|             //taskStatus==3满足条件,其他状态值说明液压台不满足开始任务的条件(无货物或者有货物但是没提升到位) | ||||
|             if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 3){ | ||||
|                 return R.failed(startPoint.getName()+"号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!"); | ||||
|             if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 1) { | ||||
|                 return R.failed(startPoint.getName() + "号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!"); | ||||
|             } | ||||
|         } | ||||
|         //是否有小车在运行 | ||||
|         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1)); | ||||
|         if (vehicleInfoList.size()>0){ | ||||
|         if (vehicleInfoList.size() > 0) { | ||||
|             //有小车在运行,提示当前有车辆在运行,请稍后 | ||||
|             return R.failed("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!"); | ||||
|         } | ||||
|         //  2022/2/27  传入任务id,起始点,若终点是窑炉,获取窑炉状态,能放两坨货的窑炉怎么判定状态?(AllowIn) | ||||
|         //  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()); | ||||
|         //窑炉状态为不可用 | ||||
|         boolean resultBoolean = Boolean.parseBoolean(JSONObject.parseObject(result).get("result").toString()); | ||||
|         //工业炉状态为不可用 | ||||
|         if (kilnInfo.getStatus() == 1) { | ||||
|             return R.failed("目标窑炉不可用!"); | ||||
|             return R.failed("目标工业炉不可用!"); | ||||
|         } | ||||
|         //窑炉可用未满 | ||||
|         if (resultBoolean){ | ||||
|         //工业炉可用未满 | ||||
|         if (resultBoolean) { | ||||
|             //计算出路径最短的车辆id | ||||
|             Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition()); | ||||
|             if (vehicleId==0){ | ||||
|             if (vehicleId == 0) { | ||||
|                 logger.info("两辆车都不在线,请检查后重试!"); | ||||
|                 return R.failed("两辆车都不在线,请检查后重试!"); | ||||
|             } | ||||
|             //占用车辆 | ||||
| @@ -126,31 +140,34 @@ public class RunTaskUtils { | ||||
|             currTask.setUpdateTime(LocalDateTime.now()); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             //异步调用车辆 | ||||
|             asynRunTaskService.asynRunTask(currTask.getId(),vehicleId); | ||||
|             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) { | ||||
|             if (count > 0) { | ||||
|                 //分配一个缓存区库位 | ||||
|                 Location location = locationServiceBiz.list(new QueryWrapper<Location>() | ||||
|                         .eq(Location.STATUS, 0) | ||||
|                         .eq(Location.VALID, 1)).get(0); | ||||
|                 //计算出路径最短的车辆id,起点液压台,终点缓存区库位点 | ||||
|                 Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), location.getCode()); | ||||
|                 if (vehicleId == 0) { | ||||
|                     logger.info("两辆车都不在线,请检查后重试!"); | ||||
|                     return R.failed("两辆车都不在线,请检查后重试!"); | ||||
|                 } | ||||
|  | ||||
|                 //更新 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); | ||||
| @@ -161,30 +178,37 @@ public class RunTaskUtils { | ||||
|                 currTask.setCacheSatatus(1); | ||||
|                 currTask.setUpdateTime(LocalDateTime.now()); | ||||
|                 currTask.setLocationId(location.getId()); | ||||
|                 currTask.setLocationName(location.getLocationName()); | ||||
|                 currTaskServiceBiz.updateById(currTask); | ||||
|                 //异步调用车辆 | ||||
|                 asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleId); | ||||
|                 return R.ok("操作成功!当前目标窑炉已满,托盘准备加入缓存区待加工队列。"); | ||||
|                 asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(), vehicleId, location); | ||||
|                 return R.ok("操作成功!当前目标工业炉已满,托盘准备加入缓存区待加工队列。"); | ||||
|             } | ||||
|             return R.failed("当前目标窑炉已满!缓存区已满!请稍后重试!"); | ||||
|             return R.failed("当前目标工业炉已满!缓存区已满!请稍后重试!"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 加工完成、出炉。传入窑炉id,查询正在该窑炉加工的currTask,查询是否有空闲车辆,有, | ||||
|      * (查询是否为自动任务,是,查询下一步的窑炉是否空闲,是,调车去下一窑炉加工,否,暂存缓存区) | ||||
|      * 呼叫车辆暂存缓存区,车辆调度任务结束后,(结束后再查询缓R存区队列避免车辆路线冲突)查询该窑炉的缓存区队列,开始下一托盘货物调度进窑炉 | ||||
|      * 加工完成、出炉。传入工业炉id,查询正在该工业炉加工的currTask,查询是否有空闲车辆,有, | ||||
|      * (查询是否为自动任务,是,查询下一步的工业炉是否空闲,是,调车去下一工业炉加工,否,暂存缓存区) | ||||
|      * 呼叫车辆暂存缓存区,车辆调度任务结束后,(结束后再查询缓R存区队列避免车辆路线冲突)查询该工业炉的缓存区队列,开始下一托盘货物调度进工业炉 | ||||
|      * | ||||
|      * @return R | ||||
|      */ | ||||
|     public R runTaskForOutKiln(Long kilnId) throws IOException { | ||||
|         //查询正在该窑炉加工的currTask | ||||
|         CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>() | ||||
|         //查询正在该工业炉加工的currTask | ||||
|         List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>() | ||||
|                 .eq("is_in", 1) | ||||
|                 .eq("status", 1) | ||||
|                 .eq("kiln_id", kilnId)); | ||||
|                 .eq("kiln_id", kilnId).orderByAsc(CurrTask.BEGIN_TIME)); | ||||
|         if (currTaskList.size() == 0) { | ||||
|             return R.failed(); | ||||
|         } | ||||
|         CurrTask currTask = currTaskList.get(0); | ||||
|         //查询是否为自动任务 | ||||
|         if (currTask.getIsAuto()==1) { | ||||
|             //查询自动任务的哪一步的设备id是该窑炉 | ||||
|         if (currTask.getIsAuto() == 1) { | ||||
|             logger.info(currTask.getId() + "为自动任务"); | ||||
|             //查询自动任务的哪一步的设备id是该工业炉 | ||||
|             int firstCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId())); | ||||
|             if (firstCount == 1) { | ||||
|                 //当前为自动任务第一步 | ||||
| @@ -193,27 +217,27 @@ public class RunTaskUtils { | ||||
|                 Long taskId = autoExeTask.getTTaskId(); | ||||
|                 CurrTask currTaskTwo = currTaskServiceBiz.getById(taskId); | ||||
|                 try { | ||||
|                     logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo); | ||||
|                     logger.info("自动任务第一步:" + currTask.getTaskCode() + "已执行完成。开始执行第二步任务:" + currTaskTwo); | ||||
|                     //  2022/2/27 websocket推送到页面显示 | ||||
|                     webSocketServer.sendtoAll("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo); | ||||
|                      return runTaskForInKiln(taskId); | ||||
|                     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 == 2) { | ||||
|                 if (secondCount == 1) { | ||||
|                     //当前为自动任务第二步 | ||||
|                     AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId())); | ||||
|                     //该自动任务的工艺类型为2,还有第三步 | ||||
|                     if (autoExeTask.getProcessFlowType()==2){ | ||||
|                     if (autoExeTask.getProcessFlowType() == 2) { | ||||
|                         Long thTaskId = autoExeTask.getThTaskId(); | ||||
|                         CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId); | ||||
|                         try { | ||||
|                             logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree); | ||||
|                             logger.info("自动任务第二步:" + currTask.getTaskCode() + "已执行完成。开始执行第三步任务:" + currTaskThree.getId()); | ||||
|                             // 2022/2/27 websocket推送到页面显示 | ||||
|                             webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree); | ||||
|                             webSocketServer.sendtoAll("自动任务第二步:" + currTask.getTaskCode() + "已执行完成。开始执行第三步任务:" + currTaskThree.getId()); | ||||
|                             return runTaskForInKiln(thTaskId); | ||||
|                         } catch (InterruptedException e) { | ||||
|                             e.printStackTrace(); | ||||
| @@ -221,30 +245,23 @@ public class RunTaskUtils { | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         //查询缓存区库位是否已满 | ||||
|         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)); | ||||
|         //液压台允许放货 | ||||
|         if (true) { | ||||
|             //是否有小车在运行 | ||||
|             List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1)); | ||||
|             if (vehicleInfoList.size()>0){ | ||||
|             if (vehicleInfoList.size() > 0) { | ||||
|                 //有小车在运行,提示当前有车辆在运行,请稍后 | ||||
|                 logger.info("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!"); | ||||
|                 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){ | ||||
|             //工业炉为起点,缓存区为一号液压台 | ||||
|             Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), "YYT001"); | ||||
|             if (vehicleId == 0) { | ||||
|                 logger.info("两辆车都不在线,请检查后重试!"); | ||||
|                 return R.failed("两辆车都不在线,请检查后重试!"); | ||||
|             } | ||||
|             //占用车辆 | ||||
| @@ -252,44 +269,110 @@ public class RunTaskUtils { | ||||
|             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(),vehicleInfoList.get(0).getId()); | ||||
|             return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。"); | ||||
|         }else { | ||||
|             return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。"); | ||||
|             String yytCode = "YYT001"; | ||||
|             //选择出库液压台 | ||||
|             if (platFormPosition("YYT001")) { | ||||
|                 yytCode = "YYT001"; | ||||
|             } else if (platFormPosition("YYT002")) { | ||||
|                 yytCode = "YYT002"; | ||||
|             } else { | ||||
|                 yytCode = "YYT001"; | ||||
|             } | ||||
|             asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(), yytCode, vehicleId); | ||||
|             return R.ok("操作成功!托盘即将出库到" + yytCode + "液压台。"); | ||||
|         } else { | ||||
|             //查询缓存区库位是否已满 | ||||
|             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) { | ||||
|                     //有小车在运行,提示当前有车辆在运行,请稍后 | ||||
|                     logger.info("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!"); | ||||
|                     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) { | ||||
|                     logger.info("两辆车都不在线,请检查后重试!"); | ||||
|                     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 locationId  库位id | ||||
|      * @param yeyaTaiCode 液压台code | ||||
|      * @return R | ||||
|      */ | ||||
|     public R runTaskForOut(Long locationId,String yeyaTaiCode) throws IOException { | ||||
|     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){ | ||||
|         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("当前选定的液压台为在线或未提升到位,请检查后重试!"); | ||||
|         Map<String, Object> yeya = new HashMap(); | ||||
|         //type=1随意赋值,不用type了 | ||||
|         yeya.put("type", 1); | ||||
|         if ("YYT003".equals(yeyaTaiCode)) { | ||||
|             yeya.put("number", 3); | ||||
|         } | ||||
|         if ("YYT004".equals(yeyaTaiCode)) { | ||||
|             yeya.put("number", 4); | ||||
|         } | ||||
|         if ("YYT002".equals(yeyaTaiCode)) { | ||||
|             yeya.put("number", 2); | ||||
|         } | ||||
|         if ("YYT001".equals(yeyaTaiCode)) { | ||||
|             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()) != 1) { | ||||
|             return R.failed("液压台" + yeyaTaiCode + "不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!"); | ||||
|         } | ||||
|         //计算出路径最短的车辆id | ||||
|         Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), yeyaTaiCode); | ||||
|         if (vehicleId==0){ | ||||
|         if (vehicleId == 0) { | ||||
|             return R.failed("两辆车都不在线,请检查后重试!"); | ||||
|         } | ||||
|         //占用车辆 | ||||
| @@ -298,7 +381,7 @@ public class RunTaskUtils { | ||||
|         vehicleInfo.setUpdateTime(LocalDateTime.now()); | ||||
|         vehicleInfoServiceBiz.updateById(vehicleInfo); | ||||
|         //异步调用车辆 | ||||
|         asynRunTaskService.asynRunOutStock(locationId,yeyaTaiCode,vehicleInfo.getId()); | ||||
|         asynRunTaskService.asynRunOutStock(locationId, yeyaTaiCode, vehicleInfo.getId()); | ||||
|         // TODO: 2022/3/19 | ||||
|         System.out.println("操作成功,任务已开始执行。"); | ||||
|         return R.ok("操作成功,任务已开始执行。"); | ||||
| @@ -306,39 +389,41 @@ public class RunTaskUtils { | ||||
|  | ||||
|     /** | ||||
|      * 获取变量值 | ||||
|      * @param nameSpace nameSpace前缀 | ||||
|      * | ||||
|      * @param nameSpace    nameSpace前缀 | ||||
|      * @param variableName 变量名称 | ||||
|      * @return result字符串 | ||||
|      */ | ||||
|     private String readPlcToString(String nameSpace, String variableName){ | ||||
|         String identifier=nameSpace.concat(variableName); | ||||
|     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); | ||||
|         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+" 的值失败"); | ||||
|             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."; | ||||
|     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"); | ||||
|             json.put("identifier", identifier + "Online"); | ||||
|             String result = null; | ||||
|             try { | ||||
|                 result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json)); | ||||
| @@ -347,11 +432,11 @@ public class RunTaskUtils { | ||||
|                 logger.info("获取液压台1当前是否在线失败"); | ||||
|             } | ||||
|             Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|             if (aBoolean){ | ||||
|             if (aBoolean) { | ||||
|                 Map<String, Object> statusJson = new HashMap(); | ||||
|                 statusJson.put("nameSpace", 6); | ||||
|                 statusJson.put("plcName", "plc1"); | ||||
|                 statusJson.put("identifier",identifier+"TaskState"); | ||||
|                 statusJson.put("identifier", identifier + "TaskState"); | ||||
|                 String statusResult = null; | ||||
|                 try { | ||||
|                     statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson)); | ||||
| @@ -360,21 +445,21 @@ public class RunTaskUtils { | ||||
|                     logger.info("获取液压台1当前状态失败"); | ||||
|                 } | ||||
|                 Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString()); | ||||
|                 if (status==1){ | ||||
|                 if (status == 1) { | ||||
|                     return true; | ||||
|                 }else { | ||||
|                 } else { | ||||
|                     return false; | ||||
|                 } | ||||
|             }else { | ||||
|             } else { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         if ("YYT002".equals(platFormCode)){ | ||||
|             identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform3ToWCS."; | ||||
|         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"); | ||||
|             json.put("identifier", identifier + "Online"); | ||||
|             String result = null; | ||||
|             try { | ||||
|                 result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json)); | ||||
| @@ -383,11 +468,11 @@ public class RunTaskUtils { | ||||
|                 logger.info("获取液压台2当前是否在线失败"); | ||||
|             } | ||||
|             Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|             if (aBoolean){ | ||||
|             if (aBoolean) { | ||||
|                 Map<String, Object> statusJson = new HashMap(); | ||||
|                 statusJson.put("nameSpace", 6); | ||||
|                 statusJson.put("plcName", "plc1"); | ||||
|                 statusJson.put("identifier",identifier+"TaskState"); | ||||
|                 statusJson.put("identifier", identifier + "TaskState"); | ||||
|                 String statusResult = null; | ||||
|                 try { | ||||
|                     statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson)); | ||||
| @@ -396,16 +481,156 @@ public class RunTaskUtils { | ||||
|                     logger.info("获取液压台2当前状态失败"); | ||||
|                 } | ||||
|                 Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString()); | ||||
|                 if (status==1){ | ||||
|                 if (status == 1) { | ||||
|                     return true; | ||||
|                 }else { | ||||
|                 } else { | ||||
|                     return false; | ||||
|                 } | ||||
|             }else { | ||||
|             } else { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 选择出库液压台; | ||||
|      * 查询液压台1和液压台2是否为高位,都不为高位则选择液压台1 | ||||
|      */ | ||||
|     private Boolean platFormPosition(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 + "LifterPosition"); | ||||
|                 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 == 2) { | ||||
|                     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 + "LifterPosition"); | ||||
|                 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 == 2) { | ||||
|                     return true; | ||||
|                 } else { | ||||
|                     return false; | ||||
|                 } | ||||
|             } else { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 车辆是否在线 | ||||
|      * | ||||
|      * @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; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 车辆是否空闲 | ||||
|      * | ||||
|      * @param vehicleId 车辆id | ||||
|      * @return true/false | ||||
|      * @throws IOException plc访问失败 | ||||
|      */ | ||||
|     private Boolean rgvFree(Long vehicleId) throws IOException { | ||||
|         String identifier = null; | ||||
|         if (vehicleId == 1) { | ||||
|             identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free"; | ||||
|         } | ||||
|         if (vehicleId == 2) { | ||||
|             identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free"; | ||||
|         } | ||||
|         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 free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|         return free; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,9 +6,17 @@ 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.dal.service.impl.CurrTaskServiceBizImpl; | ||||
| 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.utils.StringUtils; | ||||
| import com.mt.wms.core.vo.R; | ||||
| import com.mt.wms.empty.controller.ApmsController; | ||||
| import com.mt.wms.empty.params.ApmsEndProcess; | ||||
| import com.mt.wms.empty.vo.ApmsEndProcessVo; | ||||
| 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; | ||||
| @@ -20,6 +28,7 @@ import org.springframework.stereotype.Component; | ||||
| import javax.annotation.Resource; | ||||
| import java.io.IOException; | ||||
| import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| @@ -32,7 +41,7 @@ import java.util.Map; | ||||
| @Component | ||||
| public class ScheduledTask extends BaseService { | ||||
|  | ||||
|     private final static Logger logger = LoggerFactory.getLogger(AsynRunTaskService.class); | ||||
|     private final static Logger logger = LoggerFactory.getLogger(ScheduledTask.class); | ||||
|  | ||||
|     @Resource | ||||
|     private KilnInfoServiceBiz kilnInfoServiceBiz; | ||||
| @@ -66,37 +75,184 @@ public class ScheduledTask extends BaseService { | ||||
|     private RunTaskUtils runTaskUtils; | ||||
|     @Resource | ||||
|     private WebSocketServer webSocketServer; | ||||
|     @Resource | ||||
|     private CurrTaskDetServiceBiz currTaskDetServiceBiz; | ||||
|     @Resource | ||||
|     private OrderInfoServiceBiz orderInfoServiceBiz; | ||||
|     @Resource | ||||
|     private AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|     @Resource | ||||
|     private TaskHisServiceBiz taskHisServiceBiz; | ||||
|     @Resource | ||||
|     private TaskDetHisServiceBiz taskDetHisServiceBiz; | ||||
|     @Resource | ||||
|     private ApmsController apmsController; | ||||
|  | ||||
|  | ||||
|     //@Scheduled(fixedDelay = 1000*20) | ||||
|     @Test | ||||
|     public void test() throws IOException { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     //@Scheduled(fixedDelay = 1000*60) | ||||
|     public void testWebsocket() throws IOException { | ||||
|         webSocketServer.sendtoAll(LocalDateTime.now()+"测试"); | ||||
|         //查询出正在进炉加工的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.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).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) | ||||
|                 .eq(CurrTask.STATUS, 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.setTaskCode(nowCurrTask.getSheetNo()); | ||||
|                 nowCurrTask.setKilnCode(kilnInfo.getCode()); | ||||
|                 nowCurrTask.setTaskId(nowCurrTask.getId()); | ||||
|                 //设定时间 | ||||
|                 Integer setupTime = 1; | ||||
|                 //剩余时间 | ||||
|                 Integer remainingTime = 0; | ||||
|                 if (kilnInfo.getType() != 4) { | ||||
|                     if (kilnInfo.getType() == 3) { | ||||
|                         remainingTime = readPlc(nameSpace, "ProgramTimeRemaining").intValue(); | ||||
|                     } else { | ||||
|                         remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue(); | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|                 if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) { | ||||
|                     //运行时间 | ||||
|                     Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue(); | ||||
|                     setupTime = runTime + remainingTime; | ||||
|                 } | ||||
|                 if (kilnInfo.getType() == 2) { | ||||
|                     setupTime = readPlc(nameSpace, "SetTime").intValue(); | ||||
|                 } | ||||
|                 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.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName(); | ||||
|                     currTaskDetVo.setCustomer(customerName); | ||||
|                 } | ||||
|                 nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList); | ||||
|             } | ||||
|         } | ||||
|         webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList), "2"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询加工完成的工业炉 | ||||
|      */ | ||||
|     @Scheduled(fixedDelay = 1000 * 30) | ||||
|     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 | ||||
|         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 | ||||
|                     ) { | ||||
|             for (CurrTask currTask : currTaskList | ||||
|             ) { | ||||
|                 Long kilnId = currTask.getKilnId(); | ||||
|                 KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId); | ||||
|                 PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>() | ||||
|                         .eq(PlcNameSpace.EQ_TYPE, 1) | ||||
|                         .eq(PlcNameSpace.EQ_TYPE, 0) | ||||
|                         .eq(PlcNameSpace.TYPE, 0) | ||||
|                         .eq(PlcNameSpace.EQ_ID,kilnId)); | ||||
|                         .eq(PlcNameSpace.EQ_ID, kilnId)); | ||||
|                 //通过允许出炉信号来判定是否加工完成 | ||||
|                 String result = readPlcToString(plcNameSpace.getName(), "AllowOut"); | ||||
|                 Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|                 if (resultBoolean){ | ||||
|                 if (resultBoolean) { | ||||
|                     //调用RunTaskUtils.runTaskForOutKiln | ||||
|                     logger.info(kilnInfo.getCode() + kilnInfo.getKilnAlias() + "识别到允许出炉信号,进入出库程序!"); | ||||
|                     //更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务, | ||||
|                     if ("null".equals(String.valueOf(currTask.getEndTime()))) { | ||||
|                         currTask.setEndTime(LocalDateTime.now()); | ||||
|                         currTaskServiceBiz.updateById(currTask); | ||||
|                         //存入历史任务表以便查询能源消耗 | ||||
|                         TaskHis taskHis = new TaskHis(); | ||||
|                         org.springframework.beans.BeanUtils.copyProperties(currTask, taskHis); | ||||
|                         taskHis.setStatus(2); | ||||
|                         taskHis.setIsIn(2); | ||||
|                         taskHis.setTaskId(currTask.getId()); | ||||
|                         taskHisServiceBiz.save(taskHis); | ||||
|                         List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); | ||||
|                         List<TaskDetHis> taskDetHisList = BeanUtils.copyList(currTaskDets, TaskDetHis.class); | ||||
|                         taskDetHisServiceBiz.saveBatch(taskDetHisList); | ||||
|                         //加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次 | ||||
|                         asynRunTaskService.asynEndRecordConsume(currTask.getId(), kilnId); | ||||
|                         apmsEndProcess(currTask); | ||||
|                         logger.info(currTask+"上报apms结束当前工艺加工"); | ||||
|                         logger.info(kilnInfo.getCode() + "炉子中的任务:" + currTask.getId() + "已加工结束,记录加工结束能源消耗值"); | ||||
|                     } | ||||
|                     runTaskUtils.runTaskForOutKiln(kilnId); | ||||
|                     break; | ||||
|                 } | ||||
| @@ -104,35 +260,61 @@ public class ScheduledTask extends BaseService { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 | ||||
|     //@Scheduled(fixedDelay = 1000*30) | ||||
|     public void getFastValue(){ | ||||
|     //查询出正在加工的工业炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 | ||||
|     @Scheduled(fixedDelay = 1000 * 30) | ||||
|     public void getFastValue() { | ||||
|         //加工炉列表 | ||||
|         List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3)); | ||||
|         for (KilnInfo kilnInfo:kilnInfoList | ||||
|              ) { | ||||
|         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)); | ||||
|                     .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){ | ||||
|             if (resultBoolean) { | ||||
|                 Long kilnId = kilnInfo.getId(); | ||||
|                 String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); | ||||
|                 Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); | ||||
|                 Long currTaskId = 0L; | ||||
|                 //多用炉因为存在多个识别号且炉子给的DischargeIdentNumber为下油槽后的识别号,所以使用表里记录的任务id根据状态和进炉时间查出正在炉里且先进去的那个 | ||||
|                 if (kilnInfo.getType() == 1) { | ||||
|                     List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.STATUS, 1) | ||||
|                             .eq(CurrTask.KILN_ID, kilnId).eq(CurrTask.IS_IN, 1)); | ||||
|                     if (currTaskList.size() != 0) { | ||||
|                         currTaskId = currTaskList.get(0).getId(); | ||||
|                     } | ||||
|                 } else { | ||||
|                     String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); | ||||
|                     currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); | ||||
|                 } | ||||
|  | ||||
|                 if (currTaskId == 0) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 CurrTask currTask = currTaskServiceBiz.getById(currTaskId); | ||||
|                 //任务为null说明是已删除的任务,不记录 | ||||
|                 if (currTask == null) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //任务结束时间不为null,说明是已结束的任务,不记录 | ||||
|                 if (currTask.getEndTime() != null) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //任务不在加工状态,不记录 | ||||
|                 if (currTask.getIsIn() != 1) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //加工炉 | ||||
|                 if (kilnInfo.getType()==1){ | ||||
|                 if (kilnInfo.getType() == 1) { | ||||
|                     //一号油搅拌转速 | ||||
|                     Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1"); | ||||
|                     //二号油搅拌转速 | ||||
|                     Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2"); | ||||
|                     ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue(); | ||||
|                     ParRotSpeedValue parRotSpeedValue = new ParRotSpeedValue(); | ||||
|                     parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue()); | ||||
|                     parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue()); | ||||
|                     parRotSpeedValue.setOilStiSpeedBValue(oilStirringSpeed2.floatValue()); | ||||
|                     parRotSpeedValue.setKilnId(kilnId); | ||||
|                     parRotSpeedValue.setTaskId(currTaskId); | ||||
|                     parRotSpeedValue.setCreateTime(LocalDateTime.now()); | ||||
| @@ -149,7 +331,7 @@ public class ScheduledTask extends BaseService { | ||||
|                     Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); | ||||
|                     //设定碳势 | ||||
|                     Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon"); | ||||
|                     ParGasValue parGasValue=new ParGasValue(); | ||||
|                     ParGasValue parGasValue = new ParGasValue(); | ||||
|                     parGasValue.setNitFlowValue(nitrogenFlow.floatValue()); | ||||
|                     parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue()); | ||||
|                     parGasValue.setMethanolFlow(methanolFlow.floatValue()); | ||||
| @@ -162,7 +344,7 @@ public class ScheduledTask extends BaseService { | ||||
|                     parGasValueServiceBiz.save(parGasValue); | ||||
|                 } | ||||
|                 //氮化炉 | ||||
|                 if (kilnInfo.getType()==3){ | ||||
|                 if (kilnInfo.getType() == 3) { | ||||
|                     //实际氮势 | ||||
|                     Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); | ||||
|                     //设定氮势 | ||||
| @@ -172,12 +354,12 @@ public class ScheduledTask extends BaseService { | ||||
|                     //分解率 | ||||
|                     Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate"); | ||||
|                     //氨气量 | ||||
|                     Double ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow"); | ||||
|                     Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow"); | ||||
|                     //氮气量 | ||||
|                     Double nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow"); | ||||
|                     Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow"); | ||||
|                     //二氧化碳量 | ||||
|                     Double carbonDioxideFlow = readPlc(nameSpaceNote, "CO2Flow"); | ||||
|                     ParGasValue parGasValue3=new ParGasValue(); | ||||
|                     ParGasValue parGasValue3 = new ParGasValue(); | ||||
|                     parGasValue3.setNitFlowValue(nitrogenFlow.floatValue()); | ||||
|                     parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue()); | ||||
|                     parGasValue3.setActualNitPotValue(actualCarbon.floatValue()); | ||||
| @@ -189,38 +371,69 @@ public class ScheduledTask extends BaseService { | ||||
|                     parGasValue3.setCreateTime(LocalDateTime.now()); | ||||
|                     parGasValueServiceBiz.save(parGasValue3); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 | ||||
|     //@Scheduled(fixedDelay = 1000*60*3) | ||||
|     public void getSlowValue(){ | ||||
|         System.out.println("开始采集数据"); | ||||
|  | ||||
|     //查询出正在加工的工业炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 | ||||
|     @Scheduled(fixedDelay = 1000 * 60 * 3) | ||||
|     public void getSlowValue() { | ||||
|         List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(); | ||||
|         for (KilnInfo kilnInfo:kilnInfoList | ||||
|              ) { | ||||
|         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)); | ||||
|                     .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){ | ||||
|             if (resultBoolean) { | ||||
|                 Long kilnId = kilnInfo.getId(); | ||||
|                 Long currTaskId = 0L; | ||||
|                 //多用炉因为存在多个识别号且炉子给的DischargeIdentNumber为下油槽后的识别号,所以使用表里记录的任务id根据状态和进炉时间查出正在炉里且先进去的那个 | ||||
|                 if (kilnInfo.getType() == 1) { | ||||
|                     List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.STATUS, 1) | ||||
|                             .eq(CurrTask.KILN_ID, kilnId).eq(CurrTask.IS_IN, 1)); | ||||
|                     if (currTaskList.size() != 0) { | ||||
|                         currTaskId = currTaskList.get(0).getId(); | ||||
|                     } | ||||
|                 } else { | ||||
|                     String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); | ||||
|                     currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); | ||||
|                 } | ||||
| /*                Long kilnId = kilnInfo.getId(); | ||||
|                 String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); | ||||
|                 Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); | ||||
|                 Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());*/ | ||||
|                 //任务id为0说明不是自动任务,不记录 | ||||
|                 if (currTaskId == 0) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 CurrTask currTask = currTaskServiceBiz.getById(currTaskId); | ||||
|                 //任务为null说明是已删除的任务,不记录 | ||||
|                 if (currTask == null) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //任务结束时间不为null,说明是已结束的任务,不记录 | ||||
|                 if (currTask.getEndTime() != null) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //任务不在加工状态,不记录 | ||||
|                 if (currTask.getIsIn() != 1) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 //加工炉 | ||||
|                 if (kilnInfo.getType()==1){ | ||||
|                 if (kilnInfo.getType() == 1) { | ||||
|                     //实际温度 | ||||
|                     Double actualTemp =readPlc(nameSpaceNote,"ActualTemp"); | ||||
|                     Double actualTemp = readPlc(nameSpaceNote, "ActualTemp"); | ||||
|                     //设定温度 | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp"); | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp"); | ||||
|                     //油槽实际温度 | ||||
|                     Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp"); | ||||
|                     //油槽设定温度 | ||||
|                     Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp"); | ||||
|                     ParTemValue parTemValue=new ParTemValue(); | ||||
|                     Double setUpOilTemp = readPlc(nameSpaceNote, "SetUpOilTemp"); | ||||
|                     ParTemValue parTemValue = new ParTemValue(); | ||||
|                     parTemValue.setSetTemValue(setUpTemp.floatValue()); | ||||
|                     parTemValue.setActTemValue(actualTemp.floatValue()); | ||||
|                     parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue()); | ||||
| @@ -230,15 +443,24 @@ public class ScheduledTask extends BaseService { | ||||
|                     parTemValue.setCreateTime(LocalDateTime.now()); | ||||
|                     parTemValueServiceBiz.save(parTemValue); | ||||
|                     //电度值 | ||||
|                     Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); | ||||
|                     Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue"); | ||||
|                     //A向电压 | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage"); | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage"); | ||||
|                     Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage"); | ||||
|                     Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage"); | ||||
|                     ParEleValue parEleValue=new ParEleValue(); | ||||
|                     //ABC向电流 | ||||
|                     Double phaseACurrent = readPlc(nameSpaceNote, "PhaseACurrent"); | ||||
|                     Double phaseBCurrent = readPlc(nameSpaceNote, "PhaseBCurrent"); | ||||
|                     Double phaseDCurrent = readPlc(nameSpaceNote, "PhaseDCurrent"); | ||||
|                     ParEleValue parEleValue = new ParEleValue(); | ||||
|                     parEleValue.setAVoltagevValue(phaseAVoltage.floatValue()); | ||||
|                     parEleValue.setAVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue.setAVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue.setBVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue.setCVoltagevValue(phaseCVoltage.floatValue()); | ||||
|  | ||||
|                     parEleValue.setACurrentValue(phaseACurrent.floatValue()); | ||||
|                     parEleValue.setBCurrentValue(phaseBCurrent.floatValue()); | ||||
|                     parEleValue.setCCurrentValue(phaseDCurrent.floatValue()); | ||||
|  | ||||
|                     parEleValue.setTotalBat(electricalValue.floatValue()); | ||||
|                     parEleValue.setKilnId(kilnId); | ||||
|                     parEleValue.setTaskId(currTaskId); | ||||
| @@ -246,12 +468,12 @@ public class ScheduledTask extends BaseService { | ||||
|                     parEleValueServiceBiz.save(parEleValue); | ||||
|                 } | ||||
|                 //回火炉 | ||||
|                 if (kilnInfo.getType()==2){ | ||||
|                 if (kilnInfo.getType() == 2) { | ||||
|                     //实际温度 | ||||
|                     Double actualTemp =readPlc(nameSpaceNote,"ActualTemp"); | ||||
|                     Double actualTemp = readPlc(nameSpaceNote, "ActualTemp"); | ||||
|                     //设定温度 | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp"); | ||||
|                     ParTemValue parTemValue2=new ParTemValue(); | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp"); | ||||
|                     ParTemValue parTemValue2 = new ParTemValue(); | ||||
|                     parTemValue2.setSetTemValue(setUpTemp.floatValue()); | ||||
|                     parTemValue2.setActTemValue(actualTemp.floatValue()); | ||||
|                     parTemValue2.setKilnId(kilnId); | ||||
| @@ -259,15 +481,22 @@ public class ScheduledTask extends BaseService { | ||||
|                     parTemValue2.setCreateTime(LocalDateTime.now()); | ||||
|                     parTemValueServiceBiz.save(parTemValue2); | ||||
|                     //电度值 | ||||
|                     Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); | ||||
|                     Double electricalValue = readPlc(nameSpaceNote, "TotalElectricity"); | ||||
|                     //A向电压 | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage"); | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage"); | ||||
|                     Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage"); | ||||
|                     Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage"); | ||||
|                     ParEleValue parEleValue2=new ParEleValue(); | ||||
|                     //ABC三相电流 | ||||
|                     Double aCurrent = readPlc(nameSpaceNote, "ACurrent"); | ||||
|                     Double bCurrent = readPlc(nameSpaceNote, "BCurrent"); | ||||
|                     Double cCurrent = readPlc(nameSpaceNote, "CCurrent"); | ||||
|                     ParEleValue parEleValue2 = new ParEleValue(); | ||||
|                     parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue()); | ||||
|                     parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue2.setBVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue2.setCVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue2.setACurrentValue(aCurrent.floatValue()); | ||||
|                     parEleValue2.setBCurrentValue(bCurrent.floatValue()); | ||||
|                     parEleValue2.setCCurrentValue(cCurrent.floatValue()); | ||||
|                     parEleValue2.setTotalBat(electricalValue.floatValue()); | ||||
|                     parEleValue2.setKilnId(kilnId); | ||||
|                     parEleValue2.setTaskId(currTaskId); | ||||
| @@ -275,18 +504,18 @@ public class ScheduledTask extends BaseService { | ||||
|                     parEleValueServiceBiz.save(parEleValue2); | ||||
|                 } | ||||
|                 //氮化炉 | ||||
|                 if (kilnInfo.getType()==3){ | ||||
|                 if (kilnInfo.getType() == 3) { | ||||
|                     //实际温度 | ||||
|                     Double actualTemp =readPlc(nameSpaceNote,"ActualTemp"); | ||||
|                     Double actualTemp = readPlc(nameSpaceNote, "ActualTemp"); | ||||
|                     //设定温度 | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp"); | ||||
|                     Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp"); | ||||
|                     //炉压 | ||||
|                     Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure"); | ||||
|                     //外一区温度 | ||||
|                     Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature"); | ||||
|                     //外二区温度 | ||||
|                     Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature"); | ||||
|                     ParTemValue parTemValue3=new ParTemValue(); | ||||
|                     ParTemValue parTemValue3 = new ParTemValue(); | ||||
|                     parTemValue3.setSetTemValue(setUpTemp.floatValue()); | ||||
|                     parTemValue3.setActTemValue(actualTemp.floatValue()); | ||||
|                     parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue()); | ||||
| @@ -297,15 +526,22 @@ public class ScheduledTask extends BaseService { | ||||
|                     parTemValue3.setCreateTime(LocalDateTime.now()); | ||||
|                     parTemValueServiceBiz.save(parTemValue3); | ||||
|                     //电度值 | ||||
|                     Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); | ||||
|                     Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue"); | ||||
|                     //A向电压 | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage"); | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage"); | ||||
|                     Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage"); | ||||
|                     Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage"); | ||||
|                     ParEleValue parEleValue3=new ParEleValue(); | ||||
|                     //ABC三向电流 | ||||
|                     Double phaseACurrent = readPlc(nameSpaceNote, "PhaseACurrent"); | ||||
|                     Double phaseBCurrent = readPlc(nameSpaceNote, "PhaseBCurrent"); | ||||
|                     Double phaseCCurrent = readPlc(nameSpaceNote, "PhaseCCurrent"); | ||||
|                     ParEleValue parEleValue3 = new ParEleValue(); | ||||
|                     parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue()); | ||||
|                     parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue3.setBVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue3.setCVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue3.setACurrentValue(phaseACurrent.floatValue()); | ||||
|                     parEleValue3.setBCurrentValue(phaseBCurrent.floatValue()); | ||||
|                     parEleValue3.setCCurrentValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue3.setTotalBat(electricalValue.floatValue()); | ||||
|                     parEleValue3.setKilnId(kilnId); | ||||
|                     parEleValue3.setTaskId(currTaskId); | ||||
| @@ -313,17 +549,24 @@ public class ScheduledTask extends BaseService { | ||||
|                     parEleValueServiceBiz.save(parEleValue3); | ||||
|                 } | ||||
|                 //清洗炉 | ||||
|                 if (kilnInfo.getType()==4){ | ||||
|                 if (kilnInfo.getType() == 4) { | ||||
|                     //电度值 | ||||
|                     Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); | ||||
|                     Double electricalValue = readPlc(nameSpaceNote, "TotalElectricity"); | ||||
|                     //A向电压 | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage"); | ||||
|                     Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage"); | ||||
|                     Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage"); | ||||
|                     Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage"); | ||||
|                     ParEleValue parEleValue4=new ParEleValue(); | ||||
|                     Double phaseCVoltage = readPlc(nameSpaceNote, "Cvoltage"); | ||||
|                     //ABC三向电流 | ||||
|                     Double aCurrent = readPlc(nameSpaceNote, "ACurrent"); | ||||
|                     Double bCurrent = readPlc(nameSpaceNote, "BCurrent"); | ||||
|                     Double cCurrent = readPlc(nameSpaceNote, "CCurrent"); | ||||
|                     ParEleValue parEleValue4 = new ParEleValue(); | ||||
|                     parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue()); | ||||
|                     parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue4.setBVoltagevValue(phaseBVoltage.floatValue()); | ||||
|                     parEleValue4.setCVoltagevValue(phaseCVoltage.floatValue()); | ||||
|                     parEleValue4.setACurrentValue(aCurrent.floatValue()); | ||||
|                     parEleValue4.setBCurrentValue(bCurrent.floatValue()); | ||||
|                     parEleValue4.setCCurrentValue(cCurrent.floatValue()); | ||||
|                     parEleValue4.setTotalBat(electricalValue.floatValue()); | ||||
|                     parEleValue4.setKilnId(kilnId); | ||||
|                     parEleValue4.setTaskId(currTaskId); | ||||
| @@ -332,36 +575,61 @@ public class ScheduledTask extends BaseService { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         System.out.println("采集完成"); | ||||
|     } | ||||
|  | ||||
|     //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, | ||||
|     //遍历工业炉,空工业炉查询缓存区是否有等待加工的任务, | ||||
|     //待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉 | ||||
|     //@Scheduled(fixedDelay = 1000*30) | ||||
|     @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)); | ||||
|                 .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0).orderByAsc(KilnInfo.TYPE)); | ||||
|         // 呼叫车辆运送货物给炉子 | ||||
|         //存在空闲窑炉 | ||||
|         if (kilnInfoList.size()!=0) { | ||||
|             for (KilnInfo kilnInfo:kilnInfoList | ||||
|                  ) { | ||||
|         //存在空闲工业炉 | ||||
|         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){ | ||||
|                 if (vehicleInfos.size() > 0) { | ||||
|                     return; | ||||
|                 } | ||||
|                 if (kilnStopRecTask(kilnInfo.getId())){ | ||||
|                     continue; | ||||
|                 } | ||||
|                 Boolean kilnReadyIn = false; | ||||
|                 if (kilnInfo.getType() == 1) { | ||||
|                     kilnReadyIn = kilnReadyIn(kilnInfo.getId()); | ||||
|                 } | ||||
|                 //查询炉子是否allowIn | ||||
|                 Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId()); | ||||
|                 if (kilnAllowIn){ | ||||
|                     //缓存去是否有目标位置为窑炉的待加工任务 | ||||
|                 if (kilnReadyIn || kilnAllowIn) { | ||||
|                     //因为readyIn在多用炉第一托盘下油后一直存在,到出炉为止.所以查询当前炉子在加工的任务,大于一条,则不再根据readyIn发起任务 | ||||
|                     List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>() | ||||
|                             .eq(CurrTask.KILN_ID, kilnInfo.getId()).eq(CurrTask.IS_IN, 1).eq(CurrTask.STATUS, 1)); | ||||
|                     if (kilnInfo.getType() == 1) { | ||||
|                         if (currTaskList.size() > 1) { | ||||
|                             continue; | ||||
|                         } | ||||
|                     } else { | ||||
|                         if (currTaskList.size() > 0) { | ||||
|                             continue; | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
|                     //缓存区是否有目标位置为工业炉的待加工任务 | ||||
|                     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); | ||||
|                         logger.info("加工炉" + kilnInfo.getCode() + "readyIn为" + kilnReadyIn.toString() + " allowIn为" + kilnAllowIn.toString()); | ||||
|                         logger.info("缓存区等待队列第一位:" + inStockInfo.toString()); | ||||
|                         CurrTask currTask = currTaskServiceBiz.getById(inStockInfo.getTaskId()); | ||||
|                         if (currTask.getStatus() != 0) { | ||||
|                             logger.info(inStockInfo.toString() + "该缓存对应的任务状态为:" + currTask.getStatus() + "不能发起任务。"); | ||||
|                             webSocketServer.sendtoUser(inStockInfo.getLocationName() + "对应的缓存加工任务状态不为未加工,不能发起任务,请先确认任务状态!", "1"); | ||||
|                         } | ||||
|                         Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); | ||||
|                         //是否有小车在运行 | ||||
|                         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1)); | ||||
| @@ -370,11 +638,15 @@ public class ScheduledTask extends BaseService { | ||||
|                             //计算出路径最短的车辆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); | ||||
|                             if (vehicleId != 0) { | ||||
|                                 VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId); | ||||
|                                 vehicleInfo.setStatus(1); | ||||
|                                 vehicleInfo.setUpdateTime(LocalDateTime.now()); | ||||
|                                 vehicleInfoServiceBiz.updateById(vehicleInfo); | ||||
|                                 asynRunTaskService.asynRunTaskForStockToKiln(inStockInfo.getId(), vehicleId); | ||||
|                             } else { | ||||
|                                 logger.info("当前两辆车都不在线.无法发起任务!"); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| @@ -384,52 +656,69 @@ public class ScheduledTask extends BaseService { | ||||
|     } | ||||
|  | ||||
|     //遍历正在工作炉子的报警变量,记录报警 | ||||
|     public void listenKilnAlarm(){ | ||||
|     @Scheduled(fixedDelay = 1000 * 60) | ||||
|     public void listenKilnAlarm() { | ||||
|         List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(); | ||||
|         for (KilnInfo kilnInfo:kilnInfoList | ||||
|              ) { | ||||
|         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){ | ||||
|             Boolean aBoolean = Boolean.valueOf(String.valueOf(jsonObject.get("result"))); | ||||
|             if (aBoolean) { | ||||
|                 //命名空间前缀 | ||||
|                 String nameSpace = kilnNameSpace.getNote(); | ||||
|                 String nameSpace = kilnNameSpace.getName(); | ||||
|                 //炉子的报警变量 | ||||
|                 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 | ||||
|                         .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); | ||||
|                     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){ | ||||
|                         if (resultBoolean) { | ||||
|                             //任务状态为执行中且正在炉子中加工的任务 | ||||
|                             CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>() | ||||
|                             List<CurrTask> currTaskList = currTaskServiceBiz.list(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); | ||||
|                             if (currTaskList.size() != 0) { | ||||
|                                 for (CurrTask currTask : currTaskList | ||||
|                                 ) { | ||||
|                                     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); | ||||
|                                 } | ||||
|                             } else { | ||||
|                                 AlarmInfo alarmInfo = new AlarmInfo(); | ||||
|                                 alarmInfo.setEquipmentId(kilnInfo.getId()); | ||||
|                                 alarmInfo.setEquipmentName(kilnInfo.getKilnName()); | ||||
|                                 alarmInfo.setType(0); | ||||
|                                 alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode()); | ||||
|                                 alarmInfo.setAlarmInfo(plcNameSpace.getEqName() + ":" + plcNameSpace.getNote()); | ||||
|                                 alarmInfo.setTaskCode("0"); | ||||
|                                 alarmInfo.setCreateTime(LocalDateTime.now()); | ||||
|                                 alarmInfoServiceBiz.save(alarmInfo); | ||||
|                             } | ||||
|                         } | ||||
|                     } catch (IOException e) { | ||||
|                         e.printStackTrace(); | ||||
| @@ -437,70 +726,192 @@ public class ScheduledTask extends BaseService { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     //监听车辆是否在线 | ||||
|     //监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起,废弃 | ||||
|     public void listenVehicleOnline() throws IOException { | ||||
|         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>() | ||||
|                 .eq(VehicleInfo.STATUS, 2)); | ||||
|         for (VehicleInfo vehicleInfo:vehicleInfoList | ||||
|              ) { | ||||
|  | ||||
|         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1)); | ||||
|         for (VehicleInfo vehicleInfo : vehicleInfoList | ||||
|         ) { | ||||
|             Boolean rgvOnline = rgvOnline(vehicleInfo.getId()); | ||||
|             Boolean rgvFree = rgvFree(vehicleInfo.getId()); | ||||
|             if (!rgvOnline) { | ||||
|                 webSocketServer.sendtoUser("当前存在车辆不在线,请移动停用的车辆到轨道尽头处或者改车辆为线上模式,如果已经车辆停用,请忽略本提示消息。", "1"); | ||||
|             } | ||||
|             if (rgvOnline && rgvFree) { | ||||
|                 vehicleInfo.setStatus(0); | ||||
|                 vehicleInfoServiceBiz.updateById(vehicleInfo); | ||||
|                 logger.info("检测到车辆:" + vehicleInfo.getId() + " 显示状态为占用,实际状态为空闲。自动置车辆状态为空闲。"); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取变量值 | ||||
|      * @param nameSpace nameSpace前缀 | ||||
|      * | ||||
|      * @param nameSpace    nameSpace前缀 | ||||
|      * @param variableName 变量名称 | ||||
|      * @return result字符串 | ||||
|      */ | ||||
|     private String readPlcToString(String nameSpace, String variableName){ | ||||
|         String identifier=nameSpace.concat(variableName); | ||||
|     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); | ||||
|         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+" 的值失败"); | ||||
|             logger.info("readPLC: " + identifier + " 的值失败"); | ||||
|         } | ||||
|  | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取变量值 | ||||
|      * @param nameSpace nameSpace前缀 | ||||
|      * | ||||
|      * @param nameSpace    nameSpace前缀 | ||||
|      * @param variableName 变量名称 | ||||
|      * @return 变量值 | ||||
|      */ | ||||
|     private Double readPlc(String nameSpace, String variableName){ | ||||
|         String identifier=nameSpace.concat(variableName); | ||||
|     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); | ||||
|         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+" 的值失败"); | ||||
|             logger.info("能源消耗统计:获取 " + identifier + " 的值失败"); | ||||
|         } | ||||
|         return Double.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|     } | ||||
|  | ||||
|     private Boolean kilnAllowIn(Long kilnId){ | ||||
|     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)); | ||||
|                 .eq(PlcNameSpace.TYPE, 0)); | ||||
|         String nameSpaceNote = nameSpace.getName(); | ||||
|         String result = readPlcToString(nameSpaceNote, "AllowIn"); | ||||
|         return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|     } | ||||
|  | ||||
|     private Boolean kilnStopRecTask(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, "StopRecTask"); | ||||
|         return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|     } | ||||
|     private Boolean kilnReadyIn(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, "ReadyIn"); | ||||
|         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()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 车辆是否在线 | ||||
|      * | ||||
|      * @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; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 车辆是否空闲 | ||||
|      * | ||||
|      * @param vehicleId 车辆id | ||||
|      * @return true/false | ||||
|      * @throws IOException plc访问失败 | ||||
|      */ | ||||
|     private Boolean rgvFree(Long vehicleId) throws IOException { | ||||
|         String identifier = null; | ||||
|         if (vehicleId == 1) { | ||||
|             identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free"; | ||||
|         } | ||||
|         if (vehicleId == 2) { | ||||
|             identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free"; | ||||
|         } | ||||
|         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 free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|         return free; | ||||
|     } | ||||
|     /** | ||||
|      * 上报apms-end | ||||
|      * | ||||
|      * @param currTask | ||||
|      * @return | ||||
|      */ | ||||
|     private Boolean apmsEndProcess(CurrTask currTask) { | ||||
|         LocalDateTime date=LocalDateTime.now(); | ||||
|         if (currTask.getEndTime()!=null){ | ||||
|             date=currTask.getEndTime(); | ||||
|         } | ||||
|         ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); | ||||
|         apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | ||||
|         apmsEndProcess.setEndUser("QJJP03"); | ||||
|         apmsEndProcess.setSheetNo(currTask.getSheetNo()); | ||||
|         R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess); | ||||
|         if (apmsEndProcessVoR.getCode() != 0) { | ||||
|             logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败"); | ||||
|             return false; | ||||
|         } | ||||
|         logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功"); | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,18 @@ | ||||
| package com.mt.wms.empty.task; | ||||
|  | ||||
| import com.mt.wms.core.utils.CodeGeneratorHelper; | ||||
|  | ||||
| import java.text.DecimalFormat; | ||||
|  | ||||
| /** | ||||
|  * @Author: LGH | ||||
|  * @Date: 2022/11/2 | ||||
|  */ | ||||
| public class StoveCodeUtils { | ||||
|     public static String getStoveCode(String kilnName,Integer craft){ | ||||
|         DecimalFormat df=new DecimalFormat(); | ||||
|         df.applyPattern("00"); | ||||
|         String craftCode = df.format(craft); | ||||
|         return CodeGeneratorHelper.getStoveCode(kilnName, craftCode); | ||||
|     } | ||||
| } | ||||
| @@ -65,7 +65,7 @@ public class TaskDistanceUtils { | ||||
|             return 2L; | ||||
|         } | ||||
|         //液压台4 和 1号回火炉只能调用车辆1 | ||||
|         if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){ | ||||
|         if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"BMC2".equals(startPoint)||"BMC2".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)||"YYT003".equals(startPoint)||"YYT003".equals(endPoint)){ | ||||
|             return 1L; | ||||
|         } | ||||
|         Double startDistance = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPoint)).getDistance(); | ||||
| @@ -114,6 +114,9 @@ public class TaskDistanceUtils { | ||||
|         //小车当前位置、起点、终点,找出最大最小值 | ||||
|         Double minDistance=(((rgvCurrPosition<startDistance)?rgvCurrPosition:startDistance)<endDistance)?((rgvCurrPosition<startDistance)?rgvCurrPosition:startDistance):endDistance; | ||||
|         Double maxDistance=(((rgvCurrPosition>startDistance)?rgvCurrPosition:startDistance)>endDistance)?((rgvCurrPosition>startDistance)?rgvCurrPosition:startDistance):endDistance; | ||||
|         logger.info("min"+minDistance); | ||||
|         logger.info("max"+maxDistance); | ||||
|         logger.info("other"+otherNowPosition); | ||||
|         //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(4米) | ||||
|         if (otherNowPosition>=minDistance&&otherNowPosition<=maxDistance){ | ||||
|             return true; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user