From 03cf8f27122be9a738b8814533e52550638fcda7 Mon Sep 17 00:00:00 2001 From: hdy <1105738590@qq.com> Date: 星期五, 03 一月 2025 19:40:23 +0800 Subject: [PATCH] 工单bom下发接口 --- billion-main/src/main/java/com/billion/main/api/RestfulAPI.java | 64 +++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 1 deletions(-) diff --git a/billion-main/src/main/java/com/billion/main/api/RestfulAPI.java b/billion-main/src/main/java/com/billion/main/api/RestfulAPI.java index 0755132..2be3455 100644 --- a/billion-main/src/main/java/com/billion/main/api/RestfulAPI.java +++ b/billion-main/src/main/java/com/billion/main/api/RestfulAPI.java @@ -1,13 +1,75 @@ package com.billion.main.api; +import com.billion.main.api.domain.ApiResponse; +import com.billion.main.api.domain.WorkOrdersInfo; +import com.billion.main.api.service.IWorkOrdersInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + + +@RestController +//@Component +@RequestMapping("/dmMes") public class RestfulAPI { + @Autowired + private IWorkOrdersInfoService iWorkOrdersInfoService; + + public static final String getQualityData = "IP鍦板潃/CollectQualityData"; /** * 鎺ユ敹宸ュ崟淇℃伅 * 1銆佸伐鍘侻ES璋冪敤鎺ユ敹宸ュ崟鎺ュ彛锛屽皢宸ュ崟淇℃伅鍙戦�佺粰浜х嚎MES * 2銆佷骇绾縈ES灏嗘帴鏀跺埌鐨勫伐鍗曚俊鎭瓨鍏ュ埌宸ュ崟琛ㄥ拰BOM琛� */ - public void receiveWorkOrdersInfo(){ + @PostMapping("/receiveWorkOrdersInfo") + public ApiResponse receiveWorkOrdersInfo(@RequestBody WorkOrdersInfo workOrdersInfo) { + try { + // 璋冪敤service灞備繚瀛樻暟鎹� + boolean saveResult = iWorkOrdersInfoService.saveWorkOrders(workOrdersInfo); + // 鏋勫缓鍝嶅簲鏁版嵁 + ApiResponse response = new ApiResponse(); + List<ApiResponse.ResponseData> dataList = new ArrayList<>(); + ApiResponse.ResponseData responseData = new ApiResponse.ResponseData(); + if (saveResult) { + response.setCode("success"); + response.setMessage("API璋冪敤鎴愬姛"); + responseData.setProductionID(workOrdersInfo.getProductionID()); + responseData.setResultCode("S"); + responseData.setResultText("閲囬泦瀹屾垚"); + } else { + response.setCode("fail"); + response.setMessage("API璋冪敤澶辫触"); + responseData.setProductionID(workOrdersInfo.getProductionID()); + responseData.setResultCode("F"); + responseData.setResultText("閲囬泦澶辫触"); + } + dataList.add(responseData); + response.setData(dataList); + return response; + } catch (Exception e) { + // 寮傚父澶勭悊 + ApiResponse response = new ApiResponse(); + response.setCode("fail"); + response.setMessage("API璋冪敤澶辫触"); + List<ApiResponse.ResponseData> dataList = new ArrayList<>(); + ApiResponse.ResponseData responseData = new ApiResponse.ResponseData(); + responseData.setProductionID(workOrdersInfo.getProductionID()); + responseData.setResultCode("F"); + responseData.setResultText("閲囬泦澶辫触"); + dataList.add(responseData); + response.setData(dataList); + return response; + } } + + + } + -- Gitblit v1.9.3