更新
This commit is contained in:
@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.agv.server.AgvService;
|
|
||||||
import org.nl.acs.agv.server.NDCAgvService;
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||||
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
|
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.acs.ext.wms.statusEnum;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2023/3/15 4:33 下午
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum StatusEnum {
|
||||||
|
TASK_READY("0", "就绪", ""),
|
||||||
|
TASK_RUNNING("1", "执行中", "6"),
|
||||||
|
TASK_FINISH("2", "完成", "7"),
|
||||||
|
TASK_CANNEL("3", "取消", "8");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String desc;
|
||||||
|
private String ext;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.nl.acs.ext.wms.statusEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description: 工单枚举
|
||||||
|
* @Date: 2023/3/16
|
||||||
|
*/
|
||||||
|
public enum WorkerOrderEnum {
|
||||||
|
READY("就绪", "0", ""),
|
||||||
|
PRODUCTING("生产中", "1", "3"),
|
||||||
|
COMPLETE("完成", "2", "5"),
|
||||||
|
CANCEL("取消", "3", "3"),
|
||||||
|
STOP("暂停", "4", "4");
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private String mesCode;
|
||||||
|
|
||||||
|
WorkerOrderEnum(String name, String code, String mesCode) {
|
||||||
|
this.name = name;
|
||||||
|
this.code = code;
|
||||||
|
this.mesCode = mesCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMesCode() {
|
||||||
|
return mesCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,6 +86,8 @@ public interface InstructionService {
|
|||||||
*/
|
*/
|
||||||
Instruction findByTaskcode(String code);
|
Instruction findByTaskcode(String code);
|
||||||
|
|
||||||
|
Instruction findByTaskCodeFromCache(String taskCode);
|
||||||
|
|
||||||
Instruction findByTaskcodeAndStatus(String code);
|
Instruction findByTaskcodeAndStatus(String code);
|
||||||
|
|
||||||
Instruction findByTaskcodeAndStatus(String code,String status);
|
Instruction findByTaskcodeAndStatus(String code,String status);
|
||||||
|
|||||||
@@ -256,6 +256,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instruction findByTaskCodeFromCache(String taskCode) {
|
||||||
|
return Optional
|
||||||
|
.ofNullable(this.instructions)
|
||||||
|
.orElse(new ArrayList<>())
|
||||||
|
.stream()
|
||||||
|
.filter(i -> i.getTask_code().equals(taskCode))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskcodeAndStatus(String code) {
|
public Instruction findByTaskcodeAndStatus(String code) {
|
||||||
Iterator var3 = instructions.iterator();
|
Iterator var3 = instructions.iterator();
|
||||||
|
|||||||
@@ -53,6 +53,19 @@ public interface ProduceshiftorderService {
|
|||||||
*/
|
*/
|
||||||
ProduceshiftorderDto findByCode(String code);
|
ProduceshiftorderDto findByCode(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码从内存查询
|
||||||
|
* @param code code
|
||||||
|
* @return Produceshiftorder
|
||||||
|
*/
|
||||||
|
ProduceshiftorderDto findByCodeFromCache(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id从内存查询
|
||||||
|
* @param id id
|
||||||
|
* @return Produceshiftorder
|
||||||
|
*/
|
||||||
|
ProduceshiftorderDto findByIdFromCache(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
@@ -102,6 +115,8 @@ public interface ProduceshiftorderService {
|
|||||||
|
|
||||||
ProduceshiftorderDto findOrderByDeviceCode(String device_code);
|
ProduceshiftorderDto findOrderByDeviceCode(String device_code);
|
||||||
|
|
||||||
|
ProduceshiftorderDto findOrderByExtOrderId(String ext_order_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单同步
|
* 工单同步
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||||
import org.nl.acs.device.service.DeviceExtraService;
|
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
||||||
@@ -15,6 +13,7 @@ import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_stacking_statio
|
|||||||
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
@@ -33,6 +32,8 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
@@ -51,10 +52,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, ApplicationAutoInitial {
|
public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, ApplicationAutoInitial {
|
||||||
|
|
||||||
private final org.nl.acs.opc.DeviceAppService deviceAppService;
|
private final DeviceAppService deviceAppService;
|
||||||
private final DeviceExtraService deviceExtraService;
|
|
||||||
|
|
||||||
List<ProduceshiftorderDto> order = new ArrayList();
|
CopyOnWriteArrayList<ProduceshiftorderDto> order = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AcsToWmsService acsToWmsService;
|
AcsToWmsService acsToWmsService;
|
||||||
@@ -65,13 +65,16 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reload() {
|
public synchronized void reload() {
|
||||||
this.order = this.queryAll(" order_status !='2' and order_status !='3' and is_deleted =0");
|
this.order = (CopyOnWriteArrayList<ProduceshiftorderDto>) this.queryAll("order_status !='2' and order_status != '3' and is_deleted =0");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProduceshiftorderDto> queryAll(String whereJson) {
|
public List<ProduceshiftorderDto> queryAll(String whereJson) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONArray arr = wo.query(whereJson).getResultJSONArray(0);
|
JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||||
|
if (ObjectUtil.isEmpty(arr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<ProduceshiftorderDto> list = arr.toJavaList(ProduceshiftorderDto.class);
|
List<ProduceshiftorderDto> list = arr.toJavaList(ProduceshiftorderDto.class);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -87,7 +90,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
@Override
|
@Override
|
||||||
public List<ProduceshiftorderDto> queryAll(Map whereJson) {
|
public List<ProduceshiftorderDto> queryAll(Map whereJson) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
JSONArray arr = wo.query("is_deleted = '0'").getResultJSONArray(0);
|
||||||
|
if (ObjectUtil.isEmpty(arr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<ProduceshiftorderDto> list = arr.toJavaList(ProduceshiftorderDto.class);
|
List<ProduceshiftorderDto> list = arr.toJavaList(ProduceshiftorderDto.class);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -95,7 +101,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
@Override
|
@Override
|
||||||
public ProduceshiftorderDto findById(String order_id) {
|
public ProduceshiftorderDto findById(String order_id) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONObject json = wo.query("order_id ='" + order_id + "'").uniqueResult(0);
|
JSONObject json = wo.query("order_id ='" + order_id + "' and is_deleted = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
final ProduceshiftorderDto obj = (ProduceshiftorderDto) JSONObject.toJavaObject(json, ProduceshiftorderDto.class);
|
final ProduceshiftorderDto obj = (ProduceshiftorderDto) JSONObject.toJavaObject(json, ProduceshiftorderDto.class);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@@ -103,25 +112,39 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
@Override
|
@Override
|
||||||
public ProduceshiftorderDto findByCode(String code) {
|
public ProduceshiftorderDto findByCode(String code) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONObject json = wo.query("order_code ='" + code + "'").uniqueResult(0);
|
JSONObject json = wo.query("order_code ='" + code + "' and is_deleted = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
final ProduceshiftorderDto obj = (ProduceshiftorderDto) JSONObject.toJavaObject(json, ProduceshiftorderDto.class);
|
final ProduceshiftorderDto obj = (ProduceshiftorderDto) JSONObject.toJavaObject(json, ProduceshiftorderDto.class);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProduceshiftorderDto findByCodeFromCache(String code) {
|
||||||
|
return Optional.ofNullable(this.order).orElse(new CopyOnWriteArrayList<>()).stream().filter(o -> o.getOrder_code().equals(code)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProduceshiftorderDto findByIdFromCache(String id) {
|
||||||
|
return Optional.ofNullable(this.order).orElse(new CopyOnWriteArrayList<>()).stream().filter(o -> o.getOrder_id().equals(id)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(ProduceshiftorderDto dto) {
|
public void create(ProduceshiftorderDto dto) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
String now = DateUtil.now();
|
||||||
Device device = deviceAppService.findDeviceByCode(dto.getDevice_code());
|
Device device = deviceAppService.findDeviceByCode(dto.getDevice_code());
|
||||||
if (ObjectUtil.isEmpty(device)) {
|
if (ObjectUtil.isEmpty(device)) {
|
||||||
throw new BadRequestException("未找到对应设备:" + dto.getDevice_code());
|
throw new BadRequestException("未找到对应设备:" + dto.getDevice_code());
|
||||||
}
|
}
|
||||||
JSONArray resultJSONArray = wo.query("is_deleted = '0' and order_status in ('0', '1') and device_code = '" + dto.getDevice_code() + "'").getResultJSONArray(0);
|
//判断是否存在该设备未完成的工单信息
|
||||||
if (ObjectUtil.isNotEmpty(resultJSONArray)) {
|
ProduceshiftorderDto pdNow = this.findOrderByDeviceCode(dto.getDevice_code());
|
||||||
throw new BadRequestException("该设备已存在未完成工单,不能下发");
|
if (ObjectUtil.isNotEmpty(pdNow)) {
|
||||||
|
throw new BadRequestException("该设备已存在未完成工单,不能下发!");
|
||||||
}
|
}
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
|
||||||
String now = DateUtil.now();
|
|
||||||
dto.setOrder_id(IdUtil.simpleUUID());
|
dto.setOrder_id(IdUtil.simpleUUID());
|
||||||
if (StrUtil.isEmpty(dto.getOrder_code())) {
|
if (StrUtil.isEmpty(dto.getOrder_code())) {
|
||||||
String order_no = CodeUtil.getNewCode("ORDER_NO");
|
String order_no = CodeUtil.getNewCode("ORDER_NO");
|
||||||
@@ -131,11 +154,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
if (StrUtil.isEmpty(dto.getCreate_by())) {
|
if (StrUtil.isEmpty(dto.getCreate_by())) {
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_by(currentUsername);
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(dto.getUpdate_by())) {
|
|
||||||
dto.setUpdate_by(currentUsername);
|
|
||||||
}
|
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
dto.setUpdate_time(now);
|
|
||||||
String is_needmove = dto.getIs_needmove();
|
String is_needmove = dto.getIs_needmove();
|
||||||
|
|
||||||
//海亮专机
|
//海亮专机
|
||||||
@@ -151,24 +170,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
|
|
||||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||||
//专机下发工单信号:倒料数量(-99999) 当前产量清零(1) 订单生产总量 每箱接料数量 工单号
|
|
||||||
|
|
||||||
String extra_value = hailiangSpecialDeviceDriver.getExtraValue().get("one_qty").toString();
|
|
||||||
|
|
||||||
if (StrUtil.equals(is_needmove, "1")) {
|
|
||||||
if (ObjectUtil.isEmpty(extra_value)) {
|
|
||||||
throw new BadRequestException("满料框数量为空");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
extra_value = "99999";
|
|
||||||
}
|
|
||||||
if (!hailiangSpecialDeviceDriver.getItemProtocol().getIsonline()) {
|
if (!hailiangSpecialDeviceDriver.getItemProtocol().getIsonline()) {
|
||||||
throw new BadRequestException("设备未开机,开工失败!");
|
throw new BadRequestException("设备未开机,开工失败!");
|
||||||
}
|
}
|
||||||
dto.setOne_qty(BigDecimal.valueOf((Long.parseLong(extra_value))));
|
|
||||||
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
||||||
hailiangSpecialDeviceDriver.writing("to_order", dto.getOrder_code());
|
hailiangSpecialDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||||
hailiangSpecialDeviceDriver.writing("to_one_box_num", extra_value);
|
hailiangSpecialDeviceDriver.writing("to_one_box_num", String.valueOf(dto.getOne_qty()));
|
||||||
hailiangSpecialDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
hailiangSpecialDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
||||||
hailiangSpecialDeviceDriver.writing("to_out_num", "0");
|
hailiangSpecialDeviceDriver.writing("to_out_num", "0");
|
||||||
hailiangSpecialDeviceDriver.writing("to_pause", "0");
|
hailiangSpecialDeviceDriver.writing("to_pause", "0");
|
||||||
@@ -176,22 +183,13 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
|
|
||||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||||
String extra_value = hailiangEngravingMachineDeviceDriver.getExtraValue().get("one_qty").toString();
|
|
||||||
if (StrUtil.equals(is_needmove, "1")) {
|
|
||||||
if (ObjectUtil.isEmpty(extra_value)) {
|
|
||||||
throw new BadRequestException("满料框数量为空");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
extra_value = "99999";
|
|
||||||
}
|
|
||||||
dto.setOne_qty(BigDecimal.valueOf((Long.parseLong(extra_value))));
|
|
||||||
if (!hailiangEngravingMachineDeviceDriver.getItemProtocol().getIsonline()) {
|
if (!hailiangEngravingMachineDeviceDriver.getItemProtocol().getIsonline()) {
|
||||||
throw new BadRequestException("设备未开机,工单下发失败!");
|
throw new BadRequestException("设备未开机,工单下发失败!");
|
||||||
}
|
}
|
||||||
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
||||||
hailiangEngravingMachineDeviceDriver.writing("to_order", dto.getOrder_code());
|
hailiangEngravingMachineDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||||
hailiangEngravingMachineDeviceDriver.writing("to_one_box_num", extra_value);
|
hailiangEngravingMachineDeviceDriver.writing("to_one_box_num", String.valueOf(dto.getOne_qty()));
|
||||||
hailiangEngravingMachineDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
hailiangEngravingMachineDeviceDriver.writing("to_order_prod_num", String.valueOf(dto.getQty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||||
@@ -201,11 +199,14 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
}
|
}
|
||||||
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
||||||
hailiangPackerStationDeviceDriver.writing("to_order", dto.getOrder_code());
|
hailiangPackerStationDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||||
hailiangPackerStationDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
hailiangPackerStationDeviceDriver.writing("to_order_prod_num", String.valueOf(dto.getQty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
if (device.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) device.getDeviceDriver();
|
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) device.getDeviceDriver();
|
||||||
|
if (!hailiangSmartplcTestDeviceDriver.getItemProtocol().getIsonline()) {
|
||||||
|
throw new BadRequestException("设备未开机,工单下发失败");
|
||||||
|
}
|
||||||
hailiangSmartplcTestDeviceDriver.writing("to_clear", "1");
|
hailiangSmartplcTestDeviceDriver.writing("to_clear", "1");
|
||||||
hailiangSmartplcTestDeviceDriver.writing("to_task", dto.getOrder_code());
|
hailiangSmartplcTestDeviceDriver.writing("to_task", dto.getOrder_code());
|
||||||
hailiangSmartplcTestDeviceDriver.writing("to_qty", dto.getQty().toString());
|
hailiangSmartplcTestDeviceDriver.writing("to_qty", dto.getQty().toString());
|
||||||
@@ -254,15 +255,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
Iterator<ProduceshiftorderDto> iterator = order.iterator();
|
this.order.removeIf(o -> {
|
||||||
while (iterator.hasNext()) {
|
return o.getOrder_code().equals(dto.getOrder_code());
|
||||||
ProduceshiftorderDto instruction = iterator.next();
|
});
|
||||||
if (instruction.getOrder_code().equals(dto.getOrder_code())) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StrUtil.equals(dto.getOrder_status(), "0") || StrUtil.equals(dto.getOrder_status(), "1")) {
|
if (StrUtil.equals(dto.getOrder_status(), "0") || StrUtil.equals(dto.getOrder_status(), "1")) {
|
||||||
order.add(dto);
|
this.order.add(dto);
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(dto.getOrder_status(), "3")) {
|
if (StrUtil.equals(dto.getOrder_status(), "3")) {
|
||||||
WQLObject wo1 = WQLObject.getWQLObject("acs_deviceisonline");
|
WQLObject wo1 = WQLObject.getWQLObject("acs_deviceisonline");
|
||||||
@@ -357,13 +354,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||||
wo.update(json, "order_code = '" + dto.getOrder_code() + "'");
|
wo.update(json, "order_code = '" + dto.getOrder_code() + "'");
|
||||||
Iterator<ProduceshiftorderDto> iterator = order.iterator();
|
this.order.removeIf(o -> {
|
||||||
while (iterator.hasNext()) {
|
return o.getOrder_code().equals(dto.getOrder_code());
|
||||||
ProduceshiftorderDto oneorder = iterator.next();
|
});
|
||||||
if (oneorder.getOrder_code().equals(dto.getOrder_code())) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StrUtil.equals(dto.getOrder_status(), "0") || StrUtil.equals(dto.getOrder_status(), "1")) {
|
if (StrUtil.equals(dto.getOrder_status(), "0") || StrUtil.equals(dto.getOrder_status(), "1")) {
|
||||||
order.add(dto);
|
order.add(dto);
|
||||||
}
|
}
|
||||||
@@ -373,15 +366,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(String[] ids) {
|
public void deleteAll(String[] ids) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
|
String order_ids = Arrays.stream(Optional.ofNullable(ids).orElse(new String[0])).map(String::valueOf).collect(Collectors.joining(","));
|
||||||
|
wo.delete("order_id in '" + order_ids + "'");
|
||||||
for (String order_id : ids) {
|
for (String order_id : ids) {
|
||||||
wo.delete("order_id = '" + order_id + "'");
|
this.order.removeIf(o -> {
|
||||||
Iterator<ProduceshiftorderDto> iterator = order.iterator();
|
return o.getOrder_id().equals(order_id);
|
||||||
while (iterator.hasNext()) {
|
});
|
||||||
ProduceshiftorderDto instruction = iterator.next();
|
|
||||||
if (instruction.getOrder_id().equals(order_id)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,29 +500,36 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
map1.put("update_time", now);
|
map1.put("update_time", now);
|
||||||
WQLObject wo1 = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo1 = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
wo1.update(map1);
|
wo1.update(map1);
|
||||||
Iterator<ProduceshiftorderDto> iterator = order.iterator();
|
this.order.removeIf(o -> {
|
||||||
while (iterator.hasNext()) {
|
return o.getOrder_code().equals(order_code);
|
||||||
ProduceshiftorderDto instruction = iterator.next();
|
});
|
||||||
if (instruction.getOrder_code().equals(order_code)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProduceshiftorderDto> findAllOrderFromCache() {
|
public List<ProduceshiftorderDto> findAllOrderFromCache() {
|
||||||
return order;
|
return this.order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProduceshiftorderDto findOrderByDeviceCode(String device_code) {
|
public ProduceshiftorderDto findOrderByDeviceCode(String device_code) {
|
||||||
for (int i = 0; i < this.order.size(); i++) {
|
return Optional
|
||||||
ProduceshiftorderDto dto = order.get(i);
|
.ofNullable(this.order)
|
||||||
if (StrUtil.equals(device_code, dto.getDevice_code())) {
|
.orElse(new CopyOnWriteArrayList<>())
|
||||||
return dto;
|
.stream()
|
||||||
|
.filter(o -> o.getDevice_code().equals(device_code))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
@Override
|
||||||
|
public ProduceshiftorderDto findOrderByExtOrderId(String ext_order_id) {
|
||||||
|
return Optional
|
||||||
|
.ofNullable(this.order)
|
||||||
|
.orElse(new CopyOnWriteArrayList<>())
|
||||||
|
.stream()
|
||||||
|
.filter(o -> o.getExt_order_id().equals(ext_order_id))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ public class TaskDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 是否立刻下发
|
* 是否立刻下发
|
||||||
*/
|
*/
|
||||||
private String is_send;
|
private String is_send = "0";
|
||||||
|
|
||||||
private String material;
|
private String material;
|
||||||
private String quantity;
|
private String quantity;
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ public class TaskDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 任务优先级
|
* 任务优先级
|
||||||
*/
|
*/
|
||||||
private String priority;
|
private String priority = "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建类型
|
* 创建类型
|
||||||
@@ -225,12 +226,12 @@ public class TaskDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 是否启用
|
* 是否启用
|
||||||
*/
|
*/
|
||||||
private String is_active;
|
private String is_active = "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否删除
|
* 是否删除
|
||||||
*/
|
*/
|
||||||
private String is_delete;
|
private String is_delete = "0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
|
|||||||
@@ -71,16 +71,26 @@ import java.util.stream.Collectors;
|
|||||||
public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||||
List<TaskDto> tasks = new CopyOnWriteArrayList<>();
|
List<TaskDto> tasks = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
@Autowired DeviceAppService deviceAppService;
|
@Autowired
|
||||||
@Autowired RouteLineService routelineserver;
|
DeviceAppService deviceAppService;
|
||||||
@Autowired AcsToWmsService acstowmsService;
|
@Autowired
|
||||||
@Autowired TaskFeedbackService taskFeedbackService;
|
RouteLineService routelineserver;
|
||||||
@Autowired ParamService paramService;
|
@Autowired
|
||||||
@Autowired XianGongAgvService agvService;
|
AcsToWmsService acstowmsService;
|
||||||
@Autowired RouteLineService routeLineService;
|
@Autowired
|
||||||
@Autowired DeviceAssignedService deviceAssignedService;
|
TaskFeedbackService taskFeedbackService;
|
||||||
@Autowired InstructionService instructionService;
|
@Autowired
|
||||||
@Autowired StorageCellService storageCellService;
|
ParamService paramService;
|
||||||
|
@Autowired
|
||||||
|
XianGongAgvService agvService;
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routeLineService;
|
||||||
|
@Autowired
|
||||||
|
DeviceAssignedService deviceAssignedService;
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService;
|
||||||
|
@Autowired
|
||||||
|
StorageCellService storageCellService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void autoInitial() throws Exception {
|
public void autoInitial() throws Exception {
|
||||||
@@ -278,16 +288,22 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskDto findByTaskCode(String task_code) {
|
public TaskDto findByTaskCode(String task_code) {
|
||||||
|
return Optional
|
||||||
List<TaskDto> list = new ArrayList<>();
|
.ofNullable(this.tasks)
|
||||||
Iterator<TaskDto> iterator = tasks.iterator();
|
.orElse(new ArrayList<>())
|
||||||
while (iterator.hasNext()) {
|
.stream()
|
||||||
TaskDto task = iterator.next();
|
.filter(t -> t.getTask_code().equals(task_code))
|
||||||
if (StrUtil.equals(task.getTask_code(),task_code)) {
|
.findFirst()
|
||||||
return task;
|
.orElse(null);
|
||||||
}
|
// List<TaskDto> list = new ArrayList<>();
|
||||||
}
|
// Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
return null;
|
// while (iterator.hasNext()) {
|
||||||
|
// TaskDto task = iterator.next();
|
||||||
|
// if (StrUtil.equals(task.getTask_code(), task_code)) {
|
||||||
|
// return task;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,8 +385,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
list.add(task);
|
list.add(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code()))
|
if (StrUtil.equals(task.getTask_type(), "8") && StrUtil.isNotEmpty(task.getPut_device_code())) {
|
||||||
{
|
|
||||||
// if(task.getNext_device_code().equals(device_code)
|
// if(task.getNext_device_code().equals(device_code)
|
||||||
// && StrUtil.equals(task.getTask_status(), "1")){
|
// && StrUtil.equals(task.getTask_status(), "1")){
|
||||||
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||||
@@ -499,9 +514,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
dto.setMaterial(startdevice.getMaterial_type());
|
dto.setMaterial(startdevice.getMaterial_type());
|
||||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||||
// 判断起点为输送设备
|
// 判断起点为输送设备
|
||||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {}
|
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||||
|
}
|
||||||
|
|
||||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {}
|
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 判断起点为输送设备
|
// 判断起点为输送设备
|
||||||
|
|
||||||
@@ -1205,7 +1222,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTaskByClick(JSONObject json) {}
|
public void createTaskByClick(JSONObject json) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkAllowCreate(String devicecode) {
|
public int checkAllowCreate(String devicecode) {
|
||||||
@@ -1237,28 +1255,42 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TaskDto findByContainer(String container_code) {
|
public TaskDto findByContainer(String container_code) {
|
||||||
Iterator var3 = tasks.iterator();
|
return Optional
|
||||||
|
.ofNullable(this.tasks)
|
||||||
while (var3.hasNext()) {
|
.orElse(new ArrayList<>())
|
||||||
TaskDto task = (TaskDto) var3.next();
|
.stream()
|
||||||
if (StrUtil.equals(task.getVehicle_code(), container_code)) {
|
.filter(t -> t.getVehicle_code().equals(container_code))
|
||||||
return task;
|
.findFirst()
|
||||||
}
|
.orElse(null);
|
||||||
}
|
// Iterator var3 = tasks.iterator();
|
||||||
|
//
|
||||||
return null;
|
// while (var3.hasNext()) {
|
||||||
|
// TaskDto task = (TaskDto) var3.next();
|
||||||
|
// if (StrUtil.equals(task.getVehicle_code(), container_code)) {
|
||||||
|
// return task;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskDto findByCodeFromCache(String task_code) {
|
public TaskDto findByCodeFromCache(String task_code) {
|
||||||
Iterator var3 = tasks.iterator();
|
return Optional
|
||||||
|
.ofNullable(this.tasks)
|
||||||
while (var3.hasNext()) {
|
.orElse(new ArrayList<>())
|
||||||
TaskDto task = (TaskDto) var3.next();
|
.stream()
|
||||||
if (StrUtil.equals(task.getTask_code(), task_code)) {
|
.filter(t -> t.getTask_code().equals(task_code))
|
||||||
return task;
|
.findFirst()
|
||||||
}
|
.orElse(null);
|
||||||
}
|
// Iterator var3 = tasks.iterator();
|
||||||
return null;
|
//
|
||||||
|
// while (var3.hasNext()) {
|
||||||
|
// TaskDto task = (TaskDto) var3.next();
|
||||||
|
// if (StrUtil.equals(task.getTask_code(), task_code)) {
|
||||||
|
// return task;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user