|
@@ -605,7 +605,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
fabricPoOrderIn.setIQuantityNSettle(DoubleOperation.sub(fabricPoOrderIn.getIQuantity(),fabricPoOrderIn.getIQuantitySettle()));
|
|
|
// 获取保存的委外单价
|
|
|
Optional<FabricMoOrderCK> findOpt = moOrderCKList.stream().filter(e->e.getInvOutId().equalsIgnoreCase(fabricPoOrderIn.getInvId())).findFirst();
|
|
|
- if (findOpt.isPresent()){
|
|
|
+ if (findOpt.isPresent() && findOpt.get().getIPrice()>0){
|
|
|
FabricMoOrderCK findItem = findOpt.get();
|
|
|
fabricPoOrderIn.setIPrice(DoubleOperation.getScale(findItem.getIPrice(),4));
|
|
|
}else {
|
|
@@ -956,6 +956,60 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
List<FabricMoOrderRK> rowInList = fabricLossMapper.getOmInDetailList(code);
|
|
|
rowInList.forEach(e->e.setITempUseSum(0.0));
|
|
|
// 设置是否本计划入库标识
|
|
|
+ List<FabricMoOrderCK> tmpOutList = new ArrayList<>();
|
|
|
+ rowOutList.forEach(e->{
|
|
|
+ FabricMoOrderCK tmpOut = tmpOutList.stream().filter(o->o.getInvOutId().equalsIgnoreCase(e.getInvOutId())).findAny().orElse(null);
|
|
|
+ if (tmpOut == null){
|
|
|
+ tmpOut = new FabricMoOrderCK();
|
|
|
+ tmpOut.setCInvCodeOut(e.getCInvCodeOut());
|
|
|
+ tmpOut.setCColorOut(e.getCColorOut());
|
|
|
+ tmpOut.setCBatchOut(e.getCBatchOut());
|
|
|
+ tmpOut.setIQuantityOut(e.getIQuantityOut());
|
|
|
+ tmpOutList.add(tmpOut);
|
|
|
+ }else{
|
|
|
+ tmpOut.setIQuantityOut(DoubleOperation.add(tmpOut.getIQuantityOut(),e.getIQuantityOut()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ List<FabricMoOrderCK> tmpInList = new ArrayList<>();
|
|
|
+ poOrderInList.forEach(e->{
|
|
|
+ FabricMoOrderCK tmpOut = tmpInList.stream().filter(o->o.getInvOutId().equalsIgnoreCase(e.getInvId())).findAny().orElse(null);
|
|
|
+ if (tmpOut == null){
|
|
|
+ tmpOut = new FabricMoOrderCK();
|
|
|
+ tmpOut.setCInvCodeOut(e.getCInvCode());
|
|
|
+ tmpOut.setCColorOut(e.getCColor());
|
|
|
+ tmpOut.setCBatchOut(e.getCBatch());
|
|
|
+ tmpOut.setIQuantityOut(e.getIQuantity());
|
|
|
+ tmpInList.add(tmpOut);
|
|
|
+ }else{
|
|
|
+ tmpOut.setIQuantityOut(DoubleOperation.add(tmpOut.getIQuantityOut(),e.getIQuantity()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ rowInList.forEach(e->{
|
|
|
+ FabricMoOrderCK tmpOut = tmpInList.stream().filter(o->o.getInvOutId().equalsIgnoreCase(e.getInvId())).findAny().orElse(null);
|
|
|
+ if (tmpOut == null){
|
|
|
+ tmpOut = new FabricMoOrderCK();
|
|
|
+ tmpOut.setCInvCodeOut(e.getCInvCode());
|
|
|
+ tmpOut.setCColorOut(e.getCColor());
|
|
|
+ tmpOut.setCBatchOut(e.getCBatch());
|
|
|
+ tmpOut.setIQuantityOut(e.getIQuantityIn());
|
|
|
+ tmpInList.add(tmpOut);
|
|
|
+ }else{
|
|
|
+ tmpOut.setIQuantityOut(DoubleOperation.add(tmpOut.getIQuantityOut(),e.getIQuantityIn()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ List<String> otherInInvId = new ArrayList<>(); // 其他入库的物料
|
|
|
+ tmpOutList.forEach(o->{
|
|
|
+ FabricMoOrderCK in = tmpInList.stream().filter(i->i.getInvOutId().equalsIgnoreCase(o.getInvOutId())).findAny().orElse(null);
|
|
|
+ if (in != null){
|
|
|
+ o.setIQuantityOut(DoubleOperation.sub(o.getIQuantityOut(),in.getIQuantityOut()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tmpOutList.forEach(o->{
|
|
|
+ if (o.getIQuantityOut()>0){
|
|
|
+ otherInInvId.add(o.getInvOutId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*
|
|
|
List<String> otherInInvId = new ArrayList<>(); // 其他入库的物料
|
|
|
for (FabricMoOrderCK outItem : rowOutList){
|
|
|
if (poOrderInList.stream().filter(e->e.getInvId().equalsIgnoreCase(outItem.getInvOutId())).count()>0 ||
|
|
@@ -964,7 +1018,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
}else{
|
|
|
otherInInvId.add(outItem.getInvOutId());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 查询物料入库信息
|
|
|
List<FabricCommonIn> otherInList = new ArrayList<>();
|
|
|
if (otherInInvId.size()>0) {
|
|
@@ -1701,6 +1755,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
if (DoubleOperation.sub(moOrderCK.getIQuantityOut(),moOrderCK.getITempUseSum())==0){
|
|
|
continue;
|
|
|
}
|
|
|
+ moOrderCK.setIQuantityOut(DoubleOperation.sub(moOrderCK.getIQuantityOut(),moOrderCK.getITempUseSum()));
|
|
|
FabricPoOrderOut poOrderOut = FabricPoOrderOut.getByMoOut(moOrderCK);
|
|
|
// 批号是期初的,或者普通采购入库的非杂纱,算来源余纱
|
|
|
if ("期初".equalsIgnoreCase(moOrderCK.getCBatchOut()) ||
|
|
@@ -1790,6 +1845,13 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
}
|
|
|
}
|
|
|
// 入排序
|
|
|
+ allInList.forEach(e->{
|
|
|
+ if (e.getIPrice() == null){
|
|
|
+ e.setIPrice(0.0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ allInList.stream().sorted(Comparator.comparing(FabricPoOrderIn::getIPrice).reversed());
|
|
|
+ /*
|
|
|
Collections.sort(allInList, new Comparator<FabricPoOrderIn>() {
|
|
|
@Override
|
|
|
public int compare(FabricPoOrderIn o1, FabricPoOrderIn o2) {
|
|
@@ -1811,7 +1873,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
|
|
|
return (int)(o1.getIPrice()-o2.getIPrice());
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
// 转入数量有负数的,从正数扣除
|
|
|
List<FabricPoOrderIn> nList = allInList.stream().filter(e->e.getIQuantity()<0).collect(Collectors.toList());// 负数
|
|
|
allInList = allInList.stream().filter(e->e.getIQuantity()>=0).collect(Collectors.toList());// 正数
|