|
@ -1,5 +1,6 @@ |
|
|
package com.ruoyi.warehouse.service.impl; |
|
|
package com.ruoyi.warehouse.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.text.DecimalFormat; |
|
|
import java.text.DecimalFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -10,7 +11,12 @@ import com.ruoyi.common.exception.BusinessException; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
|
|
import com.ruoyi.erp.domain.ErpMaterialVo; |
|
|
|
|
|
import com.ruoyi.system.domain.SysMakeorderBom; |
|
|
|
|
|
import com.ruoyi.system.mapper.SysMakeorderBomMapper; |
|
|
|
|
|
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO; |
|
|
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild; |
|
|
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild; |
|
|
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseInventoryReportDamageChildMapper; |
|
|
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService; |
|
|
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -35,6 +41,11 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IWarehouseInventoryReportDamageChildService warehouseInventoryReportDamageChildService; |
|
|
private IWarehouseInventoryReportDamageChildService warehouseInventoryReportDamageChildService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WarehouseInventoryReportDamageChildMapper damageChildMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysMakeorderBomMapper sysMakeorderBomMapper; |
|
|
/** |
|
|
/** |
|
|
* 查询仓库库存报损 |
|
|
* 查询仓库库存报损 |
|
|
* |
|
|
* |
|
@ -44,7 +55,12 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve |
|
|
@Override |
|
|
@Override |
|
|
public WarehouseInventoryReportDamage selectWarehouseInventoryReportDamageById(Long reportDamageId) |
|
|
public WarehouseInventoryReportDamage selectWarehouseInventoryReportDamageById(Long reportDamageId) |
|
|
{ |
|
|
{ |
|
|
return warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId); |
|
|
WarehouseInventoryReportDamage warehouseInventoryReportDamage = warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId); |
|
|
|
|
|
List<WarehouseInventoryReportDamageChild> reportDamageChildList = damageChildMapper.selectWarehouseInventoryReportDamageChildByCode(warehouseInventoryReportDamage.getReportDamageCode()); |
|
|
|
|
|
if(StringUtils.isNotEmpty(reportDamageChildList)){ |
|
|
|
|
|
warehouseInventoryReportDamage.setWarehouseInventoryReportDamageChildList(reportDamageChildList); |
|
|
|
|
|
} |
|
|
|
|
|
return warehouseInventoryReportDamage; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -79,11 +95,14 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve |
|
|
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate()); |
|
|
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate()); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
warehouseInventoryReportDamage.setCreateBy(loginName); |
|
|
warehouseInventoryReportDamage.setCreateBy(loginName); |
|
|
|
|
|
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
BigDecimal sumTotal = BigDecimal.ZERO; |
|
|
//报损子表数据
|
|
|
//报损子表数据
|
|
|
//判断子表数据是否为空
|
|
|
//判断子表数据是否为空
|
|
|
if(StringUtils.isNotEmpty(warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList())){ |
|
|
if(StringUtils.isNotEmpty(warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList())){ |
|
|
for(WarehouseInventoryReportDamageChild warehouseInventoryReportDamageChild:warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList()) { |
|
|
for(WarehouseInventoryReportDamageChild warehouseInventoryReportDamageChild:warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList()) { |
|
|
//子表数据不为空,则插入子表数据
|
|
|
//子表数据不为空,则插入子表数据
|
|
|
|
|
|
sumTotal = sumTotal.add(warehouseInventoryReportDamageChild.getActualScrapQuantity()); |
|
|
warehouseInventoryReportDamageChild.setMakeNo(warehouseInventoryReportDamage.getMakeNo()); |
|
|
warehouseInventoryReportDamageChild.setMakeNo(warehouseInventoryReportDamage.getMakeNo()); |
|
|
warehouseInventoryReportDamageChild.setReportDamageCode(newCode); |
|
|
warehouseInventoryReportDamageChild.setReportDamageCode(newCode); |
|
|
warehouseInventoryReportDamageChild.setCreateTime(DateUtils.getNowDate()); |
|
|
warehouseInventoryReportDamageChild.setCreateTime(DateUtils.getNowDate()); |
|
@ -99,6 +118,7 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve |
|
|
//子表数据为空,则抛出异常
|
|
|
//子表数据为空,则抛出异常
|
|
|
throw new BusinessException("报损子表数据为空"); |
|
|
throw new BusinessException("报损子表数据为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
warehouseInventoryReportDamage.setNumTotal(sumTotal); |
|
|
return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage); |
|
|
return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -195,6 +215,24 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve |
|
|
return warehouseInventoryReportDamageMapper.restoreWarehouseInventoryReportDamageById(reportDamageId); |
|
|
return warehouseInventoryReportDamageMapper.restoreWarehouseInventoryReportDamageById(reportDamageId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<WarehouseMaterialVO> getMaterialListByMakeNo(String makeNo) { |
|
|
|
|
|
List<WarehouseMaterialVO> warehouseMaterialVOS = new ArrayList<>(); |
|
|
|
|
|
List<SysMakeorderBom> makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo); |
|
|
|
|
|
for (SysMakeorderBom makeorderBom : makeorderBoms) { |
|
|
|
|
|
WarehouseMaterialVO warehouseMaterialVO = new WarehouseMaterialVO(); |
|
|
|
|
|
warehouseMaterialVO.setMaterialNo(makeorderBom.getMaterialNo()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialName(makeorderBom.getMaterialName()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialDescribe(makeorderBom.getDescribe()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialUnit(makeorderBom.getUnit()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialType(makeorderBom.getMaterialType()); |
|
|
|
|
|
warehouseMaterialVO.setProcessMethod(makeorderBom.getProcessMethod()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialBrand(makeorderBom.getBrand()); |
|
|
|
|
|
warehouseMaterialVO.setMaterialphotoUrl(makeorderBom.getPhotoUrl()); |
|
|
|
|
|
warehouseMaterialVOS.add(warehouseMaterialVO); |
|
|
|
|
|
} |
|
|
|
|
|
return warehouseMaterialVOS; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
*报损单号生产规则 |
|
|
*报损单号生产规则 |
|
|