From 5fe8fe5e2c2eca27597332676855ed3d8b29629d Mon Sep 17 00:00:00 2001 From: cez Date: Mon, 12 Sep 2022 18:38:26 +0800 Subject: [PATCH] =?UTF-8?q?PLC=E6=8C=87=E4=BB=A4=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plc/controller/WmsPlcController.java | 406 ++++++++++++++++++ .../com/zzjee/plc/entity/WmsPlcEntity.java | 369 ++++++++++++++++ .../com/zzjee/plc/service/WmsPlcServiceI.java | 15 + .../plc/service/impl/WmsPlcServiceImpl.java | 152 +++++++ .../webpage/com/zzjee/plc/wmsPlc-add.jsp | 206 +++++++++ .../webpage/com/zzjee/plc/wmsPlc-update.jsp | 206 +++++++++ .../webapp/webpage/com/zzjee/plc/wmsPlc.js | 28 ++ .../webpage/com/zzjee/plc/wmsPlcList.js | 0 .../webpage/com/zzjee/plc/wmsPlcList.jsp | 59 +++ 9 files changed, 1441 insertions(+) create mode 100644 src/main/java/com/zzjee/plc/controller/WmsPlcController.java create mode 100644 src/main/java/com/zzjee/plc/entity/WmsPlcEntity.java create mode 100644 src/main/java/com/zzjee/plc/service/WmsPlcServiceI.java create mode 100644 src/main/java/com/zzjee/plc/service/impl/WmsPlcServiceImpl.java create mode 100644 src/main/webapp/webpage/com/zzjee/plc/wmsPlc-add.jsp create mode 100644 src/main/webapp/webpage/com/zzjee/plc/wmsPlc-update.jsp create mode 100644 src/main/webapp/webpage/com/zzjee/plc/wmsPlc.js create mode 100644 src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.js create mode 100644 src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.jsp diff --git a/src/main/java/com/zzjee/plc/controller/WmsPlcController.java b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java new file mode 100644 index 00000000..d2ffe476 --- /dev/null +++ b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java @@ -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 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 fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List 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 list() { + List 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> 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> 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); + } +} diff --git a/src/main/java/com/zzjee/plc/entity/WmsPlcEntity.java b/src/main/java/com/zzjee/plc/entity/WmsPlcEntity.java new file mode 100644 index 00000000..df595557 --- /dev/null +++ b/src/main/java/com/zzjee/plc/entity/WmsPlcEntity.java @@ -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; + } +} diff --git a/src/main/java/com/zzjee/plc/service/WmsPlcServiceI.java b/src/main/java/com/zzjee/plc/service/WmsPlcServiceI.java new file mode 100644 index 00000000..89da684d --- /dev/null +++ b/src/main/java/com/zzjee/plc/service/WmsPlcServiceI.java @@ -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; + +} diff --git a/src/main/java/com/zzjee/plc/service/impl/WmsPlcServiceImpl.java b/src/main/java/com/zzjee/plc/service/impl/WmsPlcServiceImpl.java new file mode 100644 index 00000000..08b1e77c --- /dev/null +++ b/src/main/java/com/zzjee/plc/service/impl/WmsPlcServiceImpl.java @@ -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 populationMap(WmsPlcEntity t){ + Map map = new HashMap(); + 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 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增强出现异常!"); + } + } + } +} \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-add.jsp b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-add.jsp new file mode 100644 index 00000000..ecb07db5 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-add.jsp @@ -0,0 +1,206 @@ +<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + + + PLC指令 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ PLCIP: +
+
+ + + +
+
+ + +
+
+ PLC端口: +
+
+ + + +
+
+ + +
+
+ PLC型号: +
+
+ + + +
+
+ + +
+
+ 指令备注: +
+
+ + + +
+
+ + +
+
+ 执行时间: +
+
+ + + +
+
+ + +
+
+ 执行顺序: +
+
+ + + +
+
+ + +
+
+ 指令集: +
+
+ + + +
+
+ + +
+
+ 备用1: +
+
+ + + +
+
+ + + + + +
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-update.jsp b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-update.jsp new file mode 100644 index 00000000..ad9393e4 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc-update.jsp @@ -0,0 +1,206 @@ +<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + + + PLC指令 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ PLCIP: +
+
+ + + +
+
+ + +
+
+ PLC端口: +
+
+ + + +
+
+ + +
+
+ PLC型号: +
+
+ + + +
+
+ + +
+
+ 指令备注: +
+
+ + + +
+
+ + +
+
+ 执行时间: +
+
+ + + +
+
+ + +
+
+ 执行顺序: +
+
+ + + +
+
+ + +
+
+ 指令集: +
+
+ + + +
+
+ + +
+
+ 备用1: +
+
+ + + +
+
+ + + + + +
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/plc/wmsPlc.js b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc.js new file mode 100644 index 00000000..3c340156 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/plc/wmsPlc.js @@ -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)); +} \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.js b/src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.js new file mode 100644 index 00000000..e69de29b diff --git a/src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.jsp b/src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.jsp new file mode 100644 index 00000000..d5c99928 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/plc/wmsPlcList.jsp @@ -0,0 +1,59 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +