commit
This commit is contained in:
		| @@ -6,7 +6,10 @@ import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; | ||||
| 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.entity.WoPackagingBoxSubstrate; | ||||
| import com.cnbm.packing.service.DynamicDataSourceService; | ||||
| import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz; | ||||
| import com.cnbm.s7.entity.R; | ||||
| import com.cnbm.s7.s7connector.enmuc.S7Client; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
| @@ -23,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore; | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.math.BigDecimal; | ||||
| import java.text.ParseException; | ||||
| import java.util.Arrays; | ||||
| import java.util.Map; | ||||
|  | ||||
|  | ||||
| @@ -39,6 +43,8 @@ public class TestController { | ||||
|     private static final Logger logger = LoggerFactory.getLogger(TestController.class); | ||||
|     @Autowired | ||||
|     DynamicDataSourceService service; | ||||
|     @Autowired | ||||
|     WoPackagingBoxSubstrateServiceBiz substrateServiceBiz; | ||||
|     private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
| @@ -95,7 +101,12 @@ public class TestController { | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/forString") | ||||
|     public R forString() throws UnsupportedEncodingException, ParseException { | ||||
|         String[] s = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList); | ||||
|         System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s)); | ||||
|         return R.ok(); | ||||
|     } | ||||
|     @PostMapping("/testReadAll") | ||||
|     public R testReadAll() throws UnsupportedEncodingException, ParseException { | ||||
|         for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){ | ||||
| @@ -139,17 +150,32 @@ public class TestController { | ||||
|         BigDecimal vmpp = new BigDecimal(46.799); | ||||
|         BigDecimal impp = new BigDecimal(3.0799); | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,new Integer(1)); | ||||
|         System.out.println(Step1Mes2PlcVar.dLable_Pnom.getName()+" : "+1); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,voc); | ||||
|         System.out.println(Step1Mes2PlcVar.dLable_Voc.getName()+" : "+voc.toPlainString()); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,isc); | ||||
|         System.out.println(Step1Mes2PlcVar.dLable_Isc.getName()+" : "+isc.toPlainString()); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,vmpp); | ||||
|         System.out.println(Step1Mes2PlcVar.dLable_Vmpp.getName()+" : "+vmpp.toPlainString()); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,impp); | ||||
|         System.out.println(Step1Mes2PlcVar.dLable_Impp.getName()+" : "+impp.toPlainString()); | ||||
|  | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,"12345678901111111111"); | ||||
|         System.out.println(Step2Mes2PlcVar.BoxId.getName()+" : "+"12345678901111111111"); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true); | ||||
|         System.out.println(Step1Mes2PlcVar.SubArrivedFinish.getName()+" : "+"true"); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false); | ||||
|         System.out.println(Step2Mes2PlcVar.ShelfIsFullFinish.getName()+" : "+"false"); | ||||
|  | ||||
|         write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); | ||||
|         System.out.println(Step3Mes2PlcVar.ShelfIsFullArrivedFinish.getName()+" : "+"true"); | ||||
|  | ||||
|  | ||||
|         return R.ok(); | ||||
| @@ -158,6 +184,23 @@ public class TestController { | ||||
|     public R testlogger() { | ||||
|         logger.info("test logger"); | ||||
|         System.out.println("test logger"); | ||||
| //        CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline("30110012302220591"); | ||||
| //        CamlineSubIdDTO subIdByCamline2 = service.getSubIdByCamline("30110012302220591   "); | ||||
| //        System.out.println("subIdByCamline: "+subIdByCamline.toString()); | ||||
| //        System.out.println("subIdByCamline2: "+subIdByCamline2.toString()); | ||||
|  | ||||
| //        WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("30110012302220591   "); | ||||
| //        System.out.println("bySubId: "+bySubId.toString()); | ||||
|  | ||||
|         WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("30110012302210707   "); | ||||
|         if(bySubId == null){ | ||||
|             //todo | ||||
|             CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline("30110012302220591   "); | ||||
|             bySubId = new WoPackagingBoxSubstrate(); | ||||
|             bySubId.setPowerLevel(subIdByCamline.getPowerLevel()); | ||||
|             bySubId.setSapMaterial(subIdByCamline.getSapMaterial()); | ||||
|             System.out.println("bySubId2 : "+bySubId.toString()); | ||||
|         } | ||||
|         return R.ok(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,30 @@ | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * 打印标签模板表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "camline 查询对象") | ||||
| public class CamlineSubIdDTO implements Serializable { | ||||
|  | ||||
| 	private static final long serialVersionUID = 1L; | ||||
|  | ||||
|  | ||||
| 	private String powerLevel; | ||||
|  | ||||
| 	private String sapMaterial; | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.cnbm.packing.mapper; | ||||
|  | ||||
| import com.cnbm.packing.dto.CamlineExtendArgDTO; | ||||
| import com.cnbm.packing.dto.CamlineSubIdDTO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| @@ -26,4 +27,6 @@ public interface CamlineMapper { | ||||
|     CamlineExtendArgDTO getExtendArgFromCamline(@Param("subId") String subId); | ||||
|  | ||||
|     Integer getTodayBoxNum(); | ||||
|  | ||||
|     CamlineSubIdDTO getSubIdByCamline(@Param("subId") String subId); | ||||
| } | ||||
| @@ -15,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper; | ||||
| public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> { | ||||
|     WoPackagingBoxSubstrate getOneByWoSubstrateId(@Param("woSubstrateId") String woSubstrateId); | ||||
|  | ||||
|     int updatePackagingBoxIdByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("woSubstrateId") String woSubstrateId); | ||||
| } | ||||
|  | ||||
|     int updatePackagingBoxIdAndSlotByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("slot") Integer slot, @Param("woSubstrateId") String woSubstrateId); | ||||
| } | ||||
|   | ||||
| @@ -2,6 +2,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.WoPowerLevelDTO; | ||||
| import com.cnbm.packing.mapper.CamlineMapper; | ||||
|  | ||||
| @@ -41,6 +42,12 @@ public class DynamicDataSourceService { | ||||
|         return mapper.getOrderNameBySubId(subId); | ||||
|     } | ||||
|  | ||||
|     @DataSource("camline") | ||||
|     @Transactional | ||||
|     public CamlineSubIdDTO getSubIdByCamline(String subId){ | ||||
|         return mapper.getSubIdByCamline(subId); | ||||
|     } | ||||
|  | ||||
|     @DataSource("camline") | ||||
|     @Transactional | ||||
|     public CamlineExtendArgDTO getExtendArgFromCamline(String subId){ | ||||
|   | ||||
| @@ -35,5 +35,7 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi | ||||
|     void insertSubstrateManual(ChangePackingBoxDTO dto); | ||||
|  | ||||
|     WoPackagingBoxSubstrate getBySubId(String subId); | ||||
|     int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId,String woSubstrateId); | ||||
|  | ||||
|  | ||||
|     int updatePackagingBoxIdAndSlotByWoSubstrateId(String packagingBoxId,Integer slot,String woSubstrateId); | ||||
| } | ||||
| @@ -98,8 +98,11 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens | ||||
|  | ||||
|  | ||||
|         CompensationPowerXSDTO conffBySubIdAndLineBody = mapper.getConffBySubIdAndLineBody(compensationQueryParam); | ||||
|         float res = pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB(); | ||||
|         return res; | ||||
|         if(conffBySubIdAndLineBody!=null){ | ||||
|             return pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB(); | ||||
|         }else { | ||||
|             return pmpp; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -183,7 +183,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) { | ||||
|         return mapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId); | ||||
|     public int updatePackagingBoxIdAndSlotByWoSubstrateId(String packagingBoxId, Integer slot , String woSubstrateId) { | ||||
|         return mapper.updatePackagingBoxIdAndSlotByWoSubstrateId(packagingBoxId,slot,woSubstrateId); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user