|
@@ -25,10 +25,7 @@ import com.dk.mdm.model.pojo.ivt.Outbound;
|
|
|
import com.dk.mdm.model.pojo.ivt.OutboundItem;
|
|
import com.dk.mdm.model.pojo.ivt.OutboundItem;
|
|
|
import com.dk.mdm.model.pojo.sale.Order;
|
|
import com.dk.mdm.model.pojo.sale.Order;
|
|
|
import com.dk.mdm.model.pojo.sale.OrderItem;
|
|
import com.dk.mdm.model.pojo.sale.OrderItem;
|
|
|
-import com.dk.mdm.model.query.ivt.InboundItemQuery;
|
|
|
|
|
-import com.dk.mdm.model.query.ivt.InventoryQuery;
|
|
|
|
|
-import com.dk.mdm.model.query.ivt.OutboundItemQuery;
|
|
|
|
|
-import com.dk.mdm.model.query.ivt.OutboundQuery;
|
|
|
|
|
|
|
+import com.dk.mdm.model.query.ivt.*;
|
|
|
import com.dk.mdm.model.response.ivt.InboundResponse;
|
|
import com.dk.mdm.model.response.ivt.InboundResponse;
|
|
|
import com.dk.mdm.model.response.ivt.InventoryResponse;
|
|
import com.dk.mdm.model.response.ivt.InventoryResponse;
|
|
|
import com.dk.mdm.model.response.ivt.OutboundItemResponse;
|
|
import com.dk.mdm.model.response.ivt.OutboundItemResponse;
|
|
@@ -264,7 +261,8 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
//根据出库单id分组
|
|
//根据出库单id分组
|
|
|
Map<String, List<OutboundItemVO>> outboundItemVOMap = outboundItemVOList.stream().collect(Collectors.groupingBy(OutboundItemVO::getFromId));
|
|
Map<String, List<OutboundItemVO>> outboundItemVOMap = outboundItemVOList.stream().collect(Collectors.groupingBy(OutboundItemVO::getFromId));
|
|
|
for (String str : outboundItemVOMap.keySet()) {
|
|
for (String str : outboundItemVOMap.keySet()) {
|
|
|
- InboundResponse inboundResponse = inboundMapper.selectByFromId(str);
|
|
|
|
|
|
|
+ List<OutboundItemVO> outboundItemVOListGroup = outboundItemVOMap.get(str);
|
|
|
|
|
+ InboundResponse inboundResponse = inboundMapper.selectByFromId(new InboundQuery().setFromId(str).setIntoId(outboundItemVOListGroup.get(0).getIntoId()));
|
|
|
// 退账
|
|
// 退账
|
|
|
if (inboundResponse != null && inboundResponse.getReceivableId() != null) {
|
|
if (inboundResponse != null && inboundResponse.getReceivableId() != null) {
|
|
|
accountService.reversePayable(inboundResponse.getIntoId(), Constant.InventoryDocCode.INTOBOUND.getTableName());
|
|
accountService.reversePayable(inboundResponse.getIntoId(), Constant.InventoryDocCode.INTOBOUND.getTableName());
|
|
@@ -587,14 +585,24 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
|
//region 外协品新建外协入库单
|
|
//region 外协品新建外协入库单
|
|
|
//筛选出skuId为空的 走外协品逻辑
|
|
//筛选出skuId为空的 走外协品逻辑
|
|
|
- List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
|
|
- for (int i = 0; i < outsideGoods.size(); i++) {
|
|
|
|
|
- outsideGoods.get(i).setPriceOut(outsideGoods.get(i).getCostPrice() == null ? BigDecimal.ZERO : outsideGoods.get(i).getCostPrice());
|
|
|
|
|
|
|
+ if(outboundVO.getItemList()!=null && outboundVO.getItemList().size()>0){
|
|
|
|
|
+ List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
|
|
+ for (int i = 0; i < outsideGoods.size(); i++) {
|
|
|
|
|
+ outsideGoods.get(i).setPriceOut(outsideGoods.get(i).getCostPrice() == null ? BigDecimal.ZERO : outsideGoods.get(i).getCostPrice());
|
|
|
|
|
+ }
|
|
|
|
|
+ //新建外协品生产外协入库单
|
|
|
|
|
+ this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
}
|
|
}
|
|
|
- //删除外协品生产外协入库单
|
|
|
|
|
- this.deleteOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
|
|
- //新建外协品生产外协入库单
|
|
|
|
|
- this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
|
|
|
|
+ if(outboundVO.getDeleteItemList()!=null && outboundVO.getDeleteItemList().size()>0){
|
|
|
|
|
+ List<OutboundItemVO> delOutsideGoods = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
|
|
+ for (int i = 0; i < delOutsideGoods.size(); i++) {
|
|
|
|
|
+ delOutsideGoods.get(i).setPriceOut(delOutsideGoods.get(i).getCostPrice() == null ? BigDecimal.ZERO : delOutsideGoods.get(i).getCostPrice());
|
|
|
|
|
+ }
|
|
|
|
|
+ //删除外协品生产外协入库单
|
|
|
|
|
+ this.deleteOutsideGoodsInto(outboundVO, delOutsideGoods);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 库存
|
|
//region 库存
|
|
@@ -887,18 +895,18 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
accountService.accReceivable(outboundResponse.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
accountService.accReceivable(outboundResponse.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
- //region 外协品新建外协入库单
|
|
|
|
|
|
|
+ //region 外协品新建/删除 外协入库单
|
|
|
//筛选出skuId为空的 走外协品逻辑
|
|
//筛选出skuId为空的 走外协品逻辑
|
|
|
- List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
|
|
- //删除外协品生产外协入库单
|
|
|
|
|
- this.deleteOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
|
|
- //新建外协品生产外协入库单
|
|
|
|
|
- this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
|
|
- if (outboundVO.getDeleteItemList() != null) {
|
|
|
|
|
|
|
+ if (outboundVO.getDeleteItemList() != null && outboundVO.getDeleteItemList().size() > 0) {
|
|
|
List<OutboundItemVO> delOutsideGoods = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
List<OutboundItemVO> delOutsideGoods = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
//删除外协品生产外协入库单
|
|
//删除外协品生产外协入库单
|
|
|
this.deleteOutsideGoodsInto(outboundVO, delOutsideGoods);
|
|
this.deleteOutsideGoodsInto(outboundVO, delOutsideGoods);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (outboundVO.getItemList() != null && outboundVO.getItemList().size() > 0) {
|
|
|
|
|
+ List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
|
|
+ //新建外协品生产外协入库单
|
|
|
|
|
+ this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
|
|
+ }
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 修改库存
|
|
//region 修改库存
|