|
@ -19,9 +19,11 @@ import com.ruoyi.purchase.service.IPurchasePlanService; |
|
|
import com.ruoyi.quality.domain.QualityOrder; |
|
|
import com.ruoyi.quality.domain.QualityOrder; |
|
|
import com.ruoyi.quality.domain.QualityOrderDetail; |
|
|
import com.ruoyi.quality.domain.QualityOrderDetail; |
|
|
import com.ruoyi.quality.domain.QualityOrderReport; |
|
|
import com.ruoyi.quality.domain.QualityOrderReport; |
|
|
|
|
|
import com.ruoyi.quality.domain.QualityShippingDevice; |
|
|
import com.ruoyi.quality.mapper.QualityOrderDetailMapper; |
|
|
import com.ruoyi.quality.mapper.QualityOrderDetailMapper; |
|
|
import com.ruoyi.quality.mapper.QualityOrderMapper; |
|
|
import com.ruoyi.quality.mapper.QualityOrderMapper; |
|
|
import com.ruoyi.quality.mapper.QualityOrderReportMapper; |
|
|
import com.ruoyi.quality.mapper.QualityOrderReportMapper; |
|
|
|
|
|
import com.ruoyi.quality.mapper.QualityShippingDeviceMapper; |
|
|
import com.ruoyi.system.domain.*; |
|
|
import com.ruoyi.system.domain.*; |
|
|
import com.ruoyi.system.dto.SysEquipDetailDto; |
|
|
import com.ruoyi.system.dto.SysEquipDetailDto; |
|
|
import com.ruoyi.system.dto.SysEquipMaterialDto; |
|
|
import com.ruoyi.system.dto.SysEquipMaterialDto; |
|
@ -107,6 +109,9 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ErpMaterialMapper erpMaterialMapper; |
|
|
private ErpMaterialMapper erpMaterialMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private QualityShippingDeviceMapper qualityDeviceMapper; |
|
|
/** |
|
|
/** |
|
|
* 查询生产订单 |
|
|
* 查询生产订单 |
|
|
* |
|
|
* |
|
@ -259,7 +264,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); |
|
|
makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); |
|
|
makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber()); |
|
|
makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber()); |
|
|
//这里需要注意一下类型
|
|
|
//这里需要注意一下类型
|
|
|
//makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum());
|
|
|
makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum()); |
|
|
makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum())); |
|
|
makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum())); |
|
|
String makeNo = redisCache.generateBillNo("PO"); |
|
|
String makeNo = redisCache.generateBillNo("PO"); |
|
|
makeOrder.setMakeNo(makeNo); |
|
|
makeOrder.setMakeNo(makeNo); |
|
@ -589,6 +594,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
@Override |
|
|
@Override |
|
|
public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) { |
|
|
public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) { |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
|
|
String makeNo = erpInboundOrder.getMakeNo(); |
|
|
erpInboundOrder.setCreateBy(loginName); |
|
|
erpInboundOrder.setCreateBy(loginName); |
|
|
erpInboundOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
erpInboundOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails(); |
|
|
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails(); |
|
@ -601,36 +607,91 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
throw new BusinessException("本次完成数不能全为0"); |
|
|
throw new BusinessException("本次完成数不能全为0"); |
|
|
} |
|
|
} |
|
|
for (ErpInboundOrderDetail inboundDetail:inboundDetails) { |
|
|
for (ErpInboundOrderDetail inboundDetail:inboundDetails) { |
|
|
|
|
|
//获取物料信息
|
|
|
|
|
|
String materialNo = inboundDetail.getMaterialNo(); |
|
|
|
|
|
SysMakeorderBom tempOrderBom = new SysMakeorderBom(); |
|
|
|
|
|
tempOrderBom.setMaterialNo(materialNo); |
|
|
|
|
|
tempOrderBom.setMakeNo(makeNo); |
|
|
|
|
|
SysMakeorderBom makeorderBom = makeorderBomMapper.selectSysMakeorderBomByNo(tempOrderBom); |
|
|
|
|
|
//生成并新增品质单
|
|
|
String qualityOrderCode = redisCache.generateBillNo("PZ"); |
|
|
String qualityOrderCode = redisCache.generateBillNo("PZ"); |
|
|
QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder, loginName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int orderDetailResult = generateQualityOrderDetail(qualityOrderCode,makeorderBom,inboundDetail.getCurrentNum()); |
|
|
|
|
|
if(orderDetailResult<=0){ |
|
|
|
|
|
throw new BusinessException("新增品质单详情失败!"); |
|
|
|
|
|
} |
|
|
|
|
|
QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder.getMakeNo(), loginName); |
|
|
|
|
|
qualityOrder.setMaterialNo(makeorderBom.getMaterialNo()); |
|
|
|
|
|
qualityOrder.setMaterialName(makeorderBom.getMaterialName()); |
|
|
|
|
|
qualityOrder.setThisArrivedNum(inboundDetail.getCurrentNum()); |
|
|
result += qualityOrderMapper.insertQualityOrder(qualityOrder); |
|
|
result += qualityOrderMapper.insertQualityOrder(qualityOrder); |
|
|
|
|
|
|
|
|
|
|
|
//根据出货设备生成品质单关联出货设备,并更新出货设备品质状态
|
|
|
List<AfterSalesShippingDevice> deviceList = inboundDetail.getSalesShippingDeviceList(); |
|
|
List<AfterSalesShippingDevice> deviceList = inboundDetail.getSalesShippingDeviceList(); |
|
|
if(StringUtils.isNotEmpty(deviceList)){ |
|
|
if(StringUtils.isNotEmpty(deviceList)){ |
|
|
for (AfterSalesShippingDevice device:deviceList) { |
|
|
for (AfterSalesShippingDevice device:deviceList) { |
|
|
|
|
|
QualityShippingDevice qualityDevice = generateQualityShippingDevice(qualityOrderCode,device); |
|
|
|
|
|
int insertDeviceResult = qualityDeviceMapper.insertQualityShippingDevice(qualityDevice); |
|
|
|
|
|
if(insertDeviceResult<=0){ |
|
|
|
|
|
throw new BusinessException("添加品质单关联设备"+qualityDevice.getShippingDeviceId()+"失败"); |
|
|
|
|
|
} |
|
|
device.setQualityStatus("1");//待品质
|
|
|
device.setQualityStatus("1");//待品质
|
|
|
afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(device); |
|
|
afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(device); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//品质报告单审核通过后再更新已完成数
|
|
|
|
|
|
// SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(erpInboundOrder.getMakeNo());
|
|
|
|
|
|
// long hasFinished = sysMakeOrder.getFinishNum();
|
|
|
|
|
|
// finishNum += hasFinished;
|
|
|
|
|
|
// sysMakeOrder.setFinishNum(finishNum);
|
|
|
|
|
|
// int updateSysMakeOrderResult = sysMakeOrderMapper.updateSysMakeOrder(sysMakeOrder);
|
|
|
|
|
|
// if (updateSysMakeOrderResult <= 0){
|
|
|
|
|
|
// throw new BusinessException("更新生产订单失败");
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private QualityOrder createQualityOrder(String code, ErpInboundOrder erpInboundOrder, String loginName) { |
|
|
//根据售后出货设备生成品质单关联设备
|
|
|
|
|
|
private QualityShippingDevice generateQualityShippingDevice(String qualityOrderCode,AfterSalesShippingDevice shippingDevice){ |
|
|
|
|
|
QualityShippingDevice qualityDevice = new QualityShippingDevice(); |
|
|
|
|
|
qualityDevice.setShippingDeviceId(shippingDevice.getShippingDeviceId()); |
|
|
|
|
|
qualityDevice.setMakeNo(shippingDevice.getMakeNo()); |
|
|
|
|
|
qualityDevice.setQualityAuditStatus("0"); |
|
|
|
|
|
qualityDevice.setQualityStatus("0"); |
|
|
|
|
|
qualityDevice.setDeviceModelCode(shippingDevice.getDeviceModelCode()); |
|
|
|
|
|
qualityDevice.setDeviceRunningNumber(shippingDevice.getDeviceRunningNumber()); |
|
|
|
|
|
qualityDevice.setSalesOrderCode(shippingDevice.getSalesOrderCode()); |
|
|
|
|
|
qualityDevice.setMaterialNo(shippingDevice.getMaterialNo()); |
|
|
|
|
|
qualityDevice.setMaterialName(shippingDevice.getMaterialName()); |
|
|
|
|
|
qualityDevice.setMaterialType(shippingDevice.getMaterialType()); |
|
|
|
|
|
qualityDevice.setMaterialBrand(shippingDevice.getMaterialBrand()); |
|
|
|
|
|
qualityDevice.setMaterialUnit(shippingDevice.getMaterialUnit()); |
|
|
|
|
|
qualityDevice.setMaterialDescribe(shippingDevice.getMaterialDescribe()); |
|
|
|
|
|
qualityDevice.setQualityOrderCode(qualityOrderCode); |
|
|
|
|
|
return qualityDevice; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//根据生产订单bom生成品质单详情
|
|
|
|
|
|
private int generateQualityOrderDetail(String qualityOrderCode,SysMakeorderBom makeorderBom,int checkNum){ |
|
|
|
|
|
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); |
|
|
|
|
|
qualityOrderDetail.setQualityOrderCode(qualityOrderCode); |
|
|
|
|
|
qualityOrderDetail.setMaterialNo(makeorderBom.getMaterialNo()); |
|
|
|
|
|
qualityOrderDetail.setMaterialName(makeorderBom.getMaterialName()); |
|
|
|
|
|
qualityOrderDetail.setMaterialType(makeorderBom.getMaterialType()); |
|
|
|
|
|
qualityOrderDetail.setMaterialBrand(makeorderBom.getBrand()); |
|
|
|
|
|
qualityOrderDetail.setMaterialUnit(makeorderBom.getUnit()); |
|
|
|
|
|
qualityOrderDetail.setMaterialPhotourl(makeorderBom.getPhotoUrl()); |
|
|
|
|
|
qualityOrderDetail.setMaterialDescribe(makeorderBom.getDescribe()); |
|
|
|
|
|
qualityOrderDetail.setMaterialModel(makeorderBom.getMaterialModel()); |
|
|
|
|
|
qualityOrderDetail.setMaterialProcessMethod(makeorderBom.getProcessMethod()); |
|
|
|
|
|
qualityOrderDetail.setCheckNum(checkNum); |
|
|
|
|
|
qualityOrderDetail.setMakeTotal(makeorderBom.getOrderNum()); |
|
|
|
|
|
qualityOrderDetail.setQualityStatus("0"); |
|
|
|
|
|
qualityOrderDetail.setQualityStorageStatus("4"); |
|
|
|
|
|
qualityOrderDetail.setQualityOrderType("1"); |
|
|
|
|
|
qualityOrderDetail.setRelatedOrderCode(makeorderBom.getMakeNo()); |
|
|
|
|
|
qualityOrderDetail.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
qualityOrderDetail.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
return orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private QualityOrder createQualityOrder(String code, String makeNo, String loginName) { |
|
|
QualityOrder qualityOrder = new QualityOrder(); |
|
|
QualityOrder qualityOrder = new QualityOrder(); |
|
|
qualityOrder.setQualityOrderCode(code); |
|
|
qualityOrder.setQualityOrderCode(code); |
|
|
qualityOrder.setRelatedOrderCode(erpInboundOrder.getMakeNo()); |
|
|
qualityOrder.setRelatedOrderCode(makeNo); |
|
|
qualityOrder.setQualityStatus("0"); |
|
|
qualityOrder.setQualityStatus("0"); |
|
|
qualityOrder.setQualityStorageStatus("4"); |
|
|
qualityOrder.setQualityStorageStatus("4"); |
|
|
qualityOrder.setQualityOrderType("1"); |
|
|
qualityOrder.setQualityOrderType("1"); |
|
@ -682,20 +743,6 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
return qualityOrderDetail; |
|
|
return qualityOrderDetail; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//添加品质单报告数据
|
|
|
|
|
|
private void addQualityOrderReports(QualityOrder qualityOrder, ErpInboundOrder erpInboundOrder, Map<String, SysSalesOrderChild> materialInfoMap) { |
|
|
|
|
|
|
|
|
|
|
|
for (ErpInboundOrderDetail detail : erpInboundOrder.getInboundDetails()) { |
|
|
|
|
|
SysSalesOrderChild salesOrderChild = materialInfoMap.get(detail.getMaterialNo()); |
|
|
|
|
|
QualityOrderReport qualityOrderReport = createQualityOrderReport(qualityOrder, detail, salesOrderChild); |
|
|
|
|
|
int result = orderReportMapper.insertQualityOrderReport(qualityOrderReport); |
|
|
|
|
|
if (result <= 0) { |
|
|
|
|
|
throw new BusinessException("新增品质单报告失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) { |
|
|
private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) { |
|
|
QualityOrderReport qualityOrderReport = new QualityOrderReport(); |
|
|
QualityOrderReport qualityOrderReport = new QualityOrderReport(); |
|
|
|
|
|
|
|
|