Browse Source

[fix] 品质管理 仓库管理

品质单详情新增物料入库部门字段
暂收的时候物料入库部门转入品质单详情中
计算主表的本次到货数
计算主表的本次到货数
计算主表的品质不合格数
对品质单详情表更新操作进行校验:如果品质合格数为空或者品质不合格数为空,提示先进行品质报告操作
对本次到货数进行校验,如果本次到货数为空,则不能进行品质操作
新增根据 入库单号更新仓库入库单详情数据
修复开始品质 品质详情不能传值问题
品质报告详情新增物料入库部门字段
dev
liuxiaoxu 5 months ago
parent
commit
1b1488d1a4
  1. 2
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
  3. 101
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java
  4. 110
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  5. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  6. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java
  7. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  8. 56
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  9. 6
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
  10. 67
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderDetailMapper.xml
  11. 207
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/startingQuality.html

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

@ -173,7 +173,7 @@ public class QualityOrderController extends BaseController
/**
* 开始品质显示品质单详情列表
* 开始品质显示品质单供应商物料信息列表
*/
@ResponseBody
@RequestMapping("/detailListGroupedBySupplier")

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

@ -109,6 +109,10 @@ public class QualityOrderDetail extends BaseEntity
@Excel(name = "物料加工方式")
private String materialProcessMethod;
/** 物料入库部门 */
@Excel(name = "物料入库部门")
private String materialDeptType;
/** 生产订单数 */
@Excel(name = "生产订单数")
private Integer makeTotal;
@ -376,6 +380,14 @@ public class QualityOrderDetail extends BaseEntity
this.qualityUnqualifiedNum = qualityUnqualifiedNum;
}
public String getMaterialDeptType() {
return materialDeptType;
}
public void setMaterialDeptType(String materialDeptType) {
this.materialDeptType = materialDeptType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -402,6 +414,7 @@ public class QualityOrderDetail extends BaseEntity
.append("materialUnit", getMaterialUnit())
.append("materialDescribe", getMaterialDescribe())
.append("materialProcessMethod", getMaterialProcessMethod())
.append("materialDeptType",getMaterialDeptType())
.append("makeTotal", getMakeTotal())
.append("thisArrivedNum", getThisArrivedNum())
.append("qualityHasqualifiedNum", getQualityHasqualifiedNum())

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

@ -91,7 +91,7 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService
* @param qualityOrderReport 品质管理品质单报告
* @return 结果
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public int updateQualityOrderReport(QualityOrderReport qualityOrderReport)
{
@ -115,97 +115,102 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService
Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum();
//品质合格数
Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum;
//后续要处理这个本次到货数
//本次到货数
Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum();
if (qualityQualifiedNum>thisArrivedNum){
throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数");
if (thisArrivedNum != null){
if (qualityQualifiedNum>thisArrivedNum){
throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数");
}
}
//更新品质报告详情中的品质合格数的数据
qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum);
//获得品质报告中的不合格数模块数据
List<QualityOrderReportUnqualified> unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList();
/*如果进行品质的订单类型是采购或者委外*/
if (qualityOrderDetail.getQualityOrderType().equals("0") || qualityOrderDetail.getQualityOrderType().equals("2")){
/*有品质不合格,需要在退换货入库前退货进行记录*/
//更改日期格式,以提高可读性
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// String dataPart = df.format(new Date());
// if (qualityOrderDetail.getQualityOrderType().equals("0") || qualityOrderDetail.getQualityOrderType().equals("2")){
// /*有品质不合格,需要在退换货入库前退货进行记录*/
//
// //移除日期中的分隔符以便于后续处理
// String prefix = "ZCGX"+dataPart.replace("-","");
// String refundsExchangesCode = redisCache.generateBillNo("ZCGX");
// QualityRefundsExchanges qualityRefundsExchanges = new QualityRefundsExchanges();
// qualityRefundsExchanges.setRefundsExchangesCode(refundsExchangesCode);
// qualityRefundsExchanges.setRefundsExchangesStatus("0");
//
// //查询数据库中退换货单号最大的编号
// String maxCode = refundsExchangesOrderMapper.findMaxRoundCode(prefix);
// String newCode = generateNewCode(prefix,maxCode);
String refundsExchangesCode = redisCache.generateBillNo("ZCGX");
QualityRefundsExchanges qualityRefundsExchanges = new QualityRefundsExchanges();
qualityRefundsExchanges.setRefundsExchangesCode(refundsExchangesCode);
qualityRefundsExchanges.setRefundsExchangesStatus("0");
for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) {
QualityRefundsExchangesOrder qualityRefundsExchangesOrder = new QualityRefundsExchangesOrder();
qualityRefundsExchangesOrder.setRefundsExchangesCode(refundsExchangesCode);
qualityRefundsExchangesOrder.setOkReportUrl(qualityOrderReport.getOkReportUrl());
qualityRefundsExchangesOrder.setOkAcceptedNum(qualityOrderReport.getOkAcceptedNum());
qualityRefundsExchangesOrder.setSpecialReportUrl(qualityOrderReport.getSpecialReportUrl());
qualityRefundsExchangesOrder.setSpecialConcessionsNum(qualityOrderReport.getSpecialConcessionsNum());
qualityRefundsExchangesOrder.setMaterialNo(materialNo);
qualityRefundsExchangesOrder.setMaterialName(qualityOrderReport.getMaterialName());
qualityRefundsExchangesOrder.setMakeTotal(qualityOrderReport.getMakeTotal());
qualityRefundsExchangesOrder.setQualityHasqualifiedNum(qualityOrderReport.getQualityHasqualifiedNum());
qualityRefundsExchangesOrder.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum());
qualityRefundsExchangesOrder.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification());
qualityRefundsExchangesOrder.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade());
qualityRefundsExchangesOrder.setUpdateBy(loginName);
qualityRefundsExchangesOrder.setUpdateTime(new Date());
refundsExchangesOrderMapper.insertQualityRefundsExchangesOrder(qualityRefundsExchangesOrder);
}
}
// for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) {
// QualityRefundsExchangesOrder qualityRefundsExchangesOrder = new QualityRefundsExchangesOrder();
// qualityRefundsExchangesOrder.setRefundsExchangesCode(refundsExchangesCode);
// qualityRefundsExchangesOrder.setOkReportUrl(qualityOrderReport.getOkReportUrl());
// qualityRefundsExchangesOrder.setOkAcceptedNum(qualityOrderReport.getOkAcceptedNum());
// qualityRefundsExchangesOrder.setSpecialReportUrl(qualityOrderReport.getSpecialReportUrl());
// qualityRefundsExchangesOrder.setSpecialConcessionsNum(qualityOrderReport.getSpecialConcessionsNum());
// qualityRefundsExchangesOrder.setMaterialNo(materialNo);
// qualityRefundsExchangesOrder.setMaterialName(qualityOrderReport.getMaterialName());
// qualityRefundsExchangesOrder.setMakeTotal(qualityOrderReport.getMakeTotal());
// qualityRefundsExchangesOrder.setQualityHasqualifiedNum(qualityOrderReport.getQualityHasqualifiedNum());
// qualityRefundsExchangesOrder.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum());
// qualityRefundsExchangesOrder.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification());
// qualityRefundsExchangesOrder.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade());
// qualityRefundsExchangesOrder.setUpdateBy(loginName);
// qualityRefundsExchangesOrder.setUpdateTime(new Date());
// refundsExchangesOrderMapper.insertQualityRefundsExchangesOrder(qualityRefundsExchangesOrder);
// }
// }
//计算不良数量的合计值
int processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum();
if (processBadNumTotal>thisArrivedNum){
throw new BusinessException("不良数量的总和小于等于本次到货数");
}
//后续处理本次到货数
// if (processBadNumTotal>thisArrivedNum){
// throw new BusinessException("不良数量的总和小于等于本次到货数");
// }
//更新品质报告详情品质不合格数
qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal);
orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
qualityOrderDetail.setUpdateBy(loginName);
qualityOrderDetail.setUpdateTime(new Date());
//更新品质报告详情数据表
int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
if (updateQualityOrderDetailResult <= 0){
throw new BusinessException("更新品质单详情数据失败");
}
List<QualityOrderReportUnqualified> qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified);
if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){
//如果后端不合格数列表值为空,就新增一个
for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified);
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified);
qualityOrderReportUnqualified.setCreateBy(loginName);
qualityOrderReportUnqualified.setCreateTime(new Date());
unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified);
}
}else {
//如果后端不合格数列表值为不空,就更新
for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified);
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified);
qualityOrderReportUnqualified.setUpdateBy(loginName);
qualityOrderReportUnqualified.setUpdateTime(new Date());
unqualifiedMapper.updateQualityOrderReportUnqualified(qualityOrderReportUnqualified);
}
}
qualityOrderReport.setUpdateBy(loginName);
qualityOrderReport.setUpdateTime(DateUtils.getNowDate());
qualityOrderReport.setUpdateTime(new Date());
return qualityOrderReportMapper.updateQualityOrderReport(qualityOrderReport);
}
private static QualityOrderReportUnqualified getQualityOrderReportUnqualified(String loginName, String materialNo, String supplierCode, QualityOrderReportUnqualified tempQualityOrderReportUnqualified) {
//更新品质报告不合格数量模块的数据
private static QualityOrderReportUnqualified getQualityOrderReportUnqualified(String materialNo, String supplierCode, QualityOrderReportUnqualified tempQualityOrderReportUnqualified) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
qualityOrderReportUnqualified.setSupplierCode(supplierCode);
qualityOrderReportUnqualified.setMaterialNo(materialNo);
qualityOrderReportUnqualified.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum());
qualityOrderReportUnqualified.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification());
qualityOrderReportUnqualified.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade());
qualityOrderReportUnqualified.setUpdateBy(loginName);
qualityOrderReportUnqualified.setUpdateTime(new Date());
return qualityOrderReportUnqualified;
}

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

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
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.quality.domain.QualityOrderDetail;
@ -24,6 +25,7 @@ import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.service.IQualityOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 品质管理品质单Service业务层处理
@ -94,7 +96,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
}
/**
* 修改品质管理品质单
* 修改保存品质单开始品质
*
* @param qualityOrder 品质管理品质单
* @return 结果
@ -103,21 +105,113 @@ public class QualityOrderServiceImpl implements IQualityOrderService
@Override
public int updateQualityOrder(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();
//采购订单,采购入库单品质完成后,数据生成到入库单中,后续进行入库操作
if ("0".equals(qualityStatus) && "0".equals(qualityStorageStatus) ){
warehouseStorageOrderService.updateWarehouseStorageOrderByQualityOrder(qualityOrder,qualityOrderDetailList);
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("存在品质已合格数为空,请检查!");
}
//目前假设全部品质
qualityOrder.setQualityStatus("2");
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();
//计算主表的本次到货数
// Integer thisArrivedNum = qualityOrderDetailList.stream().mapToInt(QualityOrderDetail::getThisArrivedNum).sum();
//计算主表的品质合格数
// Integer qualityQualifiedNum = qualityOrderDetailList.stream().mapToInt(QualityOrderDetail::getQualityQualifiedNum).sum();
//计算主表的品质不合格数
// Integer qualityUnqualifiedNum = 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(thisArrivedNumSum);
tempQualityOrder.setQualityUnqualifiedNum(qualityQualifiedNumSum);
tempQualityOrder.setThisArrivedNum(qualityUnqualifiedNumSum);
//采购订单,采购入库单品质完成后,数据生成到入库单中,后续进行入库操作
int updateStorageOrderResult = warehouseStorageOrderService.updateWarehouseStorageOrderByQualityOrder(tempQualityOrder, qualityOrderDetailList);
if (updateStorageOrderResult <= 0){
throw new BusinessException("更新入库单数据失败");
}
int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder);
if (updateResult <= 0){
log.warn("更新品质单失败,未影响任何行");
@ -258,7 +352,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
//To do 缺少入库部门 ,如果后续需要从这里添加
qualityOrderDetail.setMaterialDeptType(warehouseStorageOrderDetail.getMaterialDeptType());
qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -320,7 +320,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.storagePurchaseWarehouseStorageOrder(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.updateStoragePurchaseSave(warehouseStorageOrder));
}

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java

@ -108,4 +108,9 @@ public interface WarehouseStorageOrderDetailMapper
* 根据入库单号供应商id物料号更新对应的物料单详情
* */
WarehouseStorageOrderDetail selectWarehouseStorageOrderDetailListByRelatedOrderCode(WarehouseStorageOrderDetail warehouseStorageOrderDetail);
/*
* 根据入库单号更新入库单数据
* */
int updateWarehouseStorageOrderDetailByCode(WarehouseStorageOrderDetail storageOrderDetail);
}

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

@ -98,4 +98,9 @@ public interface IWarehouseStorageOrderService
* 修改保存暂收-采购单(采购入库)
* */
int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder);
/**
* 入库-采购单(采购入库)
* */
int updateStoragePurchaseSave(WarehouseStorageOrder warehouseStorageOrder);
}

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

@ -196,28 +196,37 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
warehouseStorageOrder.setWarehouseStorageCode(qualityOrder.getInStorageCode());
//入库状态 为待入库
warehouseStorageOrder.setWarehouseStorageStatus("2");
//目前假设全部品质
warehouseStorageOrder.setWarehouseQualityStatus("2");
//设置品质时间
warehouseStorageOrder.setQualityTime(new Date());
warehouseStorageOrder.setQualityTime(qualityOrder.getDeliveryInspectionTime());
//设置品质合格数
warehouseStorageOrder.setQualityQualifiedNum(qualityOrder.getQualityQualifiedNum());
//设置品质不合格数
warehouseStorageOrder.setQualityUnqualifiedNum(qualityOrder.getQualityUnqualifiedNum());
//设置交检时间
warehouseStorageOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime());
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
WarehouseStorageOrderDetail storageOrderDetail = new WarehouseStorageOrderDetail();
storageOrderDetail.setWarehouseStorageCode(qualityOrder.getInStorageCode());
storageOrderDetail.setQualityQualifiedNum(qualityOrderDetail.getQualityQualifiedNum());
int updateStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetailByCode(storageOrderDetail);
if (updateStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}
}
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrderByCode(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新仓库入库单失败,未影响任何行");
throw new BusinessException("更新仓库入库单失败,未影响任何行");
}
return updateResult;
}
/**
* 入库-采购单(采购入库)
* 入库-采购单(采购入库) 旧版弃用
* */
@Transactional(rollbackFor = Exception.class)
@Override
@ -303,6 +312,41 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult;
}
/**
* 修改保存 入库-采购单(采购入库)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateStoragePurchaseSave(WarehouseStorageOrder warehouseStorageOrder) {
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setUpdateTime(new Date());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
}
//更新生产单数据
sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder,warehouseStorageOrderDetailList);
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
}
//更新入库单的数据
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新入库单失败,未影响任何行");
}
return updateResult;
}
/**
* 修改保存暂收-采购单(采购入库) 子表数据
* */

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

@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialUnit" column="material_unit" />
<result property="materialDescribe" column="material_describe" />
<result property="materialProcessMethod" column="material_process_method" />
<result property="materialDeptType" column="material_dept_type"/>
<result property="makeTotal" column="make_total" />
<result property="thisArrivedNum" column="this_arrived_num" />
<result property="qualityHasqualifiedNum" column="quality_hasqualified_num" />
@ -41,7 +42,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, make_total, 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, 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
</sql>
<select id="selectQualityOrderDetailList" parameterType="QualityOrderDetail" resultMap="QualityOrderDetailResult">
@ -99,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialUnit != null">material_unit,</if>
<if test="materialDescribe != null">material_describe,</if>
<if test="materialProcessMethod != null">material_process_method,</if>
<if test="materialDeptType">material_dept_type,</if>
<if test="makeTotal != null">make_total,</if>
<if test="thisArrivedNum != null">this_arrived_num,</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if>
@ -133,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialUnit != null">#{materialUnit},</if>
<if test="materialDescribe != null">#{materialDescribe},</if>
<if test="materialProcessMethod != null">#{materialProcessMethod},</if>
<if test="materialDeptType">#{materialDeptType},</if>
<if test="makeTotal != null">#{makeTotal},</if>
<if test="thisArrivedNum != null">#{thisArrivedNum},</if>
<if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if>
@ -171,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="materialDeptType != null">material_dept_type = #{materialDeptType},</if>
<if test="makeTotal != null">make_total = #{makeTotal},</if>
<if test="thisArrivedNum != null">this_arrived_num = #{thisArrivedNum},</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if>

67
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderDetailMapper.xml

@ -283,6 +283,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateWarehouseStorageOrderDetailByCode" parameterType="WarehouseStorageOrderDetail">
update warehouse_storage_order_detail
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseStorageCode != null">warehouse_storage_code = #{warehouseStorageCode},</if>
<if test="relatedOrderCode != null">related_order_code = #{relatedOrderCode},</if>
<if test="warehouseStorageStatus != null">warehouse_storage_status = #{warehouseStorageStatus},</if>
<if test="warehouseQualityStatus != null">warehouse_quality_status = #{warehouseQualityStatus},</if>
<if test="warehouseStorageType != null">warehouse_storage_type = #{warehouseStorageType},</if>
<if test="warehouseStorageClass != null">warehouse_storage_class = #{warehouseStorageClass},</if>
<if test="warehouseOrderType != null">warehouse_order_type = #{warehouseOrderType},</if>
<if test="warehouseDeptType != null">warehouse_dept_type = #{warehouseDeptType},</if>
<if test="warehouseEmployee != null">warehouse_employee = #{warehouseEmployee},</if>
<if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if>
<if test="warehouseDetailAddress != null">warehouse_detail_address = #{warehouseDetailAddress},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="customerContact != null">customer_contact = #{customerContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="supplierAddress != null">supplier_address = #{supplierAddress},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="customerContactPeople != null">customer_contact_people = #{customerContactPeople},</if>
<if test="customerContactNumber != null">customer_contact_number = #{customerContactNumber},</if>
<if test="customerCompanyAddress != null">customer_company_address = #{customerCompanyAddress},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="materialPhotourl != null">material_photoUrl = #{materialPhotourl},</if>
<if test="materialBrand != null">material_brand = #{materialBrand},</if>
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="materialDeptType != null">material_dept_type = #{materialDeptType},</if>
<if test="makeTotal != null">make_total = #{makeTotal},</if>
<if test="notifyHasArrivedNum != null">notify_has_arrived_num = #{notifyHasArrivedNum},</if>
<if test="notifyArriveNum != null">notify_arrive_num = #{notifyArriveNum},</if>
<if test="actualHasArrivedNum != null">actual_has_arrived_num = #{actualHasArrivedNum},</if>
<if test="actualArriveNum != null">actual_arrive_num = #{actualArriveNum},</if>
<if test="temporaryHasQualifiedNum != null">temporary_has_qualified_num = #{temporaryHasQualifiedNum},</if>
<if test="temporaryQualifiedNum != null">temporary_qualified_num = #{temporaryQualifiedNum},</if>
<if test="hasStorageNum != null">has_storage_num = #{hasStorageNum},</if>
<if test="storageNum != null">storage_num = #{storageNum},</if>
<if test="makeStorageNum != null">make_storage_num = #{makeStorageNum},</if>
<if test="qualityHasQualifiedNum != null">quality_has_qualified_num = #{qualityHasQualifiedNum},</if>
<if test="qualityQualifiedNum != null">quality_qualified_num = #{qualityQualifiedNum},</if>
<if test="refundsExchangesNum != null">refunds_exchanges_num = #{refundsExchangesNum},</if>
<if test="arrivedTime != null">arrived_time = #{arrivedTime},</if>
<if test="temporaryTime != null">temporary_time = #{temporaryTime},</if>
<if test="deliveryInspectionTime != null">delivery_inspection_time = #{deliveryInspectionTime},</if>
<if test="qualityTime != null">quality_time = #{qualityTime},</if>
<if test="storageTime != null">storage_time = #{storageTime},</if>
<if test="temporaryRemark != null">temporary_remark = #{temporaryRemark},</if>
<if test="temporaryReportUrl != null">temporary_report_url = #{temporaryReportUrl},</if>
<if test="storageLocation != null">storage_location = #{storageLocation},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where warehouse_storage_code = #{warehouseStorageCode}
</update>
<update id="updateWarehouseStorageOrderDetailByObject" parameterType="WarehouseStorageOrderDetail">
update warehouse_storage_order_detail
<trim prefix="SET" suffixOverrides=",">

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

@ -106,48 +106,55 @@
function submitHandler() {
if ($.validate.form()) {
const qualityOrderData = $("#form-qualityOrder-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"qualityHasqualifiedNum": item.qualityHasqualifiedNum,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
const qualityOrderData = $("#form-qualityOrder-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"qualityOrderDetailId": item.qualityOrderDetailId,
"supplierCode" : item.supplierCode,
"materialNo" : item.materialNo,
"qualityHasqualifiedNum": item.qualityHasqualifiedNum,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum
// ...其他字段
};
});
}
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: allMaterialDataList
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
$.operate.saveJson(prefix + "/startingQuality", jsonData);
}
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// 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 + "/startingQuality", jsonData);
}
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
@ -162,8 +169,10 @@
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
@ -189,76 +198,86 @@
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: 'makeTotal',
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
editable:{
type:'text'
title: '物料详情ID',
field: 'qualityOrderDetailId',
visible: false
},
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="qualityReport(\'' + row.materialNo + '\', \'' + row.supplierCode + '\')"><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
{
title: '品质合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
}]
{
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: 'makeTotal',
},
{
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="qualityReport(\'' + row.materialNo + '\', \'' + row.supplierCode + '\')"><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
{
title: '品质合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
}]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
function qualityReport(materialNo, supplierCode) {
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);

Loading…
Cancel
Save