| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.gkhy.hazmat.common.api.CommonPage; |
| | | //import com.gkhy.hazmat.common.config.IdTableNameHandler; |
| | | import com.gkhy.hazmat.common.api.CommonResult; |
| | | import com.gkhy.hazmat.common.domain.entity.SysUser; |
| | | import com.gkhy.hazmat.common.enums.CodePrexEnum; |
| | | import com.gkhy.hazmat.common.enums.HazmatStatusEnum; |
| | |
| | | import com.gkhy.hazmat.common.utils.PageUtils; |
| | | import com.gkhy.hazmat.common.utils.SecurityUtils; |
| | | import com.gkhy.hazmat.system.domain.*; |
| | | import com.gkhy.hazmat.system.domain.dto.HazmatDto; |
| | | import com.gkhy.hazmat.system.domain.vo.HzHazmatOrder; |
| | | import com.gkhy.hazmat.system.domain.vo.HzHazmatWarehouseVO; |
| | | import com.gkhy.hazmat.system.mapper.*; |
| | | import com.gkhy.hazmat.system.service.HzHazmatService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private HzHazmatBasicMapper hazmatBasicMapper; |
| | | @Autowired |
| | | private HzWarehouseMapper warehouseMapper; |
| | | |
| | | @Autowired |
| | | private SubscribeMapper subscribeMapper; |
| | | |
| | | @Autowired |
| | | private HzEntryRecordMapper hzEntryRecordMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | hazmatFlow.setState(OperateStatusEnum.DISCARD.getCode()); |
| | | hazmatFlow.setCompanyId(currentUser.getCompanyId()); |
| | | hazmatFlow.setNum(hazmat.getRemaining().multiply(BigDecimal.valueOf(-1))); |
| | | hazmatFlow.setConsumption(hazmat.getRemaining()); |
| | | hazmatFlow.setCreateId(currentUser.getId()); |
| | | hazmatFlowMapper.insert(hazmatFlow); |
| | | |
| | |
| | | // IdTableNameHandler.removeCurrentId(); |
| | | } |
| | | |
| | | @Override |
| | | public List<HzHazmatOrder> selectByWarehouseAndCupboard(HazmatDto hazmatDto) { |
| | | // if (hazmatDto.getCabinetId() == null || hazmatDto.getAuxiliaryCabinetId() == null) { |
| | | // throw new ApiException("仓库id和存储柜id不能为空"); |
| | | // } |
| | | List<HzHazmatOrder> orders = new ArrayList<>(); |
| | | |
| | | List<HzHazmat> hzHazmats = baseMapper.selectByWarehouseAndCupboard(hazmatDto); |
| | | for (HzHazmat hzHazmat : hzHazmats) { |
| | | HzHazmatOrder hzHazmatOrder = new HzHazmatOrder(); |
| | | HzEntryRecord hzEntryRecord = hzEntryRecordMapper.selectById(hzHazmat.getEntryId()); |
| | | Subscribe subscribes = subscribeMapper.selectBySubscribeNum(hzEntryRecord.getSubscribeNum()); |
| | | HzHazmatBasic hzHazmatBasic = hazmatBasicMapper.selectById(hzHazmat.getBasicId()); |
| | | SysUser sysuer = sysUserMapper.getUserById(subscribes.getSubscribePersonId()); |
| | | hzHazmatOrder.setHzhazmatId(hzHazmat.getId()); |
| | | hzHazmatOrder.setCabinetId(hazmatDto.getCabinetId()); |
| | | hzHazmatOrder.setAuxiliaryCabinetId(hazmatDto.getAuxiliaryCabinetId()); |
| | | hzHazmatOrder.setSubscribeNum(subscribes.getSubscribeNum()); |
| | | hzHazmatOrder.setCas(hzHazmatBasic.getCas()); |
| | | hzHazmatOrder.setStandard(hzHazmatBasic.getHazmatFormat()); |
| | | hzHazmatOrder.setRemaining(hzHazmat.getRemaining()); |
| | | hzHazmatOrder.setProductSn(hzHazmatBasic.getProductSn()); |
| | | hzHazmatOrder.setSubscribePersonName(subscribes.getSubscribePersonName()); |
| | | hzHazmatOrder.setOfDept(sysuer.getDepartName()); |
| | | orders.add(hzHazmatOrder); |
| | | |
| | | } |
| | | |
| | | |
| | | return orders; |
| | | } |
| | | |
| | | public void checkUserAllowed(HzHazmat hazmat,SysUser user) { |
| | | if (user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) { |
| | | throw new ApiException("管理员不能操作"); |