package com.steerinfo.dil.service.impl; import com.steerinfo.dil.mapper.TmstruckEnfactoryResultMapper; import com.steerinfo.dil.mapper.TmstruckLeaveFactoryResultMapper; import com.steerinfo.dil.service.ITmstruckSelfMachineService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author luobang * @create 2021-11-17 20:59 */ @Service public class TmstruckSelfMachineService implements ITmstruckSelfMachineService { @Autowired TmstruckEnfactoryResultMapper tmstruckEnfactoryResultMapper; @Autowired TmstruckLeaveFactoryResultMapper tmstruckLeaveFactoryResultMapper; /** * 提货单信息 * @param orderNumber * @return */ @Override public Map getBillOrder(String orderNumber) { //1.根据运输订单号查询主干信息 Mapmap=tmstruckEnfactoryResultMapper.getBillOrder(orderNumber); if(map !=null){ //2.根据运输订单号查询枝叶信息-物资 List>list=tmstruckEnfactoryResultMapper.getBillOrderMaterial(orderNumber); map.put("materialList",list); } return map; } @Override public List> getBillOrderForPrinter(String orderNumber) { return tmstruckEnfactoryResultMapper.getBillOrderForPrinter(orderNumber); } @Override public Map getDeliveryOrder(String orderNumber) { //1.根据运输订单号查询主干信息 Map map = tmstruckLeaveFactoryResultMapper.getDeliveryOrder(orderNumber); map.put("note",tmstruckLeaveFactoryResultMapper.querynote(orderNumber)); map.put("orderNumber",orderNumber); if(map !=null){ List> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber); //判断为棒材还是线材 for (Map map1:deliveryOrderMaterialList){ BigDecimal materialid = (BigDecimal) map1.get("materialId"); String materialName =(String) map1.get("materialName"); map.put("materialName",materialName); BigDecimal Bigdecimal1 = tmstruckLeaveFactoryResultMapper.queryNumber(materialid, orderNumber); map1.put("materialNumber",Bigdecimal1); //判断是实重还是理重的标志 BigDecimal isPoundSale = (BigDecimal) map1.get("isPoundSale"); //判断是否为盘螺materialName.contains("盘螺")||materialName.contains("盘元") if (isPoundSale !=null && isPoundSale.compareTo(BigDecimal.valueOf(0))==0){ //根据运输订单号查找实绩重量 List> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map); for (Map stringObjectMap : netWeightlist) { BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid"); if(materialid1 !=null&&!("".equals(materialid1))){ if (materialid.compareTo(materialid1) == 0) { BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight"); if (nowNetWeight != null) { map1.put("materialWeight", nowNetWeight); } } }else { map1.put("materialWeight", ""); } } }else { //获取物资理重 List> theoryWeightlist = tmstruckLeaveFactoryResultMapper.getTheoryWeight(map); for (Map stringObjectMap : theoryWeightlist) { BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid"); if (materialid.compareTo(materialid1) == 0){ BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight"); if (theoryWeight != null){ map1.put("materialWeight",theoryWeight); } } } } } map.put("deliveryOrderMaterialList",deliveryOrderMaterialList); } return map; } }