diff --git a/ym-gateway/src/main/resources/application-dev.yml b/ym-gateway/src/main/resources/application-dev.yml index 229e619..780bf3e 100644 --- a/ym-gateway/src/main/resources/application-dev.yml +++ b/ym-gateway/src/main/resources/application-dev.yml @@ -2,13 +2,13 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver #MySQL - #url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - #username: cigs4 - #password: 1qazxsw2 + url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true + username: cigs4 + password: 1qazxsw2 - url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - username: root - password: 1qaz@WSX3edc$RFV +# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true +# username: root +# password: 1qaz@WSX3edc$RFV # #Oracle # driver-class-name: oracle.jdbc.OracleDriver # url: jdbc:oracle:thin:@192.168.10.10:1521:xe diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java b/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java index 7311a61..c14eb5a 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java @@ -15,6 +15,7 @@ import com.cnbm.packing.entity.WoPowerLevel; import com.cnbm.packing.service.*; import com.cnbm.s7.s7connector.enmuc.S7Client; import com.cnbm.s7.s7connector.type.PlcVar; +import io.swagger.models.auth.In; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +24,8 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; +import java.text.DecimalFormat; +import java.text.Format; import java.time.LocalDateTime; import java.util.Arrays; import java.util.Date; @@ -66,6 +69,7 @@ public class KukaJoinThread implements ApplicationRunner { + /** * return * 成功: 返回相应的object对象 @@ -150,7 +154,9 @@ public class KukaJoinThread implements ApplicationRunner { public String getBoxId(String sapMaterial){ Integer todayBoxNum = service.getTodayBoxNum(); String nowTime = DateUtil.format(new Date(), "yyMMdd"); - String res = "301"+sapMaterial+nowTime+todayBoxNum; + + todayBoxNum+=500; + String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum); return res; } @@ -159,9 +165,13 @@ public class KukaJoinThread implements ApplicationRunner { } public static void main(String[] args) { - String str = "30110012302210707 "; - String substring = str.substring(0,17); - System.out.println(substring); + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); } @Override @@ -209,6 +219,8 @@ public class KukaJoinThread implements ApplicationRunner { woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass()); woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum()); woPackagingBoxSubstrate.setWoSubstrateId(subId); + woPackagingBoxSubstrate.setActualPmpp(pmppBySubId); + woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now()); //5. 从camline那里获取可变字段 CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId); @@ -271,7 +283,6 @@ public class KukaJoinThread implements ApplicationRunner { try { //调度开始 - Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true); if(shelfIsFull != 1){ logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败"); diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java index 68bfab4..00b119d 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java @@ -7,6 +7,7 @@ import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar; import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; import com.cnbm.packing.dto.CamlineSubIdDTO; +import com.cnbm.packing.dto.CamlineSubIdForImportDTO; import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.service.DynamicDataSourceService; import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz; @@ -27,6 +28,7 @@ import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.text.ParseException; import java.util.Arrays; +import java.util.List; import java.util.Map; @@ -107,6 +109,21 @@ public class TestController { System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s)); return R.ok(); } + @PostMapping("/forImport") + public R forImport() throws UnsupportedEncodingException, ParseException { + List alllCamlineSubForImp = service.getAlllCamlineSubForImp(); + for(CamlineSubIdForImportDTO cam:alllCamlineSubForImp){ + WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate(); + woPackagingBoxSubstrate.setWoSubstrateId(cam.getSubId()); + woPackagingBoxSubstrate.setLineBody(2); + woPackagingBoxSubstrate.setPowerLevel(cam.getPowerLevel()); + woPackagingBoxSubstrate.setOrderName(cam.getOrderName()); + woPackagingBoxSubstrate.setSapMaterial(cam.getSapMaterial()); + substrateServiceBiz.insert(woPackagingBoxSubstrate); + } + return R.ok(); + } + @PostMapping("/testReadAll") public R testReadAll() throws UnsupportedEncodingException, ParseException { for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){ @@ -205,6 +222,7 @@ public class TestController { } + @PostMapping("getPMPPBySubId") @ApiImplicitParams({ @ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) , diff --git a/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineSubIdForImportDTO.java b/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineSubIdForImportDTO.java new file mode 100644 index 0000000..b85b4af --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineSubIdForImportDTO.java @@ -0,0 +1,28 @@ +package com.cnbm.packing.dto; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; + + +/** + * 打印标签模板表 + * + * @author codeGenerator + * @since 2023-02-20 + */ +@Data +@ApiModel(value = "camline 查询对象") +public class CamlineSubIdForImportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String subId; + private String powerLevel; + + private String sapMaterial; + + private String orderName; + +} \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java index f5a00c8..5daa7dd 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java +++ b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java @@ -2,6 +2,7 @@ package com.cnbm.packing.mapper; import com.cnbm.packing.dto.CamlineExtendArgDTO; import com.cnbm.packing.dto.CamlineSubIdDTO; +import com.cnbm.packing.dto.CamlineSubIdForImportDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -29,4 +30,6 @@ public interface CamlineMapper { Integer getTodayBoxNum(); CamlineSubIdDTO getSubIdByCamline(@Param("subId") String subId); + + List getSubIdByCamlineForImpoet(); } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java index 7d62c31..2117e3a 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java @@ -3,6 +3,7 @@ package com.cnbm.packing.service; import com.cnbm.dynamic.datasource.annotation.DataSource; import com.cnbm.packing.dto.CamlineExtendArgDTO; import com.cnbm.packing.dto.CamlineSubIdDTO; +import com.cnbm.packing.dto.CamlineSubIdForImportDTO; import com.cnbm.packing.dto.WoPowerLevelDTO; import com.cnbm.packing.mapper.CamlineMapper; @@ -54,4 +55,10 @@ public class DynamicDataSourceService { return mapper.getExtendArgFromCamline(subId); } + @DataSource("camline") + @Transactional + public List getAlllCamlineSubForImp(){ + return mapper.getSubIdByCamlineForImpoet(); + } + } diff --git a/ym-packing/src/main/resources/mapper/CamlineMapper.xml b/ym-packing/src/main/resources/mapper/CamlineMapper.xml index 93e5311..e139c79 100644 --- a/ym-packing/src/main/resources/mapper/CamlineMapper.xml +++ b/ym-packing/src/main/resources/mapper/CamlineMapper.xml @@ -11,6 +11,12 @@ + + + + + + @@ -58,16 +64,15 @@ @@ -137,6 +142,94 @@ and tu.name = #{subId} + +