Browse Source

1.增加商家端入库扫码和打托入库的功能接口

master
pref_mail@163.com 10 months ago
parent
commit
da7a1d000d
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 15
      blade-service-api/logpm-business-api/src/main/java/com/logpm/business/dto/BusinessSanDTO.java
  3. 4
      blade-service-api/logpm-business-api/src/main/java/com/logpm/business/feign/IBusinessPreOrderClient.java
  4. 2
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/IInComingClient.java
  5. 10
      blade-service/logpm-business/src/main/java/com/logpm/business/api/BusinessPreOrderApi.java
  6. 155
      blade-service/logpm-business/src/main/java/com/logpm/business/config/CustomMessageConverter.java
  7. 208
      blade-service/logpm-business/src/main/java/com/logpm/business/config/RabbitMqConfiguration.java
  8. 8
      blade-service/logpm-business/src/main/java/com/logpm/business/service/IBusinessPreOrderService.java
  9. 60
      blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java
  10. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  11. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  12. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  13. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  14. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  15. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  16. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/InComingClient.java
  17. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IInComingService.java
  18. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java
  19. 169
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -9,7 +9,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="-pref";
public static final String DEVAUTH ="";
/**
* 工厂对接服务名称

15
blade-service-api/logpm-business-api/src/main/java/com/logpm/business/dto/BusinessSanDTO.java

@ -15,4 +15,19 @@ public class BusinessSanDTO {
@ApiModelProperty(value = "异常入库 0 正常 1 异常")
private Integer inWarehouseException;
@ApiModelProperty(value = "仓库id")
private Long warehouseId;//仓库id
@ApiModelProperty(value = "仓库名称")
private String warehouseName;//仓库
@ApiModelProperty(value = "入库类型 1提货扫描入库 2直接入库 3批量入库 4 按车次号入库 5按订单入库")
private Integer incomingType;//入库类型 1提货扫描入库 2直接入库 3批量入库 4 按车次号入库 5按订单入库
@ApiModelProperty(value = "托盘码")
private String trayCode;//托盘码
@ApiModelProperty(value = "打托方式")
private String trayType;//打托方式
}

4
blade-service-api/logpm-business-api/src/main/java/com/logpm/business/feign/IBusinessPreOrderClient.java

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(
value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME
value = ModuleNameConstant.LOGPM_BUSINESS_NAME
)
public interface IBusinessPreOrderClient {
String API_PREFIX = "/client";
@ -23,6 +23,6 @@ public interface IBusinessPreOrderClient {
Integer inOrderByOrderPackageCode(@RequestParam("orderPackageCode") String orderPackageCode, @RequestParam("carNum") String carNum);
@PostMapping(SAVEOTHERDATABASENEW)
void saveOtherDataBaseNew(@RequestParam("userId") String tenantId, @RequestBody List<BusinessPreOrderEntity> dataResult, @RequestParam("userId") String mallName);
void saveOtherDataBaseNew(@RequestParam("userId") String tenantId, @RequestBody List<BusinessPreOrderEntity> dataResult, @RequestParam("mallName") String mallName);
}

2
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/IInComingClient.java

@ -16,6 +16,6 @@ public interface IInComingClient {
@PostMapping(API_PREFIX+"/incomingPackage")
R incomingPackage(@RequestBody InComingDTO inComingDTO);
R incomingPackageByTaryCode(@RequestBody InComingDTO inComingDTO);
}

10
blade-service/logpm-business/src/main/java/com/logpm/business/api/BusinessPreOrderApi.java

@ -2,6 +2,7 @@ package com.logpm.business.api;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.business.bean.Resp;
import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.dto.BusinessSanDTO;
@ -10,16 +11,23 @@ import com.logpm.business.vo.DistributionBusinessPreCarDetalVO;
import com.logpm.business.vo.DistributionBusinessPreCarNumerPageQueryVO;
import com.logpm.business.vo.DistributionBusinessPreCarNumerPageVO;
import com.logpm.business.vo.DistributionBusinessPreOrderListVO;
import com.logpm.trunkline.dto.InComingDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
@RestController
@AllArgsConstructor
@Slf4j
@RequestMapping("/app/businessPreOrder")
@Api(value = "配送管理", tags = "预入库管理")
public class BusinessPreOrderApi {
@ -73,4 +81,6 @@ public class BusinessPreOrderApi {
return R.data(distributionBusinessPreCarDetalVO);
}
}

155
blade-service/logpm-business/src/main/java/com/logpm/business/config/CustomMessageConverter.java

@ -0,0 +1,155 @@
package com.logpm.business.config;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.utils.SerializationUtils;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.remoting.rmi.CodebaseAwareObjectInputStream;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.*;
import java.util.List;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter extends AllowedListDeserializingMessageConverter implements BeanClassLoaderAware {
private final String defaultCharset = "UTF-8";
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
private String codebaseUrl;
@Deprecated
public void setCodebaseUrl(String codebaseUrl) {
this.codebaseUrl = codebaseUrl;
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
Object content = null;
MessageProperties properties = message.getMessageProperties();
if (properties != null) {
String contentType = properties.getContentType();
if (contentType != null && contentType.startsWith("text")) {
String encoding = properties.getContentEncoding();
if (encoding == null) {
encoding = "UTF-8";
}
try {
content = new String(message.getBody(), encoding);
} catch (UnsupportedEncodingException var8) {
throw new MessageConversionException("failed to convert text-based Message content", var8);
}
} else if (contentType != null && contentType.equals("application/x-java-serialized-object")) {
try {
content = SerializationUtils.deserialize(this.createObjectInputStream(new ByteArrayInputStream(message.getBody()), this.codebaseUrl));
} catch (IllegalArgumentException | IllegalStateException | IOException var7) {
throw new MessageConversionException("failed to convert serialized Message content", var7);
}
}
}
Map<String, Object> headers = properties.getHeaders();
HttpHeaders httpHeaders = new HttpHeaders();
for (Map.Entry<String, Object> entry : headers.entrySet()) {
if (StrUtil.equals("Blade-Auth", entry.getKey())
|| StrUtil.equals("Authorization", entry.getKey())
|| StrUtil.equals("blade-auth", entry.getKey())
|| StrUtil.equals("authorization", entry.getKey())) {
List value = (List) entry.getValue();
for (Object o : value) {
httpHeaders.add(entry.getKey(), String.valueOf(o));
}
}
}
ThreadLocalUtil.put("bladeContext", httpHeaders);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
if (content == null) {
content = message.getBody();
}
return content;
}
@Override
protected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException {
byte[] bytes = null;
if (object instanceof byte[]) {
bytes = (byte[]) object;
messageProperties.setContentType("application/octet-stream");
} else if (object instanceof String) {
try {
bytes = ((String) object).getBytes(this.defaultCharset);
} catch (UnsupportedEncodingException var6) {
throw new MessageConversionException("failed to convert to Message content", var6);
}
messageProperties.setContentType("text/plain");
messageProperties.setContentEncoding(this.defaultCharset);
} else if (object instanceof Serializable) {
try {
bytes = SerializationUtils.serialize(object);
} catch (IllegalArgumentException var5) {
throw new MessageConversionException("failed to convert to serialized Message content", var5);
}
messageProperties.setContentType("application/x-java-serialized-object");
}
HttpHeaders headers = ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
if (bytes != null) {
messageProperties.setContentLength(bytes.length);
return new Message(bytes, messageProperties);
} else {
throw new IllegalArgumentException(this.getClass().getSimpleName() + " only supports String, byte[] and Serializable payloads, received: " + object.getClass().getName());
}
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = beanClassLoader;
}
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException {
return new CodebaseAwareObjectInputStream(is, this.beanClassLoader, codebaseUrl) {
@Override
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
Class<?> clazz = super.resolveClass(classDesc);
CustomMessageConverter.this.checkAllowedList(clazz);
return clazz;
}
};
}
}

208
blade-service/logpm-business/src/main/java/com/logpm/business/config/RabbitMqConfiguration.java

@ -0,0 +1,208 @@
package com.logpm.business.config;
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.retry.MessageRecoverer;
import org.springframework.amqp.rabbit.retry.RepublishMessageRecoverer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Map;
/**
* RabbitMQ配置主要是配置队列如果提前存在该队列可以省略本配置类
*
* @author yangkai.shen
*/
@Slf4j
@Configuration
public class RabbitMqConfiguration {
@Bean
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){
RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory);
template.setMandatory(true);
template.setMessageConverter(new CustomMessageConverter());
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
@Override
public void confirm(CorrelationData correlationData, boolean b, String s) {
System.out.println("确认回调-相关数据:"+correlationData);
System.out.println("确认回调-确认情况:"+b);
System.out.println("确认回调-原因:"+s);
}
});
template.setReturnsCallback(new RabbitTemplate.ReturnsCallback() {
@Override
public void returnedMessage(ReturnedMessage returnedMessage) {
System.out.println("返回回调-消息:"+returnedMessage.getMessage());
System.out.println("返回回调-回应码:"+returnedMessage.getReplyCode());
System.out.println("返回回调-回应信息:"+returnedMessage.getReplyText());
System.out.println("返回回调-交换机:"+returnedMessage.getExchange());
System.out.println("返回回调-路由键:"+returnedMessage.getRoutingKey());
}
});
return template;
}
@Bean
public DirectExchange distributionErrorMessageExchange(){
return new DirectExchange(RabbitConstant.DISTRIBUTION_ERROR_EXCHANGE);
}
@Bean
public Queue distributionErrorQueue(){
return new Queue(RabbitConstant.DISTRIBUTION_ERROR_QUEUE, true);
}
@Bean
public Binding distributionErrorBinding(Queue distributionErrorQueue, DirectExchange distributionErrorMessageExchange){
return BindingBuilder.bind(distributionErrorQueue).to(distributionErrorMessageExchange).with(RabbitConstant.DISTRIBUTION_ERROR_ROUTING);
}
/**
* 消费失败队列
* @param rabbitTemplate
* @return
*/
@Bean
public MessageRecoverer republishMessageRecoverer(RabbitTemplate rabbitTemplate){
return new RepublishMessageRecoverer(rabbitTemplate, RabbitConstant.DISTRIBUTION_ERROR_EXCHANGE, RabbitConstant.DISTRIBUTION_ERROR_ROUTING);
}
/**
* 备货扫码任务队列
*/
@Bean
public Queue stockupScanQueue() {
return new Queue(RabbitConstant.STOCKUP_SCAN_QUEUE, true);
}
@Bean
public CustomExchange stockupScanExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.STOCKUP_SCAN_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding stockupScanBinding(Queue stockupScanQueue, CustomExchange stockupScanExchange) {
return BindingBuilder.bind(stockupScanQueue).to(stockupScanExchange).with(RabbitConstant.STOCKUP_SCAN_ROUTING).noargs();
}
/**
* 备货判断是否下架任务队列
*/
@Bean
public Queue stockupStateUpdateQueue() {
return new Queue(RabbitConstant.STOCKUP_STATE_UPDATE_QUEUE, true);
}
@Bean
public CustomExchange stockupStateUpdateExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.STOCKUP_STATE_UPDATE_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding stockupStateUpdateBinding(Queue stockupStateUpdateQueue, CustomExchange stockupStateUpdateExchange) {
return BindingBuilder.bind(stockupStateUpdateQueue).to(stockupStateUpdateExchange).with(RabbitConstant.STOCKUP_STATE_UPDATE_ROUTING).noargs();
}
/**
* 文员签收复合推送老系统队列
* @return
*/
@Bean
public Queue clerkCheckPushDataQueue() {
return new Queue(RabbitConstant.CLERK_CHECK_PUSH_DATA_QUEUE, true);
}
@Bean
public CustomExchange clerkCheckPushDataExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.CLERK_CHECK_PUSH_DATA_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding clerkCheckPushDataBinding(Queue clerkCheckPushDataQueue, CustomExchange clerkCheckPushDataExchange) {
return BindingBuilder.bind(clerkCheckPushDataQueue).to(clerkCheckPushDataExchange).with(RabbitConstant.CLERK_CHECK_PUSH_DATA_ROUTING).noargs();
}
@Bean
public Queue orderPackageStatusInfoQueue() {
return new Queue(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_QUEUE, true);
}
@Bean
public CustomExchange orderPackageStatusInfoExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding orderPackageStatusInfoBinding(Queue orderPackageStatusInfoQueue, CustomExchange orderPackageStatusInfoExchange) {
return BindingBuilder.bind(orderPackageStatusInfoQueue).to(orderPackageStatusInfoExchange).with(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING).noargs();
}
/**
* 文员签收复合推送老系统队列
* @return
*/
@Bean
public Queue billClerkCheckPushDataQueue() {
return new Queue(RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_QUEUE, true);
}
@Bean
public CustomExchange billClerkCheckPushDataExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding billCclerkCheckPushDataBinding(Queue billClerkCheckPushDataQueue, CustomExchange billClerkCheckPushDataExchange) {
return BindingBuilder.bind(billClerkCheckPushDataQueue).to(billClerkCheckPushDataExchange).with(RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_ROUTING).noargs();
}
@Bean
public Queue businessInConversionQueue() {
return new Queue(RabbitConstant.BUSINESS_IN_CONVERSION_DATA_QUEUE, true);
}
@Bean
public CustomExchange businessInConversionExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.BUSINESS_IN_CONVERSION_DATA_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding businessInConversionBinding(Queue businessInConversionQueue, CustomExchange businessInConversionExchange) {
return BindingBuilder.bind(businessInConversionQueue).to(businessInConversionExchange).with(RabbitConstant.BUSINESS_IN_CONVERSION_DATA_ROUTING).noargs();
}
@Bean
public Queue selfPickupScanQueue() {
return new Queue(RabbitConstant.SELF_PICKUP_SCAN_QUEUE, true);
}
@Bean
public CustomExchange selfPickupScanExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.SELF_PICKUP_SCAN_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding selfPickupScanBinding(Queue selfPickupScanQueue, CustomExchange selfPickupScanExchange) {
return BindingBuilder.bind(selfPickupScanQueue).to(selfPickupScanExchange).with(RabbitConstant.SELF_PICKUP_SCAN_ROUTING).noargs();
}
}

8
blade-service/logpm-business/src/main/java/com/logpm/business/service/IBusinessPreOrderService.java

@ -6,8 +6,10 @@ import com.logpm.business.dto.BusinessPreListDTO;
import com.logpm.business.dto.BusinessSanDTO;
import com.logpm.business.entity.BusinessPreOrderEntity;
import com.logpm.business.vo.*;
import com.logpm.trunkline.dto.InComingDTO;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
@ -69,4 +71,10 @@ public interface IBusinessPreOrderService extends BaseService<BusinessPreOrderEn
IPage<DistributionBusinessPreCarNumerPageVO> listCarNum(IPage<Object> page, DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO);
/**
* 商家端托盘扫码入库
* @param inComingDTO
* @return
*/
R incomingPackage(InComingDTO inComingDTO);
}

60
blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java

@ -30,6 +30,7 @@ import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.*;
@ -41,12 +42,13 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IInComingClient inComingClient;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
private final BladeRedis bladeRedis;
@Override
public Boolean inOrder(String ids) throws ServiceException {
@ -71,7 +73,9 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
data.add(distributionBusinessPreOrderEntity);
}
R r = inOrderWarehourse(sb.toString());
BusinessSanDTO businessSanDTO = new BusinessSanDTO();
businessSanDTO.setOrderPackageCode(sb.toString());
R r = inOrderWarehourse(businessSanDTO);
if (r.isSuccess()) {
// 更新成功
// 更新入库状态
@ -159,14 +163,17 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
}
private R inOrderWarehourse(String orderPackageCode) {
private R inOrderWarehourseByFeign(BusinessSanDTO businessSanDTO) {
InComingDTO inComingDTO = new InComingDTO();
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
inComingDTO.setOrderPackageCode(orderPackageCode);
inComingDTO.setOrderPackageCode(businessSanDTO.getOrderPackageCode());
inComingDTO.setIncomingType(IncomingTypeEnum.LINE_INCOMING.getCode());
inComingDTO.setWarehouseId(myCurrentWarehouse.getId());
inComingDTO.setTrayCode(businessSanDTO.getTrayCode());
inComingDTO.setTrayType(businessSanDTO.getTrayType());
inComingDTO.setWarehouseName(myCurrentWarehouse.getName());
R r = inComingClient.incomingPackage(inComingDTO);
R r = inComingClient.incomingPackageByTaryCode(inComingDTO);
return r;
}
@ -261,7 +268,7 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
}
R r = inOrderWarehourse(selectD.getOrderPackageCode());
R r = inOrderWarehourseByFeign(businessSanDTO);
if (r.isSuccess()) {
selectD.setInWarehouse(1);
this.updateById(selectD);
@ -321,7 +328,7 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
t.setInWarehouse(0);
this.save(t);
}
R r = inOrderWarehourse(entityByOrderPackageCode.getOrderPackageCode());
R r = inOrderWarehourseByFeign(businessSanDTO);
if (r.isSuccess()) {
t.setInWarehouse(1);
this.updateById(t);
@ -422,4 +429,41 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
}
@Override
public R incomingPackage(InComingDTO inComingDTO) {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
return R.fail(403,"仓库信息为空");
}
inComingDTO.setWarehouseId(myCurrentWarehouse.getId());
inComingDTO.setWarehouseName(myCurrentWarehouse.getName());
if(StringUtil.isBlank(inComingDTO.getOrderPackageCode())){
return R.fail(405,"包件码不能为空");
}
// 调用feign 进行托盘半固定入库
R r = inComingClient.incomingPackageByTaryCode(inComingDTO);
if(r.isSuccess()){
// 入库成功
//
}
return null;
}
}

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -516,6 +516,7 @@ public class DistributionStockArticleController extends BladeController {
}
/**
* 导入物料基础信息
*/

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -760,12 +760,12 @@
FROM
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldsa ON ldr.id = ldsa.reservation_id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldsa ON ldr.id = ldsa.reservation_id and ldsa.stock_article_status in (1,3)
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldrp.reservation_id = ldsa.reservation_id and ldrp.stock_article_id = ldsa.stock_article_id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
<where>
lds.delivery_id = #{param.deliveryId} and ldrp.packet_bar_status in ('1','3') and ldpl.id is not null
lds.delivery_id = #{param.deliveryId} and ldrp.packet_bar_status in (1,3) and ldpl.id is not null
<if test="param.waybillNumber !=null and param.waybillNumber != ''">
and ldpl.waybill_number like concat('%',#{param.waybillNumber},'%')
</if>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java

@ -85,7 +85,7 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
* @param o
* @return
*/
DistributionStockArticleQRCodeVO getOrderNoList(@Param("qrCode") String qrCode, @Param("o") String o);
DistributionStockArticleQRCodeVO getOrderNoList(@Param("qrCode") String qrCode, @Param("o") String id);
List<Map> fingListByServiceNumber(@Param("serviceNumber") String serviceNumber,@Param("warehouseId") Long warehouseId);

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -354,7 +354,14 @@
LEFT JOIN logpm_distribution_stock_article ldsa on ldpl.stock_article_id = ldsa.id
LEFT JOIN logpm_warehouse_waybill lww on lww.waybill_no= ldsa.waybill_number
<where>
ldpl.id = #{o}
<if test="qrCode != '' and qrCode != null">
and ldpl.order_package_code = #{qrCode}
</if>
<if test="o != '' and o != null">
and ldpl.id = #{o}
</if>
</where>
</select>

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -298,4 +298,5 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
* @return
*/
List<DistributionSignforStockArticleVO> signforListDetail(Long id);
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -692,7 +692,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
params.put("imgType", "/" + filetypeName);
//查询订单号
String o = (String) params.get("id");
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList(qrCode, o);
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList(null, o);
Map<String, Object> map = orderNoList.toMap();
// 创建一个新的Map,并将map1和map2合并到其中
Map<String, Object> mergedMap = new HashMap<>();
@ -795,6 +795,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return orderPackgeCodeDataVO;
}
@Override
public IPage<DistributionStockArticleVO> handlePackage(IPage<DistributionStockArticleVO> pageVO) {

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/InComingClient.java

@ -15,8 +15,8 @@ import springfox.documentation.annotations.ApiIgnore;
public class InComingClient implements IInComingClient{
private final IInComingService inComingService;
@Override
public R incomingPackage(InComingDTO inComingDTO) {
public R incomingPackageByTaryCode(InComingDTO inComingDTO) {
return inComingService.incomingPackage(inComingDTO);
return inComingService.incomingPackageByTaryCode(inComingDTO);
}
}

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IInComingService.java

@ -3,6 +3,7 @@ package com.logpm.trunkline.service;
import com.logpm.trunkline.dto.InComingDTO;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import org.springblade.core.tool.api.R;
import org.springframework.transaction.annotation.Transactional;
public interface IInComingService {
@ -10,7 +11,10 @@ public interface IInComingService {
R incomingPackages(InComingDTO inComingDTO);
R findIncomingOrderList(InComingDTO inComingDTO);
@Transactional(rollbackFor = Exception.class)
R incomingPackageByTaryCode(InComingDTO inComingDTO);
R findIncomingOrderList(InComingDTO inComingDTO);
R incomingBatchOrder(InComingDTO inComingDTO, WarehouseWaybillEntity waybillEntity);

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java

@ -274,7 +274,6 @@ public class AsyncServiceImpl implements IAsyncService {
private void saveTrunklineAdvanceDetailEntity(List<TrunklineAdvanceDetailEntity> t, TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) {
Tenant tenant = changeDataBase(mallName);
List<Long> ids = Collections.singletonList(trunklineAdvanceEntity.getId());
List<TrunklineAdvanceDetailVO> listByAdvanceIds = advanceDetailService.findAdvanceDetailVoByAdvanceIds(ids);

169
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

@ -3,7 +3,6 @@ package com.logpm.trunkline.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -186,6 +185,10 @@ public class InComingServiceImpl implements IInComingService {
}
@Transactional(rollbackFor = Exception.class)
public R incomingPackage(InComingDTO inComingDTO) {
try{
@ -430,6 +433,170 @@ public class InComingServiceImpl implements IInComingService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public R incomingPackageByTaryCode(InComingDTO inComingDTO) {
try{
String orderPackageCode = inComingDTO.getOrderPackageCode();//包件码
Long warehouseId = inComingDTO.getWarehouseId();//仓库id
String warehouseName = inComingDTO.getWarehouseName();
if (StringUtil.isBlank(warehouseName)) {
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId);
if (!Objects.isNull(warehouseEntity)) {
warehouseName = warehouseEntity.getName();
}
}
Long billladingId = inComingDTO.getBillladingId();//提货单id
Integer incomingType = inComingDTO.getIncomingType();//入库类型 1码板打托 2扫码入库 3直接入库 4 按车次号入库 5按订单入库 6扫描入库 7 批量卸车入库 8卸车托盘 9卸分一体 10补录数据入库
String trayCode = inComingDTO.getTrayCode();//托盘码
String trayType = inComingDTO.getTrayType();//打托方式
String customerTrain = inComingDTO.getCustomerTrain();//车次号
List<String> packageCodes = Arrays.asList(orderPackageCode.split(","));
log.info("############incomingPackage: 包件入库开始 packageCodes={} billladingId={} warehouseId={}", packageCodes, billladingId, warehouseId);
//包件入库开始
//查询包件是否有数据
QueryWrapper<TrunklineAdvanceDetailEntity> advanceDetailQueryWrapper = new QueryWrapper<>();
advanceDetailQueryWrapper.in("order_package_code", packageCodes);
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.list(advanceDetailQueryWrapper);
if (advanceDetailEntityList.isEmpty()) {
log.warn("############incomingPackage: 包件不存在 packageCodes={} warehouseId={}", packageCodes, warehouseId);
return Resp.scanFail(405, "包件无数据", "包件无数据");
}
if(StringUtil.isNotBlank(customerTrain)){
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) {
String trainNumber = advanceDetailEntity.getTrainNumber();
if(!trainNumber.equals(customerTrain)){
log.warn("############incomingPackage: 包件车次号不一致 packageCodes={} trainNumber={} trainNumber={}", packageCodes, trainNumber, customerTrain);
return Resp.scanFail(405, "包件车次号不一致", "包件车次号不一致");
}
}
}
//把advanceDetailEntityList通过packageStatus分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityMap = advanceDetailEntityList.stream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getPackageStatus));
//把advanceDetailEntityList的orderCode提取成一个Set
// Set<String> orderCodes = advanceDetailEntityList.stream().map(TrunklineAdvanceDetailEntity::getOrderCode).collect(Collectors.toSet());
String finalWarehouseName = warehouseName;
advanceDetailEntityMap.keySet().forEach(packageStatus -> {
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = advanceDetailEntityMap.get(packageStatus);
if (!advanceDetailEntities.isEmpty()) {
//提取advanceDetailEntities中所有元素的orderPackageCode组成一个List<String>
List<String> orderPackageCodes = advanceDetailEntities.stream()
.map(TrunklineAdvanceDetailEntity::getOrderPackageCode)
.collect(Collectors.toList());
if ("0".equals(packageStatus)) {
//未入库包件
Set<Long> advanceIds = new HashSet<>();
//1.修改暂存单包件入库状态
advanceDetailEntities.forEach(advanceDetailEntity -> {
advanceIds.add(advanceDetailEntity.getId());
advanceDetailEntity.setPackageStatus("1");
advanceDetailEntity.setIncomingTime(new Date());
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(finalWarehouseName);
});
advanceDetailService.updateBatchById(advanceDetailEntities);
advanceIds.forEach(advanceId -> {
List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId);
});
// advanceDetailService.updatePackageStatusById("1", advanceDetailId, warehouseId, warehouseName,new Date());
// List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId);
// advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId);
//
// List<String> orderPackageCodes = new ArrayList<>();
// orderPackageCodes.add(orderPackageCode);
//存入日志
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, finalWarehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType));
//2.判断包件和订单是否已经存入在库订单
boolean b = advanceService.saveOrderAndPackages(advanceDetailEntities, warehouseId);
if (b) {
//把advanceDetailEntities通过waybillNo进行分组
Map<String, List<TrunklineAdvanceDetailEntity>> advanceDetailEntityWaybillNoMap = advanceDetailEntities.stream().filter(entity -> StringUtil.isNotBlank(entity.getWaybillNo())).collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getWaybillNo));
Set<String> waybillNoSet = advanceDetailEntityWaybillNoMap.keySet();
if(!waybillNoSet.isEmpty()){
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findWaybillBilllByWaybillNos(new ArrayList<>(waybillNoSet));
//把waybillEntityList转化成waybillNo为key的map
Map<String, WarehouseWaybillEntity> waybillEntityMap = waybillEntityList.stream().collect(Collectors.toMap(WarehouseWaybillEntity::getWaybillNo, Function.identity()));
advanceDetailEntityWaybillNoMap.keySet().forEach(waybillNo -> {
List<TrunklineAdvanceDetailEntity> waybillNoAdvanceDetailEntities = advanceDetailEntityWaybillNoMap.get(waybillNo);
if(!waybillNoAdvanceDetailEntities.isEmpty()){
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
if(departureWarehouseId!=null&&departureWarehouseId.equals(warehouseId)){
Integer totalCount = waybillEntity.getTotalCount();
Integer stockCount = waybillEntity.getStockCount();
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "20", "已入库", "运单入库:"+stockCount+"/"+totalCount+",入库类型:【"+IncomingTypeEnum.getValue(incomingType)+"】,入库时间:"+ CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, finalWarehouseName);
}
}
}
});
}
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
}
});
}
} else if ("1".equals(packageStatus)) {
//已入库包件
if (incomingType != 1) {
log.warn("############incomingPackage: 包件已入库 orderPackageCodes={} warehouseId={}", orderPackageCodes, warehouseId);
throw new CustomerException(405, "包件" + orderPackageCodes + "已入库");
} else {
//4.如果有托盘码
orderPackageCodes.forEach(packageCode -> {
if (StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)) {
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
map.put("warehouseId", warehouseId);
map.put("orderPackageCode", packageCode);
warehouseTrayTypeClient.orderScanOrderPackageCode(map);
}
});
}
}
}
});
}catch (Exception e){
e.printStackTrace();
log.error("入库异常",e);
throw new CustomerException("系统异常,请联系管理员");
}
return R.success("入库成功");
}
@Override
public R findIncomingOrderList(InComingDTO inComingDTO) {
Integer incomingType = inComingDTO.getIncomingType();

Loading…
Cancel
Save