diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java index 6cc07a9b..61d56f2d 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java @@ -1,14 +1,22 @@ package com.op.system.api; +import com.op.common.core.constant.ServiceNameConstants; import com.op.common.core.domain.R; +import com.op.system.api.factory.RemoteSapFallbackFactory; import com.op.system.api.model.SapProOrder; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +/** + * sap服务 + * + * @author OP + */ +@FeignClient(contextId = "remoteSapService", value = ServiceNameConstants.SAP_SERVICE, fallbackFactory = RemoteSapFallbackFactory.class) public interface RemoteSapService { @PostMapping("/sap/shopOrderSync") - public R> shopOrderSync(); + public R> shopOrderSync(SapProOrder sapProOrder); } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java index 8b92d7bb..bb72fd80 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java @@ -16,7 +16,7 @@ public class RemoteSapFallbackFactory implements FallbackFactory> shopOrderSync() { + public R> shopOrderSync(SapProOrder sapProOrder) { return R.fail("SAP服务获取SAP订单失败:" + throwable.getMessage()); } }; diff --git a/op-auth/src/main/resources/bootstrap.yml b/op-auth/src/main/resources/bootstrap.yml index 300cb95e..777e34cf 100644 --- a/op-auth/src/main/resources/bootstrap.yml +++ b/op-auth/src/main/resources/bootstrap.yml @@ -17,12 +17,12 @@ spring: # 服务注册地址 #--spring.cloud.nacos.discovery.namespace=ywl --spring.cloud.nacos.config.namespace=ywl namespace: lanju-op - group: ywl + group: zxl server-addr: 140.249.53.142:8848 config: #命名空间 namespace: lanju-op - group: ywl + group: zxl # 配置中心地址 server-addr: 140.249.53.142:8848 # 配置文件格式 diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java index a963962d..afa0423d 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java @@ -16,66 +16,48 @@ import java.security.cert.X509Certificate; * * @author haiwei */ -public class HttpUtils -{ +public class HttpUtils { private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); /** * 向指定 URL 发送GET方法的请求 * - * @param url 发送请求的 URL + * @param url 发送请求的 URL * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 * @return 所代表远程资源的响应结果 */ - public static String sendGet(String url, String param) - { + public static String sendGet(String url, String param) { StringBuilder result = new StringBuilder(); BufferedReader in = null; - try - { + try { String urlNameString = url + "?" + param; - log.info("sendGet - {}", urlNameString); + log.info("sendGet - {}" , urlNameString); URL realUrl = new URL(urlNameString); URLConnection connection = realUrl.openConnection(); - connection.setRequestProperty("accept", "*/*"); - connection.setRequestProperty("connection", "Keep-Alive"); - connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.setRequestProperty("accept" , "*/*"); + connection.setRequestProperty("connection" , "Keep-Alive"); + connection.setRequestProperty("user-agent" , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); connection.connect(); in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; - while ((line = in.readLine()) != null) - { + while ((line = in.readLine()) != null) { result.append(line); } - log.info("recv - {}", result); - } - catch (ConnectException e) - { + log.info("recv - {}" , result); + } catch (ConnectException e) { log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { + } catch (SocketTimeoutException e) { log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { + } catch (IOException e) { log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { + } catch (Exception e) { log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); - } - finally - { - try - { - if (in != null) - { + } finally { + try { + if (in != null) { in.close(); } - } - catch (Exception ex) - { + } catch (Exception ex) { log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); } } @@ -85,26 +67,24 @@ public class HttpUtils /** * 向指定 URL 发送POST方法的请求 * - * @param url 发送请求的 URL + * @param url 发送请求的 URL * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 * @return 所代表远程资源的响应结果 */ - public static String sendPost(String url, String param) - { + public static String sendPost(String url, String param) { PrintWriter out = null; BufferedReader in = null; StringBuilder result = new StringBuilder(); - try - { + try { String urlNameString = url + "?" + param; - log.info("sendPost - {}", urlNameString); + log.info("sendPost - {}" , urlNameString); URL realUrl = new URL(urlNameString); URLConnection conn = realUrl.openConnection(); - conn.setRequestProperty("accept", "*/*"); - conn.setRequestProperty("connection", "Keep-Alive"); - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - conn.setRequestProperty("Accept-Charset", "utf-8"); - conn.setRequestProperty("contentType", "utf-8"); + conn.setRequestProperty("accept" , "*/*"); + conn.setRequestProperty("connection" , "Keep-Alive"); + conn.setRequestProperty("user-agent" , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset" , "utf-8"); + conn.setRequestProperty("contentType" , "utf-8"); conn.setDoOutput(true); conn.setDoInput(true); out = new PrintWriter(conn.getOutputStream()); @@ -112,65 +92,47 @@ public class HttpUtils out.flush(); in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); String line; - while ((line = in.readLine()) != null) - { + while ((line = in.readLine()) != null) { result.append(line); } - log.info("recv - {}", result); - } - catch (ConnectException e) - { + log.info("recv - {}" , result); + } catch (ConnectException e) { log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { + } catch (SocketTimeoutException e) { log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { + } catch (IOException e) { log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { + } catch (Exception e) { log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); - } - finally - { - try - { - if (out != null) - { + } finally { + try { + if (out != null) { out.close(); } - if (in != null) - { + if (in != null) { in.close(); } - } - catch (IOException ex) - { + } catch (IOException ex) { log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); } } return result.toString(); } - public static String sendSSLPost(String url, String param) - { + public static String sendSSLPost(String url, String param) { StringBuilder result = new StringBuilder(); String urlNameString = url + "?" + param; - try - { - log.info("sendSSLPost - {}", urlNameString); + try { + log.info("sendSSLPost - {}" , urlNameString); SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); + sc.init(null, new TrustManager[]{new TrustAnyTrustManager()}, new java.security.SecureRandom()); URL console = new URL(urlNameString); HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); - conn.setRequestProperty("accept", "*/*"); - conn.setRequestProperty("connection", "Keep-Alive"); - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - conn.setRequestProperty("Accept-Charset", "utf-8"); - conn.setRequestProperty("contentType", "utf-8"); + conn.setRequestProperty("accept" , "*/*"); + conn.setRequestProperty("connection" , "Keep-Alive"); + conn.setRequestProperty("user-agent" , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset" , "utf-8"); + conn.setRequestProperty("contentType" , "utf-8"); conn.setDoOutput(true); conn.setDoInput(true); @@ -180,60 +142,44 @@ public class HttpUtils InputStream is = conn.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String ret = ""; - while ((ret = br.readLine()) != null) - { - if (ret != null && !ret.trim().equals("")) - { + while ((ret = br.readLine()) != null) { + if (ret != null && !ret.trim().equals("")) { result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); } } - log.info("recv - {}", result); + log.info("recv - {}" , result); conn.disconnect(); br.close(); - } - catch (ConnectException e) - { + } catch (ConnectException e) { log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { + } catch (SocketTimeoutException e) { log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { + } catch (IOException e) { log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { + } catch (Exception e) { log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); } return result.toString(); } - private static class TrustAnyTrustManager implements X509TrustManager - { + private static class TrustAnyTrustManager implements X509TrustManager { @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) - { + public void checkClientTrusted(X509Certificate[] chain, String authType) { } @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) - { + public void checkServerTrusted(X509Certificate[] chain, String authType) { } @Override - public X509Certificate[] getAcceptedIssuers() - { - return new X509Certificate[] {}; + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; } } - private static class TrustAnyHostnameVerifier implements HostnameVerifier - { + private static class TrustAnyHostnameVerifier implements HostnameVerifier { @Override - public boolean verify(String hostname, SSLSession session) - { + public boolean verify(String hostname, SSLSession session) { return true; } } diff --git a/op-gateway/src/main/resources/bootstrap.yml b/op-gateway/src/main/resources/bootstrap.yml index fe99599f..a6f945f4 100644 --- a/op-gateway/src/main/resources/bootstrap.yml +++ b/op-gateway/src/main/resources/bootstrap.yml @@ -17,13 +17,13 @@ spring: # password: sfnacos2023 # namespace: lanju-op namespace: lanju-op - group: ywl + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 config: #命名空间 namespace: lanju-op - group: ywl + group: zxl # 配置中心地址 server-addr: 140.249.53.142:8848 # 配置文件格式 diff --git a/op-modules/op-file/src/main/resources/bootstrap.yml b/op-modules/op-file/src/main/resources/bootstrap.yml index 0c2780bc..3cc00fca 100644 --- a/op-modules/op-file/src/main/resources/bootstrap.yml +++ b/op-modules/op-file/src/main/resources/bootstrap.yml @@ -15,13 +15,13 @@ spring: discovery: # 服务注册地址 namespace: lanju-op - group: ywl + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 config: # 配置中心地址 namespace: lanju-op - group: ywl + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 # 配置文件格式 diff --git a/op-modules/op-gen/src/main/resources/bootstrap.yml b/op-modules/op-gen/src/main/resources/bootstrap.yml index 952af23e..1eaccce2 100644 --- a/op-modules/op-gen/src/main/resources/bootstrap.yml +++ b/op-modules/op-gen/src/main/resources/bootstrap.yml @@ -14,13 +14,13 @@ spring: nacos: discovery: namespace: lanju-op - group: ywl + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 config: #命名空间 namespace: lanju-op - group: ywl + group: zxl # 配置中心地址 server-addr: 140.249.53.142:8848 # 配置文件格式 diff --git a/op-modules/op-mes/src/main/resources/bootstrap.yml b/op-modules/op-mes/src/main/resources/bootstrap.yml index 222424bd..44e0b278 100644 --- a/op-modules/op-mes/src/main/resources/bootstrap.yml +++ b/op-modules/op-mes/src/main/resources/bootstrap.yml @@ -14,12 +14,12 @@ spring: nacos: discovery: namespace: lanju-op - group: ywl + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 config: namespace: lanju-op - group: ywl + group: zxl #命名空间 #group: local # 配置中心地址 diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/BaseFileMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/BaseFileMapper.xml deleted file mode 100644 index 919f43e9..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/BaseFileMapper.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - select file_id, file_name, file_address, source_id, remark, attr1, - attr2, attr3, attr4, create_by, create_time, update_by, - update_time from base_file - - - - - - - - - insert into base_file - - file_id, - file_name, - file_address, - source_id, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - - - #{fileId}, - #{fileName}, - #{fileAddress}, - #{sourceId}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time) - VALUES - - ( - #{baseFile.fileId}, - #{baseFile.fileName}, - #{baseFile.fileAddress}, - #{baseFile.sourceId}, - #{baseFile.remark}, - #{baseFile.createBy}, - #{baseFile.createTime} - ) - - - - - update base_file - - file_name = #{fileName}, - file_address = #{fileAddress}, - source_id = #{sourceId}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where file_id = #{fileId} - - - - delete from base_file where file_id = #{fileId} - - - - delete from base_file where file_id in - - #{fileId} - - - - delete from base_file where source_id = #{sourceId} - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml deleted file mode 100644 index e8908a5f..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split, - unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3, - status, parent_order, create_by, create_time, update_by, update_time, prod_type, - factory_code, prod_spc - from pro_order - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into pro_order - - id, - plan_factory_code, - factory_code, - order_type, - order_code, - prod_code, - prod_desc, - quantity, - quantity_split, - unit, - worker_order, - plan_pro_date, - plan_complete, - atrr1, - atrr2, - atrr3, - status, - parent_order, - create_by, - create_time, - update_by, - update_time, - prod_type, - prod_spc, - - - #{id}, - #{planFactoryCode}, - #{factoryCode}, - #{orderType}, - #{orderCode}, - #{prodCode}, - #{prodDesc}, - #{quantity}, - #{quantitySplit}, - #{unit}, - #{workerOrder}, - #{planProDate}, - #{planComplete}, - #{atrr1}, - #{atrr2}, - #{atrr3}, - #{status}, - #{parentOrder}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{prodType}, - #{prodSpc}, - - - - - update pro_order - - plan_factoryCode = #{planFactoryCode}, - factory_code = #{factoryCode}, - order_type = #{orderType}, - order_code = #{orderCode}, - prod_code = #{prodCode}, - prod_desc = #{prodDesc}, - quantity = #{quantity}, - quantity_split = #{quantitySplit}, - unit = #{unit}, - worker_order = #{workerOrder}, - plan_pro_date = #{planProDate}, - plan_complete = #{planComplete}, - atrr1 = #{atrr1}, - atrr2 = #{atrr2}, - atrr3 = #{atrr3}, - status = #{status}, - parent_order = #{parentOrder}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - prod_type = #{prodType}, - prod_spc = #{prodSpc}, - - where id = #{id} - - - update pro_order - - quantity_split += #{atrr1}, - quantity_split = #{atrr1}, - update_by = #{updateBy}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - update pro_order set quantity_split = quantity_split-#{worker.quantitySplit}, - update_time = GETDATE() - where id = #{worker.orderId} - - - - - delete from pro_order where id = #{id} - - - - delete from pro_order where id in - - #{id} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderBatchMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderBatchMapper.xml deleted file mode 100644 index f82c4367..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderBatchMapper.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - select batch_id, workorder_id, batch_code, batch_quantity, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code from pro_order_workorder_batch - - - - - - - - insert into pro_order_workorder_batch - - batch_id, - workorder_id, - batch_code, - batch_quantity, - status, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - prod_type, - factory_code, - - - #{batchId}, - #{workorderId}, - #{batchCode}, - #{batchQuantity}, - #{status}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{prodType}, - #{factoryCode}, - - - - - update pro_order_workorder_batch - - batch_id = #{batchId}, - batch_code = #{batchCode}, - batch_quantity = #{batchQuantity}, - status = #{status}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - prod_type = #{prodType}, - factory_code = #{factoryCode}, - - where workorder_id = #{workorderId} - - - - delete from pro_order_workorder_batch where workorder_id = #{workorderId} - - - - delete from pro_order_workorder_batch where workorder_id in - - #{workorderId} - - - \ No newline at end of file diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml deleted file mode 100644 index 73f81018..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code , is_end from pro_order_workorder - - - - - - - - - - - - - - - - - - - insert into pro_order_workorder - - workorder_id, - workorder_code, - workorder_name, - order_id, - order_code, - product_id, - product_code, - product_name, - product_spc, - unit, - quantity_produced, - quantity_split, - route_code, - prod_line_code, - product_date, - shift_id, - parent_order, - ancestors, - status, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - prod_type, - factory_code, - is_end, - - - #{workorderId}, - #{workorderCode}, - #{workorderName}, - #{orderId}, - #{orderCode}, - #{productId}, - #{productCode}, - #{productName}, - #{productSpc}, - #{unit}, - #{quantityProduced}, - #{quantitySplit}, - #{routeCode}, - #{prodLineCode}, - #{productDate}, - #{shiftId}, - #{parentOrder}, - #{ancestors}, - #{status}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{prodType}, - #{factoryCode}, - #{isEnd}, - - - - - update pro_order_workorder - - workorder_code = #{workorderCode}, - workorder_name = #{workorderName}, - order_id = #{orderId}, - order_code = #{orderCode}, - product_id = #{productId}, - product_code = #{productCode}, - product_name = #{productName}, - product_spc = #{productSpc}, - unit = #{unit}, - quantity_produced = #{quantityProduced}, - quantity_split = #{quantitySplit}, - route_code = #{routeCode}, - prod_line_code = #{prodLineCode}, - product_date = #{productDate}, - shift_id = #{shiftId}, - parent_order = #{parentOrder}, - ancestors = #{ancestors}, - status = #{status}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - prod_type = #{prodType}, - factory_code = #{factoryCode}, - is_end = #{isEnd}, - - where workorder_id = #{workorderId} - - - - update pro_order_workorder - set status = 'w1' - where workorder_code in - - #{workorderCode} - - - - - delete from pro_order_workorder where workorder_id = #{workorderId} - - - - delete from pro_order_workorder where workorder_id in - - #{workorderId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessContentMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessContentMapper.xml deleted file mode 100644 index 64bac0b4..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessContentMapper.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - select content_id, process_id, order_num, content_text, device, material, doc_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_process_content - - - - - - - - insert into pro_process_content - - content_id, - process_id, - order_num, - content_text, - device, - material, - doc_url, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - - - #{contentId}, - #{processId}, - #{orderNum}, - #{contentText}, - #{device}, - #{material}, - #{docUrl}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update pro_process_content - - process_id = #{processId}, - order_num = #{orderNum}, - content_text = #{contentText}, - device = #{device}, - material = #{material}, - doc_url = #{docUrl}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where content_id = #{contentId} - - - - delete from pro_process_content where content_id = #{contentId} - - - - delete from pro_process_content where content_id in - - #{contentId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessMapper.xml deleted file mode 100644 index e1041e2b..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProProcessMapper.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - select process_id, process_code, process_name, attention, - enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time,split_merge,split_merg_num,sync,work_center,work_time - from pro_process - - - - - - - - - - - - insert into pro_process - - process_id, - process_code, - process_name, - attention, - enable_flag, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - split_merge, - split_merg_num, - sync, - work_center, - work_time, - - - #{processId}, - #{processCode}, - #{processName}, - #{attention}, - #{enableFlag}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{splitMerge}, - #{splitMergNum}, - #{sync}, - #{workCenter}, - #{workTime}, - - - - update pro_process - - process_code = #{processCode}, - process_name = #{processName}, - attention = #{attention}, - enable_flag = #{enableFlag}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - split_merge = #{splitMerge}, - split_merg_num = #{splitMergNum}, - sync = #{sync}, - work_center = #{workCenter}, - work_time = #{workTime}, - - where process_id = #{processId} - - - - delete from pro_process where process_id = #{processId} - - - - delete from pro_process where process_id in - - #{processId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeContentMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeContentMapper.xml deleted file mode 100644 index 602d87ff..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeContentMapper.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - select content_id, recipe_id, order_num, content_text, device, material, - doc_url, remark, attr1, attr2, attr3, attr4, create_by, - create_time, update_by, update_time - from pro_recipe_content - - - - - - - - insert into pro_recipe_content - - content_id, - recipe_id, - order_num, - content_text, - device, - material, - doc_url, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - - - #{contentId}, - #{recipeId}, - #{orderNum}, - #{contentText}, - #{device}, - #{material}, - #{docUrl}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update pro_recipe_content - - recipe_id = #{recipeId}, - order_num = #{orderNum}, - content_text = #{contentText}, - device = #{device}, - material = #{material}, - doc_url = #{docUrl}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where content_id = #{contentId} - - - - delete from pro_recipe_content where content_id = #{contentId} - - - - delete from pro_recipe_content where content_id in - - #{contentId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeMapper.xml deleted file mode 100644 index 4bcf12ad..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRecipeMapper.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - select recipe_id, recipe_code, recipe_name, attention, - enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time,split_merge,split_merg_num,sync,version,work_time - from pro_recipe - - - - - - - - - - - - insert into pro_recipe - - recipe_id, - recipe_code, - recipe_name, - attention, - enable_flag, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - split_merge, - split_merg_num, - sync, - version, - work_time, - - - #{recipeId}, - #{recipeCode}, - #{recipeName}, - #{attention}, - #{enableFlag}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{splitMerge}, - #{splitMergNum}, - #{sync}, - #{version}, - #{workTime}, - - - - update pro_recipe - - recipe_code = #{recipeCode}, - recipe_name = #{recipeName}, - attention = #{attention}, - enable_flag = #{enableFlag}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - split_merge = #{splitMerge}, - split_merg_num = #{splitMergNum}, - sync = #{sync}, - version = #{version}, - work_time = #{workTime}, - - where recipe_id = #{recipeId} - - - - delete from pro_recipe where recipe_id = #{recipeId} - - - - delete from pro_recipe where recipe_id in - - #{recipeId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml deleted file mode 100644 index bcffc636..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - select route_id, route_code, route_name, route_desc, enable_flag, remark, - attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, - route_version,need_check - from pro_route - - - - - - - - - - - - - - insert into pro_route - - route_id, - route_code, - route_name, - route_desc, - enable_flag, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - route_version, - need_check, - - - - #{routeId}, - #{routeCode}, - #{routeName}, - #{routeDesc}, - #{enableFlag}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{routeVersion}, - #{needCheck}, - - - - - update pro_route - - route_code = #{routeCode}, - route_name = #{routeName}, - route_desc = #{routeDesc}, - enable_flag = #{enableFlag}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - route_version = #{routeVersion}, - #{needCheck}, - - where route_id = #{routeId} - - - - delete from pro_route where route_id = #{routeId} - - - - delete from pro_route where route_id in - - #{routeId} - - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml deleted file mode 100644 index 3e435856..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select record_id, route_id, process_id, process_code, process_name, order_num, next_process_id, next_process_code, next_process_name, link_type, default_pre_time, default_suf_time, color_code,key_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_process - - - - - - - - - - - - - - - - - - - insert into pro_route_process - - record_id, - route_id, - process_id, - process_code, - process_name, - order_num, - next_process_id, - next_process_code, - next_process_name, - link_type, - default_pre_time, - default_suf_time, - color_code, - key_flag, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - - - #{recordId}, - #{routeId}, - #{processId}, - #{processCode}, - #{processName}, - #{orderNum}, - #{nextProcessId}, - #{nextProcessCode}, - #{nextProcessName}, - #{linkType}, - #{defaultPreTime}, - #{defaultSufTime}, - #{colorCode}, - #{keyFlag}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update pro_route_process - - route_id = #{routeId}, - process_id = #{processId}, - process_code = #{processCode}, - process_name = #{processName}, - order_num = #{orderNum}, - next_process_id = #{nextProcessId}, - next_process_code = #{nextProcessCode}, - next_process_name = #{nextProcessName}, - link_type = #{linkType}, - default_pre_time = #{defaultPreTime}, - default_suf_time = #{defaultSufTime}, - key_flag = #{keyFlag}, - color_code = #{colorCode}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where record_id = #{recordId} - - - - delete from pro_route_process where record_id = #{recordId} - - - - delete from pro_route_process where record_id in - - #{recordId} - - - - delete from pro_route_process where route_id = #{routeId} - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProductMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProductMapper.xml deleted file mode 100644 index d2d29a52..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProductMapper.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - select record_id, route_id, item_id, item_code, item_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_product - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into pro_route_product - - record_id, - route_id, - item_id, - item_code, - item_name, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - - - #{recordId}, - #{routeId}, - #{itemId}, - #{itemCode}, - #{itemName}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update pro_route_product - - route_id = #{routeId}, - item_id = #{itemId}, - item_code = #{itemCode}, - item_name = #{itemName}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where record_id = #{recordId} - - - - delete from pro_route_product where record_id = #{recordId} - - - - delete from pro_route_product where record_id in - - #{recordId} - - - - delete from pro_route_product where route_id = #{routeId} - - diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanDetailMapper.xml deleted file mode 100644 index 59176350..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanDetailMapper.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, factory_code, wet_material_plan_id, workorder_id, atrr1, atrr2, atrr3, status, create_by, create_time, update_by, update_time, bucket_id, bucket_code, material_code, material_id, material_name, product_name, shift_id, shift_code, shift_desc, plan_time from pro_wet_material_plan_detail - - - - - - - - - - insert into pro_wet_material_plan_detail - - id, - factory_code, - wet_material_plan_id, - workorder_id, - atrr1, - atrr2, - atrr3, - status, - create_by, - create_time, - update_by, - update_time, - bucket_id, - bucket_code, - material_code, - material_id, - material_name, - product_name, - shift_id, - shift_code, - shift_desc, - plan_time, - - - #{id}, - #{factoryCode}, - #{wetMaterialPlanId}, - #{workorderId}, - #{atrr1}, - #{atrr2}, - #{atrr3}, - #{status}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{bucketId}, - #{bucketCode}, - #{materialCode}, - #{materialId}, - #{materialName}, - #{productName}, - #{shiftId}, - #{shiftCode}, - #{shiftDesc}, - #{planTime}, - - - - - update pro_wet_material_plan_detail - - factory_code = #{factoryCode}, - wet_material_plan_id = #{wetMaterialPlanId}, - workorder_id = #{workorderId}, - atrr1 = #{atrr1}, - atrr2 = #{atrr2}, - atrr3 = #{atrr3}, - status = #{status}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - bucket_id = #{bucketId}, - bucket_code = #{bucketCode}, - material_code = #{materialCode}, - material_id = #{materialId}, - material_name = #{materialName}, - product_name = #{productName}, - shift_id = #{shiftId}, - shift_code = #{shiftCode}, - shift_desc = #{shiftDesc}, - plan_time = #{planTime}, - - where id = #{id} - - - - delete from pro_wet_material_plan_detail where id = #{id} - - - - delete from pro_wet_material_plan_detail where id in - - #{id} - - - \ No newline at end of file diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanMapper.xml deleted file mode 100644 index cf67e83a..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProWetMaterialPlanMapper.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time, order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status, prod_type, plan_code, shift_id, shift_desc from pro_wet_material_plan - - - - - - - - - - - - - - - - - - - - - - insert into pro_wet_material_plan - - id, - factory_code, - plan_time, - sync_flag, - create_by, - create_time, - update_by, - update_time, - order_type, - prod_code, - prod_desc, - prod_source, - quantity, - unit, - atrr1, - atrr2, - atrr3, - status, - prod_type, - plan_code, - shift_id, - shift_desc, - - - #{id}, - #{factoryCode}, - #{planTime}, - #{syncFlag}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{orderType}, - #{prodCode}, - #{prodDesc}, - #{prodSource}, - #{quantity}, - #{unit}, - #{atrr1}, - #{atrr2}, - #{atrr3}, - #{status}, - #{prodType}, - #{planCode}, - #{shiftId}, - #{shiftDesc}, - - - - - update pro_wet_material_plan - - factory_code = #{factoryCode}, - plan_time = #{planTime}, - sync_flag = #{syncFlag}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - order_type = #{orderType}, - prod_code = #{prodCode}, - prod_desc = #{prodDesc}, - prod_source = #{prodSource}, - quantity = #{quantity}, - unit = #{unit}, - atrr1 = #{atrr1}, - atrr2 = #{atrr2}, - atrr3 = #{atrr3}, - status = #{status}, - prod_type = #{prodType}, - plan_code = #{planCode}, - plan_code = #{shiftId}, - plan_code = #{shiftDesc}, - - where id = #{id} - - - - delete from pro_wet_material_plan where id = #{id} - - - - delete from pro_wet_material_plan where id in - - #{id} - - - \ No newline at end of file diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml deleted file mode 100644 index b7188440..00000000 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProWorkorderProcessDetailMapper.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select record_id, workorder_id, process_id, status, remark, - attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time, prod_type, factory_code, machine_id, - machine_code, route_id, route_version, route_code , - next_process_id,order_num - from pro_workorder_process_detail - - - - - - - - - insert into pro_workorder_process_detail - - record_id, - workorder_id, - process_id, - status, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - update_by, - update_time, - prod_type, - factory_code, - machine_id, - machine_code, - route_id, - route_version, - route_code, - next_process_id, - order_num, - - - #{recordId}, - #{workorderId}, - #{processId}, - #{status}, - #{remark}, - #{attr1}, - #{attr2}, - #{attr3}, - #{attr4}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{prodType}, - #{factoryCode}, - #{machineId}, - #{machineCode}, - #{routeId}, - #{routeVersion}, - #{routeCode}, - #{nextProcessId}, - #{orderNum}, - - - - - insert into pro_workorder_process_detail - - record_id, - workorder_id, - process_id, - status, - remark, - attr1, - attr2, - attr3, - attr4, - create_by, - create_time, - prod_type, - factory_code, - machine_id, - machine_code, - route_id, - route_version, - route_code, - next_process_id, - order_num, - - - #{process.recordId}, - #{process.workorderId}, - #{process.processId}, - #{process.status}, - #{process.remark}, - #{process.attr1}, - #{process.attr2}, - #{process.attr3}, - #{process.attr4}, - #{process.createBy}, - #{process.createTime}, - #{process.prodType}, - #{process.factoryCode}, - #{process.machineId}, - #{process.machineCode}, - #{process.routeId}, - #{process.routeVersion}, - #{process.routeCode}, - #{process.nextProcessId}, - #{process.orderNum}, - - - - - - - update pro_workorder_process_detail - - workorder_id = #{workorderId}, - process_id = #{processId}, - status = #{status}, - remark = #{remark}, - attr1 = #{attr1}, - attr2 = #{attr2}, - attr3 = #{attr3}, - attr4 = #{attr4}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - prod_type = #{prodType}, - factory_code = #{factoryCode}, - machine_id = #{machineId}, - machine_code = #{machineCode}, - route_id = #{routeId}, - route_version = #{routeVersion}, - route_code = #{routeCode}, - next_process_id=#{nextProcessId}, - order_num=#{orderNum}, - - where record_id = #{recordId} - - - - delete from pro_workorder_process_detail where record_id = #{recordId} - - - - delete from pro_workorder_process_detail where record_id in - - #{recordId} - - - diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index 41217a90..fe8eaae6 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -218,4 +218,15 @@ public class ProOrderController extends BaseController { return toAjax(proOrderService.deleteProOrderByIds(ids)); } + /** + * 同步SAP订单 + * @param + * @return + */ + @Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT) + @PostMapping("/syncSAP") + public AjaxResult syncSAP() { + return proOrderService.syncSAP(); + } + } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java index 46d7adc2..29b745f4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.ProWetMaterialPlanDetail; +import com.op.system.api.RemoteUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.op.common.log.annotation.Log; @@ -175,4 +176,18 @@ public class ProWetMaterialPlanController extends BaseController { public AjaxResult remove(@PathVariable String[] ids) { return toAjax(proWetMaterialPlanService.deleteProWetMaterialPlanByIds(ids)); } + /** + * 提交湿料计划同步WCS + * @param + * @return + */ + @Log(title = "湿料计划同步", businessType = BusinessType.EXPORT) + @PostMapping("/syncWCS") + @RequiresPermissions("mes:plan:add") + public AjaxResult syncWCS(@PathVariable String[] ids) { + if(ids==null||ids.length==0){ + return error("没有获取到湿料计划"); + } + return proWetMaterialPlanService.syncWCS(ids); + } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java new file mode 100644 index 00000000..d080dcd2 --- /dev/null +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java @@ -0,0 +1,67 @@ +package com.op.plan.domain.dto; + +import java.util.Date; +import java.util.List; + +public class WCSDTO { + + private String reqCode; + + private Date reqTime; + + private String planNo; + + private String code; + + private String message; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + private List data; + + public String getReqCode() { + return reqCode; + } + + public void setReqCode(String reqCode) { + this.reqCode = reqCode; + } + + public Date getReqTime() { + return reqTime; + } + + public void setReqTime(Date reqTime) { + this.reqTime = reqTime; + } + + public String getPlanNo() { + return planNo; + } + + public void setPlanNo(String planNo) { + this.planNo = planNo; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataDTO.java new file mode 100644 index 00000000..37b9d225 --- /dev/null +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataDTO.java @@ -0,0 +1,37 @@ +package com.op.plan.domain.dto; + + +import java.util.List; + +public class WCSDataDTO { + + private String sku; + + private String loadNo; + + private List unLoadItems; + + public String getSku() { + return sku; + } + + public void setSku(String sku) { + this.sku = sku; + } + + public String getLoadNo() { + return loadNo; + } + + public void setLoadNo(String loadNo) { + this.loadNo = loadNo; + } + + public List getUnLoadItems() { + return unLoadItems; + } + + public void setUnLoadItems(List unLoadItems) { + this.unLoadItems = unLoadItems; + } +} diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataItemsDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataItemsDTO.java new file mode 100644 index 00000000..2dcbd981 --- /dev/null +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDataItemsDTO.java @@ -0,0 +1,15 @@ +package com.op.plan.domain.dto; + + +public class WCSDataItemsDTO { + + private String unloadNo; + + public String getUnloadNo() { + return unloadNo; + } + + public void setUnloadNo(String unloadNo) { + this.unloadNo = unloadNo; + } +} diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java index 35c11700..ecc52c18 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java @@ -8,6 +8,7 @@ import com.op.plan.domain.ProOrder; import com.op.plan.domain.ProShift; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.plan.domain.*; +import com.op.system.api.model.SapProOrder; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -151,7 +152,9 @@ public interface ProOrderMapper { * @param shiftId * @return */ - String selectShiftNameById(String shiftId); + public String selectShiftNameById(String shiftId); + + public SapProOrder getMaxCreatetime(); /** * 通过订单编码查询订单信息 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java index 7162a7dd..44685911 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java @@ -83,4 +83,6 @@ public interface ProWetMaterialPlanDetailMapper { * @return */ List selectProWetMaterialPlanDetailByOrderId(String id); + + List selectDetailListById(String id); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java index 62d2bba0..f55046c4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java @@ -111,6 +111,8 @@ public interface IProOrderService { void shopOrderSync(List proOrderList); + public AjaxResult syncSAP(); + /** * 处理表格信息 * @param orderList diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java index bc87d02a..5b1c78b2 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java @@ -7,6 +7,7 @@ import com.op.common.core.web.domain.AjaxResult; import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.ProWetMaterialPlan; import com.op.plan.domain.ProWetMaterialPlanDetail; +import org.springframework.web.bind.annotation.PathVariable; /** * 湿料计划管理Service接口 @@ -124,4 +125,6 @@ public interface IProWetMaterialPlanService { * @return */ AjaxResult checkChangePlan(String id); + + AjaxResult syncWCS(@PathVariable String[] ids); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 0e1c4699..800bdcda 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -1,17 +1,17 @@ package com.op.plan.service.impl; import java.util.*; +import java.util.stream.Collectors; import com.alibaba.csp.sentinel.util.StringUtil; import com.baomidou.dynamic.datasource.annotation.DS; -import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.context.SecurityContextHolder; +import com.op.common.core.domain.R; import com.op.common.core.exception.CheckedException; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; -import com.op.common.log.enums.BusinessType; import com.op.plan.domain.*; import com.op.plan.domain.dto.ProOrderDTO; import com.op.plan.domain.dto.SplitOrderDTO; @@ -19,17 +19,18 @@ import com.op.plan.domain.vo.LineAndShiftVo; import com.op.plan.mapper.ProOrderWorkorderBatchMapper; import com.op.plan.mapper.ProOrderWorkorderMapper; import com.op.plan.mapper.ProRouteMapper; +import com.op.system.api.RemoteSapService; +import com.op.system.api.model.SapProOrder; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.plan.mapper.ProOrderMapper; import com.op.plan.service.IProOrderService; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; - import javax.servlet.http.HttpServletRequest; - import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.success; @@ -50,6 +51,9 @@ public class ProOrderServiceImpl implements IProOrderService { @Autowired private ProRouteMapper proRouteMapper; + @Autowired + private RemoteSapService remoteSapService; + /** * 获取换算值 * @@ -214,7 +218,7 @@ public class ProOrderServiceImpl implements IProOrderService { @Override public void shopOrderSync(List proOrderList) { - for (ProOrder proOrder : proOrderList) { + for (ProOrder proOrder:proOrderList) { String shopOrder = proOrder.getOrderCode(); if (StringUtil.isBlank(shopOrder)) { throw new CheckedException("订单号不能为空!"); @@ -226,6 +230,62 @@ public class ProOrderServiceImpl implements IProOrderService { } } + /** + * 手动同步sap订单 + */ + @Override + @Transactional(rollbackFor = Exception.class) + @DS("#header.poolName") + public AjaxResult syncSAP() { + SapProOrder sapqo = proOrderMapper.getMaxCreatetime(); + if(sapqo == null){ + sapqo.setCreateTime(DateUtils.getNowDate()); + } + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + sapqo.setFactoryCode(request.getHeader(key.substring(8))); + + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo); + List newOrders = rSapProOrder.getData(); + ProOrder proOrder = null; + for(SapProOrder sapProOrder:newOrders){ + //工单下达后整个订单就被锁定//订单存在就更新,不存在就插入 + proOrder = new ProOrder(); + BeanUtils.copyProperties(sapProOrder, proOrder); + //pro_order_workorder + List orderExit = proOrderMapper.selectProOrderList(proOrder); + if(CollectionUtils.isEmpty(orderExit)){//不存在就插入 + proOrderMapper.insertProOrder(proOrder); + }else if("w0".equals(orderExit.get(0).getStatus())){ + //如果工单没下达,则更新pro_order + proOrderMapper.updateProOrder(proOrder); + List orderCodes = this.getListByPCode(proOrder); + if(!CollectionUtils.isEmpty(orderCodes)){ + List idstr = orderCodes.stream().map(order->order.getId()).collect(Collectors.toList()); + String [] ids = idstr.stream().toArray(String[]::new); + //删除工单pro_order_workorder + proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(ids); + //删除批次pro_order_workorder_batch + proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(ids); + } + }else if("w1".equals(orderExit.get(0).getStatus())){ + //TODO;不更新 + } + } + return success(); + } + //父查子递归 + public List getListByPCode(ProOrder pOrder) { + List codeList = new ArrayList<>(); + codeList.add(pOrder); + List sonOrder = proOrderMapper.selectChildProOrderByCode(pOrder.getOrderCode()); + if (!CollectionUtils.isEmpty(sonOrder)) { + getListByPCode(sonOrder.get(0)); + } + return codeList; + } + /** * 处理表格信息 * diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java index 2044155a..b1cabfc6 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java @@ -2,15 +2,21 @@ package com.op.plan.service.impl; import java.util.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.http.HttpUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.plan.domain.*; +import com.op.plan.domain.dto.WCSDTO; import com.op.plan.mapper.ProOrderWorkorderMapper; import com.op.plan.mapper.ProWetMaterialPlanDetailMapper; +import com.op.system.api.RemoteSapService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.op.plan.mapper.ProWetMaterialPlanMapper; import com.op.plan.service.IProWetMaterialPlanService; @@ -19,6 +25,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import org.springframework.web.bind.annotation.PathVariable; import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.success; @@ -38,6 +45,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService @Autowired private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; + @Value("${wcs.url1}") + public String requestMaterialLoadNoUrl; /** * 查询湿料计划管理 * @@ -271,6 +280,48 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService return success(); } + /** + * 同步wcs湿料计划 + * @param + * @return + * { + * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", + * "reqTime": "2023-06-30 21:24:04", + * "planNo": "p123", + * "data": [ + * { + * "sku": "sku01",//物料 + * "loadNo": "A1",//料罐 + * "unLoadItems": [ + * { + * "unloadNo": "B1"//成型机 + * }, + * { + * "unloadNo": "B2" + * } + * ] + * } + * ] + * } + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult syncWCS(@PathVariable String[] ids) { + String successid = ""; + for(String id:ids){ + //获取湿料计划 + WCSDTO wcsdto = new WCSDTO(); + wcsdto.setReqCode(id);//主计划id + wcsdto.setReqTime(DateUtils.getNowDate()); + List planDetails = proWetMaterialPlanDetailMapper.selectDetailListById(id); + + + String sendResult = HttpUtils.sendPost(requestMaterialLoadNoUrl, JSON.toJSONString(wcsdto)); + WCSDTO resultdto = JSON.parseObject(sendResult,WCSDTO.class); + } + return success(successid+"同步成功"); + } + /** * 创建湿料(主)计划 * @@ -359,4 +410,10 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService return detail; } + public static void main(String args[]){ + String s2="{\"reqTime\":\"2022-07-10 19:39:07.377\",\"reqCode\":\"dbee4f0c-ced7-463f-b19b-c83234cbd5b0\"}"; + WCSDTO ps2= JSON.parseObject(s2,WCSDTO.class); + System.out.println(ps2); + + } } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index 82a9a9fc..f88978cf 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -128,6 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM base_shifts_t bst WHERE bst.Shift_Id = #{shiftId} + + insert into pro_wet_material_plan_detail diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml index 0cdb35b6..edf015f1 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml @@ -30,7 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time, order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status, prod_type, plan_code, shift_id, shift_desc from pro_wet_material_plan + select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time, + order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status, + prod_type, plan_code, shift_id, shift_desc from pro_wet_material_plan