Browse Source

[feat]品质管理:

制程检验
新增制程检验详情页面
manufacturingCheckout.html新增详情按钮
新增查看详情接口和保存详情接口
新增点击详情的时候查询数据库中已有的物料信息接口
dev
liuxiaoxu 6 months ago
parent
commit
1ad99b2a5a
  1. 38
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingCheckoutController.java
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingCheckoutMapper.java
  3. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingCheckoutMaterialMapper.java
  4. 17
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingCheckoutService.java
  5. 39
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java
  6. 9
      ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingCheckoutMapper.xml
  7. 8
      ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingCheckoutMaterialMapper.xml
  8. 249
      ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/detail.html
  9. 13
      ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/manufacturingCheckout.html

38
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingCheckoutController.java

@ -2,6 +2,7 @@ package com.ruoyi.quality.controller;
import java.util.List;
import com.ruoyi.aftersales.domain.AftersalesComplaintNoticeDetail;
import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO;
import com.ruoyi.quality.domain.QualityManufacturingCheckoutMaterial;
import com.ruoyi.quality.domain.QualityManufacturingProcess;
@ -113,18 +114,29 @@ public class QualityManufacturingCheckoutController extends BaseController
return toAjax(qualityManufacturingCheckoutService.updateQualityManufacturingCheckout(qualityManufacturingCheckout));
}
/**
* 删除品质管理制程检验
* 品质管理制程检验详情
*/
@RequiresPermissions("quality:manufacturingCheckout:remove")
@Log(title = "品质管理制程检验", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
@GetMapping("/detail/{manufacturingCheckoutCode}")
public String detail(@PathVariable("manufacturingCheckoutCode") String manufacturingCheckoutCode, ModelMap mmap)
{
return toAjax(qualityManufacturingCheckoutService.deleteQualityManufacturingCheckoutByIds(ids));
QualityManufacturingCheckout qualityManufacturingCheckout = qualityManufacturingCheckoutService.selectQualityManufacturingCheckoutByCode(manufacturingCheckoutCode);
mmap.put("qualityManufacturingCheckout", qualityManufacturingCheckout);
return prefix + "/detail";
}
/**
* 修改保存品质管理制程检验
*/
@RequiresPermissions("quality:manufacturingCheckout:detail")
@Log(title = "品质管理制程检验", businessType = BusinessType.UPDATE)
@PostMapping("/detail")
@ResponseBody
public AjaxResult detailSave(QualityManufacturingCheckout qualityManufacturingCheckout)
{
return toAjax(qualityManufacturingCheckoutService.detailQualityManufacturingCheckout(qualityManufacturingCheckout));
}
@ -194,4 +206,16 @@ public class QualityManufacturingCheckoutController extends BaseController
List<QualityManufacturingProcess> list = qualityManufacturingCheckoutService.selectAllProcess();
return getDataTable(list);
}
/**
* 点击详情的时候查询数据库中已有的物料信息
* */
@ResponseBody
@PostMapping("/getMaterialListByCode")
public TableDataInfo getMaterialListByCode(QualityManufacturingCheckout qualityManufacturingCheckout){
startPage();
List<CheckoutMaterialVO> list = qualityManufacturingCheckoutService.selectMaterialListByCode(qualityManufacturingCheckout.getManufacturingCheckoutCode());
return getDataTable(list);
}
}

6
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingCheckoutMapper.java

@ -80,4 +80,10 @@ public interface QualityManufacturingCheckoutMapper
* 查询数据库中当前最大的编号
* */
public String findMaxRoundCode(@Param("prefix") String prefix);
/*
* 根据制程检验单号查找制程检验
* */
QualityManufacturingCheckout selectQualityManufacturingCheckoutByCode(String manufacturingCheckoutCode);
}

8
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingCheckoutMaterialMapper.java

@ -1,6 +1,8 @@
package com.ruoyi.quality.mapper;
import java.util.List;
import com.ruoyi.quality.domain.QualityManufacturingCheckout;
import com.ruoyi.quality.domain.QualityManufacturingCheckoutMaterial;
/**
@ -74,4 +76,10 @@ public interface QualityManufacturingCheckoutMaterialMapper
* @return 结果
*/
public int restoreQualityManufacturingCheckoutMaterialById(Long manufacturingCheckoutMaterialId);
/*
* 根据制程检验单号查找制程检验物料
* */
List<QualityManufacturingCheckoutMaterial> selectCheckoutMaterialByCode(String manufacturingCheckoutCode);
}

17
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingCheckoutService.java

@ -91,4 +91,21 @@ public interface IQualityManufacturingCheckoutService
* 查找制程工序列表
* */
QualityManufacturingCheckoutMaterial selectManufacturingCheckoutMaterial(String materialNo, String makeNo);
/*
* 根据制程检验单号查找制程检验
* */
QualityManufacturingCheckout selectQualityManufacturingCheckoutByCode(String manufacturingCheckoutCode);
/*
* 根据制程检验单号查找制程检验物料
* */
List<CheckoutMaterialVO> selectMaterialListByCode(String manufacturingCheckoutCode);
/*
* 制程检验详情
* */
int detailQualityManufacturingCheckout(QualityManufacturingCheckout qualityManufacturingCheckout);
}

39
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java

@ -115,6 +115,7 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
qualityManufacturingCheckoutMaterial.setManufacturingCheckoutCode(newCode);
qualityManufacturingCheckoutMaterial.setCreateBy(loginName);
qualityManufacturingCheckoutMaterial.setCreateTime(new Date());
qualityManufacturingCheckoutMaterial.setCheckoutTime(qualityManufacturingCheckout.getCheckoutTime());
checkoutMaterialMapper.insertQualityManufacturingCheckoutMaterial(qualityManufacturingCheckoutMaterial);
}
@ -280,4 +281,42 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
return checkoutMaterial;
}
/*
* 根据制程检验单号查找制程检验
* */
@Override
public QualityManufacturingCheckout selectQualityManufacturingCheckoutByCode(String manufacturingCheckoutCode) {
QualityManufacturingCheckout qualityManufacturingCheckout = qualityManufacturingCheckoutMapper.selectQualityManufacturingCheckoutByCode(manufacturingCheckoutCode);
return qualityManufacturingCheckout;
}
@Override
public List<CheckoutMaterialVO> selectMaterialListByCode(String manufacturingCheckoutCode) {
ArrayList<CheckoutMaterialVO> checkoutMaterialVOS = new ArrayList<>();
List<QualityManufacturingCheckoutMaterial> checkoutMaterials = checkoutMaterialMapper.selectCheckoutMaterialByCode(manufacturingCheckoutCode);
if (StringUtils.isEmpty(checkoutMaterials)){
// 记录日志
log.warn("未查找到与制程检验单号关联的物料相关数据, 制程检验单号: {}", manufacturingCheckoutCode);
}
for (QualityManufacturingCheckoutMaterial checkoutMaterial : checkoutMaterials) {
CheckoutMaterialVO checkoutMaterialVO = new CheckoutMaterialVO();
checkoutMaterialVO.setMaterialNo(checkoutMaterial.getMaterialNo());
checkoutMaterialVO.setMaterialBrand(checkoutMaterial.getMaterialBrand());
checkoutMaterialVO.setMaterialDescribe(checkoutMaterial.getMaterialDescribe());
checkoutMaterialVO.setMaterialName(checkoutMaterial.getMaterialName());
checkoutMaterialVO.setMaterialProcessMethod(checkoutMaterial.getMaterialProcessMethod());
checkoutMaterialVO.setMaterialPhotourl(checkoutMaterial.getMaterialPhotourl());
checkoutMaterialVO.setMaterialUnit(checkoutMaterial.getMaterialUnit());
checkoutMaterialVO.setMaterialType(checkoutMaterial.getMaterialType());
checkoutMaterialVOS.add(checkoutMaterialVO);
}
return checkoutMaterialVOS;
}
@Override
public int detailQualityManufacturingCheckout(QualityManufacturingCheckout qualityManufacturingCheckout) {
return 1;
}
}

9
ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingCheckoutMapper.xml

@ -44,7 +44,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQualityManufacturingCheckoutVo"/>
where manufacturing_checkout_id = #{manufacturingCheckoutId}
</select>
<select id="selectQualityManufacturingCheckoutByCode" parameterType="String" resultMap="QualityManufacturingCheckoutResult">
<include refid="selectQualityManufacturingCheckoutVo"/>
where manufacturing_checkout_code = #{manufacturingCheckoutCode}
</select>
<insert id="insertQualityManufacturingCheckout" parameterType="QualityManufacturingCheckout" useGeneratedKeys="true" keyProperty="manufacturingCheckoutId">
insert into quality_manufacturing_checkout
<trim prefix="(" suffix=")" suffixOverrides=",">

8
ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingCheckoutMaterialMapper.xml

@ -46,7 +46,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQualityManufacturingCheckoutMaterialVo"/>
where manufacturing_checkout_material_id = #{manufacturingCheckoutMaterialId}
</select>
<select id="selectCheckoutMaterialByCode" parameterType="String" resultMap="QualityManufacturingCheckoutMaterialResult">
<include refid="selectQualityManufacturingCheckoutMaterialVo"/>
where manufacturing_checkout_code = #{manufacturingCheckoutCode}
</select>
<insert id="insertQualityManufacturingCheckoutMaterial" parameterType="QualityManufacturingCheckoutMaterial" useGeneratedKeys="true" keyProperty="manufacturingCheckoutMaterialId">
insert into quality_manufacturing_checkout_material
<trim prefix="(" suffix=")" suffixOverrides=",">

249
ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/detail.html

@ -0,0 +1,249 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改品质管理制程检验')" />
<th:block th:include="include:: select2-css" />
<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 m" id="form-manufacturingCheckout-edit" th:object="${qualityManufacturingCheckout}">
<input name="manufacturingCheckoutCode" th:field="*{manufacturingCheckoutCode}" type="hidden">
<div class="form-group">
<label class="col-sm-4 control-label">生产单号:</label>
<div class="col-sm-8">
<select class="form-control" id="makeNo" name="makeNo" th:field="*{makeNo}" disabled>
<!-- 这里动态生成生产单号选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">检验时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="checkoutTime" th:value="${#dates.format(qualityManufacturingCheckout.checkoutTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</form>
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include:: select2-js" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var qualityManufacturingCheckout = [[${qualityManufacturingCheckout}]];
var makeNo = [[${qualityManufacturingCheckout.makeNo}]];
var prefix = ctx + "quality/manufacturingCheckout";
$("#form-manufacturingCheckout-edit").validate({focusCleanup: true });
//物料信息展示列表
$(function() {
var options = {
url: ctx + "quality/manufacturingCheckout/getMaterialListByCode",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
queryParams: queryParams,
modalName: "选择物料",
columns: [{
checkbox: true
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '品牌',
field: 'materialBrand',
},
{
title: '单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
},
{
title: '订单数',
field: 'makeTotal',
},
{
title: '已检验数',
field: 'checkedNum',
},
{
title: '本次检验数',
field: 'currentCheckoutNum',
editable: {
type:'text'
}
},
{
title: '制程检验报告',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="checkoutReport(\'' + row.materialNo + '\')"><i class="fa fa-plus"></i>检验报告</a> ');
return actions.join('');
}
},
{
title: '工序合格数',
field: 'processQualifiedNum',
},
{
title: '工序不合格数',
field: 'processUnqualifiedNum',
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
loadAllMakeNos();
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
manufacturingCheckoutCode: qualityManufacturingCheckout.manufacturingCheckoutCode
};
return curParams;
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/detail", $('#form-manufacturingCheckout-edit').serialize());
}
}
$("input[name='checkoutTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
/*加载所有的关联生产单号*/
function loadAllMakeNos(){
var url = ctx + 'system/makeorder/getAllMakeNos';
$.ajax({
type:'GET',//请求类型
url:url,//后端接口url
dataType:'json', //预期服务器返回数据类型
success: function (data){
if (data && Array.isArray(data)){
var selectElement = $("#form-manufacturingCheckout-edit select[name='makeNo']"); //获取生产编号下拉框元素
//清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)
selectElement.append('<option value="">请选择关联生产单号</option>');
//遍历返回的数据,添加下拉框的选项
$.each(data,function (index,item){
//赋值遍历数据中的makeNo到下拉框中
selectElement.append('<option value="'+item.makeNo+'">'+item.makeNo+'</option>');
})
$("#makeNo").val(makeNo);
}else {
$.modal.error("数据为空");
}
}
})
}
/*选择物料按钮*/
function insertRow() {
var selectedMakeNo = $("#makeNo").val();
if (!selectedMakeNo) {
$.modal.alertWarning("请先选择生产单号。");
return;
}
var encodedMakeNo = encodeURIComponent(selectedMakeNo);
var url = ctx + 'quality/manufacturingCheckout/materialSelect?makeNo=' + encodedMakeNo;
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialPhotourl:rowData.materialPhotourl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.materialDescribe,
materialBrand: rowData.materialBrand,
materialUnit: rowData.materialUnit,
materialProcessMethod: rowData.materialProcessMethod,
makeTotal:rowData.makeTotal
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
/*检验报告*/
function checkoutReport(materialNo){
var makeNo = $('#makeNo').val(); //获取生产编号下拉框元素
var url = ctx + 'quality/manufacturingCheckout/checkoutReport/' + materialNo+'/'+makeNo;
$.modal.open("制程检验报告",url);
}
</script>
</body>
</html>

13
ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/manufacturingCheckout.html

@ -62,10 +62,8 @@
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('quality:manufacturingCheckout:edit')}]];
var removeFlag = [[${@permission.hasPermi('quality:manufacturingCheckout:remove')}]];
var cancelFlag = [[${@permission.hasPermi('quality:manufacturingCheckout:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('quality:manufacturingCheckout:restore')}]];
var detailFlag = [[${@permission.hasPermi('quality:manufacturingCheckout:detail')}]];
var prefix = ctx + "quality/manufacturingCheckout";
$(function() {
@ -135,13 +133,18 @@
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.manufacturingCheckoutId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.manufacturingCheckoutCode + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function detail(manufacturingCheckoutCode){
var url = ctx +'quality/manufacturingCheckout/detail/'+manufacturingCheckoutCode;
$.modal.open("制程检验详情",url);
}
</script>
</body>
</html>
Loading…
Cancel
Save