|
@ -11,20 +11,18 @@ import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.erp.domain.ErpDevelopModifyorder; |
|
|
import com.ruoyi.erp.domain.ErpDevelopModifyorder; |
|
|
import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper; |
|
|
import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper; |
|
|
import com.ruoyi.quality.domain.QualityOrderDetail; |
|
|
import com.ruoyi.quality.domain.*; |
|
|
import com.ruoyi.quality.domain.QualityOrderReport; |
|
|
import com.ruoyi.quality.mapper.*; |
|
|
import com.ruoyi.quality.domain.QualityOrderReportUnqualified; |
|
|
import com.ruoyi.quality.service.IQualityOrderReportService; |
|
|
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.WarehouseStorageOrder; |
|
|
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; |
|
|
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; |
|
|
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; |
|
|
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; |
|
|
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; |
|
|
import com.ruoyi.warehouse.service.IWarehouseStorageOrderService; |
|
|
import com.ruoyi.warehouse.service.IWarehouseStorageOrderService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.ruoyi.quality.mapper.QualityOrderMapper; |
|
|
|
|
|
import com.ruoyi.quality.domain.QualityOrder; |
|
|
|
|
|
import com.ruoyi.quality.service.IQualityOrderService; |
|
|
import com.ruoyi.quality.service.IQualityOrderService; |
|
|
import com.ruoyi.common.core.text.Convert; |
|
|
import com.ruoyi.common.core.text.Convert; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -50,6 +48,27 @@ public class QualityOrderServiceImpl implements IQualityOrderService |
|
|
@Autowired |
|
|
@Autowired |
|
|
private QualityOrderReportMapper orderReportMapper; |
|
|
private QualityOrderReportMapper orderReportMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IQualityOrderReportService qualityOrderReportService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private QualityRefundsExchangesMapper exchangesMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private QualityRefundsExchangesDetailMapper exchangesDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private QualityRefundsExchangesOrderMapper exchangesOrderMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private QualityRefundsExchangesUnqualifiedMapper exchangesUnqualifiedMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WarehouseStorageOrderDetailMapper warehouseStorageDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WarehouseStorageOrderMapper warehouseStorageOrderMapper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper; |
|
|
private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper; |
|
|
|
|
|
|
|
@ -225,7 +244,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService |
|
|
erpDevelopModifyorder.setPurchaseStorageStatus("6"); |
|
|
erpDevelopModifyorder.setPurchaseStorageStatus("6"); |
|
|
developModifyorderMapper.updateErpDevelopModifyorder(erpDevelopModifyorder); |
|
|
developModifyorderMapper.updateErpDevelopModifyorder(erpDevelopModifyorder); |
|
|
} |
|
|
} |
|
|
|
|
|
generateBeforeRefundsExchanges(qualityOrder); |
|
|
int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder); |
|
|
int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder); |
|
|
if (updateResult <= 0){ |
|
|
if (updateResult <= 0){ |
|
|
log.warn("更新品质单失败,未影响任何行"); |
|
|
log.warn("更新品质单失败,未影响任何行"); |
|
@ -233,6 +252,192 @@ public class QualityOrderServiceImpl implements IQualityOrderService |
|
|
return updateResult; |
|
|
return updateResult; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质单生成退换货单
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public int generateBeforeRefundsExchanges(QualityOrder qualityOrder){ |
|
|
|
|
|
QualityRefundsExchanges refundsExchanges = new QualityRefundsExchanges(); |
|
|
|
|
|
refundsExchanges.setRefundsExchangesCode(redisCache.generateBillNo("THH")); |
|
|
|
|
|
refundsExchanges.setRelatedOrderCode(qualityOrder.getQualityOrderCode()); |
|
|
|
|
|
refundsExchanges.setMaterialTotal(qualityOrder.getQualityOrderDetailList().size()); |
|
|
|
|
|
refundsExchanges.setNumTotal(qualityOrder.getQualityUnqualifiedNum()); |
|
|
|
|
|
refundsExchanges.setRefundsExchangesStatus("0"); |
|
|
|
|
|
refundsExchanges.setQualityWarehouseStatus("0"); |
|
|
|
|
|
refundsExchanges.setQualityPurchaseStatus("0"); |
|
|
|
|
|
refundsExchanges.setQualityDeliveryStatus("0"); |
|
|
|
|
|
refundsExchanges.setWarehouseStorageType(qualityOrder.getQualityStorageStatus()); |
|
|
|
|
|
refundsExchanges.setQualityReturnNode("0"); |
|
|
|
|
|
refundsExchanges.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime()); |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质单生成退换货入库单
|
|
|
|
|
|
WarehouseStorageOrder warehouseStorageOrder = generateWarehouseStorageOrder(refundsExchanges.getRefundsExchangesCode(),qualityOrder); |
|
|
|
|
|
int warehouseResult = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); |
|
|
|
|
|
if (warehouseResult <= 0){ |
|
|
|
|
|
log.warn("插入入库单失败,未影响任何行"); |
|
|
|
|
|
} |
|
|
|
|
|
List<QualityOrderDetail> qualityOrderDetailList = orderDetailMapper.selectQualityOrderDetailListByCode(qualityOrder.getQualityOrderCode()); |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(qualityOrderDetailList)){ |
|
|
|
|
|
throw new BusinessException("品质单详情数据为空"); |
|
|
|
|
|
} |
|
|
|
|
|
for (QualityOrderDetail detail: qualityOrderDetailList) { |
|
|
|
|
|
// 根据品质单详情生成退换货详情
|
|
|
|
|
|
QualityRefundsExchangesDetail exchangesDetail = generateRefundsExchangesDetail(refundsExchanges.getRefundsExchangesCode(),detail); |
|
|
|
|
|
int exchangesDetailResult = exchangesDetailMapper.insertQualityRefundsExchangesDetail(exchangesDetail); |
|
|
|
|
|
if (exchangesDetailResult <= 0){ |
|
|
|
|
|
log.warn("插入退换货详情失败,未影响任何行"); |
|
|
|
|
|
} |
|
|
|
|
|
// 根据品质单详情生成退换货入库单详情
|
|
|
|
|
|
WarehouseStorageOrderDetail warehouseStorageOrderDetail = generateWarehouseStorageOrderDetail(warehouseStorageOrder.getWarehouseStorageCode(), refundsExchanges.getRefundsExchangesCode(),detail); |
|
|
|
|
|
int warehouseDetailResult = warehouseStorageDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail); |
|
|
|
|
|
if (warehouseDetailResult <= 0){ |
|
|
|
|
|
log.warn("插入入库单详情失败,未影响任何行"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质报告单生成退换货品质报告单
|
|
|
|
|
|
QualityOrderReport qualityReport = qualityOrderReportService.selectQualityOrderReportByNoAndCode(detail.getMaterialNo(), detail.getSupplierCode(), detail.getQualityOrderCode()); |
|
|
|
|
|
QualityRefundsExchangesOrder exchangesOrder = generateQualityRefundsExchangesOrder(refundsExchanges.getRefundsExchangesCode(),qualityReport,detail); |
|
|
|
|
|
int exchangesOrderResult = exchangesOrderMapper.insertQualityRefundsExchangesOrder(exchangesOrder); |
|
|
|
|
|
if (exchangesOrderResult <= 0){ |
|
|
|
|
|
log.warn("插入退换货详情报告失败,未影响任何行"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QualityOrderReportUnqualified unqualified = new QualityOrderReportUnqualified(); |
|
|
|
|
|
unqualified.setQualityOrderReportId(qualityReport.getQualityOrderReportId()); |
|
|
|
|
|
List<QualityOrderReportUnqualified> reportUnqualifiedList = orderReportUnqualifiedMapper.selectOrderReportUnqualifiedByOrderReportId(unqualified); |
|
|
|
|
|
if (CollectionUtils.isEmpty(reportUnqualifiedList)){ |
|
|
|
|
|
throw new BusinessException("品质单报告不合格分类数据为空"); |
|
|
|
|
|
} |
|
|
|
|
|
// 根据品质报告不合格分类列表生成退换货不合格
|
|
|
|
|
|
for (QualityOrderReportUnqualified unqualifiedReport:reportUnqualifiedList) { |
|
|
|
|
|
QualityRefundsExchangesUnqualified exchangesUnqualified = new QualityRefundsExchangesUnqualified(); |
|
|
|
|
|
exchangesUnqualified.setRefundsExchangesCode(refundsExchanges.getRefundsExchangesCode()); |
|
|
|
|
|
exchangesUnqualified.setMaterialNo(detail.getMaterialNo()); |
|
|
|
|
|
exchangesUnqualified.setMaterialName(detail.getMaterialName()); |
|
|
|
|
|
exchangesUnqualified.setProcessBadClassification(unqualifiedReport.getProcessBadClassification()); |
|
|
|
|
|
exchangesUnqualified.setProcessBadGrade(unqualifiedReport.getProcessBadGrade()); |
|
|
|
|
|
exchangesUnqualified.setProcessBadNum(unqualifiedReport.getProcessBadNum()); |
|
|
|
|
|
exchangesUnqualified.setUnqualifiedReportUrl(unqualifiedReport.getUnqualifiedReportUrl()); |
|
|
|
|
|
exchangesUnqualified.setInspectionTime(detail.getDeliveryInspectionTime()); |
|
|
|
|
|
exchangesUnqualified.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
exchangesUnqualified.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
int exchangeUnqualifiedResult = exchangesUnqualifiedMapper.insertQualityRefundsExchangesUnqualified(exchangesUnqualified); |
|
|
|
|
|
if (exchangeUnqualifiedResult <= 0){ |
|
|
|
|
|
log.warn("插入入库单详情失败,未影响任何行"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
refundsExchanges.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); |
|
|
|
|
|
refundsExchanges.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
refundsExchanges.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return exchangesMapper.insertQualityRefundsExchanges(refundsExchanges); |
|
|
|
|
|
} |
|
|
|
|
|
// 根据品质单生成退换货入库单
|
|
|
|
|
|
public WarehouseStorageOrder generateWarehouseStorageOrder(String refundsExchangesCode, QualityOrder qualityOrder){ |
|
|
|
|
|
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseStorageCode(redisCache.generateBillNo("RK")); |
|
|
|
|
|
warehouseStorageOrder.setRelatedOrderCode(refundsExchangesCode); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseStorageStatus("2"); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseQualityStatus(qualityOrder.getQualityStatus()); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseStorageType("3"); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseOrderType("2"); |
|
|
|
|
|
warehouseStorageOrder.setWarehouseDeptType("1"); |
|
|
|
|
|
warehouseStorageOrder.setActualArrivedNum(qualityOrder.getThisArrivedNum()); |
|
|
|
|
|
warehouseStorageOrder.setQualityQualifiedNum(qualityOrder.getQualityQualifiedNum()); |
|
|
|
|
|
warehouseStorageOrder.setQualityUnqualifiedNum(qualityOrder.getQualityUnqualifiedNum()); |
|
|
|
|
|
warehouseStorageOrder.setStorageNum(qualityOrder.getStorageNum()); |
|
|
|
|
|
warehouseStorageOrder.setQualityTime(qualityOrder.getDeliveryInspectionTime()); |
|
|
|
|
|
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return warehouseStorageOrder; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质单详情生成退换货详情
|
|
|
|
|
|
public QualityRefundsExchangesDetail generateRefundsExchangesDetail(String refundsExchangesCode,QualityOrderDetail detail){ |
|
|
|
|
|
QualityRefundsExchangesDetail exchangesDetail = new QualityRefundsExchangesDetail(); |
|
|
|
|
|
exchangesDetail.setRefundsExchangesCode(refundsExchangesCode); |
|
|
|
|
|
exchangesDetail.setRefundsExchangesStatus("0"); |
|
|
|
|
|
exchangesDetail.setQualityWarehouseStatus("0"); |
|
|
|
|
|
exchangesDetail.setQualityPurchaseStatus("0"); |
|
|
|
|
|
exchangesDetail.setQualityDeliveryStatus("0"); |
|
|
|
|
|
exchangesDetail.setRelatedOrderCode(detail.getQualityOrderCode()); |
|
|
|
|
|
exchangesDetail.setInStorageCode("11"); |
|
|
|
|
|
exchangesDetail.setQualityWarehouseStatus(detail.getQualityStorageStatus()); |
|
|
|
|
|
exchangesDetail.setDeliveryInspectionTime(detail.getDeliveryInspectionTime()); |
|
|
|
|
|
exchangesDetail.setQualityReturnNode("0"); |
|
|
|
|
|
exchangesDetail.setMaterialNo(detail.getMaterialNo()); |
|
|
|
|
|
exchangesDetail.setMaterialName(detail.getMaterialName()); |
|
|
|
|
|
exchangesDetail.setMaterialType(detail.getMaterialType()); |
|
|
|
|
|
exchangesDetail.setMaterialBrand(detail.getMaterialBrand()); |
|
|
|
|
|
exchangesDetail.setMaterialPhotourl(detail.getMaterialPhotourl()); |
|
|
|
|
|
exchangesDetail.setMaterialBrand(detail.getMaterialBrand()); |
|
|
|
|
|
exchangesDetail.setMaterialProcessMethod(detail.getMaterialProcessMethod()); |
|
|
|
|
|
exchangesDetail.setMaterialUnit(detail.getMaterialUnit()); |
|
|
|
|
|
exchangesDetail.setRefundsExchangesNum(detail.getQualityUnqualifiedNum()); |
|
|
|
|
|
exchangesDetail.setQualityUnqualifiedNum(detail.getQualityUnqualifiedNum()); |
|
|
|
|
|
exchangesDetail.setSupplierCode(detail.getSupplierCode()); |
|
|
|
|
|
exchangesDetail.setSupplierName(detail.getSupplierName()); |
|
|
|
|
|
exchangesDetail.setSupplierAddress(detail.getSupplierAddress()); |
|
|
|
|
|
exchangesDetail.setCustomerContact(detail.getCustomerContact()); |
|
|
|
|
|
exchangesDetail.setContactNumber(detail.getContactNumber()); |
|
|
|
|
|
exchangesDetail.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
exchangesDetail.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return exchangesDetail; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质单详情生成退换货入库单详情
|
|
|
|
|
|
public WarehouseStorageOrderDetail generateWarehouseStorageOrderDetail(String warehouseStorageCode,String refundsExchangesCode,QualityOrderDetail detail){ |
|
|
|
|
|
WarehouseStorageOrderDetail storageOrderDetail = new WarehouseStorageOrderDetail(); |
|
|
|
|
|
storageOrderDetail.setWarehouseStorageCode(warehouseStorageCode); |
|
|
|
|
|
storageOrderDetail.setRelatedOrderCode(refundsExchangesCode); |
|
|
|
|
|
storageOrderDetail.setWarehouseStorageStatus("2"); |
|
|
|
|
|
storageOrderDetail.setWarehouseQualityStatus(detail.getQualityStatus()); |
|
|
|
|
|
storageOrderDetail.setWarehouseStorageType("3"); |
|
|
|
|
|
storageOrderDetail.setWarehouseOrderType("2"); |
|
|
|
|
|
storageOrderDetail.setWarehouseDeptType("1"); |
|
|
|
|
|
storageOrderDetail.setSupplierCode(detail.getSupplierCode()); |
|
|
|
|
|
storageOrderDetail.setSupplierName(detail.getSupplierName()); |
|
|
|
|
|
storageOrderDetail.setSupplierAddress(detail.getSupplierAddress()); |
|
|
|
|
|
storageOrderDetail.setCustomerContact(detail.getCustomerContact()); |
|
|
|
|
|
storageOrderDetail.setContactNumber(detail.getContactNumber()); |
|
|
|
|
|
storageOrderDetail.setMaterialNo(detail.getMaterialNo()); |
|
|
|
|
|
storageOrderDetail.setMaterialName(detail.getMaterialName()); |
|
|
|
|
|
storageOrderDetail.setMaterialType(detail.getMaterialType()); |
|
|
|
|
|
storageOrderDetail.setMaterialBrand(detail.getMaterialBrand()); |
|
|
|
|
|
storageOrderDetail.setMaterialPhotourl(detail.getMaterialPhotourl()); |
|
|
|
|
|
storageOrderDetail.setMaterialBrand(detail.getMaterialBrand()); |
|
|
|
|
|
storageOrderDetail.setMaterialProcessMethod(detail.getMaterialProcessMethod()); |
|
|
|
|
|
storageOrderDetail.setMaterialUnit(detail.getMaterialUnit()); |
|
|
|
|
|
storageOrderDetail.setMakeTotal(detail.getMakeTotal()); |
|
|
|
|
|
storageOrderDetail.setActualArriveNum(detail.getActualArriveNum()); |
|
|
|
|
|
storageOrderDetail.setQualityQualifiedNum(detail.getQualityQualifiedNum()); |
|
|
|
|
|
storageOrderDetail.setQualityHasQualifiedNum(detail.getQualityHasqualifiedNum()); |
|
|
|
|
|
storageOrderDetail.setRefundsExchangesNum(detail.getQualityUnqualifiedNum()); |
|
|
|
|
|
storageOrderDetail.setDeliveryInspectionTime(detail.getDeliveryInspectionTime()); |
|
|
|
|
|
storageOrderDetail.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
storageOrderDetail.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return storageOrderDetail; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据品质单详情和品质报告生成退换货报告
|
|
|
|
|
|
public QualityRefundsExchangesOrder generateQualityRefundsExchangesOrder(String refundsExchangesCode,QualityOrderReport qualityReport,QualityOrderDetail detail){ |
|
|
|
|
|
QualityRefundsExchangesOrder exchangesOrder = new QualityRefundsExchangesOrder(); |
|
|
|
|
|
exchangesOrder.setRefundsExchangesCode(refundsExchangesCode); |
|
|
|
|
|
exchangesOrder.setSupplierCode(detail.getSupplierCode()); |
|
|
|
|
|
exchangesOrder.setSupplierName(detail.getSupplierName()); |
|
|
|
|
|
exchangesOrder.setMaterialNo(detail.getMaterialNo()); |
|
|
|
|
|
exchangesOrder.setMaterialName(detail.getMaterialName()); |
|
|
|
|
|
exchangesOrder.setMakeTotal(detail.getMakeTotal()); |
|
|
|
|
|
exchangesOrder.setQualityHasqualifiedNum(detail.getQualityHasqualifiedNum()); |
|
|
|
|
|
exchangesOrder.setOkAcceptedNum(qualityReport.getOkAcceptedNum()); |
|
|
|
|
|
exchangesOrder.setOkReportUrl(qualityReport.getOkReportUrl()); |
|
|
|
|
|
exchangesOrder.setSpecialConcessionsNum(qualityReport.getSpecialConcessionsNum()); |
|
|
|
|
|
exchangesOrder.setSpecialReportUrl(qualityReport.getSpecialReportUrl()); |
|
|
|
|
|
exchangesOrder.setCheckoutCompletionTime(qualityReport.getCheckoutCompletionTime()); |
|
|
|
|
|
exchangesOrder.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
exchangesOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return exchangesOrder; |
|
|
|
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 删除品质管理品质单对象 |
|
|
* 删除品质管理品质单对象 |
|
|
* |
|
|
* |
|
|