Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 6 months ago
parent
commit
a552104cb3
  1. 23
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java
  3. 42
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java
  4. 21
      ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html
  5. 9
      ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html
  6. 426
      ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspectionProcessing.html

23
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java

@ -126,7 +126,7 @@ public class QualityReturnInspectionController extends BaseController
}
/**
* 修改保存退检管理单
* 修改保存退检管理单详情
*/
@RequiresPermissions("quality:returnInspection:detail")
@Log(title = "物料退检单", businessType = BusinessType.UPDATE)
@ -137,6 +137,27 @@ public class QualityReturnInspectionController extends BaseController
return toAjax(qualityReturnInspectionService.detailQualityReturnInspection(erpMaterialReturnInspection));
}
/**
* 修改物料退检单
*/
@GetMapping("/processing/{id}")
public String processing(@PathVariable("id") Long id, ModelMap mmap)
{
ErpMaterialReturnInspection erpMaterialReturnInspection = qualityReturnInspectionService.selectQualityReturnInspectionById(id);
mmap.put("erpMaterialReturnInspection", erpMaterialReturnInspection);
return prefix + "/returnInspectionProcessing";
}
/**
* 修改保存物料退检单
*/
@RequiresPermissions("quality:returnInspection:processing")
@Log(title = "物料退检单", businessType = BusinessType.UPDATE)
@PostMapping("/processing")
@ResponseBody
public AjaxResult processingSave(ErpMaterialReturnInspection erpMaterialReturnInspection)
{
return toAjax(qualityReturnInspectionService.processingQualityReturnInspection(erpMaterialReturnInspection));
}
}

5
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java

@ -55,4 +55,9 @@ public interface IQualityReturnInspectionService
* 退检管理详情
* */
int detailQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection);
/*
* 退检处理
* */
int processingQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection);
}

42
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java

@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
@ -145,4 +146,45 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect
public int detailQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection) {
return 1;
}
/*
* 退检处理
* */
@Override
public int processingQualityReturnInspection(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());
if (erpMaterialReturnInspection.getIsClosed().equals("1")){
throw new BusinessException("已经结案,不可以再上传复检");
}
int updateFlag = erpMaterialReturnInspectionMapper.updateErpMaterialReturnInspection(erpMaterialReturnInspection);
return updateFlag;
}
}

21
ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html

@ -90,6 +90,7 @@
<script th:inline="javascript">
var prefix = ctx + "quality/returnInspection";
var abnormalCauseDatas = [[${@dict.getType('return_inspection_abnormal_cause')}]];
var urgencyLevelDatas = [[${@dict.getType('urgency_level')}]];
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
@ -194,7 +195,25 @@
field: 'returnInspectionRemark',
align: 'center',
title: '退检备注'
}
},
{
field: 'abnormalCause',
align: 'center',
title: '异常原因',
formatter: function(value, row, index) {
return $.table.selectDictLabel(abnormalCauseDatas, value);
}
},
{
field: 'dutyUnit',
align: 'center',
title: '责任单位',
},
{
field: 'recheckRemark',
align: 'center',
title: '复检备注',
},
]
};
$.table.init(options);

9
ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html

@ -64,7 +64,7 @@
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('erp:materialReturnInspection:edit')}]];
var processingFlag = [[${@permission.hasPermi('erp:materialReturnInspection:edit')}]];
var detailFlag = [[${@permission.hasPermi('quality:returnInspection:detail')}]];
// 字典
var urgencyLevelDatas = [[${@dict.getType('urgency_level')}]];
@ -117,7 +117,7 @@
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> ');
actions.push('<a class="btn btn-success btn-xs ' + processingFlag + '" href="javascript:void(0)" onclick="processing(\'' + row.id + '\')"><i class="fa fa-edit"></i>退检处理</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
@ -132,6 +132,11 @@
$.modal.open("退检详情",url);
}
/*退检处理*/
function processing(id){
var url = ctx + 'quality/returnInspection/processing/'+id;
$.modal.open("退检处理",url);
}
</script>
</body>
</html>

426
ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspectionProcessing.html

@ -0,0 +1,426 @@
<!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" readonly>
</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')}" readonly disabled>
<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 + "quality/returnInspection";
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;
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+'">';
}
},
{
field: 'abnormalCause',
align: 'center',
title: '异常原因',
formatter: function (value,row,index){
var curIndex = index;
var data = [{ index: curIndex, type: value }];
return $("#abnormalCauseTpl").tmpl(data).html();
}
},
{
field: 'dutyUnit',
align: 'center',
title: '责任单位',
formatter: function (value,row,index){
var curIndex = index;
return '<input class = "form-control" data-id = "dutyUnit_'+curIndex+'" name="inspectionDetails['+curIndex+'].dutyUnit" value="'+value+'">';
}
},
{
field: 'recheckRemark',
align: 'center',
title: '复检备注',
formatter: function (value,row,index){
var curIndex = index;
return '<input class = "form-control" data-id = "recheckRemark_'+curIndex+'" name="inspectionDetails['+curIndex+'].recheckRemark" 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: '',
abnormalCause:'',
dutyUnit:'',
recheckRemark:''
}
})
layer.close(index);
}
$("#form-materialReturnInspection-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/processing", $('#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>
<script id="abnormalCauseTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='inspectionDetails[${index}].abnormalCause'>
<option value="">所有</option>
<option value="0" {{if type==="0"}}selected{{/if}}>漏检</option>
<option value="1" {{if type==="1"}}selected{{/if}}>图纸实物</option>
<option value="2" {{if type==="2"}}selected{{/if}}>未检验</option>
</select>
</div>
</script>
Loading…
Cancel
Save