|
|
|
@ -7,6 +7,7 @@ import com.nov.KgLowDurable.mapper.LdOneFormMapper; |
|
|
|
import com.nov.KgLowDurable.pojo.entity.LdOneForm; |
|
|
|
import com.nov.KgLowDurable.pojo.entity.LdOneForm; |
|
|
|
import com.nov.KgLowDurable.service.ILdOneFormService; |
|
|
|
import com.nov.KgLowDurable.service.ILdOneFormService; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
@ -100,10 +101,40 @@ public class LdOneFormServiceImpl extends ServiceImpl<LdOneFormMapper, LdOneForm |
|
|
|
)) |
|
|
|
)) |
|
|
|
.values().stream() |
|
|
|
.values().stream() |
|
|
|
.collect(Collectors.toList()); |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
mergedList.sort(Comparator.comparing(LdOneForm::getMaterialCode)); |
|
|
|
return mergedList; |
|
|
|
return mergedList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<LdOneForm> getOnePutOneForm2(List<LdOneForm> oneFormList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//收集所有数据
|
|
|
|
|
|
|
|
List<LdOneForm> list = new ArrayList<>(); |
|
|
|
|
|
|
|
//根据物料id和类型查询库存所有数据
|
|
|
|
|
|
|
|
for (LdOneForm oneForm : oneFormList) { |
|
|
|
|
|
|
|
List<LdOneForm> formList = oneFormMapper.selectByMaterialId(oneForm.getMaterialId(), oneForm.getType()); |
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(formList)){ |
|
|
|
|
|
|
|
oneForm.setNum(new BigDecimal(0)); |
|
|
|
|
|
|
|
list.add(oneForm); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
list.addAll(formList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//耐用品由于是拆分开的 新增的数据需要额外加一行
|
|
|
|
|
|
|
|
for (LdOneForm oneForm : oneFormList) { |
|
|
|
|
|
|
|
if(BatchConstant.DURABLE.equals(oneForm.getType())){ |
|
|
|
|
|
|
|
LdOneForm ldOneForm = new LdOneForm(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(oneForm,ldOneForm); |
|
|
|
|
|
|
|
ldOneForm.setNum(new BigDecimal(0)); |
|
|
|
|
|
|
|
list.add(ldOneForm); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list.sort(Comparator.comparing(LdOneForm::getMaterialCode).thenComparing(LdOneForm::getNum)); |
|
|
|
|
|
|
|
return list; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private LdOneForm createNewForm(LdOneForm source) { |
|
|
|
private LdOneForm createNewForm(LdOneForm source) { |
|
|
|
LdOneForm newForm = new LdOneForm(); |
|
|
|
LdOneForm newForm = new LdOneForm(); |
|
|
|
|
|
|
|
|
|
|
|
|