master
e 2020-02-18 10:36:43 +08:00
parent 84d192f151
commit 39489177c5
12 changed files with 2976 additions and 0 deletions

View File

@ -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<TMdBomItemEntity> 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<TMdBomItemEntity> 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<TMdBomItemEntity> 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<TMdBomHeadEntity> list=this.tMdBomHeadService.getListByCriteriaQuery(cq, false);
List<TMdBomHeadPage> pageList=new ArrayList<TMdBomHeadPage>();
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<TMdBomItemEntity> 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<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(2);
params.setNeedSave(true);
try {
List<TMdBomHeadPage> 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<TMdBomHeadPage>> list() {
List<TMdBomHeadEntity> list= tMdBomHeadService.getList(TMdBomHeadEntity.class);
List<TMdBomHeadPage> pageList=new ArrayList<TMdBomHeadPage>();
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<TMdBomItemEntity> 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<TMdBomItemEntity> 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<ConstraintViolation<TMdBomHeadPage>> failures = validator.validate(tMdBomHeadPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<TMdBomItemEntity> 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<ConstraintViolation<TMdBomHeadPage>> failures = validator.validate(tMdBomHeadPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<TMdBomItemEntity> 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();
}
}

View File

@ -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;
}
}

View File

@ -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 bomID
*/
@Column(name ="BOMID",nullable=true,length=32)
public String getBomid(){
return this.bomid;
}
/**
*: java.lang.String
*@param: java.lang.String bomID
*/
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;
}
}

View File

@ -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<TMdBomItemEntity> tMdBomItemList = new ArrayList<TMdBomItemEntity>();
public List<TMdBomItemEntity> getTMdBomItemList() {
return tMdBomItemList;
}
public void setTMdBomItemList(List<TMdBomItemEntity> tMdBomItemList) {
this.tMdBomItemList = tMdBomItemList;
}
}

View File

@ -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 <T> void delete(T entity);
/**
*
*
*/
public void addMain(TMdBomHeadEntity tMdBomHead,
List<TMdBomItemEntity> tMdBomItemList) ;
/**
*
*
*/
public void updateMain(TMdBomHeadEntity tMdBomHead,
List<TMdBomItemEntity> 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);
}

View File

@ -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 <T> void delete(T entity) {
super.delete(entity);
//执行删除操作配置的sql增强
this.doDelSql((TMdBomHeadEntity)entity);
}
public void addMain(TMdBomHeadEntity tMdBomHead,
List<TMdBomItemEntity> 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<TMdBomItemEntity> tMdBomItemList) {
//保存主表信息
this.saveOrUpdate(tMdBomHead);
//===================================================================================
//获取参数
Object id0 = tMdBomHead.getId();
//===================================================================================
//1.查询出数据库的明细数据-BOM项目
String hql0 = "from TMdBomItemEntity where 1 = 1 AND bOMID = ? ";
List<TMdBomItemEntity> 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<TMdBomItemEntity> 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;
}
}

View File

@ -0,0 +1,369 @@
<%@ 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>BOM抬头</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>
</head>
<script type="text/javascript">
$(document).ready(function(){
init();
$("#jform_tab .con-wrapper").hide(); //Hide all tab content
$("#jform_tab li:first").addClass("active").show(); //Activate first tab
$("#jform_tab .con-wrapper:first").show(); //Show first tab content
//On Click Event
$("#jform_tab li").click(function() {
$("#jform_tab li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$("#jform_tab .con-wrapper").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
//$(""+activeTab).show();
if( $(activeTab).html()!="") {
return false;
}else{
$(activeTab).html('正在加载内容,请稍后...');
var url = $(this).attr("tab-ajax-url");
$.post(url, {}, function(data) {
//$(this).attr("tab-ajax-cached", true);
$(activeTab).html(data);
});
}
return false;
});
});
//初始化下标
function resetTrNum(tableId) {
$tbody = $("#"+tableId+"");
$tbody.find('>tr').each(function(i){
$(':input, select', this).each(function(){
var $this = $(this), name = $this.attr('name'), 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));
}
}
});
$(this).find('div[name=\'xh\']').html(i+1);
});
}
function init(){
var tabHead =$("#jform_tab li:first");
var tabBox = $("#jform_tab .con-wrapper:first");
var url = tabHead.attr("tab-ajax-url");
tabBox.html('正在加载内容,请稍后...');
$.post(url, {}, function(data) {
tabBox.html(data);
//tabHead.attr("tab-ajax-cached", true);
});
}
</script>
<body>
<form id="formobj" action="tMdBomHeadController.do?doAdd" name="formobj" method="post">
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input id="id" name="id" type="hidden">
<input id="createBy" name="createBy" type="hidden">
<input id="createName" name="createName" type="hidden">
<input id="createDate" name="createDate" type="hidden">
<input id="updateName" name="updateName" type="hidden">
<input id="updateBy" name="updateBy" type="hidden">
<input id="updateDate" name="updateDate" type="hidden">
<input id="sysOrgCode" name="sysOrgCode" type="hidden">
<input id="sysCompanyCode" name="sysCompanyCode" type="hidden">
<input id="bpmStatus" name="bpmStatus" type="hidden">
<input id="prccode" name="prccode" type="hidden">
<input id="prcname" name="prcname" type="hidden">
<div class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="javascript:void(0);">BOM抬头</a></li>
</ul>
<!-- tab内容 -->
<div class="con-wrapper" style="display: block;">
<div class="row form-wrapper">
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>物料:</b>
</div>
<div class="col-xs-3">
<input id="matcode" name="matcode" type="text" class="form-control" datatype="*" ignore="checked" onclick="popupClick(this,'matcode,matname','matcode,matname','pop_material')"/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">物料</label>
</div>
<div class="col-xs-3 text-center">
<b>状态:</b>
</div>
<div class="col-xs-3">
<t:dictSelect field="status" type="list" extendJson="{class:'form-control',style:'width:150px'}" typeGroupCode="status" hasLabel="false" title="状态"></t:dictSelect>
<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="text" name="text" 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 class="col-xs-3 text-center">
<b>物料名称:</b>
</div>
<div class="col-xs-3">
<input id="matname" name="matname" type="text" class="form-control" ignore="checked" />
<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="qty" name="qty" type="text" class="form-control" datatype="/^(-?\d+)(\.\d+)?$/" ignore="ignore" />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">设计数量</label>
</div>
<div class="col-xs-3 text-center">
<b>计量单位:</b>
</div>
<div class="col-xs-3">
<input id="units" name="units" 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="startdate" name="startdate" type="text" ignore="ignore" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">生效日期</label>
</div>
<div class="col-xs-3 text-center">
<b>失效日期:</b>
</div>
<div class="col-xs-3">
<input id="enddate" name="enddate" type="text" ignore="ignore" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">失效日期</label>
</div>
</div>
</div>
</div>
<div class="con-wrapper" style="display: block;"></div>
</div>
<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>
<div id="jform_tab" class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" tab-ajax-url="tMdBomHeadController.do?tMdBomItemList&id=${tMdBomHeadPage.id}"><a href="#con-wrapper0">BOM项目</a></li>
</ul>
<div class="con-wrapper" id="con-wrapper0" style="display: none;"></div>
</div>
<div align="center" id = "sub_tr" style="display: none;" > <input type="button" value="提交" onclick="neibuClick();" class="ui_state_highlight"></div>
<script src="plug-in/layer/layer.js"></script>
<script type="text/javascript">
$(function() {
$("#formobj").Validform({
tiptype: function(msg, o, cssctl) {
if (o.type == 3) {
layer.open({
title: '提示信息',
content: msg,
icon: 5,
shift: 6,
btn: false,
shade:false,time:5000,
cancel: function(index) {
o.obj.focus();
layer.close(index);
},
yes: function(index) {
o.obj.focus();
layer.close(index);
},
})
}
},
btnSubmit: "#btn_sub",
btnReset: "#btn_reset",
ajaxPost: true,
beforeSubmit: function(curform) {
var tag = true;
//提交前处理
return tag;
},
usePlugin: {
passwordstrength: {
minLen: 6,
maxLen: 18,
trigger: function(obj, error) {
if (error) {
obj.parent().next().find(".Validform_checktip").show();
obj.find(".passwordStrength").hide();
} else {
$(".passwordStrength").show();
obj.parent().next().find(".Validform_checktip").hide();
}
}
}
},
callback: function(data) {
if (data.success == true) {
var win = frameElement.api.opener;
win.reloadTable();
win.tip(data.msg);
frameElement.api.close();
} else {
if (data.responseText == '' || data.responseText == undefined) {
$.messager.alert('错误', data.msg);
$.Hidemsg();
} else {
try {
var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
$.messager.alert('错误', emsg);
$.Hidemsg();
} catch(ex) {
$.messager.alert('错误', data.responseText + '');
}
}
return false;
}
}
});
});
</script>
</form>
<!-- 添加 产品明细 模版 -->
<table style="display:none">
<tbody id="add_tMdBomItem_table_template">
<tr>
<th scope="row"><div name="xh"></div></th>
<td><input style="width:20px;" type="checkbox" name="ck"/></td>
<td align="left">
<input name="tMdBomItemList[#index#].component" name="tMdBomItemList[#index#].component" type="text" style="width: 150px" class="searchbox-inputtext" ignore="ignore" onclick="popupClick(this,'matcode,matname,unit','component,itemname,unit','pop_material')"/>
<label class="Validform_label" style="display: none;">组件</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].quantity" maxlength="32" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">数量</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].unit" maxlength="10" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">单位</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].scrap" maxlength="10" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">损耗率</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].text" maxlength="50" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">文本</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].itemname" maxlength="132" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">物料名称</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].workplace" maxlength="32" ignore="ignore" type="text" class="form-control" style="width:120px;" />
<label class="Validform_label" style="display: none;">工位</label>
</td>
</tr>
</tbody>
</table>
<script src = "webpage/com/scm/md/tMdBomHead.js"></script>
</body>
</html>

View File

@ -0,0 +1,360 @@
<%@ 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>BOM抬头</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>
</head>
<script type="text/javascript">
$(document).ready(function(){
init();
$("#jform_tab .con-wrapper").hide(); //Hide all tab content
$("#jform_tab li:first").addClass("active").show(); //Activate first tab
$("#jform_tab .con-wrapper:first").show(); //Show first tab content
//On Click Event
$("#jform_tab li").click(function() {
$("#jform_tab li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$("#jform_tab .con-wrapper").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
//$(""+activeTab).show();
if( $(activeTab).html()!="") {
return false;
}else{
$(activeTab).html('正在加载内容,请稍后...');
var url = $(this).attr("tab-ajax-url");
$.post(url, {}, function(data) {
//$(this).attr("tab-ajax-cached", true);
$(activeTab).html(data);
});
}
return false;
});
});
//初始化下标
function resetTrNum(tableId) {
$tbody = $("#"+tableId+"");
$tbody.find('>tr').each(function(i){
$(':input, select', this).each(function(){
var $this = $(this), name = $this.attr('name'), 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));
}
}
});
$(this).find('div[name=\'xh\']').html(i+1);
});
}
function init(){
var tabHead =$("#jform_tab li:first");
var tabBox = $("#jform_tab .con-wrapper:first");
var url = tabHead.attr("tab-ajax-url");
tabBox.html('正在加载内容,请稍后...');
$.post(url, {}, function(data) {
tabBox.html(data);
//tabHead.attr("tab-ajax-cached", true);
});
}
</script>
<body>
<form id="formobj" action="tMdBomHeadController.do?doUpdate" name="formobj" method="post"><input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" name="id" value='${tMdBomHeadPage.id}' >
<div class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="javascript:void(0);">BOM抬头</a></li>
</ul>
<!-- tab内容 -->
<div class="con-wrapper" style="display: block;">
<div class="row form-wrapper">
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b>物料:</b>
</div>
<div class="col-xs-3">
<input id="matcode" name="matcode" type="text" class="form-control" datatype="*" ignore="checked" onclick="popupClick(this,'matcode,matname','pop_material')" value='${tMdBomHeadPage.matcode}'/>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">物料</label>
</div>
<div class="col-xs-3 text-center">
<b>状态:</b>
</div>
<div class="col-xs-3">
<t:dictSelect field="status" type="list" extendJson="{class:'form-control',style:'width:150px'}" typeGroupCode="status" defaultVal="${tMdBomHeadPage.status}" hasLabel="false" title="状态"></t:dictSelect>
<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="text" name="text" type="text" class="form-control" ignore="ignore" value='${tMdBomHeadPage.text}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">文本</label>
</div>
<div class="col-xs-3 text-center">
<b>物料名称:</b>
</div>
<div class="col-xs-3">
<input id="matname" name="matname" type="text" class="form-control" ignore="checked" value='${tMdBomHeadPage.matname}' />
<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="qty" name="qty" type="text" class="form-control" datatype="/^(-?\d+)(\.\d+)?$/" ignore="ignore" value='${tMdBomHeadPage.qty}' />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">设计数量</label>
</div>
<div class="col-xs-3 text-center">
<b>计量单位:</b>
</div>
<div class="col-xs-3">
<input id="units" name="units" type="text" class="form-control" ignore="ignore" value='${tMdBomHeadPage.units}' />
<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="startdate" name="startdate" type="text" ignore="ignore" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker()" value="<fmt:formatDate value='${tMdBomHeadPage.startdate}' type='date' pattern='yyyy-MM-dd'/>" />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">生效日期</label>
</div>
<div class="col-xs-3 text-center">
<b>失效日期:</b>
</div>
<div class="col-xs-3">
<input id="enddate" name="enddate" type="text" ignore="ignore" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker()" value="<fmt:formatDate value='${tMdBomHeadPage.enddate}' type='date' pattern='yyyy-MM-dd'/>" />
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">失效日期</label>
</div>
</div>
</div>
</div>
<div class="con-wrapper" style="display: block;"></div>
</div>
<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>
<div id="jform_tab" class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" tab-ajax-url="tMdBomHeadController.do?tMdBomItemList&id=${tMdBomHeadPage.id}"><a href="#con-wrapper0">BOM项目</a></li>
</ul>
<div class="con-wrapper" id="con-wrapper0" style="display: none;"></div>
</div>
<div align="center" id = "sub_tr" style="display: none;" > <input type="button" value="提交" onclick="neibuClick();" class="ui_state_highlight"></div>
<script src="plug-in/layer/layer.js"></script>
<script type="text/javascript">
$(function() {
$("#formobj").Validform({
tiptype: function(msg, o, cssctl) {
if (o.type == 3) {
layer.open({
title: '提示信息',
content: msg,
icon: 5,
shift: 6,
btn: false,
shade:false,time:5000,
cancel: function(index) {
o.obj.focus();
layer.close(index);
},
yes: function(index) {
o.obj.focus();
layer.close(index);
},
})
}
},
btnSubmit: "#btn_sub",
btnReset: "#btn_reset",
ajaxPost: true,
beforeSubmit: function(curform) {
var tag = true;
//提交前处理
return tag;
},
usePlugin: {
passwordstrength: {
minLen: 6,
maxLen: 18,
trigger: function(obj, error) {
if (error) {
obj.parent().next().find(".Validform_checktip").show();
obj.find(".passwordStrength").hide();
} else {
$(".passwordStrength").show();
obj.parent().next().find(".Validform_checktip").hide();
}
}
}
},
callback: function(data) {
if (data.success == true) {
var win = frameElement.api.opener;
win.reloadTable();
win.tip(data.msg);
frameElement.api.close();
} else {
if (data.responseText == '' || data.responseText == undefined) {
$.messager.alert('错误', data.msg);
$.Hidemsg();
} else {
try {
var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
$.messager.alert('错误', emsg);
$.Hidemsg();
} catch(ex) {
$.messager.alert('错误', data.responseText + '');
}
}
return false;
}
}
});
});
</script>
</form>
<!-- 添加 产品明细 模版 -->
<table style="display:none">
<tbody id="add_tMdBomItem_table_template">
<tr>
<th scope="row"><div name="xh"></div></th>
<td><input style="width:20px;" type="checkbox" name="ck"/></td>
<td align="left">
<input name="tMdBomItemList[#index#].component" name="tMdBomItemList[#index#].component" type="text" style="width: 150px" class="form-control" ignore="ignore" onclick="popupClick(this,'matcode,matname,unit','component,itemname,unit','pop_material')" value="${poVal.component }" />
<label class="Validform_label" style="display: none;">组件</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].quantity" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">数量</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].unit" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">单位</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].scrap" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">损耗率</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].text" maxlength="50" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">文本</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].itemname" maxlength="132" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">物料名称</label>
</td>
<td align="left">
<input name="tMdBomItemList[#index#].workplace" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">工位</label>
</td>
</tr>
</tbody>
</table>
<script src = "webpage/com/scm/md/tMdBomHead.js"></script>
</body>
</html>

View File

@ -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));
}

View File

@ -0,0 +1,56 @@
<%@ 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="tMdBomHeadList" checkbox="true" fitColumns="false" title="BOM抬头" actionUrl="tMdBomHeadController.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="createBy" 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="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="物料" field="matcode" query="true" queryMode="single" dictionary="pop_material,matcode,matname,matcode,matname" popup="true" width="120"></t:dgCol>
<t:dgCol title="状态" field="status" query="true" queryMode="single" dictionary="status" width="120"></t:dgCol>
<t:dgCol title="文本" field="text" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="物料名称" field="matname" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="设计数量" field="qty" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="计量单位" field="units" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="成本中心代码" field="prccode" hidden="true" queryMode="single" dictionary="t_md_costcenter,cscode,csname" width="120"></t:dgCol>
<t:dgCol title="成本中心名称" field="prcname" hidden="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="生效日期" field="startdate" formatter="yyyy-MM-dd" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="失效日期" field="enddate" formatter="yyyy-MM-dd" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<%--<t:dgDelOpt title="删除" url="tMdBomHeadController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>--%>
<t:dgToolBar title="录入" icon="icon-add" url="tMdBomHeadController.do?goAdd" funname="add" width="100%" height="100%"></t:dgToolBar>
<t:dgToolBar title="编辑" icon="icon-edit" url="tMdBomHeadController.do?goUpdate" funname="update" width="100%" height="100%"></t:dgToolBar>
<%--<t:dgToolBar title="批量删除" icon="icon-remove" url="tMdBomHeadController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>--%>
<t:dgToolBar title="查看" icon="icon-search" url="tMdBomHeadController.do?goUpdate" funname="detail" width="100%" height="100%"></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/scm/md/tMdBomHeadList.js"></script>
<script type="text/javascript">
//导入
function ImportXls() {
openuploadwin('Excel导入', 'tMdBomHeadController.do?upload', "tMdBomHeadList");
}
//导出
function ExportXls() {
JeecgExcelExport("tMdBomHeadController.do?exportXls","tMdBomHeadList");
}
//模板下载
function ExportXlsByT() {
JeecgExcelExport("tMdBomHeadController.do?exportXlsByT","tMdBomHeadList");
}
</script>

View File

@ -0,0 +1,159 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!-- <h4>分类标题</h4> -->
<div class="row">
<div class="col-md-12 layout-header">
<button id="addBtn_TMdBomItem" type="button" class="btn btn-default">添加</button>
<button id="delBtn_TMdBomItem" type="button" class="btn btn-default">删除</button>
<script type="text/javascript">
$('#addBtn_TMdBomItem').bind('click', function(){
var tr = $("#add_tMdBomItem_table_template tr").clone();
$("#add_tMdBomItem_table").append(tr);
resetTrNum('add_tMdBomItem_table');
return false;
});
$('#delBtn_TMdBomItem').bind('click', function(){
$("#add_tMdBomItem_table").find("input:checked").parent().parent().remove();
resetTrNum('add_tMdBomItem_table');
return false;
});
$(document).ready(function(){
if(location.href.indexOf("load=detail")!=-1){
$(":input").attr("disabled","true");
$(".datagrid-toolbar").hide();
}
resetTrNum('add_tMdBomItem_table');
});
</script>
</div>
</div>
<div style="margin: 0 15px; background-color: white;">
<!-- Table -->
<table id="tMdBomItem_table" class="table table-bordered table-hover" style="margin-bottom: 0;">
<thead>
<tr>
<th style="white-space:nowrap;width:50px;">序号</th>
<th style="white-space:nowrap;width:50px;">操作</th>
<th>
组件
</th>
<th>
数量
</th>
<th>
单位
</th>
<th>
损耗率
</th>
<th>
文本
</th>
<th>
物料名称
</th>
<th>
工位
</th>
</tr>
</thead>
<tbody id="add_tMdBomItem_table">
<c:if test="${fn:length(tMdBomItemList) <= 0 }">
<tr>
<th scope="row"><div name="xh"></div></th>
<td><input style="width:20px;" type="checkbox" name="ck"/></td>
<input name="tMdBomItemList[0].id" type="hidden"/>
<input name="tMdBomItemList[0].createName" type="hidden"/>
<input name="tMdBomItemList[0].createBy" type="hidden"/>
<input name="tMdBomItemList[0].createDate" type="hidden"/>
<input name="tMdBomItemList[0].updateName" type="hidden"/>
<input name="tMdBomItemList[0].updateBy" type="hidden"/>
<input name="tMdBomItemList[0].updateDate" type="hidden"/>
<input name="tMdBomItemList[0].sysOrgCode" type="hidden"/>
<input name="tMdBomItemList[0].sysCompanyCode" type="hidden"/>
<input name="tMdBomItemList[0].bpmStatus" type="hidden"/>
<input name="tMdBomItemList[0].bomid" type="hidden"/>
<input name="tMdBomItemList[0].prccode" type="hidden"/>
<input name="tMdBomItemList[0].prcname" type="hidden"/>
<td>
<input id="tMdBomItemList[0].component" name="tMdBomItemList[0].component" type="text" style="width: 150px" class="form-control" value="${poVal.component }" ignore="ignore" onclick="popupClick(this,'matcode,matname,unit','component,itemname,unit','pop_material')"/>
<label class="Validform_label" style="display: none;">组件</label>
</td>
<td>
<input name="tMdBomItemList[0].quantity" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">数量</label>
</td>
<td>
<input name="tMdBomItemList[0].unit" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">单位</label>
</td>
<td>
<input name="tMdBomItemList[0].scrap" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">损耗率</label>
</td>
<td>
<input name="tMdBomItemList[0].text" maxlength="50" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">文本</label>
</td>
<td>
<input name="tMdBomItemList[0].itemname" maxlength="132" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">物料名称</label>
</td>
<td>
<input name="tMdBomItemList[0].workplace" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" />
<label class="Validform_label" style="display: none;">工位</label>
</td>
</tr>
</c:if>
<c:if test="${fn:length(tMdBomItemList) > 0 }">
<c:forEach items="${tMdBomItemList}" var="poVal" varStatus="stuts">
<tr>
<th scope="row"><div name="xh">${stuts.index+1 }</div></th>
<td><input style="width:20px;" type="checkbox" name="ck"/></td>
<input name="tMdBomItemList[${stuts.index }].id" type="hidden" value="${poVal.id }"/>
<input name="tMdBomItemList[${stuts.index }].createName" type="hidden" value="${poVal.createName }"/>
<input name="tMdBomItemList[${stuts.index }].createBy" type="hidden" value="${poVal.createBy }"/>
<input name="tMdBomItemList[${stuts.index }].createDate" type="hidden" value="${poVal.createDate }"/>
<input name="tMdBomItemList[${stuts.index }].updateName" type="hidden" value="${poVal.updateName }"/>
<input name="tMdBomItemList[${stuts.index }].updateBy" type="hidden" value="${poVal.updateBy }"/>
<input name="tMdBomItemList[${stuts.index }].updateDate" type="hidden" value="${poVal.updateDate }"/>
<input name="tMdBomItemList[${stuts.index }].sysOrgCode" type="hidden" value="${poVal.sysOrgCode }"/>
<input name="tMdBomItemList[${stuts.index }].sysCompanyCode" type="hidden" value="${poVal.sysCompanyCode }"/>
<input name="tMdBomItemList[${stuts.index }].bpmStatus" type="hidden" value="${poVal.bpmStatus }"/>
<input name="tMdBomItemList[${stuts.index }].bomid" type="hidden" value="${poVal.bomid }"/>
<input name="tMdBomItemList[${stuts.index }].prccode" type="hidden" value="${poVal.prccode }"/>
<input name="tMdBomItemList[${stuts.index }].prcname" type="hidden" value="${poVal.prcname }"/>
<td align="left">
<input id="tMdBomItemList[${stuts.index }].component" name="tMdBomItemList[${stuts.index }].component" type="text" class="form-control" ignore="ignore" onclick="popupClick(this,'matcode,matname,unit','component,itemname,unit','pop_material')" value="${poVal.component }" />
<label class="Validform_label" style="display: none;">组件</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].quantity" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.quantity }"/>
<label class="Validform_label" style="display: none;">数量</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].unit" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.unit }"/>
<label class="Validform_label" style="display: none;">单位</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].scrap" maxlength="10" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.scrap }"/>
<label class="Validform_label" style="display: none;">损耗率</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].text" maxlength="50" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.text }"/>
<label class="Validform_label" style="display: none;">文本</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].itemname" maxlength="132" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.itemname }"/>
<label class="Validform_label" style="display: none;">物料名称</label>
</td>
<td align="left">
<input name="tMdBomItemList[${stuts.index }].workplace" maxlength="32" type="text" class="form-control" style="width:120px;" ignore="ignore" value="${poVal.workplace }"/>
<label class="Validform_label" style="display: none;">工位</label>
</td>
</tr>
</c:forEach>
</c:if>
</tbody>
</table>