PLC指令集

master
cez 2022-09-12 18:38:26 +08:00
parent 270d54c78f
commit 5fe8fe5e2c
9 changed files with 1441 additions and 0 deletions

View File

@ -0,0 +1,406 @@
package com.zzjee.plc.controller;
import com.zzjee.plc.entity.WmsPlcEntity;
import com.zzjee.plc.service.WmsPlcServiceI;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.common.TreeChildCount;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
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;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
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;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
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;
/**
* @Title: Controller
* @Description: PLC
* @author onlineGenerator
* @date 2022-09-12 18:33:25
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmsPlcController")
public class WmsPlcController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(WmsPlcController.class);
@Autowired
private WmsPlcServiceI wmsPlcService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
* PLC
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/plc/wmsPlcList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(WmsPlcEntity wmsPlc,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmsPlcEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmsPlc, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.wmsPlcService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* PLC
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(WmsPlcEntity wmsPlc, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
wmsPlc = systemService.getEntity(WmsPlcEntity.class, wmsPlc.getId());
message = "PLC指令删除成功";
try{
wmsPlcService.delete(wmsPlc);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "PLC指令删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* PLC
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "PLC指令删除成功";
try{
for(String id:ids.split(",")){
WmsPlcEntity wmsPlc = systemService.getEntity(WmsPlcEntity.class,
id
);
wmsPlcService.delete(wmsPlc);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "PLC指令删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* PLC
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(WmsPlcEntity wmsPlc, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "PLC指令添加成功";
try{
wmsPlcService.save(wmsPlc);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "PLC指令添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* PLC
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(WmsPlcEntity wmsPlc, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "PLC指令更新成功";
WmsPlcEntity t = wmsPlcService.get(WmsPlcEntity.class, wmsPlc.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(wmsPlc, t);
wmsPlcService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "PLC指令更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* PLC
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(WmsPlcEntity wmsPlc, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wmsPlc.getId())) {
wmsPlc = wmsPlcService.getEntity(WmsPlcEntity.class, wmsPlc.getId());
req.setAttribute("wmsPlcPage", wmsPlc);
}
return new ModelAndView("com/zzjee/plc/wmsPlc-add");
}
/**
* PLC
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(WmsPlcEntity wmsPlc, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wmsPlc.getId())) {
wmsPlc = wmsPlcService.getEntity(WmsPlcEntity.class, wmsPlc.getId());
req.setAttribute("wmsPlcPage", wmsPlc);
}
return new ModelAndView("com/zzjee/plc/wmsPlc-update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmsPlcController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(WmsPlcEntity wmsPlc,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmsPlcEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmsPlc, request.getParameterMap());
List<WmsPlcEntity> wmsPlcs = this.wmsPlcService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"PLC指令");
modelMap.put(NormalExcelConstants.CLASS,WmsPlcEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("PLC指令列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmsPlcs);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmsPlcEntity wmsPlc,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"PLC指令");
modelMap.put(NormalExcelConstants.CLASS,WmsPlcEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("PLC指令列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<WmsPlcEntity> listWmsPlcEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmsPlcEntity.class,params);
for (WmsPlcEntity wmsPlc : listWmsPlcEntitys) {
wmsPlcService.save(wmsPlc);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public List<WmsPlcEntity> list() {
List<WmsPlcEntity> listWmsPlcs=wmsPlcService.getList(WmsPlcEntity.class);
return listWmsPlcs;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) {
WmsPlcEntity task = wmsPlcService.get(WmsPlcEntity.class, id);
if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
return new ResponseEntity(task, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<?> create(@RequestBody WmsPlcEntity wmsPlc, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WmsPlcEntity>> failures = validator.validate(wmsPlc);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
wmsPlcService.save(wmsPlc);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = wmsPlc.getId();
URI uri = uriBuilder.path("/rest/wmsPlcController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);
return new ResponseEntity(headers, HttpStatus.CREATED);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody WmsPlcEntity wmsPlc) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WmsPlcEntity>> failures = validator.validate(wmsPlc);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
wmsPlcService.saveOrUpdate(wmsPlc);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) {
wmsPlcService.deleteEntityById(WmsPlcEntity.class, id);
}
}

View File

@ -0,0 +1,369 @@
package com.zzjee.plc.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: PLC
* @author onlineGenerator
* @date 2022-09-12 18:33:25
* @version V1.0
*
*/
@Entity
@Table(name = "wms_plc", schema = "")
@SuppressWarnings("serial")
public class WmsPlcEntity implements java.io.Serializable {
/**主键*/
private String id;
/**创建人名称*/
private String createName;
/**创建人登录名称*/
private String createBy;
/**创建日期*/
private Date createDate;
/**更新人名称*/
private String updateName;
/**更新人登录名称*/
private String updateBy;
/**更新日期*/
private Date updateDate;
/**所属部门*/
private String sysOrgCode;
/**所属公司*/
private String sysCompanyCode;
/**流程状态*/
private String bpmStatus;
/**PLCIP*/
@Excel(name="PLCIP")
private String plcIp;
/**PLC端口*/
@Excel(name="PLC端口")
private String plcPort;
/**PLC型号*/
@Excel(name="PLC型号")
private String plcType;
/**指令备注*/
@Excel(name="指令备注")
private String comRemark;
/**执行时间*/
@Excel(name="执行时间")
private String comTime;
/**执行顺序*/
@Excel(name="执行顺序")
private String comSeq;
/**指令集*/
@Excel(name="指令集")
private String comCons;
/**备用1*/
@Excel(name="备用1")
private String remark1;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public String getCreateName(){
return this.createName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateName(String createName){
this.createName = createName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public String getCreateBy(){
return this.createBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateBy(String createBy){
this.createBy = createBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public Date getCreateDate(){
return this.createDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setCreateDate(Date createDate){
this.createDate = createDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public String getUpdateName(){
return this.updateName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateName(String updateName){
this.updateName = updateName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public String getUpdateBy(){
return this.updateBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateBy(String updateBy){
this.updateBy = updateBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="UPDATE_DATE",nullable=true,length=20)
public Date getUpdateDate(){
return this.updateDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setUpdateDate(Date updateDate){
this.updateDate = updateDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysOrgCode(String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
public String getSysCompanyCode(){
return this.sysCompanyCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysCompanyCode(String sysCompanyCode){
this.sysCompanyCode = sysCompanyCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="BPM_STATUS",nullable=true,length=32)
public String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String PLCIP
*/
@Column(name ="PLC_IP",nullable=true,length=32)
public String getPlcIp(){
return this.plcIp;
}
/**
*: java.lang.String
*@param: java.lang.String PLCIP
*/
public void setPlcIp(String plcIp){
this.plcIp = plcIp;
}
/**
*: java.lang.String
*@return: java.lang.String PLC
*/
@Column(name ="PLC_PORT",nullable=true,length=32)
public String getPlcPort(){
return this.plcPort;
}
/**
*: java.lang.String
*@param: java.lang.String PLC
*/
public void setPlcPort(String plcPort){
this.plcPort = plcPort;
}
/**
*: java.lang.String
*@return: java.lang.String PLC
*/
@Column(name ="PLC_TYPE",nullable=true,length=32)
public String getPlcType(){
return this.plcType;
}
/**
*: java.lang.String
*@param: java.lang.String PLC
*/
public void setPlcType(String plcType){
this.plcType = plcType;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="COM_REMARK",nullable=true,length=32)
public String getComRemark(){
return this.comRemark;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setComRemark(String comRemark){
this.comRemark = comRemark;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="COM_TIME",nullable=true,length=32)
public String getComTime(){
return this.comTime;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setComTime(String comTime){
this.comTime = comTime;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="COM_SEQ",nullable=true,length=32)
public String getComSeq(){
return this.comSeq;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setComSeq(String comSeq){
this.comSeq = comSeq;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="COM_CONS",nullable=true,length=32)
public String getComCons(){
return this.comCons;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setComCons(String comCons){
this.comCons = comCons;
}
/**
*: java.lang.String
*@return: java.lang.String 1
*/
@Column(name ="REMARK1",nullable=true,length=32)
public String getRemark1(){
return this.remark1;
}
/**
*: java.lang.String
*@param: java.lang.String 1
*/
public void setRemark1(String remark1){
this.remark1 = remark1;
}
}

View File

@ -0,0 +1,15 @@
package com.zzjee.plc.service;
import com.zzjee.plc.entity.WmsPlcEntity;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface WmsPlcServiceI extends CommonService{
public void delete(WmsPlcEntity entity) throws Exception;
public Serializable save(WmsPlcEntity entity) throws Exception;
public void saveOrUpdate(WmsPlcEntity entity) throws Exception;
}

View File

@ -0,0 +1,152 @@
package com.zzjee.plc.service.impl;
import com.zzjee.plc.service.WmsPlcServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.zzjee.plc.entity.WmsPlcEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.io.Serializable;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.MyClassLoader;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
@Service("wmsPlcService")
@Transactional
public class WmsPlcServiceImpl extends CommonServiceImpl implements WmsPlcServiceI {
public void delete(WmsPlcEntity entity) throws Exception{
super.delete(entity);
//执行删除操作增强业务
this.doDelBus(entity);
}
public Serializable save(WmsPlcEntity entity) throws Exception{
Serializable t = super.save(entity);
//执行新增操作增强业务
this.doAddBus(entity);
return t;
}
public void saveOrUpdate(WmsPlcEntity entity) throws Exception{
super.saveOrUpdate(entity);
//执行更新操作增强业务
this.doUpdateBus(entity);
}
/**
*
* @param t
* @return
*/
private void doAddBus(WmsPlcEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(WmsPlcEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param id
* @return
*/
private void doDelBus(WmsPlcEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
private Map<String,Object> populationMap(WmsPlcEntity t){
Map<String,Object> map = new HashMap<String,Object>();
map.put("id", t.getId());
map.put("create_name", t.getCreateName());
map.put("create_by", t.getCreateBy());
map.put("create_date", t.getCreateDate());
map.put("update_name", t.getUpdateName());
map.put("update_by", t.getUpdateBy());
map.put("update_date", t.getUpdateDate());
map.put("sys_org_code", t.getSysOrgCode());
map.put("sys_company_code", t.getSysCompanyCode());
map.put("bpm_status", t.getBpmStatus());
map.put("plc_ip", t.getPlcIp());
map.put("plc_port", t.getPlcPort());
map.put("plc_type", t.getPlcType());
map.put("com_remark", t.getComRemark());
map.put("com_time", t.getComTime());
map.put("com_seq", t.getComSeq());
map.put("com_cons", t.getComCons());
map.put("remark1", t.getRemark1());
return map;
}
/**
* sql
* @param sql
* @param t
* @return
*/
public String replaceVal(String sql,WmsPlcEntity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
sql = sql.replace("#{sys_org_code}",String.valueOf(t.getSysOrgCode()));
sql = sql.replace("#{sys_company_code}",String.valueOf(t.getSysCompanyCode()));
sql = sql.replace("#{bpm_status}",String.valueOf(t.getBpmStatus()));
sql = sql.replace("#{plc_ip}",String.valueOf(t.getPlcIp()));
sql = sql.replace("#{plc_port}",String.valueOf(t.getPlcPort()));
sql = sql.replace("#{plc_type}",String.valueOf(t.getPlcType()));
sql = sql.replace("#{com_remark}",String.valueOf(t.getComRemark()));
sql = sql.replace("#{com_time}",String.valueOf(t.getComTime()));
sql = sql.replace("#{com_seq}",String.valueOf(t.getComSeq()));
sql = sql.replace("#{com_cons}",String.valueOf(t.getComCons()));
sql = sql.replace("#{remark1}",String.valueOf(t.getRemark1()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
/**
* JAVA
*/
private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map<String,Object> data) throws Exception {
if(StringUtil.isNotEmpty(cgJavaValue)){
Object obj = null;
try {
if("class".equals(cgJavaType)){
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
}else if("spring".equals(cgJavaType)){
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
}
if(obj instanceof CgformEnhanceJavaInter){
CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj;
javaInter.execute("wms_plc",data);
}
} catch (Exception e) {
e.printStackTrace();
throw new Exception("执行JAVA增强出现异常");
}
}
}
}

View File

@ -0,0 +1,206 @@
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PLC指令</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="online/template/ledefault/css/vendor.css">
<link rel="stylesheet" href="online/template/ledefault/css/bootstrap-theme.css">
<link rel="stylesheet" href="online/template/ledefault/css/bootstrap.css">
<link rel="stylesheet" href="online/template/ledefault/css/app.css">
<link rel="stylesheet" href="plug-in/Validform/css/metrole/style.css" type="text/css"/>
<link rel="stylesheet" href="plug-in/Validform/css/metrole/tablefrom.css" type="text/css"/>
<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
<script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
<script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/datatype_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js"></script>
<script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
//编写自定义JS代码
</script>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="wmsPlcController.do?doAdd" tiptype="1" >
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" id="id" name="id"/>
<div class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="javascript:void(0);">PLC指令</a></li>
</ul>
<!-- tab内容 -->
<div class="con-wrapper" id="con-wrapper1" style="display: block;">
<div class="row form-wrapper">
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLCIP</b>
</div>
<div class="col-xs-3">
<input id="plcIp" name="plcIp" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLCIP</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLC端口</b>
</div>
<div class="col-xs-3">
<input id="plcPort" name="plcPort" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLC端口</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLC型号</b>
</div>
<div class="col-xs-3">
<input id="plcType" name="plcType" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLC型号</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>指令备注:</b>
</div>
<div class="col-xs-3">
<input id="comRemark" name="comRemark" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">指令备注</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>执行时间:</b>
</div>
<div class="col-xs-3">
<input id="comTime" name="comTime" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">执行时间</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>执行顺序:</b>
</div>
<div class="col-xs-3">
<input id="comSeq" name="comSeq" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">执行顺序</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>指令集:</b>
</div>
<div class="col-xs-3">
<textarea id="comCons" class="form-control" rows="6"
ignore="ignore"
name="comCons"></textarea>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">指令集</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>备用1</b>
</div>
<div class="col-xs-3">
<input id="remark1" name="remark1" type="text" class="form-control"
ignore="ignore"
/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">备用1</label>
</div>
</div>
<div class="row" id = "sub_tr" style="display: none;">
<div class="col-xs-12 layout-header">
<div class="col-xs-6"></div>
<div class="col-xs-6"><button type="button" onclick="neibuClick();" class="btn btn-default">提交</button></div>
</div>
</div>
</div>
</div>
<div class="con-wrapper" id="con-wrapper2" style="display: block;"></div>
</div>
</t:formvalid>
<script type="text/javascript">
$(function(){
//查看模式情况下,删除和上传附件功能禁止使用
if(location.href.indexOf("load=detail")!=-1){
$(".jeecgDetail").hide();
}
if(location.href.indexOf("mode=read")!=-1){
//查看模式控件禁用
$("#formobj").find(":input").attr("disabled","disabled");
}
if(location.href.indexOf("mode=onbutton")!=-1){
//其他模式显示提交按钮
$("#sub_tr").show();
}
});
var neibuClickFlag = false;
function neibuClick() {
neibuClickFlag = true;
$('#btn_sub').trigger('click');
}
</script>
</body>
<script src = "webpage/com/zzjee/plc/wmsPlc.js"></script>
</html>

View File

@ -0,0 +1,206 @@
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PLC指令</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="online/template/ledefault/css/vendor.css">
<link rel="stylesheet" href="online/template/ledefault/css/bootstrap-theme.css">
<link rel="stylesheet" href="online/template/ledefault/css/bootstrap.css">
<link rel="stylesheet" href="online/template/ledefault/css/app.css">
<link rel="stylesheet" href="plug-in/Validform/css/metrole/style.css" type="text/css"/>
<link rel="stylesheet" href="plug-in/Validform/css/metrole/tablefrom.css" type="text/css"/>
<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
<script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
<script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/datatype_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js"></script>
<script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
//编写自定义JS代码
</script>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="wmsPlcController.do?doUpdate" tiptype="1" >
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" name="id" value='${wmsPlcPage.id}' >
<div class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="javascript:void(0);">PLC指令</a></li>
</ul>
<!-- tab内容 -->
<div class="con-wrapper" id="con-wrapper1" style="display: block;">
<div class="row form-wrapper">
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLCIP</b>
</div>
<div class="col-xs-3">
<input id="plcIp" name="plcIp" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.plcIp}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLCIP</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLC端口</b>
</div>
<div class="col-xs-3">
<input id="plcPort" name="plcPort" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.plcPort}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLC端口</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>PLC型号</b>
</div>
<div class="col-xs-3">
<input id="plcType" name="plcType" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.plcType}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">PLC型号</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>指令备注:</b>
</div>
<div class="col-xs-3">
<input id="comRemark" name="comRemark" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.comRemark}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">指令备注</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>执行时间:</b>
</div>
<div class="col-xs-3">
<input id="comTime" name="comTime" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.comTime}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">执行时间</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>执行顺序:</b>
</div>
<div class="col-xs-3">
<input id="comSeq" name="comSeq" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.comSeq}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">执行顺序</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>指令集:</b>
</div>
<div class="col-xs-3">
<textarea id="comCons" class="form-control" rows="6"
ignore="ignore"
name="comCons">${wmsPlcPage.comCons}</textarea>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">指令集</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>备用1</b>
</div>
<div class="col-xs-3">
<input id="remark1" name="remark1" type="text" class="form-control"
ignore="ignore"
value='${wmsPlcPage.remark1}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">备用1</label>
</div>
</div>
<div class="row" id = "sub_tr" style="display: none;">
<div class="col-xs-12 layout-header">
<div class="col-xs-6"></div>
<div class="col-xs-6"><button type="button" onclick="neibuClick();" class="btn btn-default">提交</button></div>
</div>
</div>
</div>
</div>
<div class="con-wrapper" id="con-wrapper2" style="display: block;"></div>
</div>
</t:formvalid>
<script type="text/javascript">
$(function(){
//查看模式情况下,删除和上传附件功能禁止使用
if(location.href.indexOf("load=detail")!=-1){
$(".jeecgDetail").hide();
}
if(location.href.indexOf("mode=read")!=-1){
//查看模式控件禁用
$("#formobj").find(":input").attr("disabled","disabled");
}
if(location.href.indexOf("mode=onbutton")!=-1){
//其他模式显示提交按钮
$("#sub_tr").show();
}
});
var neibuClickFlag = false;
function neibuClick() {
neibuClickFlag = true;
$('#btn_sub').trigger('click');
}
</script>
</body>
<script src = "webpage/com/zzjee/plc/wmsPlc.js"></script>
</html>

View File

@ -0,0 +1,28 @@
//通用弹出式文件上传
function commonUpload(callback){
$.dialog({
content: "url:systemController.do?commonUpload",
lock : true,
title:"文件上传",
zIndex:2100,
width:700,
height: 200,
parent:windowapi,
cache:false,
ok: function(){
var iframe = this.iframe.contentWindow;
iframe.uploadCallback(callback);
return true;
},
cancelVal: '关闭',
cancel: function(){
}
});
}
function decode(value, id) {//value传入值,id接受值
var last = value.lastIndexOf("/");
var filename = value.substring(last + 1, value.length);
$("#" + id).text(decodeURIComponent(filename));
}

View File

@ -0,0 +1,59 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:0px;border:0px">
<t:datagrid name="wmsPlcList" checkbox="false" pagination="true" fitColumns="false" title="PLC指令" actionUrl="wmsPlcController.do?datagrid" idField="id" fit="true" queryMode="group">
<t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="创建人名称" field="createName" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="创建人登录名称" field="createBy" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="更新人名称" field="updateName" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="更新人登录名称" field="updateBy" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="更新日期" field="updateDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="所属部门" field="sysOrgCode" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="所属公司" field="sysCompanyCode" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="流程状态" field="bpmStatus" hidden="true" queryMode="single" dictionary="bpm_status" width="120"></t:dgCol>
<t:dgCol title="PLCIP" field="plcIp" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="PLC端口" field="plcPort" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="PLC型号" field="plcType" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="指令备注" field="comRemark" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="执行时间" field="comTime" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="执行顺序" field="comSeq" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="指令集" field="comCons" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="备用1" field="remark1" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgDelOpt title="删除" url="wmsPlcController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
<t:dgToolBar title="录入" icon="icon-add" url="wmsPlcController.do?goAdd" funname="add"></t:dgToolBar>
<t:dgToolBar title="编辑" icon="icon-edit" url="wmsPlcController.do?goUpdate" funname="update"></t:dgToolBar>
<t:dgToolBar title="批量删除" icon="icon-remove" url="wmsPlcController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
<t:dgToolBar title="查看" icon="icon-search" url="wmsPlcController.do?goUpdate" funname="detail"></t:dgToolBar>
<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
<t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
</t:datagrid>
</div>
</div>
<script src = "webpage/com/zzjee/plc/wmsPlcList.js"></script>
<script type="text/javascript">
$(document).ready(function(){
});
//导入
function ImportXls() {
openwindow('Excel导入', 'wmsPlcController.do?upload', "wmsPlcList");
}
//导出
function ExportXls() {
JeecgExcelExport("wmsPlcController.do?exportXls","wmsPlcList");
}
//模板下载
function ExportXlsByT() {
JeecgExcelExport("wmsPlcController.do?exportXlsByT","wmsPlcList");
}
</script>