From 689b8c3b733fd30a72b4d76cb91f78e350f9d83b Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期五, 14 二月 2025 17:26:28 +0800
Subject: [PATCH] 修改报工接口,提交完工和次破分别调用不同的接口
---
hangzhoumesParent/gateway/src/main/resources/application.yml | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java | 21 ++++--
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml | 2
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml | 6 +-
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java | 8 +-
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml | 6 +-
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application.yml | 2
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-dev.yml | 12 +++
hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml | 2
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java | 48 ++++++++++-----
hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application-dev.yml | 10 +++
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml | 12 +++
hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml | 16 ++++-
14 files changed, 107 insertions(+), 42 deletions(-)
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java
index bf90f72..6522037 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java
@@ -10,7 +10,7 @@
/**
* <p>
- * 鏈嶅姟绫�
+ * 鏈嶅姟绫�
* </p>
*
* @author wu
@@ -28,12 +28,14 @@
/**
* 鎸夌収鐜荤拑id淇℃伅鑷姩鎶ュ伐
+ *
* @param glassId
* @param deviceId
* @param workingProcedure
* @param remark
*/
- void autoSubmitReport(String glassId, int deviceId,String workingProcedure,String remark,int type);
+ void autoSubmitReport(String glassId, int deviceId, String workingProcedure, String remark, int type);
+
/**
* 鍗曚釜鐮存崯
*
@@ -54,5 +56,5 @@
void deleteByGlassId(String glassId);
- Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails);
+ Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails, Boolean type);
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java
index 61f6836..4550d65 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java
@@ -55,7 +55,8 @@
WorkAssignmentMapper workAssignmentMapper;
- private final static String ERP_URL = "http://192.168.2.100:8086";
+ private final static String ERP_URL = "http://192.168.2.100:8086";
+// private final static String ERP_URL = "http://10.153.19.174:8086";
/**
@@ -98,9 +99,9 @@
reportingWork.setProductionId(damages.get(0).getProcessId().substring(0, 11));
reportingWork.setProcessId(damages.get(0).getProcessId() + "/" + damages.get(0).getTechnologyNumber());
// reportingWork.setDeviceName(damages.get(0).getDeviceName());
- if (StringUtils.isBlank(damages.get(0).getDeviceName())){
+ if (StringUtils.isBlank(damages.get(0).getDeviceName())) {
reportingWork.setDeviceName("auto");
- }else{
+ } else {
reportingWork.setDeviceName(damages.get(0).getDeviceName());
}
reportingWork.setThisProcess(damages.get(0).getWorkingProcedure());
@@ -144,7 +145,7 @@
}
reportingWorkDetails.add(reportingWorkDetail);
reportingWorkDetail.setDamageDetailsList(damageDetailses);
- sendToERP(reportingWork, reportingWorkDetails);
+ sendToERP(reportingWork, reportingWorkDetails, Boolean.FALSE);
}
}
@@ -154,9 +155,9 @@
reportingWork.setOrderId(damage.getProcessId().substring(0, 10));
reportingWork.setProductionId(damage.getProcessId().substring(0, 11));
reportingWork.setProcessId(damage.getProcessId() + "/" + damage.getTechnologyNumber());
- if (StringUtils.isBlank(damage.getDeviceName())){
+ if (StringUtils.isBlank(damage.getDeviceName())) {
reportingWork.setDeviceName("auto");
- }else{
+ } else {
reportingWork.setDeviceName(damage.getDeviceName());
}
reportingWork.setThisProcess(damage.getWorkingProcedure());
@@ -174,7 +175,7 @@
reportingWorkDetail.setCompletedQuantity(1);
reportingWorkDetail.setBreakageQuantity(0);
reportingWorkDetails.add(reportingWorkDetail);
- return sendToERP(reportingWork, reportingWorkDetails);
+ return sendToERP(reportingWork, reportingWorkDetails, Boolean.TRUE);
}
@Override
@@ -312,12 +313,20 @@
}
@Override
- public Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails) {
+ public Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails, Boolean type) {
log.info("鎶ュ伐鏁版嵁reportingWork锛歿}锛宺eportingWorkDetails锛歿}", reportingWork, reportingWorkDetails);
try {
// 鐩爣绯荤粺鐨凙PI URL
-// String url = ERP_URL + "/reportingWork/mesReportingWork";
- String url = ERP_URL + "/reportingWork/mesSaveReportingWorkWorn";
+
+
+ String url1 = ERP_URL + "/reportingWork/mesReportingWork";
+ String url2 = ERP_URL + "/reportingWork/mesSaveReportingWorkWorn";
+ String url;
+ if (type) {
+ url = url1;
+ } else {
+ url = url2;
+ }
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
@@ -333,19 +342,26 @@
ObjectMapper objectMapper = new ObjectMapper();
// 灏� ReportingWork 杞崲涓� JSONObject
+
+ // 灏� ReportingWorkDetail 鍒楄〃杞崲涓� JSONArray
+
+ if (type) {
+ JSONObject detailsJsonObject = new JSONObject(objectMapper.writeValueAsString(reportingWorkDetails.get(0)));
+ result.put("detail", detailsJsonObject);
+ reportingWork.setProcessId(reportingWork.getProcessId().substring(0, 14));
+ } else {
+ JSONArray detailsJsonArray = new JSONArray(objectMapper.writeValueAsString(reportingWorkDetails));
+ result.put("detail", detailsJsonArray);
+ }
JSONObject reportingWorkJson = new JSONObject(objectMapper.writeValueAsString(reportingWork));
reportingWorkJson.put("reportingWorkTime", reportingWork.getReportingWorkTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
- // 灏� ReportingWorkDetail 鍒楄〃杞崲涓� JSONArray
- JSONArray detailsJsonArray = new JSONArray(objectMapper.writeValueAsString(reportingWorkDetails));
-
// 灏� JSON 瀵硅薄鍜屾暟缁勬坊鍔犲埌缁撴灉瀵硅薄涓�
result.put("title", reportingWorkJson);
- result.put("detail", detailsJsonArray);
+
result.put("type", 0);
result.put("userId", "admin");
result.put("userName", "admin");
result.put("qualityInsStatus", 0);
-
// 灏� result 瀵硅薄杞崲涓哄瓧绗︿覆
String jsonInputString = result.toString();
System.out.println("jsonInputString : " + result);
@@ -372,7 +388,7 @@
// 鎻愬彇 code 鍜� message
int code = jsonResponse.getInt("code");
String message = jsonResponse.getStr("data");
- log.info("鎶ュ伐澶辫触锛歿},{}", code, message);
+ log.info("鎶ュ伐鎯呭喌锛歿},{}", code, message);
if (code == 200 && message.equals("true")) {
return true;
} else {
diff --git a/hangzhoumesParent/gateway/src/main/resources/application.yml b/hangzhoumesParent/gateway/src/main/resources/application.yml
index c7444bf..6cecd95 100644
--- a/hangzhoumesParent/gateway/src/main/resources/application.yml
+++ b/hangzhoumesParent/gateway/src/main/resources/application.yml
@@ -6,7 +6,7 @@
cloud:
nacos:
discovery:
- server-addr: 127.0.0.1:8849
+ server-addr: 127.0.0.1:8848
gateway:
discovery:
locator:
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
index 63ac861..4ad0595 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -3,7 +3,7 @@
spring:
profiles:
- active: prod
+ active: dev
application:
name: cacheGlass
liquibase:
@@ -15,8 +15,8 @@
thread-name-prefix: task-cache
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# configuration:
+# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mes:
threshold: 3
ratio: 10
@@ -37,4 +37,14 @@
cellLength: 2500
sequence:
order: false
+kangaroohy:
+ milo:
+ enabled: true
+ primary: default
+ config:
+ default:
+ endpoint: opc.tcp://10.153.19.150:49320
+ security-policy: basic256sha256
+ username: admin
+ password: 1qaz2wsx3edc4rfv
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml
index c0bcd39..b6f1e94 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml
@@ -30,7 +30,7 @@
password: 123456
kangaroohy:
milo:
- enabled: true
+ enabled: false
primary: default
config:
default:
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
index 9d2c396..3e4adc4 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -3,7 +3,7 @@
spring:
profiles:
- active: prod
+ active: dev
application:
name: cacheVerticalGlass
liquibase:
@@ -15,8 +15,8 @@
thread-name-prefix: task-cacheVertical
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# configuration:
+# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mes:
sequence:
order: true
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
index bd6e1b0..62af15a 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
@@ -144,6 +144,8 @@
}
+
+
@Test
public void computeTargetByLine() {
plcStorageCageTask.computeTargetByLine(2001);
@@ -172,13 +174,18 @@
@Test
public void insertDamage() {
- Damage damage=new Damage();
- damage.setGlassId("P24060403|3|6");
- damage.setLine(2001);
- damage.setWorkingProcedure("鍐峰姞宸�");
- damage.setRemark("");
- damage.setStatus(2);
- damageService.insertDamage(damage);
+// Damage damage=new Damage();
+// damage.setGlassId("P24060403|3|6");
+// damage.setLine(2001);
+// damage.setWorkingProcedure("鍐峰姞宸�");
+// damage.setRemark("");
+// damage.setStatus(2);
+// damageService.insertDamage(damage);
+ Damage damage=damageService.getOne(
+ new LambdaQueryWrapper<Damage>()
+ .eq(Damage::getGlassId,"P24082703|1|80")
+ );
+ damageService.submitReport(damage);
}
@Test
diff --git a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application-dev.yml b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application-dev.yml
index 21ea914..25a2304 100644
--- a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application-dev.yml
+++ b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application-dev.yml
@@ -26,3 +26,13 @@
host: 127.0.0.1
port: 6379
password: 123456
+kangaroohy:
+ milo:
+ enabled: true
+ primary: default
+ config:
+ default:
+ endpoint: opc.tcp://10.153.19.150:49320
+ security-policy: basic256sha256
+ username: admin
+ password: 1qaz2wsx3edc4rfv
diff --git a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml
index 7756b17..35b5a0d 100644
--- a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/application.yml
@@ -3,7 +3,7 @@
spring:
profiles:
- active: prod
+ active: dev
application:
name: glassStorage
liquibase:
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
index 3f64913..50e65c8 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
@@ -30,4 +30,14 @@
database: 0
host: 127.0.0.1
port: 6379
- password: 123456
\ No newline at end of file
+ password: 123456
+kangaroohy:
+ milo:
+ enabled: true
+ primary: default
+ config:
+ default:
+ endpoint: opc.tcp://10.153.19.150:49320
+ security-policy: basic256sha256
+ username: admin
+ password: 1qaz2wsx3edc4rfv
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
index cb287d3..3352a84 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -2,12 +2,12 @@
port: 10015
spring:
profiles:
- active: prod
+ active: dev
application:
name: loadGlass
liquibase:
enabled: false
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
+# configuration:
+# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
index 55a2ffe..36d9e96 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
@@ -2,7 +2,7 @@
port: 10016
spring:
profiles:
- active: prod
+ active: dev
application:
name: temperingGlass
liquibase:
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-dev.yml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-dev.yml
index 3ce9b6e..c0bcd39 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-dev.yml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-dev.yml
@@ -27,4 +27,14 @@
database: 0
host: 127.0.0.1
port: 6379
- password: 123456
\ No newline at end of file
+ password: 123456
+kangaroohy:
+ milo:
+ enabled: true
+ primary: default
+ config:
+ default:
+ endpoint: opc.tcp://10.153.19.150:49320
+ security-policy: basic256sha256
+ username: admin
+ password: 1qaz2wsx3edc4rfv
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application.yml
index 693203c..04c1978 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application.yml
@@ -3,7 +3,7 @@
spring:
profiles:
- active: prod
+ active: dev
application:
name: hollowGlass
liquibase:
--
Gitblit v1.8.0