Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
# Conflicts: # dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java
This commit is contained in:
commit
83a341e541
@ -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;
|
||||
|
||||
}
|
@ -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 {
|
||||
/**
|
||||
* 服务对象
|
||||
|
@ -23,8 +23,6 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
@ -114,7 +112,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
//保存供应商
|
||||
if (StringUtils.isEmpty(repairSoRespVO.getSupplierId())){
|
||||
//采购单中录入供应商或无供应商情况
|
||||
if (StringUtils.isNotEmpty(repairSoRespVO.getSupplierName())){
|
||||
if (StringUtils.isNotEmpty(repairSoRespVO.getSupplierName())) {
|
||||
//没有选择直接录入的情况
|
||||
String supplierId = supplierService.appSaveSupplier(repairSoRespVO.getSupplierName());
|
||||
//为供应商id赋值
|
||||
@ -151,6 +149,26 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
|
||||
|
||||
// 操作配件库存表
|
||||
// 获取所有需要操作的数据
|
||||
List<DlRepairSoi> goodsList = repairSoRespVO.getGoodsList();
|
||||
List<String> ids = goodsList.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList());
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
// 更新库存和进价
|
||||
List<RepairWares> newWares = repairWares.stream().map(item -> {
|
||||
// 取数据
|
||||
DlRepairSoi repairSoi = goodsList.stream().filter(i -> i.getGoodsId().equals(item.getId())).collect(Collectors.toList()).get(0);
|
||||
// 设置新值
|
||||
// 如果是采购入库,数量+,如果是领料出库,数量-
|
||||
// 01, 03 是采购 02 是领料
|
||||
BigDecimal count = new BigDecimal(repairSoi.getGoodsCount());
|
||||
RepairWares wares = new RepairWares();
|
||||
wares.setId(item.getId());
|
||||
wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count));
|
||||
// 更新进价
|
||||
wares.setPurPrice(repairSoi.getGoodsPrice());
|
||||
return wares;
|
||||
}).collect(Collectors.toList());
|
||||
waresService.updateBatchById(newWares);
|
||||
// 获取所有需要操作的数据----生成采购单的时候,不直接操作库存,放到下面的inWares方法去操作
|
||||
if (repairSoRespVO.getSoType() != null && !repairSoRespVO.getSoType().equals("01")){
|
||||
List<DlRepairSoi> goodsList = repairSoRespVO.getGoodsList();
|
||||
@ -540,9 +558,15 @@ 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());
|
||||
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);
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user