Browse Source

Merge remote-tracking branch 'origin/dev' into dev

training
caoyizhong 1 year ago
parent
commit
d9088382e6
  1. 56
      blade-biz-common/src/main/java/org/springblade/common/utils/HttpHelper.java
  2. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataGoodsAreaController.java
  3. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetOne.java
  4. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetThree.java
  5. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetTwo.java
  6. 69
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationZreoSheetOne.java
  7. 71
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationZreoSheetTwo.java
  8. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAreaService.java
  9. 7
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java
  10. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java
  11. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  12. 83
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  13. 35
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RedissonConfig.java
  14. 47
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseGoodsAllocationController.java
  15. 1296
      doc/dpm/物流租户系统.pdma.json

56
blade-biz-common/src/main/java/org/springblade/common/utils/HttpHelper.java

@ -0,0 +1,56 @@
package org.springblade.common.utils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
/**
* 通用http工具封装
*
* @author lmy
*/
public class HttpHelper
{
private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class);
public static String getBodyString(ServletRequest request)
{
StringBuilder sb = new StringBuilder();
BufferedReader reader = null;
try (InputStream inputStream = request.getInputStream())
{
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
String line = "";
while ((line = reader.readLine()) != null)
{
sb.append(line);
}
}
catch (IOException e)
{
LOGGER.warn("getBodyString出现问题!");
}
finally
{
if (reader != null)
{
try
{
reader.close();
}
catch (IOException e)
{
LOGGER.error(ExceptionUtils.getMessage(e));
}
}
}
return sb.toString();
}
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataGoodsAreaController.java

@ -260,7 +260,7 @@ public class BasicdataGoodsAreaController extends BladeController {
public void visualizationwarehouse(@ApiIgnore @RequestParam Map<String, Object> visualization, HttpServletResponse response) {
Long areaId = Long.valueOf((String) visualization.get("areaId"));
log.info("areaId>>>>>>>>>>>>>{}",areaId);
basicdataGoodsAreaService.visualizationwarehouse(areaId,response);
basicdataGoodsAreaService.visualizationwarehouse(1,areaId,response);
//ExcelUtil.exports(response, "货区数据" + DateUtil.time(), "货区数据表", list, BasicdataGoodsAreaexportExcel.class);
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetOne.java

@ -9,7 +9,7 @@ import lombok.Data;
import java.io.Serializable;
/**
* 车辆照片信息表 Excel实体类
* 货区导出 Excel实体类
*
* @author lmy
* @since 2023-09-11

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetThree.java

@ -9,7 +9,7 @@ import lombok.Data;
import java.io.Serializable;
/**
* 车辆照片信息表 Excel实体类
* 货区导出 Excel实体类
*
* @author lmy
* @since 2023-09-11

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationSheetTwo.java

@ -9,7 +9,7 @@ import lombok.Data;
import java.io.Serializable;
/**
* 车辆照片信息表 Excel实体类
* 货区导出 Excel实体类
*
* @author lmy
* @since 2023-09-11

69
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationZreoSheetOne.java

@ -0,0 +1,69 @@
package com.logpm.basicdata.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
* 货区零担导出 Excel实体类
*
* @author lmy
* @since 2023-09-11
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class BasicdatavisualizationZreoSheetOne implements Serializable {
/**
* 运单号
*/
@ColumnWidth(40)
@ExcelProperty("运单号")
private String waybillNumber;
/**
* 货物名称
*/
@ColumnWidth(40)
@ExcelProperty("货物名称")
private String goodsName;
/**
* 托盘码
*/
@ColumnWidth(40)
@ExcelProperty("托盘码")
private String trayCode;
/**
* 库位号
*/
@ColumnWidth(30)
@ExcelProperty("库位号")
private String positionInfo;
/**
* 数量
*/
@ColumnWidth(20)
@ExcelProperty("数量")
private String num;
/**
* 上架时间
*/
@ColumnWidth(20)
@ExcelProperty("上架时间")
private String upTime;
/**
* 上架人
*/
@ColumnWidth(20)
@ExcelProperty("上架人")
private String upUser;
}

71
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdatavisualizationZreoSheetTwo.java

@ -0,0 +1,71 @@
package com.logpm.basicdata.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
* 货区零担导出 Excel实体类
*
* @author lmy
* @since 2023-09-11
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class BasicdatavisualizationZreoSheetTwo implements Serializable {
/**
* 库位号
*/
@ColumnWidth(40)
@ExcelProperty("库位号")
private String positionInfo;
/**
* 一级品类
*/
@ColumnWidth(40)
@ExcelProperty("一级品类")
private String firsts;
/**
* 二级品类
*/
@ColumnWidth(40)
@ExcelProperty("二级品类")
private String second;
/**
* 三级品类
*/
@ColumnWidth(30)
@ExcelProperty("三级品类")
private String thirdProduct;
/**
* 订单自编号
*/
@ColumnWidth(30)
@ExcelProperty("订单自编号")
private String orderCode;
/**
* 物料名称
*/
@ColumnWidth(30)
@ExcelProperty("物料名称")
private String materialName;
/**
* 数量
*/
@ColumnWidth(20)
@ExcelProperty("数量")
private String num;
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAreaService.java

@ -117,7 +117,7 @@ public interface IBasicdataGoodsAreaService extends BaseService<BasicdataGoodsAr
*
* @return
*/
void visualizationwarehouse(Long areaId, HttpServletResponse response);
void visualizationwarehouse(Integer type,Long areaId, HttpServletResponse response);
/**
* 查询当前操作人仓库下的备货区信息

7
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java

@ -321,9 +321,10 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
}
@Override
public void visualizationwarehouse(Long areaId, HttpServletResponse response) {
public void visualizationwarehouse(Integer type,Long areaId, HttpServletResponse response) {
//设置数据库格式
baseMapper.sqlMode();
if (type ==1){
//sheetOne
List<BasicdatavisualizationSheetOne> basicdatavisualizationSheetOnes = baseMapper.exportWarehouseByorderId(areaId);
//sheetTwo
@ -365,9 +366,13 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
}
// 关流
excelWriter.finish();
} catch (IOException var6) {
log.error("导出错误>>>>>>{}",var6);
return;
}
}else {
}
//return warehouseGoodsAreaList;
}

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

@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.feign.IBasicdataGoodsAreaClient;
import com.logpm.distribution.bean.Resp;
import com.logpm.distribution.config.RedissonConfig;
import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.dto.app.StockupZeroDTO;

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java

@ -889,7 +889,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
advanceEntity.setOrderTypeName(zbReceiptEntity.getOrderType()); //订单类型名称 可以为空
advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空
advanceEntity.setType(FactoryConstant.ZHIBANG);
int num = mathTotalOrderPackageNum(serviceNumEntity.getCustomerCode(), zbOrderPackageEntityList);
int num = mathTotalOrderPackageNum(serviceNumEntity.getRelationOrderCode(), zbOrderPackageEntityList);
advanceEntity.setTotal(num); //订单总数据
advanceEntity.setMctsTruck(StringUtil.isBlank(zbReceiptEntity.getDepartCode()) ? "" : zbReceiptEntity.getDepartCode()); //车次
advanceEntity.setMctsTruckNo(zbReceiptEntity.getCarNumber());
@ -945,14 +945,14 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
/**
* 按照订单合同号统计下面的包件数量
*
* @param orderNum
* @param zbOrderPackageEntityList
* @return
* @param orderNum 订单号
* @param zbOrderPackageEntityList 订单包间集合
* @return int
*/
private int mathTotalOrderPackageNum(String orderNum, List<ZbOrderPackageEntity> zbOrderPackageEntityList) {
int totalPackageNum = 0;
for (ZbOrderPackageEntity entity : zbOrderPackageEntityList) {
if (entity.getCustomerCode().equals(orderNum)) {
if (entity.getRelationOrderCode().equals(orderNum)) {
totalPackageNum++;
}
}

83
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -11,6 +11,7 @@ import com.alibaba.excel.metadata.Sheet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.MD5Utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
@ -20,6 +21,7 @@ import com.logpm.factory.comfac.dto.UnloadCarDTO;
import com.logpm.factory.excel.ExcelMode;
import com.logpm.factory.excel.JpDataMode;
import com.logpm.factory.mt.entity.MtFactoryOrderMain;
import com.logpm.factory.mt.entity.MtOrderLogEntity;
import com.logpm.factory.mt.entity.MtPushData;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
@ -31,6 +33,7 @@ import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.oupai.service.impl.OuPaiFactoryServiceImpl;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import com.logpm.factory.zb.dto.ZBReceiptDTO;
import com.logpm.factory.zb.entity.ZbFactoryLogEntity;
@ -69,6 +72,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -361,5 +365,84 @@ public class TestService {
zbFactoryLogService.save(zbFactoryLogEntity);
}
@Test
public void test10() throws NoSuchAlgorithmException {
// 重新获取
String appkey = "HuiTong";
String appsecret = "HT20230822140820";
String userid = "5003";
String userpwd = "mt123456*";
long time = new Date().getTime();
String sign = MD5Utils.md5Hex((appkey + appsecret + time).getBytes(StandardCharsets.UTF_8));
String pwd = MD5Utils.md5Hex(userpwd.getBytes(StandardCharsets.UTF_8));
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("APPKEY", appkey);
jsonObject1.put("SIGN", sign);
jsonObject1.put("USERID", userid);
jsonObject1.put("USERPWD", pwd);
jsonObject1.put("Timestamp", time);
String result = HttpRequest.post("http://www.mengtian.cn/Auth/Validate")
.header("Content-Type", "application/json").body(jsonObject1.toJSONString()).timeout(5 * 1000)
.execute()
.body();
//获取的结果转成json对象
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println(jsonObject.toJSONString());
Integer code = jsonObject.getInteger("Result");
String access_token = jsonObject.getString("Data");
System.out.println(access_token);
}
@Test
public void test11() throws NoSuchAlgorithmException {
String url="http://www.mengtian.cn/ZXCFaHuoDan/QueRenShouHuo";
String appkey = "HuiTong";
String appsecret = "HT20230822140820";
String userid = "5003";
String userpwd = "mt123456*";
// 发送数据
String data ="{\"发货单编号\":\"HYLEJIA-230983\",\"确认收货时间\":\"2023-10-01 16:15:38\"}";
//先获取token
String token = "AMiwQcwT33JksqEfDeRFbjgRieAUo/ztCQWLfpFiEqZpvUXrv0OW1GcJPFhE+ZdmPYQo+K6rUwoJ53u58Bv85A==";
//处理逻辑
String result = HttpRequest.post(url)
.header("APPKEY", appkey)
.header("Authorization", token)
.header("USERID", userid)
.header("USERPWD", MD5Utils.md5Hex(userpwd.getBytes(StandardCharsets.UTF_8)))
.header("Content-Type", "application/json")
.body(data).timeout(5 * 1000)
.execute().body();
// 保存数据到数据库
// MtOrderLogEntity mtOrderLogEntity = new MtOrderLogEntity();
// mtOrderLogEntity.setReqArgs(data);
// mtOrderLogEntity.setResBody(result);
// mtOrderLogEntity.setType(type);
// mtOrderLogEntity.setRefCode(refCode);
// mtOrderLogService.save(mtOrderLogEntity);
//把结果字符串转为json对象
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println(jsonObject);
if (!Objects.isNull(jsonObject)) {
Integer code = jsonObject.getInteger("Result");
String message = jsonObject.getString("Message");
}
}
@Test
public void test12(){
}
}

35
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RedissonConfig.java

@ -0,0 +1,35 @@
package com.logpm.warehouse.config;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
@Configuration
public class RedissonConfig {
@Bean
public Redisson redisson() {
// 单机模式
Config config = new Config();
BladeRedis bean = SpringUtil.getBean(BladeRedis.class);
RedisConnectionFactory connectionFactory = bean.getRedisTemplate().getConnectionFactory();
LettuceConnectionFactory factory = (LettuceConnectionFactory) connectionFactory;
String hostName = factory.getHostName();
int port = factory.getPort();
String password = factory.getPassword();
config.useSingleServer().setAddress("redis://"+hostName+":"+port).setDatabase(2);
config.useSingleServer().setPassword(password);
return (Redisson) Redisson.create(config);
}
}

47
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseGoodsAllocationController.java

@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.warehouse.config.RedissonConfig;
import com.logpm.warehouse.dto.*;
import com.logpm.warehouse.entity.WarehouseGoodsAllocationEntity;
import com.logpm.warehouse.excel.WarehouseGoodsAllocationExcel;
@ -35,6 +37,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.redisson.api.RLock;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
@ -55,6 +58,7 @@ import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -207,6 +211,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
public R uporder(@RequestBody UpdownTypeDTO updownTypeDTO) {
List<UpShelfOrderDTO> upShelfOrderList = updownTypeDTO.getUpShelfOrderList();
Long allocationId = updownTypeDTO.getAllocationId();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(5, TimeUnit.SECONDS);
if (upShelfOrderList.size() == 0 || Objects.isNull(allocationId)) {
return R.fail("参数不全");
}
@ -239,6 +250,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
//取出服务号
List<UpShelfOrderDTO> upShelfOrderList = updownTypeDTO.getUpShelfOrderList();
Long allocationId = updownTypeDTO.getAllocationId();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(5, TimeUnit.SECONDS);
Boolean b = warehouseGoodsAllocationService.selectIsStocking(allocationId);
if (b){
return R.fail("备货区不可上架");
@ -274,6 +292,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
//取出包条Id
List<UpShelfPackageDTO> upShelfPackageList = updownTypeDTO.getUpShelfPackageList();
Long allocationId = updownTypeDTO.getAllocationId();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(3, TimeUnit.SECONDS);
if (upShelfPackageList.size() == 0 || Objects.isNull(allocationId)) {
return R.fail("参数不全");
}
@ -287,6 +312,7 @@ public class WarehouseGoodsAllocationController extends BladeController {
}
R r = warehouseUpdownTypeService.upShelfPackage(upShelfPackageList, allocationId,myCurrentWarehouse.getId());
// if (r.getCode() == 200) {
// warehouseGoodsAllocationService.updateAllocationCache(allocationId.toString());
// }
@ -302,6 +328,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
public R upTray(@RequestBody UpdownTypeDTO updownTypeDTO) {
String trayCode = updownTypeDTO.getCode();//托盘码
Long allocationId = updownTypeDTO.getAllocationId();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(5, TimeUnit.SECONDS);
if (null == allocationId || StringUtil.isBlank(trayCode)) {
return R.fail("参数不全");
}
@ -330,6 +363,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
public R upStock(@RequestBody UpdownTypeDTO updownTypeDTO) {
Long allocationId = updownTypeDTO.getAllocationId();//库位Id
List<UpShelfStockDTO> upShelfStockList = updownTypeDTO.getUpShelfStockList();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(5, TimeUnit.SECONDS);
if (null == allocationId || upShelfStockList.size() == 0) {
return R.fail("参数不全");
}
@ -360,6 +400,13 @@ public class WarehouseGoodsAllocationController extends BladeController {
public R upZeroOrder(@RequestBody UpdownTypeDTO updownTypeDTO) {
Long allocationId = updownTypeDTO.getAllocationId();//库位编码
List<UpShelfZeroOrderDTO> upShelfZeroOrderList = updownTypeDTO.getUpShelfZeroOrderList();
//设置lockey
String lockKey ="lock:upPackage:" + allocationId;
RLock lock = new RedissonConfig().redisson().getLock(lockKey);
if(lock.isLocked()){
return R.fail("该货位还在上架中!!!");
}
lock.lock(5, TimeUnit.SECONDS);
if (null == allocationId || upShelfZeroOrderList.size() == 0) {
return R.fail("参数不全");
}

1296
doc/dpm/物流租户系统.pdma.json

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save