瀏覽代碼

每周一执行一次删除环境监测数据

oyq28 1 年之前
父節點
當前提交
2dab16215b

文件差異過大導致無法顯示
+ 0 - 1819
doc/20240314092229.sql


文件差異過大導致無法顯示
+ 41 - 27
doc/20240325100940.sql


+ 27 - 0
src/main/java/com/imcs/admin/business/config/JposPrinterDemo.java

@@ -0,0 +1,27 @@
+package com.imcs.admin.business.config;// usage instructions
+// 1. compile from command line - javac -encoding utf-8 -classpath JposPrinterSDK.jar JposPrinterDemo.java
+// 2. execute from command line - java -classpath .;JposPrinterSDK.jar JposPrinterDemo
+
+import net.jposprinter.Sdk;
+import java.nio.charset.Charset;
+
+public class JposPrinterDemo {
+	private static final String demo="JPOSPrinterSDK version 1.1R - 2023-4C6565\n";
+	public void runTest(String[] args) {
+		System.out.println("JposPrinterDemo Start ...");
+		Sdk sdk =new Sdk();
+		sdk.pioOpen("usb","",3000);//usb
+		//sdk.pioOpen("com1","9600",3000);//com1 ,9600/19200/38400/115200
+		//sdk.pioOpen("tcp:192.168.123.100","",3000);//tcp:192.168.123.100
+		sdk.twobarCodes(demo, Charset.defaultCharset());
+		sdk.pioWritePort(demo.getBytes());
+		sdk.pioWritePort("\n\n\n\n\n\n".getBytes());
+		sdk.selectCutPagerModerAndCutPager(0);
+		sdk.pioClose();
+		System.out.println("JposPrinterDemo finished.");
+	}
+
+	public static void main(String[] args) {
+		new JposPrinterDemo().runTest(args);
+	}
+}

+ 7 - 0
src/main/java/com/imcs/admin/business/controller/BusinessController.java

@@ -169,4 +169,11 @@ public class BusinessController {
         businessService.updateSales(id);
         return Result.success();
     }
+
+    @GetMapping("/printer/{workCode}")
+    public Result printer(@PathVariable("workCode") String workCode){
+        businessService.printer(workCode);
+        return Result.success();
+    }
+
 }

+ 2 - 0
src/main/java/com/imcs/admin/business/service/BusinessService.java

@@ -33,4 +33,6 @@ public interface BusinessService {
     void updateSales(Long id);
 
     void updateProcessProcedure(Long id);
+
+    void printer(String workCode);
 }

+ 26 - 0
src/main/java/com/imcs/admin/business/service/impl/BusinessServiceImpl.java

@@ -10,13 +10,16 @@ import com.imcs.admin.common.config.SessionContext;
 import com.imcs.admin.db.service.JdbcDao;
 import com.imcs.admin.db.service.JdbcService;
 import com.imcs.admin.util.GenerateSerial;
+import net.jposprinter.Sdk;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.nio.charset.Charset;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -43,6 +46,14 @@ public class BusinessServiceImpl implements BusinessService{
         serialMap.put(5,"aProductionDesignPreparationTask05");
     }
 
+    /**
+     * 每周一执行一次删除环境监测数据
+     */
+    @Scheduled(cron = "0 0 0 ? * MON")
+    public void deleteEnvironment(){
+        jdbcService.delete("delete from a_environment");
+    }
+
 
     @Override
     public void salesProductionOrder(Long id) {
@@ -465,6 +476,21 @@ public class BusinessServiceImpl implements BusinessService{
                 "production_order_code in (select production_order_code from a_production_order where product_id = (select parent_id from a_process_version where id=? and status=1 ))",id);
     }
 
+    @Override
+    public void printer(String workCode) {
+        System.out.println("JposPrinterDemo Start ...");
+        Sdk sdk =new Sdk();
+        sdk.pioOpen("usb","",3000);//usb
+        //sdk.pioOpen("com1","9600",3000);//com1 ,9600/19200/38400/115200
+        //sdk.pioOpen("tcp:192.168.123.100","",3000);//tcp:192.168.123.100
+        sdk.twobarCodes(workCode, Charset.defaultCharset());
+        sdk.pioWritePort(workCode.getBytes());
+        sdk.pioWritePort("\n\n\n\n\n\n".getBytes());
+        sdk.selectCutPagerModerAndCutPager(0);
+        sdk.pioClose();
+        System.out.println("JposPrinterDemo finished.");
+    }
+
     /**
      * 销售订单id
      * @param id

+ 4 - 4
src/main/java/com/imcs/admin/common/collection/DeviceCollectionTaskJob.java

@@ -57,7 +57,7 @@ public class DeviceCollectionTaskJob {
      * 设备采集任务FANUC
      * FANUC
      */
-   //@Scheduled(cron = "0/10 * * * * *")
+   @Scheduled(cron = "0/10 * * * * *")
     void deviceCollectionTaskFanuc() throws Exception {
        try{
            Object fanucObj = this.redisGet("FANUC_COLLECTION");
@@ -73,7 +73,7 @@ public class DeviceCollectionTaskJob {
      * 设备采集任务Opcua
      * 西门子
      */
-    //@Scheduled(cron = "0/10 * * * * *")
+    @Scheduled(cron = "0/10 * * * * *")
     void deviceCollectionTaskOpcua() throws Exception {
         try{
             Object opcuaObj = this.redisGet("OPCUA_COLLECTION");
@@ -89,7 +89,7 @@ public class DeviceCollectionTaskJob {
      * 设备采集任务Heidenhain
      * 海德汉
      */
-    //@Scheduled(cron = "0/10 * * * * *")
+    @Scheduled(cron = "0/10 * * * * *")
     void deviceCollectionTaskHeidenhain() throws Exception {
         try{
             Object heidenhainObj = this.redisGet("HEIDENHAIN_COLLECTION");
@@ -105,7 +105,7 @@ public class DeviceCollectionTaskJob {
      * 设备采集任务Mitsubishi
      * 三菱
      */
-    //@Scheduled(cron = "0/10 * * * * *")
+    @Scheduled(cron = "0/10 * * * * *")
     void deviceCollectionTaskMitsubishi() throws Exception {
         try{
             Object mitsubishiObj = this.redisGet("MITSUBISHI_COLLECTION");

部分文件因文件數量過多而無法顯示