功能优化
This commit is contained in:
parent
9d41f58598
commit
a5274db2e3
|
|
@ -173,4 +173,7 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步")
|
||||
private String leaseStyle;
|
||||
|
||||
@ApiModelProperty(value = "任务单号")
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,4 +52,7 @@ public class BoxBindWarehouseDto extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "标准箱名称")
|
||||
private String boxName;
|
||||
|
||||
@ApiModelProperty(value = "新购编号")
|
||||
private String purchaseCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ import com.bonus.material.basic.domain.vo.BoxInfoBindVo;
|
|||
import com.bonus.material.basic.mapper.BmQrBoxMapper;
|
||||
import com.bonus.material.basic.service.BmQrBoxService;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MachineVo;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
|
|
@ -70,6 +72,9 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
@Resource
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理列表
|
||||
*/
|
||||
|
|
@ -785,15 +790,21 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
}
|
||||
|
||||
private int updateStorageNum(BoxBindWarehouseDto boxMa) {
|
||||
|
||||
Type type = new Type();
|
||||
int result = 0;
|
||||
|
||||
|
||||
String maStatus = boxMa.getMaStatus();
|
||||
if("0".equals(maStatus)) {
|
||||
boxMa.setInputNum(BigDecimal.valueOf(1));
|
||||
result = bmQrBoxMapper.updateStorageNum(boxMa);
|
||||
type.setModelTitle("新购入库");
|
||||
type.setTypeId(boxMa.getMaTypeId());
|
||||
type.setInputNum(BigDecimal.valueOf(1));
|
||||
type.setMaId(boxMa.getMaId());
|
||||
type.setStyle("4");
|
||||
result = typeService.updateNumAddOrSubtract(type);
|
||||
result = machineMapper.updateMaStatus(boxMa);
|
||||
/*boxMa.setInputNum(BigDecimal.valueOf(1));
|
||||
result = bmQrBoxMapper.updateStorageNum(boxMa);*/
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
List<String> projectIdList = mapper.getAllProjectList(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
leaseApplyInfo.setProjectIdList(projectIdList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -519,20 +519,18 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
String keyWord = leaseApplyInfo.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
List<?> statusList = leaseApplyInfo.getStatusList();
|
||||
|
||||
// 转换为HashSet提高contains操作的效率(O(1))
|
||||
Set<?> statusSet = CollectionUtils.isEmpty(statusList) ?
|
||||
Collections.emptySet() :
|
||||
new HashSet<>(statusList);
|
||||
|
||||
sortedList = sortedList.stream()
|
||||
.filter(item -> containsKeyword(item, keyWord))
|
||||
.filter(item -> StringUtils.isBlank(keyWord) || containsKeyword(item, keyWord))
|
||||
.filter(item -> statusSet.isEmpty() || statusSet.contains(item.getTaskStatus()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 判断状态
|
||||
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
|
||||
// 将集合sortedList中状态taskStatus包含在leaseApplyInfo.getStatusList()中的元素
|
||||
sortedList = sortedList.stream()
|
||||
.filter(item -> leaseApplyInfo.getStatusList().contains(item.getTaskStatus()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return sortedList;
|
||||
} catch (Exception e) {
|
||||
log.error("查询领料任务列表", e.getMessage());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
|||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.mapper.TypeMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
|
|
@ -104,7 +105,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
private MaterialLeaseInfoMapper materialLeaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private BackApplyInfoMapper backApplyInfoMapper;
|
||||
private ITypeService typeService;
|
||||
/**
|
||||
* 查询领料出库详细
|
||||
*
|
||||
|
|
@ -800,12 +801,12 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
leaseApplyDetailsMapper.updateLeaseApplyDetailsByLeaseOutRecord(record);
|
||||
}
|
||||
if (res > GlobalConstants.INT_0) {
|
||||
Type type = new Type();
|
||||
// 插入领料出库明细表(lease_out_details)
|
||||
record.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
res = leaseOutDetailsMapper.insertLeaseOutDetails(record);
|
||||
type.setOutNum(record.getOutNum());
|
||||
if (res > GlobalConstants.INT_0) {
|
||||
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||
res = typeMapper.updateMaTypeStockNum(record);
|
||||
if (record.getMaId() != null) {
|
||||
if (record.getJiJuType() == GlobalConstants.INT_1) {
|
||||
record.setThisCheckTime(DateUtils.getNowDate());
|
||||
|
|
@ -816,7 +817,14 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
}
|
||||
// 更新 (ma_machine 设备表)的状态
|
||||
res = machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.IN_USE.getStatus());
|
||||
type.setOutNum(BigDecimal.valueOf(GlobalConstants.INT_1));
|
||||
type.setMaId(record.getMaId());
|
||||
}
|
||||
type.setTypeId(record.getTypeId());
|
||||
type.setStyle("1");
|
||||
type.setModelTitle("领料出库");
|
||||
type.setCode(record.getCode());
|
||||
res = typeService.updateNumAddOrSubtract(type);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
/**
|
||||
* 物资类型对象 ma_type
|
||||
|
|
@ -33,6 +32,12 @@ public class Type extends BaseEntity {
|
|||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "设备ID")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "物资名称")
|
||||
private String materialName;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "规格型号", sort = 5)
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
|
|
@ -251,4 +256,19 @@ public class Type extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "待出库数量")
|
||||
private BigDecimal pendingOutNum;
|
||||
|
||||
@ApiModelProperty(value = "1:领料出库 2:修试入库 3:盘点入库 4:新购入库 5:直接修改库存")
|
||||
private String style;
|
||||
|
||||
@ApiModelProperty(value = "模块")
|
||||
private String modelTitle;
|
||||
|
||||
@ApiModelProperty(value = "任务单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
private BigDecimal inputNum;
|
||||
|
||||
@ApiModelProperty(value = "出库数量")
|
||||
private BigDecimal outNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public interface TypeMapper {
|
|||
/**
|
||||
* 减少 (ma_type 设备规格表)的库存数量
|
||||
*/
|
||||
int updateMaTypeStockNum(@Param("record") LeaseOutDetails leaseOutDetails);
|
||||
int updateMaTypeStockNum(@Param("record") Type type);
|
||||
|
||||
Type selectByTypeId(@Param("record") LeaseOutDetails record);
|
||||
|
||||
|
|
@ -220,7 +220,22 @@ public interface TypeMapper {
|
|||
|
||||
int updateStorageNum(Type type);
|
||||
|
||||
/**
|
||||
* 获取前置库存数量
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getStorageNumByTypeId(Type type);
|
||||
|
||||
/**
|
||||
* 插入库存数量日志
|
||||
* @param type
|
||||
*/
|
||||
void insertStorageNumLog(Type type);
|
||||
|
||||
/**
|
||||
* 添加库存数量
|
||||
* @param type
|
||||
*/
|
||||
int addStockNum(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,13 +59,5 @@ public interface WarehousingMapper {
|
|||
*/
|
||||
int selectTaskNumByMonth(@Param("date") Date nowDate);
|
||||
|
||||
/**
|
||||
* 更新matype表中num数量
|
||||
* @param typeId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
int updateMaType(@Param("typeId") String typeId, @Param("num") Integer num);
|
||||
|
||||
List<PutInStorageBean> getDetails(PutInStorageBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,4 +146,11 @@ public interface ITypeService {
|
|||
List<MaTypeVo> getUserList(MaTypeVo type);
|
||||
|
||||
int updateStorageNum(Type type);
|
||||
|
||||
/**
|
||||
* 全局更新数据库中物资库存数量
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
int updateNumAddOrSubtract(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.ma.service.impl;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
|
|
@ -13,7 +14,6 @@ import com.bonus.common.core.utils.DateUtils;
|
|||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.mapper.LeaseTaskMapper;
|
||||
import com.bonus.material.ma.domain.MaTypeHistory;
|
||||
import com.bonus.material.ma.domain.TypeKeeper;
|
||||
|
|
@ -66,6 +66,8 @@ public class TypeServiceImpl implements ITypeService {
|
|||
@Resource
|
||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
|
||||
|
||||
/**
|
||||
* 查询物资类型 -- 根据id
|
||||
|
|
@ -224,6 +226,62 @@ public class TypeServiceImpl implements ITypeService {
|
|||
return typeMapper.updateStorageNum(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全局更新数据库中物资库存数量
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateNumAddOrSubtract(Type type) {
|
||||
// 获取锁(公平锁会按线程等待请求顺序分配锁)
|
||||
lock.lock();
|
||||
try {
|
||||
int result = 0;
|
||||
// 根据typeId查询物资名称和规格型号
|
||||
Type info = typeMapper.selectTypeByTypeId(type.getTypeId());
|
||||
// 查询库存
|
||||
BigDecimal storageNum = typeMapper.getStorageNumByTypeId(type);
|
||||
type.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
type.setPreStoreNum(storageNum);
|
||||
type.setMaterialName(info.getMaterialName());
|
||||
type.setTypeName(info.getTypeName());
|
||||
// 插入修改记录
|
||||
if ("1".equals(type.getStyle())) {
|
||||
// 检查库存是否充足
|
||||
if (type.getOutNum() != null && storageNum.compareTo(type.getOutNum()) < 0) {
|
||||
throw new RuntimeException("库存不足,当前库存: " + storageNum + ", 需要出库: " + type.getOutNum());
|
||||
}
|
||||
result = typeMapper.updateMaTypeStockNum(type);
|
||||
if (result > 0) {
|
||||
type.setStorageNum(type.getPreStoreNum().subtract(type.getOutNum()));
|
||||
typeMapper.insertStorageNumLog(type);
|
||||
} else {
|
||||
throw new RuntimeException("更新库存失败");
|
||||
}
|
||||
} else if (type.getStyle() == null) {
|
||||
result = typeMapper.updateStorageNum(type);
|
||||
if (result > 0) {
|
||||
type.setModelTitle("直接修改库存");
|
||||
typeMapper.insertStorageNumLog(type);
|
||||
} else {
|
||||
throw new RuntimeException("更新库存失败");
|
||||
}
|
||||
} else {
|
||||
result = typeMapper.addStockNum(type);
|
||||
if (result > 0) {
|
||||
type.setStorageNum(type.getPreStoreNum().add(type.getInputNum()));
|
||||
typeMapper.insertStorageNumLog(type);
|
||||
} else {
|
||||
throw new RuntimeException("更新库存失败");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
// 释放锁
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
|
||||
|
|
|
|||
|
|
@ -6,14 +6,11 @@ import com.bonus.common.core.utils.DateUtils;
|
|||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.ma.domain.MachIneDto;
|
||||
import com.bonus.material.ma.domain.PutInStorageBean;
|
||||
import com.bonus.material.ma.domain.SavePutInfoDto;
|
||||
import com.bonus.material.ma.domain.SupplierInfo;
|
||||
import com.bonus.material.ma.domain.*;
|
||||
import com.bonus.material.ma.domain.vo.ExceptionEnum;
|
||||
import com.bonus.material.ma.domain.vo.FieldGenerator;
|
||||
import com.bonus.material.ma.domain.vo.GlobalContants;
|
||||
import com.bonus.material.ma.mapper.WarehousingMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import com.bonus.material.ma.service.WarehousingService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -22,8 +19,9 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -40,6 +38,9 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
@Autowired
|
||||
private WarehousingMapper warehousingMapper;
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
// @Autowired
|
||||
// private PurchaseInputMapper purchaseInputMapper;
|
||||
|
||||
|
|
@ -124,12 +125,6 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
log.error("insertMaMachineInfo方法插入异常");
|
||||
throw new RuntimeException("insertMaMachineInfo方法插入异常");
|
||||
}
|
||||
//去修改ma_type里面的库存num,根据前端传的数量追加
|
||||
res = updateMaTypeInfo(dto.getTypeId(), dto.getNum());
|
||||
if (res == 0) {
|
||||
log.error("updateMaTypeInfo方法修改异常");
|
||||
throw new RuntimeException("updateMaTypeInfo方法修改异常");
|
||||
}
|
||||
} else {
|
||||
//2.插入ma_type_put_in_storage_info表和ma_type_put_in_storage_details表
|
||||
res = insertPutInfo(dto, code);
|
||||
|
|
@ -188,6 +183,15 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
machIneDto.setCheckMan(dto.getCheckMan());
|
||||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertMachineInfo(machIneDto);
|
||||
//根据类型追加ma_type表里面的num
|
||||
Type type = new Type();
|
||||
type.setModelTitle("盘点入库");
|
||||
type.setCode(code);
|
||||
type.setStyle("3");
|
||||
type.setTypeId(Long.parseLong(machIneDto.getTypeId()));
|
||||
type.setInputNum(BigDecimal.ONE);
|
||||
type.setMaId(machIneDto.getMaId());
|
||||
res += typeService.updateNumAddOrSubtract(type);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -223,16 +227,6 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
return warehousingMapper.saveDetails(machIneDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取,追加ma_type表里面的num
|
||||
* @param typeId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private int updateMaTypeInfo(String typeId, Integer num) {
|
||||
return warehousingMapper.updateMaType(typeId, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入表方法
|
||||
* @param dto
|
||||
|
|
@ -264,7 +258,14 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
//根据类型追加ma_type表里面的num
|
||||
res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
Type type = new Type();
|
||||
type.setModelTitle("盘点入库");
|
||||
type.setCode(code);
|
||||
type.setStyle("3");
|
||||
type.setTypeId(Long.parseLong(machIneDto.getTypeId()));
|
||||
type.setInputNum(BigDecimal.valueOf(machIneDto.getPutInStoreNum()));
|
||||
res += typeService.updateNumAddOrSubtract(type);
|
||||
//res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.material.purchase.service.impl;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||
|
|
@ -9,7 +8,7 @@ import com.bonus.common.core.utils.StringUtils;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||
import com.bonus.common.biz.domain.purchase.PurchaseDto;
|
||||
|
|
@ -17,8 +16,8 @@ import com.bonus.material.purchase.mapper.PurchaseBindMapper;
|
|||
import com.bonus.material.purchase.mapper.PurchaseStorageMapper;
|
||||
import com.bonus.material.purchase.service.IPurchaseStorageService;
|
||||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -49,6 +48,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
@Resource
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
* @param dto
|
||||
|
|
@ -228,10 +230,13 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
}
|
||||
} else {
|
||||
//编码入库
|
||||
// 根据taskId查询任务编号
|
||||
TmTask tmTask = tmTaskMapper.selectTmTaskByTaskId(Long.parseLong(purchaseDto.getTaskId()));
|
||||
List<PurchaseVo> purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto);
|
||||
if (CollectionUtils.isEmpty(purchaseDto.getInPutList())) {
|
||||
purchaseDto.setInPutList(new ArrayList<>());
|
||||
}
|
||||
Type type = new Type();
|
||||
result += purchaseStorageMapper.updateNum(Long.valueOf(purchaseDto.getPurchaseId()), BigDecimal.valueOf(purchaseDto.getInPutList().size()));
|
||||
for (PurchaseDto dto : purchaseDto.getInPutList()) {
|
||||
if (CollectionUtils.isNotEmpty(purchaseVoList)) {
|
||||
|
|
@ -241,10 +246,16 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
dto.setProductDate(null == purchaseVo.getProductDate() ? null : purchaseVo.getProductDate());
|
||||
}
|
||||
}
|
||||
type.setCode(tmTask.getCode());
|
||||
}
|
||||
dto.setTypeId(purchaseDto.getTypeId());
|
||||
if (1 > purchaseStorageMapper.updateMachineByCode(dto)) {throw new RuntimeException("入库失败,更新物资入库状态0条");}
|
||||
if (1 > purchaseStorageMapper.updateStorageNum(BigDecimal.ONE, dto.getTypeId())) {throw new RuntimeException("入库失败,库存增加0");}
|
||||
//if (1 > purchaseStorageMapper.updateStorageNum(BigDecimal.ONE, dto.getTypeId())) {throw new RuntimeException("入库失败,库存增加0");}
|
||||
type.setModelTitle("新购入库");
|
||||
type.setTypeId(Long.valueOf(purchaseDto.getTypeId()));
|
||||
type.setInputNum(BigDecimal.ONE);
|
||||
type.setStyle("4");
|
||||
if (1 > typeService.updateNumAddOrSubtract(type)) {throw new RuntimeException("入库失败,库存增加0");}
|
||||
List<PurchaseCheckDetails> bindMaList = purchaseBindMapper.getMachineById(purchaseDto);
|
||||
if (CollectionUtils.isNotEmpty(bindMaList)) {
|
||||
// 还有已绑定的设备, 那就不动状态了,这块由设备绑定阶段来决定是否修改成待入库状态 by阮 2025-01-10号修改逻辑
|
||||
|
|
@ -296,8 +307,15 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
* @return
|
||||
*/
|
||||
private int updatePurchaseInfoAndDetails(PurchaseVo detail, int purchaseId) {
|
||||
int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum());
|
||||
result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId());
|
||||
Type type = new Type();
|
||||
type.setModelTitle("新购入库");
|
||||
type.setTypeId(Long.valueOf(detail.getTypeId()));
|
||||
type.setStyle("4");
|
||||
type.setCode(detail.getPurchaseCode());
|
||||
type.setInputNum(detail.getCheckNum());
|
||||
int result = typeService.updateNumAddOrSubtract(type);
|
||||
result += purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum());
|
||||
//result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId());
|
||||
return result + purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,13 +27,12 @@ import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
|
|||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import com.bonus.material.repair.domain.RepairInputInfo;
|
||||
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.repair.mapper.RepairInputDetailsMapper;
|
||||
import com.bonus.common.biz.domain.repair.RepairInputDetails;
|
||||
|
|
@ -67,6 +66,9 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
|
||||
@Resource
|
||||
private BackApplyInfoMapper backApplyInfoMapper;
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
/**
|
||||
* 查询修试后入库
|
||||
*
|
||||
|
|
@ -655,6 +657,14 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
inputDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
updateRepairInputInfo(inputDetails);
|
||||
Type type = new Type();
|
||||
type.setModelTitle("修试入库");
|
||||
type.setCode(repairInputDetails.getInputCode());
|
||||
type.setTypeId(repairInputDetails.getTypeId());
|
||||
type.setStyle("2");
|
||||
type.setInputNum(BigDecimal.valueOf(1));
|
||||
type.setMaId(inputDetails.getMaId());
|
||||
typeService.updateNumAddOrSubtract(type);
|
||||
}
|
||||
if (result > 0) {
|
||||
updateTaskStatus(repairInputDetails);
|
||||
|
|
@ -675,10 +685,13 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
|
||||
if (result > 0) {
|
||||
updateTaskStatus(repairInputDetails);
|
||||
RepairInputInfo repairInputInfo = new RepairInputInfo();
|
||||
repairInputInfo.setTypeId(repairInputDetails.getTypeId());
|
||||
repairInputInfo.setInputNum(repairInputDetails.getInputNum());
|
||||
repairInputDetailsMapper.updateNum(repairInputInfo);
|
||||
Type type = new Type();
|
||||
type.setModelTitle("修试入库");
|
||||
type.setCode(repairInputDetails.getInputCode());
|
||||
type.setTypeId(repairInputDetails.getTypeId());
|
||||
type.setStyle("2");
|
||||
type.setInputNum(repairInputDetails.getInputNum());
|
||||
typeService.updateNumAddOrSubtract(type);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -892,9 +905,21 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存数量
|
||||
* @param inputApplyDetails
|
||||
* @return
|
||||
*/
|
||||
private int updateStorageNum(RepairInputDetails inputApplyDetails) {
|
||||
int result = 0;
|
||||
result = repairInputDetailsMapper.updateStorageNum(inputApplyDetails);
|
||||
Type type = new Type();
|
||||
type.setModelTitle("修试入库");
|
||||
type.setCode(inputApplyDetails.getInputCode());
|
||||
type.setTypeId(inputApplyDetails.getTypeId());
|
||||
type.setStyle("2");
|
||||
type.setInputNum(BigDecimal.valueOf(1));
|
||||
type.setMaId(inputApplyDetails.getMaId());
|
||||
result = typeService.updateNumAddOrSubtract(type);
|
||||
result = machineMapper.updateStatus(inputApplyDetails.getMaId(), 1);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,7 +335,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mm.ma_status AS maStatus,
|
||||
mm.type_id AS maTypeId,
|
||||
mm.buy_task AS taskId,
|
||||
qb.create_time AS createTime
|
||||
qb.create_time AS createTime,
|
||||
tt.code AS purchaseCode
|
||||
FROM
|
||||
bm_qrcode_box_bind qb
|
||||
LEFT JOIN bm_qrcode_box bb on qb.box_id = bb.box_id
|
||||
|
|
@ -344,6 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task tt ON mm.buy_task = tt.task_id
|
||||
WHERE
|
||||
bb.box_code = #{boxCode}
|
||||
<if test="maCode != null and maCode != ''">
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN back_apply_info baif ON baif.id = sai.back_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type_manage mtm ON mt3.parent_id = mtm.type_id
|
||||
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
|
||||
WHERE
|
||||
1 = 1
|
||||
sai.is_slt = '0'
|
||||
AND sai.ma_id IS NOT NULL
|
||||
<if test="userId != null">
|
||||
and mtm.user_id = #{userId}
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
WHERE
|
||||
bai.status = '1'
|
||||
AND bu.type_id = 36
|
||||
AND bu.type_id in (32, 36)
|
||||
AND bai.project_id = #{proId}
|
||||
</select>
|
||||
|
||||
|
|
@ -605,7 +605,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
`data_center`.dx_fb_son
|
||||
WHERE
|
||||
project_status = '在建'
|
||||
project_status in ('在建', '开工准备')
|
||||
<if test="departId != null and departId != ''">
|
||||
AND project_dept_id = #{departId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
hi.house_name,
|
||||
t.sampling_ratio,
|
||||
t.is_check,
|
||||
t.jiju_type
|
||||
t.jiju_type,
|
||||
mt2.type_name as materialName
|
||||
FROM ma_type AS t
|
||||
left join ma_type mt2 on t.parent_id = mt2.type_id
|
||||
left join ma_type mt3 on mt2.parent_id = mt3.type_id
|
||||
|
|
@ -951,8 +952,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
VALUES (#{typeId}, #{beforePrice} ,#{afterPrice}, #{createTime}, #{createBy})
|
||||
</insert>
|
||||
<insert id="insertStorageNumLog">
|
||||
INSERT INTO update_storage_num_log(type_id, pre_store_num, after_store_num, create_time, creater)
|
||||
VALUES (#{typeId}, #{preStoreNum}, #{storageNum}, now(), #{createBy})
|
||||
insert into update_storage_num_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="modelTitle != null and modelTitle != ''">model_title,</if>
|
||||
<if test="code != null and code != ''">code,</if>
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="typeName != null and typeName != ''">type_name,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="preStoreNum != null">pre_store_num,</if>
|
||||
<if test="inputNum != null">input_num,</if>
|
||||
<if test="outNum != null">out_num,</if>
|
||||
<if test="storageNum != null">after_store_num,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
create_time,
|
||||
<if test="createBy != null and createBy != ''">creater,</if>
|
||||
<if test="style != null and style != ''">style,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="modelTitle != null and modelTitle != ''">#{modelTitle},</if>
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="typeName != null and typeName != ''">#{typeName},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="preStoreNum != null">#{preStoreNum},</if>
|
||||
<if test="inputNum != null">#{inputNum},</if>
|
||||
<if test="outNum != null">#{outNum},</if>
|
||||
<if test="storageNum != null">#{storageNum},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
NOW(),
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="style != null and style != ''">#{style},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="addStockNum">
|
||||
UPDATE ma_type SET storage_num = ifnull(#{inputNum},0) + ifnull(storage_num, 0) WHERE type_id = #{typeId}
|
||||
</insert>
|
||||
|
||||
<select id="getMaTypeHistoryListBy" resultType="com.bonus.material.ma.domain.MaTypeHistory">
|
||||
|
|
|
|||
|
|
@ -178,15 +178,6 @@
|
|||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateMaType">
|
||||
UPDATE ma_type
|
||||
SET storage_num = IFNULL(storage_num, 0) + #{num},
|
||||
update_time = now()
|
||||
<where>
|
||||
<if test="typeId != null ">and type_id = #{typeId}</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="getDetails" resultType="com.bonus.material.ma.domain.PutInStorageBean">
|
||||
SELECT
|
||||
case when psi.put_in_type = 0 then '库存盘点入库'
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pcd.`status` AS status,
|
||||
pm.ma_code AS maCode,
|
||||
pm.out_fac_code AS outFacCode,
|
||||
pm.qr_code AS qrCode
|
||||
pm.qr_code AS qrCode,
|
||||
tt.code AS purchaseCode
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue