This commit is contained in:
PQZ 2024-10-26 11:03:28 +08:00
parent e3607bed22
commit aba04b4c91
4 changed files with 22 additions and 18 deletions

View File

@ -1,15 +1,12 @@
package cn.iocoder.yudao.module.project.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 维修配件库
@ -49,7 +46,11 @@ public class RepairWares extends TenantBaseDO {
/**
* 销售价格
*/
private String price;
private BigDecimal price;
/**
* 销售价格
*/
private BigDecimal purPrice;
/**
* 所属分类
*/
@ -102,7 +103,5 @@ public class RepairWares extends TenantBaseDO {
private String status;
/**数据来源*/
private String dataForm;
/** 进价 */
private String purPrice;
}

View File

@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
* @date 9:13 2024/9/13
**/
@RestController
@RequestMapping("/repair/so")
@RequestMapping("/repair/so/page")
public class DlRepairSoController {
/**
* 服务对象

View File

@ -108,9 +108,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date());
//保存供应商
if (repairSoRespVO.getSupplierId() == null){
if (repairSoRespVO.getSupplierId() == null) {
//采购单中录入供应商或无供应商情况
if (StringUtils.isNotEmpty(repairSoRespVO.getSupplierName())){
if (StringUtils.isNotEmpty(repairSoRespVO.getSupplierName())) {
//没有选择直接录入的情况
String supplierId = supplierService.appSaveSupplier(repairSoRespVO.getSupplierName());
//为供应商id赋值
@ -159,7 +159,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
wares.setId(item.getId());
wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count));
// 更新进价
wares.setPurPrice(repairSoi.getGoodsPrice().toString());
wares.setPurPrice(repairSoi.getGoodsPrice());
return wares;
}).collect(Collectors.toList());
waresService.updateBatchById(newWares);
@ -469,7 +469,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
inWares.setInCount(filterSoi.getInCount());
inWares.setId(null);
//采购品中入库数量字段累加
item.setInCount(item.getInCount() == null?0:item.getInCount()+filterSoi.getInCount());
item.setInCount(item.getInCount() == null ? 0 : item.getInCount() + filterSoi.getInCount());
inWaresList.add(inWares);
});
//更新采购品
@ -478,15 +478,20 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
repairSoiService.saveBatch(inWaresList);
/*4、原始配件库处理*/
//入库配件按照原始配件库id分组目的取出数量
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getWareId, soi -> soi));
//采购配件按照按照原始配件库id分组目的取出价格
Map<String, DlRepairSoi> itemsMap = pmsWaresList.stream().collect(Collectors.toMap(DlRepairSoi::getWareId,soi -> soi));
waresList.forEach(item -> {
DlRepairSoi filterSoi = wareMap.get(item.getId());
item.setStock((item.getStock()==null?new BigDecimal(0):item.getStock()).add(new BigDecimal(filterSoi.getInCount())));
DlRepairSoi itemSoi = itemsMap.get(item.getId());
//进价
item.setPurPrice(itemSoi.getGoodsPrice());
item.setStock((item.getStock() == null ? new BigDecimal(0) : item.getStock()).add(new BigDecimal(filterSoi.getInCount())));
});
waresService.updateBatchById(waresList);
}
}

View File

@ -258,7 +258,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitem.setItemCount(item.getWaresCount());
repairTitem.setItemName(item.getWaresName());
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
repairTitem.setItemPrice(new BigDecimal(waresMap.get(item.getWaresId()).getPrice()));
repairTitem.setItemPrice(waresMap.get(item.getWaresId()).getPrice());
//默认不打折为1
repairTitem.setItemDiscount(new BigDecimal(1));
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));