|
|
|
@ -47,6 +47,7 @@ import com.logpm.distribution.service.*;
|
|
|
|
|
import com.logpm.distribution.vo.*; |
|
|
|
|
import com.logpm.distribution.vo.app.StockupZeroVO; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionStockupWrapper; |
|
|
|
|
import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseGoodsAllocationEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseTaryAllocationEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; |
|
|
|
@ -54,20 +55,31 @@ import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
|
|
|
|
|
import com.logpm.warehouse.feign.*; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
import org.springblade.common.constant.CodeDesEnum; |
|
|
|
|
import org.springblade.common.constant.DictBizConstant; |
|
|
|
|
import org.springblade.common.constant.RabbitConstant; |
|
|
|
|
import org.springblade.common.constant.WorkNodeEnums; |
|
|
|
|
import org.springblade.common.constant.common.IsOrNoConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.pda.PdaAudioLingoStatus; |
|
|
|
|
import org.springblade.common.constant.reservation.ReservationLoadingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.reservation.ReservationOrderStatusConstant; |
|
|
|
|
import org.springblade.common.constant.reservation.ReservationPackageStatusConstant; |
|
|
|
|
import org.springblade.common.constant.reservation.ReservationSigningStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockLockingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockSignfoStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupTypeConstant; |
|
|
|
|
import org.springblade.common.enums.BizOperationEnums; |
|
|
|
|
import org.springblade.common.enums.PackageTypeEnums; |
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.common.model.NodeFanoutMsg; |
|
|
|
|
import org.springblade.common.model.PackageData; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
@ -80,6 +92,7 @@ import org.springblade.system.entity.DictBiz;
|
|
|
|
|
import org.springblade.system.entity.User; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.feign.IUserSearchClient; |
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
@ -176,7 +189,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseUpdownTypeClient warehouseUpdownTypeClient; |
|
|
|
|
@Autowired |
|
|
|
|
private final IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient; |
|
|
|
|
private IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataGoodsAreaClient basicdataGoodsAreaClient; |
|
|
|
@ -216,6 +229,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseUpdownStockUpAreaClient warehouseUpdownStockUpAreaClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private RabbitTemplate rabbitTemplate; |
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionNodeWorkService distributionNodeWorkService; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockupVO> selectDistributionStockupPage(IPage<DistributionStockupVO> page, DistributionStockupVO distributionStockup) { |
|
|
|
@ -306,10 +326,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
if ("3".equals(distributionStockupEntity.getTypeService())) { |
|
|
|
|
//自
|
|
|
|
|
return baseMapper.pageOweList(page, distributionStockupEntity,warehouseIdList); |
|
|
|
|
return baseMapper.pageOweList(page, distributionStockupEntity, warehouseIdList); |
|
|
|
|
} else { |
|
|
|
|
//商 市
|
|
|
|
|
return baseMapper.pageList(page, distributionStockupEntity,warehouseIdList); |
|
|
|
|
return baseMapper.pageList(page, distributionStockupEntity, warehouseIdList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -846,7 +866,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) { |
|
|
|
|
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -902,7 +922,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) { |
|
|
|
|
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -984,7 +1004,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNotNull(y.getStockArticleId()) && !y.getStockArticleId().contains(p.getStockArticleId())) { |
|
|
|
|
y.setStockArticleId(y.getStockArticleId() + "," + p.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum())); |
|
|
|
|
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@ -1068,7 +1088,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNotNull(y.getStockArticleId()) && !y.getStockArticleId().contains(p.getStockArticleId())) { |
|
|
|
|
y.setStockArticleId(y.getStockArticleId() + "," + p.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum())); |
|
|
|
|
y.setCompleteStact(y.getPlanNum().equals(y.getScanNum())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -1130,7 +1150,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().contains(i.getStockArticleId())) { |
|
|
|
|
wu.setStockArticleId(wu.getStockArticleId() + "," + i.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
wu.setCompleteStact(wu.getPlanNum().equals(wu.getScanNum())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -1886,6 +1906,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
List<DistributionStockEntity> list1 = new ArrayList<>(); |
|
|
|
|
AtomicBoolean f = new AtomicBoolean(false); //是否下架
|
|
|
|
|
AtomicBoolean fa = new AtomicBoolean(false); //是否有包件
|
|
|
|
|
DistributionStockupEntity distributionStockupEntity = distributionStockupService.selectById(stockupDTO.getStockupId()); |
|
|
|
|
voList.forEach(i -> { |
|
|
|
|
//查询是否已备货
|
|
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(i.getParcelListId()); |
|
|
|
@ -1927,7 +1948,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
distributionStock.setStockArticle(i.getStockArticleId()); |
|
|
|
|
// distributionStock.setGoodsAllocation(i.getGoodsAllocation());//货位信息
|
|
|
|
|
//备货区
|
|
|
|
|
DistributionStockupEntity distributionStockupEntity = distributionStockupService.selectById(stockupDTO.getStockupId()); |
|
|
|
|
if (ObjectUtils.isNotNull(distributionStockupEntity)) { |
|
|
|
|
distributionStock.setStockupArea(distributionStockupEntity.getStockupArea()); |
|
|
|
|
} |
|
|
|
@ -1955,13 +1975,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
warehouseId = byId1.getWarehouseId(); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNull(warehouseId)) { |
|
|
|
|
throw new ServiceException("预约信息不存在,无法备货!"); |
|
|
|
|
throw new CustomerException("预约信息不存在,无法备货!"); |
|
|
|
|
} |
|
|
|
|
String trayCode = stockupDTO.getTrayBarCode(); |
|
|
|
|
//货位下架
|
|
|
|
|
R r = warehouseUpdownTypeClient.downTray(trayCode, warehouseId); |
|
|
|
|
if (ObjectUtils.isNull(r) || ObjectUtils.isNotNull(r) && r.getCode() != 200) { |
|
|
|
|
throw new ServiceException("下架失败!!"); |
|
|
|
|
log.warn("货位下架失败!!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1977,7 +1997,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
); |
|
|
|
|
if (!update) { |
|
|
|
|
log.info("包件备货信息修改失败!!"); |
|
|
|
|
throw new ServiceException("包件备货信息修改失败!!"); |
|
|
|
|
throw new CustomerException("包件备货信息修改失败!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//判断备货任务是否完成
|
|
|
|
@ -1999,6 +2019,21 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!list1.isEmpty()) { |
|
|
|
|
|
|
|
|
|
List<Long> collect = list1.stream().map(DistributionStockEntity::getParcelListId).collect(Collectors.toList()); |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.listByIds(collect); |
|
|
|
|
// 备货作业节点
|
|
|
|
|
NodeFanoutMsg nodeFanoutMsg = buildStockUpNodeData(distributionStockupEntity, distributionParcelListEntities); |
|
|
|
|
if (ObjectUtils.isNotNull(nodeFanoutMsg)) { |
|
|
|
|
distributionNodeWorkService.planStock(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = list1.isEmpty() ? 0 : list1.size(); |
|
|
|
|
return Resp.scanSuccess("整托拣货" + i + "件", "整托拣货" + i + "件"); |
|
|
|
|
} |
|
|
|
@ -2407,7 +2442,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
throw new ServiceException("注意,注意!拣货人员字典未配置!请配置!"); |
|
|
|
|
} else { |
|
|
|
|
List<String> stringList = new ArrayList<>(); |
|
|
|
|
warehouseType.stream().forEach(i -> { |
|
|
|
|
warehouseType.forEach(i -> { |
|
|
|
|
//查询这个角色ID
|
|
|
|
|
R<String> roleId = sysClient.getRoleIds(tenantId, i.getDictValue()); |
|
|
|
|
if (ObjectUtils.isNotNull(roleId.getData())) { |
|
|
|
@ -3702,4 +3737,745 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return R.data(detailVOS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R stockupScanByCustom(StockupDTO stockupDTO) { |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
//包件扫描
|
|
|
|
|
String orderCode = stockupDTO.getOrderCode();//订单自编号
|
|
|
|
|
String packetBarCode = stockupDTO.getPacketBarCode();//包件码
|
|
|
|
|
Long stockupId = stockupDTO.getStockupId();//备货任务ID
|
|
|
|
|
Long reservationId = stockupDTO.getReservationId();//预约单id
|
|
|
|
|
// Long stockUpAllocationId = stockupDTO.getStockupAllocationId();//备货库位ID
|
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)) { |
|
|
|
|
log.warn("##################stockupScan: 未选择仓库,订单自编号为空"); |
|
|
|
|
return R.fail(403, "未授权!!"); |
|
|
|
|
} |
|
|
|
|
if (StringUtil.isBlank(orderCode)) { |
|
|
|
|
log.warn("##################stockupScan: 包件扫码,订单自编号为空"); |
|
|
|
|
return R.fail("包件扫码:订单自编号不能为空"); |
|
|
|
|
} |
|
|
|
|
if (StringUtil.isBlank(packetBarCode)) { |
|
|
|
|
log.warn("##################stockupScan: 包件扫码,包件码为空"); |
|
|
|
|
return R.fail("包件扫码:包件码不能为空"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNull(stockupId)) { |
|
|
|
|
log.warn("##################stockupId: 包件扫码,备货区为空"); |
|
|
|
|
return R.fail("包件扫码:备货任务ID不能为空"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(reservationId)) { |
|
|
|
|
log.warn("##################stockupScan: 包件扫码,预约单id为空"); |
|
|
|
|
return R.fail("包件扫码:预约单id不能为空"); |
|
|
|
|
} |
|
|
|
|
// if (Objects.isNull(stockUpAllocationId)) {
|
|
|
|
|
// log.warn("##################stockupScan: 备货库位不存在,stockUpAllocationId:{}",stockUpAllocationId);
|
|
|
|
|
// return Resp.scanFail("请扫描备货库位","请扫描备货库位");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Integer integer = this.selectPackage(stockupDTO); |
|
|
|
|
switch (integer) { |
|
|
|
|
case 1: |
|
|
|
|
DistributionStockupEntity distributionStockupEntity = this.getById(stockupId); |
|
|
|
|
|
|
|
|
|
List<JSONObject> aaa = new ArrayList<>(); |
|
|
|
|
//正常
|
|
|
|
|
//先保存扫码包件信息,后续由队列来出来余下补充信息
|
|
|
|
|
DistributionStockEntity entity = new DistributionStockEntity(); |
|
|
|
|
DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode()) |
|
|
|
|
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
entity.setOrderSelfNumbering(one.getOrderCode()); |
|
|
|
|
entity.setStockArticle(one.getStockArticleId()); |
|
|
|
|
entity.setCoding(packetBarCode); |
|
|
|
|
entity.setScanUser(AuthUtil.getUser().getNickName()); |
|
|
|
|
entity.setStockupId(stockupId); |
|
|
|
|
entity.setStockupId(stockupId); |
|
|
|
|
entity.setParcelListId(one.getId()); |
|
|
|
|
entity.setStockQuantity(1); |
|
|
|
|
// //修改包件备货状态
|
|
|
|
|
if ("3".equals(distributionStockupEntity.getTypeService())) { |
|
|
|
|
entity.setBillLadingId(reservationId); |
|
|
|
|
entity.setStockupArea(distributionStockupEntity.getStockupArea()); |
|
|
|
|
} else { |
|
|
|
|
entity.setReservationId(reservationId); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(stockupDTO.getAllocationId())) { |
|
|
|
|
// warehouseUpdownGoodsClient.selectMsgBywrap();
|
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); |
|
|
|
|
warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationValue(stockupDTO.getPacketBarCode()); |
|
|
|
|
warehouseUpdownGoodsEntity.setWarehouseId(distributionStockupEntity.getWarehouseId()); |
|
|
|
|
WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationInformation(warehouseUpdownGoodsEntity); |
|
|
|
|
if (ObjectUtils.isNotNull(locationInformation)) { |
|
|
|
|
entity.setAllocationTitle(locationInformation.getPositionCode()); |
|
|
|
|
} |
|
|
|
|
entity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
} |
|
|
|
|
entity.setConditions("0"); |
|
|
|
|
entity.setType(2); |
|
|
|
|
entity.setOutboundType(distributionStockupEntity.getTypeService()); |
|
|
|
|
//修改订单备货状态
|
|
|
|
|
distributionAsyncService.updateStockArticleStock(one.getStockArticleId()); |
|
|
|
|
//修改备货时间
|
|
|
|
|
distributionAsyncService.updateStockupDate(stockupDTO); |
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("scanType", stockupDTO.getScanType()); |
|
|
|
|
map.put("stockupId", stockupDTO.getStockupId()); |
|
|
|
|
map.put("logId", entity.getId()); |
|
|
|
|
map.put("messageData", entity); |
|
|
|
|
map.put("createTime", System.currentTimeMillis()); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_SCAN_EXCHANGE, RabbitConstant.STOCKUP_SCAN_ROUTING, map); |
|
|
|
|
|
|
|
|
|
//查询是否货位数据是否该下架
|
|
|
|
|
Map<String, Object> mapState = new HashMap<>(); |
|
|
|
|
mapState.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
mapState.put("scanType", stockupDTO.getScanType()); |
|
|
|
|
mapState.put("stockupId", stockupDTO.getStockupId()); |
|
|
|
|
mapState.put("typeService", stockupDTO.getTypeService()); |
|
|
|
|
mapState.put("reservationId", stockupDTO.getReservationId()); |
|
|
|
|
mapState.put("logId", entity.getId()); |
|
|
|
|
mapState.put("messageData", entity); |
|
|
|
|
mapState.put("warehouseId", myCurrentWarehouse.getId()); |
|
|
|
|
mapState.put("createTime", System.currentTimeMillis()); |
|
|
|
|
String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); |
|
|
|
|
|
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>> 对扫码的包件进行下架"); |
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_STATE_UPDATE_EXCHANGE, RabbitConstant.STOCKUP_STATE_UPDATE_ROUTING, mapState, message -> { |
|
|
|
|
message.getMessageProperties() |
|
|
|
|
.setHeader("x-delay", 3000); |
|
|
|
|
return message; |
|
|
|
|
}); |
|
|
|
|
//查询是否货位数据是否该下架
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
|
|
|
|
|
if (!Func.isEmpty(stockupDTO.getStockupAllocationId())) { |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("warehouseId", myCurrentWarehouse.getId()); |
|
|
|
|
jsonObject.put("code", packetBarCode); |
|
|
|
|
jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); |
|
|
|
|
jsonObject.put("type", 1); |
|
|
|
|
jsonObject.put("num", 1); |
|
|
|
|
//进行了备货库位的选择才进行备货库位的上架
|
|
|
|
|
warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); |
|
|
|
|
entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); |
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "备货上架,操作方式:备货上架同步操作,备货任务号:" + distributionStockupEntity.getStockupCode(); |
|
|
|
|
JSONObject js = handleLogJSONObject(myCurrentWarehouse, user, entity.getCoding(), content, WorkNodeEnums.STOCKING_OPERATION.getCode()); |
|
|
|
|
aaa.add(js); |
|
|
|
|
} |
|
|
|
|
distributionStockService.save(entity); |
|
|
|
|
//增加备货扫描节点
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "备货作业,备货任务号:" + distributionStockupEntity.getStockupCode(); |
|
|
|
|
JSONObject js = handleLogJSONObject(myCurrentWarehouse, user, entity.getCoding(), content, WorkNodeEnums.STOCKING_OPERATION.getCode()); |
|
|
|
|
aaa.add(js); |
|
|
|
|
|
|
|
|
|
//修改包件备货状态
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); |
|
|
|
|
parcelListEntity.setId(entity.getParcelListId()); |
|
|
|
|
parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); |
|
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
|
parcelListEntity = distributionParcelListService.getById(entity.getParcelListId()); |
|
|
|
|
List<DistributionParcelListEntity> ls = new ArrayList<>(); |
|
|
|
|
ls.add(parcelListEntity); |
|
|
|
|
// 备货作业节点
|
|
|
|
|
NodeFanoutMsg nodeFanoutMsg = buildStockUpNodeData(distributionStockupEntity, ls); |
|
|
|
|
if (ObjectUtils.isNotNull(nodeFanoutMsg)) { |
|
|
|
|
distributionNodeWorkService.planStock(nodeFanoutMsg, user); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); |
|
|
|
|
case 2: |
|
|
|
|
//重复扫描
|
|
|
|
|
String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); |
|
|
|
|
case 3: |
|
|
|
|
//包件不存在
|
|
|
|
|
String audioValue3 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue3); |
|
|
|
|
|
|
|
|
|
case 4: |
|
|
|
|
//操作失败
|
|
|
|
|
String audioValue4 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.caozuoshibai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.caozuoshibai.getName(), audioValue4); |
|
|
|
|
case 5: |
|
|
|
|
//窜货
|
|
|
|
|
String audioValue5 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.buzai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.buzai.getName(), audioValue5); |
|
|
|
|
default: |
|
|
|
|
log.warn("###备货扫描:未知错误"); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.weizhicuowu.getName(), PdaAudioLingoStatus.weizhicuowu.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R stockupScanByStock(StockupDTO stockupDTO) { |
|
|
|
|
//库存品扫描
|
|
|
|
|
Long reservationId = stockupDTO.getReservationId(); |
|
|
|
|
Long stockListId = stockupDTO.getStockListId(); |
|
|
|
|
String packetBarCode = stockupDTO.getPacketBarCode(); |
|
|
|
|
// String stockupArea = stockupDTO.getStockupArea();//备货区
|
|
|
|
|
Long stockupId = stockupDTO.getStockupId();//备货区
|
|
|
|
|
Long allocationId = stockupDTO.getAllocationId();//备货区
|
|
|
|
|
Integer stockPrint = stockupDTO.getStockPrint(); // 库存
|
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
return R.data(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
if (StringUtil.isBlank(packetBarCode)) { |
|
|
|
|
log.warn("##################stockupScan: 库存品扫码,包件码为空"); |
|
|
|
|
return R.fail("库存品扫码:包件码不能为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isNull(stockupId)) { |
|
|
|
|
log.warn("##################stockupScan: 库存品扫码,备货区为空"); |
|
|
|
|
return R.fail("库存品扫码:备货任务ID不能为空"); |
|
|
|
|
} |
|
|
|
|
// if (Objects.isNull(stockListId)) {
|
|
|
|
|
// log.warn("##################stockupScan: 库存品扫码,库存品id为空");
|
|
|
|
|
// return R.fail("库存品扫码:库存品id不能为空");
|
|
|
|
|
// }
|
|
|
|
|
if (Objects.isNull(reservationId)) { |
|
|
|
|
log.warn("##################stockupScan: 库存品扫码,预约单id为空"); |
|
|
|
|
return R.fail("库存品扫码:预约单id不能为空"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(stockPrint)) { |
|
|
|
|
log.warn("##################stockupScan: 库存品扫码,类型为空"); |
|
|
|
|
return R.fail("库存品扫码:类型不能为空"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(allocationId)) { |
|
|
|
|
log.warn("##################allocationId: 货位ID为空!"); |
|
|
|
|
return R.fail("货位ID不能为空"); |
|
|
|
|
} |
|
|
|
|
//判断是否可以继续备货
|
|
|
|
|
DistributionStockListEntity byId = null; |
|
|
|
|
// if (ObjectUtils.isNull(stockListId)) {
|
|
|
|
|
// 通过扫码的二维码 查询其对应的库存存信息
|
|
|
|
|
if (stockupDTO.getStockPrint() == 1) { |
|
|
|
|
//1 原有包条
|
|
|
|
|
byId = distributionStockListService.selectStockInforByOrderPackageCode(stockupDTO.getPacketBarCode()); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
// 判断stockupDTO.getMallName() 是否存在
|
|
|
|
|
if (ObjectUtils.isNull(stockupDTO.getMallName()) || "null".equals(stockupDTO.getMallName())) { |
|
|
|
|
// 查询出来 重新复制
|
|
|
|
|
DistributionStockListEntity byId1 = distributionStockListService.getById(stockupDTO.getStockListId()); |
|
|
|
|
log.info("##################stockupScan: 库存品扫码,库存品id{}", byId1); |
|
|
|
|
if (!ObjectUtils.isNull(byId1)) { |
|
|
|
|
stockupDTO.setMallName(byId1.getMarketName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 2打印处理的扫码
|
|
|
|
|
// 查询当前库位上最早入库的指定物料库存品
|
|
|
|
|
byId = disStockOrdercodeRecoService.selectStockOrdercodeRecoListByCode(stockupDTO.getCargoNumber(), stockupDTO.getAllocationId(), stockupDTO.getMallName()); |
|
|
|
|
|
|
|
|
|
// 需要判断当前这个找到的备货批次和计划的批次是否一直,如果不一致 就需要新增一个预约备货记录 扣减当前的数量
|
|
|
|
|
// updateStockOrdercodeRecoS(reservationId,byId);
|
|
|
|
|
|
|
|
|
|
if (Func.isEmpty(byId)) { |
|
|
|
|
return Resp.scanFail("当前库位无此物料库存品", "当前库位无此物料库存品"); |
|
|
|
|
} |
|
|
|
|
//判断当前库位上满足条件的库存品是否存在于预约计划中,如果不存在则需要对预约计划进行修改
|
|
|
|
|
List<DistributionReservationStocklistEntity> reservationStocklistEntityList = distributionReservationMapper.selectInventoryListByIdAndMateriel(stockupDTO.getReservationId(), stockupDTO.getCargoNumber()); |
|
|
|
|
if (Func.isNotEmpty(reservationStocklistEntityList)) { |
|
|
|
|
DistributionStockListEntity finalById = byId; |
|
|
|
|
boolean flag = reservationStocklistEntityList.stream() |
|
|
|
|
.map(DistributionReservationStocklistEntity::getStocklistId) |
|
|
|
|
.anyMatch(s -> s.equals(finalById.getId())); |
|
|
|
|
if (!flag) { |
|
|
|
|
DistributionReservationStocklistEntity rs = getDistributionReservationStocklistEntity(stockupDTO, byId); |
|
|
|
|
distributionReservationStocklistService.save(rs); |
|
|
|
|
|
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListService.getById(byId.getId()); |
|
|
|
|
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + 1); |
|
|
|
|
distributionStockListService.updateById(stockListEntity); |
|
|
|
|
|
|
|
|
|
//原来对应的需要进行计划减少
|
|
|
|
|
//收集满足修改条件的计划库存品
|
|
|
|
|
List<DistributionReservationStocklistEntity> reservationStocklistEntities = new ArrayList<>(); |
|
|
|
|
for (DistributionReservationStocklistEntity reservationStocklistEntity : reservationStocklistEntityList) { |
|
|
|
|
if (reservationStocklistEntity.getReservationNum() >= reservationStocklistEntity.getRealityNum() && reservationStocklistEntity.getReservationNum() > 0) { |
|
|
|
|
reservationStocklistEntities.add(reservationStocklistEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(reservationStocklistEntities)) { |
|
|
|
|
return R.fail("该物料库存品备货已完成"); |
|
|
|
|
} |
|
|
|
|
DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntities.get(0); |
|
|
|
|
int oldRsNum = reservationStocklistEntity.getReservationNum() - 1; |
|
|
|
|
if (oldRsNum < 0) { |
|
|
|
|
return R.fail("操作数据错误"); |
|
|
|
|
} |
|
|
|
|
reservationStocklistEntity.setReservationNum(oldRsNum); |
|
|
|
|
if (reservationStocklistEntity.getReservationNum() == 0) { |
|
|
|
|
reservationStocklistEntity.setStockListStatus(ReservationOrderStatusConstant.quxiao.getValue()); |
|
|
|
|
} |
|
|
|
|
distributionReservationStocklistService.updateById(reservationStocklistEntity); |
|
|
|
|
|
|
|
|
|
//维护老的的冻结数量
|
|
|
|
|
DistributionStockListEntity oldStockList = distributionStockListService.getById(reservationStocklistEntity.getStocklistId()); |
|
|
|
|
oldStockList.setQuantityOccupied(oldStockList.getQuantityOccupied() - 1); |
|
|
|
|
distributionStockListService.updateById(oldStockList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询对应的包件进行修改
|
|
|
|
|
List<DisStockListDetailEntity> stockListDetailEntities = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, stockupDTO.getReservationId()) |
|
|
|
|
.eq(DisStockListDetailEntity::getStockListId, oldStockList.getId()) |
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = stockListDetailEntities.stream().filter(s -> Func.isBlank(s.getStockPackageCode())).collect(Collectors.toList()).get(0); |
|
|
|
|
disStockListDetailEntity.setStockListId(rs.getStocklistId()); |
|
|
|
|
// disStockListDetailEntity.setStockStatus(OrderPackageStockupStatusConstant.yibeihu.getValue());
|
|
|
|
|
disStockListDetailService.updateById(disStockListDetailEntity); |
|
|
|
|
} else { |
|
|
|
|
//判断是否是为增加库存品进行数据维护
|
|
|
|
|
DistributionStockListEntity finalById1 = byId; |
|
|
|
|
DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntityList.stream().filter(f -> f.getStocklistId().equals(finalById1.getId())).collect(Collectors.toList()).get(0); |
|
|
|
|
//因为新增库存品的时候会完成扫描 此时的增加数和备货数量时一样的
|
|
|
|
|
if (reservationStocklistEntity.getStockListStatus().equals(ReservationOrderStatusConstant.zengjia.getValue()) && Objects.equals(reservationStocklistEntity.getReservationNum(), reservationStocklistEntity.getRealityNum())) { |
|
|
|
|
List<DistributionReservationStocklistEntity> oldRS = distributionReservationMapper.selectStockListByReservationIdAndCargoNumber(reservationStocklistEntity.getReservationId(), stockupDTO.getCargoNumber(), reservationStocklistEntity.getStocklistId()); |
|
|
|
|
//收集满足条件的库存品
|
|
|
|
|
List<DistributionReservationStocklistEntity> rs = new ArrayList<>(); |
|
|
|
|
for (DistributionReservationStocklistEntity oldR : oldRS) { |
|
|
|
|
if (oldR.getReservationNum() >= oldR.getRealityNum() && oldR.getReservationNum() > 0) { |
|
|
|
|
rs.add(oldR); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(rs)) { |
|
|
|
|
//不存在还需要进行备货的库存品
|
|
|
|
|
return R.fail("该物料库存品备货已完成"); |
|
|
|
|
} |
|
|
|
|
DistributionReservationStocklistEntity oldReservationStockList = rs.get(0); |
|
|
|
|
int oldReservationNum = oldReservationStockList.getReservationNum() - 1; |
|
|
|
|
|
|
|
|
|
oldReservationStockList.setReservationNum(oldReservationNum); |
|
|
|
|
if (oldReservationNum == 0) { |
|
|
|
|
oldReservationStockList.setStockListStatus(ReservationOrderStatusConstant.quxiao.getValue()); |
|
|
|
|
} |
|
|
|
|
distributionReservationStocklistService.updateById(oldReservationStockList); |
|
|
|
|
//修改对应库存品数量
|
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListService.getById(oldReservationStockList.getStocklistId()); |
|
|
|
|
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - 1); |
|
|
|
|
distributionStockListService.updateById(stockListEntity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//找出对库存品包件信息进行包件的修改
|
|
|
|
|
List<DisStockListDetailEntity> oldRsPack = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, oldReservationStockList.getReservationId()) |
|
|
|
|
.eq(DisStockListDetailEntity::getStockListId, oldReservationStockList.getStocklistId()) |
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (Func.isEmpty(oldRsPack)) { |
|
|
|
|
return R.fail("该物料库存品备货已完成"); |
|
|
|
|
} |
|
|
|
|
List<DisStockListDetailEntity> collect = oldRsPack.stream().filter(f -> Func.isBlank(f.getStockPackageCode())).collect(Collectors.toList()); |
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = collect.get(0); |
|
|
|
|
disStockListDetailEntity.setStockListId(reservationStocklistEntity.getStocklistId()); |
|
|
|
|
// disStockListDetailEntity.setStockStatus(OrderPackageStockupStatusConstant.yibeihu.getValue());
|
|
|
|
|
disStockListDetailService.updateById(disStockListDetailEntity); |
|
|
|
|
|
|
|
|
|
reservationStocklistEntity.setReservationNum(reservationStocklistEntity.getReservationNum() + 1); |
|
|
|
|
distributionReservationStocklistService.updateById(reservationStocklistEntity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维护库存品在库数量
|
|
|
|
|
DistributionStockListEntity newStockList = distributionStockListService.getById(reservationStocklistEntity.getStocklistId()); |
|
|
|
|
newStockList.setQuantityOccupied(newStockList.getQuantityOccupied() + 1); |
|
|
|
|
distributionStockListService.updateById(newStockList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//当前库位最先入库的批次和计划批次一致
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(byId)) { |
|
|
|
|
stockupDTO.setStockListId(byId.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// byId = distributionStockListService.getById(stockListId);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
List<WarehouseUpdownGoodsEntity> locationInformation; |
|
|
|
|
if ("2".equals(byId.getSourceType())) { |
|
|
|
|
//导入
|
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); |
|
|
|
|
warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); |
|
|
|
|
warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationId(byId.getMaterialId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationValue(byId.getCargoNumber()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationType("4"); |
|
|
|
|
warehouseUpdownGoodsEntity.setWarehouseId(byId.getWarehouseId()); |
|
|
|
|
locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); |
|
|
|
|
if (locationInformation.isEmpty()) { |
|
|
|
|
return Resp.scanFail("当前货位的库存品已为零,请更换货位继续!!", "当前货位的库存品已为零,请更换货位继续!!"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 读取码表上的配置项 是否开启验证批次号
|
|
|
|
|
String isCheckIncomingBatch = DictBizCache.getValue("isCheckIncomingBatch", "isCheckIncomingBatch"); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getOrderPackageCode, packetBarCode) |
|
|
|
|
.eq(DistributionParcelListEntity::getOrderCode, byId.getIncomingBatch()) |
|
|
|
|
.eq(DistributionParcelListEntity::getWarehouseId, byId.getWarehouseId()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
//查询包件信息
|
|
|
|
|
if (ObjectUtils.isNotNull(list) && list.size() > 1) { |
|
|
|
|
return Resp.scanFail("查询到重复包条信息!!", "查询到重复包条信息!!"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNull(list)) { |
|
|
|
|
return Resp.scanFail("没有查询到包件信息!", "没有查询到包件信息 ! "); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info(">>>>> obj {}", list.get(0).getConditions()); |
|
|
|
|
DistributionParcelListEntity distributionParcelListEntity = list.get(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (2 != distributionParcelListEntity.getConditions()) { |
|
|
|
|
return Resp.scanFail("当前包件不是库存品,无法备货!!", "当前包件不是库存品,无法备货!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); |
|
|
|
|
warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationId(list.get(0).getId()); |
|
|
|
|
warehouseUpdownGoodsEntity.setAssociationType("3"); |
|
|
|
|
warehouseUpdownGoodsEntity.setWarehouseId(byId.getWarehouseId()); |
|
|
|
|
locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); |
|
|
|
|
if (locationInformation.isEmpty()) { |
|
|
|
|
return Resp.scanFail("当前货位没有该包件信息!!", "当前货位没有该包件信息!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//有数数据校验 修改库存品数据
|
|
|
|
|
if ("1".equals(byId.getSourceType())) { |
|
|
|
|
R r1 = this.handlingPackages(stockupDTO); |
|
|
|
|
if (r1.getCode() != 200) { |
|
|
|
|
Resp.scanFail(r1.getMsg(), r1.getMsg()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Integer i = this.selectPackagePrint(stockupDTO); |
|
|
|
|
switch (i) { |
|
|
|
|
case 1: |
|
|
|
|
//绑定
|
|
|
|
|
Integer integer = this.selectPackage(stockupDTO); |
|
|
|
|
switch (integer) { |
|
|
|
|
case 1: |
|
|
|
|
DistributionStockupEntity stockupEntity = this.getById(stockupDTO.getStockupId()); |
|
|
|
|
//先保存扫码包件信息,后续由队列来出来余下补充信息
|
|
|
|
|
DistributionStockEntity entity = new DistributionStockEntity(); |
|
|
|
|
entity.setCoding(packetBarCode); |
|
|
|
|
DistributionStockupEntity byId1 = this.getById(stockupId); |
|
|
|
|
entity.setStockupArea(byId1.getStockupArea()); |
|
|
|
|
entity.setStockupId(stockupId); |
|
|
|
|
entity.setStockQuantity(1); |
|
|
|
|
entity.setScanUser(AuthUtil.getUser().getNickName()); |
|
|
|
|
if ("3".equals(stockupEntity.getTypeService())) { |
|
|
|
|
entity.setBillLadingId(reservationId); |
|
|
|
|
} else { |
|
|
|
|
entity.setReservationId(reservationId); |
|
|
|
|
} |
|
|
|
|
entity.setReservationId(reservationId); |
|
|
|
|
entity.setStockListId(stockupDTO.getStockListId()); |
|
|
|
|
//添加物料信息
|
|
|
|
|
// DistributionStockListEntity byId = iDistributionStockListService.getById(stockListId);
|
|
|
|
|
if (ObjectUtils.isNotNull(byId.getMarketId())) { |
|
|
|
|
entity.setMarketId(byId.getMarketId()); |
|
|
|
|
entity.setMaterialId(byId.getMaterialId()); |
|
|
|
|
if (!locationInformation.isEmpty()) { |
|
|
|
|
if ("2".equals(byId.getSourceType())) { |
|
|
|
|
//导入下架
|
|
|
|
|
entity.setAllocationTitle(locationInformation.get(0).getPositionCode()); |
|
|
|
|
entity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
//todo 待下架操作
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("marketId", byId.getMarketId()); |
|
|
|
|
jsonObject.put("materialCode", byId.getCargoNumber()); |
|
|
|
|
jsonObject.put("warehouseId", byId.getWarehouseId()); |
|
|
|
|
jsonObject.put("incomingBatch", byId.getIncomingBatch()); |
|
|
|
|
jsonObject.put("enterNum", 1); |
|
|
|
|
jsonObject.put("allocationId", stockupDTO.getAllocationId()); |
|
|
|
|
jsonObject.put("remark", "备货无数据库存品下架"); |
|
|
|
|
List<JSONObject> list = new ArrayList<>(); |
|
|
|
|
list.add(jsonObject); |
|
|
|
|
R r = warehouseUpdownTypeClient.downStock(list); |
|
|
|
|
if (r.getCode() != 200) { |
|
|
|
|
log.debug("##########" + r.getMsg()); |
|
|
|
|
// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
R r = warehouseUpdownTypeClient.downPackage(packetBarCode, byId.getWarehouseId(), "备货下架包件"); |
|
|
|
|
if (r.getCode() != 200) { |
|
|
|
|
log.debug("##########" + r.getMsg()); |
|
|
|
|
// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return Resp.scanFail("本货位的物料已为0,请更换货位继续!!", "本货位的物料已为0,请更换货位继续!!"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return Resp.scanFail("物料信息查询失败,请联系管理员!!", "物料信息查询失败,请联系管理员!!"); |
|
|
|
|
} |
|
|
|
|
entity.setConditions("0"); |
|
|
|
|
entity.setType(2); |
|
|
|
|
entity.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
entity.setOutboundType(stockupEntity.getTypeService()); |
|
|
|
|
// entity.setStockupAreaId(stockupDTO.getStockupAllocationId());
|
|
|
|
|
// entity.setStockupArea(stockupDTO.getStockupAllocationName());
|
|
|
|
|
// //修改备货时间
|
|
|
|
|
distributionAsyncService.updateStockupStockListDate(stockupDTO); |
|
|
|
|
// dataSourceTransactionManager.commit(transactionStatus);//提交
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("scanType", stockupDTO.getScanType()); |
|
|
|
|
map.put("logId", entity.getId()); |
|
|
|
|
map.put("messageData", entity); |
|
|
|
|
map.put("createTime", System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 完成对扫描库存品信息的数量维护
|
|
|
|
|
|
|
|
|
|
// 根据当前扫码对象查询得到当前的扫码对象的库存品信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将消息携带绑定键值
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_SCAN_EXCHANGE, RabbitConstant.STOCKUP_SCAN_ROUTING, map); |
|
|
|
|
String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); |
|
|
|
|
|
|
|
|
|
//进行备货库位上架
|
|
|
|
|
if (!Func.isEmpty(stockupDTO.getStockupAllocationId())) { |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("warehouseId", myCurrentWarehouse.getId()); |
|
|
|
|
jsonObject.put("code", packetBarCode); |
|
|
|
|
jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); |
|
|
|
|
jsonObject.put("type", 2); |
|
|
|
|
jsonObject.put("num", 1); |
|
|
|
|
warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); |
|
|
|
|
entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); |
|
|
|
|
} |
|
|
|
|
entity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
distributionStockService.save(entity); |
|
|
|
|
//这里尝试修改备货库存品包件的备货状态
|
|
|
|
|
boolean update = distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getOrderPackageCode, entity.getCoding()) |
|
|
|
|
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
.eq(DistributionParcelListEntity::getConditions, "2") |
|
|
|
|
.eq(DistributionParcelListEntity::getMaterialId, entity.getMaterialId()) |
|
|
|
|
.eq(entity.getStockArticle() != null, DistributionParcelListEntity::getStockArticleId, entity.getStockArticle()) |
|
|
|
|
.set(DistributionParcelListEntity::getOrderPackageStockupStatus, OrderPackageStockupStatusConstant.yibeihu.getValue()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// todo 这里需要完善
|
|
|
|
|
// 备货作业节点
|
|
|
|
|
NodeFanoutMsg nodeFanoutMsg = buildStockUpNodeDataByStock(stockupEntity, entity); |
|
|
|
|
if (ObjectUtils.isNotNull(nodeFanoutMsg)) { |
|
|
|
|
distributionNodeWorkService.planStock(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//扫码成功
|
|
|
|
|
return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); |
|
|
|
|
case 2: |
|
|
|
|
//重复扫描
|
|
|
|
|
String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); |
|
|
|
|
case 3: |
|
|
|
|
//包件不存在
|
|
|
|
|
String audioValue3 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baojianbucunzai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.baojianbucunzai.getName(), audioValue3); |
|
|
|
|
|
|
|
|
|
case 4: |
|
|
|
|
//操作失败
|
|
|
|
|
String audioValue4 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.caozuoshibai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.caozuoshibai.getName(), audioValue4); |
|
|
|
|
case 5: |
|
|
|
|
//窜货
|
|
|
|
|
String audioValue5 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.cuanhuo.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.cuanhuo.getName(), audioValue5); |
|
|
|
|
case 6: |
|
|
|
|
//已完成
|
|
|
|
|
String audioValue6 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.yiwancheng.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.yiwancheng.getName(), audioValue6); |
|
|
|
|
case 7: |
|
|
|
|
//包条码不存在
|
|
|
|
|
String audioValue7 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue7); |
|
|
|
|
default: |
|
|
|
|
log.warn("###备货扫描:未知错误"); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.weizhicuowu.getName(), PdaAudioLingoStatus.weizhicuowu.getName()); |
|
|
|
|
} |
|
|
|
|
case 7: |
|
|
|
|
//包条码不存在
|
|
|
|
|
String audioValue7 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue7); |
|
|
|
|
case 8: |
|
|
|
|
//条码已使用
|
|
|
|
|
String audioValue8 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomayishiyong.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.baotiaomayishiyong.getName(), audioValue8); |
|
|
|
|
case 9: |
|
|
|
|
//"没有待绑定的库存品信息!"
|
|
|
|
|
String audioValue9 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.meiyou.getValue()); |
|
|
|
|
return Resp.scanFail(PdaAudioLingoStatus.meiyou.getName(), audioValue9); |
|
|
|
|
case 10: |
|
|
|
|
//"没有待绑定的库存品信息!"
|
|
|
|
|
return Resp.scanFail("该包件与备货物料不匹配!", "该包件与备货物料不匹配!"); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg buildStockUpNodeData(DistributionStockupEntity distributionStockupEntity, List<DistributionParcelListEntity> parcelListEntitys) { |
|
|
|
|
try { |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.STOCKING_OPERATION); |
|
|
|
|
BasicdataWarehouseEntity entityWarehouse = basicdataWarehouseClient.getEntityWarehouseId(distributionStockupEntity.getWarehouseId()); |
|
|
|
|
if (entityWarehouse != null) { |
|
|
|
|
nodeFanoutMsg.setWarehouse(entityWarehouse.getName()); |
|
|
|
|
} |
|
|
|
|
nodeFanoutMsg.setWarehouseId(distributionStockupEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(user.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(distributionStockupEntity.getCreateTime()); |
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("id", distributionStockupEntity.getId()); |
|
|
|
|
jsonObject.put("stockupCode", distributionStockupEntity.getStockupCode()); |
|
|
|
|
jsonObject.put("typeService", distributionStockupEntity.getTypeService()); |
|
|
|
|
jsonObject.put("stockupDate", distributionStockupEntity.getStockupDate()); |
|
|
|
|
|
|
|
|
|
String jsonString = jsonObject.toJSONString(); |
|
|
|
|
nodeFanoutMsg.setMain(jsonString); |
|
|
|
|
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
|
|
List<PackageData> packageDataList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
parcelListEntitys.forEach(parcelListEntity -> packageDataList.add(getPackageData(parcelListEntity))); |
|
|
|
|
|
|
|
|
|
nodeFanoutMsg.setDetails(packageDataList); |
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("备货扫描:发送备货节点消息失败", e); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private PackageData getPackageData(DistributionParcelListEntity parcelListEntity) { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
packageData.setBrand(parcelListEntity.getBrandName()); |
|
|
|
|
packageData.setPackageCode(parcelListEntity.getOrderPackageCode()); |
|
|
|
|
packageData.setMaterialCode(parcelListEntity.getMaterialCode()); |
|
|
|
|
packageData.setMaterialName(parcelListEntity.getMaterialName()); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
packageData.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.CMP); |
|
|
|
|
return packageData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node) { |
|
|
|
|
JSONObject trunklinePackageTrackLog = new JSONObject(); |
|
|
|
|
trunklinePackageTrackLog.put("tenantId", user.getTenantId()); |
|
|
|
|
trunklinePackageTrackLog.put("createTime", new Date()); |
|
|
|
|
trunklinePackageTrackLog.put("createUser", user.getUserId()); |
|
|
|
|
trunklinePackageTrackLog.put("updateUser", user.getUserId()); |
|
|
|
|
trunklinePackageTrackLog.put("updateTime", new Date()); |
|
|
|
|
trunklinePackageTrackLog.put("isDeleted", 0); |
|
|
|
|
trunklinePackageTrackLog.put("status", 1); |
|
|
|
|
trunklinePackageTrackLog.put("createDept", warehouse.getDepartment()); |
|
|
|
|
trunklinePackageTrackLog.put("orderPackageCode", orderPackageCode); |
|
|
|
|
trunklinePackageTrackLog.put("warehouseId", warehouse.getId()); |
|
|
|
|
trunklinePackageTrackLog.put("warehouseName", warehouse.getName()); |
|
|
|
|
trunklinePackageTrackLog.put("workNode", node); |
|
|
|
|
trunklinePackageTrackLog.put("content", content); |
|
|
|
|
trunklinePackageTrackLog.put("operator", user.getNickName()); |
|
|
|
|
return trunklinePackageTrackLog; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg buildStockUpNodeDataByStock(DistributionStockupEntity stockupEntity, DistributionStockEntity stockEntity) { |
|
|
|
|
try { |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.STOCKING_OPERATION); |
|
|
|
|
BasicdataWarehouseEntity entityWarehouse = basicdataWarehouseClient.getEntityWarehouseId(stockupEntity.getWarehouseId()); |
|
|
|
|
if (entityWarehouse != null) { |
|
|
|
|
nodeFanoutMsg.setWarehouse(entityWarehouse.getName()); |
|
|
|
|
} |
|
|
|
|
nodeFanoutMsg.setWarehouseId(stockupEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(user.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(stockupEntity.getCreateTime()); |
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("id", stockupEntity.getId()); |
|
|
|
|
jsonObject.put("stockupCode", stockupEntity.getStockupCode()); |
|
|
|
|
jsonObject.put("typeService", stockupEntity.getTypeService()); |
|
|
|
|
jsonObject.put("stockupDate", stockupEntity.getStockupDate()); |
|
|
|
|
|
|
|
|
|
String jsonString = jsonObject.toJSONString(); |
|
|
|
|
nodeFanoutMsg.setMain(jsonString); |
|
|
|
|
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
|
|
List<PackageData> packageDataList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PackageData packageData = getPackageDataByStock(stockEntity); |
|
|
|
|
|
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
nodeFanoutMsg.setDetails(packageDataList); |
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("备货扫描:发送备货节点消息失败", e); |
|
|
|
|
throw new CustomerException(e.getMessage()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private PackageData getPackageDataByStock(DistributionStockEntity stockEntity) { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
// 查询出库存品信息
|
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListService.getById(stockEntity.getStockListId()); |
|
|
|
|
if (stockListEntity == null) { |
|
|
|
|
throw new CustomerException("库存品信息不存在"); |
|
|
|
|
} |
|
|
|
|
packageData.setBrand(stockListEntity.getBrandName()); |
|
|
|
|
packageData.setPackageCode(stockEntity.getCoding()); |
|
|
|
|
packageData.setMallName(stockListEntity.getMallName()); |
|
|
|
|
packageData.setMaterialCode(stockListEntity.getMarketCode()); |
|
|
|
|
packageData.setMaterialName(stockListEntity.getDescriptionGoods()); |
|
|
|
|
packageData.setOrderCode(stockListEntity.getOrderCode()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.INV); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
return packageData; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 库存品扫码 |
|
|
|
|
* |
|
|
|
|
* @param stockupDTO |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private static DistributionReservationStocklistEntity getDistributionReservationStocklistEntity(StockupDTO stockupDTO, DistributionStockListEntity byId) { |
|
|
|
|
DistributionReservationStocklistEntity rs = new DistributionReservationStocklistEntity(); |
|
|
|
|
rs.setReservationNum(1); |
|
|
|
|
rs.setStockListStatus(ReservationOrderStatusConstant.zengjia.getValue()); |
|
|
|
|
rs.setReservationId(stockupDTO.getReservationId()); |
|
|
|
|
rs.setRealityNum(0); |
|
|
|
|
rs.setUnit(byId.getCargoUnit()); |
|
|
|
|
rs.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue()); |
|
|
|
|
rs.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); |
|
|
|
|
rs.setStocklistId(byId.getId()); |
|
|
|
|
return rs; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|