This commit is contained in:
2023-03-24 13:54:43 +08:00
6 changed files with 218 additions and 104 deletions

View File

@@ -29,6 +29,8 @@ public class ItemProtocol {
public static String item_barcode_length = "barcode_length"; public static String item_barcode_length = "barcode_length";
//条码 //条码
public static String item_barcode = "barcode"; public static String item_barcode = "barcode";
//重量
public static String item_weight = "weight";
//下发命令 //下发命令
@@ -66,6 +68,9 @@ public class ItemProtocol {
public int getMove() { public int getMove() {
return this.getOpcIntegerValue(item_move); return this.getOpcIntegerValue(item_move);
} }
public int getWeight() {
return this.getOpcIntegerValue(item_weight);
}
public int getCarrier_direction() { public int getCarrier_direction() {
return this.getOpcIntegerValue(item_carrier_direction); return this.getOpcIntegerValue(item_carrier_direction);
@@ -126,6 +131,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_task, "任务号", "DB101.D260")); list.add(new ItemDto(item_task, "任务号", "DB101.D260"));
list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800")); list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800"));
list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50")); list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50"));
list.add(new ItemDto(item_weight, "重量", "DB101.D702"));
return list; return list;
} }

View File

@@ -18,6 +18,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
@@ -72,6 +74,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
protected String barcode = null; protected String barcode = null;
protected String formatcode = null; protected String formatcode = null;
private Date require_apply_labeling_time = new Date();
private Date instruction_require_time = new Date(); private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date(); private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date(); private Date instruction_apply_time = new Date();
@@ -84,6 +87,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
int action = 0; int action = 0;
int error = 0; int error = 0;
int task = 0; int task = 0;
int weight = 0;
int to_task = 0; int to_task = 0;
String plcbarcode = null; String plcbarcode = null;
String last_plcbarcode = null; String last_plcbarcode = null;
@@ -101,6 +105,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
int last_move = 0; int last_move = 0;
int last_error = 0; int last_error = 0;
int last_task = 0; int last_task = 0;
int last_weight = 0;
String last_container; String last_container;
String inst_message; String inst_message;
String device_code; String device_code;
@@ -143,6 +148,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
scanner.cleanBarcode(); scanner.cleanBarcode();
logServer.deviceExecuteLog(this.device_code, "", "", "清理条码"); logServer.deviceExecuteLog(this.device_code, "", "", "清理条码");
} }
public synchronized boolean finish_instruction() { public synchronized boolean finish_instruction() {
try { try {
instructionService.finish(inst); instructionService.finish(inst);
@@ -195,6 +201,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
plcbarcode = this.itemProtocol.getplcBarCode(); plcbarcode = this.itemProtocol.getplcBarCode();
plcbarcode_length = this.itemProtocol.getBarCode_length(); plcbarcode_length = this.itemProtocol.getBarCode_length();
to_task = this.itemProtocol.getTotTask(); to_task = this.itemProtocol.getTotTask();
weight = this.itemProtocol.getWeight();
if (mode != last_mode) { if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记"); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
if (mode == 2) { if (mode == 2) {
@@ -225,6 +232,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (task != last_task) { if (task != last_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task); logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
} }
if (weight != last_weight) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight" + last_weight + "->" + weight);
}
if (mode == 2 && move != 0 && task > 0) { if (mode == 2 && move != 0 && task > 0) {
//inst_message //inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task)); inst = instructionService.findByCodeFromCache(String.valueOf(task));
@@ -287,6 +297,25 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) { if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) {
instruction_apply(newBarcode.trim()); instruction_apply(newBarcode.trim());
} }
break;
case 5:
String newBarcodes = null;
//申请任务
if (!StrUtil.isEmpty(barcode())) {
newBarcodes = barcode();
} else {
//
if (plcbarcode_length > 2) {
newBarcodes = plcbarcode;
} else {
break;
}
}
// 申请贴标
if (move > 0 && !StrUtil.isEmpty(newBarcodes) && !requireSucess) {
applyLabeling(newBarcodes);
}
break;
} }
switch (flag) { switch (flag) {
//取货完成 //取货完成
@@ -306,6 +335,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
last_task = task; last_task = task;
last_plcbarcode_length = plcbarcode_length; last_plcbarcode_length = plcbarcode_length;
last_plcbarcode = plcbarcode; last_plcbarcode = plcbarcode;
last_weight = weight;
} }
public boolean exe_error() { public boolean exe_error() {
@@ -337,22 +367,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
map3.put("code", "to_command"); map3.put("code", "to_command");
map3.put("value", "0"); map3.put("value", "0");
list.add(map3); list.add(map3);
Map map4 = new HashMap();
map4.put("code","to_strap_times");
map4.put("value","0");
list.add(map4);
Map map5 = new HashMap();
map5.put("code","to_length");
map5.put("value","0");
list.add(map5);
Map map6 = new HashMap();
map6.put("code","to_weight");
map6.put("value","0");
list.add(map6);
Map map7 = new HashMap();
map7.put("code","to_height");
map7.put("value","0");
list.add(map7);
this.writing(list); this.writing(list);
message = null; message = null;
} }
@@ -435,6 +449,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
this.instruction_apply_time = date; this.instruction_apply_time = date;
//container_code //container_code
TaskDto task = taskserver.findByContainer(container_code); TaskDto task = taskserver.findByContainer(container_code);
logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(task));
if (!ObjectUtil.isEmpty(task)) { if (!ObjectUtil.isEmpty(task)) {
Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code()); Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) { if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
@@ -485,6 +500,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
/** /**
* 请求指令 * 请求指令
* 定点任务时请求这里 * 定点任务时请求这里
*
* @param container_code * @param container_code
* @param container_type * @param container_type
*/ */
@@ -497,6 +513,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
this.instruction_require_time = date; this.instruction_require_time = date;
//container_code //container_code
TaskDto taskdto = taskserver.findByContainer(container_code); TaskDto taskdto = taskserver.findByContainer(container_code);
logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(taskdto));
if (!ObjectUtil.isEmpty(taskdto)) { if (!ObjectUtil.isEmpty(taskdto)) {
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
@@ -798,6 +815,78 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} }
// 申请贴标
public synchronized void applyLabeling(String newBarcodes) {
Date date = new Date();
if (date.getTime() - this.require_apply_labeling_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
this.require_apply_labeling_time = date;
// String vehicle_code = "";
if (weight == 0) {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:" + weight + "异常");
message = "申请贴标电气设备重量:" + weight + "异常";
throw new RuntimeException("重量为空!");
}
// if (task > 0) {
// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
// if (ObjectUtil.isEmpty(instruction)) {
// instruction = instructionService.findByCode(String.valueOf(task));
// }
// vehicle_code = instruction.getVehicle_code();
// } else {
// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常");
// message = "申请贴标电气设备任务号:" + task + "异常";
// throw new RuntimeException("任务号为空!");
// }
if (StrUtil.isEmpty(newBarcodes)) {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!");
message = "申请贴标电气设备载具号为空";
throw new RuntimeException("载具号为空!");
}
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
new ApplyLabelingAndBindingRequest();
JSONObject device_json =
WQLObject.getWQLObject("acs_storage_cell")
.query("storage_code ='" + this.device_code + "'")
.uniqueResult(0);
String start_point_code = null;
if (!ObjectUtil.isEmpty(device_json)) {
start_point_code =
(String) device_json.get("parent_storage_code") == null
? this.device_code
: (String) device_json.get("parent_storage_code");
}
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType("1");
applyLabelingAndBindingRequest.setVehicle_code(newBarcodes);
applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100));
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse =
acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest));
if (applyLabelingAndBindingResponse.getstatus() == 200) {
message = "申请贴标成功";
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "5");
list.add(map);
this.writing(list);
this.writing(list);
message = "申请贴标下发电气信号成功";
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
requireSucess = true;
} else {
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
}
}
}
public void writing(List list) { public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {

View File

@@ -19,6 +19,8 @@ import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
import org.nl.system.service.role.ISysRoleService; import org.nl.system.service.role.ISysRoleService;
import org.nl.system.service.role.dao.SysRole; import org.nl.system.service.role.dao.SysRole;
import org.nl.system.service.role.dao.mapper.SysRoleMapper; import org.nl.system.service.role.dao.mapper.SysRoleMapper;
import org.nl.system.service.user.dao.SysUser;
import org.nl.system.service.user.dao.mapper.SysUserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -39,6 +41,7 @@ import java.util.*;
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService { public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
private final SysRoleMapper roleMapper; private final SysRoleMapper roleMapper;
private final SysUserMapper userMapper;
private final SysMenuMapper sysMenuMapper; private final SysMenuMapper sysMenuMapper;
@@ -130,7 +133,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
public List<String> getPermissionList(JSONObject userDto) { public List<String> getPermissionList(JSONObject userDto) {
List<String> permission = new LinkedList<>(); List<String> permission = new LinkedList<>();
// 查看是否为管理员 // 查看是否为管理员
permission.add("admin"); String currentUserId = SecurityUtils.getCurrentUserId();
SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, currentUserId));
if ( ObjectUtil.isNotEmpty(sysUser.getIsAdmin()) && sysUser.getIsAdmin()) permission.add("admin");
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId"))); permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId")));
return permission; return permission;
} }

View File

@@ -162,11 +162,24 @@ public class ProductInstorServiceImpl implements ProductInstorService {
// 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库 // 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue(); String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue();
String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue(); String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue();
Double box_length_up = Double.valueOf(length_up); String with_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_with_up").getValue();
Double box_length_down = Double.valueOf(length_down); String high_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_high_up").getValue();
Double box_length_up = Double.valueOf(length_up); // 木箱长度上限
Double box_length_down = Double.valueOf(length_down); // 木箱长度下限
Double box_with_up = Double.valueOf(with_up); // 木箱宽度上限
Double box_high_up = Double.valueOf(high_up); // 木箱高度上限
if (!(box_length_down <= box_length && box_length <= box_length_up)) { if (!(box_length_down <= box_length && box_length <= box_length_up)) {
throw new BadRequestException("无法入立体,木箱长度为:"+box_length); throw new BadRequestException("无法入立体库,木箱超长;当前木箱长度为:"+box_length);
}
if (!(box_width <= box_with_up)) {
throw new BadRequestException("无法入立体库,木箱超宽;当前木箱宽度为:"+box_width);
}
if (!(box_high <= box_high_up)) {
throw new BadRequestException("无法入立体库,木箱超高;当前木箱高度为:"+box_high);
} }
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0); JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);

View File

@@ -1,7 +1,7 @@
import store from '@/store' import store from '@/store'
export default { export default {
inserted(el, binding, vnode) { inserted(el, binding) {
const { value } = binding const { value } = binding
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
@@ -15,7 +15,7 @@ export default {
el.parentNode && el.parentNode.removeChild(el) el.parentNode && el.parentNode.removeChild(el)
} }
} else { } else {
// throw new Error(`使用方式: v-permission="['admin','editor']"`) throw new Error(`使用方式: v-permission="['admin','editor']"`)
} }
} }
} }

View File

@@ -147,6 +147,7 @@
<el-table-column prop="box_no" label="箱号" align="center" width="250px" show-overflow-tooltip /> <el-table-column prop="box_no" label="箱号" align="center" width="250px" show-overflow-tooltip />
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" /> <el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" />
<el-table-column prop="struct_code" label="仓位" align="center" show-overflow-tooltip /> <el-table-column prop="struct_code" label="仓位" align="center" show-overflow-tooltip />
<el-table-column prop="sect_name" label="区域" align="center" show-overflow-tooltip />
<!-- <el-table-column prop="next_point_code" label="目的位置" align="center" />--> <!-- <el-table-column prop="next_point_code" label="目的位置" align="center" />-->
<!-- <el-table-column prop="task_code" label="任务号" align="center" />--> <!-- <el-table-column prop="task_code" label="任务号" align="center" />-->
<!-- <el-table-column prop="task_type" label="任务类型" align="center" width="150px" :formatter="taskdtl_typeFormat" />--> <!-- <el-table-column prop="task_type" label="任务类型" align="center" width="150px" :formatter="taskdtl_typeFormat" />-->