Merge remote-tracking branch 'origin/master'
| | |
| | | "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", |
| | |
| | | <!-- Log4j2çé·æ¼æ´ --> |
| | | <log4j2.version>2.17.0</log4j2.version> |
| | | <logback.version>1.2.9</logback.version> |
| | | <!-- webservice --> |
| | | <cxf.version>3.2.4</cxf.version> |
| | | </properties> |
| | | |
| | | <repositories> |
| | |
| | | <artifactId>java-jwt</artifactId> |
| | | <version>${java-jwt.version}</version> |
| | | </dependency> |
| | | <!-- WebService --> |
| | | <dependency> |
| | | <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>--> |
| | | |
| | | <!-- CXF webservice --> |
| | | <dependency> |
| | | <groupId>org.apache.cxf</groupId> |
| | | <artifactId>cxf-spring-boot-starter-jaxws</artifactId> |
| | | <version>3.2.1</version> |
| | | <version>${cxf.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.cxf</groupId> |
| | | <artifactId>cxf-rt-transports-http</artifactId> |
| | | <version>3.2.1</version> |
| | | <version>${cxf.version}</version> |
| | | </dependency> |
| | | |
| | | <!--shiro--> |
| | |
| | | } catch (JsonProcessingException e) { |
| | | throw new JeecgBootException(e); |
| | | } |
| | | } else { |
| | | try { |
| | | String json = objectMapper.writeValueAsString(result); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | items.add(item); |
| | | } catch (JsonProcessingException e) { |
| | | throw new JeecgBootException(e); |
| | | } |
| | | } |
| | | return items.toString(); |
| | | } |
| | |
| | | .groupName("MDC"); |
| | | } |
| | | |
| | | /** |
| | | * swagger2çé
ç½®æä»¶ï¼è¿éå¯ä»¥é
ç½®swagger2çä¸äºåºæ¬çå
å®¹ï¼æ¯å¦æ«æçå
çç ï¼DNCï¼ |
| | | * |
| | | * @return Docket |
| | | */ |
| | | @Bean(value = "defaultApiDnc") |
| | | public Docket defaultApi3() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | //æ¤å
è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.dnc")) |
| | | //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("DNC"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiAct") |
| | | public Docket activitiApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | |
| | | .groupName("Flowable模å"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiMsi") |
| | | public Docket activitiApiMsi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | //æ¤å
è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.msi")) |
| | | //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("éæ"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiEam") |
| | | public Docket activitiApiEam() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("eam"); |
| | | .groupName("EAM设å¤ç®¡ç"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiSAP") |
| | | public Docket defaultApiSAP() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | //æ¤å
è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.sap")) |
| | | //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("SAP对æ¥"); |
| | | } |
| | | |
| | | @Bean(value = "defaultApiMES") |
| | | public Docket defaultApiMES() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | //æ¤å
è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.mes")) |
| | | //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ |
| | | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .securitySchemes(Collections.singletonList(securityScheme())) |
| | | .securityContexts(securityContexts()) |
| | | .globalOperationParameters(setHeaderToken()) |
| | | .groupName("MES模å"); |
| | | } |
| | | |
| | | /*** |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | import org.jeecg.modules.andon.service.IAndonButtonConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * APPå页å表æ¥è¯¢ |
| | | * |
| | | * @param andonButtonConfig |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="å®ç¯æé®é
ç½®-å页å表æ¥è¯¢", notes="å®ç¯æé®é
ç½®-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/App/list") |
| | | public Result<IPage<AndonButtonConfig>> queryPageAppList(AndonButtonConfig andonButtonConfig, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<AndonButtonConfig> queryWrapper = QueryGenerator.initQueryWrapper(andonButtonConfig, req.getParameterMap()); |
| | | |
| | | // è·åå½åç»å½ç¨æ· |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser != null) { |
| | | // å¢å éè¿ç³»ç»ç»å½äººè¿è¡è¿æ»¤ |
| | | queryWrapper.eq("create_by", sysUser.getUsername()); |
| | | } |
| | | |
| | | Page<AndonButtonConfig> page = new Page<AndonButtonConfig>(pageNo, pageSize); |
| | | IPage<AndonButtonConfig> pageList = andonButtonConfigService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.base.entity.Factory; |
| | | import org.jeecg.modules.base.model.FactoryIdModel; |
| | | import org.jeecg.modules.base.model.FactoryModel; |
| | | import org.jeecg.modules.base.service.IFactoryService; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "è·åææäº§çº¿å表", notes = "è·åææäº§çº¿å表") |
| | | @GetMapping(value = "/queryProductionLineList") |
| | | public Result<List<FactoryModel>> queryProductionLineList() { |
| | | List<Factory> factoryList = factoryService.queryProductionLineList(); |
| | | List<FactoryModel> factoryModels = factoryList.stream() |
| | | .map(factory -> new FactoryModel(factory.getId(), factory.getFactoryName())) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok(factoryModels); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //@AutoLog(value = "产线表-æ¥è¯¢æ å½¢ç»æææäº§çº¿åç§°") |
| | | @ApiOperation(value = "产线表-æ¥è¯¢æ å½¢ç»æææäº§çº¿åç§°", notes = "产线表-æ¥è¯¢æ å½¢ç»æææäº§çº¿åç§°") |
| | | @GetMapping(value = "/queryIdTree") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.base.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FactoryModel { |
| | | // getteråsetteræ¹æ³ |
| | | private String value; // 产线ID |
| | | private String text; // 产线åç§° |
| | | |
| | | public FactoryModel() { |
| | | } |
| | | |
| | | public FactoryModel(String value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | } |
| | |
| | | List<Factory> queryFacByPid(String pid); |
| | | |
| | | List<String> recursionChildren(String factoryId); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¥è¯¢å表 |
| | | * @return |
| | | */ |
| | | List<Factory> queryProductionLineList(); |
| | | } |
| | |
| | | return this.baseMapper.recursionChildren(factoryId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Factory> queryProductionLineList() { |
| | | LambdaQueryWrapper<Factory> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0); |
| | | queryWrapper.eq(Factory::getFactoryCategory, "PRODUCTION_LINE"); |
| | | queryWrapper.orderByAsc(Factory::getSorter); |
| | | return super.list(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * æå¼ ç¶èç¹ å 以ä¸çmdcæ è®° |
| | | * @param parentId |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mes.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FeishuUser { |
| | | private String openId; |
| | | private String name; |
| | | private String username; |
| | | private String realname; |
| | | private String workNo; |
| | | private String password; |
| | | private String userId; // å¯¹åº open_id |
| | | private String unionId; // å¯¹åº union_id |
| | | private String enName; // å¯¹åº en_name |
| | | private String description; // å¯¹åº description |
| | | private String avatar240; // å¯¹åº avatar.avatar_240 |
| | | private String avatar640; // å¯¹åº avatar.avatar_640 |
| | | private String avatar72; // å¯¹åº avatar.avatar_72 |
| | | private String avatarOrigin;// å¯¹åº avatar.avatar_origin |
| | | private String email; |
| | | private String mobile; |
| | | private String employeeNo; |
| | | private Integer status; |
| | | private Boolean mobileVisible; // å¯¹åº mobile_visible |
| | | } |
| | |
| | | /**客æ·åç§°*/ |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customer; |
| | | /**åæ ¼æ°é*/ |
| | | @ApiModelProperty(value = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | | /**æ¥åºæ°é*/ |
| | | @ApiModelProperty(value = "æ¥åºæ°é") |
| | | private BigDecimal scrapQuantity; |
| | | /**夿³¨*/ |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | package org.jeecg.modules.mes.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * é£ä¹¦ç¨æ·åæ¥å®æ¶ä»»å¡ |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FeishuSyncTask implements Job { |
| | | |
| | | @Autowired |
| | | private org.jeecg.modules.mes.job.FeishuUserService feishuUserService; |
| | | |
| | | @Value("${feishu.sync.departmentId:0}") |
| | | private String departmentId; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | log.info("å¼å§æ§è¡é£ä¹¦ç¨æ·åæ¥ä»»å¡"); |
| | | try { |
| | | if (departmentId != null && !"0".equals(departmentId)) { |
| | | feishuUserService.syncFeishuDepartmentUsers(departmentId); |
| | | log.info("é£ä¹¦ç¨æ·åæ¥ä»»å¡æ§è¡å®æ"); |
| | | } else { |
| | | log.warn("æªé
ç½®é£ä¹¦åæ¥é¨é¨IDï¼è·³è¿åæ¥ä»»å¡"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("é£ä¹¦ç¨æ·åæ¥ä»»å¡æ§è¡å¤±è´¥", e); |
| | | throw new JobExecutionException(e); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mes.job; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.PasswordUtil; |
| | | import org.jeecg.common.util.RestUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.mes.entity.FeishuUser; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class FeishuUserService { |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Resource |
| | | private RestTemplate restTemplate; // æ°å¢RestTemplateä¾èµæ³¨å
¥ |
| | | |
| | | @Value("${feishu.appId:}") |
| | | private String appId; |
| | | |
| | | @Value("${feishu.appSecret:}") |
| | | private String appSecret; |
| | | |
| | | @Value("${feishu.url:}") |
| | | private String feishuUrl; |
| | | |
| | | /** |
| | | * 忥é£ä¹¦é¨é¨ç¨æ·å°ç³»ç»ç¨æ·è¡¨ |
| | | * @param departmentId é£ä¹¦é¨é¨ID |
| | | */ |
| | | public void syncFeishuDepartmentUsers(String departmentId) { |
| | | try { |
| | | log.info("å¼å§åæ¥é£ä¹¦é¨é¨ç¨æ·ï¼é¨é¨ID: {}", departmentId); |
| | | |
| | | // 1. è·åé£ä¹¦è®¿é®ä»¤ç |
| | | String accessToken = getFeishuAccessToken(); |
| | | if (oConvertUtils.isEmpty(accessToken)) { |
| | | log.error("è·åé£ä¹¦è®¿é®ä»¤ç失败ï¼ç»æ¢åæ¥æµç¨"); |
| | | return; // 令çè·åå¤±è´¥ç´æ¥è¿åï¼é¿å
åç»æ ææä½ |
| | | } |
| | | |
| | | // 2. è·åé¨é¨ä¸çç¨æ·å表 |
| | | List<FeishuUser> feishuUsers = getDepartmentUsers(accessToken, departmentId); |
| | | log.info("è·åå°é£ä¹¦é¨é¨ç¨æ·æ°é: {}", feishuUsers.size()); |
| | | |
| | | // 3. 忥å°ç³»ç»ç¨æ·è¡¨ |
| | | int successCount = 0; |
| | | int updateCount = 0; |
| | | int addCount = 0; |
| | | |
| | | for (FeishuUser feishuUser : feishuUsers) { |
| | | try { |
| | | boolean isUpdated = syncFeishuUserToSystem(feishuUser); |
| | | successCount++; |
| | | if (isUpdated) { |
| | | updateCount++; |
| | | } else { |
| | | addCount++; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("忥é£ä¹¦ç¨æ·å¤±è´¥ï¼ç¨æ·ID: {}", feishuUser.getUserId(), e); |
| | | } |
| | | } |
| | | |
| | | log.info("é£ä¹¦ç¨æ·åæ¥å®æï¼æ»å¤ç: {}ï¼æ°å¢: {}ï¼æ´æ°: {}", successCount, addCount, updateCount); |
| | | } catch (Exception e) { |
| | | log.error("忥é£ä¹¦é¨é¨ç¨æ·å¤±è´¥ï¼é¨é¨ID: {}", departmentId, e); |
| | | throw new RuntimeException("忥é£ä¹¦ç¨æ·å¤±è´¥: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private String getFeishuAccessToken() { |
| | | try { |
| | | 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"); |
| | | |
| | | JSONObject params = new JSONObject(); |
| | | params.put("app_id", appId); |
| | | params.put("app_secret", appSecret); |
| | | |
| | | log.debug("è·å令ç请æ±åæ°: {}", params.toJSONString()); |
| | | |
| | | JSONObject result = RestUtil.post(url, params); |
| | | |
| | | log.info("è·åé£ä¹¦è®¿é®ä»¤çååº: {}", result != null ? result.toJSONString() : "null"); |
| | | |
| | | if (result != null && result.getInteger("code") == 0) { |
| | | String accessToken = result.getString("tenant_access_token"); |
| | | log.info("æåè·åé£ä¹¦è®¿é®ä»¤çï¼ä»¤çé¿åº¦: {}", accessToken != null ? accessToken.length() : 0); |
| | | return accessToken; |
| | | } else { |
| | | log.error("è·åé£ä¹¦è®¿é®ä»¤ç失败ï¼ååº: {}", result != null ? result.toJSONString() : "null"); |
| | | if (result != null) { |
| | | log.error("é误ç : {}, é误信æ¯: {}", result.getInteger("code"), result.getString("msg")); |
| | | } |
| | | return null; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("è·åé£ä¹¦è®¿é®ä»¤çå¼å¸¸", e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åé¨é¨ç¨æ·å表ï¼ç´å±åå·¥ï¼ |
| | | */ |
| | | private List<FeishuUser> getDepartmentUsers(String accessToken, String departmentId) { |
| | | List<FeishuUser> userList = new ArrayList<>(); |
| | | try { |
| | | log.info("å¼å§è·åé£ä¹¦é¨é¨ç¨æ·å表ï¼é¨é¨ID: {}", departmentId); |
| | | |
| | | // éªè¯è®¿é®ä»¤ç |
| | | if (accessToken == null || accessToken.isEmpty()) { |
| | | log.error("访é®ä»¤çä¸ºç©ºï¼æ æ³ç»§ç»æ§è¡"); |
| | | return userList; |
| | | } |
| | | log.info("使ç¨ç访é®ä»¤çåç¼: Bearer {}", accessToken.substring(0, Math.min(20, accessToken.length())) + "..."); |
| | | |
| | | // é£ä¹¦APIç«¯ç¹ |
| | | String url = feishuUrl + "open-apis/contact/v3/users/find_by_department"; |
| | | |
| | | String pageToken = null; |
| | | int pageNumber = 1; |
| | | |
| | | do { |
| | | // æå»ºè¯·æ±URLååæ° |
| | | StringBuilder urlBuilder = new StringBuilder(url); |
| | | urlBuilder.append("?department_id=").append(departmentId); |
| | | urlBuilder.append("&department_id_type=open_department_id"); |
| | | urlBuilder.append("&page_size=50"); |
| | | urlBuilder.append("&user_id_type=open_id"); |
| | | |
| | | if (pageToken != null && !pageToken.isEmpty()) { |
| | | urlBuilder.append("&page_token=").append(pageToken); |
| | | } |
| | | |
| | | log.info("请æ±ç¬¬{}é¡µæ°æ®ï¼URL: {}", pageNumber, urlBuilder.toString()); |
| | | |
| | | // 设置请æ±å¤´ - å
³é®ä¿®å¤ç¹ï¼ä½¿ç¨HttpHeadersç¡®ä¿å¤´ä¿¡æ¯æ£ç¡®è®¾ç½® |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | String authHeader = "Bearer " + accessToken; |
| | | headers.add("Authorization", authHeader); |
| | | headers.add("Content-Type", "application/json; charset=utf-8"); |
| | | log.info("设置请æ±å¤´: Authorization = {}", authHeader.substring(0, Math.min(30, authHeader.length())) + "..."); |
| | | |
| | | // 使ç¨RestTemplateåé请æ±ï¼ç¡®ä¿å¤´ä¿¡æ¯è¢«æ£ç¡®ä¼ é |
| | | HttpEntity<String> requestEntity = new HttpEntity<>(headers); |
| | | ResponseEntity<String> response = restTemplate.exchange( |
| | | urlBuilder.toString(), |
| | | HttpMethod.GET, |
| | | requestEntity, |
| | | String.class |
| | | ); |
| | | |
| | | // è§£æååº |
| | | JSONObject result = JSONObject.parseObject(response.getBody()); |
| | | log.debug("第{}页APIååº: {}", pageNumber, result != null ? result.toJSONString() : "null"); |
| | | |
| | | if (result != null && result.getInteger("code") == 0) { |
| | | JSONObject data = result.getJSONObject("data"); |
| | | if (data != null) { |
| | | // è§£æç¨æ·å表 |
| | | Object items = data.get("items"); |
| | | log.info("第{}页åå§ç¨æ·æ°æ®æ°é: {}", pageNumber, items instanceof List ? ((List<?>) items).size() : 0); |
| | | |
| | | if (items != null) { |
| | | List<FeishuUser> pageUsers = parseUsers(items); |
| | | userList.addAll(pageUsers); |
| | | log.info("第{}页解æåç¨æ·æ°é: {}", pageNumber, pageUsers.size()); |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦æä¸ä¸é¡µ |
| | | pageToken = data.getString("page_token"); |
| | | boolean hasMore = data.getBooleanValue("has_more"); |
| | | log.info("第{}页has_more: {}, page_token: {}", pageNumber, hasMore, pageToken); |
| | | pageNumber++; |
| | | } else { |
| | | log.warn("第{}页data为空", pageNumber); |
| | | break; |
| | | } |
| | | } else { |
| | | log.error("è·åé£ä¹¦é¨é¨ç¨æ·å表失败ï¼ååº: {}", result != null ? result.toJSONString() : "null"); |
| | | if (result != null) { |
| | | log.error("é误ç : {}, é误信æ¯: {}", result.getInteger("code"), result.getString("msg")); |
| | | } |
| | | break; |
| | | } |
| | | } while (pageToken != null && !pageToken.isEmpty()); |
| | | |
| | | log.info("è·åé£ä¹¦é¨é¨ç¨æ·å®æï¼æ»ç¨æ·æ°é: {}", userList.size()); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("è·åé£ä¹¦é¨é¨ç¨æ·å表å¼å¸¸", e); |
| | | } |
| | | return userList; |
| | | } |
| | | |
| | | /** |
| | | * è§£æç¨æ·æ°æ® |
| | | */ |
| | | /** |
| | | * è§£æç¨æ·æ°æ® |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | private List<FeishuUser> parseUsers(Object items) { |
| | | Logger log = LoggerFactory.getLogger(FeishuUserService.class); |
| | | List<FeishuUser> userList = new ArrayList<>(); |
| | | if (!(items instanceof List)) { |
| | | log.warn("è§£æç¨æ·æ°æ®å¤±è´¥ï¼items䏿¯å表类å: {}", items); |
| | | return userList; |
| | | } |
| | | List<?> userItems = (List<?>) items; |
| | | log.info("å¼å§è§£æé£ä¹¦ç¨æ·å表ï¼å
±{}æ¡è®°å½", userItems.size()); |
| | | for (Object item : userItems) { |
| | | if (item == null || !(item instanceof Map)) { |
| | | log.warn("è·³è¿æ æç¨æ·æ°æ®é¡¹ï¼ç±»åä¸å¹é
: {}", item != null ? item.getClass() : "null"); |
| | | continue; |
| | | } |
| | | Map<String, Object> userMap = (Map<String, Object>) item; |
| | | FeishuUser user = new FeishuUser(); |
| | | // è§£æopen_id |
| | | user.setOpenId((String) userMap.getOrDefault("open_id", "")); |
| | | // è§£ænameå¹¶æå |
| | | String name = (String) userMap.getOrDefault("name", ""); |
| | | if (name.contains(" ")) { |
| | | String[] parts = name.split(" "); |
| | | if (parts.length == 2) { |
| | | user.setUsername(parts[0].trim()); // å·¥å·é¨ååå°username |
| | | user.setRealname(parts[1].trim()); // å§åé¨ååå°realname |
| | | user.setWorkNo(parts[0].trim()); // å·¥å·ä¹åå°workNo |
| | | } else { |
| | | // æåå¼å¸¸æ¶ï¼é»è®¤å¤ç |
| | | user.setUsername(name); |
| | | user.setRealname(name); |
| | | user.setWorkNo(""); |
| | | log.warn("é£ä¹¦ç¨æ·nameåæ®µæ ¼å¼å¼å¸¸ï¼æ æ³æåï¼åå§å¼ï¼{}", name); |
| | | } |
| | | } else { |
| | | user.setUsername(name); |
| | | user.setRealname(name); |
| | | user.setWorkNo(""); |
| | | log.warn("é£ä¹¦ç¨æ·nameåæ®µæ ç©ºæ ¼åéï¼æ æ³æåï¼åå§å¼ï¼{}", name); |
| | | } |
| | | // è§£æå
¶ä»åºæ¬ä¿¡æ¯ |
| | | user.setEnName((String) userMap.getOrDefault("en_name", "")); |
| | | user.setDescription((String) userMap.getOrDefault("description", "")); |
| | | Object mobileVisibleObj = userMap.get("mobile_visible"); |
| | | user.setMobileVisible(mobileVisibleObj instanceof Boolean ? (Boolean) mobileVisibleObj : false); |
| | | // è§£æå¤´åä¿¡æ¯ |
| | | Object avatarObj = userMap.get("avatar"); |
| | | if (avatarObj instanceof Map) { |
| | | Map<String, Object> avatarMap = (Map<String, Object>) avatarObj; |
| | | user.setAvatar240((String) avatarMap.getOrDefault("avatar_240", "")); |
| | | user.setAvatar640((String) avatarMap.getOrDefault("avatar_640", "")); |
| | | user.setAvatar72((String) avatarMap.getOrDefault("avatar_72", "")); |
| | | user.setAvatarOrigin((String) avatarMap.getOrDefault("avatar_origin", "")); |
| | | } else { |
| | | log.info("ç¨æ·[{}]æªè®¾ç½®å¤´åæå¤´åæ ¼å¼å¼å¸¸", user.getRealname()); |
| | | } |
| | | // 设置é»è®¤å å¯å¯ç ï¼è¿éå设å¯ç æ¯ç®åå å¯åå¨ï¼å®é
å»ºè®®ç¨æ´å®å
¨çå 坿¹å¼ï¼ |
| | | user.setPassword("123456"); // ä½ è¦æ±çé»è®¤å¯ç |
| | | // å°open_idåå°å¯¹åºçåæ®µï¼æ ¹æ®ä½ çç¨æ·è¡¨ç»æï¼åè®¾ç¨æ·è¡¨æopen_idåæ®µï¼ |
| | | user.setOpenId((String) userMap.getOrDefault("open_id", "")); |
| | | userList.add(user); |
| | | } |
| | | |
| | | return userList; |
| | | } |
| | | |
| | | /** |
| | | * 忥å个é£ä¹¦ç¨æ·å°ç³»ç» |
| | | * @param feishuUser é£ä¹¦ç¨æ· |
| | | * @return trueè¡¨ç¤ºæ´æ°ï¼false表示æ°å¢ |
| | | * |
| | | * åæå¢å ï¼ ç¨æ·åæ¥å¯¹æ¯ï¼é£ä¹¦ç¦»èåå·¥éè¦å¨æ¬å°ç¨æ·è¡¨éé¢å°è¯¥ç¨æ·ç¶æç¦ç¨ |
| | | */ |
| | | private boolean syncFeishuUserToSystem(FeishuUser feishuUser) { |
| | | // è¿éæ ¹æ®æååçusernameï¼å·¥å·ï¼å»æ¥è¯¢ç³»ç»ç¨æ· |
| | | String username = feishuUser.getUsername(); |
| | | SysUser existUser = sysUserService.getUserByName(username); |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUsername(username); |
| | | sysUser.setStatus(1); |
| | | sysUser.setDelFlag(0); |
| | | sysUser.setAvatar(feishuUser.getAvatar640()); |
| | | sysUser.setRealname(feishuUser.getRealname()); |
| | | sysUser.setWorkNo(feishuUser.getWorkNo()); |
| | | String password = "123456", salt = oConvertUtils.randomGen(8); |
| | | String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt); |
| | | sysUser.setSalt(salt); |
| | | sysUser.setPassword(passwordEncode); |
| | | sysUser.setOpenId(feishuUser.getOpenId()); |
| | | |
| | | if (existUser == null) { |
| | | |
| | | sysUserService.addUserWithRole(sysUser, "5"); |
| | | log.info("æ°å¢ç¨æ·: {}", username); |
| | | return false; |
| | | } else { |
| | | sysUser.setId(existUser.getId()); |
| | | sysUserService.editUser(sysUser); |
| | | log.info("æ´æ°ç¨æ·: {}", username); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.jeecg.modules.sap.request.ProductionOrderSyncRequest; |
| | | import org.jeecg.modules.sap.service.OrderBomSync; |
| | | import org.jeecg.modules.sap.service.OrderProcessSync; |
| | | import org.jeecg.modules.sap.service.ProductionOrderSync; |
| | |
| | | lastSyncDateHigh = null; |
| | | } |
| | | } |
| | | ProductionOrderSyncRequest request = new ProductionOrderSyncRequest(); |
| | | request.setFactoryCode(FACTORY_CODE); |
| | | request.setOrderTypeCode(ORDER_TYPE_CODE); |
| | | request.setProductionManager(PRODUCTION_MANAGER); |
| | | request.setOrderStatus(ORDER_STATUS); |
| | | request.setCreateTimeLow(lastSyncDateLow); |
| | | request.setCreateTimeHigh(lastSyncDateHigh); |
| | | try { |
| | | //è°ç¨SAPæ¥å£è·åç产订å |
| | | Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(FACTORY_CODE, ORDER_TYPE_CODE, PRODUCTION_MANAGER, ORDER_STATUS, lastSyncDateLow, lastSyncDateHigh, null, null); |
| | | Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(request); |
| | | if (productionOrderMap == null || !SUCCESS_CODE.equals(productionOrderMap.get("ztype"))) { |
| | | log.error("æªåæ¥å°è®¢åä¿¡æ¯ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.jeecg.modules.sap.request.ProductionOrderSyncRequest; |
| | | import org.jeecg.modules.sap.service.OrderBomSync; |
| | | import org.jeecg.modules.sap.service.OrderProcessSync; |
| | | import org.jeecg.modules.sap.service.ProductionOrderSync; |
| | |
| | | lastSyncDateHigh = null; |
| | | } |
| | | } |
| | | ProductionOrderSyncRequest request = new ProductionOrderSyncRequest(); |
| | | request.setFactoryCode(FACTORY_CODE); |
| | | request.setOrderTypeCode(ORDER_TYPE_CODE); |
| | | request.setProductionManager(PRODUCTION_MANAGER); |
| | | request.setOrderStatus(ORDER_STATUS); |
| | | request.setUpdateTimeLow(lastSyncDateLow); |
| | | request.setUpdateTimeHigh(lastSyncDateHigh); |
| | | try { |
| | | //è°ç¨SAPæ¥å£è·åç产订å |
| | | Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(FACTORY_CODE, ORDER_TYPE_CODE, PRODUCTION_MANAGER, ORDER_STATUS, null, null, lastSyncDateLow, lastSyncDateHigh); |
| | | Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(request); |
| | | if (productionOrderMap == null || !SUCCESS_CODE.equals(productionOrderMap.get("ztype"))) { |
| | | log.error("æªåæ¥å°è®¢åä¿¡æ¯ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | |
| | | 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.jeecg.modules.sap.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api(tags = "SAPéææµè¯") |
| | |
| | | private OrderLoadService orderLoadService; |
| | | @Autowired |
| | | private OrderCloseService orderCloseService; |
| | | |
| | | // @ApiOperation(value = "SAPéææµè¯-æµè¯æ¥å£", notes = "SAPéææµè¯-æµè¯æ¥å£") |
| | | // @GetMapping("/test") |
| | | // public Result<?> test() { |
| | | // String test = sapService.test(); |
| | | // return Result.ok(test); |
| | | // } |
| | | @Autowired |
| | | private OrderMaterialRequestService orderMaterialRequestService; |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-ç产订å忥æ¥å£", notes = "SAPéææµè¯-ç产订å忥æ¥å£") |
| | | @GetMapping("/syncProductionOrder") |
| | | public Result<?> syncProductionOrder() throws Exception { |
| | | Map<String, Object> resultMap = productionOrderSync.syncProductionOrder(factoryCode, orderTypeCode1, productionManager, orderStatus, null, null, null, null); |
| | | @PostMapping("/syncProductionOrder") |
| | | public Result<?> syncProductionOrder(@RequestBody ProductionOrderSyncRequest request) throws Exception { |
| | | // ProductionOrderSyncRequest request = new ProductionOrderSyncRequest(); |
| | | // request.setFactoryCode(factoryCode); |
| | | // request.setOrderTypeCode(orderTypeCode1); |
| | | // request.setProductionManager(productionManager); |
| | | // request.setOrderStatus(orderStatus); |
| | | // request.setOrderCode("10711342"); |
| | | Map<String, Object> resultMap = productionOrderSync.syncProductionOrder(request); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-订åBOM忥", notes = "SAPéææµè¯-订åBOM忥") |
| | | @GetMapping("/syncOrderBom") |
| | | public Result<?> syncOrderBom() throws Exception { |
| | | String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543"; |
| | | public Result<?> syncOrderBom(@RequestParam(value = "factoryCode") String factoryCode, @RequestParam(value = "orderCode") String orderCode) throws Exception { |
| | | // String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543"; |
| | | Map<String, Object> resultMap = orderBomSync.syncOrderBom(factoryCode, orderCode); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-订åå·¥åºåæ¥", notes = "SAPéææµè¯-订åå·¥åºåæ¥") |
| | | @GetMapping("/syncOrderProcess") |
| | | public Result<?> syncOrderProcess() throws Exception { |
| | | String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543"; |
| | | public Result<?> syncOrderProcess(@RequestParam(value = "factoryCode") String factoryCode, @RequestParam(value = "orderCode") String orderCode) throws Exception { |
| | | // String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543"; |
| | | Map<String, Object> resultMap = orderProcessSync.syncOrderProcess(factoryCode, orderCode); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-å·¥åºæ¥å·¥", notes = "SAPéææµè¯-å·¥åºæ¥å·¥") |
| | | @GetMapping("/productionOrderReport") |
| | | public Result<?> productionOrderReport() throws Exception { |
| | | OrderReportRequest request = new OrderReportRequest(); |
| | | request.setFactoryCode(factoryCode); |
| | | request.setOrderCode("10711404"); |
| | | request.setWarehouseCode("7014"); //2# çº¿è¾¹åº |
| | | request.setProcessCode("0040"); |
| | | request.setQualifiedQuantity(new BigDecimal("180")); |
| | | request.setScrapQuantity(new BigDecimal("0")); |
| | | request.setKeyProcess("202505080102"); |
| | | @PostMapping("/productionOrderReport") |
| | | public Result<?> productionOrderReport(@RequestBody OrderReportRequest request) throws Exception { |
| | | // OrderReportRequest request10 = new OrderReportRequest(); |
| | | // request10.setFactoryCode(factoryCode); |
| | | // request10.setOrderCode("10711404"); |
| | | // request10.setWarehouseCode("7014"); //2# çº¿è¾¹åº |
| | | // request10.setProcessCode("0010"); |
| | | // request10.setQualifiedQuantity(new BigDecimal("180")); |
| | | // request10.setScrapQuantity(new BigDecimal("0")); |
| | | // request10.setKeyProcess("202505080101"); |
| | | // request10.setBatchNumber("202505080101"); |
| | | Map<String, Object> resultMap = orderReportService.productionOrderReport(request); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-çäº§è®¢åææ", notes = "SAPéææµè¯-çäº§è®¢åææ") |
| | | @GetMapping("/productionOrderLoad") |
| | | public Result<?> productionOrderLoad() throws Exception { |
| | | OrderLoadRequest request = new OrderLoadRequest(); |
| | | request.setFactoryCode(factoryCode); |
| | | request.setOrderCode("10711404"); |
| | | request.setWarehouseCode("7014"); //2# çº¿è¾¹åº |
| | | request.setMaterialNumber("320013727"); |
| | | request.setQuantity(new BigDecimal("180")); |
| | | request.setBatchNumber("202505080102"); |
| | | @PostMapping("/productionOrderLoad") |
| | | public Result<?> productionOrderLoad(@RequestBody OrderLoadRequest request) throws Exception { |
| | | // OrderLoadRequest request = new OrderLoadRequest(); |
| | | // request.setFactoryCode(factoryCode); |
| | | // request.setOrderCode("10711404"); |
| | | // request.setWarehouseCode("7014"); //2# çº¿è¾¹åº |
| | | // request.setMaterialNumber("320013727"); |
| | | // request.setQuantity(new BigDecimal("180")); |
| | | // request.setBatchNumber("202505080102"); |
| | | Map<String, Object> resultMap = orderLoadService.productionOrderLoad(request); |
| | | return Result.ok(resultMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "SAPéææµè¯-ç产订åå
³é", notes = "SAPéææµè¯-ç产订åå
³é") |
| | | @GetMapping("/productionOrderClose") |
| | | public Result<?> productionOrderClose() throws Exception { |
| | | String orderCode = "10711404"; |
| | | public Result<?> productionOrderClose(@RequestParam(value = "orderCode") String orderCode) throws Exception { |
| | | // String orderCode = "10698749"; |
| | | 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.request; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ProductionOrderSyncRequest { |
| | | private String factoryCode; |
| | | private String orderCode; |
| | | private String orderTypeCode; |
| | | private String productionManager; |
| | | private String orderStatus; |
| | | private String createTimeLow; |
| | | private String createTimeHigh; |
| | | private String updateTimeLow; |
| | | private String updateTimeHigh; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | |
| | | package org.jeecg.modules.sap.service; |
| | | |
| | | import org.jeecg.modules.sap.request.ProductionOrderSyncRequest; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public interface ProductionOrderSync { |
| | | /** |
| | | * 忥çæè®¢å |
| | | */ |
| | | Map<String, Object> syncProductionOrder(String factoryCode, String orderTypeCode, String productionManager, String orderStatus, String createTimeLow, String createTimeHigh, String updateTimeLow, String updateTimeHigh) throws Exception; |
| | | Map<String, Object> syncProductionOrder(ProductionOrderSyncRequest request) throws Exception; |
| | | } |
| | |
| | | // æ§è¡è°ç¨ |
| | | function.execute(destination); |
| | | //è·åè¿åç»æ |
| | | String ztype = function.getExportParameterList().getTable("ZTYPE").toString(); |
| | | String zmess = function.getExportParameterList().getTable("ZMESS").toString(); |
| | | String ztype = function.getExportParameterList().getValue("ZTYPE").toString(); |
| | | String zmess = function.getExportParameterList().getValue("ZMESS").toString(); |
| | | |
| | | resultMap.put("zmess", zmess); |
| | | resultMap.put("ztype", ztype); |
| | |
| | | import org.jeecg.common.constant.ApiLogCategoryEnum; |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.OrderLoadDTO; |
| | | import org.jeecg.modules.sap.request.OrderLoadRequest; |
| | | import org.jeecg.modules.sap.service.OrderLoadService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | // æ§è¡è°ç¨ |
| | | function.execute(destination); |
| | | //è·åè¿åç»æ |
| | | JCoTable eReturn = function.getExportParameterList().getTable("E_RETURN"); |
| | | Object eReturn1 = function.getExportParameterList().getValue("E_RETURN"); |
| | | OrderLoadDTO reportDTO1 = null; |
| | | if (eReturn1 != null) { |
| | | JCoStructure eReturn = (JCoStructure) eReturn1; |
| | | //E Return |
| | | reportDTO1 = new OrderLoadDTO(); |
| | | reportDTO1.setTYPE(eReturn.getString("TYPE")); |
| | | reportDTO1.setID(eReturn.getString("ID")); |
| | | reportDTO1.setNUMBER(eReturn.getString("NUMBER")); |
| | | reportDTO1.setMESSAGE(eReturn.getString("MESSAGE")); |
| | | reportDTO1.setLOG_NO(eReturn.getString("LOG_NO")); |
| | | reportDTO1.setLOG_MSG_NO(eReturn.getString("LOG_MSG_NO")); |
| | | reportDTO1.setMESSAGE_V1(eReturn.getString("MESSAGE_V1")); |
| | | reportDTO1.setMESSAGE_V2(eReturn.getString("MESSAGE_V2")); |
| | | reportDTO1.setMESSAGE_V3(eReturn.getString("MESSAGE_V3")); |
| | | reportDTO1.setMESSAGE_V4(eReturn.getString("MESSAGE_V4")); |
| | | reportDTO1.setPARAMETER(eReturn.getString("PARAMETER")); |
| | | reportDTO1.setROW(eReturn.getString("ROW")); |
| | | reportDTO1.setFIELD(eReturn.getString("FIELD")); |
| | | reportDTO1.setSYSTEM(eReturn.getString("SYSTEM")); |
| | | } |
| | | JCoTable tReturn1 = function.getTableParameterList().getTable("T_RETURN"); |
| | | String zmess = ""; |
| | | String ztype = "";//S æ è¯ æå |
| | | OrderLoadDTO reportDTO2 = null; |
| | | if (tReturn1.getNumRows() > 0) { |
| | | tReturn1.setRow(0); |
| | | reportDTO2 = new OrderLoadDTO(); |
| | | reportDTO2.setTYPE(tReturn1.getString("TYPE")); |
| | | reportDTO2.setID(tReturn1.getString("ID")); |
| | | reportDTO2.setNUMBER(tReturn1.getString("NUMBER")); |
| | | reportDTO2.setMESSAGE(tReturn1.getString("MESSAGE")); |
| | | reportDTO2.setLOG_NO(tReturn1.getString("LOG_NO")); |
| | | reportDTO2.setLOG_MSG_NO(tReturn1.getString("LOG_MSG_NO")); |
| | | reportDTO2.setMESSAGE_V1(tReturn1.getString("MESSAGE_V1")); |
| | | reportDTO2.setMESSAGE_V2(tReturn1.getString("MESSAGE_V2")); |
| | | reportDTO2.setMESSAGE_V3(tReturn1.getString("MESSAGE_V3")); |
| | | reportDTO2.setMESSAGE_V4(tReturn1.getString("MESSAGE_V4")); |
| | | reportDTO2.setPARAMETER(tReturn1.getString("PARAMETER")); |
| | | reportDTO2.setROW(tReturn1.getString("ROW")); |
| | | reportDTO2.setFIELD(tReturn1.getString("FIELD")); |
| | | reportDTO2.setSYSTEM(tReturn1.getString("SYSTEM")); |
| | | } |
| | | |
| | | String zmess = reportDTO1 == null ? (reportDTO2 == null ? "" : reportDTO2.getMESSAGE()) : reportDTO1.getMESSAGE(); |
| | | String ztype = reportDTO1 == null ? (reportDTO2 == null ? "" : reportDTO2.getTYPE()) : reportDTO1.getTYPE(); //S æ è¯ æå |
| | | |
| | | resultMap.put("zmess", zmess); |
| | | resultMap.put("ztype", ztype); |
| | | resultMap.put("importParameters", request); |
| | | resultMap.put("result", null); |
| | | resultMap.put("result", reportDTO1 == null ? reportDTO2 : reportDTO1); |
| | | return resultMap; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.jeecg.common.constant.ApiLogCategoryEnum; |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.OrderReportDTO; |
| | | import org.jeecg.modules.sap.request.OrderReportRequest; |
| | | import org.jeecg.modules.sap.service.OrderReportService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | // æ§è¡è°ç¨ |
| | | function.execute(destination); |
| | | //è·åè¿åç»æ |
| | | JCoTable eReturn = function.getExportParameterList().getTable("E_RETURN"); |
| | | Object eReturn1 = function.getExportParameterList().getValue("E_RETURN"); |
| | | OrderReportDTO reportDTO1 = null; |
| | | if (eReturn1 != null) { |
| | | JCoStructure eReturn = (JCoStructure) eReturn1; |
| | | //E Return |
| | | reportDTO1 = new OrderReportDTO(); |
| | | reportDTO1.setTYPE(eReturn.getString("TYPE")); |
| | | reportDTO1.setID(eReturn.getString("ID")); |
| | | reportDTO1.setNUMBER(eReturn.getString("NUMBER")); |
| | | reportDTO1.setMESSAGE(eReturn.getString("MESSAGE")); |
| | | reportDTO1.setLOG_NO(eReturn.getString("LOG_NO")); |
| | | reportDTO1.setLOG_MSG_NO(eReturn.getString("LOG_MSG_NO")); |
| | | reportDTO1.setMESSAGE_V1(eReturn.getString("MESSAGE_V1")); |
| | | reportDTO1.setMESSAGE_V2(eReturn.getString("MESSAGE_V2")); |
| | | reportDTO1.setMESSAGE_V3(eReturn.getString("MESSAGE_V3")); |
| | | reportDTO1.setMESSAGE_V4(eReturn.getString("MESSAGE_V4")); |
| | | reportDTO1.setPARAMETER(eReturn.getString("PARAMETER")); |
| | | reportDTO1.setROW(eReturn.getString("ROW")); |
| | | reportDTO1.setFIELD(eReturn.getString("FIELD")); |
| | | reportDTO1.setSYSTEM(eReturn.getString("SYSTEM")); |
| | | reportDTO1.setFLG_LOCKED(eReturn.getString("FLG_LOCKED")); |
| | | reportDTO1.setCONF_NO(eReturn.getString("CONF_NO")); |
| | | reportDTO1.setCONF_CNT(eReturn.getString("CONF_CNT")); |
| | | } |
| | | JCoTable tReturn1 = function.getTableParameterList().getTable("T_RETURN"); |
| | | String zmess = ""; |
| | | String ztype = "";//S æ è¯ æå |
| | | OrderReportDTO reportDTO2 = null; |
| | | if (tReturn1.getNumRows() > 0) { |
| | | tReturn1.setRow(0); |
| | | reportDTO2 = new OrderReportDTO(); |
| | | reportDTO2.setTYPE(tReturn1.getString("TYPE")); |
| | | reportDTO2.setID(tReturn1.getString("ID")); |
| | | reportDTO2.setNUMBER(tReturn1.getString("NUMBER")); |
| | | reportDTO2.setMESSAGE(tReturn1.getString("MESSAGE")); |
| | | reportDTO2.setLOG_NO(tReturn1.getString("LOG_NO")); |
| | | reportDTO2.setLOG_MSG_NO(tReturn1.getString("LOG_MSG_NO")); |
| | | reportDTO2.setMESSAGE_V1(tReturn1.getString("MESSAGE_V1")); |
| | | reportDTO2.setMESSAGE_V2(tReturn1.getString("MESSAGE_V2")); |
| | | reportDTO2.setMESSAGE_V3(tReturn1.getString("MESSAGE_V3")); |
| | | reportDTO2.setMESSAGE_V4(tReturn1.getString("MESSAGE_V4")); |
| | | reportDTO2.setPARAMETER(tReturn1.getString("PARAMETER")); |
| | | reportDTO2.setROW(tReturn1.getString("ROW")); |
| | | reportDTO2.setFIELD(tReturn1.getString("FIELD")); |
| | | reportDTO2.setSYSTEM(tReturn1.getString("SYSTEM")); |
| | | reportDTO2.setFLG_LOCKED(tReturn1.getString("FLG_LOCKED")); |
| | | reportDTO2.setCONF_NO(tReturn1.getString("CONF_NO")); |
| | | reportDTO2.setCONF_CNT(tReturn1.getString("CONF_CNT")); |
| | | } |
| | | |
| | | String zmess = reportDTO1 == null ? (reportDTO2 == null ? "" : reportDTO2.getMESSAGE()) : reportDTO1.getMESSAGE(); |
| | | String ztype = reportDTO1 == null ? (reportDTO2 == null ? "" : reportDTO2.getTYPE()) : reportDTO1.getTYPE(); //S æ è¯ æå |
| | | |
| | | resultMap.put("zmess", zmess); |
| | | resultMap.put("ztype", ztype); |
| | | resultMap.put("importParameters", request); |
| | | resultMap.put("result", null); |
| | | resultMap.put("result", reportDTO1 == null ? reportDTO2 : reportDTO1); |
| | | return resultMap; |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.sap.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.sap.conn.jco.JCoDestination; |
| | | import com.sap.conn.jco.JCoFunction; |
| | | import com.sap.conn.jco.JCoRepository; |
| | |
| | | import org.jeecg.config.sap.SapRfcConnectionManager; |
| | | import org.jeecg.modules.sap.FunctionConst; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.jeecg.modules.sap.request.ProductionOrderSyncRequest; |
| | | import org.jeecg.modules.sap.service.ProductionOrderSync; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | @ApiLog(apiName = "ç产订å忥(ZPPF_033_1)", apiCategory = ApiLogCategoryEnum.SAP) |
| | | public Map<String, Object> syncProductionOrder(String factoryCode, String orderTypeCode, String productionManager, String orderStatus, String createTimeLow, String createTimeHigh, String updateTimeLow, String updateTimeHigh) throws Exception { |
| | | public Map<String, Object> syncProductionOrder(ProductionOrderSyncRequest request) throws Exception { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | JCoDestination destination = connectionManager.getDestination(); |
| | | JCoRepository repository = destination.getRepository(); |
| | |
| | | } |
| | | // 设置è¾å
¥åæ° |
| | | //订åå·æ¥è¯¢æ¡ä»¶ |
| | | // JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR"); |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(request.getOrderCode())) { |
| | | JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR"); |
| | | String[] split = request.getOrderCode().split(","); |
| | | for (String code : split) { |
| | | AUFNRTable.appendRow(); |
| | | AUFNRTable.setValue("AUFNR", code); |
| | | } |
| | | } |
| | | //订åç±»å æ åç产订å |
| | | if(StringUtils.isNotBlank(orderTypeCode)){ |
| | | if (StringUtils.isNotBlank(request.getOrderTypeCode())) { |
| | | JCoTable AUARTTable = function.getTableParameterList().getTable("ZTAB_AUART"); |
| | | String[] split = orderTypeCode.split(","); |
| | | String[] split = request.getOrderTypeCode().split(","); |
| | | for(String code : split){ |
| | | AUARTTable.appendRow(); |
| | | AUARTTable.setValue("AUART", code); |
| | | } |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("AUART", orderTypeCode); |
| | | items.add(item); |
| | | } |
| | | if(StringUtils.isNotBlank(productionManager)){ |
| | | if (StringUtils.isNotBlank(request.getProductionManager())) { |
| | | JCoTable FEVORTable = function.getTableParameterList().getTable("ZTAB_FEVOR"); |
| | | String[] split = productionManager.split(","); |
| | | String[] split = request.getProductionManager().split(","); |
| | | for(String code : split){ |
| | | FEVORTable.appendRow(); |
| | | FEVORTable.setValue("FEVOR", code); |
| | | } |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("FEVOR", productionManager); |
| | | items.add(item); |
| | | } |
| | | if(StringUtils.isNotBlank(factoryCode)){ |
| | | if (StringUtils.isNotBlank(request.getFactoryCode())) { |
| | | //æ°ç«ç¬ |
| | | JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS"); |
| | | String[] split = factoryCode.split(","); |
| | | String[] split = request.getFactoryCode().split(","); |
| | | for(String code : split){ |
| | | WERKSTable.appendRow(); |
| | | WERKSTable.setValue("WERKS", code); |
| | | } |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("WERKS", factoryCode); |
| | | items.add(item); |
| | | } |
| | | if(StringUtils.isNotBlank(orderStatus)) { |
| | | if (StringUtils.isNotBlank(request.getOrderStatus())) { |
| | | //æ°ç«ç¬ |
| | | JCoTable TXT04Table = function.getTableParameterList().getTable("ZTAB_TXT04"); |
| | | String[] split = orderStatus.split(","); |
| | | String[] split = request.getOrderStatus().split(","); |
| | | for(String code : split){ |
| | | TXT04Table.appendRow(); |
| | | TXT04Table.setValue("TXT04", code); |
| | | } |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("TXT04", orderStatus); |
| | | items.add(item); |
| | | } |
| | | if(StringUtils.isNotBlank(createTimeLow)){ |
| | | if (StringUtils.isNotBlank(request.getCreateTimeLow())) { |
| | | JCoTable UDATETable = function.getTableParameterList().getTable("ZTAB_UDATE"); |
| | | UDATETable.appendRow(); |
| | | UDATETable.setValue("LOW", createTimeLow); |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("ZTAB_UDATE_LOW", createTimeLow); |
| | | items.add(item); |
| | | UDATETable.setValue("LOW", request.getCreateTimeLow()); |
| | | } |
| | | if(StringUtils.isNotBlank(createTimeHigh)){ |
| | | if (StringUtils.isNotBlank(request.getCreateTimeHigh())) { |
| | | JCoTable UDATETable = function.getTableParameterList().getTable("ZTAB_UDATE"); |
| | | UDATETable.appendRow(); |
| | | UDATETable.setValue("HIGH", createTimeHigh); |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("ZTAB_UDATE_HIGH", createTimeHigh); |
| | | items.add(item); |
| | | UDATETable.setValue("HIGH", request.getCreateTimeHigh()); |
| | | } |
| | | if(StringUtils.isNotBlank(updateTimeLow)){ |
| | | if (StringUtils.isNotBlank(request.getUpdateTimeLow())) { |
| | | JCoTable LAEDATable = function.getTableParameterList().getTable("ZTAB_LAEDA"); |
| | | LAEDATable.appendRow(); |
| | | LAEDATable.setValue("LOW", updateTimeLow); |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("ZTAB_LAEDA_LOW", updateTimeLow); |
| | | items.add(item); |
| | | LAEDATable.setValue("LOW", request.getUpdateTimeLow()); |
| | | } |
| | | if(StringUtils.isNotBlank(updateTimeHigh)){ |
| | | if (StringUtils.isNotBlank(request.getUpdateTimeHigh())) { |
| | | JCoTable LAEDATable = function.getTableParameterList().getTable("ZTAB_LAEDA"); |
| | | LAEDATable.appendRow(); |
| | | LAEDATable.setValue("HIGH", updateTimeLow); |
| | | //ç»è£
请æ±åæ° |
| | | JSONObject item = new JSONObject(); |
| | | item.put("ZTAB_LAEDA_HIGH", updateTimeLow); |
| | | items.add(item); |
| | | LAEDATable.setValue("HIGH", request.getUpdateTimeHigh()); |
| | | } |
| | | // æ§è¡è°ç¨ |
| | | function.execute(destination); |
| | |
| | | } |
| | | resultMap.put("zmess", zmess); |
| | | resultMap.put("ztype", ztype); |
| | | resultMap.put("importParameters", items); |
| | | resultMap.put("importParameters", request); |
| | | resultMap.put("result", resultList); |
| | | return resultMap; |
| | | } |
| | |
| | | @Excel(name = "å·¥å·", width = 15) |
| | | private String workNo; |
| | | |
| | | |
| | | /** |
| | | * é£ä¹¦idï¼å¯ä¸é® |
| | | */ |
| | | @Excel(name = "é£ä¹¦id", width = 15) |
| | | private String openId; |
| | | /** |
| | | * èå¡ï¼å
³èèå¡è¡¨ |
| | | */ |
| | |
| | | * @return |
| | | */ |
| | | IPage<SysUser> getUserByFactoryId(Page<SysUser> page, String factoryId, String username); |
| | | |
| | | void editUser(SysUser sysUser); |
| | | } |
| | |
| | | public IPage<SysUser> getUserByFactoryId(Page<SysUser> page, String factoryId, String username) { |
| | | return userMapper.getUserByFactoryId(page,factoryId,username); |
| | | } |
| | | |
| | | @Override |
| | | public void editUser(SysUser sysUser) { |
| | | userMapper.updateById(sysUser); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.cxf.endpoint.Client; |
| | | import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; |
| | | |
| | | import javax.xml.namespace.QName; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/6/11 10:16 |
| | | */ |
| | | public class CxfClientUtil { |
| | | |
| | | /** |
| | | * 卿è°ç¨ |
| | | */ |
| | | public static String invokeService(String url, String data, String namespace, String method) throws Exception { |
| | | JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); |
| | | Client client = dcf.createClient(url); |
| | | QName opName = new QName(namespace, method); |
| | | Object[] objects = new Object[0]; |
| | | try { |
| | | objects = client.invoke(opName, data); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String json = JSONObject.toJSONString(objects[0]); |
| | | return json; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.config; |
| | | |
| | | public class WebServiceClientConfig { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.config; |
| | | |
| | | import org.apache.cxf.Bus; |
| | | import org.apache.cxf.bus.spring.SpringBus; |
| | | 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.springframework.boot.web.servlet.ServletRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.xml.ws.Endpoint; |
| | | |
| | | |
| | | @Configuration |
| | | public class WebServiceServerConfig { |
| | | @Autowired |
| | | private ReceiveWMSScanItemListService receiveWMSScanItemListService; |
| | | |
| | | @Bean(name = "cxfServer") |
| | | 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/*"); |
| | | } |
| | | |
| | | @Bean |
| | | public Endpoint endpoint() { |
| | | // åæ°äºï¼æ¯SEIå®ç°ç±»å¯¹è±¡ |
| | | Endpoint endpoint = new EndpointImpl(this.springBus(), receiveWMSScanItemListService); |
| | | // åå¸æå¡ |
| | | endpoint.publish("/userService"); |
| | | return endpoint; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.dto; |
| | | |
| | | public class WSResponse { |
| | | private String ErrorCode; |
| | | private String ErrorDesc; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.request; |
| | | |
| | | public class ReceiveMESScanItemList { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.service; |
| | | |
| | | import javax.jws.WebService; |
| | | |
| | | @WebService |
| | | public interface ReceiveWMSScanItemListService { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.wms.service.impl; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 |
| | | public class ReceiveWMSScanItemListServiceImpl implements ReceiveWMSScanItemListService { |
| | | } |
| | |
| | | client-secret: ?? |
| | | agent-id: ?? |
| | | webservice: |
| | | url: http://localhost:8081/services/EquipmentService?wsdl |
| | | namespace: http://service.server.webservice.example.com |
| | | statusMethod: equipmentStatus |
| | | rateMethod: equipmentRate |
| | | url: http://10.101.0.182:8002/MesWebService/WebService.asmx?wsdl |
| | | namespace: http://tempuri.org/ |
| | | # SAP RFCæ¹å¼æ¥å£éæ |
| | | sap: |
| | | rfc: |
| | |
| | | poolSize: 5 # çº¿ç¨æ± æ°é |
| | | expirationTime: 10000 # è¿ææ¶é´ |
| | | peekLimit: 10 # å³°å¼ |
| | | feishu: |
| | | url: https://open.feishu.cn/ |
| | | appId: cli_a74aab6353b7d00e |
| | | appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT |
| | | sync: |
| | | departmentId: od-47692f32e6b66cc3985d317fee780a8b |
| | |
| | | # appSecret |
| | | client-secret: ?? |
| | | agent-id: ?? |
| | | webservice: |
| | | url: http://10.101.0.182:8002/MesWebService/WebService.asmx?wsdl |
| | | namespace: http://tempuri.org/ |
| | | # SAP RFCæ¹å¼æ¥å£éæ |
| | | sap: |
| | | rfc: |
| | |
| | | poolSize: 5 # çº¿ç¨æ± æ°é |
| | | expirationTime: 10000 # è¿ææ¶é´ |
| | | peekLimit: 10 # å³°å¼ |
| | | feishu: |
| | | url: https://open.feishu.cn/ |
| | | appId: cli_a74aab6353b7d00e |
| | | appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT |
| | | sync: |
| | | departmentId: od-47692f32e6b66cc3985d317fee780a8b |