|
@@ -10,19 +10,25 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.modules.projectCost.service.IProjectCostService;
|
|
|
+import org.jeecg.modules.wzOutboundOrder.convert.WzOutboundOrderBConvert;
|
|
|
import org.jeecg.modules.wzOutboundOrder.entity.WzOutboundOrderH;
|
|
|
import org.jeecg.modules.wzOutboundOrder.service.IWzOutboundOrderBService;
|
|
|
import org.jeecg.modules.wzOutboundOrder.service.IWzOutboundOrderHService;
|
|
|
+import org.jeecg.modules.wzOutboundOrder.vo.CLFCompareListVO;
|
|
|
import org.jeecg.modules.wzOutboundOrder.vo.WzOutboundOrderBDetailListVO;
|
|
|
+import org.jeecg.modules.wzOutboundOrder.vo.WzOutboundOrderBWLBMListVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -37,10 +43,86 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
public class WzOutboundOrderHController extends JeecgController<WzOutboundOrderH, IWzOutboundOrderHService> {
|
|
|
@Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
private IWzOutboundOrderHService wzOutboundOrderHService;
|
|
|
@Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
private IWzOutboundOrderBService bService;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ private IProjectCostService projectCostService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目成本——材料费详情对比
|
|
|
+ */
|
|
|
+ @ApiOperation(value="项目成本——材料费详情对比", notes="项目成本——材料费详情对比")
|
|
|
+ @GetMapping(value = "/compareCLFDetailList")
|
|
|
+ public List<CLFCompareListVO> compareCLFDetailList(String tasknos) {
|
|
|
+ List<String> tasknoList = Arrays.asList(tasknos.split(","));
|
|
|
+ List<WzOutboundOrderH> hList =wzOutboundOrderHService.getCKDHByTasknos(tasknoList);//根据任务号列表查询所有出库单号
|
|
|
+
|
|
|
+ List<WzOutboundOrderH> list1 = new ArrayList<>();//正常出库单集合
|
|
|
+ List<WzOutboundOrderBWLBMListVO> wlbmList = new ArrayList<>();//所有物料编码集合
|
|
|
+ if (hList!=null && !hList.isEmpty()) {
|
|
|
+ for (WzOutboundOrderH h:hList){
|
|
|
+ //出库单号对应的物料单数量——大于5000被认为是异常数据,舍弃
|
|
|
+ Integer count = bService.getckDetailDataCountByCkdh(h.getCkdh());
|
|
|
+ if(count>5000) continue;
|
|
|
+ list1.add(h);//留下正常数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!list1.isEmpty()){
|
|
|
+ List<String> ckdhList = list1.stream().map(i->i.getCkdh()).collect(Collectors.toList());//出库单号集合
|
|
|
+ if(!list1.isEmpty()) wlbmList = bService.selectWLBMList(ckdhList);//根据出库单号查询物料编码及单价、数量等
|
|
|
+ }
|
|
|
|
|
|
+ BigDecimal clf = BigDecimal.valueOf(0);//材料费
|
|
|
+ String rwh = ""; //任务号
|
|
|
+ String wlbm = ""; //物料编码
|
|
|
+ BigDecimal zsl = new BigDecimal(0); //总数量
|
|
|
+ BigDecimal zje = new BigDecimal(0); //总金额
|
|
|
+ List<CLFCompareListVO> bList = new ArrayList<>();//返回结果集合
|
|
|
+ int i = -1;
|
|
|
+ for (WzOutboundOrderBWLBMListVO bwlbmListVO : wlbmList){
|
|
|
+
|
|
|
+ BigDecimal cgdj = bwlbmListVO.getCgdj(); //采购单价
|
|
|
+ BigDecimal nbdj = bwlbmListVO.getNbdj(); //内部单价
|
|
|
+ BigDecimal sfzsl = bwlbmListVO.getSfzsl(); //实发主数量
|
|
|
+
|
|
|
+ /*如果实发主数量为空,则给默认值0*/
|
|
|
+ Optional<BigDecimal> sfzsl1 = Optional.ofNullable(sfzsl);
|
|
|
+ sfzsl = sfzsl1.orElse(BigDecimal.valueOf(0));
|
|
|
+
|
|
|
+ /*计算:采购单价或内部单价*实发主数量 (若没有采购单价,则使用内部单价)*/
|
|
|
+ BigDecimal wlf = BigDecimal.valueOf(0);
|
|
|
+ if (cgdj != null) {
|
|
|
+ wlf = cgdj.multiply(sfzsl);
|
|
|
+ } else if (nbdj != null) {
|
|
|
+ wlf = nbdj.multiply(sfzsl);
|
|
|
+ }
|
|
|
+ clf = wlf;
|
|
|
+
|
|
|
+ zsl = sfzsl; //总数量
|
|
|
+ zje = clf; //总金额
|
|
|
+
|
|
|
+ //相同,则与上一个累加
|
|
|
+ if(bwlbmListVO.getRwh().equals(rwh) && bwlbmListVO.getWlbm().equals(wlbm)){
|
|
|
+ CLFCompareListVO vo = bList.get(i);
|
|
|
+ vo.setZje(vo.getZje().add(zje));
|
|
|
+ vo.setZsl(vo.getZsl().add(zsl));
|
|
|
+ }else { //不相同,直接加入集合
|
|
|
+ CLFCompareListVO clfCompareListVO = WzOutboundOrderBConvert.INSTANCE.toCLFCompareListVO(bwlbmListVO.getWlbm(), bwlbmListVO.getRwh(), zsl, zje);
|
|
|
+ bList.add(clfCompareListVO);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ rwh = bwlbmListVO.getRwh();
|
|
|
+ wlbm = bwlbmListVO.getWlbm();
|
|
|
+ }
|
|
|
+
|
|
|
+ return bList;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 材料费详情
|
|
@@ -49,15 +131,15 @@ public class WzOutboundOrderHController extends JeecgController<WzOutboundOrderH
|
|
|
@GetMapping(value = "/getCLFList")
|
|
|
public List<WzOutboundOrderBDetailListVO> getCLFList(String taskno) {
|
|
|
|
|
|
- List<WzOutboundOrderBDetailListVO> bList = new ArrayList<>();
|
|
|
+ List<WzOutboundOrderBDetailListVO> bList = new ArrayList<>();
|
|
|
|
|
|
QueryWrapper<WzOutboundOrderH> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("rwh",taskno);
|
|
|
List<WzOutboundOrderH> list =wzOutboundOrderHService.list(wrapper);
|
|
|
List<WzOutboundOrderH> list1 = new ArrayList<>();
|
|
|
- if (!list.isEmpty()) {
|
|
|
+ if (list!=null && !list.isEmpty()) {
|
|
|
for (WzOutboundOrderH h:list){
|
|
|
- //出库单号对应的物料单数量
|
|
|
+ //出库单号对应的物料单数量——大于5000被认为是异常数据,舍弃
|
|
|
Integer count = bService.getckDetailDataCountByCkdh(h.getCkdh());
|
|
|
if(count>5000) continue;
|
|
|
list1.add(h);
|
|
@@ -65,7 +147,7 @@ public class WzOutboundOrderHController extends JeecgController<WzOutboundOrderH
|
|
|
}
|
|
|
if(!list1.isEmpty()){
|
|
|
List<String> list2 = list1.stream().map(i->i.getCkdh()).collect(Collectors.toList());
|
|
|
- bList = bService.wzDetailList(list2);
|
|
|
+ if(!list2.isEmpty()) bList = bService.wzDetailList(list2);
|
|
|
}
|
|
|
}
|
|
|
|