【admin】新增&优化#1、出入库审核 2、取消审核 3、优化出入库类别

dev
renfan 2024-08-04 19:52:50 +08:00
parent 687df636af
commit 6cfd33dc4a
17 changed files with 250 additions and 58 deletions

View File

@ -108,4 +108,17 @@ public class SparePartStockAuditController {
return AjaxResult.success(); return AjaxResult.success();
} }
/**
*
*
* @author hcy
* @param sparePartStockAuditParam
* @return Object
*/
@Log(title = "备件出入库取消审核")
@PostMapping("/cancelAudit")
public Object cancelAudit(@RequestBody SparePartStockAuditParam sparePartStockAuditParam) {
iSparePartStockAuditService.cancelAudit(Math.toIntExact(sparePartStockAuditParam.getId()));
return AjaxResult.success();
}
} }

View File

@ -183,6 +183,8 @@ public class SpareParAllotServiceImpl implements ISparePartAllotService {
model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse()); // 调入仓库 model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse()); // 调入仓库
model.setRemark(sparePartStockAuditParam.getRemark()); // 备注 model.setRemark(sparePartStockAuditParam.getRemark()); // 备注
model.setReceiptNumber(generateOrderNumber()); // 单据编号 model.setReceiptNumber(generateOrderNumber()); // 单据编号
model.setOutInWarehouseType(Long.valueOf(AuditStateEnum.STOCKTRANSFER.getStatus())); //入库类别(2=库存调拨)
// 获取当前的用户 // 获取当前的用户
Object username = AdminThreadLocal.get("username"); Object username = AdminThreadLocal.get("username");
model.setResponsiblePerson((String) username); model.setResponsiblePerson((String) username);

View File

@ -64,14 +64,14 @@ public class SparePartInWarehouseServiceImpl implements ISparePartInWarehouseSer
Integer limit = pageParam.getPageSize(); Integer limit = pageParam.getPageSize();
QueryWrapper<SparePartStockAudit> queryWrapper = new QueryWrapper<>(); QueryWrapper<SparePartStockAudit> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("in_warehouse_type",0); queryWrapper.eq("out_in_warehouse_type",0);
queryWrapper.eq("is_delete", 0); queryWrapper.eq("is_delete", 0);
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{ sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{
"like:receiptNumber@receipt_number:str", "like:receiptNumber@receipt_number:str",
"=:warehouseId@warehouse_id:long", "=:warehouseId@warehouse_id:long",
"=:outWarehouseType@out_warehouse_type:long", "=:outInWarehouseType@out_in_warehouse_type:long",
"=:auditState@audit_state:int", "=:auditState@audit_state:int",
}); });
@ -166,14 +166,14 @@ public class SparePartInWarehouseServiceImpl implements ISparePartInWarehouseSer
QueryWrapper<SparePartStockAudit> qw = new QueryWrapper<>(); QueryWrapper<SparePartStockAudit> qw = new QueryWrapper<>();
qw.select("max(id) as id"); qw.select("max(id) as id");
SparePartStockAudit sparePartStockAudit = sparePartStockAuditMapper.selectOne(qw); SparePartStockAudit sparePartStockAudit = sparePartStockAuditMapper.selectOne(qw);
if(sparePartStockAudit.getId() == null){ if(sparePartStockAudit == null){
model.setId(1L); model.setId(1L);
}else{ }else{
model.setId(sparePartStockAudit.getId() + 1); model.setId(sparePartStockAudit.getId() + 1);
} }
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 入库仓库 model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 入库仓库
model.setInWarehouseType(sparePartStockAuditParam.getInWarehouseType()); //入库类别 model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType()); //入库类别(0=采购入库)
model.setSupplier(sparePartStockAuditParam.getSupplier()); //供应商 model.setSupplier(sparePartStockAuditParam.getSupplier()); //供应商
model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话 model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话
model.setReceiptNumber(generateOrderNumber()); // 单据编号 model.setReceiptNumber(generateOrderNumber()); // 单据编号
@ -224,7 +224,7 @@ public class SparePartInWarehouseServiceImpl implements ISparePartInWarehouseSer
Assert.notNull(model, "数据不存在!"); Assert.notNull(model, "数据不存在!");
model.setId(sparePartStockAuditParam.getId()); model.setId(sparePartStockAuditParam.getId());
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 入库仓库 model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 入库仓库
model.setInWarehouseType(sparePartStockAuditParam.getInWarehouseType()); //入库类别 model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType()); //入库类别
model.setSupplier(sparePartStockAuditParam.getSupplier()); //供应商 model.setSupplier(sparePartStockAuditParam.getSupplier()); //供应商
model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话 model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话
model.setReceiptNumber(sparePartStockAuditParam.getReceiptNumber()); // 单据编号 model.setReceiptNumber(sparePartStockAuditParam.getReceiptNumber()); // 单据编号

View File

@ -60,14 +60,14 @@ public class SparePartOutWarehouseServiceImpl implements ISparePartOutWarehouseS
Integer limit = pageParam.getPageSize(); Integer limit = pageParam.getPageSize();
QueryWrapper<SparePartStockAudit> queryWrapper = new QueryWrapper<>(); QueryWrapper<SparePartStockAudit> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("out_warehouse_type",0); queryWrapper.eq("out_in_warehouse_type",1);
queryWrapper.eq("is_delete", 0); queryWrapper.eq("is_delete", 0);
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{ sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{
"like:receiptNumber@receipt_number:str", "like:receiptNumber@receipt_number:str",
"=:warehouseId@warehouse_id:long", "=:warehouseId@warehouse_id:long",
"=:outWarehouseType@out_warehouse_type:long", "=:outInWarehouseType@out_in_warehouse_type:long",
"=:auditState@audit_state:int", "=:auditState@audit_state:int",
}); });
@ -161,14 +161,14 @@ public class SparePartOutWarehouseServiceImpl implements ISparePartOutWarehouseS
QueryWrapper<SparePartStockAudit> qw = new QueryWrapper<>(); QueryWrapper<SparePartStockAudit> qw = new QueryWrapper<>();
qw.select("max(id) as id"); qw.select("max(id) as id");
SparePartStockAudit sparePartStockAudit = sparePartStockAuditMapper.selectOne(qw); SparePartStockAudit sparePartStockAudit = sparePartStockAuditMapper.selectOne(qw);
if(sparePartStockAudit.getId() == null){ if(sparePartStockAudit == null){
model.setId(1L); model.setId(1L);
}else{ }else{
model.setId(sparePartStockAudit.getId() + 1); model.setId(sparePartStockAudit.getId() + 1);
} }
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 出库仓库 model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 出库仓库
model.setOutWarehouseType(sparePartStockAuditParam.getOutWarehouseType()); // 出库类别(0=调拨出库) model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType()); // 出库类别(1=调拨出库)
model.setConsignee(sparePartStockAuditParam.getConsignee()); // 收货单位(人员) model.setConsignee(sparePartStockAuditParam.getConsignee()); // 收货单位(人员)
model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话 model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话
model.setReceiptNumber(generateOrderNumber()); // 单据编号 model.setReceiptNumber(generateOrderNumber()); // 单据编号
@ -219,7 +219,7 @@ public class SparePartOutWarehouseServiceImpl implements ISparePartOutWarehouseS
Assert.notNull(model, "数据不存在!"); Assert.notNull(model, "数据不存在!");
model.setId(sparePartStockAuditParam.getId()); model.setId(sparePartStockAuditParam.getId());
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 出库仓库 model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); // 出库仓库
model.setOutWarehouseType(sparePartStockAuditParam.getOutWarehouseType()); // 出库类别 model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType()); // 出库类别1=调拨出库)
model.setConsignee(sparePartStockAuditParam.getConsignee()); // 收货单位(人员) model.setConsignee(sparePartStockAuditParam.getConsignee()); // 收货单位(人员)
model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话 model.setPhone(sparePartStockAuditParam.getPhone()); // 联系电话
model.setReceiptNumber(sparePartStockAuditParam.getReceiptNumber()); // 单据编号 model.setReceiptNumber(sparePartStockAuditParam.getReceiptNumber()); // 单据编号

View File

@ -63,4 +63,10 @@ public interface ISparePartStockAuditService {
* @param sparePartStockAuditParam * @param sparePartStockAuditParam
*/ */
void audit(SparePartStockAuditParam sparePartStockAuditParam); void audit(SparePartStockAuditParam sparePartStockAuditParam);
/**
*
* @param id
*/
void cancelAudit(Integer id);
} }

View File

@ -1,5 +1,6 @@
package com.hcy.admin.service.sparePartStockAudit.impl; package com.hcy.admin.service.sparePartStockAudit.impl;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -8,18 +9,26 @@ import com.hcy.admin.service.sparePartStockAudit.ISparePartStockAuditService;
import com.hcy.admin.validate.common.PageParam; import com.hcy.admin.validate.common.PageParam;
import com.hcy.admin.validate.sparePartStockAudit.SparePartStockAuditParam; import com.hcy.admin.validate.sparePartStockAudit.SparePartStockAuditParam;
import com.hcy.admin.vo.sparePart.SparePartListVo; import com.hcy.admin.vo.sparePart.SparePartListVo;
import com.hcy.admin.vo.sparePartInWarehouse.SparePartInWarehouseListVo;
import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditListVo; import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditListVo;
import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditDetailVo; import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditDetailVo;
import com.hcy.common.core.PageResult; import com.hcy.common.core.PageResult;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import com.hcy.common.entity.sparePart.SparePart; import com.hcy.common.entity.sparePart.SparePart;
import com.hcy.common.entity.sparePartStockAudit.SparePartStockAudit; import com.hcy.common.entity.sparePartStockAudit.SparePartStockAudit;
import com.hcy.common.entity.warehouse.Warehouse;
import com.hcy.common.enums.Audit.AuditStateEnum; import com.hcy.common.enums.Audit.AuditStateEnum;
import com.hcy.common.exception.OperateException;
import com.hcy.common.mapper.SparePartAudit.SparePartAuditMapper;
import com.hcy.common.mapper.sparePart.SparePartMapper;
import com.hcy.common.mapper.sparePartStockAudit.SparePartStockAuditMapper; import com.hcy.common.mapper.sparePartStockAudit.SparePartStockAuditMapper;
import com.hcy.common.mapper.warehouse.WarehouseMapper;
import com.hcy.common.utils.ArrayUtil; import com.hcy.common.utils.ArrayUtil;
import com.hcy.common.utils.TimeUtil; import com.hcy.common.utils.TimeUtil;
import com.hcy.common.utils.UrlUtil; import com.hcy.common.utils.UrlUtil;
import com.hcy.common.config.GlobalConfig; import com.hcy.common.config.GlobalConfig;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.connection.Message;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -35,6 +44,15 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
@Resource @Resource
SparePartStockAuditMapper sparePartStockAuditMapper; SparePartStockAuditMapper sparePartStockAuditMapper;
@Resource
SparePartMapper sparePartMapper;
@Resource
WarehouseMapper warehouseMapper;
@Resource
SparePartAuditMapper sparePartAuditMapper;
/** /**
* *
* *
@ -53,20 +71,10 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{ sparePartStockAuditMapper.setSearch(queryWrapper, params, new String[]{
"=:receiptNumber@receipt_number:str", "like:receiptNumber@receipt_number:str",
"=:receiptType@receipt_type:long", "=:receiptType@receipt_type:long",
"=:warehouseId@warehouse_id:long", "=:outInWarehouseType@out_in_warehouse_type:long",
"=:importWarehouse@import_warehouse:long",
"=:exportWarehouse@export_warehouse:long",
"=:inWarehouseType@in_warehouse_type:long",
"=:supplier:str",
"=:outWarehouseType@out_warehouse_type:long",
"=:responsiblePerson@responsible_person:str",
"=:handlingTime@handling_time:long",
"=:allotType@allot_type:long",
"=:consignee:str",
"=:auditState@audit_state:int", "=:auditState@audit_state:int",
"=:auditResult@audit_result:int",
}); });
IPage<SparePartStockAudit> iPage = sparePartStockAuditMapper.selectPage(new Page<>(page, limit), queryWrapper); IPage<SparePartStockAudit> iPage = sparePartStockAuditMapper.selectPage(new Page<>(page, limit), queryWrapper);
@ -76,6 +84,17 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
BeanUtils.copyProperties(item, vo); BeanUtils.copyProperties(item, vo);
vo.setCreateTime(TimeUtil.timestampToDate(item.getCreateTime())); vo.setCreateTime(TimeUtil.timestampToDate(item.getCreateTime()));
vo.setUpdateTime(TimeUtil.timestampToDate(item.getUpdateTime())); vo.setUpdateTime(TimeUtil.timestampToDate(item.getUpdateTime()));
vo.setAuditTime(TimeUtil.timestampToDate(item.getAuditTime()));
//获取仓库名称
Warehouse warehouse = warehouseMapper.selectOne(
new QueryWrapper<Warehouse>()
.eq("id", item.getWarehouseId())
.eq("is_delete", 0)
.last("limit 1"));
if (warehouse != null){
vo.setWarehouseName(warehouse.getWarehouseName());
}
list.add(vo); list.add(vo);
} }
@ -100,6 +119,65 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
Assert.notNull(model, "数据不存在"); Assert.notNull(model, "数据不存在");
SparePartStockAuditDetailVo vo = new SparePartStockAuditDetailVo(); SparePartStockAuditDetailVo vo = new SparePartStockAuditDetailVo();
//获取仓库名称
Warehouse warehouse = warehouseMapper.selectOne(
new QueryWrapper<Warehouse>()
.eq("id", model.getWarehouseId())
.eq("is_delete", 0)
.last("limit 1"));
if (warehouse != null){
vo.setWarehouseName(warehouse.getWarehouseName());
}
//判断是否是调拨单
if(model.getReceiptType() == AuditStateEnum.ALLOT.getStatus()){
// 调入仓库名
Warehouse importWarehouseName = warehouseMapper.selectOne(
new QueryWrapper<Warehouse>()
.eq("id", model.getImportWarehouse())
.eq("is_delete", 0)
.last("limit 1"));
vo.setImportWarehouseName(importWarehouseName.getWarehouseName());
// 调出仓库名
Warehouse exportWarehouseName = warehouseMapper.selectOne(
new QueryWrapper<Warehouse>()
.eq("id", model.getExportWarehouse())
.eq("is_delete", 0)
.last("limit 1"));
vo.setExportWarehouseName(exportWarehouseName.getWarehouseName());
}
BeanUtils.copyProperties(model, vo);
//获取待审核备件信息
List<SparePartAudit> stockAuditId = sparePartAuditMapper.selectList(
new QueryWrapper<SparePartAudit>()
.eq("stock_audit_id", model.getId())
.eq("is_delete", 0)
);
//获取备件信息
List<SparePartAudit> listVo = new ArrayList<>();
for (SparePartAudit sparePartAudit : stockAuditId) {
SparePart sparePart = sparePartMapper.selectOne(
new QueryWrapper<SparePart>()
.eq("id", sparePartAudit.getSparePartsId())
.eq("is_delete", 0)
.last("limit 1"));
SparePartAudit sparePartAudit1 = new SparePartAudit();
BeanUtils.copyProperties(sparePart, sparePartAudit1);
sparePartAudit1.setId(sparePartAudit.getId());
sparePartAudit1.setSparePartsId(sparePart.getId());
sparePartAudit1.setStockAuditId(sparePartAudit.getStockAuditId());
sparePartAudit1.setCount(sparePartAudit.getCount()); // 入库数量
listVo.add(sparePartAudit1);
}
vo.setSupplierPhone(model.getSupplier() + "/" + model.getPhone()); // 供应商/电话
vo.setConsigneePhone(model.getConsignee() + "/" + model.getPhone()); // 收货单位(人员)/电话
vo.setSparePartAuditList(listVo);
vo.setHandlingTime(TimeUtil.timestampToDate(model.getHandlingTime())); //经办时间
BeanUtils.copyProperties(model, vo); BeanUtils.copyProperties(model, vo);
return vo; return vo;
} }
@ -118,12 +196,10 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); model.setWarehouseId(sparePartStockAuditParam.getWarehouseId());
model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse()); model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse());
model.setExportWarehouse(sparePartStockAuditParam.getExportWarehouse()); model.setExportWarehouse(sparePartStockAuditParam.getExportWarehouse());
model.setInWarehouseType(sparePartStockAuditParam.getInWarehouseType());
model.setSupplier(sparePartStockAuditParam.getSupplier()); model.setSupplier(sparePartStockAuditParam.getSupplier());
model.setOutWarehouseType(sparePartStockAuditParam.getOutWarehouseType());
model.setResponsiblePerson(sparePartStockAuditParam.getResponsiblePerson()); model.setResponsiblePerson(sparePartStockAuditParam.getResponsiblePerson());
model.setHandlingTime(sparePartStockAuditParam.getHandlingTime().getTime()); model.setHandlingTime(sparePartStockAuditParam.getHandlingTime().getTime());
model.setAllotType(sparePartStockAuditParam.getAllotType()); model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType());
model.setConsignee(sparePartStockAuditParam.getConsignee()); model.setConsignee(sparePartStockAuditParam.getConsignee());
model.setAuditState(sparePartStockAuditParam.getAuditState()); model.setAuditState(sparePartStockAuditParam.getAuditState());
model.setAuditResult(sparePartStockAuditParam.getAuditResult()); model.setAuditResult(sparePartStockAuditParam.getAuditResult());
@ -156,12 +232,10 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
model.setWarehouseId(sparePartStockAuditParam.getWarehouseId()); model.setWarehouseId(sparePartStockAuditParam.getWarehouseId());
model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse()); model.setImportWarehouse(sparePartStockAuditParam.getImportWarehouse());
model.setExportWarehouse(sparePartStockAuditParam.getExportWarehouse()); model.setExportWarehouse(sparePartStockAuditParam.getExportWarehouse());
model.setInWarehouseType(sparePartStockAuditParam.getInWarehouseType());
model.setSupplier(sparePartStockAuditParam.getSupplier()); model.setSupplier(sparePartStockAuditParam.getSupplier());
model.setOutWarehouseType(sparePartStockAuditParam.getOutWarehouseType());
model.setResponsiblePerson(sparePartStockAuditParam.getResponsiblePerson()); model.setResponsiblePerson(sparePartStockAuditParam.getResponsiblePerson());
model.setHandlingTime(sparePartStockAuditParam.getHandlingTime().getTime()); model.setHandlingTime(sparePartStockAuditParam.getHandlingTime().getTime());
model.setAllotType(sparePartStockAuditParam.getAllotType()); model.setOutInWarehouseType(sparePartStockAuditParam.getOutInWarehouseType());
model.setConsignee(sparePartStockAuditParam.getConsignee()); model.setConsignee(sparePartStockAuditParam.getConsignee());
model.setAuditState(sparePartStockAuditParam.getAuditState()); model.setAuditState(sparePartStockAuditParam.getAuditState());
model.setAuditResult(sparePartStockAuditParam.getAuditResult()); model.setAuditResult(sparePartStockAuditParam.getAuditResult());
@ -215,7 +289,98 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
model.setAuditTime(System.currentTimeMillis() / 1000); // 审核时间 model.setAuditTime(System.currentTimeMillis() / 1000); // 审核时间
model.setAuditIdea(sparePartStockAuditParam.getAuditIdea()); // 审核意见 model.setAuditIdea(sparePartStockAuditParam.getAuditIdea()); // 审核意见
// 出库时需要判断库存数量是否大于出库数量,大于才允许出库;反之,提示备件库存数量不足
//获取待审核备件信息
List<SparePartAudit> stockAuditId = sparePartAuditMapper.selectList(
new QueryWrapper<SparePartAudit>()
.eq("stock_audit_id", model.getId())
.eq("is_delete", 0)
);
if(model.getReceiptType() == AuditStateEnum.INWAREHOUSE.getStatus()
&& model.getAuditResult() == AuditStateEnum.ALREADYPASSED.getStatus()){
//已通过审核的入库单
//获取备件信息
for (SparePartAudit sparePartAudit : stockAuditId) {
SparePart sparePart = sparePartMapper.selectOne(
new QueryWrapper<SparePart>()
.eq("id", sparePartAudit.getSparePartsId())
.eq("is_delete", 0)
.last("limit 1"));
sparePart.setQuantity(sparePart.getQuantity() + sparePartAudit.getCount());
sparePartMapper.updateById(sparePart);
}
}else if(model.getReceiptType() == AuditStateEnum.OUTWAREHOUSE.getStatus()
&& model.getAuditResult() == AuditStateEnum.ALREADYPASSED.getStatus()){
// 通过审核的出库单
//获取备件信息
for (SparePartAudit sparePartAudit : stockAuditId) {
SparePart sparePart = sparePartMapper.selectOne(
new QueryWrapper<SparePart>()
.eq("id", sparePartAudit.getSparePartsId())
.eq("is_delete", 0)
.last("limit 1"));
// 出库时需要判断库存数量是否大于出库数量,大于才允许出库;反之,提示备件库存数量不足
if(sparePart.getQuantity() >= sparePartAudit.getCount()){
sparePart.setQuantity(sparePart.getQuantity() - sparePartAudit.getCount());
}else{
throw new OperateException("备件库存数量不足");
}
sparePartMapper.updateById(sparePart);
}
}else if(model.getReceiptType() == AuditStateEnum.ALLOT.getStatus()
&& model.getAuditResult() == AuditStateEnum.ALREADYPASSED.getStatus()){
//通过审核的调拨单
//获取备件信息
for (SparePartAudit sparePartAudit : stockAuditId) {
//调出仓库
SparePart sparePart = sparePartMapper.selectOne(
new QueryWrapper<SparePart>()
.eq("id", sparePartAudit.getSparePartsId())
.eq("warehouse_id", model.getExportWarehouse())
.eq("is_delete", 0)
.last("limit 1"));
// 出库时需要判断库存数量是否大于出库数量,大于才允许出库;反之,提示备件库存数量不足
if(sparePart.getQuantity() >= sparePartAudit.getCount()){
sparePart.setQuantity(sparePart.getQuantity() - sparePartAudit.getCount());
}else{
throw new OperateException("备件库存数量不足");
}
sparePartMapper.updateById(sparePart);
/*//调入仓库
SparePart inSparePart = sparePartMapper.selectOne(
new QueryWrapper<SparePart>()
.eq("id", sparePartAudit.getSparePartsId())
.eq("warehouse_id", model.getImportWarehouse())
.eq("is_delete", 0)
.last("limit 1"));
inSparePart.setQuantity(inSparePart.getQuantity() + sparePartAudit.getCount());
sparePartMapper.updateById(inSparePart);*/
}
}
sparePartStockAuditMapper.updateById(model); sparePartStockAuditMapper.updateById(model);
} }
/**
*
*
* @author hcy
* @param id ID
*/
@Override
public void cancelAudit(Integer id) {
SparePartStockAudit model = sparePartStockAuditMapper.selectOne(
new QueryWrapper<SparePartStockAudit>()
.eq("id", id)
.eq("is_delete", 0)
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
model.setAuditState(AuditStateEnum.CANCELED.getStatus()); //取消审核
model.setUpdateTime(System.currentTimeMillis() / 1000);
sparePartStockAuditMapper.updateById(model);
}
} }

View File

@ -44,18 +44,10 @@ public class SparePartStockAuditParam implements Serializable {
@DecimalMin(value = "0", message = "exportWarehouse参数值不能少于0", groups = {create.class, update.class}) @DecimalMin(value = "0", message = "exportWarehouse参数值不能少于0", groups = {create.class, update.class})
private Long exportWarehouse; private Long exportWarehouse;
//@NotNull(message = "inWarehouseType参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "inWarehouseType参数值不能少于0", groups = {create.class, update.class})
private Long inWarehouseType;
//@NotNull(message = "supplier参数缺失", groups = {create.class, update.class}) //@NotNull(message = "supplier参数缺失", groups = {create.class, update.class})
@Length(max = 32, message = "supplier参数不能超出32个字符", groups = {create.class, update.class}) @Length(max = 32, message = "supplier参数不能超出32个字符", groups = {create.class, update.class})
private String supplier; private String supplier;
//@NotNull(message = "outWarehouseType参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "outWarehouseType参数值不能少于0", groups = {create.class, update.class})
private Long outWarehouseType;
//@NotNull(message = "responsiblePerson参数缺失", groups = {create.class, update.class}) //@NotNull(message = "responsiblePerson参数缺失", groups = {create.class, update.class})
@Length(max = 32, message = "responsiblePerson参数不能超出32个字符", groups = {create.class, update.class}) @Length(max = 32, message = "responsiblePerson参数不能超出32个字符", groups = {create.class, update.class})
private String responsiblePerson; private String responsiblePerson;
@ -63,9 +55,7 @@ public class SparePartStockAuditParam implements Serializable {
// @NotNull(message = "handlingTime参数缺失", groups = {create.class, update.class}) // @NotNull(message = "handlingTime参数缺失", groups = {create.class, update.class})
private Date handlingTime; private Date handlingTime;
//@NotNull(message = "allotType参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "allotType参数值不能少于0", groups = {create.class, update.class})
private Long allotType;
//@NotNull(message = "consignee参数缺失", groups = {create.class, update.class}) //@NotNull(message = "consignee参数缺失", groups = {create.class, update.class})
@Length(max = 255, message = "consignee参数不能超出255个字符", groups = {create.class, update.class}) @Length(max = 255, message = "consignee参数不能超出255个字符", groups = {create.class, update.class})
@ -93,4 +83,6 @@ public class SparePartStockAuditParam implements Serializable {
private String sparePartAuditId; // 备件审核id private String sparePartAuditId; // 备件审核id
private List<SparePartAudit> sparePartAuditList; //待入库的备件 private List<SparePartAudit> sparePartAuditList; //待入库的备件
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -17,7 +17,6 @@ public class SparePartOutWarehouseListVo implements Serializable {
private Long id; // 主键id private Long id; // 主键id
private String receiptNumber; // 单据编号 private String receiptNumber; // 单据编号
private Long warehouseId; // 所属仓库 private Long warehouseId; // 所属仓库
private Long outWarehouseType; // 出库类别0=调拨出库)
private String consignee; // 收货单位(人员) private String consignee; // 收货单位(人员)
private String phone; // 联系电话 private String phone; // 联系电话
private String responsiblePerson; // 经办人 private String responsiblePerson; // 经办人
@ -29,7 +28,9 @@ public class SparePartOutWarehouseListVo implements Serializable {
private String createTime; // 创建时间 private String createTime; // 创建时间
private String updateTime; // 更新时间 private String updateTime; // 更新时间
private String sparePartAuditId; // 备件审核id private String sparePartAuditId; // 备件审核id
private String consigneePhone; // 供应商/电话 private String consigneePhone; // 收货单位(人员)/电话
private List<SparePartAudit> sparePartAuditList; //待入库的备件 private List<SparePartAudit> sparePartAuditList; //待入库的备件
private String warehouseName; // 所属仓库名 private String warehouseName; // 所属仓库名
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -31,4 +31,6 @@ public class SparePartAllotListVo implements Serializable {
private List<SparePartAudit> sparePartAuditList; //待入库的备件 private List<SparePartAudit> sparePartAuditList; //待入库的备件
private String importWarehouseName; // 调入仓库名 private String importWarehouseName; // 调入仓库名
private String exportWarehouseName; // 调出仓库名 private String exportWarehouseName; // 调出仓库名
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -17,7 +17,6 @@ public class SparePartInWarehouseListVo implements Serializable {
private Long id; // 主键id private Long id; // 主键id
private String receiptNumber; // 单据编号 private String receiptNumber; // 单据编号
private Long warehouseId; // 所属仓库 private Long warehouseId; // 所属仓库
private Long inWarehouseType; // 入库类别0=采购入库)
private String supplier; // 供应商 private String supplier; // 供应商
private String phone; // 联系电话 private String phone; // 联系电话
private String responsiblePerson; // 经办人 private String responsiblePerson; // 经办人
@ -32,4 +31,6 @@ public class SparePartInWarehouseListVo implements Serializable {
private String supplierPhone; // 供应商/电话 private String supplierPhone; // 供应商/电话
private List<SparePartAudit> sparePartAuditList; //待入库的备件 private List<SparePartAudit> sparePartAuditList; //待入库的备件
private String warehouseName; // 所属仓库名 private String warehouseName; // 所属仓库名
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -1,8 +1,11 @@
package com.hcy.admin.vo.sparePartStockAudit; package com.hcy.admin.vo.sparePartStockAudit;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* SparePartStockAuditVo * SparePartStockAuditVo
@ -14,20 +17,17 @@ public class SparePartStockAuditDetailVo implements Serializable {
private Long id; // 主键id private Long id; // 主键id
private String receiptNumber; // 单据编号 private String receiptNumber; // 单据编号
private Long receiptType; // 单据类型0=入库单1=出库单2=仓库调拨单) private Integer receiptType; // 单据类型0=入库单1=出库单2=仓库调拨单)
private Long warehouseId; // 所属仓库 private Long warehouseId; // 所属仓库
private Long importWarehouse; // 调入仓库 private Long importWarehouse; // 调入仓库
private Long exportWarehouse; // 调出仓库 private Long exportWarehouse; // 调出仓库
private Long inWarehouseType; // 入库类别0=采购入库)
private String supplier; // 供应商 private String supplier; // 供应商
private Long outWarehouseType; // 出库类别0=调拨出库)
private String responsiblePerson; // 经办人 private String responsiblePerson; // 经办人
private Long handlingTime; // 经办时间 private String handlingTime; // 经办时间
private Long allotType; // 调拨类别
private String consignee; // 收货单位(人员) private String consignee; // 收货单位(人员)
private Integer auditState; // 审核状态0=未审核1=已审核2=已取消) private Integer auditState; // 审核状态0=未审核1=已审核2=已取消)
private Integer auditResult; // 审核结果0=未通过1=已通过) private Integer auditResult; // 审核结果0=未通过1=已通过)
private Long auditTime; // 审核时间 private String auditTime; // 审核时间
private String auditIdea; // 审核意见 private String auditIdea; // 审核意见
private String phone; // 联系电话 private String phone; // 联系电话
private String remark; // 备注 private String remark; // 备注
@ -35,4 +35,11 @@ public class SparePartStockAuditDetailVo implements Serializable {
private String warehouseName; // 所属仓库名 private String warehouseName; // 所属仓库名
private String importWarehouseName; // 调入仓库名 private String importWarehouseName; // 调入仓库名
private String exportWarehouseName; // 调出仓库名 private String exportWarehouseName; // 调出仓库名
private List<SparePartAudit> sparePartAuditList; //待入库的备件
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
private String supplierPhone; // 供应商/电话
private String consigneePhone; // 收货单位(人员)/电话
} }

View File

@ -20,16 +20,13 @@ public class SparePartStockAuditListVo implements Serializable {
private Long warehouseId; // 所属仓库 private Long warehouseId; // 所属仓库
private Long importWarehouse; // 调入仓库 private Long importWarehouse; // 调入仓库
private Long exportWarehouse; // 调出仓库 private Long exportWarehouse; // 调出仓库
private Long inWarehouseType; // 入库类别0=采购入库)
private String supplier; // 供应商 private String supplier; // 供应商
private Long outWarehouseType; // 出库类别0=调拨出库)
private String responsiblePerson; // 经办人 private String responsiblePerson; // 经办人
private Long handlingTime; // 经办时间 private String handlingTime; // 经办时间
private Long allotType; // 调拨类别
private String consignee; // 收货单位(人员) private String consignee; // 收货单位(人员)
private Integer auditState; // 审核状态0=未审核1=已审核2=已取消) private Integer auditState; // 审核状态0=未审核1=已审核2=已取消)
private Integer auditResult; // 审核结果0=未通过1=已通过) private Integer auditResult; // 审核结果0=未通过1=已通过)
private Long auditTime; // 审核时间 private String auditTime; // 审核时间
private String createTime; // 创建时间 private String createTime; // 创建时间
private String updateTime; // 更新时间 private String updateTime; // 更新时间
private String sparePartAuditId; // 备件审核id private String sparePartAuditId; // 备件审核id
@ -39,4 +36,5 @@ public class SparePartStockAuditListVo implements Serializable {
private String warehouseName; // 所属仓库名 private String warehouseName; // 所属仓库名
private String importWarehouseName; // 调入仓库名 private String importWarehouseName; // 调入仓库名
private String exportWarehouseName; // 调出仓库名 private String exportWarehouseName; // 调出仓库名
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -21,12 +21,9 @@ public class SparePartStockAudit implements Serializable {
private Long warehouseId; // 所属仓库 private Long warehouseId; // 所属仓库
private Long importWarehouse; // 调入仓库 private Long importWarehouse; // 调入仓库
private Long exportWarehouse; // 调出仓库 private Long exportWarehouse; // 调出仓库
private Long inWarehouseType; // 入库类别0=采购入库)
private String supplier; // 供应商 private String supplier; // 供应商
private Long outWarehouseType; // 出库类别0=调拨出库)
private String responsiblePerson; // 经办人 private String responsiblePerson; // 经办人
private Long handlingTime; // 经办时间 private Long handlingTime; // 经办时间
private Long allotType; // 调拨类别
private String consignee; // 收货单位(人员) private String consignee; // 收货单位(人员)
private Integer auditState; // 审核状态0=未审核1=已审核2=已取消) private Integer auditState; // 审核状态0=未审核1=已审核2=已取消)
private Integer auditResult; // 审核结果0=未通过1=已通过) private Integer auditResult; // 审核结果0=未通过1=已通过)
@ -39,4 +36,5 @@ public class SparePartStockAudit implements Serializable {
private Long updateTime; // 更新时间 private Long updateTime; // 更新时间
private Long deleteTime; // 删除时间 private Long deleteTime; // 删除时间
private String sparePartAuditId; // 备件审核id private String sparePartAuditId; // 备件审核id
private Long outInWarehouseType; // 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
} }

View File

@ -19,9 +19,16 @@ public enum AuditStateEnum {
ALREADYPASSED(1, "已通过"), ALREADYPASSED(1, "已通过"),
// 单据类型0=入库单1=出库单2=仓库调拨单) // 单据类型0=入库单1=出库单2=仓库调拨单)
INWAREHOUSE(0,"入库单"), INWAREHOUSE(0, "入库单"),
OUTWAREHOUSE(1, "出库单"), OUTWAREHOUSE(1, "出库单"),
ALLOT(2,"仓库调拨单"); ALLOT(2,"仓库调拨单"),
// 出入库类别0=采购入库1=调拨出库2=库存调拨3=员工领料4=销售出库)
STOCKIN(0,"采购入库"),
STOCKOUT(1, "调拨出库"),
STOCKTRANSFER(2, "库存调拨"),
GETMATERIALS(3,"员工领料"),
SALESOUTBOUND(4, "销售出库");
private final int status; private final int status;
private final String desc; private final String desc;