| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.OilDepotMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.mapper.TankInfoMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.OilDepot; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.pojo.TankInfo; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | private final StockInRecordService stockInRecordService; |
| | | private final ProductModelMapper productModelMapper; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | private final OilDepotMapper oilDepotMapper; |
| | | private final TankInfoMapper tankInfoMapper; |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | @Override |
| | | public IPage<StockUninventoryDto> pageStockUninventory(Page page, StockUninventoryDto stockUninventoryDto) { |
| | |
| | | stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo()); |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordDto.setOilDepotId(stockUninventoryDto.getOilDepotId()); |
| | | stockInRecordDto.setOilDepotName(stockUninventoryDto.getOilDepotName()); |
| | | stockInRecordDto.setInboundCategory(stockUninventoryDto.getInboundCategory()); |
| | | if (stockUninventoryDto.getOilDepotId() != null && StringUtils.isEmpty(stockInRecordDto.getOilDepotName())) { |
| | | OilDepot oilDepot = oilDepotMapper.selectById(stockUninventoryDto.getOilDepotId()); |
| | | if (oilDepot != null) { |
| | | stockInRecordDto.setOilDepotName(oilDepot.getDepotName()); |
| | | } |
| | | } |
| | | stockInRecordDto.setTankId(stockUninventoryDto.getTankId()); |
| | | stockInRecordDto.setTankNo(stockUninventoryDto.getTankNo()); |
| | | if (stockUninventoryDto.getTankId() != null && StringUtils.isEmpty(stockInRecordDto.getTankNo())) { |
| | | TankInfo tankInfo = tankInfoMapper.selectById(stockUninventoryDto.getTankId()); |
| | | if (tankInfo != null) { |
| | | stockInRecordDto.setTankNo(tankInfo.getTankNo()); |
| | | } |
| | | } |
| | | stockInRecordDto.setInboundTime(stockUninventoryDto.getInboundTime()); |
| | | stockInRecordDto.setOilProduct(stockUninventoryDto.getOilProduct()); |
| | | stockInRecordDto.setOriginalQuantity(stockUninventoryDto.getOriginalQuantity()); |
| | | stockInRecordDto.setCustomerId(stockUninventoryDto.getCustomerId()); |
| | | stockInRecordDto.setCustomerName(stockUninventoryDto.getCustomerName()); |
| | | stockInRecordDto.setContactPerson(stockUninventoryDto.getContactPerson()); |
| | | stockInRecordDto.setContactPhone(stockUninventoryDto.getContactPhone()); |
| | | stockInRecordDto.setDriverName(stockUninventoryDto.getDriverName()); |
| | | stockInRecordDto.setDriverPhone(stockUninventoryDto.getDriverPhone()); |
| | | stockInRecordDto.setEscortName(stockUninventoryDto.getEscortName()); |
| | | stockInRecordDto.setEscortPhone(stockUninventoryDto.getEscortPhone()); |
| | | stockInRecordDto.setTruckPlateNo(stockUninventoryDto.getTruckPlateNo()); |
| | | stockInRecordDto.setTrailerPlateNo(stockUninventoryDto.getTrailerPlateNo()); |
| | | stockInRecordDto.setTankInspectionStatus(stockUninventoryDto.getTankInspectionStatus()); |
| | | stockInRecordDto.setUnloadingCranePosition(stockUninventoryDto.getUnloadingCranePosition()); |
| | | stockInRecordDto.setDensity(stockUninventoryDto.getDensity()); |
| | | stockInRecordDto.setUnloadPhotos(stockUninventoryDto.getUnloadPhotos() == null |
| | | ? null : JSON.toJSONString(stockUninventoryDto.getUnloadPhotos())); |
| | | stockInRecordDto.setGrossWeight(stockUninventoryDto.getGrossWeight()); |
| | | stockInRecordDto.setTareWeight(stockUninventoryDto.getTareWeight()); |
| | | stockInRecordDto.setNetWeight(stockUninventoryDto.getNetWeight()); |
| | | stockInRecordDto.setLossQuantity(stockUninventoryDto.getLossQuantity()); |
| | | stockInRecordDto.setActualVolume(stockUninventoryDto.getActualVolume()); |
| | | stockInRecordDto.setPoundPhotos(stockUninventoryDto.getPoundPhotos() == null |
| | | ? null : JSON.toJSONString(stockUninventoryDto.getPoundPhotos())); |
| | | if (stockUninventoryDto.getCustomerId() != null && StringUtils.isEmpty(stockInRecordDto.getCustomerName())) { |
| | | Customer customer = customerMapper.selectById(stockUninventoryDto.getCustomerId()); |
| | | if (customer != null) { |
| | | stockInRecordDto.setCustomerName(customer.getCustomerName()); |
| | | } |
| | | } |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //审批再添加 |
| | | return 1; |
| | |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordDto.setRemark(stockUninventoryDto.getRemark()); |
| | | stockInRecordDto.setOilDepotId(stockUninventoryDto.getOilDepotId()); |
| | | stockInRecordDto.setOilDepotName(stockUninventoryDto.getOilDepotName()); |
| | | stockInRecordDto.setInboundCategory(stockUninventoryDto.getInboundCategory()); |
| | | if (stockUninventoryDto.getOilDepotId() != null && StringUtils.isEmpty(stockInRecordDto.getOilDepotName())) { |
| | | OilDepot oilDepot = oilDepotMapper.selectById(stockUninventoryDto.getOilDepotId()); |
| | | if (oilDepot != null) { |
| | | stockInRecordDto.setOilDepotName(oilDepot.getDepotName()); |
| | | } |
| | | } |
| | | stockInRecordDto.setTankId(stockUninventoryDto.getTankId()); |
| | | stockInRecordDto.setTankNo(stockUninventoryDto.getTankNo()); |
| | | if (stockUninventoryDto.getTankId() != null && StringUtils.isEmpty(stockInRecordDto.getTankNo())) { |
| | | TankInfo tankInfo = tankInfoMapper.selectById(stockUninventoryDto.getTankId()); |
| | | if (tankInfo != null) { |
| | | stockInRecordDto.setTankNo(tankInfo.getTankNo()); |
| | | } |
| | | } |
| | | stockInRecordDto.setInboundTime(stockUninventoryDto.getInboundTime()); |
| | | stockInRecordDto.setOilProduct(stockUninventoryDto.getOilProduct()); |
| | | stockInRecordDto.setOriginalQuantity(stockUninventoryDto.getOriginalQuantity()); |
| | | stockInRecordDto.setCustomerId(stockUninventoryDto.getCustomerId()); |
| | | stockInRecordDto.setCustomerName(stockUninventoryDto.getCustomerName()); |
| | | stockInRecordDto.setContactPerson(stockUninventoryDto.getContactPerson()); |
| | | stockInRecordDto.setContactPhone(stockUninventoryDto.getContactPhone()); |
| | | stockInRecordDto.setDriverName(stockUninventoryDto.getDriverName()); |
| | | stockInRecordDto.setDriverPhone(stockUninventoryDto.getDriverPhone()); |
| | | stockInRecordDto.setEscortName(stockUninventoryDto.getEscortName()); |
| | | stockInRecordDto.setEscortPhone(stockUninventoryDto.getEscortPhone()); |
| | | stockInRecordDto.setTruckPlateNo(stockUninventoryDto.getTruckPlateNo()); |
| | | stockInRecordDto.setTrailerPlateNo(stockUninventoryDto.getTrailerPlateNo()); |
| | | stockInRecordDto.setTankInspectionStatus(stockUninventoryDto.getTankInspectionStatus()); |
| | | stockInRecordDto.setUnloadingCranePosition(stockUninventoryDto.getUnloadingCranePosition()); |
| | | stockInRecordDto.setDensity(stockUninventoryDto.getDensity()); |
| | | stockInRecordDto.setUnloadPhotos(stockUninventoryDto.getUnloadPhotos() == null |
| | | ? null : JSON.toJSONString(stockUninventoryDto.getUnloadPhotos())); |
| | | stockInRecordDto.setGrossWeight(stockUninventoryDto.getGrossWeight()); |
| | | stockInRecordDto.setTareWeight(stockUninventoryDto.getTareWeight()); |
| | | stockInRecordDto.setNetWeight(stockUninventoryDto.getNetWeight()); |
| | | stockInRecordDto.setLossQuantity(stockUninventoryDto.getLossQuantity()); |
| | | stockInRecordDto.setActualVolume(stockUninventoryDto.getActualVolume()); |
| | | stockInRecordDto.setPoundPhotos(stockUninventoryDto.getPoundPhotos() == null |
| | | ? null : JSON.toJSONString(stockUninventoryDto.getPoundPhotos())); |
| | | if (stockUninventoryDto.getCustomerId() != null && StringUtils.isEmpty(stockInRecordDto.getCustomerName())) { |
| | | Customer customer = customerMapper.selectById(stockUninventoryDto.getCustomerId()); |
| | | if (customer != null) { |
| | | stockInRecordDto.setCustomerName(customer.getCustomerName()); |
| | | } |
| | | } |
| | | stockInRecordService.add(stockInRecordDto); |
| | | return 1; |
| | | } |