库存记录 操作人
This commit is contained in:
parent
7467cfa444
commit
1198781b61
|
|
@ -104,6 +104,10 @@ public class TbConsInfoFlow implements Serializable {
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@Column(name = "`operator`")
|
||||||
|
@ApiModelProperty(value = "操作人")
|
||||||
|
private String operator;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class TbConsInfoFlowDto implements Serializable {
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
private String coverImg;
|
private String coverImg;
|
||||||
private String remark;
|
private String remark;
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,10 +6,7 @@ import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.utils.FileUtil;
|
import cn.ysk.cashier.utils.*;
|
||||||
import cn.ysk.cashier.utils.PageUtil;
|
|
||||||
import cn.ysk.cashier.utils.QueryHelp;
|
|
||||||
import cn.ysk.cashier.utils.ValidationUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.cons.repository.TbConCheckRepository;
|
import cn.ysk.cashier.cons.repository.TbConCheckRepository;
|
||||||
import cn.ysk.cashier.cons.service.TbConCheckService;
|
import cn.ysk.cashier.cons.service.TbConCheckService;
|
||||||
|
|
@ -97,13 +94,12 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
flow.setConsId(consInfo.getId());
|
flow.setConsId(consInfo.getId());
|
||||||
flow.setShopId(consInfo.getShopId());
|
flow.setShopId(consInfo.getShopId());
|
||||||
flow.setConName(consInfo.getConName());
|
flow.setConName(consInfo.getConName());
|
||||||
flow.setAmount(consInfo.getStockNumber());
|
flow.setAmount(consInfo.getStockNumber());
|
||||||
flow.setBalance(consInfo.getStockNumber());
|
flow.setBalance(consInfo.getStockNumber());
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
||||||
tbConsInfoFlow.setBizName("报损");
|
tbConsInfoFlow.setBizName("报损");
|
||||||
tbConsInfoFlow.setBizType("-");
|
tbConsInfoFlow.setBizType("-");
|
||||||
tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
|
tbConsInfoFlow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
tbConsInfoFlowRepository.save(tbConsInfoFlow);
|
tbConsInfoFlowRepository.save(tbConsInfoFlow);
|
||||||
tbConsInfo.setStockNumber(balance);
|
tbConsInfo.setStockNumber(balance);
|
||||||
consInfoRepository.save(tbConsInfo);
|
consInfoRepository.save(tbConsInfo);
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
flow.setConName(resource.getConName());
|
flow.setConName(resource.getConName());
|
||||||
flow.setAmount(BigDecimal.ZERO);
|
flow.setAmount(BigDecimal.ZERO);
|
||||||
flow.setBalance(BigDecimal.ZERO);
|
flow.setBalance(BigDecimal.ZERO);
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
flow.setConName(info.getConName());
|
flow.setConName(info.getConName());
|
||||||
flow.setAmount(conInfos.getStockNumber());
|
flow.setAmount(conInfos.getStockNumber());
|
||||||
flow.setBalance(info.getStockNumber().subtract(info.getStockConsume()));
|
flow.setBalance(info.getStockNumber().subtract(info.getStockConsume()));
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +456,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
flow.setConName(consInfo.getConName());
|
flow.setConName(consInfo.getConName());
|
||||||
flow.setAmount(consInfo.getStockNumber());
|
flow.setAmount(consInfo.getStockNumber());
|
||||||
flow.setBalance(consInfo.getStockNumber());
|
flow.setBalance(consInfo.getStockNumber());
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
flow.setConName(consInfo.getConName());
|
flow.setConName(consInfo.getConName());
|
||||||
flow.setAmount(consInfo.getStockNumber());
|
flow.setAmount(consInfo.getStockNumber());
|
||||||
flow.setBalance(consInfo.getStockNumber());
|
flow.setBalance(consInfo.getStockNumber());
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
}
|
}
|
||||||
|
|
@ -512,7 +512,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
flow.setConName(consInfo.getConName());
|
flow.setConName(consInfo.getConName());
|
||||||
flow.setAmount(consInfo.getStockNumber());
|
flow.setAmount(consInfo.getStockNumber());
|
||||||
flow.setBalance(consInfo.getStockNumber());
|
flow.setBalance(consInfo.getStockNumber());
|
||||||
|
flow.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ public class TbProductStockDetailDto implements Serializable {
|
||||||
/** 关联订单Id */
|
/** 关联订单Id */
|
||||||
private String orderId;
|
private String orderId;
|
||||||
|
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
/** 1入库 -1出库 */
|
/** 1入库 -1出库 */
|
||||||
private Integer subType;
|
private Integer subType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,6 @@ public class StockRecordMsg {
|
||||||
private String type;
|
private String type;
|
||||||
private Integer subType;
|
private Integer subType;
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
private String operator;
|
||||||
private String remark;
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,10 @@
|
||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.mapper.product;
|
package cn.ysk.cashier.mapper.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.base.BaseMapper;
|
import cn.ysk.cashier.base.BaseMapper;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
|
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -29,4 +15,8 @@ import org.mapstruct.ReportingPolicy;
|
||||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
public interface TbProductStockDetailMapper extends BaseMapper<TbProductStockDetailDto, TbProductStockDetail> {
|
public interface TbProductStockDetailMapper extends BaseMapper<TbProductStockDetailDto, TbProductStockDetail> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Mapping(target = "orderNo", ignore = true)
|
||||||
|
TbProductStockDetailDto toDto(TbProductStockDetail entity);
|
||||||
}
|
}
|
||||||
|
|
@ -208,6 +208,7 @@ public class StockServiceImpl implements StockService {
|
||||||
stockDetail.setUpdatedAt(System.currentTimeMillis());
|
stockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||||
stockDetail.setSourcePath("SHOP");
|
stockDetail.setSourcePath("SHOP");
|
||||||
stockDetail.setRemark("一次性入库覆盖库存");
|
stockDetail.setRemark("一次性入库覆盖库存");
|
||||||
|
stockDetail.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
if ("sku".equals(productIdStr)) {
|
if ("sku".equals(productIdStr)) {
|
||||||
Optional<TbProductSku> byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue());
|
Optional<TbProductSku> byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue());
|
||||||
if (byId.isPresent()) {
|
if (byId.isPresent()) {
|
||||||
|
|
@ -393,6 +394,27 @@ public class StockServiceImpl implements StockService {
|
||||||
case "stockNumber"://库存
|
case "stockNumber"://库存
|
||||||
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
|
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
|
||||||
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
|
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
|
||||||
|
TbProductStockDetail detail=new TbProductStockDetail();
|
||||||
|
detail.setProductId(product.getId().toString());
|
||||||
|
detail.setProductName(product.getName());
|
||||||
|
detail.setShopId(product.getShopId());
|
||||||
|
detail.setOperator(SecurityUtils.getCurrentUsername());
|
||||||
|
detail.setSourcePath("NORMAL");
|
||||||
|
detail.setLeftNumber(product.getStockNumber());
|
||||||
|
detail.setStockNumber(new Double(Integer.valueOf(updateValueVO.getValue())-product.getStockNumber()));
|
||||||
|
TbShopUnit tbShopUnit = shopUnitRepository.findById(product.getUnitId()).orElse(null);
|
||||||
|
if(tbShopUnit!=null){
|
||||||
|
detail.setUnitName(tbShopUnit.getName());
|
||||||
|
}
|
||||||
|
if (product.getStockNumber() > Integer.valueOf(updateValueVO.getValue())) {
|
||||||
|
detail.setSubType(-1);
|
||||||
|
detail.setType("盘点出库");
|
||||||
|
} else {
|
||||||
|
detail.setSubType(1);
|
||||||
|
detail.setType("盘点入库");
|
||||||
|
}
|
||||||
|
detail.setCreatedAt(System.currentTimeMillis());
|
||||||
|
tbProductStockDetailRepository.save(detail);
|
||||||
break;
|
break;
|
||||||
case "salePrice"://价格
|
case "salePrice"://价格
|
||||||
description.append("修改价格为" + updateValueVO.getValue());
|
description.append("修改价格为" + updateValueVO.getValue());
|
||||||
|
|
|
||||||
|
|
@ -103,21 +103,17 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
||||||
|
|
||||||
ArrayList<Map<String, Object>> contents = new ArrayList<>();
|
|
||||||
for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) {
|
for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) {
|
||||||
Map<String, Object> map1 = BeanUtil.transBean2Map(tbProductStockDetailDto);
|
|
||||||
if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) {
|
if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) {
|
||||||
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null);
|
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null);
|
||||||
if (tbOrderInfo != null) {
|
if (tbOrderInfo != null) {
|
||||||
map1.put("orderNo", tbOrderInfo.getOrderNo());
|
tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contents.add(map1);
|
|
||||||
|
|
||||||
tbProductStockDetailDto.setTypes();
|
tbProductStockDetailDto.setTypes();
|
||||||
}
|
}
|
||||||
Map<String,Object> info = new LinkedHashMap<>(2);
|
Map<String,Object> info = new LinkedHashMap<>(2);
|
||||||
info.put("content",contents);
|
info.put("content",map.getContent());
|
||||||
info.put("totalElements",page.getTotalElements());
|
info.put("totalElements",page.getTotalElements());
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -501,6 +501,7 @@ public class TbProductStockOperateServiceImpl implements TbProductStockOperateSe
|
||||||
productStockDetail.setStockSnap(JSONObject.toJSONString(snapItem));
|
productStockDetail.setStockSnap(JSONObject.toJSONString(snapItem));
|
||||||
productStockDetail.setSourcePath("CASHIER");
|
productStockDetail.setSourcePath("CASHIER");
|
||||||
productStockDetail.setRemark(stockRecordMsg.getRemark());
|
productStockDetail.setRemark(stockRecordMsg.getRemark());
|
||||||
|
productStockDetail.setOperator(stockRecordMsg.getOperator());
|
||||||
productStockDetailRepository.save(productStockDetail);
|
productStockDetailRepository.save(productStockDetail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue