库存盘点-1
This commit is contained in:
1 parent
641a61db2c
commit
d918b3b2ee
13 files changed
+263
-13
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.canteen;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.AES;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@SpringBootTest(classes = CanteenApp.class)
|
||||
public class test {
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEnc() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDec() {
|
||||
|
||||
}
|
||||
}
|
||||
+1
@@ -51,4 +51,5 @@ public class InventoryRecordSaveItemDTO {
|
||||
@Schema(description="包装单位id")
|
||||
private Long unitId;
|
||||
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.inventoryrecords;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-02-11 17:11:41
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "盘点-item")
|
||||
public class PDItemSaveDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 库存商品id
|
||||
*/
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
|
||||
@Schema(description="账面数量")
|
||||
private Double accountNumber;
|
||||
|
||||
@Schema(description="实际数量")
|
||||
private Double realNumber;
|
||||
|
||||
@Schema(description="账面单价")
|
||||
private Integer unitPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 数据库意思就是实际单价,这里等价于盘点单价
|
||||
*/
|
||||
@Schema(description="盘点单价")
|
||||
private Integer realPrice;
|
||||
/**
|
||||
* 盘盈盘亏
|
||||
*/
|
||||
@Schema(description="盈")
|
||||
private Double profit;
|
||||
|
||||
/**
|
||||
* 盘盈盘亏
|
||||
*/
|
||||
@Schema(description="亏")
|
||||
private Double loss;
|
||||
|
||||
|
||||
/**
|
||||
* 包装单位id
|
||||
*/
|
||||
@Schema(description="包装单位id")
|
||||
private Long unitId;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description="盘后总数")
|
||||
private Integer totalNumber;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@Schema(description="盘后总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 1等于盘盈 2等于盘亏
|
||||
*/
|
||||
@Schema(description="订单类型,1入库,2出库")
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.inventoryrecords;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增一个采购计划
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "盘点保存对象")
|
||||
public class PDSaveDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 采编号
|
||||
*/
|
||||
@Schema(description="编号")
|
||||
private String inventoryCode;
|
||||
|
||||
/**
|
||||
* 采购计划单据日期
|
||||
*/
|
||||
@Schema(description="单据日期")
|
||||
private LocalDate inventoryDate;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
@Schema(description="仓库id")
|
||||
private String warehouseId;
|
||||
|
||||
/**
|
||||
* 经办人id
|
||||
*/
|
||||
@Schema(description="经办人id")
|
||||
private Long handlerUserId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 单据类型(字典inventory_type)采购入库、采购退货、盘点入库等
|
||||
*/
|
||||
@Schema(description="单据类型(字典inventory_type)采购入库、采购退货、盘点入库等")
|
||||
private String inventoryType;
|
||||
|
||||
|
||||
/**
|
||||
* @Link SmCgPlanSaveItemDTO
|
||||
*/
|
||||
@Schema(description="采购计划-item")
|
||||
private List<PDItemSaveDTO> items;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.inventoryrecords;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PdUnitDto {
|
||||
|
||||
@Schema(description = "包装单位id")
|
||||
private Long unitId;
|
||||
|
||||
@Schema(description = "对应包装单位填的数量")
|
||||
private Integer unitNumber;
|
||||
}
|
||||
+12
@@ -154,4 +154,16 @@ public class SmErpInventoryRecordsItemEntity extends Model<SmErpInventoryRecords
|
||||
*/
|
||||
@Schema(description="租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description="盘后总数")
|
||||
private Integer totalNumber;
|
||||
|
||||
@Schema(description="账面数量")
|
||||
private Integer accountNumber;
|
||||
|
||||
@Schema(description="实际数量")
|
||||
private Integer realNumber;
|
||||
|
||||
@Schema(description="实际单价")
|
||||
private Integer realPrice;
|
||||
}
|
||||
+11
-6
@@ -45,23 +45,28 @@ public class ErpUnitVo {
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
|
||||
/**
|
||||
* 零售价(分为单位)
|
||||
*/
|
||||
@Schema(description="零售价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice;
|
||||
|
||||
/**
|
||||
* 成本单价,单位: 分
|
||||
*/
|
||||
@Schema(description="成本单价,单位: 分")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer costPrice;
|
||||
|
||||
|
||||
@Schema(description="是否基础单位")
|
||||
private Boolean isBase;
|
||||
|
||||
}
|
||||
+3
-2
@@ -78,12 +78,13 @@ public class SmErpCgPlanController {
|
||||
|
||||
|
||||
/**
|
||||
* 采购计划选择商品分页数据
|
||||
* 通用的,迁移到公共接口
|
||||
* 选择商品分页数据
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "采购计划选择商品分页数据" , description = "采购计划选择商品分页数据" )
|
||||
@Operation(summary = "选择商品分页数据" , description = "选择商品分页数据" )
|
||||
@GetMapping("/erpSpuPage" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpInventoryRecords_view')" )
|
||||
public R getErpSpuPage(@ParameterObject Page page, @ParameterObject ErpCgPlanDTO erpCgPlanDTO) {
|
||||
|
||||
+12
@@ -245,4 +245,16 @@ public class SmErpInventoryRecordsController {
|
||||
public R getInventoryTypeSumPage(@ParameterObject Page page, @ParameterObject InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
return R.ok(smErpInventoryRecordsService.getInventoryTypeSumPage(page, inventoryDetailQueryDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "库存盘点新增" , description = "库存盘点新增" )
|
||||
@SysLog("库存盘点新增" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpInventoryRecords_add')" )
|
||||
public R save(@RequestBody PDSaveDTO pdSaveDTO) {
|
||||
return R.ok(smErpInventoryRecordsService.savePD(pdSaveDTO));
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordEditDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.PDSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpInventoryRecordsEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -81,4 +82,11 @@ public interface SmErpInventoryRecordsService extends IService<SmErpInventoryRec
|
||||
|
||||
|
||||
Object removeBatch(ArrayList<Long> list);
|
||||
|
||||
/**
|
||||
* 库存盘点新增
|
||||
* @param pdSaveDTO
|
||||
* @return
|
||||
*/
|
||||
Object savePD(PDSaveDTO pdSaveDTO);
|
||||
}
|
||||
+16
-5
@@ -83,10 +83,6 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
updateStockDTO.setId(cgPlanItemEntity.getErpSpuId());
|
||||
Double quantity = cgPlanItemEntity.getQuantity();
|
||||
String orderType = smErpCgDdEntity.getOrderType();
|
||||
|
||||
if (null==orderType){
|
||||
//如果是盘点保存的话,那么这个就是手动录入的了
|
||||
}else {
|
||||
cgPlanItemEntity.setOrderType(orderType);
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
@@ -95,7 +91,7 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
@@ -401,5 +397,20 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object savePD(PDSaveDTO pdSaveDTO) {
|
||||
Long deptId = SecurityUtils.getUser().getDeptId();
|
||||
SmErpInventoryRecordsEntity smErpCgDdEntity = BeanUtils.toBean(pdSaveDTO, SmErpInventoryRecordsEntity.class);
|
||||
smErpCgDdEntity.setDeptId(deptId);
|
||||
smErpCgDdEntity.setCheckStatus("0");
|
||||
smErpCgDdEntity.setDeptId(deptId);
|
||||
List<PDItemSaveDTO> items = pdSaveDTO.getItems();
|
||||
|
||||
int insert = baseMapper.insert(smErpCgDdEntity);
|
||||
List<SmErpInventoryRecordsItemEntity> cgPlanItemEntities = BeanUtils.toBean(items, SmErpInventoryRecordsItemEntity.class);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
@@ -468,6 +468,7 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
voList.stream().forEach(vo -> {
|
||||
List<SmErpUnitEntity> unitEntities = unitList.stream().filter(unit -> unit.getSpuId().equals(vo.getId())).collect(Collectors.toList());
|
||||
List<ErpUnitVo> bean = BeanUtils.toBean(unitEntities, ErpUnitVo.class);
|
||||
bean.sort(Comparator.comparing(ErpUnitVo::getPackageNum));
|
||||
vo.setErpUnitVos(bean);
|
||||
//库存
|
||||
SmErpStockEntity smErpStockEntity = stockMap.get(vo.getId());
|
||||
|
||||
+4
@@ -25,6 +25,10 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="totalNumber" column="total_number"/>
|
||||
<result property="accountNumber" column="account_number"/>
|
||||
<result property="realNumber" column="real_number"/>
|
||||
<result property="realPrice" column="real_price"/>
|
||||
</resultMap>
|
||||
<select id="selectInventoryTypeSumPageByScope"
|
||||
resultType="com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordSumVo">
|
||||
|
||||
Reference in new issue
Block a user