|
|
@ -1,8 +1,20 @@ |
|
|
|
package com.ruoyi.quality.service.impl; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
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.QualityOrderReportMapper; |
|
|
|
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; |
|
|
|
import com.ruoyi.warehouse.domain.WarehouseStorageOrder; |
|
|
|
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import com.ruoyi.quality.mapper.QualityOrderMapper; |
|
|
@ -22,6 +34,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService |
|
|
|
@Autowired |
|
|
|
private QualityOrderMapper qualityOrderMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QualityOrderDetailMapper orderDetailMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QualityOrderReportMapper orderReportMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisCache redisCache; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询品质管理品质单 |
|
|
|
* |
|
|
@ -123,4 +148,159 @@ public class QualityOrderServiceImpl implements IQualityOrderService |
|
|
|
{ |
|
|
|
return qualityOrderMapper.restoreQualityOrderById(qualityOrderId); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
* 采购入库仓库入库后生成品质单 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList) { |
|
|
|
|
|
|
|
QualityOrder qualityOrder = new QualityOrder(); |
|
|
|
qualityOrder.setCreateTime(new Date()); |
|
|
|
qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy()); |
|
|
|
//使用redis自动生成品质单号
|
|
|
|
String qualityOrderCode = redisCache.generateBillNo("PZ"); |
|
|
|
|
|
|
|
qualityOrder.setQualityOrderCode(qualityOrderCode); |
|
|
|
qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); |
|
|
|
qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); |
|
|
|
qualityOrder.setQualityStatus("0"); |
|
|
|
qualityOrder.setQualityOrderType("0"); |
|
|
|
qualityOrder.setQualityStorageStatus("0"); |
|
|
|
qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum()); |
|
|
|
qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); |
|
|
|
qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); |
|
|
|
qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); |
|
|
|
qualityOrderMapper.insertQualityOrder(qualityOrder); |
|
|
|
|
|
|
|
|
|
|
|
//新增三个子表的数据
|
|
|
|
for (WarehouseStorageOrderDetail detail : storageOrderDetailList) { |
|
|
|
// 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置
|
|
|
|
insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode); |
|
|
|
insertQualityOrderReportByWarehouseStorageOrder(detail); |
|
|
|
insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail); |
|
|
|
// ...
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) { |
|
|
|
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); |
|
|
|
//插入品质报告不合格数
|
|
|
|
qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); |
|
|
|
qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); |
|
|
|
qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); |
|
|
|
qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); |
|
|
|
qualityOrderReportUnqualified.setCreateTime(new Date()); |
|
|
|
qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); |
|
|
|
orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) { |
|
|
|
QualityOrderReport qualityOrderReport = new QualityOrderReport(); |
|
|
|
//插入品质单报告开始品质单
|
|
|
|
qualityOrderReport.setSupplierCode(qualityOrderReport.getSupplierCode()); |
|
|
|
qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); |
|
|
|
qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); |
|
|
|
qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); |
|
|
|
qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); |
|
|
|
qualityOrderReport.setCreateTime(new Date()); |
|
|
|
qualityOrderReport.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); |
|
|
|
orderReportMapper.insertQualityOrderReport(qualityOrderReport); |
|
|
|
} |
|
|
|
|
|
|
|
private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) { |
|
|
|
|
|
|
|
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); |
|
|
|
|
|
|
|
//插入数据到品质报告详情和 品质报告
|
|
|
|
qualityOrderDetail.setQualityOrderCode(qualityOrderCode); |
|
|
|
qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); |
|
|
|
qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); |
|
|
|
qualityOrderDetail.setQualityStatus("0"); |
|
|
|
qualityOrderDetail.setQualityOrderType("0"); |
|
|
|
qualityOrderDetail.setQualityStorageStatus("0"); |
|
|
|
qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); |
|
|
|
qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand()); |
|
|
|
qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); |
|
|
|
qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); |
|
|
|
qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); |
|
|
|
qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); |
|
|
|
qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); |
|
|
|
qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); |
|
|
|
qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal()); |
|
|
|
qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); |
|
|
|
qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); |
|
|
|
qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); |
|
|
|
qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); |
|
|
|
qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); |
|
|
|
qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); |
|
|
|
qualityOrderDetail.setCreateTime(new Date()); |
|
|
|
qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); |
|
|
|
orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// /*
|
|
|
|
// * 根据仓库入库单采购入库 生成品质单
|
|
|
|
// * */
|
|
|
|
// private void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// //插入数据到品质报告详情和 品质报告
|
|
|
|
// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) {
|
|
|
|
// QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
|
|
|
|
// QualityOrderReport qualityOrderReport = new QualityOrderReport();
|
|
|
|
// QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
|
|
|
|
// qualityOrderDetail.setQualityOrderCode(qualityOrderCode);
|
|
|
|
// qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
|
|
|
|
// qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
|
|
|
|
// qualityOrderDetail.setQualityStatus("0");
|
|
|
|
// qualityOrderDetail.setQualityOrderType("0");
|
|
|
|
// qualityOrderDetail.setQualityStorageStatus("0");
|
|
|
|
// qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
|
|
|
|
// qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand());
|
|
|
|
// qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
|
|
|
|
// qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
|
|
|
|
// qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
|
|
|
|
// qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
|
|
|
|
// qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
|
|
|
|
// qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());
|
|
|
|
// qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal());
|
|
|
|
// qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
|
|
|
|
// qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
|
|
|
|
// qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress());
|
|
|
|
// qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact());
|
|
|
|
// qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber());
|
|
|
|
// qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
|
|
|
|
// qualityOrderDetail.setCreateTime(new Date());
|
|
|
|
// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
|
|
|
|
// orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
|
|
|
|
// //插入品质单报告开始品质单
|
|
|
|
// qualityOrderReport.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
|
|
|
|
// qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
|
|
|
|
// qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
|
|
|
|
// qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
|
|
|
|
// qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
|
|
|
|
// qualityOrderDetail.setCreateTime(new Date());
|
|
|
|
// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
|
|
|
|
// orderReportMapper.insertQualityOrderReport(qualityOrderReport);
|
|
|
|
// //插入品质报告不合格数
|
|
|
|
// qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
|
|
|
|
// qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
|
|
|
|
// qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
|
|
|
|
// qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
|
|
|
|
// qualityOrderReportUnqualified.setCreateTime(new Date());
|
|
|
|
// qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
|
|
|
|
// orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|