From e0043788e0fdbc7292a532e7eb7d2b33a9fa2d7e Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 12 九月 2024 08:53:32 +0800
Subject: [PATCH] 删除扫码枪多余代码,大理片添加指定工程
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java | 66 +++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
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 ca96d50..fe4b12c 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
@@ -12,6 +12,8 @@
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
import com.mes.edgglasstask.service.EdgGlassTaskInfoService;
import com.mes.job.PlcStorageCageTask;
+import com.mes.pp.entity.ReportingWork;
+import com.mes.pp.entity.ReportingWorkDetail;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
@@ -20,6 +22,12 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -183,4 +191,62 @@
log.info("鍦ㄥ昂瀵歌〃涓幏鍙栫幓鐠冧俊鎭瘂}", edgGlassTaskInfoList);
}
+ @Test
+ public void ca(){
+ try {
+ // 鐩爣绯荤粺鐨凙PI URL
+ String url = "http://192.168.3.119:8086/reportingWork/mesSave";
+ URL obj = new URL(url);
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+
+ // 璁剧疆璇锋眰鏂规硶鍜岃姹傚ご
+ con.setRequestMethod("POST");
+ con.setRequestProperty("Content-Type", "application/json; utf-8");
+ con.setRequestProperty("Accept", "application/json");
+ con.setDoOutput(true);
+
+ // 鍒涘缓娑堟伅浣�
+ String jsonInputString = "灏忓粬";
+ ReportingWork reportingWork=new ReportingWork();
+ reportingWork.setOrderId("NG24042301");
+ reportingWork.setProductionId("NG24042301A");
+ reportingWork.setProcessId("NG24042301A001");
+ reportingWork.setDeviceName("纾ㄨ竟鏈�");
+ reportingWork.setThisProcess("鍒囧壊");
+ reportingWork.setNextProcess("纾ㄨ竟");
+ reportingWork.setThisCompletedQuantity(1);
+ reportingWork.setThisWornQuantity(0);
+ reportingWork.setClasses("鏃╃彮");
+ reportingWork.setReportingWorkTime(LocalDateTime.now());
+ reportingWork.setTeamsGroupsName("灏忓粬涓�鍙�");
+ reportingWork.setCreator("灏忓粬");
+
+ ReportingWorkDetail reportingWorkDetail=new ReportingWorkDetail();
+ reportingWorkDetail.setTechnologyNumber(1);
+ reportingWorkDetail.setOrderNumber(1);
+ reportingWorkDetail.setCompletedQuantity(1);
+ reportingWorkDetail.setBreakageQuantity(0);
+ // 鍙戦�佽姹�
+ try (OutputStream os = con.getOutputStream()) {
+ byte[] input = jsonInputString.getBytes("utf-8");
+ os.write(input, 0, input.length);
+ }
+
+ // 鑾峰彇鍝嶅簲鐮�
+ int responseCode = con.getResponseCode();
+ System.out.println("Response Code : " + responseCode);
+ // 鑾峰彇鍝嶅簲鍐呭
+ try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))) {
+ StringBuilder response = new StringBuilder();
+ String inputLine;
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ System.out.println("Response Body: " + response.toString());
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
--
Gitblit v1.8.0