| | |
| | | import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesOutRecordMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import com.ruoyi.consumables.pojo.ConsumablesOutRecord; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | |
| | | private ConsumablesUnInventoryMapper consumablesUnInventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | return consumablesOutRecordMapper.listPage(page, ConsumablesOutRecordDto); |
| | | public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto) { |
| | | return consumablesOutRecordMapper.listPage(page, consumablesOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int add(ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | public int add(ConsumablesOutRecordDto consumablesOutRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(consumablesOutRecordMapper, "CK"); |
| | | ConsumablesOutRecordDto.setOutboundBatches(no); |
| | | ConsumablesInRecord ConsumablesInRecord = new ConsumablesInRecord(); |
| | | BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesInRecord); |
| | | return consumablesOutRecordMapper.insert(ConsumablesOutRecordDto); |
| | | consumablesOutRecordDto.setOutboundBatches(no); |
| | | return consumablesOutRecordMapper.insert(consumablesOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | public int update(Long id, ConsumablesOutRecordDto consumablesOutRecordDto) { |
| | | // 判断对象是否存在 |
| | | ConsumablesOutRecord ConsumablesOutRecord = consumablesOutRecordMapper.selectById(id); |
| | | if (ConsumablesOutRecord == null){ |
| | | ConsumablesOutRecord consumablesOutRecord = consumablesOutRecordMapper.selectById(id); |
| | | if (consumablesOutRecord == null){ |
| | | throw new BaseException("该出库记录不存在,无法更新!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id", "outbound_batches"};//排除id属性 |
| | | BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesOutRecord, ignoreProperties); |
| | | return consumablesOutRecordMapper.updateById(ConsumablesOutRecord); |
| | | BeanUtils.copyProperties(consumablesOutRecordDto, consumablesOutRecord, ignoreProperties); |
| | | return consumablesOutRecordMapper.updateById(consumablesOutRecord); |
| | | } |
| | | |
| | | @Override |
| | |
| | | }else { |
| | | ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto(); |
| | | consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId()); |
| | | consumablesInRecordDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); |
| | | consumablesInRecordDto.setQualitity(consumablesOutRecord.getStockOutNum()); |
| | | consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInRecordDto); |
| | | } |
| | | }else if (consumablesOutRecord.getType().equals("1")) { |
| | |
| | | }else { |
| | | ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto(); |
| | | consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId()); |
| | | consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); |
| | | consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getStockOutNum()); |
| | | consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(ConsumablesOutRecordDto); |
| | | public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto) { |
| | | List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(consumablesOutRecordDto); |
| | | for (ConsumablesOutRecordExportData consumablesInRecordExportData : list) { |
| | | if (consumablesInRecordExportData.getType().equals("0")) { |
| | | consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); |