PLC增加调度

master
erzhongxmu 2022-11-24 22:13:05 +08:00
parent c8c3f53ba5
commit 54720c6251
3 changed files with 505 additions and 481 deletions

View File

@ -324,7 +324,8 @@ public class MdBinController extends BaseController {
executor.execute(new Runnable() {
@Override
public void run() {
runagv(binFrom, binTo,startcom,midcom,endcom);
runagv(binFrom, binTo, startcom, midcom, endcom, type);
}
});
} catch (Exception e) {
@ -406,9 +407,8 @@ public class MdBinController extends BaseController {
return j;
}
public void runagv(String binfrom, String binto, String startcom, String midcom, String endcom) {
public void runagv(String binfrom, String binto, String startcom, String midcom, String endcom, String type) {
if ("diaodu".equals(type)) {
List<MdBinEntity> mdblistfrom = systemService.findByProperty(MdBinEntity.class, "kuWeiBianMa", binfrom);
List<MdBinEntity> mdblistto = systemService.findByProperty(MdBinEntity.class, "kuWeiBianMa", binto);
MdBinEntity mdBinEntityfrom = mdblistfrom.get(0);
@ -466,6 +466,10 @@ public class MdBinController extends BaseController {
System.out.println("endcom,endcom:" + endcom);
wmsPlcController.run("", endcom, hxstepNum);
}
} else {
wmsPlcController.runu();
}
}
/**

View File

@ -1,9 +1,11 @@
package com.zzjee.plc.controller;
import HslCommunication.Core.Types.OperateResult;
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.zzjee.plc.entity.WmsPlcEntity;
import com.zzjee.plc.service.WmsPlcServiceI;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
@ -35,6 +37,7 @@ import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -45,12 +48,16 @@ import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map;
import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity;
@ -64,20 +71,21 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.net.URI;
import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder;
/**
* @author onlineGenerator
* @version V1.0
* @Title: Controller
* @Description: PLC
* @author onlineGenerator
* @date 2022-09-12 18:33:25
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmsPlcController")
@ -95,7 +103,6 @@ public class WmsPlcController extends BaseController {
private Validator validator;
/**
* PLC
*
@ -176,11 +183,25 @@ public class WmsPlcController extends BaseController {
j.setMsg(message);
return j;
}
public void runu() {
WmsPlcEntity wmsPlc = null;
String hql = "";
List<WmsPlcEntity> wmsPlcEntityList = new ArrayList<WmsPlcEntity>();
hql = "from WmsPlcEntity t where t.comNo = ? ";
wmsPlcEntityList = systemService.findHql(hql, "runu");
if (!CollectionUtils.isEmpty(wmsPlcEntityList)) {
wmsPlc = wmsPlcEntityList.get(0);
}
String[] coms = wmsPlc.getComCons().split(";");
for (String com : coms) {
String comid[] = com.split(",");
String comno = comid[0];
String comstep = comid[1];
run("", comno, comstep);
}
}
public void run(String id, String comNo, String stepNum) {
System.out.println("id:" + id + ";comNo:" + comNo + ";stepNum:" + stepNum);
if (stepNum.equals("0")) {
return;
@ -246,25 +267,21 @@ public class WmsPlcController extends BaseController {
} else {
siemensS7Net.Write(defaultAddress, true);
}
}
else if(split[0].equals("float")){
} else if (split[0].equals("float")) {
Float runfloat = Float.parseFloat(split[2]) * stepNumrun;
System.out.println("runfloat" + Math.abs(runfloat));
siemensS7Net.Write(defaultAddress, Math.abs(runfloat));
}
else if(split[0].equals("-float")){
} else if (split[0].equals("-float")) {
Float runfloat = Float.parseFloat(split[2]) * stepNumrun;
System.out.println("runfloat" + runfloat);
siemensS7Net.Write(defaultAddress, runfloat);
}
else if(split[0].equals("int")){
} else if (split[0].equals("int")) {
Float runfloat = Float.parseFloat(split[2]) * stepNumrun;
Float abs = Math.abs(runfloat);
int runint = abs.intValue();
System.out.println("runint" + runint);
siemensS7Net.Write(defaultAddress, runint);
}
else if(split[0].equals("-int")){
} else if (split[0].equals("-int")) {
Float runfloat = Float.parseFloat(split[2]) * stepNumrun;
int runint = runfloat.intValue();
System.out.println("runint" + runint);
@ -286,8 +303,8 @@ public class WmsPlcController extends BaseController {
}
}
/**
* PLC
*
@ -379,6 +396,7 @@ public class WmsPlcController extends BaseController {
}
return new ModelAndView("com/zzjee/plc/wmsPlc-add");
}
/**
* PLC
*
@ -423,6 +441,7 @@ public class WmsPlcController extends BaseController {
modelMap.put(NormalExcelConstants.DATA_LIST, wmsPlcs);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*

View File

@ -54,6 +54,7 @@
<%-- <span style="vertical-align:middle;display:-moz-inline-box;display:inline-block;width: 90px;text-align:right;">--%>
<button onclick="chaxun('zhengxiang')">加载储位</button> </span>
<button onclick="chaxun('diaodu')">调度</button> </span>
<button onclick="chaxun('diaoduu')">U型调度</button> </span>
</div>