Browse Source

[feat]

品质管理 制程检验
修改制程检验service新增接口,补全插入数据库对象缺失字段;
dev
王晓迪 3 months ago
parent
commit
95ed223784
  1. 56
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java

56
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java

@ -12,11 +12,9 @@ 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.QualityManufacturingCheckoutMaterial;
import com.ruoyi.quality.domain.QualityManufacturingProcess;
import com.ruoyi.quality.domain.*;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
import com.ruoyi.quality.mapper.QualityManufacturingCheckoutMaterialMapper;
import com.ruoyi.quality.mapper.QualityManufacturingProcessMapper;
import com.ruoyi.quality.mapper.*;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysSalesOrderChild;
@ -26,8 +24,6 @@ import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualityManufacturingCheckoutMapper;
import com.ruoyi.quality.domain.QualityManufacturingCheckout;
import com.ruoyi.quality.service.IQualityManufacturingCheckoutService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
@ -59,6 +55,13 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
@Autowired
private SysSalesOrderChildMapper sysSalesOrderChildMapper;
@Autowired
private QualityManufacturingMaterialProcessMapper materialProcessMapper;
@Autowired
private QualityManufacturingUnqualifiedClassMapper unqualifiedClassMapper;
/**
* 查询品质管理制程检验
*
@ -96,7 +99,7 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
String loginName = ShiroUtils.getLoginName();
//格式化日期格式
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String formatDate = df.format(new Date());
String formatDate = df.format(DateUtils.getNowDate());
//去除多余的 - 时间格式转换为yyyyMMdd
String prefix = "ZCJY" +formatDate.replace("-", "");
@ -104,21 +107,54 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
//查询数据库中当前最大的编号
String maxCode = qualityManufacturingCheckoutMapper.findMaxRoundCode(prefix);
String newCode = generateNewCode(prefix, maxCode);
int numTotal = 0;
int processQualifiedNum = 0;
int processUnqualifiedNum = 0;
qualityManufacturingCheckout.setManufacturingCheckoutCode(newCode);
List<QualityManufacturingCheckoutMaterial> checkoutMaterialList = qualityManufacturingCheckout.getCheckoutMaterialList();
if (StringUtils.isEmpty(checkoutMaterialList)){
log.warn("与生产订单号有关的物料数据为空:{}",qualityManufacturingCheckout.getCheckoutMaterialList());
}
for (QualityManufacturingCheckoutMaterial qualityManufacturingCheckoutMaterial : checkoutMaterialList) {
numTotal += qualityManufacturingCheckoutMaterial.getCurrentCheckoutNum();
processQualifiedNum += qualityManufacturingCheckoutMaterial.getProcessQualifiedNum();
processUnqualifiedNum += qualityManufacturingCheckoutMaterial.getProcessUnqualifiedNum();
qualityManufacturingCheckoutMaterial.setMakeNo(qualityManufacturingCheckout.getMakeNo());
qualityManufacturingCheckoutMaterial.setManufacturingCheckoutCode(newCode);
qualityManufacturingCheckoutMaterial.setCreateBy(loginName);
qualityManufacturingCheckoutMaterial.setCreateTime(new Date());
qualityManufacturingCheckoutMaterial.setCreateTime(DateUtils.getNowDate());
qualityManufacturingCheckoutMaterial.setCheckoutTime(qualityManufacturingCheckout.getCheckoutTime());
List<QualityManufacturingMaterialProcess> materialProcessList = qualityManufacturingCheckoutMaterial.getMaterialProcessList();
if (StringUtils.isEmpty(materialProcessList)){
log.warn("与生产订单号有关的物料数据为空:{}",qualityManufacturingCheckout.getCheckoutMaterialList());
}else{
for (QualityManufacturingMaterialProcess process:materialProcessList) {
process.setManufacturingCheckoutCode(newCode);
process.setCreateBy(loginName);
process.setCreateTime(DateUtils.getNowDate());
List<QualityManufacturingUnqualifiedClass> unqualifiedClassList = process.getUnqualifiedClassList();
if (StringUtils.isEmpty(unqualifiedClassList)){
log.warn("与生产订单号有关的物料数据为空:{}",qualityManufacturingCheckout.getCheckoutMaterialList());
}else{
for (QualityManufacturingUnqualifiedClass unqualified:unqualifiedClassList) {
unqualified.setManufacturingCheckoutCode(newCode);
unqualified.setManufacturingProcessCode(process.getManufacturingProcessCode());
unqualified.setManufacturingProcessName(process.getManufacturingProcessName());
unqualified.setCreateBy(loginName);
unqualified.setCreateTime(DateUtils.getNowDate());
unqualifiedClassMapper.insertQualityManufacturingUnqualifiedClass(unqualified);
}
}
materialProcessMapper.insertQualityManufacturingMaterialProcess(process);
}
}
checkoutMaterialMapper.insertQualityManufacturingCheckoutMaterial(qualityManufacturingCheckoutMaterial);
}
qualityManufacturingCheckout.setMaterialTotal(checkoutMaterialList.size());
qualityManufacturingCheckout.setNumTotal(numTotal);
qualityManufacturingCheckout.setProcessQualifiedNum(processQualifiedNum);
qualityManufacturingCheckout.setProcessUnqualifiedNum(processUnqualifiedNum);
qualityManufacturingCheckout.setCreateBy(loginName);
qualityManufacturingCheckout.setCreateTime(DateUtils.getNowDate());
return qualityManufacturingCheckoutMapper.insertQualityManufacturingCheckout(qualityManufacturingCheckout);
@ -277,7 +313,7 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
checkoutMaterial.setMaterialNo(materialNo);
checkoutMaterial.setMaterialName(sysSalesOrderChild.getMaterialName());
checkoutMaterial.setMakeTotal(sysSalesOrderChild.getMaterialNum().toString());
checkoutMaterial.setMakeTotal(sysSalesOrderChild.getMaterialNum());
return checkoutMaterial;
}

Loading…
Cancel
Save