| | |
| | | "name": "åææ°ç«ç¬MESæ°æ®åºè®¾è®¡", |
| | | "describe": "æè¿°åèªæ°ç«ç¬MESæ°æ®åºè®¾è®¡è¯¦æ
", |
| | | "avatar": "", |
| | | "version": "4.9.4", |
| | | "version": "4.9.2", |
| | | "createdTime": "2025-3-10 16:38:19", |
| | | "updatedTime": "2025-8-7 10:18:16", |
| | | "updatedTime": "2025-8-12 12:29:31", |
| | | "dbConns": [], |
| | | "profile": { |
| | | "default": { |
| | |
| | | "extProps": {}, |
| | | "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", |
| | | "id": "6E75C587-8628-4A76-BE8A-07CB2185F61B" |
| | | }, |
| | | { |
| | | "defKey": "qualified_quantity", |
| | | "defName": "åæ ¼æ°é", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E", |
| | | "extProps": {}, |
| | | "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", |
| | | "id": "B4405701-40E7-4987-B540-759F22DC5A91" |
| | | }, |
| | | { |
| | | "defKey": "scrap_quantity", |
| | | "defName": "æ¥åºæ°é", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E", |
| | | "extProps": {}, |
| | | "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", |
| | | "id": "48F2218D-6129-47BF-85BA-72737EEDCCAC" |
| | | }, |
| | | { |
| | | "defKey": "remark", |
| | |
| | | "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098", |
| | | "extProps": {}, |
| | | "uiHint": "642D2E0A-8846-4549-BE56-8C0473F26EDE" |
| | | }, |
| | | { |
| | | "defKey": "open_id", |
| | | "defName": "é£ä¹¦ç¨æ·OPENID", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E", |
| | | "id": "BDE72375-D196-41E2-A887-59B59C9A9479" |
| | | } |
| | | ], |
| | | "indexes": [ |
| | |
| | | "hideInGraph": true |
| | | } |
| | | ], |
| | | "correlations": [] |
| | | "correlations": [], |
| | | "notes": {} |
| | | }, |
| | | { |
| | | "id": "ADF40C7F-5C97-4196-BCA7-E780FCC8E2FB", |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web-services</artifactId> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.cxf</groupId>--> |
| | | <!-- <artifactId>cxf-spring-boot-starter-jaxws</artifactId>--> |
| | | <!-- <version>${cxf.version}</version>--> |
| | | <!-- </dependency>--> |
| | | <dependency> |
| | | <groupId>org.apache.cxf</groupId> |
| | | <artifactId>cxf-spring-boot-starter-jaxws</artifactId> |
| | | <version>${cxf.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- CXF webservice --> |
| | | <dependency> |
| | |
| | | package org.jeecg; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration; |
| | | import org.flowable.spring.boot.eventregistry.EventRegistryServicesAutoConfiguration; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.springframework.boot.SpringApplication; |
| | |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, MongoAutoConfiguration.class, |
| | | ManagementWebSecurityAutoConfiguration.class, EventRegistryServicesAutoConfiguration.class}) |
| | | ManagementWebSecurityAutoConfiguration.class, EventRegistryServicesAutoConfiguration.class, |
| | | CxfAutoConfiguration.class}) |
| | | public class JeecgSystemApplication extends SpringBootServletInitializer { |
| | | |
| | | @Override |
| | |
| | | .groupName("MES模å"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiWMS") |
| | | public Docket defaultApiWMS() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | //æ¤å
è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.wms")) |
| | | //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("WMS模å"); |
| | | } |
| | | |
| | | /*** |
| | | * oauth2é
ç½® |
| | | * éè¦å¢å swaggerææåè°å°å |
| | |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "产线表éå", notes = "产线表éå") |
| | | @GetMapping(value = "/queryTreeAppList") |
| | | public Result<List<FactoryModel>> queryTreeAppList() { |
| | | Result<List<FactoryModel>> result = new Result<>(); |
| | | try { |
| | | List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>() |
| | | .eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0) |
| | | .orderByAsc(Factory::getSorter)); |
| | | |
| | | List<FactoryModel> factoryModels = factoryList.stream() |
| | | .map(factory -> new FactoryModel(factory.getId(), factory.getFactoryName())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | result.setSuccess(true); |
| | | result.setResult(factoryModels); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | @ApiOperation(value = "è·åææäº§çº¿å表", notes = "è·åææäº§çº¿å表") |
| | | @GetMapping(value = "/queryUserProductionLineList") |
| | | public Result<List<FactoryModel>> queryUserProductionLineList() { |
| | | List<Factory> factoryList = factoryService.queryUserProductionLineList(); |
| | | List<FactoryModel> factoryModels = factoryList.stream() |
| | | .map(factory -> new FactoryModel(factory.getId(), factory.getFactoryName())) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok(factoryModels); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @Data |
| | | public class FactoryModel { |
| | | // getteråsetteræ¹æ³ |
| | | private String value; // 产线ID |
| | | private String text; // 产线åç§° |
| | | |
| | | public FactoryModel() {} |
| | | public FactoryModel() { |
| | | } |
| | | |
| | | public FactoryModel(String value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | |
| | | // getteråsetteræ¹æ³ |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getText() { |
| | | return text; |
| | | } |
| | | |
| | | public void setText(String text) { |
| | | this.text = text; |
| | | } |
| | | } |
| | |
| | | List<Factory> queryFacByPid(String pid); |
| | | |
| | | List<String> recursionChildren(String factoryId); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¥è¯¢å表 |
| | | * @return |
| | | */ |
| | | List<Factory> queryUserProductionLineList(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.base.entity.Factory; |
| | | import org.jeecg.modules.base.entity.UserFactory; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | |
| | | return this.baseMapper.recursionChildren(factoryId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Factory> queryUserProductionLineList() { |
| | | //ç¨æ·æ°æ®æé |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | String productionIds = sysUser.getProductionIds(); |
| | | if(StringUtils.isBlank(productionIds)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | List<String> list = Arrays.asList(productionIds.split(",")); |
| | | LambdaQueryWrapper<Factory> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0); |
| | | // queryWrapper.eq(Factory::getFactoryCategory, "PRODUCTION_LINE"); |
| | | queryWrapper.in(Factory::getId, list); |
| | | queryWrapper.orderByAsc(Factory::getSorter); |
| | | return super.list(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * æå¼ ç¶èç¹ å 以ä¸çmdcæ è®° |
| | | * @param parentId |
| | |
| | | @PostMapping(value = "/republish") |
| | | public Result<String> republish(@RequestBody MesProductionWorkOrderRepublishRequest request) { |
| | | MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(request.getId()); |
| | | //todo å¤æçæ¬¡æ¯å¦ç»æçé»è¾ |
| | | if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | if (ProductionWorkOrderStatus.NEW.name().equals(workOrder.getWorkOrderStatus()) |
| | | || ProductionWorkOrderStatus.CLOSED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | return Result.error("å½åå·¥åç¶æä¸æ¯æéåå¸ï¼"); |
| | | } |
| | | MesProductionWorkOrder republish = new MesProductionWorkOrder() |
| | |
| | | .setPlanQuantity(request.getPlanQuantity()) |
| | | .setRepublisher(Objects.requireNonNull(getCurrentUser()).getUsername()) |
| | | .setRepublishTime(new Date()) |
| | | .setRepublishReason(request.getRepublishReason()) |
| | | .setWorkOrderStatus(ProductionWorkOrderStatus.REPUBLISHED.name()); |
| | | .setRepublishReason(request.getRepublishReason()); |
| | | mesProductionWorkOrderService.updateById(republish); |
| | | return Result.ok("éå叿åï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "æäº§å·¥å-æ§è¡æäº§å·¥å计å") |
| | | @ApiOperation(value = "æäº§å·¥å-æ§è¡æäº§å·¥å计å", notes = "æäº§å·¥å-æ§è¡æäº§å·¥å计å") |
| | | @GetMapping(value = "/execute") |
| | | public Result<?> execute(@RequestParam("id") String id) { |
| | | MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(id); |
| | | if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | return Result.error("å½åå·¥åç¶æä¸è½æ§è¡ï¼"); |
| | | } |
| | | //todo é½å¥æ§æ£æ¥ãå·¥èºç¹æ£ã设å¤ç¹æ£ çæ ¡éªé»è¾ |
| | | MesProductionWorkOrder executeOrder = new MesProductionWorkOrder() |
| | | .setId(id) |
| | | .setWorkOrderStatus(ProductionWorkOrderStatus.EXECUTING.name()); |
| | | mesProductionWorkOrderService.updateById(executeOrder); |
| | | return Result.ok("æ§è¡æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | |
| | | /**客æ·åç§°*/ |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customer; |
| | | /**åæ ¼æ°é*/ |
| | | @ApiModelProperty(value = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | | /**æ¥åºæ°é*/ |
| | | @ApiModelProperty(value = "æ¥åºæ°é") |
| | | private BigDecimal scrapQuantity; |
| | | /**夿³¨*/ |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | |
| | | @ApiModelProperty(value = "æäº§æ¥æ") |
| | | private Date workOrderDate; |
| | | /**å·¥åç¶æ*/ |
| | | @Excel(name = "å·¥åç¶æ", width = 15, dicCode = "mes_work_order_status") |
| | | @Dict(dicCode = "mes_work_order_status") |
| | | @Excel(name = "å·¥åç¶æ", width = 15, dicCode = "work_order_status") |
| | | @Dict(dicCode = "work_order_status") |
| | | @ApiModelProperty(value = "å·¥åç¶æ") |
| | | private String workOrderStatus; |
| | | /**å®é
æ¥å·¥æ°é*/ |
| | |
| | | */ |
| | | PUBLISHED, |
| | | /** |
| | | * éåå¸ |
| | | * æ§è¡ä¸ |
| | | */ |
| | | REPUBLISHED |
| | | EXECUTING, |
| | | /** |
| | | * å·²å
³é |
| | | */ |
| | | CLOSED |
| | | } |
| | |
| | | @Value("${feishu.appSecret:}") |
| | | private String appSecret; |
| | | |
| | | @Value("${feishu.url:}") |
| | | private String feishuUrl; |
| | | |
| | | /** |
| | | * 忥é£ä¹¦é¨é¨ç¨æ·å°ç³»ç»ç¨æ·è¡¨ |
| | | * @param departmentId é£ä¹¦é¨é¨ID |
| | |
| | | |
| | | private String getFeishuAccessToken() { |
| | | try { |
| | | String url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"; |
| | | String url = feishuUrl + "open-apis/auth/v3/tenant_access_token/internal"; |
| | | |
| | | log.info("å¼å§è·åé£ä¹¦è®¿é®ä»¤çï¼AppId: {}", |
| | | appId != null ? appId.substring(0, Math.min(appId.length(), 10)) + "..." : "null"); |
| | |
| | | log.info("使ç¨ç访é®ä»¤çåç¼: Bearer {}", accessToken.substring(0, Math.min(20, accessToken.length())) + "..."); |
| | | |
| | | // é£ä¹¦APIç«¯ç¹ |
| | | String url = "https://open.feishu.cn/open-apis/contact/v3/users/find_by_department"; |
| | | String url = feishuUrl + "open-apis/contact/v3/users/find_by_department"; |
| | | |
| | | String pageToken = null; |
| | | int pageNumber = 1; |
| | |
| | | public static final String ZMES_GOODSMVT_CREATE_2301 = "ZMES_GOODSMVT_CREATE_2301"; |
| | | //6.ç产订åå
³éæ¥å£ |
| | | public static final String ZPPF_019 = "ZPPF_019"; |
| | | //7.SAPé¢çå·å建æ¥å£ |
| | | public static final String ZMES_RESERVATION_CREATE = "ZMES_RESERVATION_CREATE"; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.sap.request.MaterialRequest; |
| | | import org.jeecg.modules.sap.request.OrderLoadRequest; |
| | | import org.jeecg.modules.sap.request.OrderReportRequest; |
| | | import org.jeecg.modules.sap.request.ProductionOrderSyncRequest; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api(tags = "SAPéææµè¯") |
| | |
| | | private OrderLoadService orderLoadService; |
| | | @Autowired |
| | | private OrderCloseService orderCloseService; |
| | | @Autowired |
| | | private OrderMaterialRequestService orderMaterialRequestService; |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-ç产订å忥æ¥å£", notes = "SAPéææµè¯-ç产订å忥æ¥å£") |
| | | @PostMapping("/syncProductionOrder") |
| | |
| | | Map<String, Object> resultMap = orderCloseService.productionOrderClose(orderCode); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-ç©ææå¨", notes = "SAPéææµè¯-ç©ææå¨") |
| | | @PostMapping("/orderMaterialRequest") |
| | | public Result<?> orderMaterialRequest(@RequestParam(value = "factoryCode") String factoryCode, @RequestParam(value = "warehouseCode") String warehouseCode, @RequestBody List<MaterialRequest> request) throws Exception { |
| | | // String orderCode = "10698749"; |
| | | Map<String, Object> resultMap = orderMaterialRequestService.orderMaterialRequest(factoryCode, warehouseCode, request); |
| | | return Result.ok(resultMap); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.sap.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MaterialRequestDTO { |
| | | /** æåæ è®° Y-OK N-NG */ |
| | | private String O_IS_OK; |
| | | /** é¢ç/ç¸å
³éæ±çç¼å· */ |
| | | private String O_SAP_RESV; |
| | | /** æ¶æ¯ææ¬ */ |
| | | private String O_MESSAGE; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.sap.request; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class MaterialRequest implements Serializable { |
| | | /** ç©æå· */ |
| | | private String materialNumber; |
| | | /** æ°é */ |
| | | private BigDecimal quantity; |
| | | /** åè´§åºåå°ç¹ */ |
| | | private String warehouseCode; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.sap.service; |
| | | |
| | | import org.jeecg.modules.sap.request.MaterialRequest; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ç©ææå¨ï¼é¢çå·è¯·æ± |
| | | */ |
| | | public interface OrderMaterialRequestService { |
| | | /** |
| | | * ç©ææå¨è¯·æ± |
| | | * @param factoryCode å·¥åç¼ç |
| | | * @param receiveWarehouseCode æ¥æ¶åºåå°ç¹ |
| | | * @param request ç©ææå¨ä¿¡æ¯ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> orderMaterialRequest(String factoryCode, String receiveWarehouseCode, List<MaterialRequest> request) throws Exception; |
| | | } |
| | |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.OrderLoadDTO; |
| | | import org.jeecg.modules.sap.dto.OrderReportDTO; |
| | | import org.jeecg.modules.sap.request.OrderLoadRequest; |
| | | import org.jeecg.modules.sap.service.OrderLoadService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.sap.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.sap.conn.jco.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.aspect.annotation.ApiLog; |
| | | import org.jeecg.common.constant.ApiLogCategoryEnum; |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.MaterialRequestDTO; |
| | | import org.jeecg.modules.sap.request.MaterialRequest; |
| | | import org.jeecg.modules.sap.service.OrderMaterialRequestService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class OrderMaterialRequestServiceImpl implements OrderMaterialRequestService { |
| | | @Autowired |
| | | private SapRfcConnectionManager connectionManager; |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Override |
| | | @ApiLog(apiName = "SAPé¢çå·å建(ZMES_RESERVATION_CREATE)", apiCategory = ApiLogCategoryEnum.SAP) |
| | | public Map<String, Object> orderMaterialRequest(String factoryCode, String receiveWarehouseCode, List<MaterialRequest> request) throws Exception { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | JCoDestination destination = connectionManager.getDestination(); |
| | | JCoRepository repository = destination.getRepository(); |
| | | JCoFunction function = repository.getFunction(FunctionConst.ZMES_RESERVATION_CREATE); |
| | | if (function == null) { |
| | | throw new RuntimeException("RFC 彿° ZMES_RESERVATION_CREATE æªæ¾å°ï¼"); |
| | | } |
| | | if (StringUtils.isBlank(factoryCode) || StringUtils.isBlank(receiveWarehouseCode) || CollectionUtil.isEmpty(request)) { |
| | | resultMap.put("zmess", "å·¥åç¼ç ãæ¥æ¶åºåå°ä¸ºç©ºæç©æä¿¡æ¯ä¸ºç©º"); |
| | | resultMap.put("ztype", "-1"); |
| | | resultMap.put("importParameters", factoryCode + "|" + receiveWarehouseCode + "|" + (request == null ? 0 : request.size())); |
| | | resultMap.put("result", null); |
| | | return resultMap; |
| | | } |
| | | // 设置è¾å
¥åæ° |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | //æ°ç«ç¬ |
| | | JCoParameterList importParameterList = function.getImportParameterList(); |
| | | importParameterList.setValue("I_SITE", factoryCode); |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("I_SITE", factoryCode); |
| | | items.add(item); |
| | | |
| | | //æ¥æ¶åºåå° |
| | | importParameterList.setValue("I_TO_STORGE_LOC", receiveWarehouseCode); |
| | | //ç»è£
请æ±åæ° |
| | | item = new JSONObject(); |
| | | item.put("I_TO_STORGE_LOC", factoryCode); |
| | | items.add(item); |
| | | |
| | | JCoTable itemTable = function.getTableParameterList().getTable("T_ITEMS"); |
| | | for (MaterialRequest itemReq : request) { |
| | | itemTable.appendRow(); |
| | | itemTable.setValue("ITEM", itemReq.getMaterialNumber()); |
| | | itemTable.setValue("PULL_QTY", itemReq.getQuantity()); |
| | | itemTable.setValue("FROM_STORGE_LOC", itemReq.getWarehouseCode()); |
| | | //ç»è£
请æ±åæ° |
| | | String json = objectMapper.writeValueAsString(itemReq); |
| | | item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | items.add(item); |
| | | } |
| | | |
| | | // æ§è¡è°ç¨ |
| | | function.execute(destination); |
| | | //è·åè¿åç»æ |
| | | MaterialRequestDTO response = new MaterialRequestDTO(); |
| | | String zmess = function.getExportParameterList().getValue("O_IS_OK").toString(); |
| | | String ztype = function.getExportParameterList().getValue("O_MESSAGE").toString();//S æ è¯ æå |
| | | String resv = function.getExportParameterList().getValue("O_SAP_RESV").toString();//S æ è¯ æå |
| | | response.setO_IS_OK(ztype); |
| | | response.setO_MESSAGE(zmess); |
| | | response.setO_SAP_RESV(resv); |
| | | //è¿åç»æ |
| | | resultMap.put("zmess", zmess); |
| | | resultMap.put("ztype", ztype); |
| | | resultMap.put("importParameters", items); |
| | | resultMap.put("result", response); |
| | | return resultMap; |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.sap.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.sap.conn.jco.*; |
| | | import com.sap.conn.jco.JCoDestination; |
| | | import com.sap.conn.jco.JCoFunction; |
| | | import com.sap.conn.jco.JCoRepository; |
| | | import com.sap.conn.jco.JCoTable; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.aspect.annotation.ApiLog; |
| | | import org.jeecg.common.constant.ApiLogCategoryEnum; |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.jeecg.modules.sap.service.OrderProcessSync; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Slf4j |
| | |
| | | import org.apache.cxf.jaxws.EndpointImpl; |
| | | import org.apache.cxf.transport.servlet.CXFServlet; |
| | | import org.jeecg.modules.wms.service.ReceiveWMSScanItemListService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.jeecg.modules.wms.service.impl.ReceiveWMSScanItemListServiceImpl; |
| | | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | |
| | | @Configuration |
| | | public class WebServiceServerConfig { |
| | | @Autowired |
| | | private ReceiveWMSScanItemListService receiveWMSScanItemListService; |
| | | |
| | | @Bean(name = "cxfServer") |
| | | @Bean(name = Bus.DEFAULT_BUS_ID) |
| | | public Bus springBus() { |
| | | return new SpringBus(); |
| | | } |
| | | |
| | | @Bean(name = "cxfServlet") // 注å
¥servlet bean nameä¸è½dispatcherServlet ,å¦åä¼è¦çdispatcherServlet |
| | | public ServletRegistrationBean<CXFServlet> cxfServlet() { |
| | | return new ServletRegistrationBean<CXFServlet>(new CXFServlet(), "/webservice/*"); |
| | | return new ServletRegistrationBean<>(new CXFServlet(), "/webservice/*"); |
| | | } |
| | | |
| | | @Bean |
| | | public ReceiveWMSScanItemListService receiveWMSScanItemListService() { |
| | | return new ReceiveWMSScanItemListServiceImpl(); |
| | | } |
| | | |
| | | @Bean |
| | | public Endpoint endpoint() { |
| | | // åæ°äºï¼æ¯SEIå®ç°ç±»å¯¹è±¡ |
| | | Endpoint endpoint = new EndpointImpl(this.springBus(), receiveWMSScanItemListService); |
| | | Endpoint endpoint = new EndpointImpl(this.springBus(), this.receiveWMSScanItemListService()); |
| | | // åå¸æå¡ |
| | | endpoint.publish("/userService"); |
| | | endpoint.publish("/ReceiveWMSScanItemList"); |
| | | return endpoint; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.wms.dto.ReceiveMESScanItemListResponse; |
| | | import org.jeecg.modules.wms.request.ReceiveMESScanItemList; |
| | | import org.jeecg.modules.wms.service.ReceiveWMSScanItemListService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @Api(tags = "WMSéææµè¯") |
| | | @RestController |
| | | @RequestMapping("/wms/client") |
| | | @Slf4j |
| | | public class WMSTestController { |
| | | @Value("${webservice.url}") |
| | | private String url; |
| | | @Value("${webservice.namespace}") |
| | | private String namespace; |
| | | |
| | | @ApiOperation(value = "WMSéææµè¯-æ¥æ¶WMSç§»åºç»æ", notes = "WMSéææµè¯-æ¥æ¶WMSç§»åºç»æ") |
| | | @PostMapping("/testReceiveWMSScanItemList") |
| | | public Result<?> testReceiveWMSScanItemList() { |
| | | JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); |
| | | factory.setAddress(url); |
| | | factory.setServiceClass(ReceiveWMSScanItemListService.class); |
| | | ReceiveWMSScanItemListService service = (ReceiveWMSScanItemListService) factory.create(); |
| | | ReceiveMESScanItemList request = new ReceiveMESScanItemList(); |
| | | ReceiveMESScanItemListResponse response = service.receiveWMSScanItemList(request); |
| | | return Result.ok(response); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.dto; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import java.io.Serializable; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "ReceiveMESScanItemListResponse") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class ReceiveMESScanItemListResponse implements Serializable { |
| | | @XmlElement(name = "WSResponse") |
| | | private WSResponse wsResponse; |
| | | } |
| | |
| | | package org.jeecg.modules.wms.dto; |
| | | |
| | | public class WSResponse { |
| | | private String ErrorCode; |
| | | private String ErrorDesc; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import java.io.Serializable; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class WSResponse implements Serializable { |
| | | @XmlElement(name = "ErrorCode") |
| | | private String errorCode; |
| | | @XmlElement(name = "ErrorDesc") |
| | | private String errorDesc; |
| | | } |
| | |
| | | package org.jeecg.modules.wms.request; |
| | | |
| | | public class ReceiveMESScanItemList { |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import javax.xml.bind.annotation.*; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "ReceiveMESScanItemList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class ReceiveMESScanItemList implements Serializable { |
| | | |
| | | @XmlElementWrapper(name = "ArrayOfWebServiceSendItem") |
| | | @XmlElement(name = "WebServiceSendItem") |
| | | private List<WebServiceSendItem> items; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.request; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class WebServiceSendItem implements Serializable { |
| | | /**å·¥åç¼ç */ |
| | | @XmlElement(name = "FactoryCode") |
| | | private String factoryCode; |
| | | /** ç©æç¼ç */ |
| | | @XmlElement(name = "SkuCode") |
| | | private String skuCode; |
| | | /** é¢çå· */ |
| | | @XmlElement(name = "ReservationOrder") |
| | | private String reservationOrder; |
| | | /** 坹齿¹å¼ */ |
| | | @XmlElement(name = "Align") |
| | | private String align; |
| | | /** æå· */ |
| | | @XmlElement(name = "Pallet") |
| | | private String pallet; |
| | | /** å
è£
ç¼ç */ |
| | | @XmlElement(name = "PackageNo") |
| | | private String packageNo; |
| | | /** æ¹æ¬¡å· */ |
| | | @XmlElement(name = "TrackLot") |
| | | private String trackLot; |
| | | /** ç³»åå· */ |
| | | @XmlElement(name = "Series") |
| | | private String series; |
| | | /** MESåºåID */ |
| | | @XmlElement(name = "MesStockID") |
| | | private String mesStockID; |
| | | /** æ°é */ |
| | | @XmlElement(name = "Quantity") |
| | | private BigDecimal quantity; |
| | | /** SAPæ¹æ¬¡å· */ |
| | | @XmlElement(name = "SapTrackLot") |
| | | private String sapTrackLot; |
| | | /** åéåºåå° */ |
| | | @XmlElement(name = "Section") |
| | | private String section; |
| | | /** ç®æ åºåå° */ |
| | | @XmlElement(name = "DestSection") |
| | | private String destSection; |
| | | /** ä¾åºå代ç */ |
| | | @XmlElement(name = "SupplierCode") |
| | | private String supplierCode; |
| | | /** ä¾åºåæ¹æ¬¡å· */ |
| | | @XmlElement(name = "SupplierTrackLot") |
| | | private String supplierTrackLot; |
| | | /** é¶æ®µID */ |
| | | @XmlElement(name = "StageID") |
| | | private String stageID; |
| | | /** 夿³¨ */ |
| | | @XmlElement(name = "Remark") |
| | | private String remark; |
| | | /** 订åç¼ç */ |
| | | @XmlElement(name = "OrderCode") |
| | | private String orderCode; |
| | | } |
| | |
| | | package org.jeecg.modules.wms.service; |
| | | |
| | | import org.jeecg.modules.wms.dto.ReceiveMESScanItemListResponse; |
| | | import org.jeecg.modules.wms.request.ReceiveMESScanItemList; |
| | | |
| | | import javax.jws.WebService; |
| | | |
| | | @WebService |
| | | @WebService(name = "ReceiveWMSScanItemList", targetNamespace = "http://xhj008.server.webservice.com") |
| | | public interface ReceiveWMSScanItemListService { |
| | | |
| | | /** |
| | | * æ¥æ¶WMSç§»åºä¿¡æ¯ |
| | | * @param request |
| | | * @return |
| | | */ |
| | | ReceiveMESScanItemListResponse receiveWMSScanItemList(ReceiveMESScanItemList request); |
| | | } |
| | |
| | | package org.jeecg.modules.wms.service.impl; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.aspect.annotation.ApiLog; |
| | | import org.jeecg.common.constant.ApiLogCategoryEnum; |
| | | import org.jeecg.modules.wms.dto.ReceiveMESScanItemListResponse; |
| | | import org.jeecg.modules.wms.request.ReceiveMESScanItemList; |
| | | import org.jeecg.modules.wms.service.ReceiveWMSScanItemListService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.jws.WebService; |
| | | |
| | | |
| | | @WebService(name = "ReceiveWMSScanItemListService", targetNamespace = "http://xhj008.server.webservice.com") |
| | | @Slf4j |
| | | @Service |
| | | //@Service |
| | | @WebService(name = "ReceiveWMSScanItemListService", targetNamespace = "http://xhj008.server.webservice.com", endpointInterface = "org.jeecg.modules.wms.service.ReceiveWMSScanItemListService") |
| | | public class ReceiveWMSScanItemListServiceImpl implements ReceiveWMSScanItemListService { |
| | | |
| | | @Override |
| | | @ApiLog(apiName = "æ¥æ¶WMSçç§»åºä¿¡æ¯(ReceiveWMSScanItemList(MES)", apiCategory = ApiLogCategoryEnum.WMS) |
| | | public ReceiveMESScanItemListResponse receiveWMSScanItemList(ReceiveMESScanItemList request) { |
| | | return new ReceiveMESScanItemListResponse(); |
| | | } |
| | | } |
| | |
| | | poolSize: 5 # çº¿ç¨æ± æ°é |
| | | expirationTime: 10000 # è¿ææ¶é´ |
| | | peekLimit: 10 # å³°å¼ |
| | | feishu: |
| | | url: https://open.feishu.cn/ |
| | | appId: cli_a74aab6353b7d00e |
| | | appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT |
| | | sync: |
| | | departmentId: od-47692f32e6b66cc3985d317fee780a8b |
| | |
| | | lang: ZH # è¯è¨ |
| | | poolSize: 5 # çº¿ç¨æ± æ°é |
| | | expirationTime: 10000 # è¿ææ¶é´ |
| | | peekLimit: 10 # å³°å¼ |
| | | peekLimit: 10 # å³°å¼ |
| | | feishu: |
| | | url: https://open.feishu.cn/ |
| | | appId: cli_a74aab6353b7d00e |
| | | appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT |
| | | sync: |
| | | departmentId: od-47692f32e6b66cc3985d317fee780a8b |