Merge remote-tracking branch 'origin/master'

This commit is contained in:
2023-04-06 17:03:53 +08:00
44 changed files with 612 additions and 165 deletions

View File

@@ -44,12 +44,13 @@ public enum AcsTaskEnum {
AGV_SYSTEM_NB("1","诺宝机器人任务"),
AGV_SYSTEM_XC("1","叉车任务"),
TASK_TYPE_AGV_DOUBLE_STATION("0101","AGV双工位"),
TASK_TYPE_CLEANING_TASK("0102","清洗任务"),
TASK_TYPE_PLOTTER_FULL_OF_MATERIAL("010301","刻字满料"),
TASK_TYPE_PLOTTER_FILL_THE_BLANK_BOX("010302","刻字补空框"),
TASK_TYPE_WARP_CALL_MATERIAL("010401","包装叫料"),
TASK_TYPE_WARP_SEND_BLANK_BOX("010402","包装送空框"),
TASK_TYPE_NOBLE_DOUBLE_TASK("1","诺宝双工任务"),
TASK_TYPE_NOBLE_SINGLE_TASK("2","诺宝单工任务"),
TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK("3","诺宝单入-单任务"),
TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK("4","诺宝双入-双任务"),
TASK_TYPE_NOBLE_POINT_POINT_TASK("5","诺宝点对点任务"),
TASK_TYPE_WEIGHING_TASK_OF_PS20("6","PS20称重任务刻字-包装)"),
TASK_TYPE_NON_WEIGHING_TASK_OF_PS20("7","PS20不称重任务刻字-包装)"),
TASK_FINISHED_TYPE_AUTO("1", "自动完成任务"),
TASK_FINISHED_TYPE_MANUAL("2", "手动完成任务"),

View File

@@ -0,0 +1,46 @@
package org.nl.system.controller.generator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.utils.PageUtil;
import org.nl.system.service.generator.ICodeColumnConfigService;
import org.nl.system.service.generator.ICodeGenConfigService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 代码生成字段信息存储 前端控制器
* </p>
*
* @author generator
* @since 2023-04-06
*/
@RestController
@RequestMapping("/codeColumnConfig")
@RequiredArgsConstructor
@Api(tags = "系统:代码生成管理")
public class CodeColumnConfigController {
private final ICodeGenConfigService genConfigService;
private final ICodeColumnConfigService generatorService;
@Value("${generator.enabled}")
private Boolean generatorEnabled;
@ApiOperation("查询数据库数据")
@GetMapping(value = "/tables")
public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name,
@RequestParam(defaultValue = "0")Integer page,
@RequestParam(defaultValue = "10")Integer size){
int[] startEnd = PageUtil.transToStartEnd(page, size);
return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK);
// return null;
}
}

View File

@@ -0,0 +1,43 @@
package org.nl.system.controller.generator;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.system.service.generator.ICodeGenConfigService;
import org.nl.system.service.generator.dao.CodeGenConfig;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 代码生成器配置 前端控制器
* </p>
*
* @author generator
* @since 2023-04-06
*/
@RestController
@RequestMapping("/codeGenConfig")
@RequiredArgsConstructor
@Api(tags = "系统:代码生成器配置管理")
@SaIgnore
public class CodeGenConfigController {
private final ICodeGenConfigService genConfigService;
@ApiOperation("查询")
@GetMapping(value = "/{tableName}")
public ResponseEntity<Object> query(@PathVariable String tableName){
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
}
@ApiOperation("修改")
@PutMapping
public ResponseEntity<Object> update(@Validated @RequestBody CodeGenConfig genConfig){
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK);
}
}

View File

@@ -0,0 +1,27 @@
package org.nl.system.service.generator;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.system.service.generator.dao.CodeColumnConfig;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.system.service.generator.dto.TableInfo;
import java.util.List;
/**
* <p>
* 代码生成字段信息存储 服务类
* </p>
*
* @author generator
* @since 2023-04-06
*/
public interface ICodeColumnConfigService extends IService<CodeColumnConfig> {
/**
* 查询数据库元数据
* @param name 表名
* @param startEnd 分页参数
* @return /
*/
IPage<TableInfo> getTables(String name, int[] startEnd);
}

View File

@@ -0,0 +1,30 @@
package org.nl.system.service.generator;
import org.nl.system.service.generator.dao.CodeGenConfig;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 代码生成器配置 服务类
* </p>
*
* @author generator
* @since 2023-04-06
*/
public interface ICodeGenConfigService extends IService<CodeGenConfig> {
/**
* 根据表名查找
* @param tableName
* @return
*/
CodeGenConfig find(String tableName);
/**
* 根据表名更新
* @param tableName
* @param genConfig
* @return
*/
CodeGenConfig update(String tableName, CodeGenConfig genConfig);
}

View File

@@ -0,0 +1,58 @@
package org.nl.system.service.generator.dao;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 代码生成字段信息存储
* </p>
*
* @author generator
* @since 2023-04-06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("code_column_config")
public class CodeColumnConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(value = "column_id", type = IdType.AUTO)
private Long columnId;
private String tableName;
private String columnName;
private String columnType;
private String dictName;
private String extra;
private Boolean formShow;
private String formType;
private String keyType;
private Boolean listShow;
private Boolean notNull;
private String queryType;
private String remark;
private String dateAnnotation;
}

View File

@@ -0,0 +1,83 @@
package org.nl.system.service.generator.dao;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* <p>
* 代码生成器配置
* </p>
*
* @author generator
* @since 2023-04-06
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("code_gen_config")
public class CodeGenConfig implements Serializable {
private static final long serialVersionUID = 1L;
public CodeGenConfig(String tableName) {
this.tableName = tableName;
}
/**
* ID
*/
@TableId(value = "config_id", type = IdType.AUTO)
private Long configId;
/**
* 表名
*/
private String tableName;
/**
* 作者
*/
private String author;
/**
* 是否覆盖
*/
private Boolean cover;
/**
* 模块名称
*/
private String moduleName;
/**
* 至于哪个包下
*/
private String pack;
/**
* 前端代码生成的路径
*/
private String path;
/**
* 前端Api文件路径
*/
private String apiPath;
/**
* 表前缀
*/
private String prefix;
/**
* 接口名称
*/
private String apiAlias;
}

View File

@@ -0,0 +1,16 @@
package org.nl.system.service.generator.dao.mapper;
import org.nl.system.service.generator.dao.CodeColumnConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 代码生成字段信息存储 Mapper 接口
* </p>
*
* @author generator
* @since 2023-04-06
*/
public interface CodeColumnConfigMapper extends BaseMapper<CodeColumnConfig> {
}

View File

@@ -0,0 +1,5 @@
<?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="org.nl.system.service.generator.dao.mapper.CodeColumnConfigMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package org.nl.system.service.generator.dao.mapper;
import org.nl.system.service.generator.dao.CodeGenConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 代码生成器配置 Mapper 接口
* </p>
*
* @author generator
* @since 2023-04-06
*/
public interface CodeGenConfigMapper extends BaseMapper<CodeGenConfig> {
}

View File

@@ -0,0 +1,5 @@
<?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="org.nl.system.service.generator.dao.mapper.CodeGenConfigMapper">
</mapper>

View File

@@ -0,0 +1,32 @@
package org.nl.system.service.generator.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author: lyd
* @Description: 表的数据信息
* @Date: 2023/4/6
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TableInfo {
/** 表名称 */
private Object tableName;
/** 创建日期 */
private Object createTime;
/** 数据库引擎 */
private Object engine;
/** 编码集 */
private Object coding;
/** 备注 */
private Object remark;
}

View File

@@ -0,0 +1,34 @@
package org.nl.system.service.generator.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.nl.system.service.generator.dao.CodeColumnConfig;
import org.nl.system.service.generator.dao.mapper.CodeColumnConfigMapper;
import org.nl.system.service.generator.ICodeColumnConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.system.service.generator.dto.TableInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 代码生成字段信息存储 服务实现类
* </p>
*
* @author generator
* @since 2023-04-06
*/
@Service
public class CodeColumnConfigServiceImpl extends ServiceImpl<CodeColumnConfigMapper, CodeColumnConfig> implements ICodeColumnConfigService {
@Autowired
private CodeColumnConfigMapper codeColumnConfigMapper;
@Override
public IPage<TableInfo> getTables(String name, int[] startEnd) {
IPage<TableInfo> page = new Page<>();
return null;
}
}

View File

@@ -0,0 +1,65 @@
package org.nl.system.service.generator.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.system.service.generator.ICodeGenConfigService;
import org.nl.system.service.generator.dao.CodeGenConfig;
import org.nl.system.service.generator.dao.mapper.CodeGenConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
/**
* <p>
* 代码生成器配置 服务实现类
* </p>
*
* @author generator
* @since 2023-04-06
*/
@Service
public class CodeGenConfigServiceImpl extends ServiceImpl<CodeGenConfigMapper, CodeGenConfig> implements ICodeGenConfigService {
@Autowired
private CodeGenConfigMapper codeGenConfigMapper;
@Override
public CodeGenConfig find(String tableName) {
CodeGenConfig codeGenConfig = codeGenConfigMapper.selectOne(new LambdaQueryWrapper<CodeGenConfig>()
.eq(CodeGenConfig::getTableName, tableName));
if (ObjectUtil.isEmpty(codeGenConfig)) {
return new CodeGenConfig(tableName);
}
return codeGenConfig;
}
@Override
public CodeGenConfig update(String tableName, CodeGenConfig genConfig) {
// 如果 api 路径为空,则自动生成路径
if(StrUtil.isEmpty(genConfig.getApiPath())){
String separator = File.separator;
String[] paths;
String symbol = "\\";
if (symbol.equals(separator)) {
paths = genConfig.getPath().split("\\\\");
} else {
paths = genConfig.getPath().split(File.separator);
}
StringBuilder api = new StringBuilder();
for (String path : paths) {
api.append(path);
api.append(separator);
if ("src".equals(path)) {
api.append("api");
break;
}
}
genConfig.setApiPath(api.toString());
}
codeGenConfigMapper.updateById(genConfig);
return genConfig;
}
}

View File

@@ -18,6 +18,7 @@ public interface WmsToAcsService {
*/
Map<String, Object> issueTaskToAcs(JSONArray arr);
Map<String, Object> issueTaskToAcs2(JSONArray arr);
/**
* WMS客户端--->ACS服务端

View File

@@ -133,7 +133,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
TaskDto taskDto = taskService.findById(task_id);
String processing_class = taskDto.getHandle_class();
//1:执行中,2:完成 ,3:acs取消
String acs_task_status = row.getString("task_status");
String acs_task_status = row.getString("status");
String message = "";
String status = "";
if ("1".equals(acs_task_status)) {

View File

@@ -43,6 +43,28 @@ public class WmsToAcsServiceImpl implements WmsToAcsService{
return AcsUtil.notifyAcs(api, form);
}
@Override
public Map<String, Object> issueTaskToAcs2(JSONArray arr) {
JSONArray form = new JSONArray();
for (Object o : arr) {
JSONObject task = (JSONObject) o;
JSONObject param = new JSONObject(MapOf.of("task_id", task.getString("task_id")
, "acs_task_type", task.getString("acs_task_type")
, "task_code", task.getString("task_code")
, "start_point_code", task.getString("point_code1")//起点
, "next_point_code", task.getString("point_code2")//空盘返回点
, "task_type", task.getString("task_type")
, "priority", task.getString("priority")
, "is_send", task.getString("is_send")
, "vehicle_code", task.getString("vehicle_code")
, "agv_system_type", task.getString("agv_system_type")
));
form.add(param);
}
String api = "api/wms/task";
return AcsUtil.notifyAcs(api, form);
}
@Override
public Map<String, Object> cancelToAcs(JSONArray arr) {
String api = "api/wms/cancelTask";

View File

@@ -199,7 +199,7 @@ public class TaskServiceImpl implements TaskService {
JSONArray finish = new JSONArray();
JSONObject res = new JSONObject();
res.put("task_id", task_id);
res.put("task_status", "2");
res.put("status", AcsTaskEnum.STATUS_FINISH.getCode());
res.put("finished_type", AcsTaskEnum.TASK_FINISHED_TYPE_MANUAL.getCode()); // 手动完成
finish.add(res);
acsToWmsService.receiveTaskStatusAcs(JSON.toJSONString(finish));
@@ -208,7 +208,7 @@ public class TaskServiceImpl implements TaskService {
JSONArray cancel = new JSONArray();
JSONObject res2 = new JSONObject();
res2.put("task_id", task_id);
res2.put("task_status", "3");
res2.put("status", AcsTaskEnum.STATUS_CANNEL.getCode());
cancel.add(res2);
acsToWmsService.receiveTaskStatusAcs(JSON.toJSONString(cancel));
break;

View File

@@ -49,7 +49,7 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
if (status.equals(AcsTaskEnum.STATUS_START.getCode())) {
// 执行中
// 任务执行中
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("task_status", StatusEnum.TASK_RUNNING.getCode());
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
} else if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
@@ -84,6 +84,8 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
// 2任务取消
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("update_time", DateUtil.now());
taskObj.put("finished_type", ObjectUtil.isNotEmpty(task.getString("finished_type"))?
task.getString("finished_type"):AcsTaskEnum.TASK_FINISHED_TYPE_AUTO.getCode());
taskTab.update(taskObj);
}
}
@@ -93,7 +95,7 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
public String createTask(JSONObject param) {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_produce_workOrder");
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
String end_point_code = param.getString("point_code"); // todo
String end_point_code = param.getString("device_code");
String workorder = param.getString("workorder_code");
if(StrUtil.isEmpty(end_point_code)) {
throw new BadRequestException("终点不能为空!");
@@ -119,7 +121,7 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
task.put("task_id", taskdtl_id);
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_name", "刻字机呼叫空框");
task.put("task_type", AcsTaskEnum.TASK_TYPE_PLOTTER_FILL_THE_BLANK_BOX.getCode()); // todo: 未知
task.put("task_type", AcsTaskEnum.TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode()); // todo: 未知????????
task.put("task_status", StatusEnum.TASK_CREATE.getCode());
task.put("material_id", workOrderObj.getString("material_id"));
task.put("point_code2", end_point_code);
@@ -133,6 +135,7 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
task.put("agv_system_type", "2");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
// 找终点
try {
@@ -141,7 +144,7 @@ public class PlotterCallEmptyTask extends AbstractAcsTask {
JSONObject result = taskTab.query("task_id = '" + taskdtl_id + "'").uniqueResult(0);
data.add(result);
// 下发
wms.issueTaskToAcs(data);
wms.issueTaskToAcs2(data);
} catch (Exception ex) {
// 未找到
task.put("remark", ex.getMessage());

View File

@@ -50,7 +50,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
if (status.equals(AcsTaskEnum.STATUS_START.getCode())) {
// 执行中
// 任务执行中
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("task_status", StatusEnum.TASK_RUNNING.getCode());
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
} else if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
@@ -59,7 +59,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
// 释放点位并赋值
pointObj.put("lock_type", StatusEnum.LOCK_OFF.getCode());
pointObj.put("point_status", StatusEnum.POINT_STATUS_EMPTY.getCode());
pointObj.put("material_id", "");
pointObj.put("material_id", taskObj.getString("material_id"));
pointObj.put("update_time", DateUtil.now());
pointTab.update(pointObj);
}
@@ -85,6 +85,8 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
// 2任务取消
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("update_time", DateUtil.now());
taskObj.put("finished_type", ObjectUtil.isNotEmpty(task.getString("finished_type"))?
task.getString("finished_type"):AcsTaskEnum.TASK_FINISHED_TYPE_AUTO.getCode());
taskTab.update(taskObj);
}
}
@@ -94,7 +96,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
public String createTask(JSONObject param) {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_produce_workOrder");
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
String end_point_code = param.getString("point_code"); // todo
String end_point_code = param.getString("device_code");
String workorder = param.getString("workorder_code");
if(StrUtil.isEmpty(end_point_code)) {
throw new BadRequestException("终点不能为空!");
@@ -118,7 +120,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
task.put("task_id", taskdtl_id);
task.put("task_name", "包装叫料");
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", AcsTaskEnum.TASK_TYPE_WARP_CALL_MATERIAL.getCode()); // todo: 未知
task.put("task_type", AcsTaskEnum.TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode()); // todo: 未知
task.put("task_status", StatusEnum.TASK_CREATE.getCode());
task.put("point_code2", end_point_code);
task.put("handle_class", this.getClass().getName());
@@ -131,6 +133,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
task.put("agv_system_type", "2");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
// 找终点
try {
@@ -139,7 +142,7 @@ public class WrapCallMaterialTask extends AbstractAcsTask {
JSONObject result = taskTab.query("task_id = '" + taskdtl_id + "'").uniqueResult(0);
data.add(result);
// 下发
wms.issueTaskToAcs(data);
wms.issueTaskToAcs2(data);
} catch (Exception ex) {
// 未找到
task.put("remark", ex.getMessage());

View File

@@ -49,7 +49,7 @@ public class WrapSendEmptyTask extends AbstractAcsTask {
if (status.equals(AcsTaskEnum.STATUS_START.getCode())) {
// 执行中
// 任务执行中
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("task_status", StatusEnum.TASK_RUNNING.getCode());
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
} else if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
@@ -83,16 +83,16 @@ public class WrapSendEmptyTask extends AbstractAcsTask {
// 2任务取消
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("update_time", DateUtil.now());
taskObj.put("finished_type", ObjectUtil.isNotEmpty(task.getString("finished_type"))?
task.getString("finished_type"):AcsTaskEnum.TASK_FINISHED_TYPE_AUTO.getCode());
taskTab.update(taskObj);
}
}
@Override
public String createTask(JSONObject param) {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_produce_workOrder");
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
String start_point_code = param.getString("point_code"); // todo
String workorder = param.getString("workorder_code");
String start_point_code = param.getString("device_code");
if(StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空!");
}
@@ -103,18 +103,12 @@ public class WrapSendEmptyTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(taskObj)) {
throw new BadRequestException("当前点位" + start_point_code + "存在未完成的任务");
}
// todo: 判断工单?
// 判断工单
// JSONObject workOrderObj = workOrderTab.query("workorder_code <> '" + workorder + "' and workorder_status = '" + StatusEnum.TASK_FINISH.getCode() + "' and is_delete ='0'").uniqueResult(0);
// if (ObjectUtil.isEmpty(workOrderObj)){
// throw new BadRequestException("下发工单不存在未完成工单:"+workorder);
// }
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = new JSONObject();
task.put("task_id", taskdtl_id);
task.put("task_name", "包装送空框");
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", AcsTaskEnum.TASK_TYPE_WARP_SEND_BLANK_BOX.getCode()); // todo: 未知
task.put("task_type", AcsTaskEnum.TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode()); // todo: 未知
task.put("task_status", StatusEnum.TASK_CREATE.getCode());
task.put("point_code1", start_point_code);
task.put("handle_class", this.getClass().getName());
@@ -127,6 +121,7 @@ public class WrapSendEmptyTask extends AbstractAcsTask {
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
task.put("agv_system_type", "2");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
// 找终点
try {
@@ -135,7 +130,7 @@ public class WrapSendEmptyTask extends AbstractAcsTask {
JSONObject result = taskTab.query("task_id = '" + taskdtl_id + "'").uniqueResult(0);
data.add(result);
// 下发
wms.issueTaskToAcs(data);
wms.issueTaskToAcs2(data);
} catch (Exception ex) {
// 未找到
task.put("remark", ex.getMessage());

View File

@@ -49,7 +49,7 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
if (status.equals(AcsTaskEnum.STATUS_START.getCode())) {
// 执行中
// 任务执行中
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("task_status", StatusEnum.TASK_RUNNING.getCode());
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
} else if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
@@ -85,6 +85,8 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
// 2任务取消
taskObj.put("task_status", StatusEnum.TASK_CANNEL.getCode());
taskObj.put("update_time", DateUtil.now());
taskObj.put("finished_type", ObjectUtil.isNotEmpty(task.getString("finished_type"))?
task.getString("finished_type"):AcsTaskEnum.TASK_FINISHED_TYPE_AUTO.getCode());
taskTab.update(taskObj);
}
}
@@ -94,7 +96,7 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
public String createTask(JSONObject param) {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_produce_workOrder");
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
String start_point_code = param.getString("point_code"); // todo
String start_point_code = param.getString("device_code");
String workorder = param.getString("workorder_code");
if(StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空!");
@@ -120,7 +122,7 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
task.put("task_id", taskdtl_id);
task.put("task_name", "刻字机送料");
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", AcsTaskEnum.TASK_TYPE_PLOTTER_FULL_OF_MATERIAL.getCode()); // todo: 未知
task.put("task_type", AcsTaskEnum.TASK_TYPE_WEIGHING_TASK_OF_PS20.getCode()); // todo: 未知
task.put("material_id", workOrderObj.getString("material_id"));
task.put("task_status", StatusEnum.TASK_CREATE.getCode());
task.put("point_code1", start_point_code);
@@ -134,6 +136,7 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
task.put("agv_system_type", "2");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
// 找终点
try {
@@ -142,7 +145,7 @@ public class PlotterSendMaterialTask extends AbstractAcsTask {
JSONObject result = taskTab.query("task_id = '" + taskdtl_id + "'").uniqueResult(0);
data.add(result);
// 下发
wms.issueTaskToAcs(data);
wms.issueTaskToAcs2(data);
} catch (Exception ex) {
// 未找到
task.put("remark", ex.getMessage());

View File

@@ -41,11 +41,11 @@ public enum StatusEnum {
//请求MES任务类型
LACK_REQ("1", "缺料请求(三工位)", ""),
FULL_REQ("2", "满料请求(三工位、刻字满料", ""),
EMPTY_REQ("3", "空框请求(包装", ""),
EMPTY_REQ1("4", "空框请求(包装", ""),
EMPTY_REQ2("5", "取空框请求(包装)", ""),
EMPTY_REQ3("6", "空框请求(包装)", ""),
FULL_REQ("2", "满料请求(三工位)", ""),
KZ_FULL_REQ("3", "满料请求(刻字", ""),
KZ_EMPTY_REQ("4", "空框请求(刻字", ""),
BZ_FULL_REQ("5", "叫满框请求(包装)", ""),
BZ_EMPTY_REQ("6", "空框请求(包装)", ""),
//指令状态
INST_READY("0", "就绪", ""),

View File

@@ -24,6 +24,9 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
@@ -45,8 +48,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
int agvaddr = 0;
int agvaddr_copy = 0;
int weight = 0;
@@ -202,9 +205,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
break;
}
// 4010 待处理
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
// if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
inst.setWeight(String.valueOf(weight));
instructionService.update(inst);
TaskDto taskDto = taskService.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setWeight(String.valueOf(weight));
taskService.update(taskDto);
}
//}
}
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);

View File

@@ -23,6 +23,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.List;
@@ -40,7 +43,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
private DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
private DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
private DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogServiceImpl.class);
private TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
private int agvaddr = 0;
private int agvaddr_copy = 0;
private int weight = 0;
@@ -780,9 +783,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
break;
}
// 4010 待处理
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
// if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
inst.setWeight(String.valueOf(weight));
instructionService.update(inst);
TaskDto taskDto = taskService.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setWeight(String.valueOf(weight));
taskService.update(taskDto);
}
// }
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);

View File

@@ -434,6 +434,11 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setVehicle_code(String.valueOf(docking_barcode));
taskserver.update(taskDto);
}
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
@@ -485,6 +490,11 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setVehicle_code(String.valueOf(docking_barcode));
taskserver.update(taskDto);
}
this.noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
@@ -839,21 +849,6 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
return str;
}
public void writing(List<Map<String, String>> list) {
Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) {
Object ob = list.get(i);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
if (!StrUtil.isEmpty(json.getString("value"))) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + json.getString("code");
itemMap.put(to_param, json.getString("value"));
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() throws Exception {
JSONObject jo = new JSONObject();

View File

@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -19,12 +18,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮清洗机
*/

View File

@@ -1,7 +1,6 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -94,6 +93,7 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
String device_code;

View File

@@ -14,7 +14,6 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
@@ -61,6 +60,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
String device_code;

View File

@@ -161,6 +161,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
String device_code;
@@ -381,6 +382,8 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
//有货、联机、满料请求申请AGV搬运任务
if (move == 1 && mode == 1 && full_req == 1 && !requireSucess) {
apply_task();
this.noApplyTaskMessage = null;
this.message = "申请满料任务成功";
} else {
if (full_req == 1) {
String notApplyTaskMessage = "";
@@ -400,6 +403,8 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
//无货、联机、空箱请求申请AGV搬运任务
if (move == 0 && mode == 1 && empty_req == 1 && !requireSucess) {
apply_empty_task();
this.noApplyTaskMessage = null;
this.message = "申请空箱任务成功";
} else {
if (empty_req == 1) {
String notApplyTaskMessage = "";
@@ -547,7 +552,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
reqParam.put("type", StatusEnum.LACK_REQ.getCode());
reqParam.put("type", StatusEnum.KZ_EMPTY_REQ.getCode());
reqParam.put("device_code", this.getDevice_code());
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
@@ -574,7 +579,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
reqParam.put("device_code", this.getDevice_code());
reqParam.put("type", StatusEnum.FULL_REQ.getCode());
reqParam.put("type", StatusEnum.KZ_FULL_REQ.getCode());
reqParam.put("quantity", this.getPort_full_num());
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
@@ -594,9 +599,9 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
*/
@Override
public void issuedOrderInfo(ProduceshiftorderDto dto) {
if (!this.getItemProtocol().getIsonline()) {
throw new BadRequestException("设备未开机,工单下发失败!");
}
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,工单下发失败!");
// }
Map<String, Object> map = new HashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());

View File

@@ -8,7 +8,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.acsEnum.WorkerOrderEnum;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
@@ -29,7 +28,6 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
@@ -401,9 +399,9 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
*/
@Override
public void issuedOrderInfo(ProduceshiftorderDto dto) {
if (!this.getItemProtocol().getIsonline()) {
throw new BadRequestException("设备未开机,开工失败!");
}
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,开工失败!");
// }
Map<String, Object> map = new HashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());

View File

@@ -9,7 +9,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -24,11 +23,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备空框位
@@ -90,6 +86,7 @@ public class HailiangOldSpecialEmptyStationDeviceDriver extends AbstractOpcDevic
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
@Override

View File

@@ -11,7 +11,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -32,12 +31,9 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮老车间专机设备满框位
@@ -104,6 +100,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
@Override
@@ -189,6 +186,8 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
//满料位满足联机有货有工单时向MES申请任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) {
apply_task();
this.noApplyTaskMessage = null;
this.message = "申请满料请求任务成功";
} else {
if (move == 1) {
String notApplyTaskMessage = "";

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -18,12 +17,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮老车间专机设备接框位
*/
@@ -135,17 +130,6 @@ public class HailiangOldSpecialPickStationDeviceDriver extends AbstractOpcDevice
}
}
public void writing(String key, String value) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + key;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
return null;

View File

@@ -10,7 +10,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
@@ -29,12 +28,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备倒料位
@@ -194,6 +190,8 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= this.storage_stock_num) {
applyOutCacheLineTask();
this.noApplyTaskMessage = null;
this.message = "申请缓存线任务成功";
} else {
if (Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
String notApplyTaskMessage = "";

View File

@@ -12,7 +12,6 @@ import org.nl.acs.acsEnum.WorkerOrderEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
@@ -35,7 +34,6 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
@@ -123,6 +121,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
@Override
@@ -315,6 +314,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if (mode == 1 && lack_req == 1 && !requireSucess) {
apply_task();
this.noApplyTaskMessage = null;
this.message = "申请缺料请求任务成功";
} else {
if (lack_req == 1) {
String notApplyTaskMessage = "";
@@ -330,6 +331,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if (mode == 1 && req_task_empty == 1 && !requireSucess) {
apply_take_empty_task();
this.noApplyTaskMessage = null;
this.message = "申请取空框任务成功";
} else {
if (req_task_empty == 1) {
String notApplyTaskMessage = "";
@@ -458,7 +461,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
reqParam.put("device_code", this.getDevice_code());
reqParam.put("type", StatusEnum.EMPTY_REQ.getCode());
reqParam.put("type", StatusEnum.BZ_EMPTY_REQ.getCode());
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
@@ -484,7 +487,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
reqParam.put("device_code", this.getDevice_code());
reqParam.put("type", StatusEnum.LACK_REQ.getCode());
reqParam.put("type", StatusEnum.BZ_FULL_REQ.getCode());
reqParam.put("workorder_code", this.getOrder());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
@@ -508,9 +511,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
*/
@Override
public void issuedOrderInfo(ProduceshiftorderDto dto) {
if (!this.getItemProtocol().getIsonline()) {
throw new BadRequestException("设备未开机,工单下发失败");
}
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,工单下发失败");
// }
Map<String, Object> map = new HashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());

View File

@@ -8,7 +8,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.acsEnum.WorkerOrderEnum;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
@@ -29,7 +28,6 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
@@ -389,9 +387,9 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
*/
@Override
public void issuedOrderInfo(ProduceshiftorderDto dto) {
if (!this.getItemProtocol().getIsonline()) {
throw new BadRequestException("设备未开机,开工失败!");
}
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,开工失败!");
// }
Map<String, Object> map = new HashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());

View File

@@ -9,7 +9,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -24,12 +23,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备空框位
*/

View File

@@ -11,7 +11,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -32,12 +31,9 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备满框位
@@ -106,6 +102,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
@Override
@@ -194,6 +191,8 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
//工作模式联机、满料位有货、工单号大于0 就申请agv任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) {
apply_task();
this.noApplyTaskMessage = null;
this.message = "申请满料请求任务成功";
} else {
if (move == 1) {
String notApplyTaskMessage = "";

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -18,12 +17,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备接框位
*/
@@ -150,15 +145,6 @@ public class HailiangSpecialPickStationDeviceDriver extends AbstractOpcDeviceDri
last_order = order;
}
public void writing(String key, String value) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + key;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() throws Exception {

View File

@@ -10,7 +10,6 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
@@ -29,12 +28,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮专机设备倒料位
@@ -103,6 +99,7 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
this.agvphase = agvphase;
this.index = index;
this.inst = inst;
logServer.deviceExecuteLog(device_code, "", "", "设置phase值--->" + agvphase + ",index值--->" + index + ",指令信息关联编号--->" + inst.getLink_num());
}
@Override
@@ -199,6 +196,8 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
//倒料位满足联机,剩余数量小于最小数量申请缓存线出库任务
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
applyOutCacheLineTask();
this.noApplyTaskMessage = null;
this.message = "申请缓存线任务成功";
} else {
if (Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
String notApplyTaskMessage = "";

View File

@@ -7,7 +7,6 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
@@ -27,7 +26,6 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
@@ -129,7 +127,6 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -352,22 +349,11 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
}
public void writing(String key, String value) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + key;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public void issuedOrderInfo(ProduceshiftorderDto dto) {
if (!this.getItemProtocol().getIsonline()) {
throw new BadRequestException("设备未开机,工单下发失败");
}
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,工单下发失败");
// }
String lane_tray_template = dto.getLane_tray_template();
String to_tray_info = "";
if (lane_tray_template.equals("1")) {

View File

@@ -204,7 +204,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
//驱动类中有工单的设备 下发电气工单信息的方法
if (device.getDeviceDriver() instanceof IssuedDeviceOrderInfo) {
IssuedDeviceOrderInfo issuedDeviceOrderInfo = (IssuedDeviceOrderInfo) device.getDeviceDriver();
try {
issuedDeviceOrderInfo.issuedOrderInfo(dto);
} catch (Exception e) {
e.printStackTrace();
}
}
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
@@ -307,7 +311,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
} else {
status = WorkerOrderEnum.COMPLETE.getCode();
}
this.addDeviceIsOnline(dto.getDevice_code(), pdto);
// this.addDeviceIsOnline(dto.getDevice_code(), pdto);
pdto.setOrder_status(status);
this.update(pdto);
}
@@ -326,7 +330,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
if (ObjectUtil.isEmpty(dto)) {
throw new BadRequestException("不存在该工单外部标识:" + ext_order_id);
}
this.addDeviceIsOnline(dto.getDevice_code(), dto);
// this.addDeviceIsOnline(dto.getDevice_code(), dto);
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
dto.setOrder_status(type);
dto.setUpdate_time(DateUtil.now());

View File

@@ -10,7 +10,7 @@
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>