From 2b0dc519ddc4fefcabc7f60dcda4968964155e11 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期五, 17 十一月 2023 16:45:43 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java | 3 mes-common/pom.xml | 6 mes-plan/src/main/java/com/chinaztt/mes/plan/entity/CustomerOrder.java | 3 mes-web/src/main/resources/bootstrap.yml | 6 /dev/null | 178 ---------------- mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java | 1 mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java | 10 mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java | 11 mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketMessage.java | 128 +++++++++++ mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java | 14 + mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java | 34 ++ mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml | 249 +++++++++++----------- mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java | 10 13 files changed, 332 insertions(+), 321 deletions(-) diff --git a/mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java b/mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java index 924402d..eec8bd8 100644 --- a/mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java +++ b/mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java @@ -89,7 +89,15 @@ @Inner(value = false) public R triggerAdd(@RequestParam String params) { PartVo partVo = JSONObject.parseObject(params, PartVo.class); - return R.ok(partService.triggerAdd(partVo)); + R<Object> objectR = new R<>(); + if(partService.triggerAdd(partVo).equals("1")){ + objectR.setCode(1); + objectR.setMsg("鎿嶄綔鎴愬姛"); + }else { + objectR.setCode(0); + objectR.setMsg("鎿嶄綔澶辫触锛佽仈绯讳汉鍛樻煡鐪嬫棩蹇楋紒"); + } + return objectR; } diff --git a/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java b/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java index abc3344..1a1c2c9 100644 --- a/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java +++ b/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java @@ -509,11 +509,13 @@ //鍨嬪彿 part.setPartModel(partVo.getMaterial_spec()); if (partVo.getType().equals("add")){ - baseMapper.insert(part); - return "鏂板"+part.getPartNo()+"闆朵欢鍙锋垚鍔�" ; + int insert = baseMapper.insert(part); + log.info("鏂板"+part.getPartNo()+"闆朵欢鍙锋垚鍔�"); + return insert>0?"1":"0" ; }else { - baseMapper.update(part,Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo,part.getPartNo())); - return "淇敼"+part.getPartNo()+"闆朵欢鍙锋垚鍔�" ; + int update = baseMapper.update(part, Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo, part.getPartNo())); + log.info("淇敼"+part.getPartNo()+"闆朵欢鍙锋垚鍔�"); + return update>0?"1":"0" ; } } diff --git a/mes-common/pom.xml b/mes-common/pom.xml index 3c97df9..5ea547e 100644 --- a/mes-common/pom.xml +++ b/mes-common/pom.xml @@ -31,7 +31,11 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency> - + <dependency> + <groupId>jakarta.websocket</groupId> + <artifactId>jakarta.websocket-api</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> diff --git a/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketMessage.java b/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketMessage.java new file mode 100644 index 0000000..cb0f091 --- /dev/null +++ b/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketMessage.java @@ -0,0 +1,128 @@ +package com.chinaztt.mes.common.server; + + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.websocket.*; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArraySet; + +/** + * @Author 寮犲 + * @Date 2023/11/16 + */ +@Component +@Slf4j +@ServerEndpoint("/websocket/{userId}") // 鎺ュ彛璺緞 ws://ip:绔彛/webSocket/userId; +public class WebSocketMessage { + + //涓庢煇涓鎴风鐨勮繛鎺ヤ細璇濓紝闇�瑕侀�氳繃瀹冩潵缁欏鎴风鍙戦�佹暟鎹� + private Session session; + /** + * 鐢ㄦ埛ID + */ + private String userId; + + //concurrent鍖呯殑绾跨▼瀹夊叏Set锛岀敤鏉ュ瓨鏀炬瘡涓鎴风瀵瑰簲鐨凪yWebSocket瀵硅薄銆� + //铏界劧@Component榛樿鏄崟渚嬫ā寮忕殑锛屼絾springboot杩樻槸浼氫负姣忎釜websocket杩炴帴鍒濆鍖栦竴涓猙ean锛屾墍浠ュ彲浠ョ敤涓�涓潤鎬乻et淇濆瓨璧锋潵銆� + // 娉細搴曚笅WebSocket鏄綋鍓嶇被鍚� + private static CopyOnWriteArraySet<WebSocketMessage> webSockets =new CopyOnWriteArraySet<>(); + // 鐢ㄦ潵瀛樺湪绾胯繛鎺ョ敤鎴蜂俊鎭� + private static ConcurrentHashMap<String,Session> sessionPool = new ConcurrentHashMap<String,Session>(); + + /** + * 閾炬帴鎴愬姛璋冪敤鐨勬柟娉� + */ + @OnOpen + public void onOpen(Session session, @PathParam(value="userId")String userId) { + try { + this.session = session; + this.userId = userId; + webSockets.add(this); + sessionPool.put(userId, session); + log.info("銆恮ebsocket娑堟伅銆戞湁鏂扮殑杩炴帴锛屾�绘暟涓�:"+webSockets.size()); + } catch (Exception e) { + } + } + + /** + * 閾炬帴鍏抽棴璋冪敤鐨勬柟娉� + */ + @OnClose + public void onClose() { + try { + webSockets.remove(this); + sessionPool.remove(this.userId); + log.info("銆恮ebsocket娑堟伅銆戣繛鎺ユ柇寮�锛屾�绘暟涓�:"+webSockets.size()); + } catch (Exception e) { + } + } + /** + * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉� + * + * @param message + */ + @OnMessage + public void onMessage(String message) { + log.info("銆恮ebsocket娑堟伅銆戞敹鍒板鎴风娑堟伅:"+message); + } + + /** 鍙戦�侀敊璇椂鐨勫鐞� + * @param session + * @param error + */ + @OnError + public void onError(Session session, Throwable error) { + + log.error("鐢ㄦ埛閿欒,鍘熷洜:"+error.getMessage()); + error.printStackTrace(); + } + + + // 姝や负骞挎挱娑堟伅 + public void sendAllMessage(String message) { + log.info("銆恮ebsocket娑堟伅銆戝箍鎾秷鎭�:"+message); + for(WebSocketMessage webSocket : webSockets) { + try { + if(webSocket.session.isOpen()) { + webSocket.session.getAsyncRemote().sendText(message); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + // 姝や负鍗曠偣娑堟伅 + public void sendOneMessage(String userId, String message) { + Session session = sessionPool.get(userId); + if (session != null&&session.isOpen()) { + try { + log.info("銆恮ebsocket娑堟伅銆� 鍗曠偣娑堟伅:"+message); + session.getAsyncRemote().sendText(message); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + // 姝や负鍗曠偣娑堟伅(澶氫汉) + public void sendMoreMessage(String[] userIds, String message) { + for(String userId:userIds) { + Session session = sessionPool.get(userId); + if (session != null&&session.isOpen()) { + try { + log.info("銆恮ebsocket娑堟伅銆� 鍗曠偣娑堟伅:"+message); + session.getAsyncRemote().sendText(message); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } + +} diff --git a/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketServer.java b/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketServer.java deleted file mode 100644 index be5cbf0..0000000 --- a/mes-common/src/main/java/com/chinaztt/mes/common/server/WebSocketServer.java +++ /dev/null @@ -1,178 +0,0 @@ -//package com.chinaztt.mes.common.server; -//import com.alibaba.fastjson.JSON; -//import com.alibaba.fastjson.JSONObject; -//import lombok.extern.slf4j.Slf4j; -//import org.apache.commons.lang3.StringUtils; -//import org.springframework.stereotype.Component; -// -//import javax.websocket.*; -//import javax.websocket.server.PathParam; -//import javax.websocket.server.ServerEndpoint; -//import java.io.IOException; -//import java.util.HashMap; -//import java.util.Iterator; -//import java.util.concurrent.ConcurrentHashMap; -///** -// * @Author 寮犲 -// * @Date 2023/11/13 -// * @Params: WebSocketServer.sendInfo(浣跨敤JSON,鐢ㄦ埛鍚�); -// * @Return -// */ -////@ServerEndpoint("/websocket/{userId}") -//@Component -//@Slf4j -//public class WebSocketServer { -// -// /**闈欐�佸彉閲忥紝鐢ㄦ潵璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁般�傚簲璇ユ妸瀹冭璁℃垚绾跨▼瀹夊叏鐨勩��*/ -// private static int onlineCount = 0; -// /**concurrent鍖呯殑绾跨▼瀹夊叏Set锛岀敤鏉ュ瓨鏀炬瘡涓鎴风瀵瑰簲鐨凪yWebSocket瀵硅薄銆�*/ -// private static ConcurrentHashMap<String, WebSocketServer> webSocketMap = new ConcurrentHashMap<>(); -// /**涓庢煇涓鎴风鐨勮繛鎺ヤ細璇濓紝闇�瑕侀�氳繃瀹冩潵缁欏鎴风鍙戦�佹暟鎹�*/ -// private Session session; -// /**鎺ユ敹userId*/ -// private String userId=""; -// -// /** -// * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉� -// * */ -// @OnOpen -// public void onOpen(Session session, @PathParam("userId") String userId) { -// this.session = session; -// this.userId=userId; -// if(webSocketMap.containsKey(userId)){ -// webSocketMap.remove(userId); -// //鍔犲叆set涓� -// }else{ -// webSocketMap.put(userId,this); -// //鍔犲叆set涓� -// addOnlineCount(); -// //鍦ㄧ嚎鏁板姞1 -// } -// -// log.info("鐢ㄦ埛杩炴帴:"+userId+",褰撳墠鍦ㄧ嚎浜烘暟涓�:" + getOnlineCount()); -// -// try { -// HashMap<Object, Object> map = new HashMap<>(); -// map.put("key","杩炴帴鎴愬姛"); -// sendMessage(JSON.toJSONString(map)); -// } catch (IOException e) { -// log.error("鐢ㄦ埛:"+userId+",缃戠粶寮傚父!!!!!!"); -// } -// } -// -// /** -// * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉� -// */ -// @OnClose -// public void onClose() { -// if(webSocketMap.containsKey(userId)){ -// webSocketMap.remove(userId); -// //浠巗et涓垹闄� -// subOnlineCount(); -// } -// log.info("鐢ㄦ埛閫�鍑�:"+userId+",褰撳墠鍦ㄧ嚎浜烘暟涓�:" + getOnlineCount()); -// } -// -// /** -// * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉� -// * -// * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅*/ -// @OnMessage -// public void onMessage(String message, Session session) { -// log.info("鐢ㄦ埛娑堟伅:"+userId+",鎶ユ枃:"+message); -// //鍙互缇ゅ彂娑堟伅 -// //娑堟伅淇濆瓨鍒版暟鎹簱銆乺edis -// if(StringUtils.isNotBlank(message)){ -// try { -// //瑙f瀽鍙戦�佺殑鎶ユ枃 -// JSONObject jsonObject = JSONObject.parseObject(message); -// //杩藉姞鍙戦�佷汉(闃叉涓叉敼) -// jsonObject.put("fromUserId",this.userId); -// String fromUserId=jsonObject.getString("fromUserId"); -// //浼犻�佺粰瀵瑰簲toUserId鐢ㄦ埛鐨剋ebsocket -// if(StringUtils.isNotBlank(fromUserId) && webSocketMap.containsKey(fromUserId)){ -// webSocketMap.get(fromUserId).sendMessage(jsonObject.toJSONString()); -// //鑷畾涔�-涓氬姟澶勭悊 -// -//// DeviceLocalThread.paramData.put(jsonObject.getString("group"),jsonObject.toJSONString()); -// }else{ -// log.error("璇锋眰鐨剈serId:"+fromUserId+"涓嶅湪璇ユ湇鍔″櫒涓�"); -// //鍚﹀垯涓嶅湪杩欎釜鏈嶅姟鍣ㄤ笂锛屽彂閫佸埌mysql鎴栬�卹edis -// } -// }catch (Exception e){ -// e.printStackTrace(); -// } -// } -// } -// -// /** -// * 鍙戠敓閿欒鏃跺�� -// * @param session -// * @param error -// */ -// @OnError -// public void onError(Session session, Throwable error) { -// log.error("鐢ㄦ埛閿欒:"+this.userId+",鍘熷洜:"+error.getMessage()); -// error.printStackTrace(); -// } -// /** -// * 瀹炵幇鏈嶅姟鍣ㄤ富鍔ㄦ帹閫� -// */ -// public void sendMessage(String message) throws IOException { -// //鍔犲叆绾跨▼閿� -// synchronized (session){ -// try { -// //鍚屾鍙戦�佷俊鎭� -// this.session.getBasicRemote().sendText(message); -// } catch (IOException e) { -// log.error("鏈嶅姟鍣ㄦ帹閫佸け璐�:"+e.getMessage()); -// } -// } -// } -// -// -// /** -// * 鍙戦�佽嚜瀹氫箟娑堟伅 -// * */ -// /** -// * 鍙戦�佽嚜瀹氫箟娑堟伅 -// * @param message 鍙戦�佺殑淇℃伅 -// * @param toUserId 濡傛灉涓簄ull榛樿鍙戦�佹墍鏈� -// * @throws IOException -// */ -// public static void sendInfo(String message,String toUserId) throws IOException { -// //濡傛灉userId涓虹┖锛屽悜鎵�鏈夌兢浣撳彂閫� -// if(StringUtils.isEmpty(toUserId)) { -// //鍚戞墍鏈夌敤鎴峰彂閫佷俊鎭� -// Iterator<String> itera = webSocketMap.keySet().iterator(); -// while (itera.hasNext()) { -// String keys = itera.next(); -// WebSocketServer item = webSocketMap.get(keys); -// item.sendMessage(message); -// } -// } -// //濡傛灉涓嶄负绌猴紝鍒欏彂閫佹寚瀹氱敤鎴蜂俊鎭� -// else if(webSocketMap.containsKey(toUserId)){ -// WebSocketServer item = webSocketMap.get(toUserId); -// item.sendMessage(message); -// }else{ -// log.error("璇锋眰鐨剈serId:"+toUserId+"涓嶅湪璇ユ湇鍔″櫒涓�"); -// } -// } -// -// public static synchronized int getOnlineCount() { -// return onlineCount; -// } -// -// public static synchronized void addOnlineCount() { -// WebSocketServer.onlineCount++; -// } -// -// public static synchronized void subOnlineCount() { -// WebSocketServer.onlineCount--; -// } -// -// public static synchronized ConcurrentHashMap<String, WebSocketServer> getWebSocketMap(){ -// return WebSocketServer.webSocketMap; -// } -//} \ No newline at end of file diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java index eedbc18..9a7faff 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java @@ -17,7 +17,6 @@ package com.chinaztt.mes.plan.controller; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaztt.mes.basic.service.StaffService; @@ -52,7 +51,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.net.URL; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.List; @@ -530,6 +528,7 @@ */ @DeleteMapping("/processConfigFile/{id}") public R processConfigFile(@PathVariable Long id) { + System.out.println("鎵ц鍒犻櫎------>"+id); return customerOrderService.deleteProcessConfigFile(id); } diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java index 6fd1d8b..80fb285 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaztt.mes.common.wrapper.QueryWrapperUtil; -import com.chinaztt.mes.plan.dto.*; -import com.chinaztt.mes.plan.entity.CustomerOrder; +import com.chinaztt.mes.plan.dto.CustomerOrderDTO; +import com.chinaztt.mes.plan.dto.MasterProductionScheduleDTO; +import com.chinaztt.mes.plan.dto.MpsStructureComponentDTO; +import com.chinaztt.mes.plan.dto.MpsStructureComponentTreeNode; import com.chinaztt.mes.plan.entity.MasterProductionSchedule; import com.chinaztt.mes.plan.entity.OperationTaskProduce; import com.chinaztt.mes.plan.service.MasterProductionScheduleService; @@ -13,6 +15,7 @@ import com.chinaztt.mes.technology.service.StructureService; import com.chinaztt.ztt.common.core.util.R; import com.chinaztt.ztt.common.log.annotation.SysLog; +import com.chinaztt.ztt.common.security.annotation.Inner; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -351,6 +354,11 @@ .eq(MasterProductionSchedule::getMpsNo, mpsNo))); } - + @ApiOperation(value = "閫氳繃涓昏鍒掓煡璇fs搴撳瓨鐢熶骇閲囪喘璁″垝", notes = "閫氳繃涓昏鍒掓煡璇fs搴撳瓨鐢熶骇閲囪喘璁″垝") + @PostMapping("/addPlanPurchasing") + @Inner(value = false) + public R addPlanPurchasing(@RequestParam(required = false) List<MasterProductionSchedule>masterProductionSchedules){ + return R.ok(masterProductionScheduleService.addPlanPurchasing(masterProductionSchedules)); + } } diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/entity/CustomerOrder.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/entity/CustomerOrder.java index 7e50cb5..bb82473 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/entity/CustomerOrder.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/entity/CustomerOrder.java @@ -108,6 +108,9 @@ */ @ApiModelProperty(value = "闆朵欢鍙凤細鐢ㄤ簬鐢熶骇鐨勯浂浠跺彿") private String partNo; + + @ApiModelProperty(value = "闆朵欢缂栧彿锛氱敤浜庣敓浜х殑闆朵欢鍙�") + private String partId; /** * 鏁伴噺 */ diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java index c6ec29f..49af884 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java @@ -190,4 +190,5 @@ */ MasterProductionScheduleDTO getById(Long id); + boolean addPlanPurchasing(List<MasterProductionSchedule>masterProductionSchedules); } diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java index 3604baf..01b4adc 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java @@ -93,10 +93,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; -import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -194,7 +194,7 @@ private final static String AFFILIATED_CONTRACT = "涓ぉ娉ㄥ鍘�"; - + //private FileSaveUtil fileSaveUtil; @Override public void otcDownload(Long id, HttpServletResponse response) { @@ -257,8 +257,9 @@ private void changeAudit(CustomerOrder customerOrder, String isAudit) { //瀹℃牳鐘舵�� 閫氳繃 璁㈠崟鐘舵�佸緟璁″垝 if (isAudit.equals(AuditStateStringValues.ACCEPTED)) { + //TODO: 瑕佸姞闆朵欢id鍙傛暟 Document document = documentMapper.selectById(customerOrder.getTechnologyDocumentId()); - Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getEngChgLevel, "1").eq(Part::getPartNo, customerOrder.getPartNo())); + Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getEngChgLevel, "1").eq(Part::getId,customerOrder.getPartId() )); if (null == part) { throw new RuntimeException("鏍规嵁闆朵欢缂栧彿 = 銆�" + customerOrder.getPartNo() + "銆慚ES鏈湴鏌ユ棤鍖归厤闆朵欢瀵硅薄"); } @@ -1908,7 +1909,9 @@ public R deleteProcessConfigFile(Long id) { try { OrderProcessConfigFile configFile = orderProcessConfigFileMapper.selectById(id); - minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); + String filePath=FileSaveUtil.FILE_PATH+"//"+configFile.getBucketName(); + boolean del = FileUtil.del(new File(filePath)); + //minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); orderProcessConfigFileMapper.deleteById(id); processConfigFileOrderMappingMapper.delete(Wrappers.<ProcessConfigFileOrderMapping>lambdaQuery().eq(ProcessConfigFileOrderMapping::getConfigFileId, id)); return R.ok(); diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java index 8f1353b..510d7b7 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java @@ -1,6 +1,7 @@ package com.chinaztt.mes.plan.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -28,7 +29,6 @@ import com.chinaztt.mes.plan.state.masterproductionschedule.constant.MasterProductionScheduleEvents; import com.chinaztt.mes.plan.state.masterproductionschedule.constant.MasterProductionScheduleStates; import com.chinaztt.mes.technology.entity.Document; -import com.chinaztt.mes.technology.entity.Operation; import com.chinaztt.mes.technology.entity.Routing; import com.chinaztt.mes.technology.entity.Structure; import com.chinaztt.mes.technology.mapper.DocumentMapper; @@ -40,6 +40,7 @@ import com.chinaztt.ztt.common.core.util.R; import com.chinaztt.ztt.common.security.util.SecurityUtils; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; @@ -50,7 +51,6 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; -import java.time.format.DateTimeFormatter; import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -63,6 +63,7 @@ * @author cxf * @date 2020-09-21 14:42:39 */ +@Slf4j @Service @AllArgsConstructor @Transactional(rollbackFor = Exception.class) @@ -86,6 +87,7 @@ private StructureMapper structureMapper; private StateMachineFactory<MasterProductionScheduleStates, MasterProductionScheduleEvents> masterproductionscheduleStateMachineFactory; private StateMachinePersister<MasterProductionScheduleStates, MasterProductionScheduleEvents, MasterProductionSchedule> persister; + private MoStructureComponentMapper moStructureComponentMapper; @Override public IPage<List<MasterProductionScheduleDTO>> getMasterProductionSchedulePage(Page page, QueryWrapper<MasterProductionScheduleDTO> masterProductionScheduleDTO) { @@ -457,4 +459,32 @@ masterProductionScheduleDTO.setOutPutBatchList(operationTaskProduceList); return masterProductionScheduleDTO; } + + /** + * 娣诲姞閲囪喘璁″垝 + * @param masterProductionSchedules + * @return + */ + @Override + public boolean addPlanPurchasing(List<MasterProductionSchedule>masterProductionSchedules) { + masterProductionSchedules.forEach(p->{ + Long technologyDocumentId = p.getTechnologyDocumentId(); + Document document = documentMapper.selectById(technologyDocumentId); + Long firstPart = document.getPartId(); + List<MoStructureComponent> moStructureComponents = moStructureComponentMapper.selectList(new QueryWrapper<MoStructureComponent>().lambda().eq(MoStructureComponent::getPlanManufacturingOrderId, p.getId())); + moStructureComponents.forEach(m->{ + Part part = partMapper.selectById(m.getPartId()); + String url="http://192.168.20.47:8008/PurchService.ashx?contract=ZTKJ&contractKey=4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=&procedureName=QUERY_INVENTORY_INFO_STD&userId=7632&inAttr={\"LOCATION_NO\": \"1019\",\"PART_NO\":"+part.getPartNo()+"}"; + String body = HttpRequest.get(url).execute().body(); + JSONObject partInfo = JSONObject.parseObject(body); + log.info("搴撳瓨闆朵欢==================================>"+partInfo); + }); + }); + return false; + } + + + + + } diff --git a/mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml b/mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml index 67bd66e..8f98c53 100644 --- a/mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml +++ b/mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml @@ -57,81 +57,85 @@ </resultMap> <select id="getDtoById" resultType="com.chinaztt.mes.plan.dto.MasterProductionScheduleDTO"> - SELECT * FROM plan_master_production_schedule where ID = #{id} + SELECT * + FROM plan_master_production_schedule + where ID = #{id} </select> <select id="getMasterProductionSchedulePage" resultMap="masterProductionScheduleMap"> select - D.id, - D.factory_id, - D.mps_no, - D.required_date, - D.remark, - D.create_time, - D.update_time, - D.create_user, - D.update_user, - D.part_id, - D.qty_required, - D.state, - D.part_no, - D.unit, - D.part_name, - D.part_description, - D.inventory_reserved_quantity, - D.outsourcing_number, - D.manufacturing_quantity, - D.customer_order_no, - D.outer_color, - D.length_requirement, - D.order_remark, - D.print_requirement, - D.source, - D.is_audit, - D.technology_document_id, - D.doc_number, - D.manufacture_attr, - D.promised_delivery_date + D.id, + D.factory_id, + D.mps_no, + D.required_date, + D.remark, + D.create_time, + D.update_time, + D.create_user, + D.update_user, + D.part_id, + D.qty_required, + D.state, + D.part_no, + D.unit, + D.part_name, + D.part_description, + D.inventory_reserved_quantity, + D.outsourcing_number, + D.manufacturing_quantity, + D.customer_order_no, + D.outer_color, + D.length_requirement, + D.order_remark, + D.print_requirement, + D.source, + D.is_audit, + D.technology_document_id, + D.doc_number, + D.manufacture_attr, + D.promised_delivery_date FROM ( - select - pmps.*, - bp.part_no, - bp.part_name, - bp.description part_description, - bp.unit, - pco.customer_order_no, - pco.outer_color, - pcop."value" as length_requirement, - pcop2."value" as order_remark, - pcop3."value" as print_requirement, - ( - SELECT coalesce(sum(wjso.reserved_quantity), 0) - from - warehouse_join_stock_order wjso - left join plan_customer_order pco on pco."id" = wjso.customer_order_id - left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' - where wjso.type = '瀹㈡埛璁㈠崟棰勭暀' - and status = '02confirmed' - and pjmc.model_id = pmps.id - ) inventory_reserved_quantity, - ( - SELECT coalesce(sum(poo.qty_required), 0) - from plan_outsourcing_order poo - where poo.mps_id = pmps.id - ) outsourcing_number, - ( - SELECT coalesce(sum(pmo.qty_required), 0) - from plan_manufacturing_order pmo - where pmo.mps_id = pmps.id AND pmo.part_id = pmps.part_id - ) manufacturing_quantity - from plan_master_production_schedule pmps - left join basic_part bp on bp."id" = pmps.part_id - left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = 'plan_master_production_schedule' - left join plan_customer_order pco on pco.id = pjmc.customer_order_id - left join plan_customer_order_param pcop on pcop.order_id = pco.id and pcop.field = 'LengthRequirement' - left join plan_customer_order_param pcop2 on pcop2.order_id = pco.id and pcop2.field = 'Remark' - left join plan_customer_order_param pcop3 on pcop3.order_id = pco.id and pcop3.field = 'PrintRequirement' - ) D + select + pmps.*, + bp.part_no, + bp.part_name, + bp.description part_description, + bp.unit, + pco.customer_order_no, + pco.outer_color, + pcop."value" as length_requirement, + pcop2."value" as order_remark, + pcop3."value" as print_requirement, + ( + SELECT coalesce(sum(wjso.reserved_quantity), 0) + from + warehouse_join_stock_order wjso + left join plan_customer_order pco on pco."id" = wjso.customer_order_id + left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = + 'plan_master_production_schedule' + where wjso.type = '瀹㈡埛璁㈠崟棰勭暀' + and status = '02confirmed' + and pjmc.model_id = pmps.id + ) inventory_reserved_quantity, + ( + SELECT coalesce(sum(poo.qty_required), 0) + from plan_outsourcing_order poo + where poo.mps_id = pmps.id + ) outsourcing_number, + ( + SELECT coalesce(sum(pmo.qty_required), 0) + from plan_manufacturing_order pmo + where pmo.mps_id = pmps.id AND pmo.part_id = pmps.part_id + ) manufacturing_quantity + from plan_master_production_schedule pmps + left join basic_part bp on bp."id" = pmps.part_id + left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = + 'plan_master_production_schedule' + left join plan_customer_order pco on pco.id = pjmc.customer_order_id + left join plan_customer_order_param pcop on pcop.order_id = pco.id and pcop.field = 'LengthRequirement' + left join plan_customer_order_param pcop2 on pcop2.order_id = pco.id and pcop2.field = 'Remark' + left join plan_customer_order_param pcop3 on pcop3.order_id = pco.id and pcop3.field = 'PrintRequirement' + ) D <if test="ew.emptyOfWhere == false"> ${ew.customSqlSegment} </if> @@ -144,7 +148,7 @@ left join plan_mps_source pms on pms.mps_requ_id = pmr."id" where pms.mps_id = pmps."id") where exists(select 1 from plan_mps_source pms where pms.mps_id = pmps."id" and pms.mps_requ_id = #{param.id}) - </update> + </update> <select id="getPlanProduction" resultMap="masterProductionScheduleMap"> select * FROM plan_master_production_schedule a @@ -153,59 +157,58 @@ </select> <select id="getByIdExt" resultMap="masterProductionScheduleMap"> - select - D.id, - D.factory_id, - D.mps_no, - D.required_date, - D.remark, - D.create_time, - D.update_time, - D.create_user, - D.update_user, - D.part_id, - D.qty_required, - D.state, - D.part_no, - D.unit, - D.part_name, - D.part_description, - D.inventory_reserved_quantity, - D.outsourcing_number, - D.manufacturing_quantity, - D.source, - D.is_audit, - D.technology_document_id, - D.doc_number, - D.manufacture_attr, - D.promised_delivery_date + select D.id, + D.factory_id, + D.mps_no, + D.required_date, + D.remark, + D.create_time, + D.update_time, + D.create_user, + D.update_user, + D.part_id, + D.qty_required, + D.state, + D.part_no, + D.unit, + D.part_name, + D.part_description, + D.inventory_reserved_quantity, + D.outsourcing_number, + D.manufacturing_quantity, + D.source, + D.is_audit, + D.technology_document_id, + D.doc_number, + D.manufacture_attr, + D.promised_delivery_date FROM ( - select - pmps.*, - bp.part_no, - bp.part_name, - bp.description part_description, - bp.unit, - ( - SELECT coalesce(sum(wjso.reserved_quantity), 0) - from - warehouse_join_stock_order wjso - left join plan_customer_order pco on pco."id" = wjso.customer_order_id - left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' - where wjso.type = '瀹㈡埛璁㈠崟棰勭暀' - and status = '02confirmed' - and pjmc.model_id = pmps.id - ) inventory_reserved_quantity, - ( - SELECT coalesce(sum(poo.qty_required), 0) - from plan_outsourcing_order poo - where poo.mps_id = pmps.id - ) outsourcing_number, - ( - SELECT coalesce(sum(pmo.qty_required), 0) - from plan_manufacturing_order pmo - where pmo.mps_id = pmps.id - ) manufacturing_quantity + select pmps.*, + bp.part_no, + bp.part_name, + bp.description part_description, + bp.unit, + ( + SELECT coalesce(sum(wjso.reserved_quantity), 0) + from warehouse_join_stock_order wjso + left join plan_customer_order pco on pco."id" = wjso.customer_order_id + left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND + pjmc.model = + 'plan_master_production_schedule' + where wjso.type = '瀹㈡埛璁㈠崟棰勭暀' + and status = '02confirmed' + and pjmc.model_id = pmps.id + ) inventory_reserved_quantity, + ( + SELECT coalesce(sum(poo.qty_required), 0) + from plan_outsourcing_order poo + where poo.mps_id = pmps.id + ) outsourcing_number, + ( + SELECT coalesce(sum(pmo.qty_required), 0) + from plan_manufacturing_order pmo + where pmo.mps_id = pmps.id + ) manufacturing_quantity from plan_master_production_schedule pmps left join basic_part bp on bp."id" = pmps.part_id where pmps.id = #{id} diff --git a/mes-web/src/main/resources/bootstrap.yml b/mes-web/src/main/resources/bootstrap.yml index 1d6e43d..b3510fa 100644 --- a/mes-web/src/main/resources/bootstrap.yml +++ b/mes-web/src/main/resources/bootstrap.yml @@ -6,9 +6,9 @@ druid: username: postgres # password: postgres123 - password: root2022 + password: zsAdmin123! # 灏勯寮�鍙戞暟鎹簱 - url: jdbc:postgresql://127.0.0.1:5432/postgres + url: jdbc:postgresql://10.1.51.136:5432/zs_dev application: name: ztt-mes cloud: @@ -17,7 +17,7 @@ # password: nacos password: zttZTT123! discovery: - server-addr: 106.13.194.57:8848 + server-addr: 127.0.0.1:8848 metadata: # VERSION: 10.88.15.224 VERSION: 127.0.0.1 -- Gitblit v1.9.3