出入库优化
This commit is contained in:
@@ -2,6 +2,7 @@ package com.gear.mat.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gear.common.exception.ServiceException;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
@@ -146,7 +147,28 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MatMaterial entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isNotBlank(entity.getMaterialName())) {
|
||||
entity.setMaterialName(entity.getMaterialName().trim());
|
||||
}
|
||||
if (StringUtils.isNotBlank(entity.getFactory())) {
|
||||
entity.setFactory(entity.getFactory().trim());
|
||||
}
|
||||
if (StringUtils.isBlank(entity.getMaterialName()) || StringUtils.isBlank(entity.getFactory()) || entity.getMaterialType() == null) {
|
||||
return;
|
||||
}
|
||||
Long cnt = baseMapper.selectCount(Wrappers.<MatMaterial>lambdaQuery()
|
||||
.eq(MatMaterial::getMaterialName, entity.getMaterialName())
|
||||
.eq(MatMaterial::getFactory, entity.getFactory())
|
||||
.eq(MatMaterial::getMaterialType, entity.getMaterialType())
|
||||
.eq(MatMaterial::getDelFlag, 0)
|
||||
.ne(entity.getMaterialId() != null, MatMaterial::getMaterialId, entity.getMaterialId()));
|
||||
if (cnt != null && cnt > 0) {
|
||||
String typeLabel = Objects.equals(entity.getMaterialType(), 2) ? "主材" : Objects.equals(entity.getMaterialType(), 1) ? "辅材" : "原料";
|
||||
throw new ServiceException(typeLabel + "已存在:" + entity.getMaterialName() + " - " + entity.getFactory());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearStockIoOrderBo;
|
||||
import com.gear.oa.domain.bo.GearStockIoOrderWithDetailBo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderVo;
|
||||
@@ -18,9 +19,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@@ -36,6 +39,13 @@ public class GearStockIoOrderController extends BaseController {
|
||||
return stockIoOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearStockIoOrderBo bo, HttpServletResponse response) {
|
||||
List<GearStockIoOrderVo> list = stockIoOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "出入库单据", GearStockIoOrderVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{orderId}")
|
||||
public R<GearStockIoOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
return R.ok(stockIoOrderService.queryById(orderId));
|
||||
@@ -68,57 +78,19 @@ public class GearStockIoOrderController extends BaseController {
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/submit/{orderId}")
|
||||
public R<Void> submit(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.submitOrder(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/audit/{orderId}")
|
||||
public R<Void> audit(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.auditOrder(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/execute/{orderId}")
|
||||
public R<Void> execute(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.executeOrder(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/arrival/{orderId}")
|
||||
public R<Void> arrival(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.confirmArrival(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/finish/{orderId}")
|
||||
public R<Void> finish(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.finishOrder(orderId);
|
||||
@PostMapping("/confirmIn/{orderId}")
|
||||
public R<Void> confirmIn(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.confirmIn(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/cancel/{orderId}")
|
||||
public R<Void> cancel(@NotNull(message = "主键不能为空") @PathVariable Long orderId,
|
||||
@PostMapping("/revoke/{orderId}")
|
||||
public R<Void> revoke(@NotNull(message = "主键不能为空") @PathVariable Long orderId,
|
||||
@RequestBody(required = false) Map<String, Object> payload) {
|
||||
String reason = payload == null ? "" : String.valueOf(payload.getOrDefault("reason", ""));
|
||||
stockIoOrderService.cancelOrder(orderId, reason);
|
||||
stockIoOrderService.revoke(orderId, reason);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/reverse/{orderId}")
|
||||
public R<Long> reverse(@NotNull(message = "主键不能为空") @PathVariable Long orderId,
|
||||
@RequestBody(required = false) Map<String, Object> payload) {
|
||||
String reason = payload == null ? "" : String.valueOf(payload.getOrDefault("reason", ""));
|
||||
return R.ok(stockIoOrderService.reverseOrder(orderId, reason));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,18 @@ public class GearStockIoOrder extends BaseEntity {
|
||||
|
||||
private String execFlag;
|
||||
|
||||
private String confirmInFlag;
|
||||
|
||||
private String confirmInBy;
|
||||
|
||||
private Date confirmInTime;
|
||||
|
||||
private String revokeFlag;
|
||||
|
||||
private String revokeBy;
|
||||
|
||||
private Date revokeTime;
|
||||
|
||||
private String reversalFlag;
|
||||
|
||||
private Long reversalOrderId;
|
||||
@@ -89,4 +101,3 @@ public class GearStockIoOrder extends BaseEntity {
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ public class GearStockIoOrderDetail extends BaseEntity {
|
||||
|
||||
private Long itemId;
|
||||
|
||||
private Integer materialTypeSnapshot;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String specName;
|
||||
@@ -54,4 +56,3 @@ public class GearStockIoOrderDetail extends BaseEntity {
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ public class GearStockIoOrderBo extends BaseEntity {
|
||||
|
||||
private String execFlag;
|
||||
|
||||
private String confirmInFlag;
|
||||
|
||||
private String revokeFlag;
|
||||
|
||||
private String reversalFlag;
|
||||
|
||||
private Long reversalOrderId;
|
||||
@@ -87,4 +91,3 @@ public class GearStockIoOrderBo extends BaseEntity {
|
||||
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ public class GearStockIoOrderDetailBo extends BaseEntity {
|
||||
@NotNull(message = "物料ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long itemId;
|
||||
|
||||
private Integer materialTypeSnapshot;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String specName;
|
||||
@@ -53,4 +55,3 @@ public class GearStockIoOrderDetailBo extends BaseEntity {
|
||||
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ public class GearStockIoOrderDetailVo extends BaseEntity {
|
||||
|
||||
private Long itemId;
|
||||
|
||||
private Integer materialTypeSnapshot;
|
||||
|
||||
@ExcelProperty(value = "物料名称")
|
||||
private String itemName;
|
||||
|
||||
@@ -49,4 +51,3 @@ public class GearStockIoOrderDetailVo extends BaseEntity {
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,18 @@ public class GearStockIoOrderVo extends BaseEntity {
|
||||
|
||||
private String execFlag;
|
||||
|
||||
private String confirmInFlag;
|
||||
|
||||
private String confirmInBy;
|
||||
|
||||
private Date confirmInTime;
|
||||
|
||||
private String revokeFlag;
|
||||
|
||||
private String revokeBy;
|
||||
|
||||
private Date revokeTime;
|
||||
|
||||
private String reversalFlag;
|
||||
|
||||
private Long reversalOrderId;
|
||||
|
||||
@@ -26,18 +26,7 @@ public interface IGearStockIoOrderService {
|
||||
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
void submitOrder(Long orderId);
|
||||
void confirmIn(Long orderId);
|
||||
|
||||
void auditOrder(Long orderId);
|
||||
|
||||
void executeOrder(Long orderId);
|
||||
|
||||
void confirmArrival(Long orderId);
|
||||
|
||||
void finishOrder(Long orderId);
|
||||
|
||||
void cancelOrder(Long orderId, String reason);
|
||||
|
||||
Long reverseOrder(Long orderId, String reason);
|
||||
void revoke(Long orderId, String reason);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,8 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBizType()), GearStockIoOrder::getBizType, bo.getBizType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), GearStockIoOrder::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getExecFlag()), GearStockIoOrder::getExecFlag, bo.getExecFlag());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getConfirmInFlag()), GearStockIoOrder::getConfirmInFlag, bo.getConfirmInFlag());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRevokeFlag()), GearStockIoOrder::getRevokeFlag, bo.getRevokeFlag());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReversalFlag()), GearStockIoOrder::getReversalFlag, bo.getReversalFlag());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getSourceNo()), GearStockIoOrder::getSourceNo, bo.getSourceNo());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getResponsibleName()), GearStockIoOrder::getResponsibleName, bo.getResponsibleName());
|
||||
@@ -144,6 +146,8 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
order.setStatus("0");
|
||||
order.setExecFlag("0");
|
||||
order.setConfirmInFlag("0");
|
||||
order.setRevokeFlag("0");
|
||||
order.setReversalFlag("0");
|
||||
order.setDelayMinutes(0);
|
||||
order.setDelayStatus("0");
|
||||
@@ -158,19 +162,17 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
|
||||
insertDetails(order.getOrderId(), bo.getDetails());
|
||||
|
||||
if ("O".equalsIgnoreCase(order.getIoType())) {
|
||||
List<GearStockIoOrderDetail> details = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
.eq(GearStockIoOrderDetail::getOrderId, order.getOrderId())
|
||||
.orderByAsc(GearStockIoOrderDetail::getLineNo));
|
||||
applyMaterialStockChange(order.getIoType(), details);
|
||||
applyMaterialStockChange("O", details, "原料库存不足,无法出库");
|
||||
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(order.getOrderId());
|
||||
update.setExecFlag("1");
|
||||
update.setExecuteBy(LoginHelper.getNickName());
|
||||
update.setExecuteTime(new Date());
|
||||
update.setStatus("1");
|
||||
update.setActualFinishTime(new Date());
|
||||
baseMapper.updateById(update);
|
||||
}
|
||||
return order.getOrderId();
|
||||
@@ -285,66 +287,16 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitOrder(Long orderId) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
Long cnt = detailMapper.selectCount(Wrappers.<GearStockIoOrderDetail>lambdaQuery().eq(GearStockIoOrderDetail::getOrderId, orderId));
|
||||
if (cnt == null || cnt <= 0) {
|
||||
throw new ServiceException("单据明细不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditOrder(Long orderId) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
if (order.getAuditTime() != null) {
|
||||
return;
|
||||
}
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(orderId);
|
||||
update.setAuditBy(LoginHelper.getNickName());
|
||||
update.setAuditTime(new Date());
|
||||
baseMapper.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void executeOrder(Long orderId) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
if ("1".equals(order.getExecFlag())) {
|
||||
return;
|
||||
}
|
||||
List<GearStockIoOrderDetail> details = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
.eq(GearStockIoOrderDetail::getOrderId, orderId)
|
||||
.orderByAsc(GearStockIoOrderDetail::getLineNo));
|
||||
if (details == null || details.isEmpty()) {
|
||||
throw new ServiceException("单据明细不能为空");
|
||||
}
|
||||
applyMaterialStockChange(order.getIoType(), details);
|
||||
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(orderId);
|
||||
update.setExecFlag("1");
|
||||
update.setExecuteBy(LoginHelper.getNickName());
|
||||
update.setExecuteTime(new Date());
|
||||
update.setStatus("1");
|
||||
update.setActualFinishTime(new Date());
|
||||
baseMapper.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirmArrival(Long orderId) {
|
||||
public void confirmIn(Long orderId) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
ensureNotRevoked(order);
|
||||
if (!"I".equalsIgnoreCase(order.getIoType())) {
|
||||
throw new ServiceException("仅入库单支持到货确认");
|
||||
throw new ServiceException("仅入库单支持确认入库");
|
||||
}
|
||||
if ("1".equals(order.getExecFlag())) {
|
||||
if ("1".equals(order.getConfirmInFlag())) {
|
||||
return;
|
||||
}
|
||||
List<GearStockIoOrderDetail> details = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
@@ -353,146 +305,54 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
if (details == null || details.isEmpty()) {
|
||||
throw new ServiceException("单据明细不能为空");
|
||||
}
|
||||
applyMaterialStockChange("I", details);
|
||||
for (GearStockIoOrderDetail d : details) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
if (d.getItemId() == null) {
|
||||
throw new ServiceException("原料ID不能为空");
|
||||
}
|
||||
if (d.getQuantity() == null || d.getQuantity().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new ServiceException("入库数量必须大于0");
|
||||
}
|
||||
fillMaterialSnapshotIfNeeded(d);
|
||||
detailMapper.updateById(d);
|
||||
}
|
||||
applyMaterialStockChange("I", details, "确认入库失败");
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(orderId);
|
||||
update.setConfirmInFlag("1");
|
||||
update.setConfirmInBy(LoginHelper.getNickName());
|
||||
update.setConfirmInTime(new Date());
|
||||
update.setActualArrivalTime(new Date());
|
||||
update.setExecFlag("1");
|
||||
update.setExecuteBy(LoginHelper.getNickName());
|
||||
update.setExecuteTime(new Date());
|
||||
baseMapper.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishOrder(Long orderId) {
|
||||
public void revoke(Long orderId, String reason) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
if ("1".equals(order.getStatus())) {
|
||||
return;
|
||||
}
|
||||
Date finishTime = order.getActualFinishTime() != null ? order.getActualFinishTime() : new Date();
|
||||
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(orderId);
|
||||
update.setStatus("1");
|
||||
update.setActualFinishTime(finishTime);
|
||||
fillDelayOnFinish(order, update, finishTime);
|
||||
baseMapper.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelOrder(Long orderId, String reason) {
|
||||
GearStockIoOrder order = requireOrder(orderId);
|
||||
ensureNotCanceled(order);
|
||||
if ("1".equals(order.getExecFlag())) {
|
||||
throw new ServiceException("已执行单据不允许作废");
|
||||
}
|
||||
if ("1".equals(order.getStatus())) {
|
||||
throw new ServiceException("已完成单据不允许作废");
|
||||
}
|
||||
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(orderId);
|
||||
update.setCancelReason(StringUtils.isBlank(reason) ? "" : reason);
|
||||
update.setCancelTime(new Date());
|
||||
update.setDelFlag("2");
|
||||
baseMapper.updateById(update);
|
||||
|
||||
detailMapper.delete(Wrappers.<GearStockIoOrderDetail>lambdaQuery().eq(GearStockIoOrderDetail::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long reverseOrder(Long orderId, String reason) {
|
||||
GearStockIoOrder original = requireOrder(orderId);
|
||||
ensureNotCanceled(original);
|
||||
if ("1".equals(original.getReversalFlag())) {
|
||||
throw new ServiceException("冲销单不允许再冲销");
|
||||
}
|
||||
if (!"1".equals(original.getExecFlag())) {
|
||||
throw new ServiceException("原单未执行,无法冲销");
|
||||
}
|
||||
|
||||
Long exists = baseMapper.selectCount(Wrappers.<GearStockIoOrder>lambdaQuery()
|
||||
.eq(GearStockIoOrder::getReversalFlag, "1")
|
||||
.eq(GearStockIoOrder::getReversalOrderId, orderId));
|
||||
if (exists != null && exists > 0) {
|
||||
throw new ServiceException("该单据已创建冲销单");
|
||||
}
|
||||
|
||||
List<GearStockIoOrderDetail> originalDetails = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
ensureNotRevoked(order);
|
||||
List<GearStockIoOrderDetail> details = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
.eq(GearStockIoOrderDetail::getOrderId, orderId)
|
||||
.orderByAsc(GearStockIoOrderDetail::getLineNo));
|
||||
if (originalDetails == null || originalDetails.isEmpty()) {
|
||||
throw new ServiceException("原单明细为空,无法冲销");
|
||||
|
||||
if ("O".equalsIgnoreCase(order.getIoType()) && "1".equals(order.getExecFlag())) {
|
||||
applyMaterialStockChange("I", details, "撤回出库失败");
|
||||
}
|
||||
|
||||
GearStockIoOrder reversal = new GearStockIoOrder();
|
||||
reversal.setOrderCode("SIOO_R_" + IdUtil.getSnowflakeNextIdStr());
|
||||
reversal.setIoType(reverseIoType(original.getIoType()));
|
||||
reversal.setBizType(original.getBizType());
|
||||
reversal.setSourceType("reversal");
|
||||
reversal.setSourceNo(original.getOrderCode());
|
||||
reversal.setSourceOrderId(original.getOrderId());
|
||||
reversal.setResponsibleId(original.getResponsibleId());
|
||||
reversal.setResponsibleName(original.getResponsibleName());
|
||||
reversal.setWarehouseId(original.getWarehouseId());
|
||||
reversal.setFromWarehouseId(original.getFromWarehouseId());
|
||||
reversal.setToWarehouseId(original.getToWarehouseId());
|
||||
reversal.setStatus("0");
|
||||
reversal.setExecFlag("0");
|
||||
reversal.setReversalFlag("1");
|
||||
reversal.setReversalOrderId(original.getOrderId());
|
||||
reversal.setReversalReason(StringUtils.isBlank(reason) ? "" : reason);
|
||||
reversal.setReversalTime(new Date());
|
||||
reversal.setDelayMinutes(0);
|
||||
reversal.setDelayStatus("0");
|
||||
reversal.setDelFlag("0");
|
||||
reversal.setTotalQty(original.getTotalQty());
|
||||
reversal.setRemark(original.getRemark());
|
||||
baseMapper.insert(reversal);
|
||||
|
||||
int lineNo = 1;
|
||||
for (GearStockIoOrderDetail od : originalDetails) {
|
||||
GearStockIoOrderDetail rd = new GearStockIoOrderDetail();
|
||||
rd.setOrderId(reversal.getOrderId());
|
||||
rd.setLineNo(od.getLineNo() == null ? lineNo++ : od.getLineNo());
|
||||
rd.setItemType(od.getItemType());
|
||||
rd.setItemId(od.getItemId());
|
||||
rd.setItemName(od.getItemName());
|
||||
rd.setSpecName(od.getSpecName());
|
||||
rd.setWarehouseId(od.getWarehouseId());
|
||||
rd.setFromWarehouseId(od.getFromWarehouseId());
|
||||
rd.setQuantity(od.getQuantity());
|
||||
rd.setUnit(od.getUnit());
|
||||
rd.setBatchNo(od.getBatchNo());
|
||||
rd.setUnitPrice(od.getUnitPrice());
|
||||
rd.setAmount(od.getAmount());
|
||||
rd.setSourceDetailNo(od.getSourceDetailNo());
|
||||
rd.setReversalDetailId(od.getDetailId());
|
||||
rd.setRemark(od.getRemark());
|
||||
rd.setDelFlag("0");
|
||||
detailMapper.insert(rd);
|
||||
if ("I".equalsIgnoreCase(order.getIoType()) && "1".equals(order.getConfirmInFlag()) && "1".equals(order.getExecFlag())) {
|
||||
applyMaterialStockChange("O", details, "原料库存不足,无法撤回入库");
|
||||
}
|
||||
|
||||
List<GearStockIoOrderDetail> reversalDetails = detailMapper.selectList(Wrappers.<GearStockIoOrderDetail>lambdaQuery()
|
||||
.eq(GearStockIoOrderDetail::getOrderId, reversal.getOrderId())
|
||||
.orderByAsc(GearStockIoOrderDetail::getLineNo));
|
||||
applyMaterialStockChange(reversal.getIoType(), reversalDetails);
|
||||
|
||||
GearStockIoOrder update = new GearStockIoOrder();
|
||||
update.setOrderId(reversal.getOrderId());
|
||||
update.setAuditBy(LoginHelper.getNickName());
|
||||
update.setAuditTime(new Date());
|
||||
update.setExecFlag("1");
|
||||
update.setExecuteBy(LoginHelper.getNickName());
|
||||
update.setExecuteTime(new Date());
|
||||
update.setStatus("1");
|
||||
update.setActualFinishTime(new Date());
|
||||
update.setOrderId(orderId);
|
||||
update.setRevokeFlag("1");
|
||||
update.setRevokeBy(LoginHelper.getNickName());
|
||||
update.setRevokeTime(new Date());
|
||||
update.setExecFlag("0");
|
||||
baseMapper.updateById(update);
|
||||
return reversal.getOrderId();
|
||||
}
|
||||
|
||||
private GearStockIoOrder requireOrder(Long orderId) {
|
||||
@@ -512,13 +372,23 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureNotRevoked(GearStockIoOrder order) {
|
||||
if ("1".equals(order.getRevokeFlag())) {
|
||||
throw new ServiceException("单据已撤回");
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureEditable(GearStockIoOrder order) {
|
||||
ensureNotCanceled(order);
|
||||
ensureNotRevoked(order);
|
||||
if ("1".equals(order.getConfirmInFlag())) {
|
||||
throw new ServiceException("已确认入库单据不允许修改");
|
||||
}
|
||||
if ("1".equals(order.getStatus())) {
|
||||
throw new ServiceException("已完成单据不允许修改");
|
||||
}
|
||||
if ("1".equals(order.getExecFlag())) {
|
||||
throw new ServiceException("已执行单据不允许修改");
|
||||
throw new ServiceException("已影响库存单据不允许修改");
|
||||
}
|
||||
if (order.getAuditTime() != null) {
|
||||
throw new ServiceException("已审核单据不允许修改");
|
||||
@@ -578,46 +448,6 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
}
|
||||
|
||||
private void fillDelayOnFinish(GearStockIoOrder dbOrder, GearStockIoOrder update, Date finishTime) {
|
||||
if ("2".equals(dbOrder.getDelayStatus())) {
|
||||
return;
|
||||
}
|
||||
Date planFinish = dbOrder.getPlanFinishTime();
|
||||
if (planFinish == null || finishTime == null) {
|
||||
update.setDelayMinutes(0);
|
||||
update.setDelayStatus("0");
|
||||
return;
|
||||
}
|
||||
long diffMs = finishTime.getTime() - planFinish.getTime();
|
||||
int minutes = (int) Math.max(0, diffMs / (60_000L));
|
||||
update.setDelayMinutes(minutes);
|
||||
update.setDelayStatus(minutes > 0 ? "1" : "0");
|
||||
}
|
||||
|
||||
private void applyMaterialStockChange(String ioType, List<GearStockIoOrderDetail> details) {
|
||||
if (!"I".equalsIgnoreCase(ioType) && !"O".equalsIgnoreCase(ioType)) {
|
||||
throw new ServiceException("仅支持入库/出库类型");
|
||||
}
|
||||
if (details == null || details.isEmpty()) {
|
||||
throw new ServiceException("单据明细不能为空");
|
||||
}
|
||||
for (GearStockIoOrderDetail d : details) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
if (!"material".equals(d.getItemType())) {
|
||||
throw new ServiceException("仅支持原料(主材/辅材)出入库");
|
||||
}
|
||||
fillMaterialSnapshotIfNeeded(d);
|
||||
BigDecimal qty = d.getQuantity() == null ? BigDecimal.ZERO : d.getQuantity();
|
||||
if (qty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal delta = "I".equalsIgnoreCase(ioType) ? qty : qty.negate();
|
||||
adjustMaterialStock(d.getItemId(), delta);
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveUnit(String preferred, String itemType, Long itemId) {
|
||||
if (StringUtils.isNotBlank(preferred)) {
|
||||
return preferred;
|
||||
@@ -642,6 +472,14 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
if (snapshot == null) {
|
||||
throw new ServiceException("原料不存在:" + d.getItemId());
|
||||
}
|
||||
if (d.getMaterialTypeSnapshot() == null) {
|
||||
Object materialType = snapshot.get("materialType");
|
||||
if (materialType instanceof Number) {
|
||||
d.setMaterialTypeSnapshot(((Number) materialType).intValue());
|
||||
} else if (materialType != null && StringUtils.isNotBlank(String.valueOf(materialType))) {
|
||||
d.setMaterialTypeSnapshot(Integer.parseInt(String.valueOf(materialType)));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(d.getItemName())) {
|
||||
Object name = snapshot.get("materialName");
|
||||
if (name != null) {
|
||||
@@ -656,7 +494,31 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustMaterialStock(Long materialId, BigDecimal delta) {
|
||||
private void applyMaterialStockChange(String ioType, List<GearStockIoOrderDetail> details, String insufficientMessage) {
|
||||
if (!"I".equalsIgnoreCase(ioType) && !"O".equalsIgnoreCase(ioType)) {
|
||||
throw new ServiceException("仅支持入库/出库类型");
|
||||
}
|
||||
if (details == null || details.isEmpty()) {
|
||||
throw new ServiceException("单据明细不能为空");
|
||||
}
|
||||
for (GearStockIoOrderDetail d : details) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
if (!"material".equals(d.getItemType())) {
|
||||
throw new ServiceException("仅支持原料(主材/辅材)出入库");
|
||||
}
|
||||
fillMaterialSnapshotIfNeeded(d);
|
||||
BigDecimal qty = d.getQuantity() == null ? BigDecimal.ZERO : d.getQuantity();
|
||||
if (qty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal delta = "I".equalsIgnoreCase(ioType) ? qty : qty.negate();
|
||||
adjustMaterialStock(d.getItemId(), delta, insufficientMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustMaterialStock(Long materialId, BigDecimal delta, String insufficientMessage) {
|
||||
if (delta == null || delta.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -673,24 +535,11 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
}
|
||||
BigDecimal after = currentStock.add(delta);
|
||||
if (after.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("原料库存不足,无法出库");
|
||||
throw new ServiceException(StringUtils.isBlank(insufficientMessage) ? "原料库存不足" : insufficientMessage);
|
||||
}
|
||||
matMaterialMapper.updateStockDelta(materialId, delta);
|
||||
}
|
||||
|
||||
private String reverseIoType(String ioType) {
|
||||
if ("I".equalsIgnoreCase(ioType)) {
|
||||
return "O";
|
||||
}
|
||||
if ("O".equalsIgnoreCase(ioType)) {
|
||||
return "I";
|
||||
}
|
||||
if ("T".equalsIgnoreCase(ioType)) {
|
||||
return "T";
|
||||
}
|
||||
return ioType;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private static <T> T firstNonNull(T... values) {
|
||||
if (values == null) {
|
||||
|
||||
@@ -45,54 +45,17 @@ export function delStockIoOrder(orderId) {
|
||||
})
|
||||
}
|
||||
|
||||
export function submitStockIoOrder(orderId) {
|
||||
export function confirmInStockIoOrder(orderId) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/submit/' + orderId,
|
||||
url: '/gear/stockIoOrder/confirmIn/' + orderId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function auditStockIoOrder(orderId) {
|
||||
export function revokeStockIoOrder(orderId, reason) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/audit/' + orderId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function executeStockIoOrder(orderId) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/execute/' + orderId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function arrivalStockIoOrder(orderId) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/arrival/' + orderId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function finishStockIoOrder(orderId) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/finish/' + orderId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function cancelStockIoOrder(orderId, reason) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/cancel/' + orderId,
|
||||
url: '/gear/stockIoOrder/revoke/' + orderId,
|
||||
method: 'post',
|
||||
data: { reason: reason || '' }
|
||||
})
|
||||
}
|
||||
|
||||
export function reverseStockIoOrder(orderId, reason) {
|
||||
return request({
|
||||
url: '/gear/stockIoOrder/reverse/' + orderId,
|
||||
method: 'post',
|
||||
data: { reason: reason || '' }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<slot name="trigger">
|
||||
<el-button v-if="!materialId" type="primary" size="small">选择配料</el-button>
|
||||
<el-tag v-else type="info" closable @close="handleClear">
|
||||
{{ currentMaterial.materialName }}({{ currentMaterial.spec }})[{{ currentMaterial.model }}] - {{
|
||||
currentMaterial.factory }},库存:{{ currentMaterial.currentStock }}{{ currentMaterial.unit }}
|
||||
{{ currentMaterial.materialName }} - {{ currentMaterial.factory }},库存:{{ currentMaterial.currentStock }}{{ currentMaterial.unit }}
|
||||
</el-tag>
|
||||
</slot>
|
||||
</div>
|
||||
@@ -23,12 +22,6 @@
|
||||
<el-option label="辅料" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格">
|
||||
<el-input v-model="searchForm.spec" placeholder="请输入配料规格" clearable @keyup.enter="fetchMaterialList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料型号">
|
||||
<el-input v-model="searchForm.model" placeholder="请输入配料型号" clearable @keyup.enter="fetchMaterialList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产厂家">
|
||||
<el-input v-model="searchForm.factory" placeholder="请输入生产厂家" clearable @keyup.enter="fetchMaterialList" />
|
||||
</el-form-item>
|
||||
@@ -57,8 +50,6 @@
|
||||
{{ scope.row.materialType === 1 ? '辅料' : scope.row.materialType === 2 ? '主材' : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="spec" label="配料规格" min-width="100" align="center" />
|
||||
<el-table-column prop="model" label="配料型号" min-width="100" align="center" />
|
||||
<el-table-column prop="factory" label="生产厂家" min-width="120" align="center" />
|
||||
<el-table-column prop="currentStock" label="现存库存" min-width="80" align="center">
|
||||
<template #default="scope">
|
||||
@@ -92,12 +83,6 @@
|
||||
<el-option label="辅材" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input v-model="addForm.spec" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="型号" prop="model">
|
||||
<el-input v-model="addForm.model" placeholder="请输入型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="addForm.factory" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
@@ -163,8 +148,6 @@ const addFormRef = ref()
|
||||
const addForm = ref({
|
||||
materialName: '',
|
||||
materialType: undefined,
|
||||
spec: '',
|
||||
model: '',
|
||||
factory: '',
|
||||
unit: '',
|
||||
remark: ''
|
||||
@@ -178,8 +161,6 @@ const addRules = {
|
||||
const searchForm = ref({
|
||||
materialName: '',
|
||||
materialType: '',
|
||||
spec: '',
|
||||
model: '',
|
||||
factory: ''
|
||||
});
|
||||
|
||||
@@ -206,8 +187,6 @@ async function fetchMaterialList() {
|
||||
pageSize: pageSize.value,
|
||||
materialName: searchForm.value.materialName,
|
||||
materialType: searchForm.value.materialType,
|
||||
spec: searchForm.value.spec,
|
||||
model: searchForm.value.model,
|
||||
factory: searchForm.value.factory
|
||||
};
|
||||
|
||||
@@ -234,8 +213,6 @@ function resetSearch() {
|
||||
searchForm.value = {
|
||||
materialName: '',
|
||||
materialType: '',
|
||||
spec: '',
|
||||
model: '',
|
||||
factory: ''
|
||||
};
|
||||
pageNum.value = 1;
|
||||
@@ -275,8 +252,6 @@ function openAdd() {
|
||||
addForm.value = {
|
||||
materialName: searchForm.value.materialName || '',
|
||||
materialType: searchForm.value.materialType ? Number(searchForm.value.materialType) : undefined,
|
||||
spec: '',
|
||||
model: '',
|
||||
factory: '',
|
||||
unit: '',
|
||||
remark: ''
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
<el-form-item label="辅料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入辅料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料规格" prop="spec">
|
||||
<el-input v-model="queryParams.spec" placeholder="请输入辅料规格" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料型号" prop="model">
|
||||
<el-input v-model="queryParams.model" placeholder="请输入辅料型号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
@@ -51,8 +45,6 @@
|
||||
{{ scope.row.materialType === 1 ? '辅料' : '原料' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="辅料规格" align="center" prop="spec" />
|
||||
<el-table-column label="辅料型号" align="center" prop="model" />
|
||||
<el-table-column label="厂家" align="center" prop="factory" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="现存库存" align="center" prop="currentStock">
|
||||
@@ -88,12 +80,6 @@
|
||||
<el-option label="辅料" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入辅料规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入辅料型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="form.factory" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
<el-form-item label="配料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入配料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格" prop="spec">
|
||||
<el-input v-model="queryParams.spec" placeholder="请输入配料规格" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料型号" prop="model">
|
||||
<el-input v-model="queryParams.model" placeholder="请输入配料型号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
@@ -55,8 +49,6 @@
|
||||
{{ scope.row.materialType === 1 ? '辅料' : '主材' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配料规格" align="center" prop="spec" />
|
||||
<el-table-column label="配料型号" align="center" prop="model" />
|
||||
<el-table-column label="厂家" align="center" prop="factory" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="现存库存" align="center" prop="currentStock">
|
||||
@@ -92,12 +84,6 @@
|
||||
<el-option label="主材" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入配料规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入配料型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="form.factory" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
<el-form-item label="责任人" prop="responsibleName">
|
||||
<el-input v-model="queryParams.responsibleName" placeholder="请输入责任人" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="queryParams.sourceNo" placeholder="请输入来源单号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@@ -24,10 +21,13 @@
|
||||
<el-button type="primary" plain icon="Plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Clock" size="mini" :disabled="single" @click="handleArrival()">到货确认</el-button>
|
||||
<el-button type="success" plain icon="CircleCheck" size="mini" :disabled="single" @click="handleConfirm()">确认入库</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="RefreshLeft" size="mini" :disabled="single" @click="handleReverse()">撤回</el-button>
|
||||
<el-button type="danger" plain icon="RefreshLeft" size="mini" :disabled="single" @click="handleRevoke()">撤回</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
@@ -51,12 +51,18 @@
|
||||
<el-table-column label="业务类型" align="center" prop="bizType" min-width="120" />
|
||||
<el-table-column label="责任人" align="center" prop="responsibleName" min-width="120" />
|
||||
<el-table-column label="实际到货" align="center" prop="actualArrivalTime" min-width="160" />
|
||||
<el-table-column label="来源单号" align="center" prop="sourceNo" min-width="140" />
|
||||
<el-table-column label="状态" align="center" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.revokeFlag === '1'" type="danger">已撤回</el-tag>
|
||||
<el-tag v-else-if="scope.row.confirmInFlag === '1'" type="success">已确认</el-tag>
|
||||
<el-tag v-else type="info">正常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<el-button size="mini" type="text" icon="Document" @click="showDetail(scope.row)">明细</el-button>
|
||||
<el-button size="mini" type="text" icon="Clock" @click="handleArrival(scope.row)">到货确认</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" @click="handleReverse(scope.row)">撤回</el-button>
|
||||
<el-button size="mini" type="text" icon="CircleCheck" :disabled="scope.row.revokeFlag === '1' || scope.row.confirmInFlag === '1'" @click="handleConfirm(scope.row)">确认入库</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" :disabled="scope.row.revokeFlag === '1' || scope.row.confirmInFlag === '1'" @click="handleRevoke(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -87,11 +93,6 @@
|
||||
<el-input v-model="editForm.responsibleName" placeholder="请输入责任人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="editForm.sourceNo" placeholder="请输入来源单号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="editForm.remark" placeholder="请输入备注" />
|
||||
@@ -180,10 +181,12 @@
|
||||
<el-descriptions-item label="业务类型">{{ detailData.order.bizType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="责任人">{{ detailData.order.responsibleName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="实际到货">{{ detailData.order.actualArrivalTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="确认入库人">{{ detailData.order.confirmInBy || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="撤回人">{{ detailData.order.revokeBy || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin: 12px 0; text-align: right;">
|
||||
<el-button type="warning" size="small" @click="handleArrival(detailData.order)">到货确认</el-button>
|
||||
<el-button type="danger" size="small" @click="handleReverse(detailData.order)">撤回</el-button>
|
||||
<el-button type="success" size="small" :disabled="detailData.order.revokeFlag === '1' || detailData.order.confirmInFlag === '1'" @click="handleConfirm(detailData.order)">确认入库</el-button>
|
||||
<el-button type="danger" size="small" :disabled="detailData.order.revokeFlag === '1' || detailData.order.confirmInFlag === '1'" @click="handleRevoke(detailData.order)">撤回</el-button>
|
||||
</div>
|
||||
<el-table :data="detailData.details || []" border style="width: 100%">
|
||||
<el-table-column label="行号" prop="lineNo" width="70" align="center" />
|
||||
@@ -211,8 +214,8 @@ import {
|
||||
listStockIoOrder,
|
||||
getStockIoOrderWithDetail,
|
||||
addStockIoOrderWithDetail,
|
||||
arrivalStockIoOrder,
|
||||
reverseStockIoOrder
|
||||
confirmInStockIoOrder,
|
||||
revokeStockIoOrder
|
||||
} from '@/api/wms/stockIoOrder'
|
||||
|
||||
export default {
|
||||
@@ -235,8 +238,7 @@ export default {
|
||||
orderCode: undefined,
|
||||
ioType: 'I',
|
||||
bizType: undefined,
|
||||
responsibleName: undefined,
|
||||
sourceNo: undefined
|
||||
responsibleName: undefined
|
||||
},
|
||||
editOpen: false,
|
||||
editTitle: '',
|
||||
@@ -291,11 +293,39 @@ export default {
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleExport() {
|
||||
this.download(
|
||||
'/gear/stockIoOrder/export',
|
||||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`stockIoOrder_in_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
},
|
||||
handleConfirm(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认入库前将进行数据校验,确认继续?')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return confirmInStockIoOrder(target.orderId)
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('确认成功')
|
||||
this.getList()
|
||||
if (this.detailOpen && this.detailData && this.detailData.order) {
|
||||
return getStockIoOrderWithDetail(this.detailData.order.orderId).then((res) => (this.detailData = res.data))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
resetEdit() {
|
||||
this.editForm = {
|
||||
ioType: 'I',
|
||||
bizType: undefined,
|
||||
sourceNo: undefined,
|
||||
responsibleName: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
@@ -316,36 +346,21 @@ export default {
|
||||
this.detailData = res.data
|
||||
})
|
||||
},
|
||||
handleArrival(row) {
|
||||
handleRevoke(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认到货?')
|
||||
.confirm('确认撤回该入库单据?撤回后将标记为已撤回。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return arrivalStockIoOrder(target.orderId)
|
||||
return revokeStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('已确认到货')
|
||||
this.getList()
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleReverse(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认冲销该单据?系统将创建一张反向单据并自动执行。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return reverseStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then((res) => {
|
||||
const newId = res.data
|
||||
this.$modal.msgSuccess('冲销成功,冲销单ID:' + newId)
|
||||
this.$modal.msgSuccess('撤回成功')
|
||||
this.getList()
|
||||
if (this.detailOpen) {
|
||||
this.detailOpen = false
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
@@ -417,6 +432,7 @@ export default {
|
||||
lineNo,
|
||||
itemType: 'material',
|
||||
itemId: d.itemId,
|
||||
materialTypeSnapshot: d._materialType,
|
||||
itemName: d.itemName,
|
||||
quantity: quantity,
|
||||
unit: d.unit,
|
||||
@@ -493,6 +509,9 @@ export default {
|
||||
onMaterialPicked(row, material) {
|
||||
if (material && material.materialName) {
|
||||
row.itemName = material.materialName
|
||||
if (material.materialType != null) {
|
||||
row._materialType = material.materialType
|
||||
}
|
||||
if (!row.unit && material.unit) {
|
||||
row.unit = material.unit
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="RefreshLeft" size="mini" :disabled="single" @click="handleRevoke()">撤回</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
@@ -44,10 +47,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="业务类型" align="center" prop="bizType" min-width="120" />
|
||||
<el-table-column label="责任人" align="center" prop="responsibleName" min-width="120" />
|
||||
<el-table-column label="状态" align="center" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.revokeFlag === '1'" type="danger">已撤回</el-tag>
|
||||
<el-tag v-else type="info">正常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<el-button size="mini" type="text" icon="Document" @click="showDetail(scope.row)">明细</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" @click="handleRevoke(scope.row)">撤回</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" :disabled="scope.row.revokeFlag === '1'" @click="handleRevoke(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -78,11 +87,6 @@
|
||||
<el-input v-model="editForm.responsibleName" placeholder="请输入责任人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="editForm.sourceNo" placeholder="请输入来源单号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="editForm.remark" placeholder="请输入备注" />
|
||||
@@ -127,7 +131,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" min-width="120" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.quantity" placeholder="请输入数量" @input="recalcAmount(scope.row)" />
|
||||
<el-input v-model="scope.row.quantity" placeholder="请输入数量" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="90" align="center">
|
||||
@@ -140,16 +144,6 @@
|
||||
<el-input v-model="scope.row.batchNo" placeholder="批次号" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" min-width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.unitPrice" placeholder="单价" @input="recalcAmount(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.amount" placeholder="金额" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="140" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.remark" placeholder="备注" />
|
||||
@@ -170,9 +164,10 @@
|
||||
<el-descriptions-item label="类型">出库</el-descriptions-item>
|
||||
<el-descriptions-item label="业务类型">{{ detailData.order.bizType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="责任人">{{ detailData.order.responsibleName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="撤回人">{{ detailData.order.revokeBy || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin: 12px 0; text-align: right;">
|
||||
<el-button type="danger" size="small" @click="handleRevoke(detailData.order)">撤回</el-button>
|
||||
<el-button type="danger" size="small" :disabled="detailData.order.revokeFlag === '1'" @click="handleRevoke(detailData.order)">撤回</el-button>
|
||||
</div>
|
||||
<el-table :data="detailData.details || []" border style="width: 100%">
|
||||
<el-table-column label="行号" prop="lineNo" width="70" align="center" />
|
||||
@@ -200,7 +195,7 @@ import {
|
||||
listStockIoOrder,
|
||||
getStockIoOrderWithDetail,
|
||||
addStockIoOrderWithDetail,
|
||||
reverseStockIoOrder
|
||||
revokeStockIoOrder
|
||||
} from '@/api/wms/stockIoOrder'
|
||||
|
||||
export default {
|
||||
@@ -276,11 +271,19 @@ export default {
|
||||
this.ids = selection.map((r) => r.orderId)
|
||||
this.single = selection.length !== 1
|
||||
},
|
||||
handleExport() {
|
||||
this.download(
|
||||
'/gear/stockIoOrder/export',
|
||||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`stockIoOrder_out_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
},
|
||||
resetEdit() {
|
||||
this.editForm = {
|
||||
ioType: 'O',
|
||||
bizType: undefined,
|
||||
sourceNo: undefined,
|
||||
responsibleName: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
@@ -305,15 +308,17 @@ export default {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认撤回该出库?系统将创建一张反向单据并自动执行。')
|
||||
.confirm('确认撤回该出库单据?撤回后将标记为已撤回。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return reverseStockIoOrder(target.orderId, '')
|
||||
return revokeStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then((res) => {
|
||||
const newId = res.data
|
||||
this.$modal.msgSuccess('撤回成功,撤回单ID:' + newId)
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('撤回成功')
|
||||
this.getList()
|
||||
if (this.detailOpen) {
|
||||
this.detailOpen = false
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
@@ -358,7 +363,6 @@ export default {
|
||||
const hasAny =
|
||||
(d.itemId != null && String(d.itemId) !== '') ||
|
||||
(d.quantity != null && String(d.quantity) !== '') ||
|
||||
(d.unitPrice != null && String(d.unitPrice) !== '') ||
|
||||
(d.batchNo != null && String(d.batchNo) !== '') ||
|
||||
(d.remark != null && String(d.remark) !== '') ||
|
||||
(d.itemName != null && String(d.itemName) !== '')
|
||||
@@ -381,20 +385,17 @@ export default {
|
||||
.filter((d) => d && d.itemId != null && String(d.itemId) !== '' && this.toNumber(d.quantity) > 0)
|
||||
.map((d, idx) => {
|
||||
const lineNo = d.lineNo != null ? d.lineNo : idx + 1
|
||||
const unitPrice = this.toNumber(d.unitPrice)
|
||||
const quantity = this.toNumber(d.quantity)
|
||||
const amount = d.amount != null && String(d.amount) !== '' ? this.toNumber(d.amount) : unitPrice * quantity
|
||||
return {
|
||||
detailId: d.detailId,
|
||||
lineNo,
|
||||
itemType: 'material',
|
||||
itemId: d.itemId,
|
||||
materialTypeSnapshot: d._materialType,
|
||||
itemName: d.itemName,
|
||||
quantity: quantity,
|
||||
unit: d.unit,
|
||||
batchNo: d.batchNo,
|
||||
unitPrice: unitPrice,
|
||||
amount: amount,
|
||||
remark: d.remark
|
||||
}
|
||||
})
|
||||
@@ -413,8 +414,6 @@ export default {
|
||||
quantity: undefined,
|
||||
unit: undefined,
|
||||
batchNo: undefined,
|
||||
unitPrice: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
this.rebuildLineNo()
|
||||
@@ -446,8 +445,7 @@ export default {
|
||||
const r = this.editDetails[0]
|
||||
const empty =
|
||||
(r.itemId == null || String(r.itemId) === '') &&
|
||||
(r.quantity == null || String(r.quantity) === '') &&
|
||||
(r.unitPrice == null || String(r.unitPrice) === '')
|
||||
(r.quantity == null || String(r.quantity) === '')
|
||||
if (empty) {
|
||||
r.itemId = rows[0].materialId
|
||||
this.onMaterialPicked(r, rows[0])
|
||||
@@ -465,22 +463,14 @@ export default {
|
||||
onMaterialPicked(row, material) {
|
||||
if (material && material.materialName) {
|
||||
row.itemName = material.materialName
|
||||
if (material.materialType != null) {
|
||||
row._materialType = material.materialType
|
||||
}
|
||||
if (!row.unit && material.unit) {
|
||||
row.unit = material.unit
|
||||
}
|
||||
if (material.unitPrice != null && row.unitPrice == null) {
|
||||
row.unitPrice = material.unitPrice
|
||||
}
|
||||
this.recalcAmount(row)
|
||||
}
|
||||
},
|
||||
recalcAmount(row) {
|
||||
const qty = this.toNumber(row.quantity)
|
||||
const unitPrice = this.toNumber(row.unitPrice)
|
||||
if (qty > 0 || unitPrice > 0) {
|
||||
row.amount = String(unitPrice * qty)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
<el-form-item label="责任人" prop="responsibleName">
|
||||
<el-input v-model="queryParams.responsibleName" placeholder="请输入责任人" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="queryParams.sourceNo" placeholder="请输入来源单号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@@ -50,22 +47,7 @@
|
||||
<el-button type="danger" plain icon="Delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="CircleCheck" size="mini" :disabled="single" @click="handleAudit()">审核</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Check" size="mini" :disabled="single" @click="handleExecute()">执行</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Clock" size="mini" :disabled="single" @click="handleArrival()">到货确认</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Finished" size="mini" :disabled="single" @click="handleFinish()">完成</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="RefreshLeft" size="mini" :disabled="single" @click="handleReverse()">冲销</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Close" size="mini" :disabled="single" @click="handleCancel()">作废</el-button>
|
||||
<el-button type="warning" plain icon="Download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
@@ -101,7 +83,6 @@
|
||||
<el-tag :type="delayStatusTag(scope.row.delayStatus)">{{ delayStatusLabel(scope.row.delayStatus) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="来源单号" align="center" prop="sourceNo" min-width="140" />
|
||||
<el-table-column label="执行流水ID" align="center" prop="sourceIoId" min-width="120" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
@@ -140,11 +121,6 @@
|
||||
<el-input v-model="editForm.responsibleName" placeholder="请输入责任人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="editForm.sourceNo" placeholder="请输入来源单号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="主仓库" prop="warehouseId">
|
||||
<WarehouseSelect v-model="editForm.warehouseId" placeholder="请选择仓库" />
|
||||
@@ -281,14 +257,9 @@
|
||||
<el-descriptions-item label="已执行">{{ detailData.order.execFlag === '1' ? '是' : '否' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="责任人">{{ detailData.order.responsibleName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="延迟">{{ delayStatusLabel(detailData.order.delayStatus) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="确认入库人">{{ detailData.order.confirmInBy || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="撤回人">{{ detailData.order.revokeBy || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin: 12px 0; text-align: right;">
|
||||
<el-button type="primary" size="small" @click="handleAudit(detailData.order)">审核</el-button>
|
||||
<el-button type="primary" size="small" @click="handleExecute(detailData.order)">执行</el-button>
|
||||
<el-button type="warning" size="small" @click="handleArrival(detailData.order)">到货确认</el-button>
|
||||
<el-button type="success" size="small" @click="handleFinish(detailData.order)">完成</el-button>
|
||||
<el-button type="danger" size="small" @click="handleReverse(detailData.order)">冲销</el-button>
|
||||
</div>
|
||||
<el-table :data="detailData.details || []" border style="width: 100%">
|
||||
<el-table-column label="行号" prop="lineNo" width="70" align="center" />
|
||||
<el-table-column label="物料类型" prop="itemType" width="110" align="center" />
|
||||
@@ -321,13 +292,7 @@ import {
|
||||
getStockIoOrderWithDetail,
|
||||
addStockIoOrderWithDetail,
|
||||
updateStockIoOrderWithDetail,
|
||||
delStockIoOrder,
|
||||
auditStockIoOrder,
|
||||
executeStockIoOrder,
|
||||
arrivalStockIoOrder,
|
||||
finishStockIoOrder,
|
||||
cancelStockIoOrder,
|
||||
reverseStockIoOrder
|
||||
delStockIoOrder
|
||||
} from '@/api/wms/stockIoOrder'
|
||||
|
||||
export default {
|
||||
@@ -378,8 +343,7 @@ export default {
|
||||
execFlag: undefined,
|
||||
reversalFlag: undefined,
|
||||
delayStatus: undefined,
|
||||
responsibleName: undefined,
|
||||
sourceNo: undefined
|
||||
responsibleName: undefined
|
||||
},
|
||||
editOpen: false,
|
||||
editTitle: '',
|
||||
@@ -466,7 +430,6 @@ export default {
|
||||
ioType: this.ioType || 'I',
|
||||
bizType: undefined,
|
||||
sourceType: undefined,
|
||||
sourceNo: undefined,
|
||||
sourceOrderId: undefined,
|
||||
responsibleId: undefined,
|
||||
responsibleName: undefined,
|
||||
@@ -503,6 +466,9 @@ export default {
|
||||
}
|
||||
this.editDetails = (data.details || []).map((d) => {
|
||||
const next = Object.assign({}, d)
|
||||
if (next._materialType == null && next.materialTypeSnapshot != null) {
|
||||
next._materialType = next.materialTypeSnapshot
|
||||
}
|
||||
if (this.fixedMaterialMode) {
|
||||
next.itemType = 'material'
|
||||
}
|
||||
@@ -538,6 +504,16 @@ export default {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleExport() {
|
||||
const type = this.queryParams && this.queryParams.ioType ? String(this.queryParams.ioType) : 'all'
|
||||
this.download(
|
||||
'/gear/stockIoOrder/export',
|
||||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`stockIoOrder_${type}_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
},
|
||||
showDetail(row) {
|
||||
this.detailOpen = true
|
||||
this.detailData = null
|
||||
@@ -545,122 +521,6 @@ export default {
|
||||
this.detailData = res.data
|
||||
})
|
||||
},
|
||||
handleAudit(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认审核该单据?')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return auditStockIoOrder(target.orderId)
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('审核成功')
|
||||
this.getList()
|
||||
if (this.detailOpen && this.detailData && this.detailData.order) {
|
||||
return getStockIoOrderWithDetail(this.detailData.order.orderId).then((res) => (this.detailData = res.data))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleExecute(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认执行该单据?执行后将影响库存。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return executeStockIoOrder(target.orderId)
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('执行成功')
|
||||
this.getList()
|
||||
if (this.detailOpen && this.detailData && this.detailData.order) {
|
||||
return getStockIoOrderWithDetail(this.detailData.order.orderId).then((res) => (this.detailData = res.data))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleArrival(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认到货?')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return arrivalStockIoOrder(target.orderId)
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('已确认到货')
|
||||
this.getList()
|
||||
if (this.detailOpen && this.detailData && this.detailData.order) {
|
||||
return getStockIoOrderWithDetail(this.detailData.order.orderId).then((res) => (this.detailData = res.data))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleFinish(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认完成该单据?')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return finishStockIoOrder(target.orderId)
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('已完成')
|
||||
this.getList()
|
||||
if (this.detailOpen && this.detailData && this.detailData.order) {
|
||||
return getStockIoOrderWithDetail(this.detailData.order.orderId).then((res) => (this.detailData = res.data))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleCancel(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认作废该单据?')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return cancelStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('已作废')
|
||||
this.getList()
|
||||
this.detailOpen = false
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleReverse(row) {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认冲销该单据?系统将创建一张反向单据并自动执行。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return reverseStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then((res) => {
|
||||
const newId = res.data
|
||||
this.$modal.msgSuccess('冲销成功,冲销单ID:' + newId)
|
||||
this.getList()
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
submitEdit() {
|
||||
this.$refs.editFormRef.validate((valid) => {
|
||||
if (!valid) return
|
||||
@@ -695,6 +555,7 @@ export default {
|
||||
lineNo,
|
||||
itemType: this.fixedMaterialMode ? 'material' : d.itemType,
|
||||
itemId: d.itemId,
|
||||
materialTypeSnapshot: d._materialType,
|
||||
itemName: d.itemName,
|
||||
specName: d.specName,
|
||||
warehouseId: d.warehouseId,
|
||||
|
||||
@@ -30,6 +30,12 @@ CREATE TABLE gear_stock_io_order (
|
||||
to_warehouse_id bigint(20) DEFAULT NULL COMMENT '调入仓库ID',
|
||||
status char(1) NOT NULL DEFAULT '0' COMMENT '单据状态(0进行中 1已完成)',
|
||||
exec_flag char(1) NOT NULL DEFAULT '0' COMMENT '执行标志(0未执行 1已执行)',
|
||||
confirm_in_flag char(1) NOT NULL DEFAULT '0' COMMENT '确认入库标志(0未确认 1已确认)',
|
||||
confirm_in_by varchar(64) DEFAULT '' COMMENT '确认入库人',
|
||||
confirm_in_time datetime COMMENT '确认入库时间',
|
||||
revoke_flag char(1) NOT NULL DEFAULT '0' COMMENT '撤回标志(0正常 1已撤回)',
|
||||
revoke_by varchar(64) DEFAULT '' COMMENT '撤回人',
|
||||
revoke_time datetime COMMENT '撤回时间',
|
||||
reversal_flag char(1) NOT NULL DEFAULT '0' COMMENT '是否冲销单(0否 1是)',
|
||||
reversal_order_id bigint(20) DEFAULT NULL COMMENT '对应原单据ID',
|
||||
reversal_reason varchar(500) DEFAULT '' COMMENT '冲销原因',
|
||||
@@ -53,6 +59,8 @@ CREATE TABLE gear_stock_io_order (
|
||||
UNIQUE KEY uk_reversal_order_id (reversal_order_id),
|
||||
KEY idx_status (status),
|
||||
KEY idx_exec_flag (exec_flag),
|
||||
KEY idx_confirm_in_flag (confirm_in_flag),
|
||||
KEY idx_revoke_flag (revoke_flag),
|
||||
KEY idx_biz_type (biz_type),
|
||||
KEY idx_source_no (source_no),
|
||||
KEY idx_source_order_id (source_order_id),
|
||||
@@ -70,6 +78,7 @@ CREATE TABLE gear_stock_io_order_detail (
|
||||
line_no int(11) NOT NULL DEFAULT 1 COMMENT '行号',
|
||||
item_type varchar(32) NOT NULL COMMENT '物料类型(product/material/other)',
|
||||
item_id bigint(20) NOT NULL COMMENT '物料ID',
|
||||
material_type_snapshot tinyint(2) DEFAULT NULL COMMENT '主辅材类型快照(1辅材 2主材)',
|
||||
item_name varchar(128) DEFAULT '' COMMENT '物料名称快照',
|
||||
spec_name varchar(128) DEFAULT '' COMMENT '规格型号快照',
|
||||
warehouse_id bigint(20) DEFAULT NULL COMMENT '入库仓库ID',
|
||||
|
||||
Reference in New Issue
Block a user