拆包bug修复

This commit is contained in:
zhangke 2026-03-10 20:20:40 +08:00
parent a4a3aecd5d
commit b024a8757b
5 changed files with 45 additions and 15 deletions

View File

@ -16,10 +16,7 @@ import com.nflg.wms.common.pojo.vo.*;
import com.nflg.wms.common.util.StringUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.WmsPackage;
import com.nflg.wms.repository.entity.WmsPackageItem;
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
import com.nflg.wms.repository.entity.*;
import com.nflg.wms.repository.service.*;
import com.nflg.wms.starter.BaseController;
import com.nflg.wms.starter.annotation.ApiMark;
@ -35,10 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -63,6 +57,9 @@ public class PackingController extends BaseController {
@Resource
private BasdeSerialNumberControllerService serialNumberControllerService;
@Resource
private IUserSupplierService userSupplierService;
//----------------PC端接口-----------------
/*
* 新增包装箱
@ -185,7 +182,7 @@ public class PackingController extends BaseController {
// 首先判断当前包是否已经收货了
WmsPackage wmsPackage = packageService.lambdaQuery()
.eq(WmsPackage::getPackageCode, request.getPackageCode())
// .eq(WmsPackage::getSupplierId, UserUtil.getUserId())
.eq(WmsPackage::getSupplierId, UserUtil.getUserId())
.one();
VUtil.trueThrowBusinessError(ObjectUtil.isNull(wmsPackage)).throwMessage("打包码不存在");
VUtil.trueThrowBusinessError(wmsPackage.getPackageStatus() == 2).throwMessage("此打包码已收货");
@ -207,7 +204,13 @@ public class PackingController extends BaseController {
*/
private PackageDTO BarcodeValidation(WmsQrCodeMaster qrCodeMaster, BarCodeProcessStage processStage) {
//判断是否为有效码
VUtil.trueThrowBusinessError(ObjectUtil.isNull(qrCodeMaster) || !qrCodeMaster.getSupplierId().equals(UserUtil.getUserId())).throwMessage("无效码");
VUtil.trueThrowBusinessError(ObjectUtil.isNull(qrCodeMaster)).throwMessage("无效码");
UserSupplier userSupplier = userSupplierService.lambdaQuery()
.eq(UserSupplier::getUserId, UserUtil.getUserId())
.one();
VUtil.trueThrowBusinessError(ObjectUtil.isNull(userSupplier) || !Objects.equals(qrCodeMaster.getSupplierId(), userSupplier.getId())).throwMessage("此物料码非当前供应商所有");
// VUtil.trueThrowBusinessError(ObjectUtil.isNull(qrCodeMaster) || !qrCodeMaster.getSupplierId().equals(UserUtil.getUserId())).throwMessage("无效码");
// 判断此物料码是否有效以及是否已被使用
BarCodeProcessStage stage = BarCodeProcessStage.findByValue(qrCodeMaster.getProcessStage());
VUtil.trueThrowBusinessError(qrCodeMaster.getProcessStage() > processStage.getState())
@ -216,11 +219,11 @@ public class PackingController extends BaseController {
packageDTO.setMaterialCode(qrCodeMaster.getMaterialCode());
// 根据条形码类型计算物料数量
BigDecimal quantity = BigDecimal.valueOf(0);
if (qrCodeMaster.getBarcodeType() == 0) {
if ( qrCodeMaster.getPackagingType() == 0) {
// 直接获取单个条形码的数量
quantity = qrCodeMaster.getQuantity();
}
if (qrCodeMaster.getBarcodeType() == 1) {
if (qrCodeMaster.getPackagingType() == 1) {
// 查询子条形码并累加其数量
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.lambdaQuery()
.eq(WmsQrCodeMaster::getParentBarcodeId, qrCodeMaster.getId())
@ -292,6 +295,7 @@ public class PackingController extends BaseController {
packingScanVO.setRemainQuantity(item.getDeliveryQty().subtract(item.getReceiptQty()));
packingScanVO.setId(item.getId());
packingScanVO.setQuantity(quantity);
packingScanVO.setMaterialDescription(item.getItemName());
packingScanVO.setPoNumber(item.getPoNum());
packingScanVO.setPoLineNumber(item.getPoLineNumber());
return ApiResult.success(packingScanVO);
@ -412,8 +416,14 @@ public class PackingController extends BaseController {
VUtil.trueThrowBusinessError(ObjectUtil.isNull(item))
.throwMessage("此条数据不存在");
// UserSupplier userSupplier = userSupplierService.lambdaQuery()
// .eq(UserSupplier::getUserId, UserUtil.getUserId())
// .one();
//
// VUtil.trueThrowBusinessError(ObjectUtil.isNull(userSupplier)).throwMessage("此物料码非当前供应商所有");
WmsPackage wmsPackage = packageService.lambdaQuery()
.eq(WmsPackage::getPackageCode, item.getPackageId())
.eq(WmsPackage::getId, item.getPackageId())
.eq(WmsPackage::getSupplierId, UserUtil.getUserId())
.one();

View File

@ -44,4 +44,14 @@ public class OutProduceSearchQO extends SearchBaseQO {
* 库存地点
*/
private String lgort2;
/**
* 部门Id
*/
private Long deptId;
/**
* 订单状态 0 空白1已打印2 已过账
*/
private Short orderStatus;
}

View File

@ -20,6 +20,11 @@ public class PackingScanVO {
* 物料编号
*/
private String materialCode;
/**
* 物料描述
*/
private String materialDescription;
/**
* 剩余数量
*/

View File

@ -35,6 +35,11 @@ public class PackingVO {
*/
private String supplierName;
/**
* 供应商编号
*/
private String supplierCode;
/**
* 包装名称
*/

View File

@ -64,10 +64,10 @@ public class WmsPackageServiceImpl extends ServiceImpl<WmsPackageMapper, WmsPack
//保存包装物信息
wmsPackageItemService.saveBatch(items);
Long id = items.get(0).getPackageId();
Short packageType = 1;
Short packageStatus = 1;
// 修改当前包码状态
baseMapper.update(
new WmsPackage().setPackageType(packageType),
new WmsPackage().setPackageStatus(packageStatus),
new UpdateWrapper<WmsPackage>().eq("id", id)
);
}