Browse Source

[feat]

品质管理 品质单
新增品质单列表页面委外入库单品质、详情按钮;
新增委外加工品质页面、品质详情页面、品质报告页面;
新增品质单委外加工品质controller接口、service方法;
dev
王晓迪 2 months ago
parent
commit
c6698303e3
  1. 55
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
  2. 11
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
  3. 163
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  4. 298
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html
  5. 256
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html
  6. 180
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html
  7. 20
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html

55
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java

@ -302,6 +302,61 @@ public class QualityOrderController extends BaseController
return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport));
}
/**
* 委外加工品质单开始品质
*/
@GetMapping("/makeOutStartingQuality/{qualityOrderId}")
public String makeOStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
{
QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
mmap.put("qualityOrder", qualityOrder);
return prefix + "/makeOutStartingQuality";
}
/**
* 修改保存委外加工品质单开始品质
*/
@RequiresPermissions("quality:qualityOrder:makeInStartingQuality")
@Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
@PostMapping("/makeOutStartingQuality")
@ResponseBody
public AjaxResult makeOutStartingQualitySave(@RequestBody QualityOrder qualityOrder)
{
return toAjax(qualityOrderService.updateMakeOutStartingQuality(qualityOrder));
}
/**
* 委外加工品质单开始品质列表详情接口
*/
@GetMapping("/makeOutStartingQualityDetail/{qualityOrderId}")
public String makeOutStartingQualityDetail(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
{
QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
mmap.put("qualityOrder", qualityOrder);
return prefix + "/makeOutStartingQualityDetail";
}
/**
* 修改委外加工入库单品质报告按钮
*/
@GetMapping("/makeOutOrderReport")
public String makeOutOrderReport( @RequestParam("materialNo") String materialNo,
@RequestParam("qualityOrderCode") String qualityOrderCode,
ModelMap mmap)
{
QualityOrderReport qualityOrderReport = orderReportService.selectMakeInOrderReportByNoAndCode(materialNo,qualityOrderCode);
mmap.put("qualityOrderReport", qualityOrderReport);
mmap.put("qualityOrderCode",qualityOrderCode);
return prefix + "/makeOutOrderReport";
}
/**
* 修改保存委外加工入库单品质报告按钮
*/
@Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
@PostMapping("/makeOutOrderReport")
@ResponseBody
public AjaxResult makeOutOrderReportSave(@RequestBody QualityOrderReport qualityOrderReport)
{
return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport));
}
/*1111111111*/
/**

11
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java

@ -6,6 +6,7 @@ import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import org.springframework.transaction.annotation.Transactional;
/**
* 品质管理品质单Service接口
@ -82,11 +83,21 @@ public interface IQualityOrderService
* */
void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList);
/*
* 委外入库仓库入库后生成品质单
* */
void insertQualityOrderByOutsourceStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList);
/*
* 修改保存委内加工品质单开始品质
* */
int updateMakeInStartingQuality(QualityOrder qualityOrder);
/*
* 修改保存委外加工品质单开始品质
* */
int updateMakeOutStartingQuality(QualityOrder qualityOrder);
/**
* 查询委内加工品质单开始品质 物料相关信息
*/

163
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java

@ -1,6 +1,5 @@
package com.ruoyi.quality.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -16,7 +15,6 @@ import com.ruoyi.quality.mapper.*;
import com.ruoyi.quality.service.IQualityOrderReportService;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
import com.ruoyi.warehouse.service.IWarehouseStorageOrderService;
@ -255,6 +253,9 @@ public class QualityOrderServiceImpl implements IQualityOrderService
// 根据品质单生成退换货单
@Transactional(rollbackFor = Exception.class)
public int generateBeforeRefundsExchanges(QualityOrder qualityOrder){
if(qualityOrder.getQualityUnqualifiedNum() == 0){
return 0;
}
QualityRefundsExchanges refundsExchanges = new QualityRefundsExchanges();
refundsExchanges.setRefundsExchangesCode(redisCache.generateBillNo("THH"));
refundsExchanges.setRelatedOrderCode(qualityOrder.getQualityOrderCode());
@ -526,6 +527,45 @@ public class QualityOrderServiceImpl implements IQualityOrderService
}
/*
* 委外入库仓库暂收生成品质单
* */
@Override
public void insertQualityOrderByOutsourceStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList) {
QualityOrder qualityOrder = new QualityOrder();
qualityOrder.setCreateTime(DateUtils.getNowDate());
qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy());
//使用redis自动生成品质单号
String qualityOrderCode = redisCache.generateBillNo("PZ");
qualityOrder.setQualityOrderCode(qualityOrderCode);
qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
qualityOrder.setQualityStatus("0");
qualityOrder.setQualityOrderType("2");
qualityOrder.setQualityStorageStatus("2");
// 计算本次到货数合计
int totalReceivedQuantity = storageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getActualArriveNum)
.sum();
qualityOrder.setThisArrivedNum(totalReceivedQuantity);
qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode());
qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName());
qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime());
qualityOrder.setCreateBy(ShiroUtils.getLoginName());
qualityOrder.setCreateTime(DateUtils.getNowDate());
qualityOrderMapper.insertQualityOrder(qualityOrder);
//新增三个子表的数据
for (WarehouseStorageOrderDetail detail : storageOrderDetailList) {
// 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置
insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode);
insertQualityOrderReportByWarehouseStorageOrder(detail,qualityOrderCode);
insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail);
// ...
}
}
/*
* 修改保存委内加工品质单开始品质
* */
@ -647,6 +687,120 @@ public class QualityOrderServiceImpl implements IQualityOrderService
}
/*
* 修改保存委外加工品质单开始品质
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateMakeOutStartingQuality(QualityOrder qualityOrder) {
String loginName = ShiroUtils.getLoginName();
qualityOrder.setUpdateBy(loginName);
qualityOrder.setUpdateTime(DateUtils.getNowDate());
qualityOrder.setQualityEmployee(loginName);
List<QualityOrderDetail> qualityOrderDetailList = qualityOrder.getQualityOrderDetailList();
if (CollectionUtils.isEmpty(qualityOrderDetailList)){
throw new BusinessException("品质单详情数据为空");
}
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
qualityOrderDetail.setUpdateBy(loginName);
qualityOrderDetail.setUpdateTime(DateUtils.getNowDate());
Long qualityOrderDetailId = qualityOrderDetail.getQualityOrderDetailId();
QualityOrderDetail tempQualityOrderDetail = orderDetailMapper.selectQualityOrderDetailById(qualityOrderDetailId);
Integer qualifiedNum = tempQualityOrderDetail.getQualityQualifiedNum();
Integer unqualifiedNum = tempQualityOrderDetail.getQualityUnqualifiedNum();
if (qualifiedNum == null || unqualifiedNum == null){
throw new BusinessException("请先进行品质报告操作");
}
qualityOrderDetail.setInStorageCode(qualityOrder.getInStorageCode());
//更新品质单详情数据
int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
if (updateQualityOrderDetailResult <= 0){
throw new BusinessException("更新品质单详情数据失败");
}
}
//根据品质单号从数据库查询 用于更新入库单
QualityOrder tempQualityOrder = qualityOrderMapper.selectQualityOrderByCode(qualityOrder.getQualityOrderCode());
String qualityStatus = tempQualityOrder.getQualityStatus();
String qualityStorageStatus = tempQualityOrder.getQualityStorageStatus();
Integer thisArrivedNumSum = 0;
Integer qualityQualifiedNumSum = 0;
Integer qualityUnqualifiedNumSum = 0;
// 检查thisArrivedNum是否含有null值
boolean hasThisArrivedNumNull = qualityOrderDetailList.stream()
.anyMatch(item -> item.getThisArrivedNum() == null);
// 检查qualityQualifiedNum是否含有null值
boolean hasQualityQualifiedNumNull = qualityOrderDetailList.stream()
.anyMatch(item -> item.getQualityQualifiedNum() == null);
// 检查qualityUnqualifiedNum是否含有null值
boolean hasQualityUnqualifiedNumNull = qualityOrderDetailList.stream()
.anyMatch(item -> item.getQualityUnqualifiedNum() == null);
if (hasThisArrivedNumNull) {
throw new BusinessException("存在本次到货数为空,请检查!");
}
if (hasQualityQualifiedNumNull) {
throw new BusinessException("存在品质已合格数为空,请检查!");
}
if (hasQualityUnqualifiedNumNull) {
throw new BusinessException("存在品质不合格数为空,请检查!");
}
// 计算各个字段的总和
thisArrivedNumSum = qualityOrderDetailList.stream()
.mapToInt(QualityOrderDetail::getThisArrivedNum)
.sum();
qualityQualifiedNumSum = qualityOrderDetailList.stream()
.mapToInt(QualityOrderDetail::getQualityQualifiedNum)
.sum();
qualityUnqualifiedNumSum = qualityOrderDetailList.stream()
.mapToInt(QualityOrderDetail::getQualityUnqualifiedNum)
.sum();
//插入主表中本次到货数
qualityOrder.setThisArrivedNum(thisArrivedNumSum);
//插入主表中品质合格数
qualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum);
//插入主表中品质不合格数
qualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum);
// if (thisArrivedNum == qualityQualifiedNum){
//全部品质
qualityOrder.setQualityStatus("2");
tempQualityOrder.setQualityStatus("2");
// }else {
// //部分品质
// qualityOrder.setQualityStatus("1");
// tempQualityOrder.setQualityStatus("1");
// }
//如果品质时修改交检时间
tempQualityOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime());
tempQualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum);
tempQualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum);
tempQualityOrder.setThisArrivedNum(thisArrivedNumSum);
//数据生成到入库单中,后续进行入库操作
int updateStorageOrderResult = warehouseStorageOrderService.updateWarehouseStorageOrderByOutQualityOrder(tempQualityOrder, qualityOrderDetailList);
if (updateStorageOrderResult <= 0){
throw new BusinessException("更新入库单数据失败");
}
int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder);
if (updateResult <= 0){
log.warn("更新品质单失败,未影响任何行");
}
return updateResult;
}
/**
* 查询委内加工品质单开始品质 物料相关信息
*/
@ -686,7 +840,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
String loginName = ShiroUtils.getLoginName();
qualityOrder.setUpdateBy(loginName);
qualityOrder.setUpdateTime(new Date());
qualityOrder.setUpdateTime(DateUtils.getNowDate());
qualityOrder.setQualityEmployee(loginName);
//生成入库单号
String warehouseStorageCode = redisCache.generateBillNo("RK");
@ -868,8 +1022,5 @@ public class QualityOrderServiceImpl implements IQualityOrderService
if (insertResult <= 0){
throw new BusinessException("插入品质单详情失败");
}
}
}

298
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html

@ -0,0 +1,298 @@
<!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 m" id="form-qualityOrderReport-edit" th:object="${qualityOrderReport}">
<input name="qualityOrderReportId" th:field="*{qualityOrderReportId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-6">
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-6">
<input name="materialName" th:field="*{materialName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质已合格数:</label>
<div class="col-sm-6">
<input name="qualityHasqualifiedNum" th:field="*{qualityHasqualifiedNum}" class="form-control" type="text">
</div>
</div>
<div class="container">
<!--合格数-->
<div class="col-sm-12">
<h3>合格数</h3>
<div class="row">
<div class="form-group col-sm-6">
<label class="control-label is-required">ok允收数:</label>
<input name="okAcceptedNum" th:field="*{okAcceptedNum}" class="form-control" type="text" required>
</div>
<div class="form-group col-sm-6">
<label class="control-label">ok报告图片:</label>
<input name="okReportUrl" th:field="*{okReportUrl}" class="form-control" type="text">
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<label class="control-label is-required">特采/让步数:</label>
<input name="specialConcessionsNum" th:field="*{specialConcessionsNum}" class="form-control" type="text" required>
</div>
<div class="form-group col-sm-6">
<label class="control-label">特采报告图片:</label>
<input name="specialReportUrl" th:field="*{specialReportUrl}" class="form-control" type="text">
</div>
</div>
</div>
<!--不合格数-->
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12 d-flex align-items-center">
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;">不合格数</span>
<a class="btn btn-success ml-auto" onclick="addUnqualified()">
<i class="fa fa-plus"></i> 添加
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-unqualified-table"></table>
</div>
</div>
</div>
</div>
<!--其他字段-->
<div class="form-group">
<label class="col-sm-4 control-label">检验完成时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="checkoutCompletionTime" th:value="${#dates.format(qualityOrderReport.checkoutCompletionTime, '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 class="form-group">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" th:field="*{remark}" class="form-control" type="text"></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]];
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]];
var qualityOrderCode = /*[[${qualityOrderCode}]]*/ '';
var $table = $("#bootstrap-unqualified-table");
var prefix = ctx + "quality/qualityOrder";
$("#form-qualityOrderReport-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
// 获取表单数据
const qualityReportData = $("#form-qualityOrderReport-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-unqualified-table').bootstrapTable('getData');
console.log(JSON.stringify(table));
// 将表数据转换成与qualityReportData格式一致的数组
var unqualifiedDataList = table.map(function (item) {
// 根据实际字段名调整
return {
"processBadClassification": item.processBadClassification,
"processBadGrade": item.processBadGrade,
"processBadNum": item.processBadNum,
"unqualifiedReportUrl": item.unqualifiedReportUrl
// ...其他字段
};
});
const combinedData = Object.assign({}, qualityReportData,
{unqualifiedDataList: unqualifiedDataList,
qualityOrderCode: qualityOrderCode // 直接使用全局变量
},
);
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeOutOrderReport", jsonData);
}
}
$("input[name='checkoutCompletionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//添加不合格数
function addUnqualified() {
// 生成一个简单的唯一标识,这里使用时间戳作为示例
var uniqueId = new Date().getTime();
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义
var newRow = {
qualityOrderReportId:uniqueId,
processBadClassification: "",
processBadGrade: "",
processBadNum: "",
unqualifiedReportUrl: ""
};
// 使用Bootstrap Table的API插入新行
$('#bootstrap-unqualified-table').bootstrapTable('append', newRow);
}
//收款凭证table列表
$(function() {
var options = {
id:"bootstrap-unqualified-table",
modalName: "不合格分类",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [
{
title: '品质报告单id',
field: 'qualityOrderReportId',
visible: false
},
{title: '不良分类',field: 'processBadClassification',
formatter:function (value, row, index) {
return processBadClassificationFormatter(value,row,index);
}
},
{title: '不良等级',field: 'processBadGrade',
formatter:function (value, row, index) {
return processBadGradeFormatter(value,row,index);
}
},
{
title: '数量',
field: 'processBadNum',
editable:{
type: 'text',
mode:'inline',
validate: function (v) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum < 0) return '数量必须是正整数';
}
}
},
{
title: '报告',
field: 'unqualifiedReportUrl',
editable: {
mode:'inline',
type: 'text', // 表示该列可以被编辑为文本
},
},
{
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.qualityOrderReportId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
});
// 逻辑删除不合格数前端的一行数据
function removeRow(qualityOrderReportId){
console.log(qualityOrderReportId);
// 直接使用 receivablesRecordsId 值进行删除操作
$("#bootstrap-unqualified-table").bootstrapTable('remove', {
field: 'qualityOrderReportId',
values: qualityOrderReportId
});
}
// 列中获取不良分类的下拉改变数据
function onProcessBadClassification(selectElement, rowIndex) {
var processBadClassificationValue = $(selectElement).val();
var tableData = $table.bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 重新渲染成本小类的设备名称列
// 更新行数据
newRow.processBadClassification = processBadClassificationValue;
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
// 自定义不良分类的格式化函数
function processBadClassificationFormatter(value, row, index) {
var selectHtml = '<select class="form-control" onchange="onProcessBadClassification(this, ' + index + ')">';
// 添加默认选项
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadClassificationDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取不良等级的下拉改变数据
function onProcessBadGrade(selectElement, rowIndex) {
var processBadGradeValue = $(selectElement).val();
var tableData = $table.bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 重新渲染成本小类的设备名称列
// 更新行数据
newRow.processBadGrade = processBadGradeValue;
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
// 自定义不良等级的格式化函数
function processBadGradeFormatter(value, row, index) {
var selectHtml = '<select class="form-control" onchange="onProcessBadGrade(this, ' + index + ')">';
// 添加默认选项
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadGradeDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
</script>
</body>
</html>

256
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html

@ -0,0 +1,256 @@
<!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 m" id="form-makeInStartingQuality-edit" th:object="${qualityOrder}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">品质单号:</label>
<div class="col-sm-8">
<input name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<input name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label>
<div class="col-sm-8">
<select name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质单入库类型:</label>
<div class="col-sm-8">
<select name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option>
</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="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, '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>
</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 :: datetimepicker-js" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]
var qualityOrder = [[${qualityOrder}]]
var prefix = ctx + "quality/qualityOrder";
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
$("#form-makeInStartingQuality-edit").validate({
focusCleanup: true
});
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const qualityOrderData = $("#form-makeInStartingQuality-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"qualityOrderDetailId": item.qualityOrderDetailId,
"materialNo": item.materialNo,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand,
"materialUnit": item.materialUnit,
"materialProcessMethod": item.materialProcessMethod,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum,
"makeInNum":item.makeInNum,
"makeInUnitPrice": item.makeInUnitPrice,
"materialDeptType": item.materialDeptType,
// ...其他字段
};
});
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeOutStartingQuality", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '品质单详情ID',
field: 'qualityOrderDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo'
},
{
title: '物料名称',
field: 'materialName'
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
editable:{
type:'text',
validate: function (v) {
if (!v) return '本次到货数不能为空';
}
},
required:true
},
{
title: '品质报告',
align: 'center',
formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="makeInOrderReport(\'' + row.materialNo + '\')"><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
{
title: '品质合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
},
{
title: '物料入库部门',
field: 'materialDeptType',
visible: false
}
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
qualityOrderCode: qualityOrderCode
};
console.log(curParams);
return curParams;
}
function makeInOrderReport(materialNo) {
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]];
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode));
var url = ctx + 'quality/qualityOrder/makeOutOrderReport?' + queryParams.toString();
$.modal.open("品质报告", url);
}
</script>
</body>
</html>

180
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html

@ -0,0 +1,180 @@
<!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 m" id="form-makeInStartingQualityDetail-edit" th:object="${qualityOrder}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">品质单号:</label>
<div class="col-sm-8">
<input name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<input name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label>
<div class="col-sm-8">
<select name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品质单入库类型:</label>
<div class="col-sm-8">
<select name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option>
</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="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, '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 :: datetimepicker-js" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]
var qualityOrder = [[${qualityOrder}]]
var prefix = ctx + "quality/qualityOrder";
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
$("#form-makeInStartingQualityDetail-edit").validate({
focusCleanup: true
});
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '品质单详情ID',
field: 'qualityOrderDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo'
},
{
title: '物料名称',
field: 'materialName'
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
},
{
title: '品质合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
}]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
qualityOrderCode: qualityOrderCode
};
console.log(curParams);
return curParams;
}
</script>
</body>
</html>

20
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html

@ -188,6 +188,14 @@
if (row.qualityStorageStatus == 4 ){
actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
//委外入库品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 2 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityFlag + '" href="javascript:void(0)" onclick="makeOutStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//委外入库品质详情
if (row.qualityStorageStatus == 2 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeOutStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
return actions.join('');
}
}]
@ -220,6 +228,18 @@
$.modal.open("进行品质详情",url)
}
//委内加工单品质
function makeOutStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOutStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url)
}
//委内加工单品质详情
function makeOutStartingQualityDetail(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOutStartingQualityDetail/' + qualityOrderId;
$.modal.open("品质详情",url)
}
//生产入库品质
function makeStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeStartingQuality/' + qualityOrderId;

Loading…
Cancel
Save