功能修改

master
sunjianxi 5 days ago
parent b9104dd956
commit bca6b3fe1d
  1. 9
      src/main/java/com/nov/KgLowDurable/controller/LdOneFormController.java
  2. 7
      src/main/java/com/nov/KgLowDurable/pojo/entity/LdOneForm.java
  3. 2
      src/main/java/com/nov/KgLowDurable/service/ILdOneFormService.java
  4. 33
      src/main/java/com/nov/KgLowDurable/service/Impl/LdOneFormServiceImpl.java
  5. 11
      src/main/java/com/nov/KgLowDurable/service/Impl/LdPurchaseEndServiceImpl.java
  6. 2
      src/main/resources/mapper/LdOnePutStorageDetailMapper.xml

@ -55,6 +55,15 @@ public class LdOneFormController {
}
@PostMapping("/getOnePutOneForm2")
@ApiOperationSort(3)
@ApiOperation(value = "获取一级出库库存", notes = "查询库存", httpMethod = "POST", response = Result.class)
public Result getOnePutOneForm2(@RequestBody List<LdOneForm> oneFormList) {
return Result.OK(oneFormService.getOnePutOneForm2(oneFormList));
}
}

@ -2,6 +2,7 @@
package com.nov.KgLowDurable.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -84,4 +85,10 @@ public class LdOneForm implements Serializable {
*/
private String remark;
/**
* 已入库数量
*/
@TableField(exist = false)
private BigDecimal yetInboundQuantity;
}

@ -49,4 +49,6 @@ public interface ILdOneFormService extends IService<LdOneForm> {
* @return
*/
List<LdOneForm> getOnePutOneForm(List<LdOneForm> oneFormList);
List<LdOneForm> getOnePutOneForm2(List<LdOneForm> oneFormList);
}

@ -7,6 +7,7 @@ import com.nov.KgLowDurable.mapper.LdOneFormMapper;
import com.nov.KgLowDurable.pojo.entity.LdOneForm;
import com.nov.KgLowDurable.service.ILdOneFormService;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -100,10 +101,40 @@ public class LdOneFormServiceImpl extends ServiceImpl<LdOneFormMapper, LdOneForm
))
.values().stream()
.collect(Collectors.toList());
mergedList.sort(Comparator.comparing(LdOneForm::getMaterialCode));
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) {
LdOneForm newForm = new LdOneForm();

@ -14,10 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -81,6 +78,10 @@ public class LdPurchaseEndServiceImpl extends ServiceImpl<LdPurchaseEndMapper, L
.collect(Collectors.toList());
List<LdOnePutStorageDetail> ldOnePutStorageDetailList = onePutStorageDetailService.getSummaryData(collect);
ldOnePutStorageDetailList.forEach(detail ->{
detail.setYetInboundQuantity(detail.getInboundQuantity());
});
ldOnePutStorageDetailList.sort(Comparator.comparing(LdOnePutStorageDetail::getMaterialCode));
return ldOnePutStorageDetailList;
}
}
@ -106,7 +107,7 @@ public class LdPurchaseEndServiceImpl extends ServiceImpl<LdPurchaseEndMapper, L
onePutStorageDetail.setLdPurchaseEndId(ldPurchaseEnd.getId());
list.add(onePutStorageDetail);
}
list.sort(Comparator.comparing(LdOnePutStorageDetail::getMaterialCode));
return list;
}
}

@ -78,7 +78,6 @@
model,
type,
unit,
unit_price,
required_quantity,
SUM(inbound_quantity) as inbound_quantity
FROM ld_one_put_storage_detail
@ -95,7 +94,6 @@
model,
type,
unit,
unit_price,
required_quantity
ORDER BY ld_purchase_end_id, material_id;
</select>

Loading…
Cancel
Save