| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.by4cloud.platformx.device.dto.ReceivingNoteQueryDTO; |
| | | import com.by4cloud.platformx.device.entity.DeviceInventory; |
| | | import com.by4cloud.platformx.device.entity.ReceivingNote; |
| | | import com.by4cloud.platformx.device.entity.ReceivingNoteItem; |
| | | import com.by4cloud.platformx.device.mapper.DeviceInventoryMapper; |
| | | import com.by4cloud.platformx.device.mapper.ReceivingNoteItemMapper; |
| | | import com.by4cloud.platformx.device.mapper.ReceivingNoteMapper; |
| | | import com.by4cloud.platformx.device.entity.*; |
| | | import com.by4cloud.platformx.device.mapper.*; |
| | | import com.by4cloud.platformx.device.service.ReceivingNoteService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | private final ReceivingNoteItemMapper itemMapper; |
| | | private final DeviceInventoryMapper inventoryMapper; |
| | | private final InventoryFlowWaterMapper inventoryFlowWaterMapper; |
| | | private final DeviceMapper deviceMapper; |
| | | private final ContractMapper contractMapper; |
| | | |
| | | @Override |
| | | public IPage pageNew(Page page, ReceivingNoteQueryDTO queryDTO) { |
| | |
| | | if (item.getSerialNos()!=null&&item.getSerialNos().size()>0){ |
| | | for (String serialNo:item.getSerialNos() |
| | | ) { |
| | | DeviceInventory inventory = new DeviceInventory(); |
| | | inventory.setDeviceId(item.getDeviceId()); |
| | | inventory.setDeviceNumber(item.getDeviceCode()); |
| | | inventory.setName(item.getDeviceName()); |
| | | inventory.setSerialNo(serialNo); |
| | | inventory.setSource(1); |
| | | inventoryMapper.insert(inventory); |
| | | Device device = deviceMapper.selectById(item.getDeviceId()); |
| | | Contract contract = contractMapper.selectById(entity.getContractId()); |
| | | if (device!=null) { |
| | | DeviceInventory inventory = new DeviceInventory(); |
| | | inventory.setDeviceId(item.getDeviceId()); |
| | | inventory.setDeviceNumber(item.getDeviceCode()); |
| | | inventory.setName(device.getName()); |
| | | inventory.setSerialNo(serialNo); |
| | | if (contract!=null&&(contract.getType()==1||contract.getType()==2)){ |
| | | inventory.setSource(1); |
| | | inventory.setInventoryStatus(1); |
| | | } |
| | | if (contract!=null&&contract.getType()==0){ |
| | | inventory.setSource(1); |
| | | inventory.setInventoryStatus(2); |
| | | } |
| | | inventoryMapper.insert(inventory); |
| | | //设备库存流水同步新增 |
| | | InventoryFlowWater flowWater = new InventoryFlowWater(); |
| | | flowWater.setDeviceId(item.getDeviceId()); |
| | | flowWater.setSerialNo(serialNo); |
| | | flowWater.setInventoryId(inventory.getId()); |
| | | flowWater.setClassId(device.getClassId()); |
| | | if (contract!=null&&(contract.getType()==1||contract.getType()==2)){ |
| | | flowWater.setOperateType(2); |
| | | } |
| | | if (contract!=null&&contract.getType()==0){ |
| | | flowWater.setOperateType(1); |
| | | } |
| | | inventoryFlowWaterMapper.insert(flowWater); |
| | | } |
| | | } |
| | | |
| | | } |