Commit 25dfb6b3 authored by 耿迪迪's avatar 耿迪迪

生产执行

parent 89fbe881
...@@ -45,6 +45,13 @@ public class TProductDrawingController extends BaseController ...@@ -45,6 +45,13 @@ public class TProductDrawingController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/drawInfoList")
public AjaxResult drawInfoList(TProductDrawing tProductDrawing)
{
List<TProductDrawing> list = tProductDrawingService.selectTProductDrawingList(tProductDrawing);
return AjaxResult.success(list);
}
/** /**
* 导出图纸列表 * 导出图纸列表
*/ */
......
package com.zehong.web.controller.track;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductInspect;
import com.zehong.system.service.track.ITProductInspectService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 生产执行Controller
*
* @author zehong
* @date 2024-08-26
*/
@RestController
@RequestMapping("/track/execute")
public class TProductInspectController extends BaseController
{
@Autowired
private ITProductInspectService tProductInspectService;
/**
* 查询生产执行列表
*/
// @PreAuthorize("@ss.hasPermi('system:inspect:list')")
@GetMapping("/list")
public TableDataInfo list(TProductInspect tProductInspect)
{
startPage();
List<TProductInspect> list = tProductInspectService.selectTProductInspectList(tProductInspect);
return getDataTable(list);
}
/**
* 导出生产执行列表
*/
//@PreAuthorize("@ss.hasPermi('system:inspect:export')")
@Log(title = "生产执行", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductInspect tProductInspect)
{
List<TProductInspect> list = tProductInspectService.selectTProductInspectList(tProductInspect);
ExcelUtil<TProductInspect> util = new ExcelUtil<TProductInspect>(TProductInspect.class);
return util.exportExcel(list, "生产执行数据");
}
/**
* 获取生产执行详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:inspect:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductInspectService.selectTProductInspectById(id));
}
/**
* 新增生产执行
*/
//@PreAuthorize("@ss.hasPermi('system:inspect:add')")
@Log(title = "生产执行", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductInspect tProductInspect)
{
return toAjax(tProductInspectService.insertTProductInspect(tProductInspect));
}
/**
* 修改生产执行
*/
//@PreAuthorize("@ss.hasPermi('system:inspect:edit')")
@Log(title = "生产执行", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductInspect tProductInspect)
{
return toAjax(tProductInspectService.updateTProductInspect(tProductInspect));
}
/**
* 删除生产执行
*/
//@PreAuthorize("@ss.hasPermi('system:inspect:remove')")
@Log(title = "生产执行", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductInspectService.deleteTProductInspectByIds(ids));
}
}
package com.zehong.web.controller.track;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductInspectDetail;
import com.zehong.system.service.track.ITProductInspectDetailService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 生产执行中间Controller
*
* @author zehong
* @date 2024-08-26
*/
@RestController
@RequestMapping("/track/executeDetail")
public class TProductInspectDetailController extends BaseController
{
@Autowired
private ITProductInspectDetailService tProductInspectDetailService;
/**
* 查询生产执行中间列表
*/
// @PreAuthorize("@ss.hasPermi('system:detail:list')")
@GetMapping("/list")
public TableDataInfo list(TProductInspectDetail tProductInspectDetail)
{
startPage();
List<TProductInspectDetail> list = tProductInspectDetailService.selectTProductInspectDetailList(tProductInspectDetail);
return getDataTable(list);
}
/**
* 导出生产执行中间列表
*/
//@PreAuthorize("@ss.hasPermi('system:detail:export')")
@Log(title = "生产执行中间", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductInspectDetail tProductInspectDetail)
{
List<TProductInspectDetail> list = tProductInspectDetailService.selectTProductInspectDetailList(tProductInspectDetail);
ExcelUtil<TProductInspectDetail> util = new ExcelUtil<TProductInspectDetail>(TProductInspectDetail.class);
return util.exportExcel(list, "生产执行中间数据");
}
/**
* 获取生产执行中间详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:detail:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductInspectDetailService.selectTProductInspectDetailById(id));
}
/**
* 新增生产执行中间
*/
//@PreAuthorize("@ss.hasPermi('system:detail:add')")
@Log(title = "生产执行中间", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductInspectDetail tProductInspectDetail)
{
return toAjax(tProductInspectDetailService.insertTProductInspectDetail(tProductInspectDetail));
}
/**
* 修改生产执行中间
*/
//@PreAuthorize("@ss.hasPermi('system:detail:edit')")
@Log(title = "生产执行中间", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductInspectDetail tProductInspectDetail)
{
return toAjax(tProductInspectDetailService.updateTProductInspectDetail(tProductInspectDetail));
}
/**
* 删除生产执行中间
*/
//@PreAuthorize("@ss.hasPermi('system:detail:remove')")
@Log(title = "生产执行中间", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductInspectDetailService.deleteTProductInspectDetailByIds(ids));
}
@PostMapping("/batchAddDetailInfo")
public AjaxResult batchAddDetailInfo(@RequestBody List<TProductInspectDetail> productInspectDetailList) {
return toAjax(tProductInspectDetailService.batchAddDetailInfo(productInspectDetailList));
}
}
...@@ -45,6 +45,13 @@ public class TProductMarkController extends BaseController ...@@ -45,6 +45,13 @@ public class TProductMarkController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/markInfoList")
public AjaxResult markInfoList(TProductMark tProductMark)
{
List<TProductMark> list = tProductMarkService.selectTProductMarkList(tProductMark);
return AjaxResult.success(list);
}
/** /**
* 导出装配模板列表 * 导出装配模板列表
*/ */
......
...@@ -45,6 +45,13 @@ public class TProductPlanController extends BaseController ...@@ -45,6 +45,13 @@ public class TProductPlanController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/planInfoList")
public AjaxResult planInfoList(TProductPlan tProductPlan)
{
List<TProductPlan> list = tProductPlanService.selectTProductPlanList(tProductPlan);
return AjaxResult.success(list);
}
/** /**
* 导出生产计划列表 * 导出生产计划列表
*/ */
......
package com.zehong.system.domain.track;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 生产执行对象 t_product_inspect
*
* @author zehong
* @date 2024-08-26
*/
public class TProductInspect extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 计划编号 */
private Long planId;
@Excel(name = "计划名称")
private String planName;
/** 批次号 */
@Excel(name = "批次号")
private String batchNo;
/** 生产数量 */
@Excel(name = "生产数量")
private Long total;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date starttime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endtime;
/** 执行状态 */
@Excel(name = "执行状态",dictType = "t_produce_execute")
private String status;
/** 创建人 */
private Long createId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public void setBatchNo(String batchNo)
{
this.batchNo = batchNo;
}
public String getBatchNo()
{
return batchNo;
}
public void setTotal(Long total)
{
this.total = total;
}
public Long getTotal()
{
return total;
}
public void setStarttime(Date starttime)
{
this.starttime = starttime;
}
public Date getStarttime()
{
return starttime;
}
public void setEndtime(Date endtime)
{
this.endtime = endtime;
}
public Date getEndtime()
{
return endtime;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planId", getPlanId())
.append("batchNo", getBatchNo())
.append("total", getTotal())
.append("starttime", getStarttime())
.append("endtime", getEndtime())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.domain.track;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 生产执行中间对象 t_product_inspect_detail
*
* @author zehong
* @date 2024-08-26
*/
public class TProductInspectDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 执行编号 */
private Long inspectId;
@Excel(name="批次号")
private String batchNo;
/** 关联类型,1是图纸,2是配件,3是装配模板 */
@Excel(name = "关联类型",readConverterExp="1=图纸,2=配件,3=装配模版")
private Integer type;
/** 关联类型对应的编号 */
private Long typeId;
@Excel(name = "名称")
private String typeName;
/** 配件数量 */
@Excel(name = "配件数量")
private Long number;
/** $column.columnComment */
private Long createId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInspectId(Long inspectId)
{
this.inspectId = inspectId;
}
public Long getInspectId()
{
return inspectId;
}
public void setType(Integer type)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setTypeId(Long typeId)
{
this.typeId = typeId;
}
public Long getTypeId()
{
return typeId;
}
public void setNumber(Long number)
{
this.number = number;
}
public Long getNumber()
{
return number;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
public String getBatchNo() {
return batchNo;
}
public void setBatchNo(String batchNo) {
this.batchNo = batchNo;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("inspectId", getInspectId())
.append("type", getType())
.append("typeId", getTypeId())
.append("number", getNumber())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.track.TProductInspectDetail;
/**
* 生产执行中间Mapper接口
*
* @author zehong
* @date 2024-08-26
*/
public interface TProductInspectDetailMapper
{
/**
* 查询生产执行中间
*
* @param id 生产执行中间ID
* @return 生产执行中间
*/
public TProductInspectDetail selectTProductInspectDetailById(Long id);
/**
* 查询生产执行中间列表
*
* @param tProductInspectDetail 生产执行中间
* @return 生产执行中间集合
*/
public List<TProductInspectDetail> selectTProductInspectDetailList(TProductInspectDetail tProductInspectDetail);
/**
* 新增生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
public int insertTProductInspectDetail(TProductInspectDetail tProductInspectDetail);
/**
* 修改生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
public int updateTProductInspectDetail(TProductInspectDetail tProductInspectDetail);
/**
* 删除生产执行中间
*
* @param id 生产执行中间ID
* @return 结果
*/
public int deleteTProductInspectDetailById(Long id);
/**
* 批量删除生产执行中间
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductInspectDetailByIds(Long[] ids);
/**
* 批量新增
* @param productInspectDetailList
* @return
*/
int batchAddDetailInfo(List<TProductInspectDetail> productInspectDetailList);
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.track.TProductInspect;
/**
* 生产执行Mapper接口
*
* @author zehong
* @date 2024-08-26
*/
public interface TProductInspectMapper
{
/**
* 查询生产执行
*
* @param id 生产执行ID
* @return 生产执行
*/
public TProductInspect selectTProductInspectById(Long id);
/**
* 查询生产执行列表
*
* @param tProductInspect 生产执行
* @return 生产执行集合
*/
public List<TProductInspect> selectTProductInspectList(TProductInspect tProductInspect);
/**
* 新增生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
public int insertTProductInspect(TProductInspect tProductInspect);
/**
* 修改生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
public int updateTProductInspect(TProductInspect tProductInspect);
/**
* 删除生产执行
*
* @param id 生产执行ID
* @return 结果
*/
public int deleteTProductInspectById(Long id);
/**
* 批量删除生产执行
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductInspectByIds(Long[] ids);
}
package com.zehong.system.service.impl.track;
import java.util.Date;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TProductInspectDetailMapper;
import com.zehong.system.domain.track.TProductInspectDetail;
import com.zehong.system.service.track.ITProductInspectDetailService;
/**
* 生产执行中间Service业务层处理
*
* @author zehong
* @date 2024-08-26
*/
@Service
public class TProductInspectDetailServiceImpl implements ITProductInspectDetailService
{
@Autowired
private TProductInspectDetailMapper tProductInspectDetailMapper;
/**
* 查询生产执行中间
*
* @param id 生产执行中间ID
* @return 生产执行中间
*/
@Override
public TProductInspectDetail selectTProductInspectDetailById(Long id)
{
return tProductInspectDetailMapper.selectTProductInspectDetailById(id);
}
/**
* 查询生产执行中间列表
*
* @param tProductInspectDetail 生产执行中间
* @return 生产执行中间
*/
@Override
public List<TProductInspectDetail> selectTProductInspectDetailList(TProductInspectDetail tProductInspectDetail)
{
return tProductInspectDetailMapper.selectTProductInspectDetailList(tProductInspectDetail);
}
/**
* 新增生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
@Override
public int insertTProductInspectDetail(TProductInspectDetail tProductInspectDetail)
{
tProductInspectDetail.setCreateTime(DateUtils.getNowDate());
tProductInspectDetail.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
return tProductInspectDetailMapper.insertTProductInspectDetail(tProductInspectDetail);
}
/**
* 修改生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
@Override
public int updateTProductInspectDetail(TProductInspectDetail tProductInspectDetail)
{
return tProductInspectDetailMapper.updateTProductInspectDetail(tProductInspectDetail);
}
/**
* 批量删除生产执行中间
*
* @param ids 需要删除的生产执行中间ID
* @return 结果
*/
@Override
public int deleteTProductInspectDetailByIds(Long[] ids)
{
return tProductInspectDetailMapper.deleteTProductInspectDetailByIds(ids);
}
/**
* 删除生产执行中间信息
*
* @param id 生产执行中间ID
* @return 结果
*/
@Override
public int deleteTProductInspectDetailById(Long id)
{
return tProductInspectDetailMapper.deleteTProductInspectDetailById(id);
}
/**
* 批量新增详情
* @param productInspectDetailList
* @return
*/
public int batchAddDetailInfo(List<TProductInspectDetail> productInspectDetailList){
for(TProductInspectDetail detail : productInspectDetailList){
detail.setCreateTime(new Date());
detail.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
}
return tProductInspectDetailMapper.batchAddDetailInfo(productInspectDetailList);
}
}
package com.zehong.system.service.impl.track;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.List;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TProductInspectMapper;
import com.zehong.system.domain.track.TProductInspect;
import com.zehong.system.service.track.ITProductInspectService;
/**
* 生产执行Service业务层处理
*
* @author zehong
* @date 2024-08-26
*/
@Service
public class TProductInspectServiceImpl implements ITProductInspectService
{
@Autowired
private TProductInspectMapper tProductInspectMapper;
/**
* 查询生产执行
*
* @param id 生产执行ID
* @return 生产执行
*/
@Override
public TProductInspect selectTProductInspectById(Long id)
{
return tProductInspectMapper.selectTProductInspectById(id);
}
/**
* 查询生产执行列表
*
* @param tProductInspect 生产执行
* @return 生产执行
*/
@Override
public List<TProductInspect> selectTProductInspectList(TProductInspect tProductInspect)
{
return tProductInspectMapper.selectTProductInspectList(tProductInspect);
}
/**
* 新增生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
@Override
public int insertTProductInspect(TProductInspect tProductInspect)
{
try{
tProductInspect.setCreateTime(DateUtils.getNowDate());
tProductInspect.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
return tProductInspectMapper.insertTProductInspect(tProductInspect);
}catch (Exception e){
Throwable cause = e.getCause();
if (cause instanceof SQLIntegrityConstraintViolationException){
String errMsg = cause.getMessage();
if (StringUtils.isNotEmpty(errMsg) && errMsg.contains("index_unique_batch_no")){
throw new CustomException("批次号不能重复");
}
}
throw e;
}
}
/**
* 修改生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
@Override
public int updateTProductInspect(TProductInspect tProductInspect)
{
return tProductInspectMapper.updateTProductInspect(tProductInspect);
}
/**
* 批量删除生产执行
*
* @param ids 需要删除的生产执行ID
* @return 结果
*/
@Override
public int deleteTProductInspectByIds(Long[] ids)
{
return tProductInspectMapper.deleteTProductInspectByIds(ids);
}
/**
* 删除生产执行信息
*
* @param id 生产执行ID
* @return 结果
*/
@Override
public int deleteTProductInspectById(Long id)
{
return tProductInspectMapper.deleteTProductInspectById(id);
}
}
package com.zehong.system.service.track;
import java.util.List;
import com.zehong.system.domain.track.TProductInspectDetail;
/**
* 生产执行中间Service接口
*
* @author zehong
* @date 2024-08-26
*/
public interface ITProductInspectDetailService
{
/**
* 查询生产执行中间
*
* @param id 生产执行中间ID
* @return 生产执行中间
*/
public TProductInspectDetail selectTProductInspectDetailById(Long id);
/**
* 查询生产执行中间列表
*
* @param tProductInspectDetail 生产执行中间
* @return 生产执行中间集合
*/
public List<TProductInspectDetail> selectTProductInspectDetailList(TProductInspectDetail tProductInspectDetail);
/**
* 新增生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
public int insertTProductInspectDetail(TProductInspectDetail tProductInspectDetail);
/**
* 修改生产执行中间
*
* @param tProductInspectDetail 生产执行中间
* @return 结果
*/
public int updateTProductInspectDetail(TProductInspectDetail tProductInspectDetail);
/**
* 批量删除生产执行中间
*
* @param ids 需要删除的生产执行中间ID
* @return 结果
*/
public int deleteTProductInspectDetailByIds(Long[] ids);
/**
* 删除生产执行中间信息
*
* @param id 生产执行中间ID
* @return 结果
*/
public int deleteTProductInspectDetailById(Long id);
/**
* 批量新增详情
* @param productInspectDetailList
* @return
*/
int batchAddDetailInfo(List<TProductInspectDetail> productInspectDetailList);
}
package com.zehong.system.service.track;
import java.util.List;
import com.zehong.system.domain.track.TProductInspect;
/**
* 生产执行Service接口
*
* @author zehong
* @date 2024-08-26
*/
public interface ITProductInspectService
{
/**
* 查询生产执行
*
* @param id 生产执行ID
* @return 生产执行
*/
public TProductInspect selectTProductInspectById(Long id);
/**
* 查询生产执行列表
*
* @param tProductInspect 生产执行
* @return 生产执行集合
*/
public List<TProductInspect> selectTProductInspectList(TProductInspect tProductInspect);
/**
* 新增生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
public int insertTProductInspect(TProductInspect tProductInspect);
/**
* 修改生产执行
*
* @param tProductInspect 生产执行
* @return 结果
*/
public int updateTProductInspect(TProductInspect tProductInspect);
/**
* 批量删除生产执行
*
* @param ids 需要删除的生产执行ID
* @return 结果
*/
public int deleteTProductInspectByIds(Long[] ids);
/**
* 删除生产执行信息
*
* @param id 生产执行ID
* @return 结果
*/
public int deleteTProductInspectById(Long id);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TProductInspectDetailMapper">
<resultMap type="TProductInspectDetail" id="TProductInspectDetailResult">
<result property="id" column="id" />
<result property="inspectId" column="inspect_id" />
<result property="type" column="type" />
<result property="typeId" column="type_id" />
<result property="number" column="number" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
</resultMap>
<sql id="selectTProductInspectDetailVo">
SELECT
id,
inspect_id,
(SELECT batch_no FROM t_product_inspect WHERE id = inspect_id)as batchNo,
`type`,
type_id,
`number`,
create_time,
create_id,
(
CASE
WHEN type = '1' THEN (select title from t_product_drawing draw WHERE draw.id = type_id)
WHEN type = '2' THEN (select title from t_product_store store WHERE store.id = type_id)
WHEN type = '3' THEN (select title from t_product_mark mark WHERE mark.id = type_id)
END
)as typeName,
<include refid="Common.createBy"/>
FROM
t_product_inspect_detail
</sql>
<select id="selectTProductInspectDetailList" parameterType="TProductInspectDetail" resultMap="TProductInspectDetailResult">
<include refid="selectTProductInspectDetailVo"/>
<where>
<if test="inspectId != null "> and inspect_id = #{inspectId}</if>
<if test="type != null "> and type = #{type}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
</where>
</select>
<select id="selectTProductInspectDetailById" parameterType="Long" resultMap="TProductInspectDetailResult">
<include refid="selectTProductInspectDetailVo"/>
where id = #{id}
</select>
<insert id="insertTProductInspectDetail" parameterType="TProductInspectDetail" useGeneratedKeys="true" keyProperty="id">
insert into t_product_inspect_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inspectId != null">inspect_id,</if>
<if test="type != null">`type`,</if>
<if test="typeId != null">type_id,</if>
<if test="number != null">`number`,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inspectId != null">#{inspectId},</if>
<if test="type != null">#{type},</if>
<if test="typeId != null">#{typeId},</if>
<if test="number != null">#{number},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
</trim>
</insert>
<update id="updateTProductInspectDetail" parameterType="TProductInspectDetail">
update t_product_inspect_detail
<trim prefix="SET" suffixOverrides=",">
<if test="inspectId != null">inspect_id = #{inspectId},</if>
<if test="type != null">`type` = #{type},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="number != null">`number` = #{number},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductInspectDetailById" parameterType="Long">
delete from t_product_inspect_detail where id = #{id}
</delete>
<delete id="deleteTProductInspectDetailByIds" parameterType="String">
delete from t_product_inspect_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchAddDetailInfo" parameterType="List" useGeneratedKeys="true" keyProperty="id">
insert into t_product_inspect_detail(
inspect_id,`type`,type_id,`number`,create_time,create_id
)values
<foreach item="item" collection="list" index="index" separator=",">
(#{item.inspectId},#{item.type},#{item.typeId},#{item.number},#{item.createTime},#{item.createId})
</foreach>
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TProductInspectMapper">
<resultMap type="TProductInspect" id="TProductInspectResult">
<result property="id" column="id" />
<result property="planId" column="plan_id" />
<result property="batchNo" column="batch_no" />
<result property="total" column="total" />
<result property="starttime" column="starttime" />
<result property="endtime" column="endtime" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
</resultMap>
<sql id="selectTProductInspectVo">
SELECT
ins.id,
ins.plan_id,
plan.title as planName,
ins.batch_no,
ins.total,
ins.starttime,
ins.endtime,
ins.`STATUS`,
ins.create_time,
ins.create_id,
(select nick_name from sys_user where user_id = ins.create_id) as createBy
FROM
t_product_inspect ins
LEFT JOIN t_product_plan plan ON plan.id = ins.plan_id
</sql>
<select id="selectTProductInspectList" parameterType="TProductInspect" resultMap="TProductInspectResult">
<include refid="selectTProductInspectVo"/>
<where>
<if test="batchNo != null and batchNo != ''"> and ins.batch_no = #{batchNo}</if>
<if test="status != null and status != ''"> and ins.status = #{status}</if>
</where>
order by ins.create_time desc
</select>
<select id="selectTProductInspectById" parameterType="Long" resultMap="TProductInspectResult">
<include refid="selectTProductInspectVo"/>
where ins.id = #{id}
</select>
<insert id="insertTProductInspect" parameterType="TProductInspect" useGeneratedKeys="true" keyProperty="id">
insert into t_product_inspect
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null">plan_id,</if>
<if test="batchNo != null and batchNo != ''">batch_no,</if>
<if test="total != null">total,</if>
<if test="starttime != null">starttime,</if>
<if test="endtime != null">endtime,</if>
<if test="status != null">status,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planId != null">#{planId},</if>
<if test="batchNo != null and batchNo != ''">#{batchNo},</if>
<if test="total != null">#{total},</if>
<if test="starttime != null">#{starttime},</if>
<if test="endtime != null">#{endtime},</if>
<if test="status != null">#{status},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
</trim>
</insert>
<update id="updateTProductInspect" parameterType="TProductInspect">
update t_product_inspect
<trim prefix="SET" suffixOverrides=",">
<if test="planId != null">plan_id = #{planId},</if>
<if test="batchNo != null and batchNo != ''">batch_no = #{batchNo},</if>
<if test="total != null">total = #{total},</if>
<if test="starttime != null">starttime = #{starttime},</if>
<if test="endtime != null">endtime = #{endtime},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductInspectById" parameterType="Long">
delete from t_product_inspect where id = #{id}
</delete>
<delete id="deleteTProductInspectByIds" parameterType="String">
delete from t_product_inspect where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -51,3 +51,12 @@ export function exportDrawing(query) { ...@@ -51,3 +51,12 @@ export function exportDrawing(query) {
params: query params: query
}) })
} }
// 查询图纸全部信息
export function drawInfoList(query) {
return request({
url: '/track/drawing/drawInfoList',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询生产执行列表
export function listInspect(query) {
return request({
url: '/track/execute/list',
method: 'get',
params: query
})
}
// 查询生产执行详细
export function getInspect(id) {
return request({
url: '/track/execute/' + id,
method: 'get'
})
}
// 新增生产执行
export function addInspect(data) {
return request({
url: '/track/execute',
method: 'post',
data: data
})
}
// 修改生产执行
export function updateInspect(data) {
return request({
url: '/track/execute',
method: 'put',
data: data
})
}
// 删除生产执行
export function delInspect(id) {
return request({
url: '/track/execute/' + id,
method: 'delete'
})
}
// 导出生产执行
export function exportInspect(query) {
return request({
url: '/track/execute/export',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询生产执行中间列表
export function listDetail(query) {
return request({
url: '/track/executeDetail/list',
method: 'get',
params: query
})
}
// 查询生产执行中间详细
export function getDetail(id) {
return request({
url: '/track/executeDetail/' + id,
method: 'get'
})
}
// 新增生产执行中间
export function addDetail(data) {
return request({
url: '/track/executeDetail',
method: 'post',
data: data
})
}
// 修改生产执行中间
export function updateDetail(data) {
return request({
url: '/track/executeDetail',
method: 'put',
data: data
})
}
// 删除生产执行中间
export function delDetail(id) {
return request({
url: '/track/executeDetail/' + id,
method: 'delete'
})
}
// 导出生产执行中间
export function exportDetail(query) {
return request({
url: '/track/executeDetail/export',
method: 'get',
params: query
})
}
//批量新增
export function batchAddDetailInfo(data) {
return request({
url: '/track/executeDetail/batchAddDetailInfo',
method: 'post',
data: data
})
}
...@@ -51,3 +51,12 @@ export function exportMark(query) { ...@@ -51,3 +51,12 @@ export function exportMark(query) {
params: query params: query
}) })
} }
//查看全部模版信息
export function markInfoList(query) {
return request({
url: '/track/mark/markInfoList',
method: 'get',
params: query
})
}
...@@ -51,3 +51,12 @@ export function exportPlan(query) { ...@@ -51,3 +51,12 @@ export function exportPlan(query) {
params: query params: query
}) })
} }
//生产计划所有信息
export function planInfoList(query) {
return request({
url: '/track/plan/planInfoList',
method: 'get',
params: query
})
}
<template>
<!-- 入库 -->
<el-dialog title="新增生产执行详情" :visible.sync="executeDetailOpen" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<div class="execute-detail-form">
<div class="execute-detail-item" v-for="(item,index) in detailInfoList">
<div class="execute-detail-info">
<el-select v-model="item.type" placeholder="请选择关联类型" size="small">
<el-option label="图纸" value="1" />
<el-option label="配件" value="2" />
<el-option label="装配模板" value="3" />
</el-select>
</div>
<div class="execute-detail-info">
<el-select v-model="item.typeId" v-if="item.type == '1'" placeholder="请选择图纸" clearable size="small" @change="pictureChange($event,index)">
<el-option
v-for="picture in pictureList"
:key="picture.id"
:label="picture.title"
:value="picture.id"
/>
</el-select>
<el-select v-model="item.typeId" v-if="item.type == '2'" placeholder="请选择配件" clearable size="small" @change="storeChange($event,index)">
<el-option
v-for="store in storeInfoList"
:key="store.id"
:label="store.title"
:value="store.id"
/>
</el-select>
<el-select v-model="item.typeId" v-if="item.type == '3'" placeholder="请选择转配模版" clearable size="small" @change="markChange($event,index)">
<el-option
v-for="mark in markList"
:key="mark.id"
:label="mark.title"
:value="mark.id"
/>
</el-select>
</div>
<div class="execute-detail-info">
<el-input type="number" v-model.number="item.number" placeholder="请输入数量" size="small"/>
</div>
<div class="execute-detail-operate">
<i style="color:#1890ff" class="el-icon-circle-plus-outline" v-if="detailInfoList.length -1 == index" @click="addDetail"></i>
<i style="color: #ff9292" class="el-icon-remove-outline" v-else @click="delDetail(index)"></i>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitStore">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import { drawInfoList } from "@/api/track/drawing";
import { getStores } from "@/api/track/store";
import { markInfoList } from "@/api/track/mark";
import { batchAddDetailInfo } from "@/api/track/executeDetail";
export default {
name: "add-detail",
props:{
executeId:{
type: Number
}
},
data(){
return{
executeDetailOpen: false,
storeList: [],
detailInfoList: [{type: '1',inspectId: this.executeId}],
pictureList: [],
storeInfoList: [],
markList: []
}
},
methods:{
openExecuteDetail(){
this.initInExecuteDetail();
this.getPictureInfo();
this.getStoreInfo();
this.getMarkInfo();
this.executeDetailOpen = true;
},
addDetail(){
this.detailInfoList.push({type: '1',inspectId: this.executeId});
},
delDetail(index){
this.detailInfoList.splice(index, 1);
},
getPictureInfo(){
drawInfoList().then(res =>{
if(res.code == 200){
this.pictureList = res.data;
}
})
},
getStoreInfo(){
getStores().then(res =>{
if(res.code == 200){
this.storeInfoList = res.data;
}
})
},
getMarkInfo(){
markInfoList().then(res =>{
if(res.code == 200){
this.markList = res.data;
}
})
},
pictureChange(val,index){
const store = this.detailInfoList.filter(item => item.id == val && item.type == '1');
if(store.length > 1){
this.detailInfoList[index].id = "";
this.$message.error("此图纸已被选中")
}
},
storeChange(val,index){
const store = this.detailInfoList.filter(item => item.id == val && item.type == '2');
if(store.length > 1){
this.detailInfoList[index].id = "";
this.$message.error("此配件已被选中")
}
},
markChange(val,index){
const store = this.detailInfoList.filter(item => item.id == val && item.type == '3');
if(store.length > 1){
this.detailInfoList[index].id = "";
this.$message.error("此装配模版已被选中")
}
},
submitStore(){
this.validateData();
batchAddDetailInfo(this.detailInfoList).then(res =>{
if(res.code == 200){
this.executeDetailOpen = false;
this.$parent.getList();
}
})
},
validateData(){
//检查信息是否完整
for(var i = 0; i< this.detailInfoList.length; i++){
if(!(this.detailInfoList[i].typeId && this.detailInfoList[i].number && this.detailInfoList[i].type)){
this.$message.error("请检查信息是否填完整");
return
}
}
if(this.detailInfoList.findIndex(item => item.type == '1') == -1){
this.$message.error("未选择图纸");
return
}
if(this.detailInfoList.findIndex(item => item.type == '2') == -1){
this.$message.error("未选择配件");
return
}
if(this.detailInfoList.findIndex(item => item.type == '3') == -1){
this.$message.error("未选择装配模版");
return
}
},
cancel(){
this.executeDetailOpen = false;
this.initInExecuteDetail();
},
initInExecuteDetail(){
this.detailInfoList = [{type: '1',inspectId: this.executeId}];
}
}
}
</script>
<style scoped lang="scss">
.execute-detail-form{
height: 350px;
overflow-y: scroll;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
.execute-detail-item{
display: flex;
margin: 4px auto;
}
.execute-detail-info{
flex: 2;
}
.execute-detail-operate{
flex: 0.2;
text-align: center;
margin: auto
}
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="关联类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择关联类型" clearable size="small">
<el-option label="图纸" value="1" />
<el-option label="配件" value="2" />
<el-option label="装配模板" value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="批次号" align="center" prop="batchNo"/>
<el-table-column label="关联类型" align="center" prop="type">
<template slot-scope="scope">
<span v-if="scope.row.type == '1'">图纸</span>
<span v-if="scope.row.type == '2'">配件</span>
<span v-else>装配模版</span>
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="typeName" />
<el-table-column label="配件数量" align="center" prop="number" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改生产执行中间对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="关联类型" prop="type">
<el-select style="width: 100%" v-model="form.type" placeholder="请选择关联类型">
<el-option label="图纸" :value= "1" />
<el-option label="配件" :value= "2" />
<el-option label="装配模板" :value= "3" />
</el-select>
</el-form-item>
<el-form-item label="名称" prop="typeId">
<el-select style="width: 100%" v-model="form.typeId" v-if="form.type == '1'" placeholder="请选择图纸" clearable size="small">
<el-option
v-for="picture in pictureList"
:key="picture.id"
:label="picture.title"
:value="picture.id"
/>
</el-select>
<el-select style="width: 100%" v-model="form.typeId" v-if="form.type == '2'" placeholder="请选择配件" clearable size="small">
<el-option
v-for="store in storeInfoList"
:key="store.id"
:label="store.title"
:value="store.id"
/>
</el-select>
<el-select style="width: 100%" v-model="form.typeId" v-if="form.type == '3'" placeholder="请选择转配模版" clearable size="small">
<el-option
v-for="mark in markList"
:key="mark.id"
:label="mark.title"
:value="mark.id"
/>
</el-select>
</el-form-item>
<el-form-item label="配件数量" prop="number">
<el-input type="number" v-model="form.number" placeholder="请输入配件数量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 新增 -->
<AddDetail ref="add" :executeId="parseInt($route.query.id)"/>
</div>
</template>
<script>
import { listDetail, getDetail, delDetail, addDetail, updateDetail, exportDetail } from "@/api/track/executeDetail";
import AddDetail from "./components/AddDetail";
import { drawInfoList } from "@/api/track/drawing";
import { getStores } from "@/api/track/store";
import { markInfoList } from "@/api/track/mark";
export default {
name: "Detail",
components: {
AddDetail
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 生产执行中间表格数据
detailList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
inspectId: null,
type: null,
typeId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
type:[
{ required: true, message: "请选择关联类型", trigger: "change" }
],
typeId:[
{ required: true, message: "请选择名称", trigger: "change" }
],
number:[
{ required: true, message: "数量不能为空", trigger: "blur" }
]
},
pictureList: [],
storeInfoList: [],
markList: []
};
},
created() {
this.getList();
},
methods: {
/** 查询生产执行中间列表 */
getList() {
this.loading = true;
listDetail(this.queryParams).then(response => {
this.detailList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
inspectId: null,
type: null,
typeId: null,
number: null,
createTime: null,
createId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.queryParams.inspectId = this.$route.query.id;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
/*this.reset();
this.open = true;
this.title = "添加生产执行中间";*/
this.$refs.add.openExecuteDetail();
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDetail(id).then(response => {
this.form = response.data;
if(this.form.type == '1'){
this.getPictureInfo();
}
if(this.form.type == '2'){
this.getStoreInfo()
}
if(this.form.type == '3'){
this.getMarkInfo();
}
this.open = true;
this.title = "修改生产执行详情";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDetail(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDetail(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除生产执行详情编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delDetail(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有生产执行中间数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportDetail(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
getPictureInfo(){
drawInfoList().then(res =>{
if(res.code == 200){
this.pictureList = res.data;
}
})
},
getStoreInfo(){
getStores().then(res =>{
if(res.code == 200){
this.storeInfoList = res.data;
}
})
},
getMarkInfo(){
markInfoList().then(res =>{
if(res.code == 200){
this.markList = res.data;
}
})
},
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="批次号" prop="batchNo">
<el-input
v-model="queryParams.batchNo"
placeholder="请输入批次号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="执行状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择执行状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="inspectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="计划编号" align="center" prop="planName" />
<el-table-column label="批次号" align="center" prop="batchNo" />
<el-table-column label="生产数量" align="center" prop="total" />
<el-table-column label="开始时间" align="center" prop="starttime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endtime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endtime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="执行状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-document"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改生产执行对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="计划编号" prop="planId">
<el-select style="width: 100%" v-model="form.planId" placeholder="请选择计划编号">
<el-option
v-for="plan in planList"
:key="plan.id"
:label="plan.title"
:value="plan.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="批次号" prop="batchNo">
<el-input v-model="form.batchNo" placeholder="请输入批次号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产数量" prop="total">
<el-input type="Number" v-model="form.total" placeholder="请输入生产数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开始时间" prop="starttime">
<el-date-picker style="width: 100%" clearable size="small"
v-model="form.starttime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束时间" prop="endtime">
<el-date-picker style="width: 100%" clearable size="small"
v-model="form.endtime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInspect, getInspect, delInspect, addInspect, updateInspect, exportInspect } from "@/api/track/execute";
import { planInfoList } from "@/api/track/plan";
export default {
name: "Inspect",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 生产执行表格数据
inspectList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 执行状态字典
statusOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
batchNo: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
planId: [
{ required: true, message: "计划编号不能为空", trigger: "change" }
],
batchNo: [
{ required: true, message: "批次号不能为空", trigger: "blur" }
],
total: [
{ required: true, message: "生产数量不能为空", trigger: "blur" }
],
starttime: [
{ required: true, message: "开始时间不能为空", trigger: "blur" }
],
endtime: [
{ required: true, message: "结束时间不能为空", trigger: "blur" }
],
},
planList: []
};
},
created() {
this.getList();
this.getDicts("t_produce_execute").then(response => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询生产执行列表 */
getList() {
this.loading = true;
listInspect(this.queryParams).then(response => {
this.inspectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 执行状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
planId: null,
batchNo: null,
total: null,
starttime: null,
endtime: null,
status: "0",
createTime: null,
createId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getPlanInfo();
this.open = true;
this.title = "添加生产执行";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInspect(id).then(response => {
this.form = response.data;
this.getPlanInfo();
this.open = true;
this.title = "修改生产执行";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInspect(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInspect(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除生产执行编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delInspect(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有生产执行数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportInspect(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
//生产计划
getPlanInfo(){
planInfoList().then(res =>{
if(res.code == 200){
this.planList = res.data;
}
})
},
//详情
handleDetail(row){
this.$router.push({path:"/track/execute/detail",query:{id:row.id}})
}
}
};
</script>
...@@ -73,19 +73,19 @@ ...@@ -73,19 +73,19 @@
} }
}, },
submitStore(){ submitStore(){
console.log("gege=======",this.inHouseStore) for(var i = 0; i< this.detailInfoList.length; i++){
this.inHouseStore.forEach(item =>{ if(!(this.detailInfoList[i].id && this.detailInfoList[i].num)){
if(!(item.id && item.num)){
this.$message.error("请检查信息是否填完整"); this.$message.error("请检查信息是否填完整");
return return
} }
}
inHouse(this.inHouseStore).then(res =>{ inHouse(this.inHouseStore).then(res =>{
if(res.code == 200){ if(res.code == 200){
this.houseOpen = false; this.houseOpen = false;
this.$parent.getList(); this.$parent.getList();
} }
}) })
})
}, },
cancel(){ cancel(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment