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; package cn.iocoder.yudao.module.project.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; 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 lombok.*;
import java.util.*;
import java.math.BigDecimal; 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 status;
/**数据来源*/ /**数据来源*/
private String dataForm; 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 * @date 9:13 2024/9/13
**/ **/
@RestController @RestController
@RequestMapping("/repair/so") @RequestMapping("/repair/so/page")
public class DlRepairSoController { public class DlRepairSoController {
/** /**
* 服务对象 * 服务对象

View File

@ -108,9 +108,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) { public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date()); 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()); String supplierId = supplierService.appSaveSupplier(repairSoRespVO.getSupplierName());
//为供应商id赋值 //为供应商id赋值
@ -159,7 +159,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
wares.setId(item.getId()); wares.setId(item.getId());
wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count)); 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; return wares;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
waresService.updateBatchById(newWares); waresService.updateBatchById(newWares);
@ -469,7 +469,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
inWares.setInCount(filterSoi.getInCount()); inWares.setInCount(filterSoi.getInCount());
inWares.setId(null); 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); inWaresList.add(inWares);
}); });
//更新采购品 //更新采购品
@ -478,15 +478,20 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
repairSoiService.saveBatch(inWaresList); repairSoiService.saveBatch(inWaresList);
/*4、原始配件库处理*/ /*4、原始配件库处理*/
//入库配件按照原始配件库id分组目的取出数量
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getWareId, soi -> soi)); 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 -> { waresList.forEach(item -> {
DlRepairSoi filterSoi = wareMap.get(item.getId()); 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); waresService.updateBatchById(waresList);
} }
} }

View File

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