diff --git a/nladmin-system/src/main/java/org/nl/AppRun.java b/nladmin-system/src/main/java/org/nl/AppRun.java index b2eada2..948a623 100644 --- a/nladmin-system/src/main/java/org/nl/AppRun.java +++ b/nladmin-system/src/main/java/org/nl/AppRun.java @@ -50,7 +50,6 @@ public class AppRun implements CommandLineRunner { @Override public void run(String... args) throws Exception { - System.out.println(111); } @Bean diff --git a/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 30c1e38..e6dabe5 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -14,7 +14,7 @@ public enum DriverTypeEnum { HAILIANG_FEEDING(2, "hailiang_feeding", "海亮包装项目-上料线体", "conveyor"), - HAILIANG_LEETERING(3, "hailiang_lettering", "海亮包装项目-刻字线体", "conveyor"), + HAILIANG_LETTERING(3, "hailiang_lettering", "海亮包装项目-刻字线体", "conveyor"), HAILIANG_RISKING(4, "hailiang_risking", "海亮包装项目-套冒线体", "conveyor"), diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java index 04b54af..845ac5e 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java @@ -12,8 +12,51 @@ public class ItemProtocol { public static String item_mode = "mode"; public static String item_action = "action"; public static String item_error = "error"; - public static String item_to_command = "to_command"; + public static String item_order = "order"; + public static String item_order_detail = "order_detail"; + public static String item_last_order_detail = "last_order_detail"; + //当前工单上料数量 + public static String item_order_feeding_qty = "order_feeding_qty"; + //当前工单明细号上料数量 + public static String item_detail_feeding_qty = "detail_feeding_qty"; + //当前工单明细顺序号刻字数量 + public static String item_detail_lettering_qty = "detail_lettering_qty"; + //当前工单明细顺序号刻字合格数量 + public static String item_detail_lettering_qualified_qty = "detail_lettering_qualified_qty"; + //当前工单明细号套冒合格数 + public static String item_detail_risking_qualified_qty = "detail_risking_qualified_qty"; + //当前工单明细号套冒数 + public static String item_detail_risking_qty = "detail_risking_qty"; + //当前工单明细号捆扎数 + public static String item_detail_strapping_qty = "detail_strapping_qty"; + //当前工单明细号捆扎根数 + public static String item_detail_strapping_oneqty = "detail_strapping_oneqty"; + //当前工单明细号裹膜数 + public static String item_detail_coating_qty = "detail_coating_qty"; + //当前贴标工单明细号 + public static String item_labeling_order = "labeling_order"; + //当前贴标工单明细号贴标合格数 + public static String item_detail_rlabeling_qualified_qty = "detail_rlabeling_qualified_qty"; + //当前贴标工单明细号贴标数 + public static String item_detail_rlabeling_qty = "detail_rlabeling_qty"; + + public static String item_to_command = "to_command"; + public static String item_to_order = "to_order"; + public static String item_to_order_detail = "to_order_detail"; + public static String item_to_order_feeding_qty = "to_order_feeding_qty"; + public static String item_to_detail_feeding_qty = "to_detail_feeding_qty"; + public static String item_to_outer_diameter = "to_outer_diameter"; + public static String item_to_wall_thickness = "to_wall thickness"; + public static String item_to_length = "to_length"; + public static String item_to_is_last = "to_is_last"; + public static String item_to_strapping_qty = "to_strapping_qty"; + public static String item_to_one_strapping_qty = "to_one_strapping_qty"; + public static String item_to_lastone_strapping_qty = "to_lastone_strapping_qty"; + public static String item_to_coating_qty = "to_coating_qty"; + public static String item_to_labeling_qty = "to_labeling_qty"; + public static String item_to_stop = "to_stop"; + public static String item_to_force_complete = "to_force_complete"; private HaiLiangFeedingTrunkDeviceDriver driver; @@ -55,16 +98,46 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_action, "动作信号", "DB51.B2")); - list.add(new ItemDto(item_error, "报警信号", "DB51.B4")); + list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB600.B2", Boolean.valueOf(true))); + list.add(new ItemDto(item_error, "故障信号", "DB600.B3")); + list.add(new ItemDto(item_order, "当前执行工单号", "DB600.D4")); + list.add(new ItemDto(item_order_detail, "当前工单明细号", "DB600.D8")); + list.add(new ItemDto(item_last_order_detail, "上次完成工单明细号", "DB600.D12")); + list.add(new ItemDto(item_order_feeding_qty, "当前工单上料数量", "DB600.D16")); + list.add(new ItemDto(item_detail_feeding_qty, "当前工单明细号上料数量", "DB600.D20")); + list.add(new ItemDto(item_detail_lettering_qty, "当前工单明细号刻字数量", "DB600.D24")); + list.add(new ItemDto(item_detail_lettering_qualified_qty, "当前工单明细号刻字合格数量", "DB600.D28")); + list.add(new ItemDto(item_detail_risking_qualified_qty, "当前工单明细号套冒合格数", "DB600.D32")); + list.add(new ItemDto(item_detail_risking_qty, "当前工单明细号套冒数", "DB600.D36")); + list.add(new ItemDto(item_detail_strapping_qty, "当前工单明细号捆扎包数", "DB600.D40")); + list.add(new ItemDto(item_detail_strapping_oneqty, "当前工单明细号捆扎根数", "DB600.D44")); + list.add(new ItemDto(item_detail_coating_qty, "当前工单明细号裹膜数", "DB600.D48")); + list.add(new ItemDto(item_labeling_order, "当前贴标工单明细号", "DB600.D52")); + list.add(new ItemDto(item_detail_rlabeling_qualified_qty, "当前工单明细号刻字数量", "DB600.D56")); + list.add(new ItemDto(item_detail_rlabeling_qty, "当前贴标工单明细号贴标数", "DB600.D60")); + return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB52.W2", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_order, "工单号", "DB600.D2")); + list.add(new ItemDto(item_to_order_detail, "工单明细号", "DB600.D6")); + list.add(new ItemDto(item_to_order_feeding_qty, "工单上料总数量", "DB600.D10")); + list.add(new ItemDto(item_to_detail_feeding_qty, "工单明细号上料数量", "DB600.D14")); + list.add(new ItemDto(item_to_outer_diameter, "外径", "DB600.REAL18")); + list.add(new ItemDto(item_to_wall_thickness, "壁厚", "DB600.REAL22")); + list.add(new ItemDto(item_to_length, "长度", "DB600.REAL26")); + list.add(new ItemDto(item_to_is_last, "是否最后工单明细号", "DB600.D30")); + list.add(new ItemDto(item_to_strapping_qty, "总捆扎包数", "DB600.D34")); + list.add(new ItemDto(item_to_one_strapping_qty, "标准每捆数量", "DB600.D38")); + list.add(new ItemDto(item_to_lastone_strapping_qty, "捆扎尾料数量", "DB600.D42")); + list.add(new ItemDto(item_to_coating_qty, "需要裹膜捆数", "DB600.D42")); + list.add(new ItemDto(item_to_labeling_qty, "需要贴标数量", "DB600.D46")); + list.add(new ItemDto(item_to_stop, "急停", "DB600.D50")); + list.add(new ItemDto(item_to_force_complete, "工单强制完成", "DB600.D54")); + list.add(new ItemDto(item_to_command, "作业命令", "DB52.D62", Boolean.valueOf(true))); return list; } diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java index c37c5fa..74378ec 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java @@ -1,19 +1,21 @@ package org.nl.acs.device_driver.hailiang.hailiang_lettering; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.DeviceDriverDefination; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceType; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** - * 海亮刻字线体 + * 海亮贴标线体 */ @Service -public class HaiLiangLetteringDefination implements DeviceDriverDefination { +public class HaiLiangLetteringDefination implements OpcDeviceDriverDefination { @Override public String getDriverCode() { return "hailiang_lettering"; @@ -47,4 +49,22 @@ public class HaiLiangLetteringDefination implements DeviceDriverDefination { return types; } + @Override + public List getReadableItemDtos() { + return getReadableItemDtos2(); + } + + public static List getReadableItemDtos2() { + List list = new ArrayList(); + list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "V100.1", true)); + list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "V100.0")); + list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VB101")); + return list; + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + } diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java index 1eac059..4790af2 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java @@ -4,31 +4,27 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.utils.SpringContextHolder; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; - +import org.nl.acs.opc.Device; /** - * + * 海亮贴标线体 */ @Slf4j @Data @RequiredArgsConstructor -public class HaiLiangLetteringDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { +public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + @Override + public Device getDevice() { + return this.device; + } @Override public void execute() { } - } - diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java index b717d6d..75f02b5 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java @@ -2,7 +2,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_lettering; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.hailiang.hailiang_labeling.HaiLiangLabelingDeviceDriver; import java.util.ArrayList; import java.util.List; @@ -15,9 +14,9 @@ public class ItemProtocol { public static String item_to_command = "to_command"; - private HaiLiangLabelingDeviceDriver driver; + private HaiLiangLetteringDeviceDriver driver; - public ItemProtocol(HaiLiangLabelingDeviceDriver driver) { + public ItemProtocol(HaiLiangLetteringDeviceDriver driver) { this.driver = driver; } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java index 251d53b..1cd42e4 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java @@ -3,6 +3,8 @@ package org.nl.acs.order.service; import com.alibaba.fastjson.JSONArray; import org.nl.acs.order.service.dto.ProduceshiftorderDto; +import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto; +import org.nl.acs.task.service.dto.TaskDto; import org.springframework.data.domain.Pageable; import javax.servlet.http.HttpServletResponse; @@ -34,6 +36,26 @@ public interface ProduceshiftorderService { */ List queryAll(Map whereJson); + + + + /** + * 查询所有未完成工单 + * + * @param whereJson 条件参数 + * @return List + */ + List queryAllOrder(String whereJson); + + /** + * 查询所有未完成工单明细 + * + * @param whereJson 条件参数 + * @return List + */ + List queryAllOrderDteail(String whereJson); + + /** * 根据ID查询 * diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index c531aa5..a2fda15 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -14,8 +14,10 @@ import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.dto.CustomerbaseDto; import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.exception.BadRequestException; import org.nl.modules.system.util.CodeUtil; +import org.nl.start.auto.initial.ApplicationAutoInitial; import org.nl.utils.SecurityUtils; import org.nl.wql.WQL; import org.nl.wql.core.bean.ResultBean; @@ -31,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,10 +46,24 @@ import java.util.Map; @Service @RequiredArgsConstructor @Slf4j -public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { +public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, ApplicationAutoInitial { + + List order = new ArrayList(); + + List detail = new ArrayList(); private final MongoTemplate mongoTemplate; + @Override + public void autoInitial() throws Exception { + this.reload(); + } + + public synchronized void reload() { + this.order = this.queryAllOrder("order_status <2 and is_delete =0"); + this.detail = this.queryAllOrderDteail("order_detail_status <2 and is_delete =0"); + } + @Override public Map queryAll(Map whereJson, Pageable page) { WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); @@ -96,6 +113,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { return null; } + + @Override + public List queryAllOrder(String whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); + JSONArray arr = wo.query(whereJson).getResultJSONArray(0); + List list = arr.toJavaList(ProduceshiftorderDto.class); + return list; + } + + @Override + public List queryAllOrderDteail(String whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorderdetail"); + JSONArray arr = wo.query(whereJson).getResultJSONArray(0); + List list = arr.toJavaList(ProduceshiftorderdetailDto.class); + return list; + } + + @Override public ProduceshiftorderDto findById(String order_id) { WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); @@ -231,4 +266,5 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { JSONArray arr = wo.query("order_id = '"+order_id+"'").getResultJSONArray(0); return arr; } + } \ No newline at end of file diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls b/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls index 1c40ed3..7518a0d 100644 Binary files a/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls and b/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls differ