2023-02-14 09:08:21 +08:00
|
|
|
|
package com.cnbm.packing.controller;
|
|
|
|
|
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import com.cnbm.admin.annotation.LogOperation;
|
2023-02-25 14:19:33 +08:00
|
|
|
|
import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
|
|
|
|
import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
|
|
|
|
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;
|
2023-03-03 14:33:18 +08:00
|
|
|
|
import com.cnbm.packing.dto.CamlineSubIdDTO;
|
2023-03-04 13:57:07 +08:00
|
|
|
|
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import com.cnbm.packing.dto.PowerReportDTO;
|
2023-03-03 14:33:18 +08:00
|
|
|
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import com.cnbm.packing.param.PowerReportQueryParam;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import com.cnbm.packing.param.SubIdQueryParam;
|
2023-02-24 14:21:25 +08:00
|
|
|
|
import com.cnbm.packing.service.DynamicDataSourceService;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
2023-03-03 14:33:18 +08:00
|
|
|
|
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import com.cnbm.packing.vo.PowerReportVo;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import com.cnbm.packing.vo.SubIdPageVo;
|
2023-02-25 14:19:33 +08:00
|
|
|
|
import com.cnbm.s7.entity.R;
|
|
|
|
|
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
2023-03-01 17:06:24 +08:00
|
|
|
|
import com.cnbm.s7.s7connector.type.PlcVar;
|
2023-02-14 09:08:21 +08:00
|
|
|
|
import io.swagger.annotations.Api;
|
2023-02-24 14:21:25 +08:00
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
2023-02-25 14:19:33 +08:00
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
2023-02-24 14:21:25 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
2023-02-14 09:08:21 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import com.cnbm.common.utils.Result;
|
2023-02-24 14:21:25 +08:00
|
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import javax.validation.groups.Default;
|
2023-02-25 14:19:33 +08:00
|
|
|
|
import java.io.UnsupportedEncodingException;
|
2023-03-01 17:06:24 +08:00
|
|
|
|
import java.math.BigDecimal;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
import java.text.DecimalFormat;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import java.text.Format;
|
2023-02-25 14:19:33 +08:00
|
|
|
|
import java.text.ParseException;
|
2023-03-03 14:33:18 +08:00
|
|
|
|
import java.util.Arrays;
|
2023-03-17 12:39:56 +08:00
|
|
|
|
import java.util.Date;
|
2023-03-04 13:57:07 +08:00
|
|
|
|
import java.util.List;
|
2023-02-24 14:21:25 +08:00
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
2023-02-25 14:19:33 +08:00
|
|
|
|
|
2023-02-14 09:08:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* @Author weihongyang
|
|
|
|
|
* @Date 2022/6/24 8:57 AM
|
|
|
|
|
* @Version 1.0
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
2023-02-24 14:21:25 +08:00
|
|
|
|
@RequestMapping("/test")
|
|
|
|
|
@Api(tags="测试接口")
|
2023-02-14 09:08:21 +08:00
|
|
|
|
public class TestController {
|
|
|
|
|
|
2023-02-25 14:19:33 +08:00
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
2023-02-24 14:21:25 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
DynamicDataSourceService service;
|
2023-03-03 14:33:18 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
|
2023-03-06 11:24:16 +08:00
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
WoPackagingBoxServiceBiz boxServiceBiz;
|
|
|
|
|
|
2023-03-17 12:39:56 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
WoPackagingBoxSubstrateMapper subMapper;
|
|
|
|
|
|
|
|
|
|
|
2023-02-25 14:19:33 +08:00
|
|
|
|
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());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Object read(S7Client s7Client,Step1Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
try {
|
|
|
|
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object read(S7Client s7Client,Step2Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
try {
|
|
|
|
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Object read(S7Client s7Client,Step2Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
try {
|
|
|
|
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object read(S7Client s7Client,Step3Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
try {
|
|
|
|
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Object read(S7Client s7Client,Step3Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
try {
|
|
|
|
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-03 14:33:18 +08:00
|
|
|
|
@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();
|
|
|
|
|
}
|
2023-03-17 12:39:56 +08:00
|
|
|
|
|
|
|
|
|
@PostMapping("/subPageMapper")
|
|
|
|
|
@ApiOperation(value = "基板表 left join box表 分页查询")
|
|
|
|
|
|
|
|
|
|
public com.cnbm.packing.vo.R<IPage<SubIdPageVo>> subPageMapper(@Validated({Default.class}) @RequestBody SubIdQueryParam param) {
|
|
|
|
|
|
|
|
|
|
return boxServiceBiz.subIdPage(param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-03-04 13:57:07 +08:00
|
|
|
|
@PostMapping("/forImport")
|
|
|
|
|
public R forImport() throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
List<CamlineSubIdForImportDTO> 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();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 12:39:56 +08:00
|
|
|
|
@PostMapping("/forTestMix")
|
|
|
|
|
public R forTestMix() throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
String[] s = new String[20];
|
|
|
|
|
s[0]= "30110012303021614";
|
|
|
|
|
s[1]= "30110012303022415";
|
|
|
|
|
s[2]= "30110012303022801";
|
|
|
|
|
s[3]= "30110012303040003";
|
|
|
|
|
s[4]= "30110012303030488";
|
|
|
|
|
s[5]= "30110012303020247";
|
|
|
|
|
s[6]= "30110012303021008";
|
|
|
|
|
s[7]= "30110012303022434";
|
|
|
|
|
s[8]= "30110012303012878";
|
|
|
|
|
s[9]= "30110012302281212";
|
|
|
|
|
s[10]= "30110012302281213";
|
|
|
|
|
s[11]= "30110012302281215";
|
|
|
|
|
s[12]= "30110012302271160";
|
|
|
|
|
s[13]= "30110012302271154";
|
|
|
|
|
s[14]= "30110012303050321";
|
|
|
|
|
s[15]= "30110012303050331";
|
|
|
|
|
s[16]= "30110012303020036";
|
|
|
|
|
s[17]= "30110012303022606";
|
|
|
|
|
s[18]= "30110012303030009";
|
|
|
|
|
s[19]= "30110012303021795";
|
|
|
|
|
System.out.println(isMixLevel(s));;
|
|
|
|
|
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(s[0]);
|
|
|
|
|
System.out.println(bySubId.getSapMaterial());
|
|
|
|
|
System.out.println(getErrorBoxId(bySubId.getSapMaterial()));
|
|
|
|
|
System.out.println(getBoxId(bySubId.getSapMaterial()));
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
public String formateString(Integer a){
|
|
|
|
|
Format f1 = new DecimalFormat("000");
|
|
|
|
|
return f1.format(a);
|
|
|
|
|
}
|
|
|
|
|
public String getBoxId(String sapMaterial){
|
|
|
|
|
Integer todayBoxNum = service.getTodayBoxNum()+1;
|
|
|
|
|
String nowTime = DateUtil.format(new Date(), "yyMMdd");
|
|
|
|
|
|
|
|
|
|
todayBoxNum+=500;
|
|
|
|
|
String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
public String getErrorBoxId(String sapMaterial){
|
|
|
|
|
|
|
|
|
|
String nowTime = DateUtil.format(new Date(), "yyMMdd");
|
|
|
|
|
String mixBoxError = "001";
|
|
|
|
|
String res = "Err"+sapMaterial+nowTime+mixBoxError;
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
private boolean isMixLevel(String[] subIds){
|
|
|
|
|
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
|
|
|
|
|
String errMsg = "以下基板ID出现混档:";
|
|
|
|
|
boolean res = false;
|
|
|
|
|
for(int i=1;i<subIds.length;i++){
|
|
|
|
|
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
|
|
|
|
|
|
|
|
|
|
if(!powerLevel.equals(correctLevel)){
|
|
|
|
|
errMsg+="基板ID:"+subIds[i]+" 档位:"+powerLevel+", ";
|
|
|
|
|
res = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(res){
|
|
|
|
|
logger.error(errMsg);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-06 11:24:16 +08:00
|
|
|
|
|
|
|
|
|
|
2023-02-25 14:19:33 +08:00
|
|
|
|
@PostMapping("/testReadAll")
|
|
|
|
|
public R testReadAll() throws UnsupportedEncodingException, ParseException {
|
|
|
|
|
for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
for(Step1Mes2PlcVar actual:Step1Mes2PlcVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(Step2Plc2MesVar actual:Step2Plc2MesVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
for(Step2Mes2PlcVar actual:Step2Mes2PlcVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(Step3Plc2MesVar actual:Step3Plc2MesVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
for(Step3Mes2PlcVar actual:Step3Mes2PlcVar.values()){
|
|
|
|
|
logger.info(read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString());
|
|
|
|
|
}
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
2023-03-01 17:06:24 +08:00
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
BigDecimal voc = new BigDecimal(59.799);
|
|
|
|
|
System.out.println(Float.valueOf(voc.toString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/testWrite")
|
|
|
|
|
public R testWrite() {
|
|
|
|
|
BigDecimal voc = new BigDecimal(59.799);
|
|
|
|
|
BigDecimal isc = new BigDecimal(3.799);
|
|
|
|
|
BigDecimal vmpp = new BigDecimal(46.799);
|
|
|
|
|
BigDecimal impp = new BigDecimal(3.0799);
|
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,new Integer(1));
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.dLable_Pnom.getName()+" : "+1);
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,voc);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.dLable_Voc.getName()+" : "+voc.toPlainString());
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,isc);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.dLable_Isc.getName()+" : "+isc.toPlainString());
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,vmpp);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.dLable_Vmpp.getName()+" : "+vmpp.toPlainString());
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,impp);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.dLable_Impp.getName()+" : "+impp.toPlainString());
|
2023-03-01 17:06:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,"12345678901111111111");
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step2Mes2PlcVar.BoxId.getName()+" : "+"12345678901111111111");
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step1Mes2PlcVar.SubArrivedFinish.getName()+" : "+"true");
|
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step2Mes2PlcVar.ShelfIsFullFinish.getName()+" : "+"false");
|
2023-03-01 17:06:24 +08:00
|
|
|
|
|
|
|
|
|
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
2023-03-03 14:33:18 +08:00
|
|
|
|
System.out.println(Step3Mes2PlcVar.ShelfIsFullArrivedFinish.getName()+" : "+"true");
|
2023-03-01 17:06:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
2023-02-25 14:19:33 +08:00
|
|
|
|
@PostMapping("/testlogger")
|
|
|
|
|
public R testlogger() {
|
|
|
|
|
logger.info("test logger");
|
|
|
|
|
System.out.println("test logger");
|
2023-03-03 14:33:18 +08:00
|
|
|
|
// 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());
|
|
|
|
|
}
|
2023-02-25 14:19:33 +08:00
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-03-04 13:57:07 +08:00
|
|
|
|
|
2023-02-24 14:21:25 +08:00
|
|
|
|
@PostMapping("getPMPPBySubId")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
|
|
|
|
})
|
|
|
|
|
public Result<Float> getPMPPBySubId(@ApiIgnore @RequestParam Map<String, Object> params){
|
|
|
|
|
Object subId = params.get("subId");
|
|
|
|
|
return new Result<Float>().ok(service.getPMPPBySubId(subId.toString()));
|
|
|
|
|
}
|
|
|
|
|
@PostMapping("getOrderNameBySubId")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
|
|
|
|
})
|
|
|
|
|
public Result<String> getOrderNameBySubId(@ApiIgnore @RequestParam Map<String, Object> params){
|
|
|
|
|
Object subId = params.get("subId");
|
|
|
|
|
//service.getExtendArgFromCamline()
|
|
|
|
|
return new Result<String>().ok(service.getOrderNameBySubId(subId.toString()));
|
2023-02-14 09:08:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-24 14:21:25 +08:00
|
|
|
|
@PostMapping("getExtendArgFromCamline")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
|
|
|
|
})
|
|
|
|
|
public Result<String> getExtendArgFromCamline(@ApiIgnore @RequestParam Map<String, Object> params){
|
|
|
|
|
Object subId = params.get("subId");
|
|
|
|
|
return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString());
|
2023-02-14 09:08:21 +08:00
|
|
|
|
}
|
2023-02-24 14:21:25 +08:00
|
|
|
|
|
2023-03-01 17:06:24 +08:00
|
|
|
|
private void write(S7Client s7Client, Step1Mes2PlcVar var, Object newValue) {
|
|
|
|
|
if(var.getType().equals(PlcVar.STRING_Array)){
|
|
|
|
|
String[] s = (String[])newValue;
|
|
|
|
|
String[] ss = (String[])newValue;
|
|
|
|
|
if(s.length > var.getLength() ){
|
|
|
|
|
ss = new String[var.getLength()];
|
|
|
|
|
for(int i=0;i< var.getLength();i++){
|
|
|
|
|
ss[i] = s[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
|
|
|
|
|
}else {
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void write(S7Client s7Client, Step2Mes2PlcVar var, Object newValue) {
|
|
|
|
|
if(var.getType().equals(PlcVar.STRING_Array)){
|
|
|
|
|
String[] s = (String[])newValue;
|
|
|
|
|
String[] ss = (String[])newValue;
|
|
|
|
|
if(s.length > var.getLength() ){
|
|
|
|
|
ss = new String[var.getLength()];
|
|
|
|
|
for(int i=0;i< var.getLength();i++){
|
|
|
|
|
ss[i] = s[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
|
|
|
|
|
}else {
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void write(S7Client s7Client, Step3Mes2PlcVar var, Object newValue) {
|
|
|
|
|
if(var.getType().equals(PlcVar.STRING_Array)){
|
|
|
|
|
String[] s = (String[])newValue;
|
|
|
|
|
String[] ss = (String[])newValue;
|
|
|
|
|
if(s.length > var.getLength() ){
|
|
|
|
|
ss = new String[var.getLength()];
|
|
|
|
|
for(int i=0;i< var.getLength();i++){
|
|
|
|
|
ss[i] = s[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
|
|
|
|
|
}else {
|
|
|
|
|
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-14 09:08:21 +08:00
|
|
|
|
}
|