Esempio n. 1
0
function laptop418()
{
    $query = M('Db')->createQuery('tmp_equipment_export')->what('city_id, user_id, `laptop-418` as serial')->where('`laptop-418` IS NOT NULL AND `laptop-418` != ""');
    $request = M('Store')->requestQuery(M('Store')->factoryObject(), $query);
    $created_laptop = 0;
    foreach ($request as $object) {
        if (isNull($obEquipment = getEquipmentByTypeAndSerial(RM_Equipment_Entity::LAPTOP, $object->serial))) {
            $obHolder = getRegionHolderByCityId($object->city_id);
            $obEquipment = M('Equipment')->create(array('type' => RM_Equipment_Entity::LAPTOP, 'state' => RM_Equipment_Entity_State::WORK, 'serial_number' => $object->serial, 'producer' => 'Rover', 'model' => '418'));
            $obEquipment->setHolder($obHolder);
            $obEquipment->save();
            $created_laptop++;
        }
        M('Db')->exec('UPDATE tmp_equipment_export SET laptop_id = ? WHERE user_id = ?', $obEquipment->id, $object->user_id);
    }
    echo 'created ' . $created_laptop . ' computers';
    return TRUE;
}
Esempio n. 2
0
function modemComDlink()
{
    $query = M('Db')->createQuery('tmp_equipment_export')->what('city_id, user_id, `modem-com-d-link` as serial')->where('`modem-com-d-link` IS NOT NULL AND `modem-com-d-link` != ""');
    $request = M('Store')->requestQuery(M('Store')->factoryObject(), $query);
    $created_modem = 0;
    foreach ($request as $object) {
        if (isNull($obEquipment = getEquipmentByTypeAndSerial(RM_Equipment_Entity::MODEM, $object->serial))) {
            $obHolder = getRegionHolderByCityId($object->city_id);
            $obEquipment = M('Equipment')->create(array('type' => RM_Equipment_Entity::MODEM, 'state' => RM_Equipment_Entity_State::WORK, 'serial_number' => $object->serial, 'producer' => 'D-Link', 'port_type' => 'COM'));
            $obEquipment->setHolder($obHolder);
            $obEquipment->save();
            $created_modem++;
        }
        M('Db')->exec('UPDATE tmp_equipment_export SET modem_id = ? WHERE user_id = ?', $obEquipment->id, $object->user_id);
    }
    echo 'created ' . $created_modem . ' modems';
    return TRUE;
}
Esempio n. 3
0
function scaner2140()
{
    $query = M('Db')->createQuery('tmp_equipment_export')->what('city_id, user_id, `scaner-2140` as serial')->where('`scaner-2140` IS NOT NULL AND `scaner-2140` != ""');
    $request = M('Store')->requestQuery(M('Store')->factoryObject(), $query);
    $created_2140 = 0;
    foreach ($request as $object) {
        if (isNull($obEquipment = getEquipmentByTypeAndSerial(RM_Equipment_Entity::SCANER, $object->serial))) {
            $obHolder = getRegionHolderByCityId($object->city_id);
            $obEquipment = M('Equipment')->create(array('type' => RM_Equipment_Entity::SCANER, 'state' => RM_Equipment_Entity_State::WORK, 'serial_number' => $object->serial, 'producer' => 'Протон', 'model' => '2140', 'port_type' => 'USB'));
            $obEquipment->setHolder($obHolder);
            $obEquipment->save();
            $created_2140++;
        }
        M('Db')->exec('UPDATE tmp_equipment_export SET scaner_id = ? WHERE user_id = ?', $obEquipment->id, $object->user_id);
    }
    echo 'created ' . $created_2140 . ' scaners';
    return TRUE;
}