|
@@ -10,6 +10,7 @@ import com.dayou.service.IAssetsProductionService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dayou.service.IBusinessProductionService;
|
|
|
import com.dayou.service.IOrderFundService;
|
|
|
+import com.dayou.service.IProductionOutWarehouseService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -27,6 +28,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.ArrayList;
|
|
|
|
|
@@ -56,6 +58,9 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
@Autowired
|
|
|
private IOrderFundService orderFundService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IProductionOutWarehouseService productionOutWarehouseService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据资产业务id查询资产业务产品
|
|
|
*
|
|
@@ -126,7 +131,7 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
public Boolean writeAssetsProduction(AssetsProduction assetsProduction) {
|
|
|
int count = this.count(new LambdaQueryWrapper<AssetsProduction>().select(AssetsProduction::getCreateProductionDate).eq(AssetsProduction::getProductionNo, assetsProduction.getProductionNo())
|
|
|
.eq(AssetsProduction::getId, assetsProduction.getId()));
|
|
|
- if (count > 0){
|
|
|
+ if (count > 0) {
|
|
|
return null;
|
|
|
}
|
|
|
// 生成产品二维码
|
|
@@ -136,6 +141,7 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
|
|
|
/**
|
|
|
* 根据业务id与产品号获取资产产品详细信息
|
|
|
+ *
|
|
|
* @param dto 查询dto
|
|
|
* @return AssetsProduction
|
|
|
*/
|
|
@@ -146,6 +152,7 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
|
|
|
/**
|
|
|
* 根据业务id与产品号查询产品信息
|
|
|
+ *
|
|
|
* @param aProListSelectDTO 查询dto
|
|
|
* @return List<AssetsProduction>
|
|
|
*/
|
|
@@ -156,6 +163,7 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
|
|
|
/**
|
|
|
* 根据业务id与产品号查询该产品是否已有提交的流程实例信息
|
|
|
+ *
|
|
|
* @param aProListSelectDTO 查询dto
|
|
|
* @return Integer
|
|
|
*/
|
|
@@ -166,49 +174,68 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
|
|
|
/**
|
|
|
* 产品出入库
|
|
|
+ *
|
|
|
* @param wareHouseDTO 出入库信息dto
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
@Override
|
|
|
public Boolean assetsProRepertory(AssetsProWareHouseDTO wareHouseDTO) {
|
|
|
AssetsProduction assetsProduction = this.getOne(new LambdaQueryWrapper<AssetsProduction>()
|
|
|
- .select(BaseEntity::getId,AssetsProduction::getRepertoryState,
|
|
|
+ .select(BaseEntity::getId, AssetsProduction::getRepertoryState,
|
|
|
AssetsProduction::getProductionNo,
|
|
|
AssetsProduction::getBusinessId,
|
|
|
AssetsProduction::getProductionType)
|
|
|
- .eq(BaseEntity::getId,wareHouseDTO.getProductionId())
|
|
|
+ .eq(BaseEntity::getId, wareHouseDTO.getProductionId())
|
|
|
.eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
- if (ObjectUtil.isNull(assetsProduction)){
|
|
|
+ if (ObjectUtil.isNull(assetsProduction)) {
|
|
|
ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品不存在,操作失败。");
|
|
|
} else if (!assetsProduction.getProductionNo().equals(wareHouseDTO.getProductionNo())) {
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "出库的产品报告号与当前操作的产品报告号不一致,请检查。");
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "操作的产品报告号与当前操作的产品报告号不一致,请检查。");
|
|
|
} else if (!assetsProduction.getProductionType().equals(wareHouseDTO.getProductionType())) {
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "出库的产品类型与当前操作的产品类型不符,请检查。");
|
|
|
- }
|
|
|
-
|
|
|
- // true出库,false入库
|
|
|
- if (wareHouseDTO.getRepertoryState()){ // 出库
|
|
|
- if (ObjectUtil.isNull(assetsProduction.getRepertoryState())){
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还未入库,无法出库。");
|
|
|
- } else if (assetsProduction.getRepertoryState()) {
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还已出库,无需出库。");
|
|
|
- }
|
|
|
- OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>()
|
|
|
- .select(BaseEntity::getId,OrderFund::getRealAmount)
|
|
|
- .eq(OrderFund::getBusinessId,wareHouseDTO.getBusinessId())
|
|
|
- .eq(OrderFund::getBusinessType,ASSET_BUSINESS.getCode()));
|
|
|
- // 非意见书,且实收款未认领(订单实收款为NULL)
|
|
|
- if (!assetsProduction.getProductionType().equals(STATEMENT.name()) && ObjectUtil.isNull(orderFund)){
|
|
|
- // 判断出库审核是否通过
|
|
|
- if (true){ // 不通过提示
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "不满足出库条件,该产品需客户经理申请产品出库通过后方可出库。");
|
|
|
- }else { // 通过则出库
|
|
|
-
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "操作的产品类型与当前操作的产品类型不符,请检查。");
|
|
|
+ } else {
|
|
|
+ // true出库,false入库
|
|
|
+ if (wareHouseDTO.getRepertoryState()) { // 出库
|
|
|
+ if (ObjectUtil.isNull(assetsProduction.getRepertoryState())) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还未入库,无法出库。");
|
|
|
+ } else if (assetsProduction.getRepertoryState()) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还已出库,无需出库。");
|
|
|
}
|
|
|
- }else { // 意见书可以直接出库
|
|
|
-
|
|
|
+ OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>()
|
|
|
+ .select(BaseEntity::getId, OrderFund::getRealAmount)
|
|
|
+ .eq(OrderFund::getBusinessId, wareHouseDTO.getBusinessId())
|
|
|
+ .eq(OrderFund::getBusinessType, ASSET_BUSINESS.getCode()));
|
|
|
+ // 非意见书,且实收款未认领(订单实收款为NULL)
|
|
|
+ if (!assetsProduction.getProductionType().equals(STATEMENT.name()) && ObjectUtil.isNull(orderFund)) {
|
|
|
+ ProductionOutWarehouse productionOutWarehouse = productionOutWarehouseService.getOne(new LambdaQueryWrapper<ProductionOutWarehouse>()
|
|
|
+ .select(BaseEntity::getId, ProductionOutWarehouse::getDepartmentCheckState)
|
|
|
+ .eq(ProductionOutWarehouse::getProductionId, wareHouseDTO.getProductionId())
|
|
|
+ .eq(ProductionOutWarehouse::getReportNo, wareHouseDTO.getProductionNo()));
|
|
|
+ // 判断出库审核是否通过
|
|
|
+ if (ObjectUtil.isNull(productionOutWarehouse) && !productionOutWarehouse.getDepartmentCheckState().equals("审核通过")) { // 不通过提示
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "不满足出库条件,该产品需客户经理申请产品出库通过后方可出库。");
|
|
|
+ } else { // 通过则出库
|
|
|
+ return this.update(new LambdaUpdateWrapper<AssetsProduction>()
|
|
|
+ .set(AssetsProduction::getRepertoryState, 1)
|
|
|
+ .set(AssetsProduction::getRepertoryOutTime, new Date())
|
|
|
+ .eq(BaseEntity::getId, wareHouseDTO.getProductionId())
|
|
|
+ .eq(AssetsProduction::getProductionNo, wareHouseDTO.getProductionNo()));
|
|
|
+ }
|
|
|
+ } else { // 意见书可以直接出库
|
|
|
+ return this.update(new LambdaUpdateWrapper<AssetsProduction>()
|
|
|
+ .set(AssetsProduction::getRepertoryState, 1)
|
|
|
+ .set(AssetsProduction::getRepertoryInTime, new Date())
|
|
|
+ .eq(BaseEntity::getId, wareHouseDTO.getProductionId())
|
|
|
+ .eq(AssetsProduction::getProductionNo, wareHouseDTO.getProductionNo()));
|
|
|
+ }
|
|
|
+ } else { // 入库
|
|
|
+ return this.update(new LambdaUpdateWrapper<AssetsProduction>()
|
|
|
+ .set(AssetsProduction::getRepertoryState, 0)
|
|
|
+ .set(AssetsProduction::getRepertoryInTime, new Date())
|
|
|
+ .eq(BaseEntity::getId, wareHouseDTO.getProductionId())
|
|
|
+ .eq(AssetsProduction::getProductionNo, wareHouseDTO.getProductionNo()));
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return Boolean.FALSE;
|
|
|
}
|
|
|
}
|