Browse Source
退检管理 新增退检管理Controller 新增退检管理Service 新增退检管理ServiceImpl 新增制程工序returnInspection.html 完成数据填充,页面展示,条件查询操作dev
liuxiaoxu
6 months ago
5 changed files with 831 additions and 0 deletions
@ -0,0 +1,119 @@ |
|||||
|
package com.ruoyi.quality.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspection; |
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import com.ruoyi.common.annotation.Log; |
||||
|
import com.ruoyi.common.enums.BusinessType; |
||||
|
import com.ruoyi.quality.service.IQualityReturnInspectionService; |
||||
|
import com.ruoyi.common.core.controller.BaseController; |
||||
|
import com.ruoyi.common.core.domain.AjaxResult; |
||||
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
|
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 物料退检单Controller |
||||
|
* |
||||
|
* @author 刘晓旭 |
||||
|
* @date 2024-05-15 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/quality/returnInspection") |
||||
|
public class QualityReturnInspectionController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "quality/returnInspection"; |
||||
|
|
||||
|
@Autowired |
||||
|
private IQualityReturnInspectionService qualityReturnInspectionService; |
||||
|
|
||||
|
@RequiresPermissions("quality:returnInspection:view") |
||||
|
@GetMapping() |
||||
|
public String returnInspection() |
||||
|
{ |
||||
|
return prefix + "/returnInspection"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询物料退检单列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("quality:returnInspection:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<ErpMaterialReturnInspection> list = qualityReturnInspectionService.selectQualityReturnInspectionList(erpMaterialReturnInspection); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出物料退检单列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("quality:returnInspection:export") |
||||
|
@Log(title = "物料退检单", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
@ResponseBody |
||||
|
public AjaxResult export(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
List<ErpMaterialReturnInspectionExcelDto> list = qualityReturnInspectionService.selectExportList(erpMaterialReturnInspection); |
||||
|
ExcelUtil<ErpMaterialReturnInspectionExcelDto> util = new ExcelUtil<ErpMaterialReturnInspectionExcelDto>(ErpMaterialReturnInspectionExcelDto.class); |
||||
|
return util.exportExcel(list, "物料退检单数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增物料退检单 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存物料退检单 |
||||
|
*/ |
||||
|
@RequiresPermissions("quality:returnInspection:add") |
||||
|
@Log(title = "物料退检单", businessType = BusinessType.INSERT) |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public AjaxResult addSave(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
return toAjax(qualityReturnInspectionService.insertQualityReturnInspection(erpMaterialReturnInspection)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改物料退检单 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{id}") |
||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap) |
||||
|
{ |
||||
|
ErpMaterialReturnInspection erpMaterialReturnInspection = qualityReturnInspectionService.selectQualityReturnInspectionById(id); |
||||
|
mmap.put("erpMaterialReturnInspection", erpMaterialReturnInspection); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存物料退检单 |
||||
|
*/ |
||||
|
@RequiresPermissions("quality:returnInspection:edit") |
||||
|
@Log(title = "物料退检单", businessType = BusinessType.UPDATE) |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public AjaxResult editSave(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
return toAjax(qualityReturnInspectionService.updateQualityReturnInspection(erpMaterialReturnInspection)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
package com.ruoyi.quality.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspection; |
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto; |
||||
|
|
||||
|
/** |
||||
|
* 物料退检单Service接口 |
||||
|
* |
||||
|
* @author 刘晓旭 |
||||
|
* @date 2024-05-15 |
||||
|
*/ |
||||
|
public interface IQualityReturnInspectionService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询物料退检单 |
||||
|
* |
||||
|
* @param id 物料退检单ID |
||||
|
* @return 物料退检单 |
||||
|
*/ |
||||
|
public ErpMaterialReturnInspection selectQualityReturnInspectionById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询物料退检单列表 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 物料退检单集合 |
||||
|
*/ |
||||
|
public List<ErpMaterialReturnInspection> selectQualityReturnInspectionList(ErpMaterialReturnInspection erpMaterialReturnInspection); |
||||
|
|
||||
|
/** |
||||
|
* 新增物料退检单 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection); |
||||
|
|
||||
|
/** |
||||
|
* 修改物料退检单 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 导出列表查询 |
||||
|
* */ |
||||
|
List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection); |
||||
|
} |
@ -0,0 +1,140 @@ |
|||||
|
package com.ruoyi.quality.service.impl; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import com.ruoyi.common.core.redis.RedisCache; |
||||
|
import com.ruoyi.common.utils.DateUtils; |
||||
|
import com.ruoyi.common.utils.ShiroUtils; |
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspection; |
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionDetail; |
||||
|
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto; |
||||
|
import com.ruoyi.erp.mapper.ErpMaterialReturnInspectionMapper; |
||||
|
import com.ruoyi.erp.service.IErpMaterialReturnInspectionDetailService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.ruoyi.quality.service.IQualityReturnInspectionService; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
/** |
||||
|
* 物料退检单Service业务层处理 |
||||
|
* |
||||
|
* @author 刘晓旭 |
||||
|
* @date 2024-05-15 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class QualityReturnInspectionServiceImpl implements IQualityReturnInspectionService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private ErpMaterialReturnInspectionMapper erpMaterialReturnInspectionMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private RedisCache redisCache; |
||||
|
|
||||
|
@Autowired |
||||
|
private IErpMaterialReturnInspectionDetailService materialReturnInspectionDetailService; |
||||
|
|
||||
|
/** |
||||
|
* 查询物料退检单 |
||||
|
* |
||||
|
* @param id 物料退检单ID |
||||
|
* @return 物料退检单 |
||||
|
*/ |
||||
|
@Override |
||||
|
public ErpMaterialReturnInspection selectQualityReturnInspectionById(Long id) |
||||
|
{ |
||||
|
return erpMaterialReturnInspectionMapper.selectErpMaterialReturnInspectionById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询物料退检单列表 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 物料退检单 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<ErpMaterialReturnInspection> selectQualityReturnInspectionList(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
return erpMaterialReturnInspectionMapper.selectErpMaterialReturnInspectionList(erpMaterialReturnInspection); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增物料退检单 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public int insertQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
String loginName = ShiroUtils.getLoginName(); |
||||
|
erpMaterialReturnInspection.setCreateBy(loginName); |
||||
|
erpMaterialReturnInspection.setCreateTime(DateUtils.getNowDate()); |
||||
|
// 生成编号,年月日规则
|
||||
|
String billNo = redisCache.generateBillNo("TJ"); |
||||
|
erpMaterialReturnInspection.setReturnInspectionNo(billNo); |
||||
|
int id = erpMaterialReturnInspectionMapper.insertErpMaterialReturnInspection(erpMaterialReturnInspection); |
||||
|
List<ErpMaterialReturnInspectionDetail> inspectionDetails = erpMaterialReturnInspection.getInspectionDetails(); |
||||
|
// 插入子表
|
||||
|
for (int i = 0; i < inspectionDetails.size(); i++) { |
||||
|
ErpMaterialReturnInspectionDetail inspectionDetail = inspectionDetails.get(i); |
||||
|
inspectionDetail.setReturnInspectionNo(billNo); |
||||
|
materialReturnInspectionDetailService.insertErpMaterialReturnInspectionDetail(inspectionDetail); |
||||
|
} |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改物料退检单 |
||||
|
* |
||||
|
* @param qualityReturnInspection 物料退检单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public int updateQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection) |
||||
|
{ |
||||
|
String returnInspectionNo = erpMaterialReturnInspection.getReturnInspectionNo(); |
||||
|
ErpMaterialReturnInspectionDetail detailQueryObj = new ErpMaterialReturnInspectionDetail(); |
||||
|
detailQueryObj.setReturnInspectionNo(returnInspectionNo); |
||||
|
List<ErpMaterialReturnInspectionDetail> oldDetails = materialReturnInspectionDetailService.selectErpMaterialReturnInspectionDetailList(detailQueryObj); |
||||
|
List<Long> oldDetailIds = new ArrayList<>(); |
||||
|
if(CollectionUtil.isNotEmpty(oldDetails)){ |
||||
|
oldDetailIds = oldDetails.stream().map(t->t.getId()).collect(Collectors.toList()); |
||||
|
}else{ |
||||
|
materialReturnInspectionDetailService.deleteByReturnInspectionNo(returnInspectionNo); |
||||
|
} |
||||
|
List<ErpMaterialReturnInspectionDetail> inspectionDetails = erpMaterialReturnInspection.getInspectionDetails(); |
||||
|
List<Long> finalOldDetailIds = oldDetailIds; |
||||
|
inspectionDetails.forEach(detail->{ |
||||
|
Long id = detail.getId(); |
||||
|
if(finalOldDetailIds.contains(id)){ |
||||
|
materialReturnInspectionDetailService.updateErpMaterialReturnInspectionDetail(detail); |
||||
|
finalOldDetailIds.remove(id); |
||||
|
}else{ |
||||
|
detail.setReturnInspectionNo(returnInspectionNo); |
||||
|
materialReturnInspectionDetailService.insertErpMaterialReturnInspectionDetail(detail); |
||||
|
} |
||||
|
}); |
||||
|
if(CollectionUtil.isNotEmpty(finalOldDetailIds)){ |
||||
|
materialReturnInspectionDetailService.deleteErpMaterialReturnInspectionDetailByIdList(finalOldDetailIds); |
||||
|
} |
||||
|
|
||||
|
String loginName = ShiroUtils.getLoginName(); |
||||
|
erpMaterialReturnInspection.setUpdateBy(loginName); |
||||
|
erpMaterialReturnInspection.setUpdateTime(DateUtils.getNowDate()); |
||||
|
int updateFlag = erpMaterialReturnInspectionMapper.updateErpMaterialReturnInspection(erpMaterialReturnInspection); |
||||
|
return updateFlag; |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* 导出列表查询 |
||||
|
* */ |
||||
|
@Override |
||||
|
public List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection) { |
||||
|
return erpMaterialReturnInspectionMapper.selectExportList(erpMaterialReturnInspection); |
||||
|
} |
||||
|
} |
@ -0,0 +1,384 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('修改物料退检单')" /> |
||||
|
<th:block th:include="include :: datetimepicker-css" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal" id="form-materialReturnInspection-edit" th:object="${erpMaterialReturnInspection}"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-6"> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">退检单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input id="returnInspectionNo" name="returnInspectionNo" th:field="*{returnInspectionNo}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-sm-6"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">生产单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input readonly id="makeNo" name="makeNo" th:field="*{makeNo}" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-6"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">退料时间:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="input-group date"> |
||||
|
<input name="returnMaterialTime" th:value="${#dates.format(erpMaterialReturnInspection.returnMaterialTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
||||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-sm-6"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">紧急程度:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="urgencyLevel" class="form-control" th:with="type=${@dict.getType('urgency_level')}"> |
||||
|
<option value=""></option> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{urgencyLevel}"></option> |
||||
|
</select> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-6"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">是否结案:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}"> |
||||
|
<input type="radio" th:id="${'isClosed_' + dict.dictCode}" name="isClosed" th:value="${dict.dictValue}" th:field="*{isClosed}"> |
||||
|
<label th:for="${'isClosed_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12"> |
||||
|
<a class="btn btn-success btn-sm" onclick="insertRow()"> |
||||
|
<i class="fa fa-plus"></i> 新增行 |
||||
|
</a> |
||||
|
<a class="btn btn-danger multiple btn-sm" onclick="removeRow()"> |
||||
|
<i class="fa fa-remove"></i> 删除选择行 |
||||
|
</a> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-sub-table-1"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<th:block th:include="include :: datetimepicker-js" /> |
||||
|
<script th:src="@{/js/jquery.tmpl.js}"></script> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "erp/materialReturnInspection"; |
||||
|
|
||||
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
||||
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
||||
|
var bomLevelSelectDatas = [[${@dict.getTypeSelect('bomLevel')}]]; |
||||
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
||||
|
|
||||
|
$(function(){ |
||||
|
var options = { |
||||
|
url: ctx + "erp/materialReturnInspectionDetail/list", |
||||
|
id: 'bootstrap-sub-table-1', |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
uniqueId: "id", |
||||
|
pagination: false, // 设置不分页 |
||||
|
sidePagination: "client", |
||||
|
queryParams: queryParams, |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'id', |
||||
|
title: '主键id', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].id' value='%s'>", curIndex, value); |
||||
|
return value + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialNo', |
||||
|
align: 'center', |
||||
|
title: '料号', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].materialNo' value='%s'>", curIndex, value); |
||||
|
return value + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'photoUrl', |
||||
|
title: '图片', |
||||
|
formatter: function(value, row, index) { |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].photoUrl' value='%s'>", curIndex, value); |
||||
|
return $.table.imageView(value) + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialName', |
||||
|
align: 'center', |
||||
|
title: '物料名称', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].materialName' value='%s'>", curIndex, value); |
||||
|
return value + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialType', |
||||
|
align: 'center', |
||||
|
title: '物料类型', |
||||
|
formatter: function(value, row, index) { |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].materialType' value='%s'>", curIndex, value); |
||||
|
return $.table.selectCategoryLabel(materialTypeDatas, value) + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'describe', |
||||
|
align: 'center', |
||||
|
title: '描述', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].describe' value='%s'>", curIndex, value); |
||||
|
if(value){ |
||||
|
return value + columnInput; |
||||
|
} |
||||
|
return columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'brand', |
||||
|
align: 'center', |
||||
|
title: '品牌', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].brand' value='%s'>", curIndex, value); |
||||
|
if(value){ |
||||
|
return value + columnInput; |
||||
|
} |
||||
|
return columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'unit', |
||||
|
align: 'center', |
||||
|
title: '单位', |
||||
|
formatter: function(value, row, index) { |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].unit' value='%s'>", curIndex, value); |
||||
|
return $.table.selectDictLabel(sysUnitClassDatas, value) + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'processMethod', |
||||
|
align: 'center', |
||||
|
title: '加工方式', |
||||
|
formatter: function(value, row, index) { |
||||
|
var curIndex = index; |
||||
|
var columnInput = $.common.sprintf("<input type='hidden' name='inspectionDetails[%s].processMethod' value='%s'>", curIndex, value); |
||||
|
return $.table.selectDictLabel(processMethodDatas, value) + columnInput; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'returnInspectionNum', |
||||
|
align: 'center', |
||||
|
title: '退检数量', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
return '<input class = "form-control" data-id = "returnInspectionNum_'+curIndex+'" name="inspectionDetails['+curIndex+'].returnInspectionNum" value="'+value+'">'; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'returnInspectionType', |
||||
|
align: 'center', |
||||
|
title: '退检类型', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
return '<input class = "form-control" data-id = "returnInspectionType_'+curIndex+'" name="inspectionDetails['+curIndex+'].returnInspectionType" value="'+value+'">'; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'urgencyLevel', |
||||
|
align: 'center', |
||||
|
title: '紧急程度', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
// return '<input class = "form-control" data-id = "urgencyLevel_'+curIndex+'" name="inspectionDetails['+curIndex+'].urgencyLevel" value="'+value+'">'; |
||||
|
var data = [{ index: curIndex, type: value }]; |
||||
|
return $("#urgencyLevelTpl").tmpl(data).html(); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'pickMaterialTime', |
||||
|
align: 'center', |
||||
|
title: '领料时间', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
var html = $.common.sprintf("<input class='form-control' type='text' name='inspectionDetails[%s].pickMaterialTime' value='%s' placeholder='yyyy-MM-dd'>", curIndex, value); |
||||
|
return html; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'returnInspectionRemark', |
||||
|
align: 'center', |
||||
|
title: '退检备注', |
||||
|
formatter: function (value,row,index){ |
||||
|
var curIndex = index; |
||||
|
return '<input class = "form-control" data-id = "returnInspectionRemark_'+curIndex+'" name="inspectionDetails['+curIndex+'].returnInspectionRemark" value="'+value+'">'; |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}) |
||||
|
|
||||
|
function queryParams(params) { |
||||
|
var curParams = { |
||||
|
// 传递参数查询参数 |
||||
|
pageSize: params.limit, |
||||
|
pageNum: params.offset / params.limit + 1, |
||||
|
searchValue: params.search, |
||||
|
orderByColumn: params.sort, |
||||
|
isAsc: params.order |
||||
|
}; |
||||
|
// 额外传参 |
||||
|
curParams.returnInspectionNo = $("#returnInspectionNo").val(); |
||||
|
return curParams; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
function selectMakeOrder() { |
||||
|
var url = ctx + "system/makeorder/selectMakeorder"; |
||||
|
var options = { |
||||
|
title: '选择生产订单', |
||||
|
url: url, |
||||
|
callBack: doSubmit1 |
||||
|
}; |
||||
|
$.modal.openOptions(options); |
||||
|
} |
||||
|
|
||||
|
function doSubmit1(index, layero){ |
||||
|
debugger |
||||
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
||||
|
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; |
||||
|
$("#makeNo").val(rowData.makeNo); |
||||
|
$.modal.close(index); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* 新增表格行 */ |
||||
|
function insertRow(){ |
||||
|
var makeNo = $("#makeNo").val(); |
||||
|
if(!makeNo){ |
||||
|
$.modal.msgWarning("请先选择生产单号!"); |
||||
|
return; |
||||
|
} |
||||
|
var url = ctx + "system/makeorder/selectMakeorderDetail/"+makeNo; |
||||
|
var options = { |
||||
|
title: '选择料号', |
||||
|
url: url, |
||||
|
callBack: doSubmit |
||||
|
}; |
||||
|
$.modal.openOptions(options); |
||||
|
} |
||||
|
/* 删除指定表格行 */ |
||||
|
function removeRow(){ |
||||
|
var ids = $.table.selectColumns("id"); |
||||
|
if (ids.length == 0) { |
||||
|
$.modal.alertWarning("请至少选择一条记录"); |
||||
|
return; |
||||
|
} |
||||
|
$("#bootstrap-sub-table-1").bootstrapTable('remove', { |
||||
|
field: 'id', |
||||
|
values: ids |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
function doSubmit(index, layero,uniqueId){ |
||||
|
console.log(uniqueId); |
||||
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
||||
|
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; |
||||
|
var totalNum = $("#bootstrap-sub-table-1").bootstrapTable('getData').length; |
||||
|
console.log("rowData:"+rowData); |
||||
|
$("#bootstrap-sub-table-1").bootstrapTable('insertRow',{ |
||||
|
index: 1, |
||||
|
row: { |
||||
|
id: totalNum+1, |
||||
|
materialNo: rowData.materialNo, |
||||
|
photoUrl: rowData.photoUrl, |
||||
|
materialName: rowData.materialName, |
||||
|
materialType: rowData.materialType, |
||||
|
describe: rowData.describe, |
||||
|
brand: rowData.brand, |
||||
|
unit: rowData.unit, |
||||
|
processMethod: rowData.processMethod, |
||||
|
returnInspectionNum: '', |
||||
|
returnInspectionType: '', |
||||
|
urgencyLevel: '', |
||||
|
pickMaterialTime: '', |
||||
|
returnInspectionRemark: '' |
||||
|
} |
||||
|
}) |
||||
|
layer.close(index); |
||||
|
} |
||||
|
|
||||
|
$("#form-materialReturnInspection-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/edit", $('#form-materialReturnInspection-edit').serialize()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$("input[name='returnMaterialTime']").datetimepicker({ |
||||
|
format: "yyyy-mm-dd", |
||||
|
minView: "month", |
||||
|
autoclose: true |
||||
|
}); |
||||
|
|
||||
|
$("#bootstrap-sub-table-1").on("post-body.bs.table", function (e, args) { |
||||
|
$("input[name$='Time']").datetimepicker({ |
||||
|
format: "yyyy-mm-dd", |
||||
|
minView: "month", |
||||
|
autoclose: true, |
||||
|
pickerPosition:'top-right' |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
|
|
||||
|
<!-- 紧急程度 --> |
||||
|
<script id="urgencyLevelTpl" type="text/x-jquery-tmpl"> |
||||
|
<div> |
||||
|
<select class='form-control' name='inspectionDetails[${index}].urgencyLevel'> |
||||
|
<option value=""></option> |
||||
|
<option value="0" {{if type==="0"}}selected{{/if}}>一般</option> |
||||
|
<option value="1" {{if type==="1"}}selected{{/if}}>紧急</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</script> |
@ -0,0 +1,135 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('物料退检单列表')" /> |
||||
|
</head> |
||||
|
<body class="gray-bg"> |
||||
|
<div class="container-div"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 search-collapse"> |
||||
|
<form id="formId"> |
||||
|
<div class="select-list"> |
||||
|
<ul> |
||||
|
<li> |
||||
|
<label>退检单号:</label> |
||||
|
<input type="text" name="returnInspectionNo"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>退检类型:</label> |
||||
|
<input type="text" name="returnInspectionType"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>生产单号:</label> |
||||
|
<input type="text" name="makeNo"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>料号:</label> |
||||
|
<input type="text" name="materialNo"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>物料名称:</label> |
||||
|
<input type="text" name="materialName"/> |
||||
|
</li> |
||||
|
<li class="select-time"> |
||||
|
<label>录入时间:</label> |
||||
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/> |
||||
|
<span>-</span> |
||||
|
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>紧急程度:</label> |
||||
|
<select name="urgencyLevel" th:with="type=${@dict.getType('urgency_level')}"> |
||||
|
<option value="">所有</option> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
||||
|
</select> |
||||
|
</li> |
||||
|
<li> |
||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> |
||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
|
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="erp:materialReturnInspection:add">--> |
||||
|
<!-- <i class="fa fa-plus"></i> 添加--> |
||||
|
<!-- </a>--> |
||||
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:materialReturnInspection:export"> |
||||
|
<i class="fa fa-download"></i> 导出 |
||||
|
</a> |
||||
|
</div> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var editFlag = [[${@permission.hasPermi('erp:materialReturnInspection:edit')}]]; |
||||
|
var removeFlag = [[${@permission.hasPermi('erp:materialReturnInspection:remove')}]]; |
||||
|
// 字典 |
||||
|
var urgencyLevelDatas = [[${@dict.getType('urgency_level')}]]; |
||||
|
var yesOrNoDatas = [[${@dict.getType('yes_or_no')}]]; |
||||
|
var prefix = ctx + "erp/materialReturnInspection"; |
||||
|
|
||||
|
$(function() { |
||||
|
var options = { |
||||
|
url: prefix + "/list", |
||||
|
createUrl: prefix + "/add", |
||||
|
updateUrl: prefix + "/edit/{id}", |
||||
|
removeUrl: prefix + "/remove", |
||||
|
cancelUrl: prefix + "/cancel/{id}", |
||||
|
restoreUrl: prefix + "/restore/{id}", |
||||
|
exportUrl: prefix + "/export", |
||||
|
modalName: "物料退检单", |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '主键ID', |
||||
|
field: 'id', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '退检单号', |
||||
|
field: 'returnInspectionNo' |
||||
|
}, |
||||
|
{ |
||||
|
title: '是否结案', |
||||
|
field: 'isClosed', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(yesOrNoDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '关联生产单号', |
||||
|
field: 'makeNo', |
||||
|
}, |
||||
|
{ |
||||
|
title: '退料时间', |
||||
|
field: 'returnMaterialTime', |
||||
|
}, |
||||
|
{ |
||||
|
title: '紧急程度', |
||||
|
field: 'urgencyLevel', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(urgencyLevelDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue