|
|
@ -38,6 +38,7 @@ import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusCon |
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
@ -202,25 +203,30 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt |
|
|
|
// DistributionStockDTO distributionStock1 = JSONObject.parseObject(JSONObject.toJSONString(distributionStocks), DistributionStockDTO.class);
|
|
|
|
// DistributionStockDTO distributionStock1 = JSONObject.parseObject(JSONObject.toJSONString(distributionStocks), DistributionStockDTO.class);
|
|
|
|
List<String> ids = distributionStocks.getIds(); |
|
|
|
List<String> ids = distributionStocks.getIds(); |
|
|
|
List<DistributionStockEntity> list = new ArrayList<>(); |
|
|
|
List<DistributionStockEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int ii = 0; ii < ids.size(); ii++) { |
|
|
|
|
|
|
|
String i = ids.get(ii); |
|
|
|
ids.forEach( i ->{ |
|
|
|
|
|
|
|
DistributionStockEntity stockEntity = new DistributionStockEntity(); |
|
|
|
DistributionStockEntity stockEntity = new DistributionStockEntity(); |
|
|
|
stockEntity.setParcelListId(Long.parseLong(i)); // 包件id
|
|
|
|
stockEntity.setParcelListId(Long.parseLong(i)); // 包件id
|
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(i); |
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(i); |
|
|
|
DistributionStockArticleEntity byId1 = distributionStockArticleService.getById(byId.getStockArticleId()); |
|
|
|
DistributionStockArticleEntity byId1 = distributionStockArticleService.getById(byId.getStockArticleId()); |
|
|
|
//查询包件数量
|
|
|
|
//查询包件数量
|
|
|
|
getUpdateOrderState(Long.parseLong(i),1 ); |
|
|
|
getUpdateOrderState(Long.parseLong(i),1,0 ); |
|
|
|
|
|
|
|
//选择预约库存品
|
|
|
|
List<DistributionStockVO> stockVOList = baseMapper.selectReservationDelivery(String.valueOf(distributionStocks.getStockupId())); |
|
|
|
List<DistributionStockVO> stockVOList = baseMapper.selectReservationDelivery(String.valueOf(distributionStocks.getStockupId())); |
|
|
|
if (stockVOList.size() > 0) { |
|
|
|
if (stockVOList.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && distributionStocks.getStockupType().equals("ZT")){ |
|
|
|
|
|
|
|
stockEntity.setBillLadingId(stockVOList.get(0).getReservationId()); |
|
|
|
|
|
|
|
}else{ |
|
|
|
stockEntity.setReservationId(stockVOList.get(0).getReservationId()); |
|
|
|
stockEntity.setReservationId(stockVOList.get(0).getReservationId()); |
|
|
|
|
|
|
|
} |
|
|
|
stockEntity.setDeliveryListId(stockVOList.get(0).getDeliveryListId()); |
|
|
|
stockEntity.setDeliveryListId(stockVOList.get(0).getDeliveryListId()); |
|
|
|
stockEntity.setDeliveryListCode(stockVOList.get(0).getDeliveryListCode()); |
|
|
|
stockEntity.setDeliveryListCode(stockVOList.get(0).getDeliveryListCode()); |
|
|
|
} |
|
|
|
|
|
|
|
// DistributionStockArticleEntity byId1 = distributionStockArticleService.getById(byId.getStockArticleId());
|
|
|
|
// DistributionStockArticleEntity byId1 = distributionStockArticleService.getById(byId.getStockArticleId());
|
|
|
|
stockEntity.setGoodsAllocation(byId.getGoodsAllocation()); // 货位
|
|
|
|
stockEntity.setGoodsAllocation(byId.getGoodsAllocation()); // 货位
|
|
|
|
stockEntity.setMaterialId(byId.getMaterialId()); // 物料
|
|
|
|
stockEntity.setMaterialId(byId.getMaterialId()); // 物料
|
|
|
|
stockEntity.setMarketId(byId.getMaterialId()); // 商场
|
|
|
|
stockEntity.setMarketId(byId1.getMallId()); // 商场
|
|
|
|
stockEntity.setStockArticle(byId.getStockArticleId()); // 在库订单ID
|
|
|
|
stockEntity.setStockArticle(byId.getStockArticleId()); // 在库订单ID
|
|
|
|
stockEntity.setCoding(byId.getOrderPackageCode()); //包条码
|
|
|
|
stockEntity.setCoding(byId.getOrderPackageCode()); //包条码
|
|
|
|
stockEntity.setConditions("1"); //状态
|
|
|
|
stockEntity.setConditions("1"); //状态
|
|
|
@ -239,18 +245,13 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt |
|
|
|
parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); |
|
|
|
parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); |
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
// distributionStockService.list(Wrappers.<S>query().lambda().eq());
|
|
|
|
// distributionStockService.list(Wrappers.<S>query().lambda().eq());
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && distributionStocks.getStockupType().equals("ZT")){ |
|
|
|
if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && distributionStocks.getStockupType().equals("ZT")){ |
|
|
|
//修改备货状态 自提
|
|
|
|
//修改备货状态 自提
|
|
|
|
getUpdateOrderState(distributionStocks.getStockupId(),3 ); |
|
|
|
getUpdateOrderState(distributionStocks.getStockupId(),3,list.size() ); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
//修改备货状态
|
|
|
|
//修改备货状态 市 商
|
|
|
|
getUpdateOrderState(distributionStocks.getStockupId(),2 ); |
|
|
|
getUpdateOrderState(distributionStocks.getStockupId(),2,list.size() ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.saveBatch(list); |
|
|
|
return this.saveBatch(list); |
|
|
@ -262,7 +263,7 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void getUpdateOrderState(Long pageId,int type) { |
|
|
|
public void getUpdateOrderState(Long pageId,int type,Integer num ) { |
|
|
|
switch (type){ |
|
|
|
switch (type){ |
|
|
|
case 1: //修改订单备货状态
|
|
|
|
case 1: //修改订单备货状态
|
|
|
|
DistributionStockVO distributionStockVO = baseMapper.selectParcelList(pageId); //查询有多少待备货的包件
|
|
|
|
DistributionStockVO distributionStockVO = baseMapper.selectParcelList(pageId); //查询有多少待备货的包件
|
|
|
@ -278,16 +279,23 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: //备货
|
|
|
|
case 2: //备货 商 市
|
|
|
|
|
|
|
|
//查询还没有扫的数量
|
|
|
|
DistributionStockVO distributionStockVO1 = baseMapper.selectStockupInfo(pageId); |
|
|
|
DistributionStockVO distributionStockVO1 = baseMapper.selectStockupInfo(pageId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionStockVO1)){ |
|
|
|
|
|
|
|
//有订单
|
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionStockVO1.getScanned()) && !distributionStockVO1.getScanned().equals(0)){ |
|
|
|
|
|
|
|
//没有完成
|
|
|
|
|
|
|
|
getUpdateStockup(pageId,1); |
|
|
|
|
|
|
|
}else{ |
|
|
|
//查询库存品
|
|
|
|
//查询库存品
|
|
|
|
DistributionDeliveryDetailsVO distributionOrder = distributionDeliveryDetailsService.selectOrderCount(pageId); |
|
|
|
DistributionDeliveryDetailsVO distributionOrder = distributionDeliveryDetailsService.selectOrderCount(pageId); |
|
|
|
if(ObjectUtils.isNotNull(distributionStockVO1.getScanned()) && distributionStockVO1.getScanned() == 0 ){ //已扫数为o
|
|
|
|
|
|
|
|
//修改备货任务
|
|
|
|
//修改备货任务
|
|
|
|
if(ObjectUtils.isNotNull(distributionOrder)){ |
|
|
|
if(ObjectUtils.isNotNull(distributionOrder)){ |
|
|
|
int i = ObjectUtils.isNotNull(distributionOrder.getEsauNum()) ? distributionOrder.getEsauNum() : 0; |
|
|
|
int i = ObjectUtils.isNotNull(distributionOrder.getEsauNum()) ? distributionOrder.getEsauNum() : 0; |
|
|
|
int ii = ObjectUtils.isNotNull(distributionOrder.getWholeNum()) ? distributionOrder.getWholeNum() : 0; |
|
|
|
int ii = ObjectUtils.isNotNull(distributionOrder.getWholeNum()) ? distributionOrder.getWholeNum() : 0; |
|
|
|
if(i == ii){ |
|
|
|
if(i >= ii){ |
|
|
|
//查询备货状态
|
|
|
|
//查询备货状态
|
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
} |
|
|
|
} |
|
|
@ -296,30 +304,33 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt |
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3://自提
|
|
|
|
case 3://自提
|
|
|
|
DistributionStockVO distributionStockSelf = baseMapper.selectStockupInfoSelf(pageId); |
|
|
|
DistributionStockVO distributionStockSelf = baseMapper.selectStockupInfoSelf(pageId); |
|
|
|
//查询库存品
|
|
|
|
//查询库存品
|
|
|
|
DistributionDeliveryDetailsVO distributionSelf = distributionDeliveryDetailsService.selectCount(pageId); |
|
|
|
DistributionDeliveryDetailsVO distributionSelf = distributionDeliveryDetailsService.selectCount(pageId); |
|
|
|
if(ObjectUtils.isNotNull(distributionStockSelf.getScanned())){ |
|
|
|
int ys = 0; //已扫
|
|
|
|
if(distributionStockSelf.getScanned() == distributionStockSelf.getWhole()){ |
|
|
|
int qb = 0; //全部
|
|
|
|
//订单已扫完
|
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionSelf)){ |
|
|
|
if(ObjectUtils.isNotNull(distributionSelf)){ |
|
|
|
int i = ObjectUtils.isNotNull(distributionSelf.getEsauNum()) ? distributionSelf.getEsauNum() : 0; |
|
|
|
//有库存品
|
|
|
|
int ii = ObjectUtils.isNotNull(distributionSelf.getWholeNum()) ? distributionSelf.getWholeNum() : 0; |
|
|
|
ys += distributionSelf.getEsauNum(); |
|
|
|
if(i == ii){ |
|
|
|
qb += distributionSelf.getWholeNum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(distributionStockSelf)){ |
|
|
|
|
|
|
|
//有订单
|
|
|
|
|
|
|
|
ys += distributionStockSelf.getScanned(); |
|
|
|
|
|
|
|
qb += distributionStockSelf.getWhole(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ys + num >= qb){ |
|
|
|
//修改备货任务
|
|
|
|
//修改备货任务
|
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
//没有完成
|
|
|
|
//没有完成
|
|
|
|
getUpdateStockup(pageId,1); |
|
|
|
getUpdateStockup(pageId,1); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
|
|
|
|
//修改备货任务
|
|
|
|
|
|
|
|
getUpdateStockup(pageId,2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|