diff --git a/src/main/java/com/zzjee/md/controller/TMdBomHeadController.java b/src/main/java/com/zzjee/md/controller/TMdBomHeadController.java new file mode 100644 index 00000000..82fba7d0 --- /dev/null +++ b/src/main/java/com/zzjee/md/controller/TMdBomHeadController.java @@ -0,0 +1,499 @@ +package com.zzjee.md.controller; +import com.zzjee.md.entity.TMdBomHeadEntity; +import com.zzjee.md.service.TMdBomHeadServiceI; +import com.zzjee.md.page.TMdBomHeadPage; +import com.zzjee.md.entity.TMdBomItemEntity; +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.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + + import org.jeecgframework.jwt.util.ResponseMessage; +import org.jeecgframework.jwt.util.Result; +import org.apache.commons.lang3.StringUtils; +import com.alibaba.fastjson.JSONArray; +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.json.AjaxJson; +import org.jeecgframework.core.common.model.json.DataGrid; +import org.jeecgframework.core.constant.Globals; +import org.jeecgframework.core.util.ExceptionUtil; +import org.jeecgframework.core.util.ResourceUtil; +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 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.vo.NormalExcelConstants; +import org.springframework.ui.ModelMap; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import java.io.IOException; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.jeecgframework.jwt.util.ResponseMessage; +import org.jeecgframework.jwt.util.Result; +import com.alibaba.fastjson.JSONArray; +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; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; + +/** + * @Title: Controller + * @Description: BOM抬头 + * @author onlineGenerator + * @date 2018-05-05 12:56:55 + * @version V1.0 + * + */ +@Api(value="TMdBomHead",description="BOM抬头",tags="tMdBomHeadController") +@Controller +@RequestMapping("/tMdBomHeadController") +public class TMdBomHeadController extends BaseController { + /** + * Logger for this class + */ + private static final Logger logger = Logger.getLogger(TMdBomHeadController.class); + + @Autowired + private TMdBomHeadServiceI tMdBomHeadService; + @Autowired + private SystemService systemService; + @Autowired + private Validator validator; + + /** + * BOM抬头列表 页面跳转 + * + * @return + */ + @RequestMapping(params = "list") + public ModelAndView list(HttpServletRequest request) { + return new ModelAndView("com/scm/md/tMdBomHeadList"); + } + + /** + * easyui AJAX请求数据 + * + * @param request + * @param response + * @param dataGrid + */ + + @RequestMapping(params = "datagrid") + public void datagrid(TMdBomHeadEntity tMdBomHead,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { + CriteriaQuery cq = new CriteriaQuery(TMdBomHeadEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tMdBomHead); + try{ + //自定义追加查询条件 + }catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + cq.add(); + this.tMdBomHeadService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } + + /** + * 删除BOM抬头 + * + * @return + */ + @RequestMapping(params = "doDel") + @ResponseBody + public AjaxJson doDel(TMdBomHeadEntity tMdBomHead, HttpServletRequest request) { + AjaxJson j = new AjaxJson(); + tMdBomHead = systemService.getEntity(TMdBomHeadEntity.class, tMdBomHead.getId()); + String message = "BOM抬头删除成功"; + try{ + tMdBomHeadService.delMain(tMdBomHead); + systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); + }catch(Exception e){ + e.printStackTrace(); + message = "BOM抬头删除失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + + /** + * 批量删除BOM抬头 + * + * @return + */ + @RequestMapping(params = "doBatchDel") + @ResponseBody + public AjaxJson doBatchDel(String ids,HttpServletRequest request){ + AjaxJson j = new AjaxJson(); + String message = "BOM抬头删除成功"; + try{ + for(String id:ids.split(",")){ + TMdBomHeadEntity tMdBomHead = systemService.getEntity(TMdBomHeadEntity.class, + id + ); + tMdBomHeadService.delMain(tMdBomHead); + systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); + } + }catch(Exception e){ + e.printStackTrace(); + message = "BOM抬头删除失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + + /** + * 添加BOM抬头 + * + * @return + */ + @RequestMapping(params = "doAdd") + @ResponseBody + public AjaxJson doAdd(TMdBomHeadEntity tMdBomHead,TMdBomHeadPage tMdBomHeadPage, HttpServletRequest request) { + List tMdBomItemList = tMdBomHeadPage.getTMdBomItemList(); + AjaxJson j = new AjaxJson(); + String message = "添加成功"; + try{ + tMdBomHeadService.addMain(tMdBomHead, tMdBomItemList); + systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); + }catch(Exception e){ + e.printStackTrace(); + message = "BOM抬头添加失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + /** + * 更新BOM抬头 + * + * @param ids + * @return + */ + @RequestMapping(params = "doUpdate") + @ResponseBody + public AjaxJson doUpdate(TMdBomHeadEntity tMdBomHead,TMdBomHeadPage tMdBomHeadPage, HttpServletRequest request) { + List tMdBomItemList = tMdBomHeadPage.getTMdBomItemList(); + AjaxJson j = new AjaxJson(); + String message = "更新成功"; + try{ + tMdBomHeadService.updateMain(tMdBomHead, tMdBomItemList); + systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); + }catch(Exception e){ + e.printStackTrace(); + message = "更新BOM抬头失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + + /** + * BOM抬头新增页面跳转 + * + * @return + */ + @RequestMapping(params = "goAdd") + public ModelAndView goAdd(TMdBomHeadEntity tMdBomHead, HttpServletRequest req) { + if (StringUtil.isNotEmpty(tMdBomHead.getId())) { + tMdBomHead = tMdBomHeadService.getEntity(TMdBomHeadEntity.class, tMdBomHead.getId()); + req.setAttribute("tMdBomHeadPage", tMdBomHead); + } + return new ModelAndView("com/scm/md/tMdBomHead-add"); + } + + /** + * BOM抬头编辑页面跳转 + * + * @return + */ + @RequestMapping(params = "goUpdate") + public ModelAndView goUpdate(TMdBomHeadEntity tMdBomHead, HttpServletRequest req) { + if (StringUtil.isNotEmpty(tMdBomHead.getId())) { + tMdBomHead = tMdBomHeadService.getEntity(TMdBomHeadEntity.class, tMdBomHead.getId()); + req.setAttribute("tMdBomHeadPage", tMdBomHead); + } + return new ModelAndView("com/scm/md/tMdBomHead-update"); + } + + + /** + * 加载明细列表[BOM项目] + * + * @return + */ + @RequestMapping(params = "tMdBomItemList") + public ModelAndView tMdBomItemList(TMdBomHeadEntity tMdBomHead, HttpServletRequest req) { + + //=================================================================================== + //获取参数 + Object id0 = tMdBomHead.getId(); + //=================================================================================== + //查询-BOM项目 + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + try{ + List tMdBomItemEntityList = systemService.findHql(hql0,id0); + req.setAttribute("tMdBomItemList", tMdBomItemEntityList); + }catch(Exception e){ + logger.info(e.getMessage()); + } + return new ModelAndView("com/scm/md/tMdBomItemList"); + } + + /** + * 导出excel + * + * @param request + * @param response + */ + @RequestMapping(params = "exportXls") + public String exportXls(TMdBomHeadEntity tMdBomHead,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) { + CriteriaQuery cq = new CriteriaQuery(TMdBomHeadEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tMdBomHead); + try{ + //自定义追加查询条件 + }catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + cq.add(); + List list=this.tMdBomHeadService.getListByCriteriaQuery(cq, false); + List pageList=new ArrayList(); + if(list!=null&&list.size()>0){ + for(TMdBomHeadEntity entity:list){ + try{ + TMdBomHeadPage page=new TMdBomHeadPage(); + MyBeanUtils.copyBeanNotNull2Bean(entity,page); + Object id0 = entity.getId(); + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + List tMdBomItemEntityList = systemService.findHql(hql0,id0); + page.setTMdBomItemList(tMdBomItemEntityList); + pageList.add(page); + }catch(Exception e){ + logger.info(e.getMessage()); + } + } + } + map.put(NormalExcelConstants.FILE_NAME,"BOM抬头"); + map.put(NormalExcelConstants.CLASS,TMdBomHeadPage.class); + map.put(NormalExcelConstants.PARAMS,new ExportParams("BOM抬头列表", "导出人:Jeecg", + "导出信息")); + map.put(NormalExcelConstants.DATA_LIST,pageList); + return NormalExcelConstants.JEECG_EXCEL_VIEW; + } + + /** + * 通过excel导入数据 + * @param request + * @param + * @return + */ + @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(2); + params.setNeedSave(true); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), TMdBomHeadPage.class, params); + TMdBomHeadEntity entity1=null; + for (TMdBomHeadPage page : list) { + entity1=new TMdBomHeadEntity(); + MyBeanUtils.copyBeanNotNull2Bean(page,entity1); + tMdBomHeadService.addMain(entity1, page.getTMdBomItemList()); + } + j.setMsg("文件导入成功!"); + } catch (Exception e) { + j.setMsg("文件导入失败!"); + logger.error(ExceptionUtil.getExceptionMessage(e)); + }finally{ + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return j; + } + /** + * 导出excel 使模板 + */ + @RequestMapping(params = "exportXlsByT") + public String exportXlsByT(ModelMap map) { + map.put(NormalExcelConstants.FILE_NAME,"BOM抬头"); + map.put(NormalExcelConstants.CLASS,TMdBomHeadPage.class); + map.put(NormalExcelConstants.PARAMS,new ExportParams("BOM抬头列表", "导出人:"+ ResourceUtil.getSessionUser().getRealName(), + "导出信息")); + map.put(NormalExcelConstants.DATA_LIST,new ArrayList()); + return NormalExcelConstants.JEECG_EXCEL_VIEW; + } + /** + * 导入功能跳转 + * + * @return + */ + @RequestMapping(params = "upload") + public ModelAndView upload(HttpServletRequest req) { + req.setAttribute("controller_name", "tMdBomHeadController"); + return new ModelAndView("common/upload/pub_excel_upload"); + } + + + @RequestMapping(method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value="BOM抬头列表信息",produces="application/json",httpMethod="GET") + public ResponseMessage> list() { + List list= tMdBomHeadService.getList(TMdBomHeadEntity.class); + List pageList=new ArrayList(); + if(list!=null&&list.size()>0){ + for(TMdBomHeadEntity entity:list){ + try{ + TMdBomHeadPage page=new TMdBomHeadPage(); + MyBeanUtils.copyBeanNotNull2Bean(entity,page); + Object id0 = entity.getId(); + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + List tMdBomItemOldList = this.tMdBomHeadService.findHql(hql0,id0); + page.setTMdBomItemList(tMdBomItemOldList); + pageList.add(page); + }catch(Exception e){ + logger.info(e.getMessage()); + } + } + } + return Result.success(pageList); + } + + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value="根据ID获取BOM抬头信息",notes="根据ID获取BOM抬头信息",httpMethod="GET",produces="application/json") + public ResponseMessage get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) { + TMdBomHeadEntity task = tMdBomHeadService.get(TMdBomHeadEntity.class, id); + if (task == null) { + return Result.error("根据ID获取BOM抬头信息为空"); + } + TMdBomHeadPage page = new TMdBomHeadPage(); + try { + MyBeanUtils.copyBeanNotNull2Bean(task, page); + Object id0 = task.getId(); + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + List tMdBomItemOldList = this.tMdBomHeadService.findHql(hql0,id0); + page.setTMdBomItemList(tMdBomItemOldList); + } catch (Exception e) { + e.printStackTrace(); + } + return Result.success(page); + } + + @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + @ApiOperation(value="创建BOM抬头") + public ResponseMessage create(@ApiParam(name="BOM抬头对象")@RequestBody TMdBomHeadPage tMdBomHeadPage, UriComponentsBuilder uriBuilder) { + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + Set> failures = validator.validate(tMdBomHeadPage); + if (!failures.isEmpty()) { + return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures))); + } + + //保存 + List tMdBomItemList = tMdBomHeadPage.getTMdBomItemList(); + + TMdBomHeadEntity tMdBomHead = new TMdBomHeadEntity(); + try{ + MyBeanUtils.copyBeanNotNull2Bean(tMdBomHeadPage,tMdBomHead); + }catch(Exception e){ + logger.info(e.getMessage()); + return Result.error("保存BOM抬头失败"); + } + tMdBomHeadService.addMain(tMdBomHead, tMdBomItemList); + + return Result.success(tMdBomHead); + } + + @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + @ApiOperation(value="更新BOM抬头",notes="更新BOM抬头") + public ResponseMessage update(@RequestBody TMdBomHeadPage tMdBomHeadPage) { + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + Set> failures = validator.validate(tMdBomHeadPage); + if (!failures.isEmpty()) { + return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures))); + } + + //保存 + List tMdBomItemList = tMdBomHeadPage.getTMdBomItemList(); + + TMdBomHeadEntity tMdBomHead = new TMdBomHeadEntity(); + try{ + MyBeanUtils.copyBeanNotNull2Bean(tMdBomHeadPage,tMdBomHead); + }catch(Exception e){ + logger.info(e.getMessage()); + return Result.error("BOM抬头更新失败"); + } + tMdBomHeadService.updateMain(tMdBomHead, tMdBomItemList); + + //按Restful约定,返回204状态码, 无内容. 也可以返回200状态码. + return Result.success(); + } + + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) + @ResponseStatus(HttpStatus.NO_CONTENT) + @ApiOperation(value="删除BOM抬头") + public ResponseMessage delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) { + logger.info("delete[{}]" + id); + // 验证 + if (StringUtils.isEmpty(id)) { + return Result.error("ID不能为空"); + } + try { + TMdBomHeadEntity tMdBomHead = tMdBomHeadService.get(TMdBomHeadEntity.class, id); + tMdBomHeadService.delMain(tMdBomHead); + } catch (Exception e) { + e.printStackTrace(); + return Result.error("BOM抬头删除失败"); + } + + return Result.success(); + } +} diff --git a/src/main/java/com/zzjee/md/entity/TMdBomHeadEntity.java b/src/main/java/com/zzjee/md/entity/TMdBomHeadEntity.java new file mode 100644 index 00000000..332a4934 --- /dev/null +++ b/src/main/java/com/zzjee/md/entity/TMdBomHeadEntity.java @@ -0,0 +1,433 @@ +package com.zzjee.md.entity; + +import org.hibernate.annotations.GenericGenerator; +import org.jeecgframework.poi.excel.annotation.Excel; + +import javax.persistence.*; +import java.util.Date; + +/** + * @Title: Entity + * @Description: BOM抬头 + * @author onlineGenerator + * @date 2018-05-05 12:56:55 + * @version V1.0 + * + */ +@Entity +@Table(name = "t_md_bom_head", schema = "") +@SuppressWarnings("serial") +public class TMdBomHeadEntity implements java.io.Serializable { + /**主键*/ + private String id; + /**创建人登录名称*/ + private String createBy; + /**创建人名称*/ + private String createName; + /**创建日期*/ + private Date createDate; + /**更新人名称*/ + private String updateName; + /**更新人登录名称*/ + private String updateBy; + /**更新日期*/ + private Date updateDate; + /**所属部门*/ + private String sysOrgCode; + /**所属公司*/ + private String sysCompanyCode; + /**流程状态*/ + private String bpmStatus; + /**物料*/ + @Excel(name="物料",width=15,dictTable ="pop_material",dicCode ="matcode,matname",dicText ="matcode,matname") + private String matcode; + /**状态*/ + @Excel(name="状态",width=15,dicCode="status") + private String status; + /**文本*/ + @Excel(name="文本",width=15) + private String text; + /**物料名称*/ + @Excel(name="物料名称",width=15) + private String matname; + /**设计数量*/ + @Excel(name="设计数量",width=15) + private Double qty; + /**计量单位*/ + @Excel(name="计量单位",width=15) + private String units; + /**成本中心代码*/ + private String prccode; + /**成本中心名称*/ + private String prcname; + /**生效日期*/ + @Excel(name="生效日期",width=15,format = "yyyy-MM-dd") + private Date startdate; + /**失效日期*/ + @Excel(name="失效日期",width=15,format = "yyyy-MM-dd") + private Date enddate; + + /** + *方法: 取得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_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.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.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 物料 + */ + + @Column(name ="MATCODE",nullable=true,length=32) + public String getMatcode(){ + return this.matcode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 物料 + */ + public void setMatcode(String matcode){ + this.matcode = matcode; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 状态 + */ + + @Column(name ="STATUS",nullable=true,length=32) + public String getStatus(){ + return this.status; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 状态 + */ + public void setStatus(String status){ + this.status = status; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 文本 + */ + + @Column(name ="TEXT",nullable=true,length=50) + public String getText(){ + return this.text; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 文本 + */ + public void setText(String text){ + this.text = text; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 物料名称 + */ + + @Column(name ="MATNAME",nullable=true,length=132) + public String getMatname(){ + return this.matname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 物料名称 + */ + public void setMatname(String matname){ + this.matname = matname; + } + + /** + *方法: 取得java.lang.Double + *@return: java.lang.Double 设计数量 + */ + + @Column(name ="QTY",nullable=true,scale=2,length=32) + public Double getQty(){ + return this.qty; + } + + /** + *方法: 设置java.lang.Double + *@param: java.lang.Double 设计数量 + */ + public void setQty(Double qty){ + this.qty = qty; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 计量单位 + */ + + @Column(name ="UNITS",nullable=true,length=32) + public String getUnits(){ + return this.units; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 计量单位 + */ + public void setUnits(String units){ + this.units = units; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心代码 + */ + + @Column(name ="PRCCODE",nullable=true,length=32) + public String getPrccode(){ + return this.prccode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心代码 + */ + public void setPrccode(String prccode){ + this.prccode = prccode; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心名称 + */ + + @Column(name ="PRCNAME",nullable=true,length=132) + public String getPrcname(){ + return this.prcname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心名称 + */ + public void setPrcname(String prcname){ + this.prcname = prcname; + } + + /** + *方法: 取得java.util.Date + *@return: java.util.Date 生效日期 + */ + + @Column(name ="STARTDATE",nullable=true,length=32) + public Date getStartdate(){ + return this.startdate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 生效日期 + */ + public void setStartdate(Date startdate){ + this.startdate = startdate; + } + + /** + *方法: 取得java.util.Date + *@return: java.util.Date 失效日期 + */ + + @Column(name ="ENDDATE",nullable=true,length=32) + public Date getEnddate(){ + return this.enddate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 失效日期 + */ + public void setEnddate(Date enddate){ + this.enddate = enddate; + } + +} diff --git a/src/main/java/com/zzjee/md/entity/TMdBomItemEntity.java b/src/main/java/com/zzjee/md/entity/TMdBomItemEntity.java new file mode 100644 index 00000000..b9da3e8e --- /dev/null +++ b/src/main/java/com/zzjee/md/entity/TMdBomItemEntity.java @@ -0,0 +1,432 @@ +package com.zzjee.md.entity; + +import org.hibernate.annotations.GenericGenerator; +import org.jeecgframework.poi.excel.annotation.Excel; + +import javax.persistence.*; +import java.util.Date; + +/** + * @Title: Entity + * @Description: BOM项目 + * @author onlineGenerator + * @date 2018-05-05 12:56:55 + * @version V1.0 + * + */ +@Entity +@Table(name = "t_md_bom_item", schema = "") +@SuppressWarnings("serial") +public class TMdBomItemEntity 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; + /**组件*/ + @Excel(name="组件",width=15,dictTable ="pop_material",dicCode ="component,itemname,unit",dicText ="matcode,matname,unit") + private String component; + /**数量*/ + @Excel(name="数量",width=15) + private String quantity; + /**单位*/ + @Excel(name="单位",width=15) + private String unit; + /**损耗率*/ + @Excel(name="损耗率",width=15) + private String scrap; + /**文本*/ + @Excel(name="文本",width=15) + private String text; + /**bom抬头ID*/ + private String bomid; + /**物料名称*/ + @Excel(name="物料名称",width=15) + private String itemname; + /**工位*/ + @Excel(name="工位",width=15) + private String workplace; + /**成本中心*/ + private String prccode; + /**成本中心名称*/ + private String prcname; + + /** + *方法: 取得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 组件 + */ + + @Column(name ="COMPONENT",nullable=true,length=32) + public String getComponent(){ + return this.component; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 组件 + */ + public void setComponent(String component){ + this.component = component; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 数量 + */ + + @Column(name ="QUANTITY",nullable=true,length=32) + public String getQuantity(){ + return this.quantity; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 数量 + */ + public void setQuantity(String quantity){ + this.quantity = quantity; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 单位 + */ + + @Column(name ="UNIT",nullable=true,length=10) + public String getUnit(){ + return this.unit; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 单位 + */ + public void setUnit(String unit){ + this.unit = unit; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 损耗率 + */ + + @Column(name ="SCRAP",nullable=true,length=10) + public String getScrap(){ + return this.scrap; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 损耗率 + */ + public void setScrap(String scrap){ + this.scrap = scrap; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 文本 + */ + + @Column(name ="TEXT",nullable=true,length=50) + public String getText(){ + return this.text; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 文本 + */ + public void setText(String text){ + this.text = text; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String bom抬头ID + */ + + @Column(name ="BOMID",nullable=true,length=32) + public String getBomid(){ + return this.bomid; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String bom抬头ID + */ + public void setBomid(String bomid){ + this.bomid = bomid; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 物料名称 + */ + + @Column(name ="ITEMNAME",nullable=true,length=132) + public String getItemname(){ + return this.itemname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 物料名称 + */ + public void setItemname(String itemname){ + this.itemname = itemname; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 工位 + */ + + @Column(name ="WORKPLACE",nullable=true,length=32) + public String getWorkplace(){ + return this.workplace; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 工位 + */ + public void setWorkplace(String workplace){ + this.workplace = workplace; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心 + */ + + @Column(name ="PRCCODE",nullable=true,length=32) + public String getPrccode(){ + return this.prccode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心 + */ + public void setPrccode(String prccode){ + this.prccode = prccode; + } + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心名称 + */ + + @Column(name ="PRCNAME",nullable=true,length=32) + public String getPrcname(){ + return this.prcname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心名称 + */ + public void setPrcname(String prcname){ + this.prcname = prcname; + } + +} diff --git a/src/main/java/com/zzjee/md/page/TMdBomHeadPage.java b/src/main/java/com/zzjee/md/page/TMdBomHeadPage.java new file mode 100644 index 00000000..d388ce73 --- /dev/null +++ b/src/main/java/com/zzjee/md/page/TMdBomHeadPage.java @@ -0,0 +1,390 @@ + +package com.zzjee.md.page; +import com.zzjee.md.entity.TMdBomHeadEntity; +import com.zzjee.md.entity.TMdBomItemEntity; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.ArrayList; + +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; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; + +/** + * @Title: Entity + * @Description: BOM抬头 + * @author onlineGenerator + * @date 2018-05-05 12:56:55 + * @version V1.0 + * + */ +public class TMdBomHeadPage implements java.io.Serializable { + /**主键*/ + private String id; + /**创建人登录名称*/ + private String createBy; + /**创建人名称*/ + private String createName; + /**创建日期*/ + private Date createDate; + /**更新人名称*/ + private String updateName; + /**更新人登录名称*/ + private String updateBy; + /**更新日期*/ + private Date updateDate; + /**所属部门*/ + private String sysOrgCode; + /**所属公司*/ + private String sysCompanyCode; + /**流程状态*/ + private String bpmStatus; + /**物料*/ + @Excel(name="物料") + private String matcode; + /**状态*/ + @Excel(name="状态") + private String status; + /**文本*/ + @Excel(name="文本") + private String text; + /**物料名称*/ + @Excel(name="物料名称") + private String matname; + /**设计数量*/ + @Excel(name="设计数量") + private Double qty; + /**计量单位*/ + @Excel(name="计量单位") + private String units; + /**成本中心代码*/ + private String prccode; + /**成本中心名称*/ + private String prcname; + /**生效日期*/ + @Excel(name="生效日期",format = "yyyy-MM-dd") + private Date startdate; + /**失效日期*/ + @Excel(name="失效日期",format = "yyyy-MM-dd") + private Date enddate; + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 主键 + */ + 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 创建人登录名称 + */ + public String getCreateBy(){ + return this.createBy; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 创建人登录名称 + */ + public void setCreateBy(String createBy){ + this.createBy = createBy; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 创建人名称 + */ + public String getCreateName(){ + return this.createName; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 创建人名称 + */ + public void setCreateName(String createName){ + this.createName = createName; + } + /** + *方法: 取得java.util.Date + *@return: java.util.Date 创建日期 + */ + 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 更新人名称 + */ + 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 更新人登录名称 + */ + 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 更新日期 + */ + 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 所属部门 + */ + 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 所属公司 + */ + 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 流程状态 + */ + 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 物料 + */ + public String getMatcode(){ + return this.matcode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 物料 + */ + public void setMatcode(String matcode){ + this.matcode = matcode; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 状态 + */ + public String getStatus(){ + return this.status; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 状态 + */ + public void setStatus(String status){ + this.status = status; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 文本 + */ + public String getText(){ + return this.text; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 文本 + */ + public void setText(String text){ + this.text = text; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 物料名称 + */ + public String getMatname(){ + return this.matname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 物料名称 + */ + public void setMatname(String matname){ + this.matname = matname; + } + /** + *方法: 取得java.lang.Double + *@return: java.lang.Double 设计数量 + */ + public Double getQty(){ + return this.qty; + } + + /** + *方法: 设置java.lang.Double + *@param: java.lang.Double 设计数量 + */ + public void setQty(Double qty){ + this.qty = qty; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 计量单位 + */ + public String getUnits(){ + return this.units; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 计量单位 + */ + public void setUnits(String units){ + this.units = units; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心代码 + */ + public String getPrccode(){ + return this.prccode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心代码 + */ + public void setPrccode(String prccode){ + this.prccode = prccode; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 成本中心名称 + */ + public String getPrcname(){ + return this.prcname; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 成本中心名称 + */ + public void setPrcname(String prcname){ + this.prcname = prcname; + } + /** + *方法: 取得java.util.Date + *@return: java.util.Date 生效日期 + */ + public Date getStartdate(){ + return this.startdate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 生效日期 + */ + public void setStartdate(Date startdate){ + this.startdate = startdate; + } + /** + *方法: 取得java.util.Date + *@return: java.util.Date 失效日期 + */ + public Date getEnddate(){ + return this.enddate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 失效日期 + */ + public void setEnddate(Date enddate){ + this.enddate = enddate; + } + + /**保存-BOM项目*/ + @ExcelCollection(name="BOM项目") + private List tMdBomItemList = new ArrayList(); + public List getTMdBomItemList() { + return tMdBomItemList; + } + public void setTMdBomItemList(List tMdBomItemList) { + this.tMdBomItemList = tMdBomItemList; + } +} diff --git a/src/main/java/com/zzjee/md/service/TMdBomHeadServiceI.java b/src/main/java/com/zzjee/md/service/TMdBomHeadServiceI.java new file mode 100644 index 00000000..b3d1e223 --- /dev/null +++ b/src/main/java/com/zzjee/md/service/TMdBomHeadServiceI.java @@ -0,0 +1,44 @@ +package com.zzjee.md.service; +import com.zzjee.md.entity.TMdBomHeadEntity; +import com.zzjee.md.entity.TMdBomItemEntity; + +import org.jeecgframework.core.common.service.CommonService; + +import java.util.List; + +public interface TMdBomHeadServiceI extends CommonService { + + public void delete(T entity); + /** + * 添加一对多 + * + */ + public void addMain(TMdBomHeadEntity tMdBomHead, + List tMdBomItemList) ; + /** + * 修改一对多 + * + */ + public void updateMain(TMdBomHeadEntity tMdBomHead, + List tMdBomItemList); + public void delMain(TMdBomHeadEntity tMdBomHead); + + /** + * 默认按钮-sql增强-新增操作 + * @param id + * @return + */ + public boolean doAddSql(TMdBomHeadEntity t); + /** + * 默认按钮-sql增强-更新操作 + * @param id + * @return + */ + public boolean doUpdateSql(TMdBomHeadEntity t); + /** + * 默认按钮-sql增强-删除操作 + * @param id + * @return + */ + public boolean doDelSql(TMdBomHeadEntity t); +} diff --git a/src/main/java/com/zzjee/md/service/impl/TMdBomHeadServiceImpl.java b/src/main/java/com/zzjee/md/service/impl/TMdBomHeadServiceImpl.java new file mode 100644 index 00000000..323065c1 --- /dev/null +++ b/src/main/java/com/zzjee/md/service/impl/TMdBomHeadServiceImpl.java @@ -0,0 +1,160 @@ +package com.zzjee.md.service.impl; + +import com.zzjee.md.entity.TMdBomHeadEntity; +import com.zzjee.md.entity.TMdBomItemEntity; +import com.zzjee.md.service.TMdBomHeadServiceI; +import org.jeecgframework.core.common.exception.BusinessException; +import org.jeecgframework.core.common.service.impl.CommonServiceImpl; +import org.jeecgframework.core.util.MyBeanUtils; +import org.jeecgframework.core.util.oConvertUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.UUID; + + +@Service("tMdBomHeadService") +@Transactional +public class TMdBomHeadServiceImpl extends CommonServiceImpl implements TMdBomHeadServiceI { + + public void delete(T entity) { + super.delete(entity); + //执行删除操作配置的sql增强 + this.doDelSql((TMdBomHeadEntity)entity); + } + + public void addMain(TMdBomHeadEntity tMdBomHead, + List tMdBomItemList){ + //保存主信息 + this.save(tMdBomHead); + + /**保存-BOM项目*/ + for(TMdBomItemEntity tMdBomItem:tMdBomItemList){ + //外键设置 + tMdBomItem.setBomid(tMdBomHead.getId()); + this.save(tMdBomItem); + } + //执行新增操作配置的sql增强 + this.doAddSql(tMdBomHead); + } + + + public void updateMain(TMdBomHeadEntity tMdBomHead, + List tMdBomItemList) { + //保存主表信息 + this.saveOrUpdate(tMdBomHead); + //=================================================================================== + //获取参数 + Object id0 = tMdBomHead.getId(); + //=================================================================================== + //1.查询出数据库的明细数据-BOM项目 + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + List tMdBomItemOldList = this.findHql(hql0,id0); + //2.筛选更新明细数据-BOM项目 + if(tMdBomItemList!=null&&tMdBomItemList.size()>0){ + for(TMdBomItemEntity oldE:tMdBomItemOldList){ + boolean isUpdate = false; + for(TMdBomItemEntity sendE:tMdBomItemList){ + //需要更新的明细数据-BOM项目 + if(oldE.getId().equals(sendE.getId())){ + try { + MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE); + this.saveOrUpdate(oldE); + } catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(e.getMessage()); + } + isUpdate= true; + break; + } + } + if(!isUpdate){ + //如果数据库存在的明细,前台没有传递过来则是删除-BOM项目 + super.delete(oldE); + } + + } + //3.持久化新增的数据-BOM项目 + for(TMdBomItemEntity tMdBomItem:tMdBomItemList){ + if(oConvertUtils.isEmpty(tMdBomItem.getId())){ + //外键设置 + tMdBomItem.setBomid(tMdBomHead.getId()); + this.save(tMdBomItem); + } + } + } + //执行更新操作配置的sql增强 + this.doUpdateSql(tMdBomHead); + } + + + public void delMain(TMdBomHeadEntity tMdBomHead) { + //删除主表信息 + this.delete(tMdBomHead); + //=================================================================================== + //获取参数 + Object id0 = tMdBomHead.getId(); + //=================================================================================== + //删除-BOM项目 + String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? "; + List tMdBomItemOldList = this.findHql(hql0,id0); + this.deleteAllEntitie(tMdBomItemOldList); + } + + + /** + * 默认按钮-sql增强-新增操作 + * @param id + * @return + */ + public boolean doAddSql(TMdBomHeadEntity t){ + return true; + } + /** + * 默认按钮-sql增强-更新操作 + * @param id + * @return + */ + public boolean doUpdateSql(TMdBomHeadEntity t){ + return true; + } + /** + * 默认按钮-sql增强-删除操作 + * @param id + * @return + */ + public boolean doDelSql(TMdBomHeadEntity t){ + return true; + } + + /** + * 替换sql中的变量 + * @param sql + * @return + */ + public String replaceVal(String sql,TMdBomHeadEntity t){ + sql = sql.replace("#{id}",String.valueOf(t.getId())); + sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy())); + sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName())); + 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("#{matcode}",String.valueOf(t.getMatcode())); + sql = sql.replace("#{status}",String.valueOf(t.getStatus())); + sql = sql.replace("#{text}",String.valueOf(t.getText())); + sql = sql.replace("#{matname}",String.valueOf(t.getMatname())); + sql = sql.replace("#{qty}",String.valueOf(t.getQty())); + sql = sql.replace("#{units}",String.valueOf(t.getUnits())); + sql = sql.replace("#{prccode}",String.valueOf(t.getPrccode())); + sql = sql.replace("#{prcname}",String.valueOf(t.getPrcname())); + sql = sql.replace("#{startdate}",String.valueOf(t.getStartdate())); + sql = sql.replace("#{enddate}",String.valueOf(t.getEnddate())); + sql = sql.replace("#{UUID}",UUID.randomUUID().toString()); + return sql; + } +} \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-add.jsp b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-add.jsp new file mode 100644 index 00000000..2e6772fe --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-add.jsp @@ -0,0 +1,369 @@ + <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + + + BOM抬头 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ 物料: +
+
+ + + +
+ + +
+ 状态: +
+
+ + + +
+
+ + +
+
+ 文本: +
+
+ + + +
+ + +
+ 物料名称: +
+
+ + + +
+
+ + +
+
+ 设计数量: +
+
+ + + +
+ + +
+ 计量单位: +
+
+ + + +
+
+ + +
+
+ 生效日期: +
+
+ + + +
+ + +
+ 失效日期: +
+
+ + + +
+
+ + +
+
+ +
+
+ + + + + +
+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-update.jsp b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-update.jsp new file mode 100644 index 00000000..9ecf00bd --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead-update.jsp @@ -0,0 +1,360 @@ +<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + + + BOM抬头 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + +
+
+
+
+ 物料: +
+
+ + + +
+ + +
+ 状态: +
+
+ + + +
+
+ + +
+
+ 文本: +
+
+ + + +
+ + +
+ 物料名称: +
+
+ + + +
+
+ + +
+
+ 设计数量: +
+
+ + + +
+ + +
+ 计量单位: +
+
+ + + +
+
+ + +
+
+ 生效日期: +
+
+ + + +
+ + +
+ 失效日期: +
+
+ + + +
+
+ + + + +
+
+ +
+
+ + + + + +
+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/md/tMdBomHead.js b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead.js new file mode 100644 index 00000000..119abe3c --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/md/tMdBomHead.js @@ -0,0 +1,74 @@ + + +//初始化下标 +function resetTrNum(tableId) { + $tbody = $("#"+tableId+""); + $tbody.find('>tr').each(function(i){ + $(':input, select,button,a', this).each(function(){ + var $this = $(this), validtype_str = $this.attr('validType'), name = $this.attr('name'),id=$this.attr('id'),onclick_str=$this.attr('onclick'), val = $this.val(); + if(name!=null){ + if (name.indexOf("#index#") >= 0){ + $this.attr("name",name.replace('#index#',i)); + }else{ + var s = name.indexOf("["); + var e = name.indexOf("]"); + var new_name = name.substring(s+1,e); + $this.attr("name",name.replace(new_name,i)); + } + } + if(id!=null){ + if (id.indexOf("#index#") >= 0){ + $this.attr("id",id.replace('#index#',i)); + }else{ + var s = id.indexOf("["); + var e = id.indexOf("]"); + var new_id = id.substring(s+1,e); + $this.attr("id",id.replace(new_id,i)); + } + } + if(onclick_str!=null){ + if (onclick_str.indexOf("#index#") >= 0){ + $this.attr("onclick",onclick_str.replace(/#index#/g,i)); + }else{ + } + } + if(validtype_str!=null){ + if(validtype_str.indexOf("#index#") >= 0){ + $this.attr("validType",validtype_str.replace('#index#',i)); + } + } + }); + $(this).find('div[name=\'xh\']').html(i+1); + }); +} +//通用弹出式文件上传 +function commonUpload(callback,inputId){ + $.dialog({ + content: "url:systemController.do?commonUpload", + lock : true, + title:"文件上传", + zIndex:getzIndex(), + width:700, + height: 200, + parent:windowapi, + cache:false, + ok: function(){ + var iframe = this.iframe.contentWindow; + iframe.uploadCallback(callback,inputId); + return true; + }, + cancelVal: '关闭', + cancel: function(){ + } + }); +} +//通用弹出式文件上传-回调 +function commonUploadDefaultCallBack(url,name,inputId){ + $("#"+inputId+"_href").attr('href',url).html('下载'); + $("#"+inputId).val(url); +} +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/md/tMdBomHeadList.js b/src/main/webapp/webpage/com/zzjee/md/tMdBomHeadList.js new file mode 100644 index 00000000..e69de29b diff --git a/src/main/webapp/webpage/com/zzjee/md/tMdBomHeadList.jsp b/src/main/webapp/webpage/com/zzjee/md/tMdBomHeadList.jsp new file mode 100644 index 00000000..1d05763c --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/md/tMdBomHeadList.jsp @@ -0,0 +1,56 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + <%----%> + + + + + +
+
+ + \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/md/tMdBomItemList.jsp b/src/main/webapp/webpage/com/zzjee/md/tMdBomItemList.jsp new file mode 100644 index 00000000..d26279a9 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/md/tMdBomItemList.jsp @@ -0,0 +1,159 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + +
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号操作 + 组件 + + 数量 + + 单位 + + 损耗率 + + 文本 + + 物料名称 + + 工位 +
+ + + + + + + + + + + + + + + + + + + + +
${stuts.index+1 }
+ + + + + + + + + + + + + + + + + + + + +