Browse Source

[fix] 生产管理 品质管理 仓库管理

修改生产订单的委内加工入库的前端页面 损耗率字段
委内加工入库对象 新增 销售订单物料号字段
修改委内加工入库的新增方法:由委内加工入库->入库流程改成(委内加工入库->品质->入库流程);
新增 委内加工品质单报告数据后端接口
新增 添加委内加工品质单详情数据后端接口
新增 委内入库品质单报告前端页面
新增 委内入库品质单品质前端页面
品质单前端页面 修改所有页面的按钮显示的条件
新增 委内入库相关品质页面
品质单 后端新增 委内加工品质单开始品质接口
品质单 后端新增 修改保存委内加工品质单开始品质
品质单 后端新增 委内加工品质单开始品质  物料相关信息
品质单 后端新增 修改委内加工入库单品质报告按钮
品质单 后端新增 修改保存委内加工入库单品质报告按钮
品质单详情新增 委内已完成数字段
品质单详情新增 根据物料号和品质单号查询品质管理品质单详情后端接口
品质单详情新增 查询委内加工品质单开始品质  物料相关信息后端接口
品质单报告新增 委内已完成数字段
品质单报告 新增 通过品质单报告Id修改品质管理品质单报告后端接口
品质单报告 新增 查询委内加工入库单品质报告
品质单不合格数 新增 品质单报告Id字段
品质单不合格数 新增 根据品质单报告id查询品质单报告不合格分类 后端接口
入库单新增 通过委内加工入库单品质后生成入库单后端接口
dev
liuxiaoxu 4 months ago
parent
commit
e5ff5cfa2f
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpInboundOrder.java
  2. 164
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java
  3. 70
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
  4. 14
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
  5. 13
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java
  6. 15
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java
  7. 12
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java
  8. 3
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java
  9. 21
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java
  10. 5
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportUnqualifiedMapper.java
  11. 10
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java
  12. 12
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
  13. 103
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java
  14. 132
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  15. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  16. 45
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  17. 17
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
  18. 46
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml
  19. 11
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml
  20. 315
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeInOrderReport.html
  21. 237
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeInStartingQuality.html
  22. 18
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html
  23. 2
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/startingQuality.html
  24. 24
      ruoyi-admin/src/main/resources/templates/system/makeorder/addProcessInbound.html

12
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpInboundOrder.java

@ -32,6 +32,9 @@ public class ErpInboundOrder extends BaseEntity
@Excel(name = "生产订单号")
private String makeNo;
/** 销售订单物料号 */
private String salesOrderMaterialNo;
/** 品质状态(0待品质、1部分品质、全部品质) */
@Excel(name = "品质状态(0待品质、1部分品质、全部品质)")
private String qualityStatus;
@ -137,6 +140,15 @@ public class ErpInboundOrder extends BaseEntity
{
return makeNo;
}
public String getSalesOrderMaterialNo() {
return salesOrderMaterialNo;
}
public void setSalesOrderMaterialNo(String salesOrderMaterialNo) {
this.salesOrderMaterialNo = salesOrderMaterialNo;
}
public void setQualityStatus(String qualityStatus)
{
this.qualityStatus = qualityStatus;

164
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java

@ -1,12 +1,15 @@
package com.ruoyi.erp.service.impl;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
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.common.utils.StringUtils;
@ -14,7 +17,20 @@ import com.ruoyi.erp.domain.ErpEquipmentResume;
import com.ruoyi.erp.domain.ErpInboundOrderDetail;
import com.ruoyi.erp.service.IErpEquipmentResumeService;
import com.ruoyi.erp.service.IErpInboundOrderDetailService;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityOrderReportUnqualified;
import com.ruoyi.quality.mapper.QualityOrderDetailMapper;
import com.ruoyi.quality.mapper.QualityOrderMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysMakeorderPickDetail;
import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.erp.mapper.ErpInboundOrderMapper;
@ -22,6 +38,7 @@ import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.erp.service.IErpInboundOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 入库单Service业务层处理
@ -44,6 +61,24 @@ public class ErpInboundOrderServiceImpl implements IErpInboundOrderService
@Autowired
private IErpEquipmentResumeService erpEquipmentResumeService;
@Autowired
private QualityOrderMapper qualityOrderMapper;
@Autowired
private QualityOrderDetailMapper qualityOrderDetailMapper;
@Autowired
private QualityOrderReportMapper qualityOrderReportMapper;
@Autowired
private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper;
@Autowired
private SysSalesOrderChildMapper salesOrderChildMapper;
@Autowired
private SysMakeorderBomMapper makeorderBomMapper;
/**
* 查询入库单
*
@ -69,44 +104,129 @@ public class ErpInboundOrderServiceImpl implements IErpInboundOrderService
}
/**
* 新增入库单
* 生产订单新增委内加工入库单先品质
*
* @param erpInboundOrder 入库单
* @param erpInboundOrder 委内加工入库单
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertErpInboundOrder(ErpInboundOrder erpInboundOrder)
{
QualityOrder qualityOrder = new QualityOrder();
String loginName = ShiroUtils.getLoginName();
erpInboundOrder.setCreateBy(loginName);
erpInboundOrder.setCreateTime(DateUtils.getNowDate());
// 生成编号,年月日规则
String billNo = redisCache.generateBillNo("RK");
erpInboundOrder.setInboundOrderNo(billNo);
int id = erpInboundOrderMapper.insertErpInboundOrder(erpInboundOrder);
String qualityOrderCode = redisCache.generateBillNo("PZ");
qualityOrder.setQualityOrderCode(qualityOrderCode);
//设置关联单号
qualityOrder.setRelatedOrderCode(erpInboundOrder.getMakeNo());
//设置为待品质
qualityOrder.setQualityStatus("0");
//设置为委内入库
qualityOrder.setQualityStorageStatus("1");
//设置订单类型
qualityOrder.setQualityOrderType("1");
qualityOrder.setCreateTime(new Date());
qualityOrder.setCreateBy(loginName);
List<SysMakeorderBom> sysMakeorderBoms = erpInboundOrder.getInboundDetails().stream()
.map(ErpInboundOrderDetail::getMakeorderBomId)
.map(this::getSysMakeorderBomById)
.collect(Collectors.toList());
//添加委内加工品质单详情数据
addQualityOrderDetail(erpInboundOrder,qualityOrderCode,sysMakeorderBoms);
//添加委内加工品质单报告数据
addQualityOrderReport(erpInboundOrder,qualityOrderCode,sysMakeorderBoms);
//插入品质单
return qualityOrderMapper.insertQualityOrder(qualityOrder);
}
// 提取公共方法
private SysMakeorderBom getSysMakeorderBomById(Long makeorderBomId) {
return makeorderBomMapper.selectSysMakeorderBomById(makeorderBomId);
}
//添加委内加工品质单报告数据
private void addQualityOrderReport(ErpInboundOrder erpInboundOrder,String qualityOrderCode,List<SysMakeorderBom> sysMakeorderBoms) {
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails();
if(CollectionUtil.isNotEmpty(inboundDetails)){
// 插入子表
for (int i = 0; i < inboundDetails.size(); i++) {
ErpInboundOrderDetail inboundOrderDetail = inboundDetails.get(i);
inboundOrderDetail.setInboundOrderNo(billNo);
inboundOrderDetailService.insertErpInboundOrderDetail(inboundOrderDetail);
String equipResumeArrayStr = inboundOrderDetail.getEquipResumeArrayStr();
if(StringUtils.isNotBlank(equipResumeArrayStr)){
List<ErpEquipmentResume> equipmentResumes = JSON.parseObject(equipResumeArrayStr, new TypeReference<List<ErpEquipmentResume>>(){});
equipmentResumes.forEach(t->{
t.setInboundOrderNo(billNo);
t.setMakeNo(erpInboundOrder.getMakeNo());
t.setSaleNo(erpInboundOrder.getSaleNo());
t.setMaterialNo(inboundOrderDetail.getMaterialNo());
erpEquipmentResumeService.insertErpEquipmentResume(t);
});
if (CollectionUtils.isEmpty(inboundDetails)) {
throw new BusinessException("委内加工详情数据为空");
}
for (int i = 0; i < inboundDetails.size(); i++) {
ErpInboundOrderDetail inboundDetail = inboundDetails.get(i);
SysMakeorderBom sysMakeorderBom = sysMakeorderBoms.get(i);
QualityOrderReport qualityOrderReport = new QualityOrderReport();
qualityOrderReport.setQualityOrderCode(qualityOrderCode);
qualityOrderReport.setMaterialNo(sysMakeorderBom.getMaterialNo());
QualityOrderReport tempQualityOrderReport = qualityOrderReportMapper.selectMakeInOrderReportByNoAndCode(qualityOrderReport);
if (tempQualityOrderReport != null){
qualityOrderReport.setQualityOrderReportId(tempQualityOrderReport.getQualityOrderReportId());
Long currentNum = inboundDetail.getCurrentNum();
qualityOrderReport.setMakeInNum((int) (tempQualityOrderReport.getMakeInNum()+currentNum));
int updateQualityOrderReportResult = qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReport);
if (updateQualityOrderReportResult <= 0){
throw new BusinessException("更新品质单报告数据失败");
}
}else {
qualityOrderReport.setMaterialName(sysMakeorderBom.getMaterialName());
//添加委内已完成数
qualityOrderReport.setMakeInNum(Math.toIntExact(inboundDetail.getCurrentNum()));
qualityOrderReport.setCreateBy(ShiroUtils.getLoginName());
qualityOrderReport.setCreateTime(new Date());
qualityOrderReportMapper.insertQualityOrderReport(qualityOrderReport);
}
}
}
return id;
//添加委内加工品质单详情数据
private void addQualityOrderDetail(ErpInboundOrder erpInboundOrder,String qualityOrderCode,List<SysMakeorderBom> sysMakeorderBoms) {
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails();
if (CollectionUtils.isEmpty(inboundDetails)) {
throw new BusinessException("委内加工详情数据为空");
}
for (int i = 0; i < inboundDetails.size(); i++) {
ErpInboundOrderDetail inboundDetail = inboundDetails.get(i);
SysMakeorderBom sysMakeorderBom = sysMakeorderBoms.get(i);
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
qualityOrderDetail.setMaterialNo(sysMakeorderBom.getMaterialNo());
qualityOrderDetail.setQualityOrderCode(qualityOrderCode);
QualityOrderDetail tempQualityOrderDetail = qualityOrderDetailMapper.selectMakeInOrderDetailByCodeAndNo(qualityOrderDetail);
if (tempQualityOrderDetail != null){
qualityOrderDetail.setQualityOrderDetailId(tempQualityOrderDetail.getQualityOrderDetailId());
Long currentNum = inboundDetail.getCurrentNum();
qualityOrderDetail.setMakeInNum((int) (tempQualityOrderDetail.getMakeInNum()+currentNum));
int updateQualityOrderDetailResult = qualityOrderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
if (updateQualityOrderDetailResult <= 0){
throw new BusinessException("更新品质单详情数据失败");
}
}else {
qualityOrderDetail.setRelatedOrderCode(erpInboundOrder.getMakeNo());
qualityOrderDetail.setMaterialName(sysMakeorderBom.getMaterialName());
qualityOrderDetail.setMaterialBrand(sysMakeorderBom.getBrand());
qualityOrderDetail.setMaterialDescribe(sysMakeorderBom.getDescribe());
qualityOrderDetail.setMaterialProcessMethod(sysMakeorderBom.getProcessMethod());
qualityOrderDetail.setMaterialDeptType(sysMakeorderBom.getMaterialType());
qualityOrderDetail.setMaterialPhotourl(sysMakeorderBom.getPhotoUrl());
qualityOrderDetail.setMaterialUnit(sysMakeorderBom.getUnit());
qualityOrderDetail.setMaterialType(sysMakeorderBom.getMaterialType());
//添加委内已完成数
qualityOrderDetail.setMakeInNum(Math.toIntExact(inboundDetail.getCurrentNum()));
qualityOrderDetail.setCreateBy(ShiroUtils.getLoginName());
qualityOrderDetail.setCreateTime(new Date());
qualityOrderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
}
}
}
/**

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

@ -8,6 +8,8 @@ import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.service.IQualityOrderDetailService;
import com.ruoyi.quality.service.IQualityOrderReportService;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -208,8 +210,74 @@ public class QualityOrderController extends BaseController
@Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
@PostMapping("/qualityReport")
@ResponseBody
public AjaxResult orderReportSave(@RequestBody QualityOrderReport qualityOrderReport)
public AjaxResult qualityReportSave(@RequestBody QualityOrderReport qualityOrderReport)
{
return toAjax(orderReportService.updateQualityOrderReport(qualityOrderReport));
}
/**
* 委内加工品质单开始品质
*/
@GetMapping("/makeInStartingQuality/{qualityOrderId}")
public String makeInStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
{
QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
mmap.put("qualityOrder", qualityOrder);
return prefix + "/makeInStartingQuality";
}
/**
* 修改保存委内加工品质单开始品质
*/
@RequiresPermissions("quality:qualityOrder:makeInStartingQuality")
@Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
@PostMapping("/makeInStartingQuality")
@ResponseBody
public AjaxResult makeInStartingQualitySave(@RequestBody QualityOrder qualityOrder)
{
return toAjax(qualityOrderService.updateMakeInStartingQuality(qualityOrder));
}
/**
* 委内加工品质单开始品质 物料相关信息
*/
@PostMapping("/getMaterialListByQualityOrderCode")
@ResponseBody
public TableDataInfo getMaterialListByOutOrderCode(QualityOrder qualityOrder)
{
startPage();
List<QualityOrderDetail> list = qualityOrderService.getMaterialListByQualityOrderCode(qualityOrder);
return getDataTable(list);
}
/**
* 修改委内加工入库单品质报告按钮
*/
@GetMapping("/makeInOrderReport")
public String makeInOrderReport( @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 + "/makeInOrderReport";
}
/**
* 修改保存委内加工入库单品质报告按钮
*/
@RequiresPermissions("quality:qualityOrder:makeInOrderReport")
@Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
@PostMapping("/makeInOrderReport")
@ResponseBody
public AjaxResult makeInOrderReportSave(@RequestBody QualityOrderReport qualityOrderReport)
{
return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport));
}
}

14
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java

@ -137,6 +137,11 @@ public class QualityOrderDetail extends BaseEntity
@Excel(name = "品质不合格数")
private Integer qualityUnqualifiedNum;
/** 委内已完成数 */
@Excel(name = "委内已完成数")
private Integer makeInNum;
public void setQualityOrderDetailId(Long qualityOrderDetailId)
{
this.qualityOrderDetailId = qualityOrderDetailId;
@ -392,6 +397,14 @@ public class QualityOrderDetail extends BaseEntity
this.qualityUnqualifiedNum = qualityUnqualifiedNum;
}
public Integer getMakeInNum() {
return makeInNum;
}
public void setMakeInNum(Integer makeInNum) {
this.makeInNum = makeInNum;
}
public String getMaterialDeptType() {
return materialDeptType;
}
@ -433,6 +446,7 @@ public class QualityOrderDetail extends BaseEntity
.append("qualityHasqualifiedNum", getQualityHasqualifiedNum())
.append("qualityQualifiedNum", getQualityQualifiedNum())
.append("qualityUnqualifiedNum", getQualityUnqualifiedNum())
.append("makeInNum",getMakeInNum())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())

13
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java

@ -46,6 +46,10 @@ public class QualityOrderReport extends BaseEntity
@Excel(name = "生产订单数")
private Integer makeTotal;
/** 委内已完成数 */
@Excel(name = "委内已完成数")
private Integer makeInNum;
/** 实际到货数量 */
@Excel(name = "实际到货数量")
private Integer actualArriveNum;
@ -159,6 +163,14 @@ public class QualityOrderReport extends BaseEntity
return makeTotal;
}
public Integer getMakeInNum() {
return makeInNum;
}
public void setMakeInNum(Integer makeInNum) {
this.makeInNum = makeInNum;
}
public Integer getActualArriveNum() {
return actualArriveNum;
}
@ -277,6 +289,7 @@ public class QualityOrderReport extends BaseEntity
.append("materialNo", getMaterialNo())
.append("materialName", getMaterialName())
.append("makeTotal", getMakeTotal())
.append("makeInNum",getMakeInNum())
.append("actualArriveNum", getActualArriveNum())
.append("qualityHasqualifiedNum", getQualityHasqualifiedNum())
.append("okAcceptedNum", getOkAcceptedNum())

15
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java

@ -18,6 +18,9 @@ public class QualityOrderReportUnqualified extends BaseEntity
/** 品质单报告不合格数Id */
private Long orderReportUnqualifiedId;
/** 品质单报告Id */
private Long qualityOrderReportId;
/** 供应商Id */
@Excel(name = "供应商Id")
private String supplierCode;
@ -59,7 +62,16 @@ public class QualityOrderReportUnqualified extends BaseEntity
{
return orderReportUnqualifiedId;
}
public void setSupplierCode(String supplierCode)
public Long getQualityOrderReportId() {
return qualityOrderReportId;
}
public void setQualityOrderReportId(Long qualityOrderReportId) {
this.qualityOrderReportId = qualityOrderReportId;
}
public void setSupplierCode(String supplierCode)
{
this.supplierCode = supplierCode;
}
@ -136,6 +148,7 @@ public class QualityOrderReportUnqualified extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("orderReportUnqualifiedId", getOrderReportUnqualifiedId())
.append("qualityOrderReportId", getQualityOrderReportId())
.append("supplierCode", getSupplierCode())
.append("supplierName", getSupplierName())
.append("materialNo", getMaterialNo())

12
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java

@ -93,9 +93,19 @@ public interface QualityOrderDetailMapper
List<QualityOrderDetail> selectQualityOrderDetailListByCode(String qualityOrderCode);
/**
* 根据供应商Id和物料号查询品质管理品质单详情
* 根据供应商Id和物料号以及品质单号查询品质管理品质单详情
*
*/
QualityOrderDetail selectQualityOrderDetailByCodeAndNo(QualityOrderDetail qualityOrderDetail);
/**
* 根据物料号和品质单号查询品质管理品质单详情
*
*/
QualityOrderDetail selectMakeInOrderDetailByCodeAndNo(QualityOrderDetail tempQualityOrderDetail);
/**
* 查询委内加工品质单开始品质 物料相关信息
*/
List<QualityOrderDetail> selectMakeInOrderDetailListByCode(String qualityOrderCode);
}

3
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java

@ -2,6 +2,8 @@ package com.ruoyi.quality.mapper;
import java.util.List;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
/**
* 品质管理品质单Mapper接口
@ -82,4 +84,5 @@ public interface QualityOrderMapper
* @return 品质管理品质单
*/
public QualityOrder selectQualityOrderByCode(String qualityOrderCode);
}

21
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java

@ -36,13 +36,24 @@ public interface QualityOrderReportMapper
public int insertQualityOrderReport(QualityOrderReport qualityOrderReport);
/**
* 修改品质管理品质单报告
* 通过品质单报告物料号和供应商编号修改品质管理品质单报告
*
* @param qualityOrderReport 品质管理品质单报告
* @return 结果
*/
public int updateQualityOrderReport(QualityOrderReport qualityOrderReport);
/**
* 通过品质单报告Id修改品质管理品质单报告
*
* @param qualityOrderReport 品质管理品质单报告
* @return 结果
*/
public int updateQualityOrderReportById(QualityOrderReport qualityOrderReport);
/**
* 删除品质管理品质单报告
*
@ -75,6 +86,12 @@ public interface QualityOrderReportMapper
*/
public int restoreQualityOrderReportById(Long qualityOrderReportId);
/*根据供应商ID和物料号查询品质报告*/
/*根据供应商ID和物料号以及品质单号查询品质报告*/
QualityOrderReport selectQualityOrderReportByNoAndCode(QualityOrderReport qualityOrderReport);
/*
* 查询委内加工入库单品质报告
* */
QualityOrderReport selectMakeInOrderReportByNoAndCode(QualityOrderReport tempQualityOrderReport);
}

5
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportUnqualifiedMapper.java

@ -83,4 +83,9 @@ public interface QualityOrderReportUnqualifiedMapper
* @return 结果
*/
public int restoreQualityOrderReportUnqualifiedById(Long orderReportUnqualifiedId);
/*
* 根据品质单报告id查询品质单报告不合格分类
* */
List<QualityOrderReportUnqualified> selectOrderReportUnqualifiedByOrderReportId(QualityOrderReportUnqualified tempOrderReportUnqualified);
}

10
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java

@ -75,4 +75,14 @@ public interface IQualityOrderReportService
/*根据供应商ID和物料号查询品质报告*/
QualityOrderReport selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode,String qualityOrderCode);
/*
* 查询委内加工入库单品质报告
* */
QualityOrderReport selectMakeInOrderReportByNoAndCode(String materialNo, String qualityOrderCode);
/**
* 修改保存委内加工入库单品质报告按钮
*/
int updateMakeInOrderReport(QualityOrderReport qualityOrderReport);
}

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

@ -2,6 +2,8 @@ package com.ruoyi.quality.service;
import java.util.List;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
@ -79,4 +81,14 @@ public interface IQualityOrderService
*
* */
void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList);
/*
* 修改保存委内加工品质单开始品质
* */
int updateMakeInStartingQuality(QualityOrder qualityOrder);
/**
* 查询委内加工品质单开始品质 物料相关信息
*/
List<QualityOrderDetail> getMaterialListByQualityOrderCode(QualityOrder qualityOrder);
}

103
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java

@ -21,6 +21,7 @@ import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.service.IQualityOrderReportService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 品质管理品质单报告Service业务层处理
@ -118,12 +119,12 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService
Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum;
//后续要处理这个本次到货数
//本次到货数
Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum();
if (thisArrivedNum != null){
if (qualityQualifiedNum>thisArrivedNum){
throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数");
}
}
// Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum();
// if (thisArrivedNum != null){
// if (qualityQualifiedNum>thisArrivedNum){
// throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数");
// }
// }
//更新品质报告详情中的品质合格数的数据
qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum);
//更新品质已合格数
@ -264,7 +265,7 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService
return qualityOrderReportMapper.restoreQualityOrderReportById(qualityOrderReportId);
}
/*根据供应商ID和物料号查询品质报告*/
/*根据供应商ID和物料号以及品质单号查询品质报告*/
@Override
public QualityOrderReport selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode,String qualityOrderCode) {
@ -276,6 +277,94 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService
return qualityOrderReport;
}
/*
* 查询委内加工入库单品质报告
* */
@Override
public QualityOrderReport selectMakeInOrderReportByNoAndCode(String materialNo, String qualityOrderCode) {
QualityOrderReport tempQualityOrderReport = new QualityOrderReport();
tempQualityOrderReport.setMaterialNo(materialNo);
tempQualityOrderReport.setQualityOrderCode(qualityOrderCode);
QualityOrderReport qualityOrderReport = qualityOrderReportMapper.selectMakeInOrderReportByNoAndCode(tempQualityOrderReport);
return qualityOrderReport;
}
/**
* 修改保存委内加工入库单品质报告按钮
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateMakeInOrderReport(QualityOrderReport qualityOrderReport) {
String loginName = ShiroUtils.getLoginName();
String materialNo = qualityOrderReport.getMaterialNo();
String qualityOrderCode = qualityOrderReport.getQualityOrderCode();
QualityOrderDetail tempQualityOrderDetail = new QualityOrderDetail();
tempQualityOrderDetail.setMaterialNo(materialNo);
tempQualityOrderDetail.setQualityOrderCode(qualityOrderCode);
//从数据库查询品质报告详情数据
QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectMakeInOrderDetailByCodeAndNo(tempQualityOrderDetail);
//计算品质单详情中的品质合格数量
Integer okAcceptedNum = qualityOrderReport.getOkAcceptedNum();
Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum();
//品质合格数
Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum;
//后续要处理这个本次到货数
//本次到货数
// Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum();
// if (thisArrivedNum != null){
// if (qualityQualifiedNum>thisArrivedNum){
// throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数");
// }
// }
//更新品质报告详情中的品质合格数的数据
qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum);
//更新品质已合格数
qualityOrderDetail.setQualityHasqualifiedNum(qualityQualifiedNum);
//获得品质报告中的不合格数模块数据
List<QualityOrderReportUnqualified> unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList();
if (CollectionUtils.isEmpty(unqualifiedDataList)){
throw new BusinessException("品质单不合格数数据为空");
}
//计算不良数量的合计值
int processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum();
//更新品质报告详情品质不合格数
qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal);
qualityOrderDetail.setUpdateBy(loginName);
qualityOrderDetail.setUpdateTime(new Date());
//更新品质报告详情数据表
int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
if (updateQualityOrderDetailResult <= 0){
throw new BusinessException("更新品质单详情数据失败");
}
//生成品质报告不合格数
for (QualityOrderReportUnqualified qualityOrderReportUnqualified : unqualifiedDataList) {
qualityOrderReportUnqualified.setQualityOrderReportId(qualityOrderReport.getQualityOrderReportId());
qualityOrderReportUnqualified.setCreateBy(loginName);
qualityOrderReportUnqualified.setCreateTime(new Date());
qualityOrderReportUnqualified.setMaterialNo(qualityOrderReport.getMaterialNo());
qualityOrderReportUnqualified.setMaterialName(qualityOrderReport.getMaterialName());
int insertUnqualifiedResult = unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified);
if (insertUnqualifiedResult <= 0){
throw new BusinessException("新增品质报告不合格数数据失败");
}
}
qualityOrderReport.setUpdateBy(loginName);
qualityOrderReport.setUpdateTime(new Date());
return qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReport);
}
/**
*退换货单号生产规则
*系统自动生成按照特定编码编码暂用THH+年月日+001

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

@ -8,6 +8,7 @@ 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.common.utils.StringUtils;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityOrderReportUnqualified;
@ -307,8 +308,137 @@ public class QualityOrderServiceImpl implements IQualityOrderService
}
/*
* 修改保存委内加工品质单开始品质
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateMakeInStartingQuality(QualityOrder qualityOrder) {
String loginName = ShiroUtils.getLoginName();
qualityOrder.setUpdateBy(loginName);
qualityOrder.setUpdateTime(new Date());
List<QualityOrderDetail> qualityOrderDetailList = qualityOrder.getQualityOrderDetailList();
if (CollectionUtils.isEmpty(qualityOrderDetailList)){
throw new BusinessException("品质单详情数据为空");
}
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
qualityOrderDetail.setUpdateBy(loginName);
qualityOrderDetail.setUpdateTime(new Date());
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("请先进行品质报告操作");
}
//更新品质单详情数据
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.insertWarehouseStorageOrderByMakeInQualityOrder(tempQualityOrder, qualityOrderDetailList);
if (updateStorageOrderResult <= 0){
throw new BusinessException("更新入库单数据失败");
}
int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder);
if (updateResult <= 0){
log.warn("更新品质单失败,未影响任何行");
}
return updateResult;
}
/**
* 查询委内加工品质单开始品质 物料相关信息
*/
@Override
public List<QualityOrderDetail> getMaterialListByQualityOrderCode(QualityOrder qualityOrder) {
String qualityOrderCode = qualityOrder.getQualityOrderCode();
if (StringUtils.isEmpty(qualityOrderCode)){
log.warn("品质单号为空:{}",qualityOrderCode);
}
List<QualityOrderDetail> details = orderDetailMapper.selectMakeInOrderDetailListByCode(qualityOrderCode);
return details;
}
//品质单不合格分类表
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
//插入品质报告不合格数
qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java

@ -108,4 +108,9 @@ public interface IWarehouseStorageOrderService
* 通用入库单详情保存接口
* */
int updateWarehouseStorageOrderSave(WarehouseStorageOrder warehouseStorageOrder);
/**
* 通过委内加工入库单品质后生成入库单
* */
int insertWarehouseStorageOrderByMakeInQualityOrder(QualityOrder tempQualityOrder, List<QualityOrderDetail> qualityOrderDetailList);
}

45
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -392,6 +392,51 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return 1;
}
/**
* 通过委内加工入库单品质后生成入库单 调用此方法的地方已经加事务这里不需要加事务了
* */
@Override
public int insertWarehouseStorageOrderByMakeInQualityOrder(QualityOrder tempQualityOrder, List<QualityOrderDetail> qualityOrderDetailList) {
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
String loginName = ShiroUtils.getLoginName();
String warehouseStorageCode = redisCache.generateBillNo("RK");
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrder.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
warehouseStorageOrder.setWarehouseStorageStatus("2");
warehouseStorageOrder.setWarehouseStorageType("2");
warehouseStorageOrder.setWarehouseOrderType("1");
warehouseStorageOrder.setDeliveryInspectionTime(tempQualityOrder.getDeliveryInspectionTime());
warehouseStorageOrder.setQualityUnqualifiedNum(tempQualityOrder.getQualityUnqualifiedNum());
warehouseStorageOrder.setQualityQualifiedNum(tempQualityOrder.getQualityQualifiedNum());
warehouseStorageOrder.setCreateBy(loginName);
warehouseStorageOrder.setQualityTime(new Date());
warehouseStorageOrder.setCreateTime(new Date());
//插入入库单详情数据
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
WarehouseStorageOrderDetail warehouseStorageOrderDetail = new WarehouseStorageOrderDetail();
warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrderDetail.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
warehouseStorageOrderDetail.setWarehouseOrderType("2");
warehouseStorageOrderDetail.setWarehouseStorageType("2");
warehouseStorageOrderDetail.setWarehouseOrderType("1");
warehouseStorageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo());
warehouseStorageOrderDetail.setMaterialName(qualityOrderDetail.getMaterialName());
warehouseStorageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand());
warehouseStorageOrderDetail.setMaterialDescribe(qualityOrderDetail.getMaterialDescribe());
warehouseStorageOrderDetail.setMaterialPhotourl(qualityOrderDetail.getMaterialPhotourl());
warehouseStorageOrderDetail.setMaterialProcessMethod(qualityOrderDetail.getMaterialProcessMethod());
warehouseStorageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType());
warehouseStorageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit());
warehouseStorageOrderDetail.setCreateBy(loginName);
warehouseStorageOrderDetail.setCreateTime(new Date());
storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
}
return warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
}
/**
* 修改保存暂收-采购单(采购入库) 子表数据
* */

17
ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml

@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="qualityHasqualifiedNum" column="quality_hasqualified_num" />
<result property="qualityQualifiedNum" column="quality_qualified_num" />
<result property="qualityUnqualifiedNum" column="quality_unqualified_num" />
<result property="makeInNum" column="make_in_num" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQualityOrderDetailVo">
select quality_order_detail_id, quality_order_code, in_storage_code, related_order_code, quality_status, quality_order_type, quality_storage_status, delivery_inspection_time, warehouse_code, warehouse_name, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_dept_type ,make_total, actual_arrive_num, this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, remark, create_by, create_time, update_by, update_time from quality_order_detail
select quality_order_detail_id, quality_order_code, in_storage_code, related_order_code, quality_status, quality_order_type, quality_storage_status, delivery_inspection_time, warehouse_code, warehouse_name, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_dept_type ,make_total, actual_arrive_num, this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, make_in_num, remark, create_by, create_time, update_by, update_time from quality_order_detail
</sql>
<select id="selectQualityOrderDetailList" parameterType="QualityOrderDetail" resultMap="QualityOrderDetailResult">
@ -75,6 +76,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and quality_order_code = #{qualityOrderCode}
</select>
<select id="selectMakeInOrderDetailByCodeAndNo" parameterType="QualityOrderDetail" resultMap="QualityOrderDetailResult">
<include refid="selectQualityOrderDetailVo"/>
where material_no = #{materialNo}
and quality_order_code = #{qualityOrderCode}
</select>
<select id="selectMakeInOrderDetailListByCode" parameterType="String" resultMap="QualityOrderDetailResult">
<include refid="selectQualityOrderDetailVo"/>
where quality_order_code = #{qualityOrderCode}
</select>
<insert id="insertQualityOrderDetail" parameterType="QualityOrderDetail" useGeneratedKeys="true" keyProperty="qualityOrderDetailId">
@ -109,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if>
<if test="qualityQualifiedNum != null">quality_qualified_num,</if>
<if test="qualityUnqualifiedNum != null">quality_unqualified_num,</if>
<if test="makeInNum != null">make_in_num,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -145,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if>
<if test="qualityQualifiedNum != null">#{qualityQualifiedNum},</if>
<if test="qualityUnqualifiedNum != null">#{qualityUnqualifiedNum},</if>
<if test="makeInNum != null">#{makeInNum},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -185,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if>
<if test="qualityQualifiedNum != null">quality_qualified_num = #{qualityQualifiedNum},</if>
<if test="qualityUnqualifiedNum != null">quality_unqualified_num = #{qualityUnqualifiedNum},</if>
<if test="makeInNum != null">make_in_num = #{makeInNum},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>

46
ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="makeTotal" column="make_total" />
<result property="makeInNum" column="make_in_num" />
<result property="actualArriveNum" column="actual_arrive_num" />
<result property="qualityHasqualifiedNum" column="quality_hasqualified_num" />
<result property="okAcceptedNum" column="ok_accepted_num" />
@ -31,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQualityOrderReportVo">
select quality_order_report_id, quality_order_code, supplier_code, supplier_name, material_no, material_name, make_total, actual_arrive_num,quality_hasqualified_num, ok_accepted_num, ok_report_url, special_concessions_num, special_report_url, checkout_completion_time, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report
select quality_order_report_id, quality_order_code, supplier_code, supplier_name, material_no, material_name, make_total, make_in_num, actual_arrive_num,quality_hasqualified_num, ok_accepted_num, ok_report_url, special_concessions_num, special_report_url, checkout_completion_time, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report
</sql>
<select id="selectQualityOrderReportList" parameterType="QualityOrderReport" resultMap="QualityOrderReportResult">
@ -52,6 +53,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and quality_order_code = #{qualityOrderCode}
</select>
<select id="selectMakeInOrderReportByNoAndCode" parameterType="QualityOrderReport" resultMap="QualityOrderReportResult">
<include refid="selectQualityOrderReportVo"/>
where material_no = #{materialNo}
and quality_order_code = #{qualityOrderCode}
</select>
<insert id="insertQualityOrderReport" parameterType="QualityOrderReport" useGeneratedKeys="true" keyProperty="qualityOrderReportId">
insert into quality_order_report
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -61,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null">material_no,</if>
<if test="materialName != null">material_name,</if>
<if test="makeTotal != null">make_total,</if>
<if test="makeInNum != null">make_in_num,</if>
<if test="actualArriveNum != null">actual_arrive_num,</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if>
<if test="okAcceptedNum != null">ok_accepted_num,</if>
@ -85,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null">#{materialNo},</if>
<if test="materialName != null">#{materialName},</if>
<if test="makeTotal != null">#{makeTotal},</if>
<if test="makeInNum != null">#{makeInNum},</if>
<if test="actualArriveNum != null">#{actualArriveNum},</if>
<if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if>
<if test="okAcceptedNum != null">#{okAcceptedNum},</if>
@ -113,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="makeTotal != null">make_total = #{makeTotal},</if>
<if test="makeInNum != null">make_in_num = #{makeInNum},</if>
<if test="actualArriveNum != null">actual_arrive_num = #{actualArriveNum},</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if>
<if test="okAcceptedNum != null">ok_accepted_num = #{okAcceptedNum},</if>
@ -134,6 +146,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and supplier_code = #{supplierCode}
</update>
<update id="updateQualityOrderReportById" parameterType="QualityOrderReport">
update quality_order_report
<trim prefix="SET" suffixOverrides=",">
<if test="qualityOrderCode != null">quality_order_code = #{qualityOrderCode},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="makeTotal != null">make_total = #{makeTotal},</if>
<if test="makeInNum != null">make_in_num = #{makeInNum},</if>
<if test="actualArriveNum != null">actual_arrive_num = #{actualArriveNum},</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if>
<if test="okAcceptedNum != null">ok_accepted_num = #{okAcceptedNum},</if>
<if test="okReportUrl != null">ok_report_url = #{okReportUrl},</if>
<if test="specialConcessionsNum != null">special_concessions_num = #{specialConcessionsNum},</if>
<if test="specialReportUrl != null">special_report_url = #{specialReportUrl},</if>
<if test="checkoutCompletionTime != null">checkout_completion_time = #{checkoutCompletionTime},</if>
<if test="processBadClassification != null">process_bad_classification = #{processBadClassification},</if>
<if test="processBadGrade != null">process_bad_grade = #{processBadGrade},</if>
<if test="processBadNum != null">process_bad_num = #{processBadNum},</if>
<if test="unqualifiedReportUrl != null">unqualified_report_url = #{unqualifiedReportUrl},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where quality_order_report_id = #{qualityOrderReportId}
</update>
<delete id="deleteQualityOrderReportById" parameterType="Long">
delete from quality_order_report where quality_order_report_id = #{qualityOrderReportId}
</delete>

11
ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="QualityOrderReportUnqualified" id="QualityOrderReportUnqualifiedResult">
<result property="orderReportUnqualifiedId" column="order_report_unqualified_id" />
<result property="qualityOrderReportId" column="quality_order_report_id" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="materialNo" column="material_no" />
@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQualityOrderReportUnqualifiedVo">
select order_report_unqualified_id, supplier_code, supplier_name, material_no, material_name, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report_unqualified
select order_report_unqualified_id, quality_order_report_id, supplier_code, supplier_name, material_no, material_name, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report_unqualified
</sql>
<select id="selectQualityOrderReportUnqualifiedList" parameterType="QualityOrderReportUnqualified" resultMap="QualityOrderReportUnqualifiedResult">
@ -36,6 +37,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where order_report_unqualified_id = #{orderReportUnqualifiedId}
</select>
<select id="selectOrderReportUnqualifiedByOrderReportId" parameterType="Long" resultMap="QualityOrderReportUnqualifiedResult">
<include refid="selectQualityOrderReportUnqualifiedVo"/>
where quality_order_report_id = #{qualityOrderReportId}
</select>
<select id="selectQualityOrderReportUnqualifiedByCodeAndNo" parameterType="QualityOrderReportUnqualified" resultMap="QualityOrderReportUnqualifiedResult">
<include refid="selectQualityOrderReportUnqualifiedVo"/>
@ -46,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertQualityOrderReportUnqualified" parameterType="QualityOrderReportUnqualified" useGeneratedKeys="true" keyProperty="orderReportUnqualifiedId">
insert into quality_order_report_unqualified
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="qualityOrderReportId != null">quality_order_report_id,</if>
<if test="supplierCode != null">supplier_code,</if>
<if test="supplierName != null">supplier_name,</if>
<if test="materialNo != null">material_no,</if>
@ -61,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="qualityOrderReportId != null">#{qualityOrderReportId},</if>
<if test="supplierCode != null">#{supplierCode},</if>
<if test="supplierName != null">#{supplierName},</if>
<if test="materialNo != null">#{materialNo},</if>
@ -80,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateQualityOrderReportUnqualified" parameterType="QualityOrderReportUnqualified">
update quality_order_report_unqualified
<trim prefix="SET" suffixOverrides=",">
<if test="qualityOrderReportId != null">quality_order_report_id= #{qualityOrderReportId},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>

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

@ -0,0 +1,315 @@
<!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="makeInNum" th:field="*{makeInNum}" 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');
// 检查表格数据是否为空
if (table.length === 0) {
$.modal.alertWarning("请至少添加一条不合格数再保存!");
return;
}
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 + "/makeInOrderReport", 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: [{
checkbox: false
},
{
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>

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

@ -0,0 +1,237 @@
<!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>
<div class="form-group">
<label class="col-sm-3 control-label">仓库Id:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" 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="warehouseName" th:field="*{warehouseName}" class="form-control" type="text">
</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";
$("#form-qualityOrder-edit").validate({
focusCleanup: 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,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum
// ...其他字段
};
});
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeInStartingQuality", 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',
},
{
title: '物料图片地址',
field: 'materialPhotourl',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
},
{
title: '委内已完成数',
field: 'makeInNum',
},
{
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',
}]
};
$.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/makeInOrderReport?' + queryParams.toString();
$.modal.open("品质报告", url);
}
</script>
</body>
</html>

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

@ -57,6 +57,8 @@
<script th:inline="javascript">
var detailFlag = [[${@permission.hasPermi('quality:qualityOrder:detail')}]];
var qualityFlag = [[${@permission.hasPermi('quality:qualityOrder:startingQuality')}]];
var makeInStartingQualityFlag = [[${@permission.hasPermi('quality:qualityOrder:makeInStartingQuality')}]];
var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]];
var qualityOrderTypeDatas = [[${@dict.getType('quality_order_type')}]];
var qualityStorageStatusDatas = [[${@dict.getType('quality_storage_status')}]];
@ -156,9 +158,15 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
if (row.qualityStatus != 2){
//采购订单品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 0 ){
actions.push('<a class="btn btn-success btn-xs ' + qualityFlag + '" href="javascript:void(0)" onclick="startingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//委内入库品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 1 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityFlag + '" href="javascript:void(0)" onclick="makeInStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
return actions.join('');
}
}]
@ -172,11 +180,19 @@
$.modal.open("进行品质",url)
}
//详情
function detail(qualityOrderId){
var url = ctx +'quality/qualityOrder/startingQualityDetail/' + qualityOrderId;
$.modal.open("品质单详情",url)
}
//委内加工单品质
function makeInStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeInStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url)
}
</script>
</body>
</html>

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

@ -198,7 +198,7 @@
visible: false
},
{
title: '物料详情ID',
title: '品质单详情ID',
field: 'qualityOrderDetailId',
visible: false

24
ruoyi-admin/src/main/resources/templates/system/makeorder/addProcessInbound.html

@ -160,18 +160,18 @@
},
{field: 'useNum',title: '用量',},
{field: 'lossRate',title: '损耗率',
formatter: function (value,row,index){
//百分号匹配
if(value == null || value == ""){
return "/";
}
var reg = /^[0-9]+.?[0-9]*$/;
if (!reg.test(value)){
return value + "%";
}else{
return value;
}
}
// formatter: function (value,row,index){
// //百分号匹配
// if(value == null || value == ""){
// return "/";
// }
// var reg = /^[0-9]+.?[0-9]*$/;
// if (!reg.test(value)){
// return value + "%";
// }else{
// return value;
// }
// }
},
{field: 'materialNum',title: '订单用量',
formatter: function (value,row,index){

Loading…
Cancel
Save