盘点入库修正

This commit is contained in:
hongchao 2025-09-14 16:35:15 +08:00
parent ce86089d29
commit 591b7fcbde
10 changed files with 60 additions and 9 deletions

View File

@ -52,4 +52,6 @@ public class TreeNode {
@ApiModelProperty("机具类型1机具2安全工器具") @ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType; private int jiJuType;
private int unitValue;
} }

View File

@ -1,5 +1,6 @@
package com.bonus.material.ma.controller; package com.bonus.material.ma.controller;
import com.bonus.common.biz.annotation.StoreLog;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.common.core.web.page.TableDataInfo;
@ -23,7 +24,6 @@ import java.util.List;
@Api(tags = " 入库盘点") @Api(tags = " 入库盘点")
@RestController @RestController
@RequestMapping("/warehousing") @RequestMapping("/warehousing")
@Slf4j
public class WarehousingController extends BaseController { public class WarehousingController extends BaseController {
@Autowired @Autowired
private WarehousingService warehousingService; private WarehousingService warehousingService;

View File

@ -135,13 +135,13 @@ public class MachIneDto {
* 数量 * 数量
*/ */
@ApiModelProperty(value = "上方页面入库数量") @ApiModelProperty(value = "上方页面入库数量")
private Integer num; private BigDecimal num;
/** /**
* 数量 * 数量
*/ */
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer totalNum; private BigDecimal totalNum;
/** /**
* 检验人 * 检验人
@ -153,6 +153,6 @@ public class MachIneDto {
* 入库数量 * 入库数量
*/ */
@ApiModelProperty(value = "表单集合入库数量") @ApiModelProperty(value = "表单集合入库数量")
private Integer putInStoreNum; private BigDecimal putInStoreNum;
} }

View File

@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -48,7 +49,7 @@ public class SavePutInfoDto extends BaseEntity {
* 数量 * 数量
*/ */
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer num; private BigDecimal num;
/** /**
* 库房 * 库房

View File

@ -296,4 +296,10 @@ public class Type extends BaseEntity {
@ApiModelProperty(value="机具编码") @ApiModelProperty(value="机具编码")
private String maCode; private String maCode;
@ApiModelProperty(value="方法路径")
private String method;
@ApiModelProperty(value="状态默认0其他为异常状态")
private Integer status;
} }

View File

@ -254,4 +254,6 @@ public interface TypeMapper {
* @return * @return
*/ */
BigDecimal getMaCodeNum(Type type); BigDecimal getMaCodeNum(Type type);
void insertBmStorageNumLog(Type type);
} }

View File

@ -253,6 +253,8 @@ public class TypeServiceImpl implements ITypeService {
type.setPreStoreNum(storageNum); type.setPreStoreNum(storageNum);
type.setMaterialName(info.getMaterialName()); type.setMaterialName(info.getMaterialName());
type.setTypeName(info.getTypeName()); type.setTypeName(info.getTypeName());
type.setMethod("/warehousing/addList");
type.setStatus(0);
// 插入修改记录 // 插入修改记录
if ("1".equals(type.getStyle())) { if ("1".equals(type.getStyle())) {
result = typeMapper.updateMaTypeStockNum(type); result = typeMapper.updateMaTypeStockNum(type);
@ -278,6 +280,10 @@ public class TypeServiceImpl implements ITypeService {
} else { } else {
throw new RuntimeException("更新库存失败"); throw new RuntimeException("更新库存失败");
} }
//盘点往bm_storage_log表
if ("3".equals(type.getStyle())) {
typeMapper.insertBmStorageNumLog(type);
}
} }
return result; return result;
} finally { } finally {

View File

@ -191,6 +191,7 @@ public class WarehousingServiceImpl implements WarehousingService {
type.setTypeId(Long.parseLong(machIneDto.getTypeId())); type.setTypeId(Long.parseLong(machIneDto.getTypeId()));
type.setInputNum(BigDecimal.ONE); type.setInputNum(BigDecimal.ONE);
type.setMaId(machIneDto.getMaId()); type.setMaId(machIneDto.getMaId());
type.setMaCode(machIneDto.getMaCode());
res += typeService.updateNumAddOrSubtract(type); res += typeService.updateNumAddOrSubtract(type);
} }
return res; return res;
@ -234,10 +235,10 @@ public class WarehousingServiceImpl implements WarehousingService {
*/ */
private int insertPutInfo(SavePutInfoDto dto, String code) { private int insertPutInfo(SavePutInfoDto dto, String code) {
int res = 0; int res = 0;
Integer total = dto.getMachIneDtoList().stream() BigDecimal total = dto.getMachIneDtoList().stream()
.map(MachIneDto::getPutInStoreNum) .map(MachIneDto::getPutInStoreNum)
.filter(num -> num != null) .filter(num -> num != null)
.collect(Collectors.summingInt(Integer::intValue)); .collect(Collectors.reducing(BigDecimal.ZERO, BigDecimal::add));
if (CollectionUtils.isNotEmpty(dto.getMachIneDtoList())) { if (CollectionUtils.isNotEmpty(dto.getMachIneDtoList())) {
MachIneDto machIneDto = dto.getMachIneDtoList().get(0); MachIneDto machIneDto = dto.getMachIneDtoList().get(0);
machIneDto.setCode(code); machIneDto.setCode(code);
@ -263,7 +264,7 @@ public class WarehousingServiceImpl implements WarehousingService {
type.setCode(code); type.setCode(code);
type.setStyle("3"); type.setStyle("3");
type.setTypeId(Long.parseLong(machIneDto.getTypeId())); type.setTypeId(Long.parseLong(machIneDto.getTypeId()));
type.setInputNum(BigDecimal.valueOf(machIneDto.getPutInStoreNum())); type.setInputNum(machIneDto.getPutInStoreNum());
res += typeService.updateNumAddOrSubtract(type); res += typeService.updateNumAddOrSubtract(type);
//res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum()); //res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
} }

View File

@ -945,7 +945,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.unit_name AS unitName, mt.unit_name AS unitName,
mt.storage_num as num, mt.storage_num as num,
mt.model_code AS modelCode, mt.model_code AS modelCode,
mt.manage_type AS manageType mt.manage_type AS manageType,
mt.unit_value as unitValue
FROM ma_type mt FROM ma_type mt
WHERE mt.del_flag = '0' WHERE mt.del_flag = '0'
<if test="level!=null and level!=''"> <if test="level!=null and level!=''">

View File

@ -985,6 +985,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<insert id="insertBmStorageNumLog">
insert into bm_storage_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">model_title,</if>
<if test="method != null and method != ''">method,</if>
<if test="typeId != null">type_id,</if>
<if test="maCode != null and maCode != ''">ma_code,</if>
<if test="preStoreNum != null">pre_store_num,</if>
<if test="inputNum != null">in_num,</if>
<if test="storageNum != null">post_store_num,</if>
<if test="materialName != null and materialName != ''">type_name,</if>
<if test="typeName != null and typeName != ''">type_model_name,</if>
create_time,
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">creator,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">#{modelTitle},</if>
<if test="method != null and method != ''">#{method},</if>
<if test="typeId != null">#{typeId},</if>
<if test="maCode != null and maCode != ''">#{maCode},</if>
<if test="preStoreNum != null">#{preStoreNum},</if>
<if test="inputNum != null">#{inputNum},</if>
<if test="storageNum != null">#{storageNum},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if>
NOW(),
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
</trim>
</insert>
<insert id="addStockNum"> <insert id="addStockNum">
UPDATE ma_type SET storage_num = ifnull(#{inputNum},0) + ifnull(storage_num, 0) WHERE type_id = #{typeId} UPDATE ma_type SET storage_num = ifnull(#{inputNum},0) + ifnull(storage_num, 0) WHERE type_id = #{typeId}
</insert> </insert>