| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | |
| | | import com.whyc.mapper.BattSpareRecordMapper; |
| | | import com.whyc.pojo.BattSpare; |
| | | import com.whyc.pojo.BattSpareRecord; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.CollationElementIterator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | spare.setMonCount(monCount); |
| | | if(mapper.updateById(spare)>0){ |
| | | record.setSpareNum(spare.getMonCount()); |
| | | recordMapper.updateById(record); |
| | | record.setOperationTime(new Date()); |
| | | recordMapper.insert(record); |
| | | } |
| | | return new Response().set(1,true,"更新成功"); |
| | | } |
| | | |
| | | public Response getSpareRecord(Integer spareId){ |
| | | public Response getSpareRecord(Integer spareId) { |
| | | QueryWrapper<BattSpareRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("spare_id",spareId); |
| | | queryWrapper.eq("spare_id", spareId); |
| | | queryWrapper.orderByDesc("operation_time"); |
| | | List<BattSpareRecord> list = recordMapper.selectList(queryWrapper); |
| | | for (BattSpareRecord record:list) { |
| | | //根据当前的语言环境设置不同的日志记录 |
| | | String lang = ActionUtil.getLang(); |
| | | for (BattSpareRecord record : list) { |
| | | int operationType = record.getOperationType(); |
| | | switch (operationType){ |
| | | switch (operationType) { |
| | | case -1: |
| | | record.setEventInfo("执行了备件出库操作,出库数量为:"+record.getOperationNum()+",备件库存数为:"+record.getSpareNum()); |
| | | if (!lang.contains("zh")) { |
| | | record.setEventInfo("The spare parts outbound operation has been executed, and the outbound quantity is" + record.getOperationNum() + ",The inventory of spare parts is" + record.getSpareNum()); |
| | | } else { |
| | | record.setEventInfo("执行了备件出库操作,出库数量为:" + record.getOperationNum() + ",备件库存数为:" + record.getSpareNum()); |
| | | } |
| | | break; |
| | | case 1: |
| | | record.setEventInfo("执行了备件入库操作,入库数量为:"+record.getOperationNum()+",备件库存数为:"+record.getSpareNum()); |
| | | if (!lang.contains("zh")) { |
| | | record.setEventInfo("The spare parts outbound operation has been executed, and the outbound quantity is" + record.getOperationNum() + ",The inventory of spare parts is" + record.getSpareNum()); |
| | | } else { |
| | | record.setEventInfo("执行了备件入库操作,入库数量为:" + record.getOperationNum() + ",备件库存数为:" + record.getSpareNum()); |
| | | } |
| | | break; |
| | | case 0: |
| | | record.setEventInfo("新创建了电池备件,并执行入库,入库数量为:"+record.getOperationNum()+",备件库存数为:"+record.getSpareNum()); |
| | | if (!lang.contains("zh")) { |
| | | record.setEventInfo("New battery spare parts have been created and stored in the following quantity is " + record.getOperationNum() + ",The inventory of spare parts is" + record.getSpareNum()); |
| | | } else { |
| | | record.setEventInfo("新创建了电池备件,并执行入库,入库数量为:" + record.getOperationNum() + ",备件库存数为:" + record.getSpareNum()); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |