| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | |
| | | |
| | | @Autowired |
| | | private WorkflowDeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private DeviceSpareService deviceSpareService; |
| | | |
| | | |
| | | public void addBatch(List<WorkflowLink> links) { |
| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | //设备入库申请 |
| | | //设备入库申请 TODO 入库影响库存 |
| | | case 2: |
| | | //设备报废申请 |
| | | case 3:{ |
| | |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | //入库 |
| | | if(mainInDB.getType() == 2){ |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | spare.setName(device.getName()); |
| | | spare.setModel(device.getModel()); |
| | | spare.setVersion(device.getVersion()); |
| | | spare.setQuantity(device.getQuantity()); |
| | | spare.setBrand(device.getBrand()); |
| | | spare.setType(device.getType()); |
| | | spare.setSupplier(device.getSupplier()); |
| | | |
| | | spareList.add(spare); |
| | | }); |
| | | deviceSpareService.add(spareList); |
| | | } |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |