Merge remote-tracking branch 'origin/orderChange' into zhairh

feature-order-fix
x_z 2 years ago
commit 121003e42b

@ -29,7 +29,7 @@ public class UdiInfoEntity {
private String sydycpbs;
private String uuid;
private int versionNumber;
private int diType;
private Integer diType;
private String thirdId;
private String thirdName;
private String ybbm;

@ -342,48 +342,52 @@ public class StockOrderServiceImpl implements StockOrderService {
*/
if (isPreInOrder(orderEntity)) {
//查询预验收库库存详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOrderIdFk(orderEntity.getId());
List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
List<InvProductEntity> invPreInProductList = new ArrayList<>();
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
filterInvProductRequest.setSupId(invProductDetailEntity.getSupId());
filterInvProductRequest.setInvWarehouseCode(invProductDetailEntity.getInvWarehouseCode());
filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getInvStorageCode());
if (StrUtil.isBlank(invProductDetailEntity.getBatchNo())) {
filterInvProductRequest.setBatchNo("empty");
} else {
filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo());
}
List<InvProductEntity> invProductEntities = invPreInProductDao.filterInvProduct(filterInvProductRequest);
if (CollUtil.isNotEmpty(invProductEntities) && invProductEntities.size() > 0) {
InvProductEntity invProductEntity = invProductEntities.get(0);
calculateInvCount(invProductEntity, invProductDetailEntity);
invPreInProductList.add(invProductEntity);
} else {
return false;
}
}
//删除库存详情
invPreInProductDetailDao.deleteByOrderId(orderEntity.getId());
//更新库存
for (InvProductEntity invProductEntity : invPreInProductList) {
//查询库存码详情,如果库存码详情为空,则删除此库存
FilterInvProductDetailRequest detailParams = new FilterInvProductDetailRequest();
detailParams.setBatchNo(invProductEntity.getBatchNo());
detailParams.setInvCodes(Collections.singletonList(invProductEntity.getInvStorageCode()));
detailParams.setProductIdFk(invProductEntity.getRelIdFk());
int count = invPreInProductDetailDao.statCount(detailParams);
if (count == 0) {
//如果库存码详情为空,则删除此库存
invPreInProductDao.deleteById(String.valueOf(invProductEntity.getId()));
} else {
invPreInProductDao.updateInvProduct(invProductEntity);
}
}
invPreInProductDao.deleteByOrderIdFk(orderEntity.getId());
// //查询预验收库库存详情
// FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
// filterInvProductDetailRequest.setOrderIdFk(orderEntity.getId());
// List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
// List<InvProductEntity> invPreInProductList = new ArrayList<>();
// for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
// FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
// filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
// filterInvProductRequest.setSupId(invProductDetailEntity.getSupId());
// filterInvProductRequest.setInvWarehouseCode(invProductDetailEntity.getInvWarehouseCode());
// filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getInvStorageCode());
// if (StrUtil.isBlank(invProductDetailEntity.getBatchNo())) {
// filterInvProductRequest.setBatchNo("empty");
// } else {
// filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo());
// }
// List<InvProductEntity> invProductEntities = invPreInProductDao.filterInvProduct(filterInvProductRequest);
// if (CollUtil.isNotEmpty(invProductEntities) && invProductEntities.size() > 0) {
// InvProductEntity invProductEntity = invProductEntities.get(0);
// calculateInvCount(invProductEntity, invProductDetailEntity);
// invPreInProductList.add(invProductEntity);
// } else {
// return false;
// }
// }
// //删除库存详情
// invPreInProductDetailDao.deleteByOrderId(orderEntity.getId());
// //更新库存
// for (InvProductEntity invProductEntity : invPreInProductList) {
// //查询库存码详情,如果库存码详情为空,则删除此库存
// FilterInvProductDetailRequest detailParams = new FilterInvProductDetailRequest();
// detailParams.setBatchNo(invProductEntity.getBatchNo());
// detailParams.setInvCodes(Collections.singletonList(invProductEntity.getInvStorageCode()));
// detailParams.setProductIdFk(invProductEntity.getRelIdFk());
// int count = invPreInProductDetailDao.statCount(detailParams);
// if (count == 0) {
// //如果库存码详情为空,则删除此库存
// invPreInProductDao.deleteById(String.valueOf(invProductEntity.getId()));
// } else {
// invPreInProductDao.updateInvProduct(invProductEntity);
// }
// }
} else {
//非预验收单据库存,正常扣减库存
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();

@ -554,59 +554,63 @@ public class OrderServiceImpl implements OrderService {
try {
//判断单据是否是预验收单据,如果是预验收单据,则删除预验收库库存
if (isPreInOrder(orderEntity)) {
//查询预验收库详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOrderIdFk(id);
List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
Map<String, List<InvProductDetailEntity>> invPreInProductDetailMap = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk));
List<InvProductEntity> invPreInProductList = new ArrayList<>(invPreInProductDetailMap.keySet().size());
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
filterInvProductRequest.setSupId(invProductDetailEntity.getSupId());
filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getInvStorageCode());
filterInvProductRequest.setInvWarehouseCode(invProductDetailEntity.getInvWarehouseCode());
if (StrUtil.isBlank(invProductDetailEntity.getBatchNo())) {
filterInvProductRequest.setBatchNo("empty");
} else {
filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo());
}
List<InvProductEntity> invPerInProductEntities = invPreInProductDao.filterInvProduct(filterInvProductRequest);
InvProductEntity invProductEntity = invPerInProductEntities.get(0);
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
//入库,在原有库存基础上减库存
int count = invProductEntity.getInCount() - invProductDetailEntity.getCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
//出库,在原有库存上增加库存
int count = invProductEntity.getOutCount() - invProductDetailEntity.getCount();
invProductEntity.setOutCount(count);
}
invPreInProductList.add(invProductEntity);
}
//删除库存详情
invPreInProductDetailDao.deleteByOrderId(id);
//删除码详情
codesDao.deleteByOrderId(id);
//更新库存
for (InvProductEntity invProductEntity : invPreInProductList) {
//查询库存码详情,如果库存码详情为空,则删除此库存
FilterInvProductDetailRequest detailParams = new FilterInvProductDetailRequest();
detailParams.setBatchNo(invProductEntity.getBatchNo());
detailParams.setInvCodes(Collections.singletonList(invProductEntity.getInvStorageCode()));
detailParams.setProductIdFk(invProductEntity.getRelIdFk());
int count = invPreInProductDetailDao.statCount(detailParams);
if (count == 0) {
//如果库存码详情为空,则删除此库存
invPreInProductDao.deleteById(String.valueOf(invProductEntity.getId()));
} else {
invPreInProductDao.updateInvProduct(invProductEntity);
}
}
invPreInProductDetailDao.deleteByOrderId(orderEntity.getId());
invPreInProductDao.deleteByOrderIdFk(orderEntity.getId());
// //查询预验收库详情
// FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
// filterInvProductDetailRequest.setOrderIdFk(id);
// List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
// Map<String, List<InvProductDetailEntity>> invPreInProductDetailMap = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk));
//
// List<InvProductEntity> invPreInProductList = new ArrayList<>(invPreInProductDetailMap.keySet().size());
//
// for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
// FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
// filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
// filterInvProductRequest.setSupId(invProductDetailEntity.getSupId());
// filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getInvStorageCode());
// filterInvProductRequest.setInvWarehouseCode(invProductDetailEntity.getInvWarehouseCode());
// if (StrUtil.isBlank(invProductDetailEntity.getBatchNo())) {
// filterInvProductRequest.setBatchNo("empty");
// } else {
// filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo());
// }
// List<InvProductEntity> invPerInProductEntities = invPreInProductDao.filterInvProduct(filterInvProductRequest);
// InvProductEntity invProductEntity = invPerInProductEntities.get(0);
// if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
// //入库,在原有库存基础上减库存
// int count = invProductEntity.getInCount() - invProductDetailEntity.getCount();
// invProductEntity.setInCount(count);
// } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
// //出库,在原有库存上增加库存
// int count = invProductEntity.getOutCount() - invProductDetailEntity.getCount();
// invProductEntity.setOutCount(count);
// }
//
// invPreInProductList.add(invProductEntity);
// }
//
// //删除库存详情
// invPreInProductDetailDao.deleteByOrderId(id);
// //删除码详情
// codesDao.deleteByOrderId(id);
// //更新库存
// for (InvProductEntity invProductEntity : invPreInProductList) {
// //查询库存码详情,如果库存码详情为空,则删除此库存
// FilterInvProductDetailRequest detailParams = new FilterInvProductDetailRequest();
// detailParams.setBatchNo(invProductEntity.getBatchNo());
// detailParams.setInvCodes(Collections.singletonList(invProductEntity.getInvStorageCode()));
// detailParams.setProductIdFk(invProductEntity.getRelIdFk());
// int count = invPreInProductDetailDao.statCount(detailParams);
// if (count == 0) {
// //如果库存码详情为空,则删除此库存
// invPreInProductDao.deleteById(String.valueOf(invProductEntity.getId()));
// } else {
// invPreInProductDao.updateInvProduct(invProductEntity);
// }
// }
} else {
//查询库存详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();

@ -479,7 +479,7 @@ public class InvProductsTrService {
//寄售出库生成单据
OrderEntity outOrder = new OrderEntity();
BeanUtils.copyProperties(orderEntity, outOrder);
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setActDate(DateUtil.getBeforeDay(fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setCreateTime(outOrder.getActDate());
outOrder.setAction(bussinessChangeTypeEntity.getScAction());
outOrder.setMainAction(ConstantType.TYPE_OUT);
@ -550,7 +550,7 @@ public class InvProductsTrService {
temps = filterSupMaps.get(corpName);
OrderEntity outOrder = new OrderEntity();
BeanUtils.copyProperties(orderEntity, outOrder);
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setActDate(DateUtil.getBeforeDay(fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setCreateTime(outOrder.getActDate());
outOrder.setAction(bussinessChangeTypeEntity.getScAction());
outOrder.setMainAction(ConstantType.TYPE_PUT);
@ -598,7 +598,7 @@ public class InvProductsTrService {
for (WarehouseEntity warehouseEntity : unkonwCorpList) {
OrderEntity outOrder = new OrderEntity();
BeanUtils.copyProperties(orderEntity, outOrder);
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setActDate(DateUtil.getBeforeDay(fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setCreateTime(outOrder.getActDate());
outOrder.setAction(bussinessChangeTypeEntity.getScAction());
outOrder.setMainAction(ConstantType.TYPE_PUT);
@ -674,7 +674,7 @@ public class InvProductsTrService {
OrderEntity outOrder = new OrderEntity();
BeanUtils.copyProperties(orderEntity, outOrder);
outOrder.setSupplementNo(null);//补单需置空
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setActDate(DateUtil.getBeforeDay(fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setCreateTime(outOrder.getActDate());
outOrder.setAction(bussinessTypeEntity.getAction());
outOrder.setMainAction(bussinessTypeEntity.getMainAction());
@ -756,7 +756,7 @@ public class InvProductsTrService {
temps = filterSupMaps.get(corpName);
OrderEntity outOrder = new OrderEntity();
BeanUtils.copyProperties(orderEntity, outOrder);
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setActDate(DateUtil.getBeforeDay(fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
outOrder.setCreateTime(outOrder.getActDate());
outOrder.setAction(bussinessChangeTypeEntity.getScAction());
outOrder.setMainAction(ConstantType.TYPE_PUT);
@ -1116,4 +1116,17 @@ public class InvProductsTrService {
} else return false;
}
String fromDate(OrderEntity orderEntity) {
String time = "";
if (orderEntity.getAuditTime() != null) {
time = DateUtil.formatDateTime(orderEntity.getAuditTime());
} else {
time = orderEntity.getActDate();
}
return time;
}
}

@ -1,8 +1,8 @@
server.port=9991
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udiwms_ph1?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.jdbc-url=jdbc:mysql://192.168.0.66:3364/udiwms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.password=Glxp@6066
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.maximum-pool-size=60
spring.datasource.hikari.minimum-idle=10

@ -6,4 +6,5 @@ CALL Pro_Temp_ColumnWork ('io_order','wzUploadResult','varchar(255) ', 1);
-- 创建表时必须 create table if not exists 表名
-- 创建表时必须 create table if not exists 表名

Loading…
Cancel
Save